Skip to contentSkip to conversation

iw: scan: add EHT beacon info support

PATCH Superseded Dylan Eskew 1 participant 3 messages Dec 9, 2024

v5 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v5 cover iw: scan: add EHT beacon info support

With the recently upstreamed changes regarding carrying an ie context around in the scan parsing, a more sensible implementation of EHT capabilities parsing in beacons is made possible. With this, the changes have been broken up into two patches for better isolation.

v5:
- Split out changes between two patches
- Utilize new ie context in scan parsing logic
- Clean up old EHT capa printing logic
v4:
- Change s-o-b to use full name
v3:
- Clean up changes and drop HE logic Johannes commented on
v2:
- Fix mangled subject

Dylan Eskew (2):
iw: util: update and clean up eht capa printing
iw: scan: add eht capability parsing

 ieee80211.h |  1 +
 iw.h        |  1 +
 scan.c      | 21 ++++++++++--
 util.c      | 99 ++++++++++++++++++++++++++++++++++++++---------------
 4 files changed, 93 insertions(+), 29 deletions(-)
Signature · 1 line
2.47.0
#1 lore raw

PATCH v5 1/2 iw: util: update and clean up eht capa printing

A number of fields were either missing or incorrect, so update to more aligned with 802.11be spec. Also clean up printout formatting.

---
 iw.h   |  1 +
 util.c | 99 ++++++++++++++++++++++++++++++++++++++++++----------------
 2 files changed, 73 insertions(+), 27 deletions(-)
iw.h +1 -0
index dc11d2b..bce4e5b 100644
@@ -245,6 +245,7 @@ void print_vht_info(__u32 capa, const __u8 *mcs);
 void print_he_capability(const uint8_t *ie, int len);
 void print_he_operation(const uint8_t *ie, int len);
 void print_he_info(struct nlattr *nl_iftype);
+void print_eht_capability(const uint8_t *ie, int len, const uint8_t *he_cap);
 void print_eht_info(struct nlattr *nl_iftype, int band);
 void print_s1g_capability(const uint8_t *caps);
 
util.c +72 -27

143 lines not on this page · raw message

Signature · 1 line
2.47.0
#2 lore raw

PATCH v5 2/2 iw: scan: add eht capability parsing

In reply to Dylan Eskew

Add ability to print out EHT capabilities from
AP beacons.

---
 ieee80211.h |  1 +
 scan.c      | 21 +++++++++++++++++++--
 2 files changed, 20 insertions(+), 2 deletions(-)
ieee80211.h +1 -0
index de05844..1e29371 100644
@@ -99,6 +99,7 @@ enum elem_id {
 enum elem_id_ext {
 	EID_EXT_HE_CAPABILITY		= 35,
 	EID_EXT_HE_OPERATION		= 36,
+	EID_EXT_EHT_CAPABILITY		= 108,
 };
 
 #define SUITE(oui, id)  (((oui) << 8) | (id))
scan.c +19 -2
index 6cf44d2..395c7cb 100644
@@ -556,6 +556,7 @@ static void tab_on_first(bool *first)
 
 struct ie_context {
 	bool is_vht_cap;
+	const uint8_t *he_cap;
 };
 
 static void print_ssid(const uint8_t type, uint8_t len, const uint8_t *data,
@@ -2393,12 +2394,21 @@ static void print_he_oper(const uint8_t type, uint8_t len, const uint8_t *data,
 	print_he_operation(data, len);
 }
 
+static void print_eht_capa(const uint8_t type, uint8_t len,
+			   const uint8_t *data, const struct ie_context *ctx)
+{
+	printf("\n");
+	print_eht_capability(data, len, ctx->he_cap);
+}
+
 static const struct ie_print ext_printers[] = {
 	[EID_EXT_HE_CAPABILITY] = { "HE capabilities", print_he_capa, 21, 54, BIT(PRINT_SCAN), },
 	[EID_EXT_HE_OPERATION] = { "HE Operation", print_he_oper, 6, 15, BIT(PRINT_SCAN), },
+	[EID_EXT_EHT_CAPABILITY] = { "EHT capabilities", print_eht_capa, 13, 30, BIT(PRINT_SCAN), },
 };
 
 static void print_extension(unsigned char len, unsigned char *ie,
+			    const struct ie_context *ctx,
 			    bool unknown, enum print_ie_type ptype)
 {
 	unsigned char tag;
@@ -2411,7 +2421,7 @@ static void print_extension(unsigned char len, unsigned char *ie,
 	tag = ie[0];
 	if (tag < ARRAY_SIZE(ext_printers) && ext_printers[tag].name &&
 	    ext_printers[tag].flags & BIT(ptype)) {
-		print_ie(&ext_printers[tag], tag, len - 1, ie + 1, NULL);
+		print_ie(&ext_printers[tag], tag, len - 1, ie + 1, ctx);
 		return;
 	}
 
@@ -2441,6 +2451,13 @@ static void init_context(struct ie_context *ctx,
 		case EID_VHT_CAPABILITY:
 			ctx->is_vht_cap = true;
 			break;
+		case EID_EXTENSION:
+			switch (pos[2]) {
+			case EID_EXT_HE_CAPABILITY:
+				ctx->he_cap = pos + 3;
+				break;
+			}
+			break;
 		}
 
 		remaining -= pos[1] + 2;
@@ -2468,7 +2485,7 @@ void print_ies(unsigned char *ie, int ielen, bool unknown,
 		} else if (ie[0] == 221 /* vendor */) {
 			print_vendor(ie[1], ie + 2, unknown, ptype);
 		} else if (ie[0] == 255 /* extension */) {
-			print_extension(ie[1], ie + 2, unknown, ptype);
+			print_extension(ie[1], ie + 2, &ctx, unknown, ptype);
 		} else if (unknown) {
 			int i;
 
Signature · 1 line
2.47.0