3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-16 17:09:24 +01:00

monitor: fix the CQM RSSI threshold attribute

This attribute is actually an array of signed 32 bit integers and it
was being treated as a single integer. This would work until more
than one threshold was set, then it would fail to parse it.
This commit is contained in:
James Prestwood 2024-07-26 05:18:08 -07:00 committed by Denis Kenzior
parent f9a55e3728
commit d8803b309d

View File

@ -5618,8 +5618,26 @@ static void print_cqm_event(unsigned int level, const char *label,
} }
} }
static void print_cqm_thresholds(unsigned int level, const char *label,
const void *data, uint16_t size)
{
const int32_t *thresholds = data;
unsigned int i;
if (size % 4) {
printf("malformed packet");
return;
}
print_attr(level, "%s:", label);
for (i = 0; i < size / 4; i++)
print_attr(level + 1, "Threshold: %d", thresholds[i]);
}
static const struct attr_entry cqm_table[] = { static const struct attr_entry cqm_table[] = {
{ NL80211_ATTR_CQM_RSSI_THOLD, "RSSI threshold", ATTR_U32 }, { NL80211_ATTR_CQM_RSSI_THOLD, "RSSI thresholds", ATTR_CUSTOM,
{ .function = print_cqm_thresholds } },
{ NL80211_ATTR_CQM_RSSI_HYST, "RSSI hysteresis", ATTR_U32 }, { NL80211_ATTR_CQM_RSSI_HYST, "RSSI hysteresis", ATTR_U32 },
{ NL80211_ATTR_CQM_RSSI_THRESHOLD_EVENT, { NL80211_ATTR_CQM_RSSI_THRESHOLD_EVENT,
"RSSI threshold event", ATTR_CUSTOM, "RSSI threshold event", ATTR_CUSTOM,