[openwrt/openwrt] hostapd: add op-class to get_status output

LEDE Commits lede-commits at lists.infradead.org
Sat Mar 19 17:34:55 PDT 2022


blocktrron pushed a commit to openwrt/openwrt.git, branch openwrt-21.02:
https://git.openwrt.org/411c73f7486c9e16ade32222d30521e60ead5275

commit 411c73f7486c9e16ade32222d30521e60ead5275
Author: David Bauer <mail at david-bauer.net>
AuthorDate: Sat Jan 8 12:25:42 2022 +0100

    hostapd: add op-class to get_status output
    
    Include the current operation class to hostapd get_status interface.
    
    Signed-off-by: David Bauer <mail at david-bauer.net>
    (cherry picked from commit 2a31e9ca975d99b6216b2979a825f07253c8947e)
---
 package/network/services/hostapd/src/src/ap/ubus.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/package/network/services/hostapd/src/src/ap/ubus.c b/package/network/services/hostapd/src/src/ap/ubus.c
index a9cded0113..29a4af8ebd 100644
--- a/package/network/services/hostapd/src/src/ap/ubus.c
+++ b/package/network/services/hostapd/src/src/ap/ubus.c
@@ -409,9 +409,15 @@ hostapd_bss_get_status(struct ubus_context *ctx, struct ubus_object *obj,
 	char ssid[SSID_MAX_LEN + 1];
 	char phy_name[17];
 	size_t ssid_len = SSID_MAX_LEN;
+	u8 channel = 0, op_class = 0;
 
 	if (hapd->conf->ssid.ssid_len < SSID_MAX_LEN)
 		ssid_len = hapd->conf->ssid.ssid_len;
+	
+	ieee80211_freq_to_channel_ext(hapd->iface->freq,
+				      hapd->iconf->secondary_channel,
+				      hostapd_get_oper_chwidth(hapd->iconf),
+				      &op_class, &channel);
 
 	blob_buf_init(&b, 0);
 	blobmsg_add_string(&b, "status", hostapd_state_text(hapd->iface->state));
@@ -422,7 +428,8 @@ hostapd_bss_get_status(struct ubus_context *ctx, struct ubus_object *obj,
 	blobmsg_add_string(&b, "ssid", ssid);
 
 	blobmsg_add_u32(&b, "freq", hapd->iface->freq);
-	blobmsg_add_u32(&b, "channel", ieee80211_frequency_to_channel(hapd->iface->freq));
+	blobmsg_add_u32(&b, "channel", channel);
+	blobmsg_add_u32(&b, "op_class", op_class);
 	blobmsg_add_u32(&b, "beacon_interval", hapd->iconf->beacon_int);
 
 	snprintf(phy_name, 17, "%s", hapd->iface->phy);




More information about the lede-commits mailing list