[PATCH] wlantest: allow missing RSNE in S1G beacon

Thomas Pedersen thomas at adapt-ip.com
Thu Oct 22 14:20:32 EDT 2020


S1G beacons save a few bytes by not requiring the RSN IE
in beacon if RSN BSS is configured. Handle this in
wlantest by only clearing RSNE from the BSS info if frame
is a probe response.

Signed-off-by: Thomas Pedersen <thomas at adapt-ip.com>
---
 src/common/ieee802_11_common.c |  5 +++++
 src/common/ieee802_11_common.h |  1 +
 src/common/ieee802_11_defs.h   |  3 +++
 wlantest/bss.c                 | 10 ++++++++--
 4 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/src/common/ieee802_11_common.c b/src/common/ieee802_11_common.c
index 9c536cc5f34f..3727b9477ef9 100644
--- a/src/common/ieee802_11_common.c
+++ b/src/common/ieee802_11_common.c
@@ -566,6 +566,11 @@ ParseRes ieee802_11_parse_elems(const u8 *start, size_t len,
 			elems->dils = pos;
 			elems->dils_len = elen;
 			break;
+		case WLAN_EID_S1G_CAPABILITIES:
+			if (elen < 15)
+				break;
+			elems->s1g_capab = pos;
+			break;
 		case WLAN_EID_FRAGMENT:
 			ieee802_11_parse_fragment(&elems->frag_ies, pos, elen);
 			break;
diff --git a/src/common/ieee802_11_common.h b/src/common/ieee802_11_common.h
index 0ddba06924c2..7d1db72c6408 100644
--- a/src/common/ieee802_11_common.h
+++ b/src/common/ieee802_11_common.h
@@ -115,6 +115,7 @@ struct ieee802_11_elems {
 	const u8 *short_ssid_list;
 	const u8 *he_6ghz_band_cap;
 	const u8 *sae_pk;
+	const u8 *s1g_capab;
 
 	u8 ssid_len;
 	u8 supp_rates_len;
diff --git a/src/common/ieee802_11_defs.h b/src/common/ieee802_11_defs.h
index 86d71c15680d..9518a7afe909 100644
--- a/src/common/ieee802_11_defs.h
+++ b/src/common/ieee802_11_defs.h
@@ -443,7 +443,10 @@
 #define WLAN_EID_DEVICE_LOCATION 204
 #define WLAN_EID_WHITE_SPACE_MAP 205
 #define WLAN_EID_FTM_PARAMETERS 206
+#define WLAN_EID_S1G_BCN_COMPAT 213
+#define WLAN_EID_S1G_CAPABILITIES 217
 #define WLAN_EID_VENDOR_SPECIFIC 221
+#define WLAN_EID_S1G_OPERATION 232
 #define WLAN_EID_CAG_NUMBER 237
 #define WLAN_EID_AP_CSN 239
 #define WLAN_EID_FILS_INDICATION 240
diff --git a/wlantest/bss.c b/wlantest/bss.c
index 3208e65e4195..5a05521d93d4 100644
--- a/wlantest/bss.c
+++ b/wlantest/bss.c
@@ -178,14 +178,20 @@ void bss_update(struct wlantest *wt, struct wlantest_bss *bss,
 			  elems->osen_len + 2);
 	}
 
-	if (elems->rsn_ie == NULL) {
+	/* S1G does not include RSNE in beacon, so only clear it from
+	 * probe response. NOTE this assumes short beacons were dropped due to
+	 * missing SSID above.
+	 */
+	if (elems->rsn_ie == NULL &&
+	    (!elems->s1g_capab ||
+	     (elems->s1g_capab && beacon != 1))) {
 		if (bss->rsnie[0]) {
 			add_note(wt, MSG_INFO, "BSS " MACSTR
 				 " - RSN IE removed", MAC2STR(bss->bssid));
 			bss->rsnie[0] = 0;
 			update = 1;
 		}
-	} else {
+	} else if (elems->rsn_ie) {
 		if (bss->rsnie[0] == 0 ||
 		    os_memcmp(bss->rsnie, elems->rsn_ie - 2,
 			      elems->rsn_ie_len + 2) != 0) {
-- 
2.20.1




More information about the Hostap mailing list