diff mbox series

monitor: fix the CQM RSSI threshold attribute

Message ID 20240726121808.1629079-1-prestwoj@gmail.com (mailing list archive)
State Accepted, archived
Headers show
Series monitor: fix the CQM RSSI threshold attribute | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
prestwoj/iwd-alpine-ci-fetch success Fetch PR
prestwoj/iwd-ci-gitlint success GitLint
prestwoj/iwd-ci-fetch success Fetch PR
prestwoj/iwd-alpine-ci-setupell success Prep - Setup ELL
prestwoj/iwd-ci-setupell success Prep - Setup ELL
prestwoj/iwd-ci-makedistcheck success Make Distcheck
prestwoj/iwd-ci-incremental_build success Incremental build not run PASS
prestwoj/iwd-ci-build success Build - Configure
prestwoj/iwd-alpine-ci-makedistcheck success Make Distcheck
prestwoj/iwd-alpine-ci-incremental_build success Incremental build not run PASS
prestwoj/iwd-alpine-ci-build success Build - Configure
prestwoj/iwd-ci-makecheckvalgrind success Make Check w/Valgrind
prestwoj/iwd-ci-makecheck success Make Check
prestwoj/iwd-ci-clang success clang PASS
prestwoj/iwd-alpine-ci-makecheckvalgrind success Make Check w/Valgrind
prestwoj/iwd-alpine-ci-makecheck success Make Check
prestwoj/iwd-ci-testrunner success test-runner PASS

Commit Message

James Prestwood July 26, 2024, 12:18 p.m. UTC
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.
---
 monitor/nlmon.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

Comments

Denis Kenzior July 26, 2024, 2:53 p.m. UTC | #1
Hi James,

On 7/26/24 7:18 AM, James Prestwood wrote:
> 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.
> ---
>   monitor/nlmon.c | 20 +++++++++++++++++++-
>   1 file changed, 19 insertions(+), 1 deletion(-)

Applied, thanks.

Regards,
-Denis
diff mbox series

Patch

diff --git a/monitor/nlmon.c b/monitor/nlmon.c
index a900f7cc..e5cd5451 100644
--- a/monitor/nlmon.c
+++ b/monitor/nlmon.c
@@ -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[] = {
-	{ 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_THRESHOLD_EVENT,
 					"RSSI threshold event",	ATTR_CUSTOM,