hostapd: ubus: add (V)HT capabilities to client list
authorDavid Bauer <mail@david-bauer.net>
Mon, 12 Oct 2020 01:10:20 +0000 (03:10 +0200)
committerDavid Bauer <mail@david-bauer.net>
Wed, 28 Oct 2020 19:22:02 +0000 (20:22 +0100)
This adds HT as well as VHT capability information to the hostapd
get_clients method.

Signed-off-by: David Bauer <mail@david-bauer.net>
package/network/services/hostapd/src/src/ap/ubus.c

index dc9f75310df61c46576fbb59c95a3d0f5514b3e3..ba8f0e818e19a6a6d2841a30f50037657d6cce96 100644 (file)
@@ -209,6 +209,44 @@ hostapd_bss_reload(struct ubus_context *ctx, struct ubus_object *obj,
        return ret;
 }
 
+
+static void
+hostapd_parse_vht_capab_blobmsg(struct ieee80211_vht_capabilities *vht_capabilities)
+{
+       blobmsg_add_u32(&b, "raw", vht_capabilities->vht_capabilities_info);
+       blobmsg_add_u16(&b, "mcs_rx_map", vht_capabilities->vht_supported_mcs_set.rx_map);
+       blobmsg_add_u16(&b, "mcs_rx_highest", vht_capabilities->vht_supported_mcs_set.rx_highest);
+       blobmsg_add_u16(&b, "mcs_tx_map", vht_capabilities->vht_supported_mcs_set.tx_map);
+       blobmsg_add_u16(&b, "mcs_tx_highest", vht_capabilities->vht_supported_mcs_set.tx_highest);
+}
+
+static void
+hostapd_parse_ht_capab_blobmsg(struct ieee80211_ht_capabilities *ht_capabilities)
+{
+       blobmsg_add_u16(&b, "raw", ht_capabilities->ht_capabilities_info);
+}
+
+static void
+hostapd_parse_capab_blobmsg(struct sta_info *sta)
+{
+       void *r, *v;
+
+       v = blobmsg_open_table(&b, "capabilities");
+       if (sta->vht_capabilities) {
+               r = blobmsg_open_table(&b, "vht");
+               hostapd_parse_vht_capab_blobmsg(sta->vht_capabilities);
+               blobmsg_close_table(&b, r);
+       }
+
+       if (sta->ht_capabilities) {
+               r = blobmsg_open_table(&b, "ht");
+               hostapd_parse_ht_capab_blobmsg(sta->ht_capabilities);
+               blobmsg_close_table(&b, r);
+       }
+
+       blobmsg_close_table(&b, v);
+}
+
 static int
 hostapd_bss_get_clients(struct ubus_context *ctx, struct ubus_object *obj,
                        struct ubus_request_data *req, const char *method,
@@ -282,6 +320,8 @@ hostapd_bss_get_clients(struct ubus_context *ctx, struct ubus_object *obj,
                blobmsg_close_table(&b,r);
                blobmsg_add_u32(&b, "signal", sta_driver_data.signal);
 
+               hostapd_parse_capab_blobmsg(sta);
+
                blobmsg_close_table(&b, c);
        }
        blobmsg_close_array(&b, list);