From patchwork Wed Mar 19 18:39:17 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dylan Eskew X-Patchwork-Id: 14022994 X-Patchwork-Delegate: johannes@sipsolutions.net Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [67.231.154.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6C8A51E2834 for ; Wed, 19 Mar 2025 18:39:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.154.183 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742409572; cv=none; b=QIHq6BoA3wBu/c2PGxjQnpWwUa8VE6vwL0uifudl6wOQR42gfjT1jufDSML9AjJddfoZgWpNsr1EyHQU1LcQQ80lD0Q+btg5//89jzh+cPGcwGQlYyjy0wBImd44C+8WuwomsWwkMTuUsnGORfzVRVqJ70C/eMn7HlA0m/UEw/8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742409572; c=relaxed/simple; bh=0Lv2cH2yGjyhyRDoMRwLBPww8vBEkeagvIRbdmvr+I8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TlsQb3i08tgTh0pdzKRWRY1cJAqf824OmYzXeuLJ+6IbIGdWG2ebeMphSqEWxyuEzuqmKBC8LbthlCjBI2VBbdQnX4LZYndSEkjVn77HMJgXusQSdtV+mBuGCCH6OQgBLKgGnZmCSaRKasMpCRNl/HZ0hXzceIVf+xZ7IcvSllc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=candelatech.com; spf=pass smtp.mailfrom=candelatech.com; dkim=pass (1024-bit key) header.d=candelatech.com header.i=@candelatech.com header.b=EWHTnJLV; arc=none smtp.client-ip=67.231.154.183 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=candelatech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=candelatech.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=candelatech.com header.i=@candelatech.com header.b="EWHTnJLV" X-Virus-Scanned: Proofpoint Essentials engine Received: from mail3.candelatech.com (mail.candelatech.com [208.74.158.173]) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTP id 23ED5240098; Wed, 19 Mar 2025 18:39:28 +0000 (UTC) Received: from corvid-conspiracy.candelatech.com (unknown [50.251.239.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail3.candelatech.com (Postfix) with ESMTPSA id 70E2313C2B0; Wed, 19 Mar 2025 11:39:27 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 mail3.candelatech.com 70E2313C2B0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=candelatech.com; s=default; t=1742409567; bh=0Lv2cH2yGjyhyRDoMRwLBPww8vBEkeagvIRbdmvr+I8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EWHTnJLVnHGs+CRj7s/x5FXL6+JpmpT039dh3J35YSkRdqPLqn02UigEJuuZkIDvC mcmn2zEmAWW34hoc8+Uo3/SLAZTLiMUmBmGPYKJLKogi14nFGMPOk9p7nI9Lt71pTP 2gaLJUxyaQd28B+UCayGSnhe/5m2znHMYsFSnxVw= From: Dylan Eskew To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Dylan Eskew Subject: [PATCH iw v6 1/2] iw: util: update and clean up eht capa printing Date: Wed, 19 Mar 2025 11:39:17 -0700 Message-ID: <20250319183918.1215853-2-dylan.eskew@candelatech.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250319183918.1215853-1-dylan.eskew@candelatech.com> References: <20250319183918.1215853-1-dylan.eskew@candelatech.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MDID: 1742409569-TFk-lKPw9Mvi X-MDID-O: us5;at1;1742409569;TFk-lKPw9Mvi;;b42792dba290a1257c3f0aaf1c60b0ff X-PPE-TRUSTED: V=1;DIR=OUT; A number of fields were either missing or incorrect, so update to more aligned with 802.11be spec. Also clean up printout formatting. Signed-off-by: Dylan Eskew --- iw.h | 2 + util.c | 124 ++++++++++++++++++++++++++++++++++++++++++++------------- 2 files changed, 99 insertions(+), 27 deletions(-) diff --git a/iw.h b/iw.h index dc11d2b..8cbb971 100644 --- a/iw.h +++ b/iw.h @@ -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); diff --git a/util.c b/util.c index dc84886..ee0fd7a 100644 --- a/util.c +++ b/util.c @@ -1531,11 +1531,11 @@ static void __print_eht_capa(int band, const __u8 *mcs_set, size_t mcs_len, const __u8 *ppet, size_t ppet_len, const __u16 *he_phy_cap, + bool from_ap, bool indent) { unsigned int i; const char *pre = indent ? "\t" : ""; - const char *mcs[] = { "0-7", "8-9", "10-11", "12-13"}; #define PRINT_EHT_CAP(_var, _idx, _bit, _str) \ do { \ @@ -1550,6 +1550,7 @@ static void __print_eht_capa(int band, } while (0) #define PRINT_EHT_MAC_CAP(...) PRINT_EHT_CAP(mac_cap, __VA_ARGS__) + #define PRINT_EHT_MAC_CAP_MASK(...) PRINT_EHT_CAP_MASK(mac_cap, __VA_ARGS__) #define PRINT_EHT_PHY_CAP(...) PRINT_EHT_CAP(phy_cap, __VA_ARGS__) #define PRINT_EHT_PHY_CAP_MASK(...) PRINT_EHT_CAP_MASK(phy_cap, __VA_ARGS__) @@ -1558,13 +1559,22 @@ static void __print_eht_capa(int band, printf("%02x", mac_cap[i]); printf("):\n"); - PRINT_EHT_MAC_CAP(0, 0, "NSEP priority access Supported"); + PRINT_EHT_MAC_CAP(0, 0, "EPCS Priority Access Supported"); PRINT_EHT_MAC_CAP(0, 1, "EHT OM Control Supported"); - PRINT_EHT_MAC_CAP(0, 2, "Triggered TXOP Sharing Supported"); - PRINT_EHT_MAC_CAP(0, 3, "ARR Supported"); - - printf("%s\t\tEHT PHY Capabilities: (0x", pre); - for (i = 0; i < 8; i++) + PRINT_EHT_MAC_CAP(0, 2, "Triggered TXOP Sharing Mode 1 Supported"); + PRINT_EHT_MAC_CAP(0, 3, "Triggered TXOP Sharing Mode 2 Supported"); + PRINT_EHT_MAC_CAP(0, 4, "Restricted TWP Supported"); + PRINT_EHT_MAC_CAP(0, 5, "SCS Traffic Description Supported"); + PRINT_EHT_MAC_CAP_MASK(0, 6, 0x3, "Maximum MPDU Length"); + + PRINT_EHT_MAC_CAP(1, 1, "Maximum A_MPDU Length Exponent Extension"); + PRINT_EHT_MAC_CAP(1, 2, "EHT TRS Supported"); + PRINT_EHT_MAC_CAP(1, 3, "TXOP Return In TXOP Sharing Mode 2 Supported"); + PRINT_EHT_MAC_CAP(1, 4, "Two BQRs Supported"); + PRINT_EHT_MAC_CAP_MASK(1, 5, 0x3, "EHT Link Adaptation Supported"); + + printf("%s\t\tEHT PHY Capabilities (0x", pre); + for (i = 0; i < 9; i++) printf("%02x", ((__u8 *)phy_cap)[i]); printf("):\n"); @@ -1610,39 +1620,77 @@ static void __print_eht_capa(int band, PRINT_EHT_PHY_CAP(1, 28, "MU Beamformer (80MHz)"); PRINT_EHT_PHY_CAP(1, 29, "MU Beamformer (160MHz)"); PRINT_EHT_PHY_CAP(1, 30, "MU Beamformer (320MHz)"); + PRINT_EHT_PHY_CAP(1, 31, "TB Sounding Feedback Rate Limit"); - printf("%s\t\tEHT MCS/NSS: (0x", pre); - for (i = 0; i < mcs_len; i++) - printf("%02x", ((__u8 *)mcs_set)[i]); - printf("):\n"); + PRINT_EHT_PHY_CAP(2, 0, "Rx 1024-QAM In Wider Bandwidth DL OFDMA Supported"); + PRINT_EHT_PHY_CAP(2, 1, "Rx 4096-QAM In Wider Bandwidth DL OFDMA Supported"); + + if (!from_ap && + !(he_phy_cap[0] & ((BIT(1) | BIT(2) | BIT(3) | BIT(4)) << 8))) { + static const char * const mcs[] = { "0-7", "8-9", "10-11", "12-13" }; - if (!(he_phy_cap[0] & ((BIT(2) | BIT(3) | BIT(4)) << 8))){ - for (i = 0; i < 4; i++) - printf("%s\t\tEHT bw=20 MHz, max NSS for MCS %s: Rx=%u, Tx=%u\n", - pre, mcs[i], - mcs_set[i] & 0xf, mcs_set[i] >> 4); + printf("%s\t\tEHT-MCS Map (20 Mhz Non-AP STA) (0x", pre); + for (i = 0; i < mcs_len; i++) + printf("%02x", ((__u8 *)mcs_set)[i]); + printf("):\n"); + + for (i = 0; i < 4; i++) { + printf("%s\t\t\tRx Max NSS for MCS %s: %u\n", + pre, mcs[i], mcs_set[i] & 0xf); + printf("%s\t\t\tTx Max NSS for MCS %s: %u\n", + pre, mcs[i], mcs_set[i] >> 4); + } } else { - if (he_phy_cap[0] & (BIT(2) << 8)) { + static const char * const mcs[] = { "0-9", "10-11", "12-13"}; + + /* Bit 1 corresponds to 2.4Ghz 40Mhz support + * Bit 2 corresponds to 5/6Ghz 40 and 80Mhz support + * If no Channel Width bits are set, but we are an AP, we use + * this MCS logic also. + */ + if (he_phy_cap[0] & ((BIT(1) | BIT(2)) << 8) || + (from_ap && !(he_phy_cap[0] & ((BIT(1) | BIT(2) | BIT(3) | BIT(4)) << 8)))) { + printf("%s\t\tEHT-MCS Map (BW <= 80) (0x", pre); for (i = 0; i < 3; i++) - printf("%s\t\tEHT bw <= 80 MHz, max NSS for MCS %s: Rx=%u, Tx=%u\n", - pre, mcs[i + 1], - mcs_set[i] & 0xf, mcs_set[i] >> 4); + printf("%02x", ((__u8 *)mcs_set)[i]); + printf("):\n"); + + for (i = 0; i < 3; i++) { + printf("%s\t\t\tRx Max NSS for MCS %s: %u\n", + pre, mcs[i], mcs_set[i] & 0xf); + printf("%s\t\t\tTx Max NSS for MCS %s: %u\n", + pre, mcs[i], mcs_set[i] >> 4); + } } mcs_set += 3; if (he_phy_cap[0] & (BIT(3) << 8)) { + printf("%s\t\tEHT-MCS Map (BW = 160) (0x", pre); for (i = 0; i < 3; i++) - printf("%s\t\tEHT bw=160 MHz, max NSS for MCS %s: Rx=%u, Tx=%u\n", - pre, mcs[i + 1], - mcs_set[i] & 0xf, mcs_set[i] >> 4); + printf("%02x", ((__u8 *)mcs_set)[i]); + printf("):\n"); + + for (i = 0; i < 3; i++) { + printf("%s\t\t\tRx Max NSS for MCS %s: %u\n", + pre, mcs[i], mcs_set[i] & 0xf); + printf("%s\t\t\tTx Max NSS for MCS %s: %u\n", + pre, mcs[i], mcs_set[i] >> 4); + } } mcs_set += 3; if (band == NL80211_BAND_6GHZ && (phy_cap[0] & BIT(1))) { + printf("%s\t\tEHT-MCS Map (BW = 320) (0x", pre); for (i = 0; i < 3; i++) - printf("%s\t\tEHT bw=320 MHz, max NSS for MCS %s: Rx=%u, Tx=%u\n", - pre, mcs[i + 1], - mcs_set[i] & 0xf, mcs_set[i] >> 4); + printf("%02x", ((__u8 *)mcs_set)[i]); + printf("):\n"); + + for (i = 0; i < 3; i++) { + printf("%s\t\t\tRx Max NSS for MCS %s: %u\n", + pre, mcs[i], mcs_set[i] & 0xf); + printf("%s\t\t\tTx Max NSS for MCS %s: %u\n", + pre, mcs[i], mcs_set[i] >> 4); + } } } @@ -1729,7 +1777,29 @@ void print_eht_info(struct nlattr *nl_iftype, int band) } __print_eht_capa(band, mac_cap, phy_cap, mcs_set, mcs_len, ppet, ppet_len, - he_phy_cap, true); + he_phy_cap, false, true); +} + +void print_eht_capability(const uint8_t *ie, int len, const uint8_t *he_cap, + bool from_ap) +{ + const void *mac_cap, *phy_cap, *mcs_set, *he_phy_cap; + int mcs_len; + int i = 0; + + mac_cap = &ie[i]; + i += 2; + + phy_cap = &ie[i]; + i += 9; + + mcs_set = &ie[i]; + mcs_len = len - i; + + he_phy_cap = &he_cap[6]; + + __print_eht_capa(NL80211_BAND_6GHZ, mac_cap, phy_cap, mcs_set, mcs_len, + NULL, 0, he_phy_cap - 1, from_ap, false); } void print_he_capability(const uint8_t *ie, int len) From patchwork Wed Mar 19 18:39:18 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dylan Eskew X-Patchwork-Id: 14022995 X-Patchwork-Delegate: johannes@sipsolutions.net Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [67.231.154.184]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 072E1207DF1 for ; Wed, 19 Mar 2025 18:39:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.154.184 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742409572; cv=none; b=ucsfXj9U+uktYJG/tBu4eY7sEMiQ84Iw69Fjh2tv2k8sTQx4nYXgyxax1O1VJbtCUYGOnS3vlfqwxNj3JBidBeSBtJS/XbvdmFO9vMjFa9f1MWwWA6dfq/LEr8d+RcPLKmRTfBh9mHLOb6fQbs9xDOJNmLj0OtKmB7XlZfiTTV0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742409572; c=relaxed/simple; bh=2ubWtw5Ij9/BJ3/5+2dsxukzEGfcln0TpU73iE7BI8g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ixaAkAVAZYtL9bUeQHJ4Kcfx4FyJVRtVmUM0mo4zt3jbN7JpmnP9YUhxcbBVbp3lY8H2mCmzST1foP+jcLBgnVkBNzISMxZlzavhvSOEin+0x26cr3ktAJlNMYHvmMzEv+cc1kUNdFP2YzvZTHKKRE/o1IBIW5ouDlkpyvLt9yY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=candelatech.com; spf=pass smtp.mailfrom=candelatech.com; dkim=pass (1024-bit key) header.d=candelatech.com header.i=@candelatech.com header.b=NEBOmKjH; arc=none smtp.client-ip=67.231.154.184 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=candelatech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=candelatech.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=candelatech.com header.i=@candelatech.com header.b="NEBOmKjH" X-Virus-Scanned: Proofpoint Essentials engine Received: from mail3.candelatech.com (mail.candelatech.com [208.74.158.173]) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTP id C87422C00A2; Wed, 19 Mar 2025 18:39:28 +0000 (UTC) Received: from corvid-conspiracy.candelatech.com (unknown [50.251.239.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail3.candelatech.com (Postfix) with ESMTPSA id 203B213C2B1; Wed, 19 Mar 2025 11:39:28 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 mail3.candelatech.com 203B213C2B1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=candelatech.com; s=default; t=1742409568; bh=2ubWtw5Ij9/BJ3/5+2dsxukzEGfcln0TpU73iE7BI8g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NEBOmKjHdXnVZaW0HVh2R8FVk52gKC6GDp4tH+vE0HDqj/L4g1oG2RlvGodjzw/8X OOewyHGY3zS26Ur/aBDZRPmCF2u7gN8vtZVIhbvtTPbI7LCIMSUT647BAEc+3WrIIh NddQITSrIRAJWP9GB2exZYgLKPh+tXkZmvh+AjXA= From: Dylan Eskew To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Dylan Eskew Subject: [PATCH iw v6 2/2] iw: scan: add eht capability parsing Date: Wed, 19 Mar 2025 11:39:18 -0700 Message-ID: <20250319183918.1215853-3-dylan.eskew@candelatech.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250319183918.1215853-1-dylan.eskew@candelatech.com> References: <20250319183918.1215853-1-dylan.eskew@candelatech.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MDID: 1742409569-aK_Z01e8i73M X-MDID-O: us5;at1;1742409569;aK_Z01e8i73M;;b42792dba290a1257c3f0aaf1c60b0ff X-PPE-TRUSTED: V=1;DIR=OUT; Add ability to print out EHT capabilities from AP beacons. Signed-off-by: Dylan Eskew --- ieee80211.h | 1 + iw.h | 2 +- link.c | 5 +++-- scan.c | 34 +++++++++++++++++++++++++++------- 4 files changed, 32 insertions(+), 10 deletions(-) diff --git a/ieee80211.h b/ieee80211.h index de05844..1e29371 100644 --- a/ieee80211.h +++ b/ieee80211.h @@ -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)) diff --git a/iw.h b/iw.h index 8cbb971..b8caccd 100644 --- a/iw.h +++ b/iw.h @@ -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); diff --git a/link.c b/link.c index a7ee963..20ab927 100644 --- a/link.c +++ b/link.c @@ -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]); diff --git a/scan.c b/scan.c index 6cf44d2..a366184 100644 --- a/scan.c +++ b/scan.c @@ -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;