aboutsummaryrefslogtreecommitdiffstats
path: root/package/network/services/hostapd
diff options
context:
space:
mode:
authorDavid Bauer <mail@david-bauer.net>2020-10-11 17:45:01 +0200
committerDavid Bauer <mail@david-bauer.net>2020-11-17 17:04:33 +0100
commitcd8052da4998b50219573faa80ac4ddc8a4dcebf (patch)
tree05ade5f1ff912728d23e3f5463e458cc4d921fb4 /package/network/services/hostapd
parent7463a0b5ee65bae85c2a9e1bfcc86b0727b5b0ee (diff)
downloadupstream-cd8052da4998b50219573faa80ac4ddc8a4dcebf.tar.gz
upstream-cd8052da4998b50219573faa80ac4ddc8a4dcebf.tar.bz2
upstream-cd8052da4998b50219573faa80ac4ddc8a4dcebf.zip
hostapd: ubus: add driver information to client list
This adds information from mac80211 to hostapd get_client ubus function. This way, TX as well as RX status information as well as the signal can be determined. Signed-off-by: David Bauer <mail@david-bauer.net>
Diffstat (limited to 'package/network/services/hostapd')
-rw-r--r--package/network/services/hostapd/src/src/ap/ubus.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/package/network/services/hostapd/src/src/ap/ubus.c b/package/network/services/hostapd/src/src/ap/ubus.c
index 5a5dd1a889..cdbb8076d3 100644
--- a/package/network/services/hostapd/src/src/ap/ubus.c
+++ b/package/network/services/hostapd/src/src/ap/ubus.c
@@ -212,6 +212,7 @@ hostapd_bss_get_clients(struct ubus_context *ctx, struct ubus_object *obj,
struct blob_attr *msg)
{
struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj);
+ struct hostap_sta_driver_data sta_driver_data;
struct sta_info *sta;
void *list, *c;
char mac_buf[20];
@@ -254,6 +255,29 @@ hostapd_bss_get_clients(struct ubus_context *ctx, struct ubus_object *obj,
if (retrieve_sta_taxonomy(hapd, sta, r, 1024) > 0)
blobmsg_add_string_buffer(&b);
#endif
+
+ /* Driver information */
+ if (hostapd_drv_read_sta_data(hapd, &sta_driver_data, sta->addr) >= 0) {
+ r = blobmsg_open_table(&b, "bytes");
+ blobmsg_add_u64(&b, "rx", sta_driver_data.rx_bytes);
+ blobmsg_add_u64(&b, "tx", sta_driver_data.tx_bytes);
+ blobmsg_close_table(&b, r);
+ r = blobmsg_open_table(&b, "airtime");
+ blobmsg_add_u64(&b, "rx", sta_driver_data.rx_airtime);
+ blobmsg_add_u64(&b, "tx", sta_driver_data.tx_airtime);
+ blobmsg_close_table(&b, r);
+ r = blobmsg_open_table(&b, "packets");
+ blobmsg_add_u32(&b, "rx", sta_driver_data.rx_packets);
+ blobmsg_add_u32(&b, "tx", sta_driver_data.tx_packets);
+ blobmsg_close_table(&b, r);
+ r = blobmsg_open_table(&b, "rate");
+ /* Rate in kbits */
+ blobmsg_add_u32(&b, "rx", sta_driver_data.current_rx_rate * 100);
+ blobmsg_add_u32(&b, "tx", sta_driver_data.current_tx_rate * 100);
+ blobmsg_close_table(&b, r);
+ blobmsg_add_u32(&b, "signal", sta_driver_data.signal);
+ }
+
blobmsg_close_table(&b, c);
}
blobmsg_close_array(&b, list);