ubus: don't request measurement from unsupported STAs
authorDavid Bauer <mail@david-bauer.net>
Mon, 25 Oct 2021 19:49:05 +0000 (21:49 +0200)
committerDavid Bauer <mail@david-bauer.net>
Thu, 25 Nov 2021 22:04:56 +0000 (23:04 +0100)
Don't request measurements from STAs which do not support the specific
measurement mode. Otherwise, hostapd complains in the syslog about
unsupported measurement modes.

Signed-off-by: David Bauer <mail@david-bauer.net>
sta.c
ubus.c
usteer.h

diff --git a/sta.c b/sta.c
index 54bcaeb2a5c4e827ed7bcf1dcc7217ac3e860863..7bca10ec02b05d5d3f001828e34981a57fba0409 100644 (file)
--- a/sta.c
+++ b/sta.c
@@ -202,6 +202,21 @@ usteer_handle_sta_event(struct usteer_node *node, const uint8_t *addr,
        return ret;
 }
 
+bool
+usteer_sta_supports_beacon_measurement_mode(struct sta *sta, enum usteer_beacon_measurement_mode mode)
+{
+       switch (mode) {
+               case BEACON_MEASUREMENT_PASSIVE:
+                       return sta->rrm & (1 << 4);
+               case BEACON_MEASUREMENT_ACTIVE:
+                       return sta->rrm & (1 << 5);
+               case BEACON_MEASUREMENT_TABLE:
+                       return sta->rrm & (1 << 6);
+       }
+
+       return false;
+}
+
 static void __usteer_init usteer_sta_init(void)
 {
        usteer_timeout_init(&tq);
diff --git a/ubus.c b/ubus.c
index 2bd8ac8af1fa1b3e05238fec9d13517b5653638f..fabc1a678dc8b364cb4c8a4b96240d712e088156 100644 (file)
--- a/ubus.c
+++ b/ubus.c
@@ -547,6 +547,11 @@ int usteer_ubus_trigger_client_scan(struct sta_info *si)
 {
        struct usteer_local_node *ln = container_of(si->node, struct usteer_local_node, node);
 
+       if (!usteer_sta_supports_beacon_measurement_mode(si->sta, BEACON_MEASUREMENT_ACTIVE)) {
+               MSG(DEBUG, "STA does not support beacon measurement sta=" MAC_ADDR_FMT "\n", MAC_ADDR_DATA(si->sta->addr));
+               return 0;
+       }
+
        si->scan_band = !si->scan_band;
 
        blob_buf_init(&b, 0);
index 694e492b8eae176f9af45d8c624d61c04769f40a..292bcc0636882eccd5a43e0697a761ef64f436d5 100644 (file)
--- a/usteer.h
+++ b/usteer.h
@@ -271,6 +271,8 @@ int usteer_ubus_notify_client_disassoc(struct sta_info *si);
 struct sta *usteer_sta_get(const uint8_t *addr, bool create);
 struct sta_info *usteer_sta_info_get(struct sta *sta, struct usteer_node *node, bool *create);
 
+bool usteer_sta_supports_beacon_measurement_mode(struct sta *sta, enum usteer_beacon_measurement_mode mode);
+
 void usteer_sta_info_update_timeout(struct sta_info *si, int timeout);
 void usteer_sta_info_update(struct sta_info *si, int signal, bool avg);