From c1492838f74f8ce366b2195670fd3f5d744015d9 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Tue, 29 Jul 2025 14:04:16 +0200 Subject: [PATCH] hostapd: add reporting detail support to RRM beacon request 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 --- .../network/services/hostapd/src/src/ap/ubus.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/package/network/services/hostapd/src/src/ap/ubus.c b/package/network/services/hostapd/src/src/ap/ubus.c index 71b7911b05..5e562b62c9 100644 --- a/package/network/services/hostapd/src/src/ap/ubus.c +++ b/package/network/services/hostapd/src/src/ap/ubus.c @@ -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;