[PATCH v4 07/15] mbssid: set extended capabilities

Aloka Dixit quic_alokad at quicinc.com
Wed Nov 30 19:18:39 PST 2022


Set extended capabilities as described in IEEE Std 802.11ax-2021,
section 9.4.2.26.

Reset the capability bits to 0 explicitly if MBSSID and/or EMA is not
enabled because otherwise some client devices fail to associate.

Bit 80 (complete list of non-tx profiles) is set for all probe
responses, but for beacons it is set only if EMA is disabled or
if EMA profile periodicity is 1.

Signed-off-by: Aloka Dixit <quic_alokad at quicinc.com>
Co-developed-by: John Crispin <john at phrozen.org>
Signed-off-by: John Crispin <john at phrozen.org>
---
 src/ap/beacon.c            | 30 +++++++++++++++++++++---------
 src/ap/ieee802_11_shared.c | 11 +++++++++++
 2 files changed, 32 insertions(+), 9 deletions(-)

diff --git a/src/ap/beacon.c b/src/ap/beacon.c
index a297fad961c0..68b6b28588ce 100644
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -517,7 +517,7 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd,
 				   bool bcast_probe_resp)
 {
 	struct ieee80211_mgmt *resp;
-	u8 *pos, *epos, *csa_pos;
+	u8 *pos, *epos, *csa_pos, *ext_cap_pos;
 	size_t buflen;
 
 	hapd = hostapd_mbssid_get_tx_bss(hapd);
@@ -642,7 +642,12 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd,
 	pos = hostapd_eid_ht_operation(hapd, pos);
 	pos = hostapd_eid_mbssid(hapd, pos, epos, WLAN_FC_STYPE_PROBE_RESP, 0,
 				 NULL);
+
+	ext_cap_pos = pos;
 	pos = hostapd_eid_ext_capab(hapd, pos);
+	if (hapd->iconf->mbssid >= MBSSID_ENABLED)
+		ext_cap_pos[12] |= 0x01; /* Probe responses always include all
+					  * non-tx profiles */
 
 	pos = hostapd_eid_time_adv(hapd, pos);
 	pos = hostapd_eid_time_zone(hapd, pos);
@@ -1572,7 +1577,7 @@ int ieee802_11_build_ap_params(struct hostapd_data *hapd,
 	size_t resp_len = 0;
 #ifdef NEED_AP_MLME
 	u16 capab_info;
-	u8 *pos, *tailpos, *tailend, *csa_pos;
+	u8 *pos, *tailpos, *tailend, *csa_pos, *ext_cap_pos;
 #endif /* NEED_AP_MLME */
 
 	os_memset(params, 0, sizeof(*params));
@@ -1714,16 +1719,23 @@ int ieee802_11_build_ap_params(struct hostapd_data *hapd,
 	tailpos = hostapd_eid_supported_op_classes(hapd, tailpos);
 	tailpos = hostapd_eid_ht_capabilities(hapd, tailpos);
 	tailpos = hostapd_eid_ht_operation(hapd, tailpos);
+	ext_cap_pos = tailpos;
 	tailpos = hostapd_eid_ext_capab(hapd, tailpos);
 
-	if (hapd->iconf->mbssid && hapd->iconf->num_bss > 1 &&
-	    ieee802_11_build_ap_params_mbssid(hapd, params)) {
-		os_free(head);
-		os_free(tail);
-		wpa_printf(MSG_ERROR, "Failed to set beacon data");
-		return -1;
+	if (hapd->iconf->mbssid && hapd->iconf->num_bss > 1) {
+		if (ieee802_11_build_ap_params_mbssid(hapd, params)) {
+			os_free(head);
+			os_free(tail);
+			wpa_printf(MSG_ERROR, "Failed to set beacon data");
+			return -1;
+		} else if (hapd->iconf->mbssid == MBSSID_ENABLED ||
+			   (hapd->iconf->mbssid == ENHANCED_MBSSID_ENABLED &&
+			   params->mbssid_elem_count == 1)) {
+			/* Set the extended capability bit for "complete list
+			 * of non-tx profiles" */
+			ext_cap_pos[12] |= 0x01;
+		}
 	}
-
 	/*
 	 * TODO: Time Advertisement element should only be included in some
 	 * DTIM Beacon frames.
diff --git a/src/ap/ieee802_11_shared.c b/src/ap/ieee802_11_shared.c
index eaeaec5d73dc..8eb2c21d23af 100644
--- a/src/ap/ieee802_11_shared.c
+++ b/src/ap/ieee802_11_shared.c
@@ -364,6 +364,8 @@ static void hostapd_ext_capab_byte(struct hostapd_data *hapd, u8 *pos, int idx)
 			*pos |= 0x02; /* Bit 17 - WNM-Sleep Mode */
 		if (hapd->conf->bss_transition)
 			*pos |= 0x08; /* Bit 19 - BSS Transition */
+		if (hapd->iconf->mbssid)
+			*pos |= 0x40; /* Bit 22 - Multiple BSSID */
 		break;
 	case 3: /* Bits 24-31 */
 #ifdef CONFIG_WNM_AP
@@ -435,6 +437,8 @@ static void hostapd_ext_capab_byte(struct hostapd_data *hapd, u8 *pos, int idx)
 		    (hapd->iface->drv_flags &
 		     WPA_DRIVER_FLAGS_BEACON_PROTECTION))
 			*pos |= 0x10; /* Bit 84 - Beacon Protection Enabled */
+		if (hapd->iconf->mbssid == ENHANCED_MBSSID_ENABLED)
+			*pos |= 0x08; /* Bit 83 - Enhanced multiple BSSID */
 		break;
 	case 11: /* Bits 88-95 */
 #ifdef CONFIG_SAE_PK
@@ -470,6 +474,13 @@ u8 * hostapd_eid_ext_capab(struct hostapd_data *hapd, u8 *eid)
 			*pos &= ~hapd->conf->ext_capa_mask[i];
 			*pos |= hapd->conf->ext_capa[i];
 		}
+
+		/* Clear bits 83 and 22 if EMA and MBSSID are not enabled
+		 * otherwise association fails with some clients */
+		if (i == 10 && hapd->iconf->mbssid < ENHANCED_MBSSID_ENABLED)
+			*pos &= ~0x08;
+		if (i == 2 && !hapd->iconf->mbssid)
+			*pos &= ~0x40;
 	}
 
 	while (len > 0 && eid[1 + len] == 0) {
-- 
2.25.1




More information about the Hostap mailing list