From 359ad1bf98a754393556a19fbfa7522398028c68 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Mon, 12 Oct 2020 03:10:20 +0200 Subject: [PATCH] hostapd: ubus: add (V)HT capabilities to client list This adds HT as well as VHT capability information to the hostapd get_clients method. Signed-off-by: David Bauer --- .../services/hostapd/src/src/ap/ubus.c | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/package/network/services/hostapd/src/src/ap/ubus.c b/package/network/services/hostapd/src/src/ap/ubus.c index dc9f75310d..ba8f0e818e 100644 --- a/package/network/services/hostapd/src/src/ap/ubus.c +++ b/package/network/services/hostapd/src/src/ap/ubus.c @@ -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); -- 2.30.2