iw: scan: add EHT beacon info support
v6 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.
v6:
- Fix 2.4Ghz MCS/NSS parsing
- Show bitfield for MCS/NSS fields
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 | 4 +- link.c | 5 ++- scan.c | 34 +++++++++++--- util.c | 124 ++++++++++++++++++++++++++++++++++++++++------------ 5 files changed, 131 insertions(+), 37 deletions(-)
Signature · 1 line
2.48.1
PATCH v6 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 | 2 + util.c | 124 ++++++++++++++++++++++++++++++++++++++++++++------------- 2 files changed, 99 insertions(+), 27 deletions(-)
iw.h +2 -0
@@ -245,6 +245,8 @@ 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, +bool from_ap);void print_eht_info (struct nlattr *nl_iftype,int band);void print_s1g_capability (const uint8_t *caps);
util.c +97 -27
173 lines not on this page · raw message
Signature · 1 line
2.48.1
PATCH v6 2/2 iw: scan: add eht capability parsing
In reply to Dylan EskewAdd ability to print out EHT capabilities from
AP beacons.
--- ieee80211.h | 1 + iw.h | 2 +- link.c | 5 +++-- scan.c | 34 +++++++++++++++++++++++++++------- 4 files changed, 32 insertions(+), 10 deletions(-)
ieee80211.h +1 -0
@@ -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))
iw.h +1 -1
@@ -277,7 +277,7 @@ enum print_ie_type {#define BIT (x) (1ULL<<(x))void print_ies (unsigned char *ie,int ielen,bool unknown, -enum print_ie_type ptype); +enum print_ie_type ptype,bool from_ap);void parse_bitrate (struct nlattr *bitrate_attr,char *buf,int buflen);void iw_hexdump (const char *prefix,const __u8 *data,size_t len);
link.c +3 -2
@@ -93,7 +93,7 @@ static int link_bss_handler(struct nl_msg *msg, void *arg)if (bss[NL80211_BSS_INFORMATION_ELEMENTS ])print_ies (nla_data (bss[NL80211_BSS_INFORMATION_ELEMENTS ]),nla_len (bss[NL80211_BSS_INFORMATION_ELEMENTS ]), - false,PRINT_LINK_MLO_MLD ); + false,PRINT_LINK_MLO_MLD , false); } }else {memcpy (result->sta_addr,nla_data (bss[NL80211_BSS_BSSID ]),6 );
@@ -121,7 +121,8 @@ static int link_bss_handler(struct nl_msg *msg, void *arg)if (bss[NL80211_BSS_INFORMATION_ELEMENTS ])print_ies (nla_data (bss[NL80211_BSS_INFORMATION_ELEMENTS ]),nla_len (bss[NL80211_BSS_INFORMATION_ELEMENTS ]), - false, result->mld ?PRINT_LINK_MLO_LINK :PRINT_LINK ); + false, result->mld ?PRINT_LINK_MLO_LINK :PRINT_LINK , + false);if (bss[NL80211_BSS_FREQUENCY_OFFSET ]) freq_offset =nla_get_u32 (bss[NL80211_BSS_FREQUENCY_OFFSET ]);
scan.c +27 -7
@@ -555,7 +555,9 @@ static void tab_on_first(bool *first) }struct ie_context { +bool from_ap;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 +2395,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, ctx->from_ap); +} +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 +2422,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 ; }
@@ -2426,7 +2437,7 @@ static void print_extension(unsigned char len, unsigned char *ie, }static void init_context (struct ie_context *ctx, -unsigned char *ie,int ielen) +unsigned char *ie,int ielen,bool from_ap) {unsigned char *pos = ie;int remaining = ielen;
@@ -2436,11 +2447,20 @@ static void init_context(struct ie_context *ctx,if (!ie || !ielen)return ; + ctx->from_ap = from_ap; +while (remaining >=2 && remaining -2 >= pos[1 ]) {switch (pos[0 ]) {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 ;
@@ -2449,14 +2469,14 @@ static void init_context(struct ie_context *ctx, }void print_ies (unsigned char *ie,int ielen,bool unknown, -enum print_ie_type ptype) +enum print_ie_type ptype,bool from_ap) {struct ie_context ctx;if (!ie)return ; -init_context (&ctx, ie, ielen); +init_context (&ctx, ie, ielen, from_ap);while (ielen >=2 && ielen -2 >= ie[1 ]) { if (ie[0] < ARRAY_SIZE(ieprinters) &&
@@ -2468,7 +2488,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;
@@ -2673,13 +2693,13 @@ static int print_bss_handler(struct nl_msg *msg, void *arg)printf ("\tInformation elements from Probe Response " "frame:\n" );print_ies (nla_data (ies),nla_len (ies), - params->unknown, params->type); + params->unknown, params->type, true); }if (bss[NL80211_BSS_BEACON_IES ] && show--) {printf ("\tInformation elements from Beacon frame:\n" );print_ies (nla_data (bss[NL80211_BSS_BEACON_IES ]),nla_len (bss[NL80211_BSS_BEACON_IES ]), - params->unknown, params->type); + params->unknown, params->type, true); }return NL_SKIP ;
Signature · 1 line
2.48.1