From: Markus Theil Date: Fri, 24 Jan 2020 16:24:53 +0000 (+0100) Subject: Send RM Enabled Capabilities element in (Re)Association Response frame X-Git-Tag: hostap_2_10~1855 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=96a2a9a88bd8dab584ace9922c76a815c498f352;p=thirdparty%2Fhostap.git Send RM Enabled Capabilities element in (Re)Association Response frame (Re)Association Response frames should include radio measurement capabilities in order to let stations know if they can, e.g., use neighbor requests. I tested this commit with a Samsung S8, which does not send neighbor requests without this commit and sends them afterwards. Signed-off-by: Markus Theil --- diff --git a/src/ap/beacon.c b/src/ap/beacon.c index 29c7e383d..ecee27aa6 100644 --- a/src/ap/beacon.c +++ b/src/ap/beacon.c @@ -36,27 +36,6 @@ #ifdef NEED_AP_MLME -static u8 * hostapd_eid_rm_enabled_capab(struct hostapd_data *hapd, u8 *eid, - size_t len) -{ - size_t i; - - for (i = 0; i < RRM_CAPABILITIES_IE_LEN; i++) { - if (hapd->conf->radio_measurements[i]) - break; - } - - if (i == RRM_CAPABILITIES_IE_LEN || len < 2 + RRM_CAPABILITIES_IE_LEN) - return eid; - - *eid++ = WLAN_EID_RRM_ENABLED_CAPABILITIES; - *eid++ = RRM_CAPABILITIES_IE_LEN; - os_memcpy(eid, hapd->conf->radio_measurements, RRM_CAPABILITIES_IE_LEN); - - return eid + RRM_CAPABILITIES_IE_LEN; -} - - static u8 * hostapd_eid_bss_load(struct hostapd_data *hapd, u8 *eid, size_t len) { if (len < 2 + 5) diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c index c93872da4..625e10b4b 100644 --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c @@ -199,6 +199,27 @@ u8 * hostapd_eid_ext_supp_rates(struct hostapd_data *hapd, u8 *eid) } +u8 * hostapd_eid_rm_enabled_capab(struct hostapd_data *hapd, u8 *eid, + size_t len) +{ + size_t i; + + for (i = 0; i < RRM_CAPABILITIES_IE_LEN; i++) { + if (hapd->conf->radio_measurements[i]) + break; + } + + if (i == RRM_CAPABILITIES_IE_LEN || len < 2 + RRM_CAPABILITIES_IE_LEN) + return eid; + + *eid++ = WLAN_EID_RRM_ENABLED_CAPABILITIES; + *eid++ = RRM_CAPABILITIES_IE_LEN; + os_memcpy(eid, hapd->conf->radio_measurements, RRM_CAPABILITIES_IE_LEN); + + return eid + RRM_CAPABILITIES_IE_LEN; +} + + u16 hostapd_own_capab_info(struct hostapd_data *hapd) { int capab = WLAN_CAPABILITY_ESS; @@ -3684,6 +3705,9 @@ static u16 send_assoc_resp(struct hostapd_data *hapd, struct sta_info *sta, /* Extended supported rates */ p = hostapd_eid_ext_supp_rates(hapd, p); + /* Radio measurement capabilities */ + p = hostapd_eid_rm_enabled_capab(hapd, p, buf + buflen - p); + #ifdef CONFIG_MBO if (status_code == WLAN_STATUS_DENIED_POOR_CHANNEL_CONDITIONS && rssi != 0) { diff --git a/src/ap/ieee802_11.h b/src/ap/ieee802_11.h index 0983d4c8b..635fc8cd6 100644 --- a/src/ap/ieee802_11.h +++ b/src/ap/ieee802_11.h @@ -49,6 +49,8 @@ u8 * hostapd_eid_ext_capab(struct hostapd_data *hapd, u8 *eid); u8 * hostapd_eid_qos_map_set(struct hostapd_data *hapd, u8 *eid); u8 * hostapd_eid_supp_rates(struct hostapd_data *hapd, u8 *eid); u8 * hostapd_eid_ext_supp_rates(struct hostapd_data *hapd, u8 *eid); +u8 * hostapd_eid_rm_enabled_capab(struct hostapd_data *hapd, u8 *eid, + size_t len); u8 * hostapd_eid_ht_capabilities(struct hostapd_data *hapd, u8 *eid); u8 * hostapd_eid_ht_operation(struct hostapd_data *hapd, u8 *eid); u8 * hostapd_eid_secondary_channel(struct hostapd_data *hapd, u8 *eid);