From 59a4cd63b810052e33da941ff21acc8467c2a920 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Thu, 26 Mar 2020 00:28:27 +0100 Subject: [PATCH] gluon-respondd: expose OWE clients in nodeinfo Provide the number of OWE stations in addition to the number of all connected wireless clients. --- package/gluon-respondd/src/respondd-statistics.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/package/gluon-respondd/src/respondd-statistics.c b/package/gluon-respondd/src/respondd-statistics.c index 634b2942..baf49c64 100644 --- a/package/gluon-respondd/src/respondd-statistics.c +++ b/package/gluon-respondd/src/respondd-statistics.c @@ -239,7 +239,7 @@ static void count_iface_stations(size_t *wifi24, size_t *wifi5, const char *ifna } } -static void count_stations(size_t *wifi24, size_t *wifi5) { +static void count_stations(size_t *wifi24, size_t *wifi5, size_t *owe24, size_t owe5) { struct uci_context *ctx = uci_alloc_context(); if (!ctx) return; @@ -269,6 +269,9 @@ static void count_stations(size_t *wifi24, size_t *wifi5) { if (!ifname) continue; + if (strstr(ifname, "owe") == ifname) + count_iface_stations(owe24, owe5, ifname); + count_iface_stations(wifi24, wifi5, ifname); } @@ -277,9 +280,9 @@ static void count_stations(size_t *wifi24, size_t *wifi5) { } static struct json_object * get_clients(void) { - size_t wifi24 = 0, wifi5 = 0; + size_t wifi24 = 0, wifi5 = 0, owe24 = 0, owe5 = 0; - count_stations(&wifi24, &wifi5); + count_stations(&wifi24, &wifi5, &owe24, &owe5); struct json_object *ret = json_object_new_object(); @@ -287,6 +290,10 @@ static struct json_object * get_clients(void) { json_object_object_add(ret, "wifi24", json_object_new_int(wifi24)); json_object_object_add(ret, "wifi5", json_object_new_int(wifi5)); + json_object_object_add(ret, "owe", json_object_new_int(owe24 + owe5)); + json_object_object_add(ret, "owe24", json_object_new_int(owe24)); + json_object_object_add(ret, "owe5", json_object_new_int(owe5)); + return ret; }