From: Aloka Dixit Date: Tue, 4 Apr 2023 17:59:00 +0000 (-0700) Subject: nl80211: Support for RNR elements X-Git-Tag: hostap_2_11~1208 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ac54b612739751c4d9548cca9ce86aa670477279;p=thirdparty%2Fhostap.git nl80211: Support for RNR elements Add new nested netlink attribute, NL80211_ATTR_EMA_RNR_ELEMS, to send the reduced neighbor report (RNR) elements to the driver when EMA is enabled. This attribute includes the count of RNR elements and data at each index. While generating EMA beacons, the driver will include RNR group at a given index along with MBSSID group. The last element, if present, has RNR data common for all EMA beacons such as neighbor APs. Signed-off-by: Aloka Dixit --- diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index 31be2a547..467f46cf4 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -4725,6 +4725,28 @@ static int nl80211_mbssid(struct nl_msg *msg, nla_nest_end(msg, elems); } + if (!params->ema) + return 0; + + if (params->rnr_elem_count && params->rnr_elem_len && + params->rnr_elem_offset && *params->rnr_elem_offset) { + u8 i, **offs = params->rnr_elem_offset; + + elems = nla_nest_start(msg, NL80211_ATTR_EMA_RNR_ELEMS); + if (!elems) + return -1; + + for (i = 0; i < params->rnr_elem_count - 1; i++) { + if (nla_put(msg, i + 1, offs[i + 1] - offs[i], offs[i])) + return -1; + } + + if (nla_put(msg, i + 1, *offs + params->rnr_elem_len - offs[i], + offs[i])) + return -1; + nla_nest_end(msg, elems); + } + return 0; }