hostapd: add op-class to get_status output
authorDavid Bauer <mail@david-bauer.net>
Sat, 8 Jan 2022 11:25:42 +0000 (12:25 +0100)
committerDavid Bauer <mail@david-bauer.net>
Fri, 14 Jan 2022 21:12:44 +0000 (22:12 +0100)
Include the current operation class to hostapd get_status interface.

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

index bcb80f4a33428ac042fc7558fbaf6da51ba4f407..3c016124f99ed89f8bfd99f6cae57b9aa4693e78 100644 (file)
@@ -411,9 +411,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));
@@ -424,7 +430,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);
@@ -1930,4 +1937,4 @@ int hostapd_ubus_notify_bss_transition_query(
 
        return ureq.resp;
 #endif
-}
\ No newline at end of file
+}