[PATCH 11/13] mbssid: hidden SSID support
Aloka Dixit
quic_alokad at quicinc.com
Wed Mar 2 14:26:32 PST 2022
Hidden nontransmitted BSSID profiles will be included in the beacons
and probe responses but SSID value will be removed or set to all
zeros depending on the configured value of 'ignore_broadcast_ssid'.
If complete profiles are omitted, clients cannot stay connected to
the AP.
For unicast probe requests with SSID set to a hidden nontransmitted
BSS, complete SSID should be included in the response.
Co-developed-by: Sowmiya Sree Elavalagan <quic_ssreeela at quicinc.com>
Signed-off-by: Sowmiya Sree Elavalagan <quic_ssreeela at quicinc.com>
Signed-off-by: Aloka Dixit <quic_alokad at quicinc.com>
---
src/ap/beacon.c | 25 +++++++++++++++++++------
src/ap/ieee802_11.c | 24 +++++++++++++++++++-----
2 files changed, 38 insertions(+), 11 deletions(-)
diff --git a/src/ap/beacon.c b/src/ap/beacon.c
index be0f0658155a..5f22dfc8cde2 100644
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -547,6 +547,7 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd,
struct ieee80211_mgmt *resp;
u8 *pos, *epos, *csa_pos, *ext_cap_pos;
size_t buflen;
+ struct hostapd_data *hapd_probed = hapd;
hapd = hostapd_mbssid_get_tx_bss(hapd);
@@ -584,7 +585,8 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd,
}
#endif /* CONFIG_IEEE80211AX */
- buflen += hostapd_eid_mbssid_len(hapd, WLAN_FC_STYPE_PROBE_RESP, NULL);
+ buflen += hostapd_eid_mbssid_len(hapd_probed, WLAN_FC_STYPE_PROBE_RESP,
+ NULL);
buflen += hostapd_eid_rnr_len(hapd, WLAN_FC_STYPE_PROBE_RESP);
buflen += hostapd_mbo_ie_len(hapd);
buflen += hostapd_eid_owe_trans_len(hapd);
@@ -612,9 +614,20 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd,
pos = resp->u.probe_resp.variable;
*pos++ = WLAN_EID_SSID;
- *pos++ = hapd->conf->ssid.ssid_len;
- os_memcpy(pos, hapd->conf->ssid.ssid, hapd->conf->ssid.ssid_len);
- pos += hapd->conf->ssid.ssid_len;
+ if (hapd->conf->ignore_broadcast_ssid && hapd != hapd_probed) {
+ if (hapd->conf->ignore_broadcast_ssid == 2) {
+ *pos++ = hapd->conf->ssid.ssid_len;
+ os_memset(pos, 0, hapd->conf->ssid.ssid_len);
+ pos += hapd->conf->ssid.ssid_len;
+ } else {
+ *pos++ = 0; /* empty SSID */
+ }
+ } else {
+ *pos++ = hapd->conf->ssid.ssid_len;
+ os_memcpy(pos, hapd->conf->ssid.ssid,
+ hapd->conf->ssid.ssid_len);
+ pos += hapd->conf->ssid.ssid_len;
+ }
/* Supported rates */
pos = hostapd_eid_supp_rates(hapd, pos);
@@ -653,8 +666,8 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd,
pos = hostapd_eid_supported_op_classes(hapd, pos);
pos = hostapd_eid_ht_capabilities(hapd, pos);
pos = hostapd_eid_ht_operation(hapd, pos);
- pos = hostapd_eid_mbssid(hapd, pos, epos, WLAN_FC_STYPE_PROBE_RESP, 0,
- NULL);
+ pos = hostapd_eid_mbssid(hapd_probed, pos, epos,
+ WLAN_FC_STYPE_PROBE_RESP, 0, NULL);
ext_cap_pos = pos;
pos = hostapd_eid_ext_capab(hapd, pos);
diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
index 3365b48fa639..36d6831b2376 100644
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -7490,11 +7490,16 @@ static size_t hostapd_eid_mbssid_elem_len(struct hostapd_data *hapd,
* Sublement ID: 1 byte
* Length: 1 byte
* Nontransmitted capabilities: 4 bytes
- * SSID element: 2 + variable
+ * SSID element: 2 + variable (except for hidden BSS)
* Multiple BSSID Index Element: 3 bytes (+2 bytes in beacons)
* Fixed length = 1 + 1 + 4 + 2 + 3 = 11
*/
- nontx_profile_len = 11 + bss->conf->ssid.ssid_len;
+ nontx_profile_len = 11;
+
+ if (!bss->conf->ignore_broadcast_ssid ||
+ bss->conf->ignore_broadcast_ssid == 2 ||
+ (frame_type == WLAN_FC_STYPE_PROBE_RESP && bss == hapd))
+ nontx_profile_len += bss->conf->ssid.ssid_len;
if (frame_type == WLAN_FC_STYPE_BEACON)
nontx_profile_len += 2;
@@ -7593,9 +7598,18 @@ static u8 * hostapd_eid_mbssid_elem(struct hostapd_data *hapd, u8 *eid, u8 *end,
eid += sizeof(capab_info);
*eid++ = WLAN_EID_SSID;
- *eid++ = conf->ssid.ssid_len;
- os_memcpy(eid, conf->ssid.ssid, conf->ssid.ssid_len);
- eid += conf->ssid.ssid_len;
+ if (!conf->ignore_broadcast_ssid ||
+ (frame_type == WLAN_FC_STYPE_PROBE_RESP && bss == hapd)) {
+ *eid++ = conf->ssid.ssid_len;
+ os_memcpy(eid, conf->ssid.ssid, conf->ssid.ssid_len);
+ eid += conf->ssid.ssid_len;
+ } else if (conf->ignore_broadcast_ssid == 2) {
+ *eid++ = conf->ssid.ssid_len;
+ os_memset(eid, 0, conf->ssid.ssid_len);
+ eid += conf->ssid.ssid_len;
+ } else {
+ *eid++ = 0;
+ }
*eid++ = WLAN_EID_MULTIPLE_BSSID_INDEX;
if (frame_type == WLAN_FC_STYPE_BEACON) {
--
2.31.1
More information about the Hostap
mailing list