]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
hostapd: add reporting detail support to RRM beacon request
authorJohn Crispin <john@phrozen.org>
Tue, 29 Jul 2025 12:04:16 +0000 (14:04 +0200)
committerFelix Fietkau <nbd@nbd.name>
Mon, 26 Jan 2026 17:46:16 +0000 (17:46 +0000)
Extend the hostapd_rrm_beacon_req ubus method to support the optional
reporting_detail parameter as defined in IEEE 802.11-2016 section 9.4.2.21.7.

Also fix missing assignment operators (=) in the beacon_req_policy array
initialisation.

Signed-off-by: John Crispin <john@phrozen.org>
package/network/services/hostapd/src/src/ap/ubus.c

index 71b7911b056ea12ee81e954c301db9175848f6a0..5e562b62c93bb07d925b4c48cf47f8d6105460a1 100644 (file)
@@ -1159,6 +1159,8 @@ enum {
        BEACON_REQ_DURATION,
        BEACON_REQ_BSSID,
        BEACON_REQ_SSID,
+       BEACON_REQ_REPORTING_DETAIL,
+       BEACON_REQ_CHANNEL_REPORTS,
        __BEACON_REQ_MAX,
 };
 
@@ -1170,6 +1172,8 @@ static const struct blobmsg_policy beacon_req_policy[__BEACON_REQ_MAX] = {
        [BEACON_REQ_MODE] = { "mode", BLOBMSG_TYPE_INT32 },
        [BEACON_REQ_BSSID] = { "bssid", BLOBMSG_TYPE_STRING },
        [BEACON_REQ_SSID] = { "ssid", BLOBMSG_TYPE_STRING },
+       [BEACON_REQ_REPORTING_DETAIL] = { "reporting_detail", BLOBMSG_TYPE_INT32 },
+       [BEACON_REQ_CHANNEL_REPORTS] = { "channel_reports", BLOBMSG_TYPE_ARRAY },
 };
 
 static int
@@ -1185,6 +1189,7 @@ hostapd_rrm_beacon_req(struct ubus_context *ctx, struct ubus_object *obj,
        u8 addr[ETH_ALEN];
        int mode, rem, ret;
        int buf_len = 13;
+       int reporting_detail = 255;
 
        blobmsg_parse(beacon_req_policy, __BEACON_REQ_MAX, tb, blob_data(msg), blob_len(msg));
 
@@ -1203,6 +1208,9 @@ hostapd_rrm_beacon_req(struct ubus_context *ctx, struct ubus_object *obj,
            hwaddr_aton(blobmsg_data(tb[BEACON_REQ_BSSID]), bssid))
                return UBUS_STATUS_INVALID_ARGUMENT;
 
+       if (tb[BEACON_REQ_REPORTING_DETAIL])
+               reporting_detail = blobmsg_get_u32(tb[BEACON_REQ_REPORTING_DETAIL]);
+
        req = wpabuf_alloc(buf_len);
        if (!req)
                return UBUS_STATUS_UNKNOWN_ERROR;
@@ -1231,6 +1239,14 @@ hostapd_rrm_beacon_req(struct ubus_context *ctx, struct ubus_object *obj,
                wpabuf_put_data(req, blobmsg_data(cur), blobmsg_data_len(cur) - 1);
        }
 
+       /* as per 9-106 */
+       if (reporting_detail >= 0 && reporting_detail < 3) {
+               /* as per 9-104 */
+               wpabuf_put_u8(req, 2);
+               wpabuf_put_u8(req, 1);
+               wpabuf_put_le16(req, reporting_detail);
+       }
+
        ret = hostapd_send_beacon_req(hapd, addr, 0, req);
        if (ret < 0)
                return -ret;