local-node: fetch bss-transition-management support
authorDavid Bauer <mail@david-bauer.net>
Fri, 18 Feb 2022 23:03:51 +0000 (00:03 +0100)
committerDavid Bauer <mail@david-bauer.net>
Sat, 19 Feb 2022 15:10:34 +0000 (16:10 +0100)
Signed-off-by: David Bauer <mail@david-bauer.net>
local_node.c
usteer.h

index b12f7fdb70f7e2629fa130507d957350e245aae4..0e476c7460244756a1da5000bce50ad720957118 100644 (file)
@@ -344,14 +344,20 @@ usteer_local_node_assoc_update(struct sta_info *si, struct blob_attr *data)
 }
 
 static void
-usteer_local_node_update_sta_rrm(const uint8_t *addr, struct blob_attr *client_attr)
+usteer_local_node_update_sta_rrm_wnm(const uint8_t *addr, struct blob_attr *client_attr)
 {
        static const struct blobmsg_policy rrm_policy = {
                .name = "rrm",
                .type = BLOBMSG_TYPE_ARRAY,
        };
-       struct blob_attr *sta_blob = NULL;
+       static const struct blobmsg_policy ext_capa_policy = {
+               .name = "extended_capabilities",
+               .type = BLOBMSG_TYPE_ARRAY,
+       };
+       struct blob_attr *rrm_blob = NULL, *wnm_blob = NULL, *cur;
        struct sta *sta;
+       int rem;
+       int i = 0;
 
        if (!addr)
                return;
@@ -361,11 +367,29 @@ usteer_local_node_update_sta_rrm(const uint8_t *addr, struct blob_attr *client_a
        if (!sta)
                return;
 
-       blobmsg_parse(&rrm_policy, 1, &sta_blob, blobmsg_data(client_attr), blobmsg_data_len(client_attr));
-       if (!sta_blob)
+       /* RRM */
+       blobmsg_parse(&rrm_policy, 1, &rrm_blob, blobmsg_data(client_attr), blobmsg_data_len(client_attr));
+       if (!rrm_blob)
                return;
 
-       sta->rrm = blobmsg_get_u32(blobmsg_data(sta_blob));
+       sta->rrm = blobmsg_get_u32(blobmsg_data(rrm_blob));
+
+       /* Extended Capabilities / WNM */
+       blobmsg_parse(&ext_capa_policy, 1, &wnm_blob, blobmsg_data(client_attr), blobmsg_data_len(client_attr));
+       if (!wnm_blob)
+               return;
+
+       blobmsg_for_each_attr(cur, wnm_blob, rem) {
+               if (blobmsg_type(cur) != BLOBMSG_TYPE_INT32)
+                       return;
+               
+               if (i == 2) {
+                       if (blobmsg_get_u32(cur) & (1 << 3))
+                               sta->bss_transition = true;
+               }
+
+               i++;
+       }
 }
 
 static void
@@ -408,7 +432,7 @@ usteer_local_node_set_assoc(struct usteer_local_node *ln, struct blob_attr *cl)
                }
 
                /* Read RRM information */
-               usteer_local_node_update_sta_rrm(addr, cur);
+               usteer_local_node_update_sta_rrm_wnm(addr, cur);
        }
 
        node->n_assoc = n_assoc;
index a7d0bf44804f9cb7f2d5b6228d316ea7fbfec9df..911ee694049e273cd07dd3d8a7451d8406b4d9cc 100644 (file)
--- a/usteer.h
+++ b/usteer.h
@@ -269,6 +269,7 @@ struct sta {
        uint8_t addr[6];
 
        uint8_t rrm;
+       bool bss_transition;
 };
 
 struct usteer_beacon_report {