From b64fdedeaca3fecdafa02738a05b01ec952de7de Mon Sep 17 00:00:00 2001 From: Aleksander Jan Bajkowski Date: Mon, 6 Oct 2025 20:46:12 +0200 Subject: [PATCH] iw: bump to 6.17 Changelog: a52bda0 (HEAD, tag: v6.17) bump version to 6.17 c5bfa2a iw: add support to print link level information in station dump efaf786 iw: Add support to set per-radio RTS threshold in multi-radio wiphy 009ad3b update nl80211.h aef3798 iw: don't set stupid socket buffer size 8d52fb4 iw: scan: Add partial Multi-Link element printing cfc0695 iw: print HE mcs correctly when mcs_len 8e4808f iw: Add command to enable/disable EPCS 85b79b3 update nl80211.h 612f9f5 iw: Prevent segfault in ftm get stats 1558e60 iw: print NO-EHT flags for reg get command 59660a3 iw: fix EHT capabilities on Big Endian platforms 8ea80d3 iw: scan: Add printing of EHT Operation Element 7c0511b util: rename hz to Hz vol 2 c2a12a5 util: rename hz to Hz 0cc98ae iw: scan: Decode additional WPA3 group ciphers f04e5c5 iw: scan: Decode additional WPA3 AKM suite types 41a07a8 iw: fix HE operation on Big Endian platforms c41971e iw: fix HE capabilities on Big Endian platforms a6ad3f1 iw: scan: add eht capability parsing 4c85991 iw: util: update and clean up eht capa printing a0a7dde iw: scan: replace passed ie buffer with ie context 7bc2a84 iw: print tx power per link for MLD 478ddd4 iw: add output for wiphy interface combinations 93e2309 update nl80211.h 966c590 iw: scan: add enum for element IDs 422419e scan: Add printing of HE Operation Element d088c8a update nl80211.h 73231dd iw: fix formats under MIPS64/PPC 8609336 iw: remove sizer section and related code c8b9e77 util: clarify comment about 'parsed' pointer b29da20 iw: add puncturing support cce9897 iw: refactor frequency help Signed-off-by: Aleksander Jan Bajkowski Link: https://github.com/openwrt/openwrt/pull/20321 Signed-off-by: Hauke Mehrtens --- package/network/utils/iw/Makefile | 6 +- .../utils/iw/patches/001-nl80211_h_sync.patch | 98 ---- ...ow-specifying-CFLAGS-LIBS-externally.patch | 4 +- ...Add-printing-of-HE-Operation-Element.patch | 153 ------ ...capabilities-on-Big-Endian-platforms.patch | 77 --- ...HE-operation-on-Big-Endian-platforms.patch | 36 -- ...103-iw-scan-add-enum-for-element-IDs.patch | 170 ------ ...ace-passed-ie-buffer-with-ie-context.patch | 482 ------------------ ...pdate-and-clean-up-eht-capa-printing.patch | 207 -------- ...6-iw-scan-add-eht-capability-parsing.patch | 175 ------- ...capabilities-on-Big-Endian-platforms.patch | 107 ---- ...dd-printing-of-EHT-Operation-Element.patch | 131 ----- .../utils/iw/patches/200-reduce_size.patch | 74 +-- .../utils/iw/patches/300-wiphy_radios.patch | 252 --------- .../utils/iw/patches/310-vif_radio_mask.patch | 2 +- 15 files changed, 43 insertions(+), 1931 deletions(-) delete mode 100644 package/network/utils/iw/patches/001-nl80211_h_sync.patch delete mode 100644 package/network/utils/iw/patches/100-scan-Add-printing-of-HE-Operation-Element.patch delete mode 100644 package/network/utils/iw/patches/101-iw-fix-HE-capabilities-on-Big-Endian-platforms.patch delete mode 100644 package/network/utils/iw/patches/102-iw-fix-HE-operation-on-Big-Endian-platforms.patch delete mode 100644 package/network/utils/iw/patches/103-iw-scan-add-enum-for-element-IDs.patch delete mode 100644 package/network/utils/iw/patches/104-iw-scan-replace-passed-ie-buffer-with-ie-context.patch delete mode 100644 package/network/utils/iw/patches/105-iw-util-update-and-clean-up-eht-capa-printing.patch delete mode 100644 package/network/utils/iw/patches/106-iw-scan-add-eht-capability-parsing.patch delete mode 100644 package/network/utils/iw/patches/107-iw-fix-EHT-capabilities-on-Big-Endian-platforms.patch delete mode 100644 package/network/utils/iw/patches/108-iw-scan-Add-printing-of-EHT-Operation-Element.patch delete mode 100644 package/network/utils/iw/patches/300-wiphy_radios.patch diff --git a/package/network/utils/iw/Makefile b/package/network/utils/iw/Makefile index 17340624716..5da0c0edb39 100644 --- a/package/network/utils/iw/Makefile +++ b/package/network/utils/iw/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=iw -PKG_VERSION:=6.9 -PKG_RELEASE:=4 +PKG_VERSION:=6.17 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/software/network/iw -PKG_HASH:=3f2db22ad41c675242b98ae3942dbf3112548c60a42ff739210f2de4e98e4894 +PKG_HASH:=7d182e498289ab39b257da6780d562e415377107f50358ee5b55b8cfe40b1e33 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=GPL-2.0 diff --git a/package/network/utils/iw/patches/001-nl80211_h_sync.patch b/package/network/utils/iw/patches/001-nl80211_h_sync.patch deleted file mode 100644 index f48c083575d..00000000000 --- a/package/network/utils/iw/patches/001-nl80211_h_sync.patch +++ /dev/null @@ -1,98 +0,0 @@ ---- a/nl80211.h -+++ b/nl80211.h -@@ -2061,6 +2061,10 @@ enum nl80211_commands { - * @NL80211_ATTR_INTERFACE_COMBINATIONS: Nested attribute listing the supported - * interface combinations. In each nested item, it contains attributes - * defined in &enum nl80211_if_combination_attrs. -+ * If the wiphy uses multiple radios (@NL80211_ATTR_WIPHY_RADIOS is set), -+ * this attribute contains the interface combinations of the first radio. -+ * See @NL80211_ATTR_WIPHY_INTERFACE_COMBINATIONS for the global wiphy -+ * combinations for the sum of all radios. - * @NL80211_ATTR_SOFTWARE_IFTYPES: Nested attribute (just like - * %NL80211_ATTR_SUPPORTED_IFTYPES) containing the interface types that - * are managed in software: interfaces of these types aren't subject to -@@ -2856,6 +2860,17 @@ enum nl80211_commands { - * %NL80211_CMD_ASSOCIATE indicating the SPP A-MSDUs - * are used on this connection - * -+ * @NL80211_ATTR_WIPHY_RADIOS: Nested attribute describing physical radios -+ * belonging to this wiphy. See &enum nl80211_wiphy_radio_attrs. -+ * -+ * @NL80211_ATTR_WIPHY_INTERFACE_COMBINATIONS: Nested attribute listing the -+ * supported interface combinations for all radios combined. In each -+ * nested item, it contains attributes defined in -+ * &enum nl80211_if_combination_attrs. -+ * -+ * @NL80211_ATTR_VIF_RADIO_MASK: Bitmask of allowed radios (u32). -+ * A value of 0 means all radios. -+ * - * @NUM_NL80211_ATTR: total number of nl80211_attrs available - * @NL80211_ATTR_MAX: highest attribute number currently defined - * @__NL80211_ATTR_AFTER_LAST: internal use -@@ -3401,6 +3416,11 @@ enum nl80211_attrs { - - NL80211_ATTR_ASSOC_SPP_AMSDU, - -+ NL80211_ATTR_WIPHY_RADIOS, -+ NL80211_ATTR_WIPHY_INTERFACE_COMBINATIONS, -+ -+ NL80211_ATTR_VIF_RADIO_MASK, -+ - /* add attributes here, update the policy in nl80211.c */ - - __NL80211_ATTR_AFTER_LAST, -@@ -7987,4 +8007,54 @@ enum nl80211_ap_settings_flags { - NL80211_AP_SETTINGS_SA_QUERY_OFFLOAD_SUPPORT = 1 << 1, - }; - -+/** -+ * enum nl80211_wiphy_radio_attrs - wiphy radio attributes -+ * -+ * @__NL80211_WIPHY_RADIO_ATTR_INVALID: Invalid -+ * -+ * @NL80211_WIPHY_RADIO_ATTR_INDEX: Index of this radio (u32) -+ * @NL80211_WIPHY_RADIO_ATTR_FREQ_RANGE: Frequency range supported by this -+ * radio. Attribute may be present multiple times. -+ * @NL80211_WIPHY_RADIO_ATTR_INTERFACE_COMBINATION: Supported interface -+ * combination for this radio. Attribute may be present multiple times -+ * and contains attributes defined in &enum nl80211_if_combination_attrs. -+ * -+ * @__NL80211_WIPHY_RADIO_ATTR_LAST: Internal -+ * @NL80211_WIPHY_RADIO_ATTR_MAX: Highest attribute -+ */ -+enum nl80211_wiphy_radio_attrs { -+ __NL80211_WIPHY_RADIO_ATTR_INVALID, -+ -+ NL80211_WIPHY_RADIO_ATTR_INDEX, -+ NL80211_WIPHY_RADIO_ATTR_FREQ_RANGE, -+ NL80211_WIPHY_RADIO_ATTR_INTERFACE_COMBINATION, -+ -+ /* keep last */ -+ __NL80211_WIPHY_RADIO_ATTR_LAST, -+ NL80211_WIPHY_RADIO_ATTR_MAX = __NL80211_WIPHY_RADIO_ATTR_LAST - 1, -+}; -+ -+/** -+ * enum nl80211_wiphy_radio_freq_range - wiphy radio frequency range -+ * -+ * @__NL80211_WIPHY_RADIO_FREQ_ATTR_INVALID: Invalid -+ * -+ * @NL80211_WIPHY_RADIO_FREQ_ATTR_START: Frequency range start (u32). -+ * The unit is kHz. -+ * @NL80211_WIPHY_RADIO_FREQ_ATTR_END: Frequency range end (u32). -+ * The unit is kHz. -+ * -+ * @__NL80211_WIPHY_RADIO_FREQ_ATTR_LAST: Internal -+ * @NL80211_WIPHY_RADIO_FREQ_ATTR_MAX: Highest attribute -+ */ -+enum nl80211_wiphy_radio_freq_range { -+ __NL80211_WIPHY_RADIO_FREQ_ATTR_INVALID, -+ -+ NL80211_WIPHY_RADIO_FREQ_ATTR_START, -+ NL80211_WIPHY_RADIO_FREQ_ATTR_END, -+ -+ __NL80211_WIPHY_RADIO_FREQ_ATTR_LAST, -+ NL80211_WIPHY_RADIO_FREQ_ATTR_MAX = __NL80211_WIPHY_RADIO_FREQ_ATTR_LAST - 1, -+}; -+ - #endif /* __LINUX_NL80211_H */ diff --git a/package/network/utils/iw/patches/010-Revert-iw-allow-specifying-CFLAGS-LIBS-externally.patch b/package/network/utils/iw/patches/010-Revert-iw-allow-specifying-CFLAGS-LIBS-externally.patch index 1c93f00900f..218413b890b 100644 --- a/package/network/utils/iw/patches/010-Revert-iw-allow-specifying-CFLAGS-LIBS-externally.patch +++ b/package/network/utils/iw/patches/010-Revert-iw-allow-specifying-CFLAGS-LIBS-externally.patch @@ -16,7 +16,7 @@ Signed-off-by: Hauke Mehrtens --- a/Makefile +++ b/Makefile -@@ -46,30 +46,30 @@ NLLIBNAME = libnl-1 +@@ -47,30 +47,30 @@ NLLIBNAME = libnl-1 endif ifeq ($(NL2FOUND),Y) @@ -55,7 +55,7 @@ Signed-off-by: Hauke Mehrtens NLLIBNAME = libnl-3.1 endif -@@ -77,8 +77,8 @@ ifeq ($(NLLIBNAME),) +@@ -78,8 +78,8 @@ ifeq ($(NLLIBNAME),) $(error Cannot find development files for any supported version of libnl) endif diff --git a/package/network/utils/iw/patches/100-scan-Add-printing-of-HE-Operation-Element.patch b/package/network/utils/iw/patches/100-scan-Add-printing-of-HE-Operation-Element.patch deleted file mode 100644 index a251ceea37f..00000000000 --- a/package/network/utils/iw/patches/100-scan-Add-printing-of-HE-Operation-Element.patch +++ /dev/null @@ -1,153 +0,0 @@ -From 422419e06d55a7c852d1f6f054a094e285ebaa27 Mon Sep 17 00:00:00 2001 -From: Christopher A Wills -Date: Tue, 30 Jul 2024 16:27:36 -0700 -Subject: [PATCH] scan: Add printing of HE Operation Element - -Signed-off-by: Christopher A Wills ---- - iw.h | 1 + - scan.c | 8 +++++ - util.c | 103 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 112 insertions(+) - ---- a/iw.h -+++ b/iw.h -@@ -222,6 +222,7 @@ void print_ampdu_spacing(__u8 spacing); - void print_ht_capability(__u16 cap); - 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_info(struct nlattr *nl_iftype, int band); - void print_s1g_capability(const uint8_t *caps); ---- a/scan.c -+++ b/scan.c -@@ -2384,8 +2384,16 @@ static void print_he_capa(const uint8_t - print_he_capability(data, len); - } - -+static void print_he_oper(const uint8_t type, uint8_t len, const uint8_t *data, -+ const struct print_ies_data *ie_buffer) -+{ -+ printf("\n"); -+ print_he_operation(data, len); -+} -+ - static const struct ie_print ext_printers[] = { - [35] = { "HE capabilities", print_he_capa, 21, 54, BIT(PRINT_SCAN), }, -+ [36] = { "HE Operation", print_he_oper, 6, 15, BIT(PRINT_SCAN), }, - }; - - static void print_extension(unsigned char len, unsigned char *ie, ---- a/util.c -+++ b/util.c -@@ -1733,6 +1733,109 @@ void print_he_capability(const uint8_t * - __print_he_capa(mac_cap, phy_cap - 1, mcs_set, mcs_len, NULL, 0, false); - } - -+void print_he_operation(const uint8_t *ie, int len) -+{ -+ uint8_t oper_parameters[3] = {ie[0], ie[1], ie[2] }; -+ uint8_t bss_color = ie[3]; -+ uint16_t nss_mcs_set = *(uint16_t*)(&ie[4]); -+ uint8_t vht_oper_present = oper_parameters[1] & 0x40; -+ uint8_t co_hosted_bss_present = oper_parameters[1] & 0x80; -+ uint8_t uhb_operation_info_present = oper_parameters[2] & 0x02; -+ uint8_t offset = 6; -+ -+ printf("\t\tHE Operation Parameters: (0x%02x%02x%02x)\n", -+ oper_parameters[2], oper_parameters[1], oper_parameters[0]); -+ printf("\t\t\tDefault PE Duration: %hhu\n", oper_parameters[0] & 0x07); -+ if (oper_parameters[0] & 0x08) -+ printf("\t\t\tTWT Required\n"); -+ -+ printf("\t\t\tTXOP Duration RTS Threshold: %hu\n", -+ (*(uint16_t*)(oper_parameters)) >> 4 & 0x03ff); -+ if (oper_parameters[1] & 0x40) -+ printf("\t\t\tVHT Operation Information Present\n"); -+ -+ if (oper_parameters[1] & 0x80) -+ printf("\t\t\tCo-Hosted BSS\n"); -+ -+ if (oper_parameters[2] & 0x01) -+ printf("\t\t\tER SU Disable\n"); -+ -+ if (oper_parameters[2] & 0x02) -+ printf("\t\t\t6 GHz Operation Information Present\n"); -+ -+ printf("\t\tBSS Color: %hhu\n", bss_color & 0x3F); -+ if (bss_color & 0x40) -+ printf("\t\tPartial BSS Color\n"); -+ -+ if (bss_color & 0x80) -+ printf("\t\tBSS Color Disabled\n"); -+ -+ printf("\t\tBasic HE-MCS NSS Set: 0x%04x\n", nss_mcs_set); -+ for (int k = 0; k < 8; k++) { -+ __u16 mcs = nss_mcs_set; -+ -+ mcs >>= k * 2; -+ mcs &= 0x3; -+ printf("\t\t\t%d streams: ", k + 1); -+ if (mcs == 3) -+ printf("not supported\n"); -+ else -+ printf("MCS 0-%d\n", 7 + (mcs * 2)); -+ } -+ -+ if (vht_oper_present) { -+ if (len - offset < 3) { -+ printf("\t\tVHT Operation Info: Invalid\n"); -+ return; -+ } -+ -+ printf("\t\tVHT Operation Info: 0x%02x%02x%02x\n", -+ ie[offset + 2], ie[offset + 1], ie[offset + 0]); -+ offset += 3; -+ } -+ -+ if (co_hosted_bss_present) { -+ if (len - offset < 1) { -+ printf("\t\tMax Co-Hosted BSSID: Invalid\n"); -+ return; -+ } -+ -+ printf("\t\tMax Co-Hosted BSSID: %hhu\n", ie[offset]); -+ offset += 1; -+ } -+ -+ if (uhb_operation_info_present) { -+ if (len - offset < 5) { -+ printf("\t\t6 GHz Operation Info: Invalid\n"); -+ return; -+ } else { -+ const uint8_t control = ie[offset + 1]; -+ -+ printf("\t\t6 Ghz Operation Information: 0x"); -+ for (uint8_t i = 0; i < 5; i++) -+ printf("%02x", ie[offset + i]); -+ -+ printf("\n"); -+ printf("\t\t\tPrimary Channel: %hhu\n", ie[offset]); -+ printf("\t\t\tChannel Width: "); -+ switch (control & 0x3) { -+ case 0: printf("20 MHz\n"); break; -+ case 1: printf("40 MHz\n"); break; -+ case 2: printf("80 MHz\n"); break; -+ case 3: printf("80+80 or 160 MHz\n"); break; -+ } -+ -+ if (control & 0x4) -+ printf("\t\t\tDuplicate Beacon: True\n"); -+ -+ printf("\t\t\tRegulatory Info: %hhu\n", (control >> 3) & 0xf); -+ printf("\t\t\tCenter Frequency Segment 0: %hhu\n", ie[offset+2]); -+ printf("\t\t\tCenter Frequency Segment 1: %hhu\n", ie[offset+3]); -+ printf("\t\t\tMinimum Rate: %hhu\n", ie[offset+4]); -+ } -+ } -+} -+ - void iw_hexdump(const char *prefix, const __u8 *buf, size_t size) - { - size_t i; diff --git a/package/network/utils/iw/patches/101-iw-fix-HE-capabilities-on-Big-Endian-platforms.patch b/package/network/utils/iw/patches/101-iw-fix-HE-capabilities-on-Big-Endian-platforms.patch deleted file mode 100644 index a4abc14abac..00000000000 --- a/package/network/utils/iw/patches/101-iw-fix-HE-capabilities-on-Big-Endian-platforms.patch +++ /dev/null @@ -1,77 +0,0 @@ -From c41971e27a8359f88122593a2700f270f58cb2fa Mon Sep 17 00:00:00 2001 -From: Aleksander Jan Bajkowski -Date: Sat, 5 Apr 2025 20:48:05 +0200 -Subject: [PATCH 1/2] iw: fix HE capabilities on Big Endian platforms - -IE fields are encoded in Little Endian and are not correctly -printed on Big Endian platforms. - -Fixes: c741be9f6ca3 ("iw: print HE capabilities") -Signed-off-by: Aleksander Jan Bajkowski -Link: https://patch.msgid.link/20250405184807.701728-2-olek2@wp.pl -Signed-off-by: Johannes Berg ---- - util.c | 17 +++++++++-------- - 1 file changed, 9 insertions(+), 8 deletions(-) - ---- a/util.c -+++ b/util.c -@@ -1245,14 +1245,15 @@ static void __print_he_capa(const __u16 - - #define PRINT_HE_CAP(_var, _idx, _bit, _str) \ - do { \ -- if (_var[_idx] & BIT(_bit)) \ -+ if (le16toh(_var[_idx]) & BIT(_bit)) \ - printf("%s\t\t\t" _str "\n", pre); \ - } while (0) - - #define PRINT_HE_CAP_MASK(_var, _idx, _shift, _mask, _str) \ - do { \ -- if ((_var[_idx] >> _shift) & _mask) \ -- printf("%s\t\t\t" _str ": %d\n", pre, (_var[_idx] >> _shift) & _mask); \ -+ if ((le16toh(_var[_idx]) >> _shift) & _mask) \ -+ printf("%s\t\t\t" _str ": %d\n", pre, \ -+ (le16toh(_var[_idx]) >> _shift) & _mask); \ - } while (0) - - #define PRINT_HE_MAC_CAP(...) PRINT_HE_CAP(mac_cap, __VA_ARGS__) -@@ -1263,7 +1264,7 @@ static void __print_he_capa(const __u16 - - printf("%s\t\tHE MAC Capabilities (0x", pre); - for (i = 0; i < 3; i++) -- printf("%04x", mac_cap[i]); -+ printf("%04x", le16toh(mac_cap[i])); - printf("):\n"); - - PRINT_HE_MAC_CAP(0, 0, "+HTC HE Supported"); -@@ -1377,18 +1378,18 @@ static void __print_he_capa(const __u16 - char *bw[] = { "<= 80", "160", "80+80" }; - int j; - -- if ((phy_cap[0] & (phy_cap_support[i] << 8)) == 0) -+ if ((le16toh(phy_cap[0]) & (phy_cap_support[i] << 8)) == 0) - continue; - - /* Supports more, but overflow? Abort. */ -- if ((i * 2 + 2) * sizeof(mcs_set[0]) >= mcs_len) -+ if ((i * 2 + 2) * sizeof(le16toh(mcs_set[0])) >= mcs_len) - return; - - for (j = 0; j < 2; j++) { - int k; - printf("%s\t\tHE %s MCS and NSS set %s MHz\n", pre, j ? "TX" : "RX", bw[i]); - for (k = 0; k < 8; k++) { -- __u16 mcs = mcs_set[(i * 2) + j]; -+ __u16 mcs = le16toh(mcs_set[(i * 2) + j]); - mcs >>= k * 2; - mcs &= 0x3; - printf("%s\t\t\t%d streams: ", pre, k + 1); -@@ -1411,7 +1412,7 @@ static void __print_he_capa(const __u16 - ppet_len = 0; - } - -- if (ppet_len && (phy_cap[3] & BIT(15))) { -+ if (ppet_len && (le16toh(phy_cap[3]) & BIT(15))) { - printf("%s\t\tPPE Threshold ", pre); - for (i = 0; i < ppet_len; i++) - if (ppet[i]) diff --git a/package/network/utils/iw/patches/102-iw-fix-HE-operation-on-Big-Endian-platforms.patch b/package/network/utils/iw/patches/102-iw-fix-HE-operation-on-Big-Endian-platforms.patch deleted file mode 100644 index 0cb943c6884..00000000000 --- a/package/network/utils/iw/patches/102-iw-fix-HE-operation-on-Big-Endian-platforms.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 41a07a818090da424ddd24bf07f468cf5725cdc6 Mon Sep 17 00:00:00 2001 -From: Aleksander Jan Bajkowski -Date: Sat, 5 Apr 2025 20:48:06 +0200 -Subject: [PATCH 2/2] iw: fix HE operation on Big Endian platforms - -IE fields are encoded in Little Endian and are not correctly -printed on Big Endian platforms. - -Fixes: 422419e06d55 ("scan: Add printing of HE Operation Element") -Signed-off-by: Aleksander Jan Bajkowski -Link: https://patch.msgid.link/20250405184807.701728-3-olek2@wp.pl -Signed-off-by: Johannes Berg ---- - util.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - ---- a/util.c -+++ b/util.c -@@ -1738,7 +1738,7 @@ void print_he_operation(const uint8_t *i - { - uint8_t oper_parameters[3] = {ie[0], ie[1], ie[2] }; - uint8_t bss_color = ie[3]; -- uint16_t nss_mcs_set = *(uint16_t*)(&ie[4]); -+ uint16_t nss_mcs_set = le16toh(*(uint16_t *)(&ie[4])); - uint8_t vht_oper_present = oper_parameters[1] & 0x40; - uint8_t co_hosted_bss_present = oper_parameters[1] & 0x80; - uint8_t uhb_operation_info_present = oper_parameters[2] & 0x02; -@@ -1751,7 +1751,7 @@ void print_he_operation(const uint8_t *i - printf("\t\t\tTWT Required\n"); - - printf("\t\t\tTXOP Duration RTS Threshold: %hu\n", -- (*(uint16_t*)(oper_parameters)) >> 4 & 0x03ff); -+ le16toh((*(uint16_t *)(oper_parameters))) >> 4 & 0x03ff); - if (oper_parameters[1] & 0x40) - printf("\t\t\tVHT Operation Information Present\n"); - diff --git a/package/network/utils/iw/patches/103-iw-scan-add-enum-for-element-IDs.patch b/package/network/utils/iw/patches/103-iw-scan-add-enum-for-element-IDs.patch deleted file mode 100644 index abf699f2ff6..00000000000 --- a/package/network/utils/iw/patches/103-iw-scan-add-enum-for-element-IDs.patch +++ /dev/null @@ -1,170 +0,0 @@ -From 966c590bc4dcbd9a69fdf8fe9f41cec00e72e376 Mon Sep 17 00:00:00 2001 -From: Dylan Eskew -Date: Mon, 30 Sep 2024 11:11:43 -0700 -Subject: [PATCH] iw: scan: add enum for element IDs - -Formerly, element IDs were hardcoded. Improve readability by using -element ID names. - -Signed-off-by: Dylan Eskew -Link: https://patch.msgid.link/20240930181145.1043048-2-dylan.eskew@candelatech.com -Signed-off-by: Johannes Berg ---- - ieee80211.h | 43 +++++++++++++++++++++++++++ - scan.c | 86 +++++++++++++++++++++++++++++++---------------------- - 2 files changed, 93 insertions(+), 36 deletions(-) - ---- a/ieee80211.h -+++ b/ieee80211.h -@@ -58,6 +58,49 @@ struct ieee80211_vht_cap { - struct ieee80211_vht_mcs_info mcs; - } __attribute__ ((packed)); - -+enum elem_id { -+ EID_SSID = 0, -+ EID_SUPP_RATES = 1, -+ EID_DS_PARAMS = 3, -+ EID_TIM = 5, -+ EID_IBSS_TIM_PARAMS = 6, -+ EID_COUNTRY = 7, -+ EID_BSS_LOAD = 11, -+ EID_POWER_CONSTRAINT = 32, -+ EID_TPC_REPORT = 35, -+ EID_ERP_INFO = 42, -+ EID_HT_CAPABILITY = 45, -+ EID_ERP_D4_0 = 47, -+ EID_RSN = 48, -+ EID_EXT_SUPP_RATES = 50, -+ EID_AP_CHAN_REPORT = 51, -+ EID_SUPP_OP_CLASSES = 59, -+ EID_HT_OPERATION = 61, -+ EID_SECONDARY_CH_OFFSET = 62, -+ EID_MEASUREMENT_PILOT_TX = 66, -+ EID_RM_ENABLED_CAPABILITIES = 70, -+ EID_OVERLAP_BSS_SCAN_PARAM = 74, -+ EID_INTERWORKING = 107, -+ EID_ADVERTISEMENT = 108, -+ EID_ROAMING_CONSORTIUM = 111, -+ EID_MESH_CONFIG = 113, -+ EID_MESH_ID = 114, -+ EID_EXT_CAPABILITY = 127, -+ EID_VHT_CAPABILITY = 191, -+ EID_VHT_OPERATION = 192, -+ EID_TRANSMIT_POWER_ENVELOPE = 195, -+ EID_SHORT_BEACON_INTERVAL = 214, -+ EID_S1G_CAPABILITY = 217, -+ EID_VENDOR = 221, -+ EID_S1G_OPERATION = 232, -+ EID_EXTENSION = 255, -+}; -+ -+enum elem_id_ext { -+ EID_EXT_HE_CAPABILITY = 35, -+ EID_EXT_HE_OPERATION = 36, -+}; -+ - #define SUITE(oui, id) (((oui) << 8) | (id)) - - /* cipher suite selectors */ ---- a/scan.c -+++ b/scan.c -@@ -1816,40 +1816,54 @@ static void print_ie(const struct ie_pri - } - - static const struct ie_print ieprinters[] = { -- [0] = { "SSID", print_ssid, 0, 32, -- BIT(PRINT_SCAN) | BIT(PRINT_LINK) | BIT(PRINT_LINK_MLO_MLD), }, -- [1] = { "Supported rates", print_supprates, 0, 255, BIT(PRINT_SCAN), }, -- [3] = { "DS Parameter set", print_ds, 1, 1, BIT(PRINT_SCAN), }, -- [5] = { "TIM", print_tim, 4, 255, BIT(PRINT_SCAN), }, -- [6] = { "IBSS ATIM window", print_ibssatim, 2, 2, BIT(PRINT_SCAN), }, -- [7] = { "Country", print_country, 3, 255, BIT(PRINT_SCAN), }, -- [11] = { "BSS Load", print_bss_load, 5, 5, BIT(PRINT_SCAN), }, -- [32] = { "Power constraint", print_powerconstraint, 1, 1, BIT(PRINT_SCAN), }, -- [35] = { "TPC report", print_tpcreport, 2, 2, BIT(PRINT_SCAN), }, -- [42] = { "ERP", print_erp, 1, 255, BIT(PRINT_SCAN), }, -- [45] = { "HT capabilities", print_ht_capa, 26, 26, BIT(PRINT_SCAN), }, -- [47] = { "ERP D4.0", print_erp, 1, 255, BIT(PRINT_SCAN), }, -- [51] = { "AP Channel Report", print_ap_channel_report, 1, 255, BIT(PRINT_SCAN), }, -- [59] = { "Supported operating classes", print_supp_op_classes, 1, 255, BIT(PRINT_SCAN), }, -- [66] = { "Measurement Pilot Transmission", print_measurement_pilot_tx, 1, 255, BIT(PRINT_SCAN), }, -- [74] = { "Overlapping BSS scan params", print_obss_scan_params, 14, 255, BIT(PRINT_SCAN), }, -- [61] = { "HT operation", print_ht_op, 22, 22, BIT(PRINT_SCAN), }, -- [62] = { "Secondary Channel Offset", print_secchan_offs, 1, 1, BIT(PRINT_SCAN), }, -- [191] = { "VHT capabilities", print_vht_capa, 12, 255, BIT(PRINT_SCAN), }, -- [192] = { "VHT operation", print_vht_oper, 5, 255, BIT(PRINT_SCAN), }, -- [48] = { "RSN", print_rsn, 2, 255, BIT(PRINT_SCAN), }, -- [50] = { "Extended supported rates", print_supprates, 0, 255, BIT(PRINT_SCAN), }, -- [70] = { "RM enabled capabilities", print_rm_enabled_capabilities, 5, 5, BIT(PRINT_SCAN), }, -- [113] = { "MESH Configuration", print_mesh_conf, 7, 7, BIT(PRINT_SCAN), }, -- [114] = { "MESH ID", print_ssid, 0, 32, BIT(PRINT_SCAN) | BIT(PRINT_LINK), }, -- [127] = { "Extended capabilities", print_capabilities, 0, 255, BIT(PRINT_SCAN), }, -- [107] = { "802.11u Interworking", print_interworking, 0, 255, BIT(PRINT_SCAN), }, -- [108] = { "802.11u Advertisement", print_11u_advert, 0, 255, BIT(PRINT_SCAN), }, -- [111] = { "802.11u Roaming Consortium", print_11u_rcon, 2, 255, BIT(PRINT_SCAN), }, -- [195] = { "Transmit Power Envelope", print_tx_power_envelope, 2, 5, BIT(PRINT_SCAN), }, -- [214] = { "Short beacon interval", print_short_beacon_int, 2, 2, BIT(PRINT_SCAN), }, -- [217] = { "S1G capabilities", print_s1g_capa, 15, 15, BIT(PRINT_SCAN), }, -- [232] = { "S1G operation", print_s1g_oper, 6, 6, BIT(PRINT_SCAN), }, -+ [EID_SSID] = { "SSID", print_ssid, 0, 32, -+ BIT(PRINT_SCAN) | BIT(PRINT_LINK) | BIT(PRINT_LINK_MLO_MLD), }, -+ [EID_SUPP_RATES] = { "Supported rates", print_supprates, 0, 255, BIT(PRINT_SCAN), }, -+ [EID_DS_PARAMS] = { "DS Parameter set", print_ds, 1, 1, BIT(PRINT_SCAN), }, -+ [EID_TIM] = { "TIM", print_tim, 4, 255, BIT(PRINT_SCAN), }, -+ [EID_IBSS_TIM_PARAMS] = { "IBSS ATIM window", print_ibssatim, 2, 2, BIT(PRINT_SCAN), }, -+ [EID_COUNTRY] = { "Country", print_country, 3, 255, BIT(PRINT_SCAN), }, -+ [EID_BSS_LOAD] = { "BSS Load", print_bss_load, 5, 5, BIT(PRINT_SCAN), }, -+ [EID_POWER_CONSTRAINT] = { "Power constraint", print_powerconstraint, -+ 1, 1, BIT(PRINT_SCAN), }, -+ [EID_TPC_REPORT] = { "TPC report", print_tpcreport, 2, 2, BIT(PRINT_SCAN), }, -+ [EID_ERP_INFO] = { "ERP", print_erp, 1, 255, BIT(PRINT_SCAN), }, -+ [EID_HT_CAPABILITY] = { "HT capabilities", print_ht_capa, 26, 26, BIT(PRINT_SCAN), }, -+ [EID_ERP_D4_0] = { "ERP D4.0", print_erp, 1, 255, BIT(PRINT_SCAN), }, -+ [EID_AP_CHAN_REPORT] = { "AP Channel Report", print_ap_channel_report, -+ 1, 255, BIT(PRINT_SCAN), }, -+ [EID_SUPP_OP_CLASSES] = { "Supported operating classes", -+ print_supp_op_classes, 1, 255, BIT(PRINT_SCAN), }, -+ [EID_MEASUREMENT_PILOT_TX] = { "Measurement Pilot Transmission", -+ print_measurement_pilot_tx, 1, 255, BIT(PRINT_SCAN), }, -+ [EID_OVERLAP_BSS_SCAN_PARAM] = { "Overlapping BSS scan params", -+ print_obss_scan_params, 14, 255, BIT(PRINT_SCAN), }, -+ [EID_HT_OPERATION] = { "HT operation", print_ht_op, 22, 22, BIT(PRINT_SCAN), }, -+ [EID_SECONDARY_CH_OFFSET] = { "Secondary Channel Offset", -+ print_secchan_offs, 1, 1, BIT(PRINT_SCAN), }, -+ [EID_VHT_CAPABILITY] = { "VHT capabilities", print_vht_capa, 12, 255, BIT(PRINT_SCAN), }, -+ [EID_VHT_OPERATION] = { "VHT operation", print_vht_oper, 5, 255, BIT(PRINT_SCAN), }, -+ [EID_RSN] = { "RSN", print_rsn, 2, 255, BIT(PRINT_SCAN), }, -+ [EID_EXT_SUPP_RATES] = { "Extended supported rates", print_supprates, -+ 0, 255, BIT(PRINT_SCAN), }, -+ [EID_RM_ENABLED_CAPABILITIES] = { "RM enabled capabilities", -+ print_rm_enabled_capabilities, 5, 5, BIT(PRINT_SCAN), }, -+ [EID_MESH_CONFIG] = { "MESH Configuration", print_mesh_conf, 7, 7, BIT(PRINT_SCAN), }, -+ [EID_MESH_ID] = { "MESH ID", print_ssid, 0, 32, BIT(PRINT_SCAN) | BIT(PRINT_LINK), }, -+ [EID_EXT_CAPABILITY] = { "Extended capabilities", print_capabilities, -+ 0, 255, BIT(PRINT_SCAN), }, -+ [EID_INTERWORKING] = { "802.11u Interworking", print_interworking, -+ 0, 255, BIT(PRINT_SCAN), }, -+ [EID_ADVERTISEMENT] = { "802.11u Advertisement", print_11u_advert, -+ 0, 255, BIT(PRINT_SCAN), }, -+ [EID_ROAMING_CONSORTIUM] = { "802.11u Roaming Consortium", -+ print_11u_rcon, 2, 255, BIT(PRINT_SCAN), }, -+ [EID_TRANSMIT_POWER_ENVELOPE] = { "Transmit Power Envelope", -+ print_tx_power_envelope, 2, 5, BIT(PRINT_SCAN), }, -+ [EID_SHORT_BEACON_INTERVAL] = { "Short beacon interval", -+ print_short_beacon_int, 2, 2, BIT(PRINT_SCAN), }, -+ [EID_S1G_CAPABILITY] = { "S1G capabilities", print_s1g_capa, 15, 15, BIT(PRINT_SCAN), }, -+ [EID_S1G_OPERATION] = { "S1G operation", print_s1g_oper, 6, 6, BIT(PRINT_SCAN), }, - }; - - static void print_wifi_wpa(const uint8_t type, uint8_t len, const uint8_t *data, -@@ -2392,8 +2406,8 @@ static void print_he_oper(const uint8_t - } - - static const struct ie_print ext_printers[] = { -- [35] = { "HE capabilities", print_he_capa, 21, 54, BIT(PRINT_SCAN), }, -- [36] = { "HE Operation", print_he_oper, 6, 15, BIT(PRINT_SCAN), }, -+ [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), }, - }; - - static void print_extension(unsigned char len, unsigned char *ie, diff --git a/package/network/utils/iw/patches/104-iw-scan-replace-passed-ie-buffer-with-ie-context.patch b/package/network/utils/iw/patches/104-iw-scan-replace-passed-ie-buffer-with-ie-context.patch deleted file mode 100644 index aa8b8b16a04..00000000000 --- a/package/network/utils/iw/patches/104-iw-scan-replace-passed-ie-buffer-with-ie-context.patch +++ /dev/null @@ -1,482 +0,0 @@ -From a0a7ddef29fc412cee7e3ca027905218b145a40f Mon Sep 17 00:00:00 2001 -From: Dylan Eskew -Date: Fri, 22 Nov 2024 08:18:51 -0800 -Subject: [PATCH] iw: scan: replace passed ie buffer with ie context - -Since some ies require references to other ies, parse -the ie list once before to create a context and prevent -parsing more than the two times required. - -Signed-off-by: Dylan Eskew -Link: https://patch.msgid.link/20241122161851.647214-1-dylan.eskew@candelatech.com -[cleanups] -Signed-off-by: Johannes Berg ---- - scan.c | 141 +++++++++++++++++++++++++++++++-------------------------- - 1 file changed, 76 insertions(+), 65 deletions(-) - ---- a/scan.c -+++ b/scan.c -@@ -554,13 +554,12 @@ static void tab_on_first(bool *first) - *first = false; - } - --struct print_ies_data { -- unsigned char *ie; -- int ielen; -+struct ie_context { -+ bool is_vht_cap; - }; - - static void print_ssid(const uint8_t type, uint8_t len, const uint8_t *data, -- const struct print_ies_data *ie_buffer) -+ const struct ie_context *ctx) - { - printf(" "); - print_ssid_escaped(len, data); -@@ -572,7 +571,7 @@ static void print_ssid(const uint8_t typ - - static void print_supprates(const uint8_t type, uint8_t len, - const uint8_t *data, -- const struct print_ies_data *ie_buffer) -+ const struct ie_context *ctx) - { - int i; - -@@ -595,7 +594,7 @@ static void print_supprates(const uint8_ - - static void print_rm_enabled_capabilities(const uint8_t type, uint8_t len, - const uint8_t *data, -- const struct print_ies_data *ie_buffer) -+ const struct ie_context *ctx) - { - __u64 capa = ((__u64) data[0]) | - ((__u64) data[1]) << 8 | -@@ -649,7 +648,7 @@ static void print_rm_enabled_capabilitie - } - - static void print_ds(const uint8_t type, uint8_t len, const uint8_t *data, -- const struct print_ies_data *ie_buffer) -+ const struct ie_context *ctx) - { - printf(" channel %d\n", data[0]); - } -@@ -669,7 +668,7 @@ static const char *country_env_str(char - } - - static void print_country(const uint8_t type, uint8_t len, const uint8_t *data, -- const struct print_ies_data *ie_buffer) -+ const struct ie_context *ctx) - { - printf(" %.*s", 2, data); - -@@ -716,21 +715,21 @@ static void print_country(const uint8_t - - static void print_powerconstraint(const uint8_t type, uint8_t len, - const uint8_t *data, -- const struct print_ies_data *ie_buffer) -+ const struct ie_context *ctx) - { - printf(" %d dB\n", data[0]); - } - - static void print_tpcreport(const uint8_t type, uint8_t len, - const uint8_t *data, -- const struct print_ies_data *ie_buffer) -+ const struct ie_context *ctx) - { - printf(" TX power: %d dBm\n", data[0]); - /* printf(" Link Margin (%d dB) is reserved in Beacons\n", data[1]); */ - } - - static void print_erp(const uint8_t type, uint8_t len, const uint8_t *data, -- const struct print_ies_data *ie_buffer) -+ const struct ie_context *ctx) - { - if (data[0] == 0x00) - printf(" "); -@@ -744,7 +743,7 @@ static void print_erp(const uint8_t type - } - - static void print_ap_channel_report(const uint8_t type, uint8_t len, const uint8_t *data, -- const struct print_ies_data *ie_buffer) -+ const struct ie_context *ctx) - { - uint8_t oper_class = data[0]; - int i; -@@ -1084,13 +1083,13 @@ static void print_osen_ie(const char *de - } - - static void print_rsn(const uint8_t type, uint8_t len, const uint8_t *data, -- const struct print_ies_data *ie_buffer) -+ const struct ie_context *ctx) - { - print_rsn_ie("CCMP", "IEEE 802.1X", len, data); - } - - static void print_ht_capa(const uint8_t type, uint8_t len, const uint8_t *data, -- const struct print_ies_data *ie_buffer) -+ const struct ie_context *ctx) - { - printf("\n"); - print_ht_capability(data[0] | (data[1] << 8)); -@@ -1135,7 +1134,7 @@ static const char* vgroup_11u(uint8_t t) - - static void print_interworking(const uint8_t type, uint8_t len, - const uint8_t *data, -- const struct print_ies_data *ie_buffer) -+ const struct ie_context *ctx) - { - /* See Section 7.3.2.92 in the 802.11u spec. */ - printf("\n"); -@@ -1168,7 +1167,7 @@ static void print_interworking(const uin - - static void print_11u_advert(const uint8_t type, uint8_t len, - const uint8_t *data, -- const struct print_ies_data *ie_buffer) -+ const struct ie_context *ctx) - { - /* See Section 7.3.2.93 in the 802.11u spec. */ - /* TODO: This code below does not decode private protocol IDs */ -@@ -1201,7 +1200,7 @@ static void print_11u_advert(const uint8 - } - - static void print_11u_rcon(const uint8_t type, uint8_t len, const uint8_t *data, -- const struct print_ies_data *ie_buffer) -+ const struct ie_context *ctx) - { - /* See Section 7.3.2.96 in the 802.11u spec. */ - int idx = 0; -@@ -1254,7 +1253,7 @@ static void print_11u_rcon(const uint8_t - - static void print_tx_power_envelope(const uint8_t type, uint8_t len, - const uint8_t *data, -- const struct print_ies_data *ie_buffer) -+ const struct ie_context *ctx) - { - const uint8_t local_max_tx_power_count = data[0] & 7; - const uint8_t local_max_tx_power_unit_interp = (data[0] >> 3) & 7; -@@ -1290,7 +1289,7 @@ static const char *ht_secondary_offset[4 - }; - - static void print_ht_op(const uint8_t type, uint8_t len, const uint8_t *data, -- const struct print_ies_data *ie_buffer) -+ const struct ie_context *ctx) - { - static const char *protection[4] = { - "no", -@@ -1322,21 +1321,10 @@ static void print_ht_op(const uint8_t ty - - static void print_capabilities(const uint8_t type, uint8_t len, - const uint8_t *data, -- const struct print_ies_data *ie_buffer) -+ const struct ie_context *ctx) - { - int i, base, bit, si_duration = 0, max_amsdu = 0; -- bool s_psmp_support = false, is_vht_cap = false; -- unsigned char *ie = ie_buffer->ie; -- int ielen = ie_buffer->ielen; -- -- while (ielen >= 2 && ielen >= ie[1]) { -- if (ie[0] == 191) { -- is_vht_cap = true; -- break; -- } -- ielen -= ie[1] + 2; -- ie += ie[1] + 2; -- } -+ bool s_psmp_support = false; - - for (i = 0; i < len; i++) { - base = i * 8; -@@ -1432,8 +1420,8 @@ static void print_capabilities(const uin - CAPA(61, "TDLS Wider Bandwidth"); - CAPA(62, "Operating Mode Notification"); - -- ADD_BIT_VAL(63, is_vht_cap, max_amsdu, 1); -- ADD_BIT_VAL(64, is_vht_cap, max_amsdu, 2); -+ ADD_BIT_VAL(63, ctx->is_vht_cap, max_amsdu, 1); -+ ADD_BIT_VAL(64, ctx->is_vht_cap, max_amsdu, 2); - - CAPA(65, "Channel Schedule Management"); - CAPA(66, "Geodatabase Inband Enabling Signal"); -@@ -1462,7 +1450,7 @@ static void print_capabilities(const uin - printf("\n\t\t * Service Interval Granularity is %d ms", - (si_duration + 1) * 5); - -- if (is_vht_cap) { -+ if (ctx->is_vht_cap) { - printf("\n\t\t * Max Number Of MSDUs In A-MSDU is "); - switch (max_amsdu) { - case 0: -@@ -1486,7 +1474,7 @@ static void print_capabilities(const uin - } - - static void print_tim(const uint8_t type, uint8_t len, const uint8_t *data, -- const struct print_ies_data *ie_buffer) -+ const struct ie_context *ctx) - { - printf(" DTIM Count %u DTIM Period %u Bitmap Control 0x%x " - "Bitmap[0] 0x%x", -@@ -1497,13 +1485,13 @@ static void print_tim(const uint8_t type - } - - static void print_ibssatim(const uint8_t type, uint8_t len, const uint8_t *data, -- const struct print_ies_data *ie_buffer) -+ const struct ie_context *ctx) - { - printf(" %d TUs\n", (data[1] << 8) + data[0]); - } - - static void print_vht_capa(const uint8_t type, uint8_t len, const uint8_t *data, -- const struct print_ies_data *ie_buffer) -+ const struct ie_context *ctx) - { - printf("\n"); - print_vht_info((__u32) data[0] | ((__u32)data[1] << 8) | -@@ -1512,7 +1500,7 @@ static void print_vht_capa(const uint8_t - } - - static void print_vht_oper(const uint8_t type, uint8_t len, const uint8_t *data, -- const struct print_ies_data *ie_buffer) -+ const struct ie_context *ctx) - { - const char *chandwidths[] = { - [0] = "20 or 40 MHz", -@@ -1531,7 +1519,7 @@ static void print_vht_oper(const uint8_t - - static void print_supp_op_classes(const uint8_t type, uint8_t len, - const uint8_t *data, -- const struct print_ies_data *ie_buffer) -+ const struct ie_context *ctx) - { - uint8_t *p = (uint8_t*) data; - const uint8_t *next_data = p + len; -@@ -1565,7 +1553,7 @@ static void print_supp_op_classes(const - - static void print_measurement_pilot_tx(const uint8_t type, uint8_t len, - const uint8_t *data, -- const struct print_ies_data *ie_buffer) -+ const struct ie_context *ctx) - { - uint8_t *p, len_remaining; - -@@ -1614,7 +1602,7 @@ static void print_measurement_pilot_tx(c - - static void print_obss_scan_params(const uint8_t type, uint8_t len, - const uint8_t *data, -- const struct print_ies_data *ie_buffer) -+ const struct ie_context *ctx) - { - printf("\n"); - printf("\t\t * passive dwell: %d TUs\n", (data[1] << 8) | data[0]); -@@ -1629,7 +1617,7 @@ static void print_obss_scan_params(const - - static void print_secchan_offs(const uint8_t type, uint8_t len, - const uint8_t *data, -- const struct print_ies_data *ie_buffer) -+ const struct ie_context *ctx) - { - if (data[0] < ARRAY_SIZE(ht_secondary_offset)) - printf(" %s (%d)\n", ht_secondary_offset[data[0]], data[0]); -@@ -1638,7 +1626,7 @@ static void print_secchan_offs(const uin - } - - static void print_bss_load(const uint8_t type, uint8_t len, const uint8_t *data, -- const struct print_ies_data *ie_buffer) -+ const struct ie_context *ctx) - { - printf("\n"); - printf("\t\t * station count: %d\n", (data[1] << 8) | data[0]); -@@ -1648,7 +1636,7 @@ static void print_bss_load(const uint8_t - - static void print_mesh_conf(const uint8_t type, uint8_t len, - const uint8_t *data, -- const struct print_ies_data *ie_buffer) -+ const struct ie_context *ctx) - { - printf("\n"); - printf("\t\t * Active Path Selection Protocol ID: %d\n", data[0]); -@@ -1681,7 +1669,7 @@ static void print_mesh_conf(const uint8_ - - static void print_s1g_capa(const uint8_t type, uint8_t len, - const uint8_t *data, -- const struct print_ies_data *ie_buffer) -+ const struct ie_context *ctx) - { - printf("\n"); - print_s1g_capability(data); -@@ -1689,14 +1677,14 @@ static void print_s1g_capa(const uint8_t - - static void print_short_beacon_int(const uint8_t type, uint8_t len, - const uint8_t *data, -- const struct print_ies_data *ie_buffer) -+ const struct ie_context *ctx) - { - printf(" %d\n", (data[1] << 8) | data[0]); - } - - static void print_s1g_oper(const uint8_t type, uint8_t len, - const uint8_t *data, -- const struct print_ies_data *ie_buffer) -+ const struct ie_context *ctx) - { - int oper_ch_width, prim_ch_width; - int prim_ch_width_subfield = data[0] & 0x1; -@@ -1777,14 +1765,14 @@ static void print_s1g_oper(const uint8_t - struct ie_print { - const char *name; - void (*print)(const uint8_t type, uint8_t len, const uint8_t *data, -- const struct print_ies_data *ie_buffer); -+ const struct ie_context *ctx); - uint8_t minlen, maxlen; - uint8_t flags; - }; - - static void print_ie(const struct ie_print *p, const uint8_t type, uint8_t len, - const uint8_t *data, -- const struct print_ies_data *ie_buffer) -+ const struct ie_context *ctx) - { - int i; - -@@ -1805,7 +1793,7 @@ static void print_ie(const struct ie_pri - return; - } - -- p->print(type, len, data, ie_buffer); -+ p->print(type, len, data, ctx); - } - - #define PRINT_IGN { \ -@@ -1867,14 +1855,14 @@ static const struct ie_print ieprinters[ - }; - - static void print_wifi_wpa(const uint8_t type, uint8_t len, const uint8_t *data, -- const struct print_ies_data *ie_buffer) -+ const struct ie_context *ctx) - { - print_rsn_ie("TKIP", "IEEE 802.1X", len, data); - } - - static void print_wifi_osen(const uint8_t type, uint8_t len, - const uint8_t *data, -- const struct print_ies_data *ie_buffer) -+ const struct ie_context *ctx) - { - print_osen_ie("OSEN", "OSEN", len, data); - } -@@ -1922,7 +1910,7 @@ static bool print_wifi_wmm_param(const u - } - - static void print_wifi_wmm(const uint8_t type, uint8_t len, const uint8_t *data, -- const struct print_ies_data *ie_buffer) -+ const struct ie_context *ctx) - { - int i; - -@@ -1965,7 +1953,7 @@ static const char * wifi_wps_dev_passwd_ - } - - static void print_wifi_wps(const uint8_t type, uint8_t len, const uint8_t *data, -- const struct print_ies_data *ie_buffer) -+ const struct ie_context *ctx) - { - bool first = true; - __u16 subtype, sublen; -@@ -2205,7 +2193,7 @@ static const struct ie_print wifiprinter - - static inline void print_p2p(const uint8_t type, uint8_t len, - const uint8_t *data, -- const struct print_ies_data *ie_buffer) -+ const struct ie_context *ctx) - { - bool first = true; - __u8 subtype; -@@ -2287,7 +2275,7 @@ static inline void print_p2p(const uint8 - - static inline void print_hs20_ind(const uint8_t type, uint8_t len, - const uint8_t *data, -- const struct print_ies_data *ie_buffer) -+ const struct ie_context *ctx) - { - /* I can't find the spec for this...just going off what wireshark uses. */ - printf("\n"); -@@ -2299,7 +2287,7 @@ static inline void print_hs20_ind(const - - static void print_wifi_owe_tarns(const uint8_t type, uint8_t len, - const uint8_t *data, -- const struct print_ies_data *ie_buffer) -+ const struct ie_context *ctx) - { - char mac_addr[20]; - int ssid_len; -@@ -2392,14 +2380,14 @@ static void print_vendor(unsigned char l - } - - static void print_he_capa(const uint8_t type, uint8_t len, const uint8_t *data, -- const struct print_ies_data *ie_buffer) -+ const struct ie_context *ctx) - { - printf("\n"); - print_he_capability(data, len); - } - - static void print_he_oper(const uint8_t type, uint8_t len, const uint8_t *data, -- const struct print_ies_data *ie_buffer) -+ const struct ie_context *ctx) - { - printf("\n"); - print_he_operation(data, len); -@@ -2437,23 +2425,46 @@ static void print_extension(unsigned cha - } - } - -+static void init_context(struct ie_context *ctx, -+ unsigned char *ie, int ielen) -+{ -+ unsigned char *pos = ie; -+ int remaining = ielen; -+ -+ memset(ctx, 0, sizeof(*ctx)); -+ -+ if (!ie || !ielen) -+ return; -+ -+ while (remaining >= 2 && remaining - 2 >= pos[1]) { -+ switch (pos[0]) { -+ case EID_VHT_CAPABILITY: -+ ctx->is_vht_cap = true; -+ break; -+ } -+ -+ remaining -= pos[1] + 2; -+ pos += pos[1] + 2; -+ } -+} -+ - void print_ies(unsigned char *ie, int ielen, bool unknown, - enum print_ie_type ptype) - { -- struct print_ies_data ie_buffer = { -- .ie = ie, -- .ielen = ielen }; -+ struct ie_context ctx; - -- if (ie == NULL || ielen < 0) -+ if (!ie) - return; - -+ init_context(&ctx, ie, ielen); -+ - while (ielen >= 2 && ielen - 2 >= ie[1]) { - if (ie[0] < ARRAY_SIZE(ieprinters) && - ieprinters[ie[0]].name && - ieprinters[ie[0]].flags & BIT(ptype) && - ie[1] > 0) { - print_ie(&ieprinters[ie[0]], -- ie[0], ie[1], ie + 2, &ie_buffer); -+ ie[0], ie[1], ie + 2, &ctx); - } else if (ie[0] == 221 /* vendor */) { - print_vendor(ie[1], ie + 2, unknown, ptype); - } else if (ie[0] == 255 /* extension */) { diff --git a/package/network/utils/iw/patches/105-iw-util-update-and-clean-up-eht-capa-printing.patch b/package/network/utils/iw/patches/105-iw-util-update-and-clean-up-eht-capa-printing.patch deleted file mode 100644 index 3970677d74b..00000000000 --- a/package/network/utils/iw/patches/105-iw-util-update-and-clean-up-eht-capa-printing.patch +++ /dev/null @@ -1,207 +0,0 @@ -From 4c859917316b69e66ba241d85b4da6ee01292a11 Mon Sep 17 00:00:00 2001 -From: Dylan Eskew -Date: Wed, 19 Mar 2025 11:39:17 -0700 -Subject: [PATCH] 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. - -Signed-off-by: Dylan Eskew -Link: https://patch.msgid.link/20250319183918.1215853-2-dylan.eskew@candelatech.com -Signed-off-by: Johannes Berg ---- - iw.h | 2 + - util.c | 124 ++++++++++++++++++++++++++++++++++++++++++++------------- - 2 files changed, 99 insertions(+), 27 deletions(-) - ---- a/iw.h -+++ b/iw.h -@@ -224,6 +224,8 @@ void print_vht_info(__u32 capa, const __ - 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); - ---- a/util.c -+++ b/util.c -@@ -1515,11 +1515,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 { \ -@@ -1534,6 +1534,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__) - -@@ -1542,13 +1543,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"); -+ 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 < 8; i++) -+ printf("%s\t\tEHT PHY Capabilities (0x", pre); -+ for (i = 0; i < 9; i++) - printf("%02x", ((__u8 *)phy_cap)[i]); - printf("):\n"); - -@@ -1594,39 +1604,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 (!(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); -+ 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" }; -+ -+ 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); -+ } - } - } - -@@ -1713,7 +1761,29 @@ void print_eht_info(struct nlattr *nl_if - } - - __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) diff --git a/package/network/utils/iw/patches/106-iw-scan-add-eht-capability-parsing.patch b/package/network/utils/iw/patches/106-iw-scan-add-eht-capability-parsing.patch deleted file mode 100644 index ff8a323d345..00000000000 --- a/package/network/utils/iw/patches/106-iw-scan-add-eht-capability-parsing.patch +++ /dev/null @@ -1,175 +0,0 @@ -From a6ad3f11ead18d1812c7d3759991dc22b20d90da Mon Sep 17 00:00:00 2001 -From: Dylan Eskew -Date: Wed, 19 Mar 2025 11:39:18 -0700 -Subject: [PATCH] iw: scan: add eht capability parsing - -Add ability to print out EHT capabilities from -AP beacons. - -Signed-off-by: Dylan Eskew -Link: https://patch.msgid.link/20250319183918.1215853-3-dylan.eskew@candelatech.com -Signed-off-by: Johannes Berg ---- - ieee80211.h | 1 + - iw.h | 2 +- - link.c | 5 +++-- - scan.c | 34 +++++++++++++++++++++++++++------- - 4 files changed, 32 insertions(+), 10 deletions(-) - ---- 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)) ---- a/iw.h -+++ b/iw.h -@@ -256,7 +256,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); ---- a/link.c -+++ b/link.c -@@ -93,7 +93,7 @@ static int link_bss_handler(struct nl_ms - 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_ms - 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]); ---- 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 - 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 cha - 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 cha - } - - 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_conte - 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_conte - } - - 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 ie - } 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_m - 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; diff --git a/package/network/utils/iw/patches/107-iw-fix-EHT-capabilities-on-Big-Endian-platforms.patch b/package/network/utils/iw/patches/107-iw-fix-EHT-capabilities-on-Big-Endian-platforms.patch deleted file mode 100644 index d0f15eaec5d..00000000000 --- a/package/network/utils/iw/patches/107-iw-fix-EHT-capabilities-on-Big-Endian-platforms.patch +++ /dev/null @@ -1,107 +0,0 @@ -From 59660a349cf35903e951f99bdd8a74df063c912e Mon Sep 17 00:00:00 2001 -From: Aleksander Jan Bajkowski -Date: Fri, 2 May 2025 21:44:05 +0200 -Subject: [PATCH] iw: fix EHT capabilities on Big Endian platforms - -IE fields are encoded in Little Endian and are not correctly -printed on Big Endian platforms. - -Fixes: 5a71b722270c ("iw: Print local EHT capabilities") -Signed-off-by: Aleksander Jan Bajkowski -Link: https://patch.msgid.link/20250502194405.3489240-1-olek2@wp.pl -Signed-off-by: Johannes Berg ---- - util.c | 40 +++++++++++++++++++++++++--------------- - 1 file changed, 25 insertions(+), 15 deletions(-) - ---- a/util.c -+++ b/util.c -@@ -1521,22 +1521,31 @@ static void __print_eht_capa(int band, - unsigned int i; - const char *pre = indent ? "\t" : ""; - -- #define PRINT_EHT_CAP(_var, _idx, _bit, _str) \ -+ #define PRINT_EHT_MAC_CAP(_idx, _bit, _str) \ - do { \ -- if (_var[_idx] & BIT(_bit)) \ -+ if (mac_cap[_idx] & BIT(_bit)) \ - printf("%s\t\t\t" _str "\n", pre); \ - } while (0) - -- #define PRINT_EHT_CAP_MASK(_var, _idx, _shift, _mask, _str) \ -+ #define PRINT_EHT_MAC_CAP_MASK(_idx, _shift, _mask, _str) \ - do { \ -- if ((_var[_idx] >> _shift) & _mask) \ -- printf("%s\t\t\t" _str ": %d\n", pre, (_var[_idx] >> _shift) & _mask); \ -+ if ((mac_cap[_idx] >> _shift) & _mask) \ -+ printf("%s\t\t\t" _str ": %d\n", pre, \ -+ (mac_cap[_idx] >> _shift) & _mask); \ - } 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__) -+ #define PRINT_EHT_PHY_CAP(_idx, _bit, _str) \ -+ do { \ -+ if (le32toh(phy_cap[_idx]) & BIT(_bit)) \ -+ printf("%s\t\t\t" _str "\n", pre); \ -+ } while (0) -+ -+ #define PRINT_EHT_PHY_CAP_MASK(_idx, _shift, _mask, _str) \ -+ do { \ -+ if ((le32toh(phy_cap[_idx]) >> _shift) & _mask) \ -+ printf("%s\t\t\t" _str ": %d\n", pre, \ -+ (le32toh(phy_cap[_idx]) >> _shift) & _mask); \ -+ } while (0) - - printf("%s\t\tEHT MAC Capabilities (0x", pre); - for (i = 0; i < 2; i++) -@@ -1610,7 +1619,7 @@ static void __print_eht_capa(int band, - 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))) { -+ !(le16toh(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" }; - - printf("%s\t\tEHT-MCS Map (20 Mhz Non-AP STA) (0x", pre); -@@ -1632,8 +1641,9 @@ static void __print_eht_capa(int band, - * 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)))) { -+ if (le16toh(he_phy_cap[0]) & ((BIT(1) | BIT(2)) << 8) || -+ (from_ap && !(le16toh(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("%02x", ((__u8 *)mcs_set)[i]); -@@ -1648,7 +1658,7 @@ static void __print_eht_capa(int band, - } - mcs_set += 3; - -- if (he_phy_cap[0] & (BIT(3) << 8)) { -+ if (le16toh(he_phy_cap[0]) & (BIT(3) << 8)) { - printf("%s\t\tEHT-MCS Map (BW = 160) (0x", pre); - for (i = 0; i < 3; i++) - printf("%02x", ((__u8 *)mcs_set)[i]); -@@ -1663,7 +1673,7 @@ static void __print_eht_capa(int band, - } - - mcs_set += 3; -- if (band == NL80211_BAND_6GHZ && (phy_cap[0] & BIT(1))) { -+ if (band == NL80211_BAND_6GHZ && (le32toh(phy_cap[0]) & BIT(1))) { - printf("%s\t\tEHT-MCS Map (BW = 320) (0x", pre); - for (i = 0; i < 3; i++) - printf("%02x", ((__u8 *)mcs_set)[i]); -@@ -1678,7 +1688,7 @@ static void __print_eht_capa(int band, - } - } - -- if (ppet && ppet_len && (phy_cap[1] & BIT(11))) { -+ if (ppet && ppet_len && (le32toh(phy_cap[1]) & BIT(11))) { - printf("%s\t\tEHT PPE Thresholds ", pre); - for (i = 0; i < ppet_len; i++) - if (ppet[i]) diff --git a/package/network/utils/iw/patches/108-iw-scan-Add-printing-of-EHT-Operation-Element.patch b/package/network/utils/iw/patches/108-iw-scan-Add-printing-of-EHT-Operation-Element.patch deleted file mode 100644 index 81b1def031b..00000000000 --- a/package/network/utils/iw/patches/108-iw-scan-Add-printing-of-EHT-Operation-Element.patch +++ /dev/null @@ -1,131 +0,0 @@ -From 8ea80d378ce5f727e69493533a666278c6a568a7 Mon Sep 17 00:00:00 2001 -From: Aleksander Jan Bajkowski -Date: Fri, 2 May 2025 12:03:53 +0200 -Subject: [PATCH] iw: scan: Add printing of EHT Operation Element - -Add ability to print out EHT capabilities from AP beacons. - -Signed-off-by: Aleksander Jan Bajkowski -Link: https://patch.msgid.link/20250502100353.3149470-1-olek2@wp.pl -[add default case to bandwidth switch] -Signed-off-by: Johannes Berg ---- - ieee80211.h | 1 + - iw.h | 1 + - scan.c | 8 +++++++ - util.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++ - 4 files changed, 73 insertions(+) - ---- 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_OPERATION = 106, - EID_EXT_EHT_CAPABILITY = 108, - }; - ---- a/iw.h -+++ b/iw.h -@@ -226,6 +226,7 @@ void print_he_operation(const uint8_t *i - 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_operation(const uint8_t *ie, int len); - void print_eht_info(struct nlattr *nl_iftype, int band); - void print_s1g_capability(const uint8_t *caps); - ---- a/scan.c -+++ b/scan.c -@@ -2402,10 +2402,18 @@ static void print_eht_capa(const uint8_t - print_eht_capability(data, len, ctx->he_cap, ctx->from_ap); - } - -+static void print_eht_oper(const uint8_t type, uint8_t len, const uint8_t *data, -+ const struct ie_context *ctx) -+{ -+ printf("\n"); -+ print_eht_operation(data, len); -+} -+ - 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), }, -+ [EID_EXT_EHT_OPERATION] = { "EHT Operation", print_eht_oper, 5, 10, BIT(PRINT_SCAN), }, - }; - - static void print_extension(unsigned char len, unsigned char *ie, ---- a/util.c -+++ b/util.c -@@ -1917,6 +1917,69 @@ void print_he_operation(const uint8_t *i - } - } - -+void print_eht_operation(const uint8_t *ie, int len) -+{ -+ uint8_t oper_parameters = ie[0]; -+ uint8_t disabled_subchannel_info_present = oper_parameters & 0x02; -+ uint8_t eht_operation_info_present = oper_parameters & 0x01; -+ -+ printf("\t\tEHT Operation Parameters: (0x%02x)\n", -+ oper_parameters); -+ -+ if (oper_parameters & 0x04) -+ printf("\t\t\tEHT Default PE Duration\n"); -+ -+ if (oper_parameters & 0x08) -+ printf("\t\t\tGroup Addressed BU Indication Limit\n"); -+ -+ printf("\t\t\tGroup Addressed BU Indication Exponent: 0x%01x\n", -+ (oper_parameters >> 4 & 3)); -+ -+ printf("\t\tBasic EHT-MCS And Nss Set: 0x"); -+ for (uint8_t i = 0; i < 4; i++) -+ printf("%02x", ie[1 + i]); -+ -+ printf("\n"); -+ -+ if (eht_operation_info_present) { -+ uint8_t offset = 5; -+ const uint8_t control = ie[offset]; -+ uint8_t eht_operation_info_len = 3; -+ -+ if (disabled_subchannel_info_present) -+ eht_operation_info_len += 2; -+ -+ if (len - offset < eht_operation_info_len) { -+ printf("\t\tEHT Operation Info: Invalid\n"); -+ return; -+ } -+ -+ printf("\t\tEHT Operation Info: 0x"); -+ for (uint8_t i = 0; i < eht_operation_info_len; i++) -+ printf("%02x", ie[offset + i]); -+ -+ printf("\n"); -+ printf("\t\t\tChannel Width: "); -+ switch (control & 0x7) { -+ case 0: printf("20 MHz\n"); break; -+ case 1: printf("40 MHz\n"); break; -+ case 2: printf("80 MHz\n"); break; -+ case 3: printf("160 MHz\n"); break; -+ case 4: printf("320 MHz\n"); break; -+ default: printf("invalid bandwidth (%d)\n", control & 0x7); break; -+ } -+ -+ printf("\t\t\tCenter Frequency Segment 0: %hhu\n", -+ ie[offset + 1]); -+ printf("\t\t\tCenter Frequency Segment 1: %hhu\n", -+ ie[offset + 2]); -+ -+ if (disabled_subchannel_info_present) -+ printf("\t\t\tDisabled Subchannel Bitmap: 0x%02x%02x\n", -+ ie[offset + 3], ie[offset + 4]); -+ } -+} -+ - void iw_hexdump(const char *prefix, const __u8 *buf, size_t size) - { - size_t i; diff --git a/package/network/utils/iw/patches/200-reduce_size.patch b/package/network/utils/iw/patches/200-reduce_size.patch index 40ca57209de..f1327d01cff 100644 --- a/package/network/utils/iw/patches/200-reduce_size.patch +++ b/package/network/utils/iw/patches/200-reduce_size.patch @@ -38,7 +38,7 @@ --- a/info.c +++ b/info.c -@@ -446,6 +446,7 @@ next: +@@ -525,6 +525,7 @@ next: } } @@ -46,7 +46,7 @@ if (tb_band[NL80211_BAND_ATTR_RATES]) { printf("\t\tBitrates (non-HT):\n"); nla_for_each_nested(nl_rate, tb_band[NL80211_BAND_ATTR_RATES], rem_rate) { -@@ -462,6 +463,7 @@ next: +@@ -541,6 +542,7 @@ next: printf("\n"); } } @@ -54,7 +54,7 @@ } } -@@ -527,6 +529,7 @@ next: +@@ -606,6 +608,7 @@ next: printf("\tCoverage class: %d (up to %dm)\n", coverage, 450 * coverage); } @@ -62,7 +62,7 @@ if (tb_msg[NL80211_ATTR_CIPHER_SUITES]) { int num = nla_len(tb_msg[NL80211_ATTR_CIPHER_SUITES]) / sizeof(__u32); int i; -@@ -538,6 +541,7 @@ next: +@@ -617,6 +620,7 @@ next: cipher_name(ciphers[i])); } } @@ -70,7 +70,7 @@ if (tb_msg[NL80211_ATTR_WIPHY_ANTENNA_AVAIL_TX] && tb_msg[NL80211_ATTR_WIPHY_ANTENNA_AVAIL_RX]) -@@ -555,9 +559,11 @@ next: +@@ -634,9 +638,11 @@ next: print_iftype_list("\tSupported interface modes", "\t\t", tb_msg[NL80211_ATTR_SUPPORTED_IFTYPES]); @@ -81,8 +81,8 @@ +#endif if (tb_msg[NL80211_ATTR_INTERFACE_COMBINATIONS]) { - struct nlattr *nl_combi; -@@ -647,6 +653,7 @@ broken_combination: + bool have_combinations = false; +@@ -650,6 +656,7 @@ next: printf("\tinterface combinations are not supported\n"); } @@ -90,7 +90,7 @@ if (tb_msg[NL80211_ATTR_SUPPORTED_COMMANDS]) { printf("\tSupported commands:\n"); nla_for_each_nested(nl_cmd, tb_msg[NL80211_ATTR_SUPPORTED_COMMANDS], rem_cmd) -@@ -744,6 +751,7 @@ broken_combination: +@@ -747,6 +754,7 @@ next: printf("\t\t * wake up on TCP connection\n"); } } @@ -98,7 +98,7 @@ if (tb_msg[NL80211_ATTR_ROAM_SUPPORT]) printf("\tDevice supports roaming.\n"); -@@ -782,6 +790,7 @@ broken_combination: +@@ -785,6 +793,7 @@ next: } } @@ -106,7 +106,7 @@ if (tb_msg[NL80211_ATTR_FEATURE_FLAGS]) { unsigned int features = nla_get_u32(tb_msg[NL80211_ATTR_FEATURE_FLAGS]); -@@ -846,6 +855,7 @@ broken_combination: +@@ -849,6 +858,7 @@ next: if (features & NL80211_FEATURE_ND_RANDOM_MAC_ADDR) printf("\tDevice supports randomizing MAC-addr in net-detect scans.\n"); } @@ -114,7 +114,7 @@ if (tb_msg[NL80211_ATTR_TDLS_SUPPORT]) printf("\tDevice supports T-DLS.\n"); -@@ -914,6 +924,7 @@ TOPLEVEL(list, NULL, NL80211_CMD_GET_WIP +@@ -979,6 +989,7 @@ TOPLEVEL(list, NULL, NL80211_CMD_GET_WIP "List all wireless devices and their capabilities."); TOPLEVEL(phy, NULL, NL80211_CMD_GET_WIPHY, NLM_F_DUMP, CIB_NONE, handle_info, NULL); @@ -122,7 +122,7 @@ static int handle_commands(struct nl80211_state *state, struct nl_msg *msg, int argc, char **argv, enum id_input id) { -@@ -925,6 +936,7 @@ static int handle_commands(struct nl8021 +@@ -990,6 +1001,7 @@ static int handle_commands(struct nl8021 } TOPLEVEL(commands, NULL, NL80211_CMD_GET_WIPHY, 0, CIB_NONE, handle_commands, "list all known commands and their decimal & hex value"); @@ -132,7 +132,7 @@ { --- a/scan.c +++ b/scan.c -@@ -1309,6 +1309,9 @@ static void print_ht_op(const uint8_t ty +@@ -1333,6 +1333,9 @@ static void print_ht_op(const uint8_t ty printf("\t\t * secondary channel offset: %s\n", ht_secondary_offset[data[1] & 0x3]); printf("\t\t * STA channel width: %s\n", sta_chan_width[(data[1] & 0x4)>>2]); @@ -142,7 +142,7 @@ printf("\t\t * RIFS: %d\n", (data[1] & 0x8)>>3); printf("\t\t * HT protection: %s\n", protection[data[2] & 0x3]); printf("\t\t * non-GF present: %d\n", (data[2] & 0x4) >> 2); -@@ -1808,17 +1811,25 @@ static void print_ie(const struct ie_pri +@@ -1832,17 +1835,25 @@ static void print_ie(const struct ie_pri static const struct ie_print ieprinters[] = { [EID_SSID] = { "SSID", print_ssid, 0, 32, BIT(PRINT_SCAN) | BIT(PRINT_LINK) | BIT(PRINT_LINK_MLO_MLD), }, @@ -170,7 +170,7 @@ [EID_ERP_D4_0] = { "ERP D4.0", print_erp, 1, 255, BIT(PRINT_SCAN), }, [EID_AP_CHAN_REPORT] = { "AP Channel Report", print_ap_channel_report, 1, 255, BIT(PRINT_SCAN), }, -@@ -1828,18 +1839,11 @@ static const struct ie_print ieprinters[ +@@ -1852,18 +1863,11 @@ static const struct ie_print ieprinters[ print_measurement_pilot_tx, 1, 255, BIT(PRINT_SCAN), }, [EID_OVERLAP_BSS_SCAN_PARAM] = { "Overlapping BSS scan params", print_obss_scan_params, 14, 255, BIT(PRINT_SCAN), }, @@ -189,7 +189,7 @@ [EID_EXT_CAPABILITY] = { "Extended capabilities", print_capabilities, 0, 255, BIT(PRINT_SCAN), }, [EID_INTERWORKING] = { "802.11u Interworking", print_interworking, -@@ -1854,6 +1858,7 @@ static const struct ie_print ieprinters[ +@@ -1878,6 +1882,7 @@ static const struct ie_print ieprinters[ print_short_beacon_int, 2, 2, BIT(PRINT_SCAN), }, [EID_S1G_CAPABILITY] = { "S1G capabilities", print_s1g_capa, 15, 15, BIT(PRINT_SCAN), }, [EID_S1G_OPERATION] = { "S1G operation", print_s1g_oper, 6, 6, BIT(PRINT_SCAN), }, @@ -197,7 +197,7 @@ }; static void print_wifi_wpa(const uint8_t type, uint8_t len, const uint8_t *data, -@@ -2189,8 +2194,10 @@ static void print_wifi_wps(const uint8_t +@@ -2213,8 +2218,10 @@ static void print_wifi_wps(const uint8_t static const struct ie_print wifiprinters[] = { [1] = { "WPA", print_wifi_wpa, 2, 255, BIT(PRINT_SCAN), }, @@ -208,7 +208,7 @@ }; static inline void print_p2p(const uint8_t type, uint8_t len, -@@ -2353,6 +2360,10 @@ static void print_vendor(unsigned char l +@@ -2377,6 +2384,10 @@ static void print_vendor(unsigned char l return; } @@ -219,7 +219,7 @@ if (len >= 4 && memcmp(data, wfa_oui, 3) == 0) { if (data[3] < ARRAY_SIZE(wfa_printers) && wfa_printers[data[3]].name && -@@ -2544,6 +2555,7 @@ static void print_capa_non_dmg(__u16 cap +@@ -2576,6 +2587,7 @@ static void print_capa_non_dmg(__u16 cap printf(" ESS"); if (capa & WLAN_CAPABILITY_IBSS) printf(" IBSS"); @@ -227,7 +227,7 @@ if (capa & WLAN_CAPABILITY_CF_POLLABLE) printf(" CfPollable"); if (capa & WLAN_CAPABILITY_CF_POLL_REQUEST) -@@ -2572,6 +2584,7 @@ static void print_capa_non_dmg(__u16 cap +@@ -2604,6 +2616,7 @@ static void print_capa_non_dmg(__u16 cap printf(" DelayedBACK"); if (capa & WLAN_CAPABILITY_IMM_BACK) printf(" ImmediateBACK"); @@ -235,7 +235,7 @@ } static int print_bss_handler(struct nl_msg *msg, void *arg) -@@ -2662,8 +2675,10 @@ static int print_bss_handler(struct nl_m +@@ -2694,8 +2707,10 @@ static int print_bss_handler(struct nl_m else printf("\tfreq: %d\n", freq); @@ -246,7 +246,7 @@ } if (bss[NL80211_BSS_BEACON_INTERVAL]) printf("\tbeacon interval: %d TUs\n", -@@ -2857,6 +2872,7 @@ static int handle_stop_sched_scan(struct +@@ -2889,6 +2904,7 @@ static int handle_stop_sched_scan(struct return 0; } @@ -254,7 +254,7 @@ COMMAND(scan, sched_start, SCHED_SCAN_OPTIONS, NL80211_CMD_START_SCHED_SCAN, 0, CIB_NETDEV, handle_start_sched_scan, -@@ -2867,3 +2883,4 @@ COMMAND(scan, sched_start, +@@ -2899,3 +2915,4 @@ COMMAND(scan, sched_start, COMMAND(scan, sched_stop, "", NL80211_CMD_STOP_SCHED_SCAN, 0, CIB_NETDEV, handle_stop_sched_scan, "Stop an ongoing scheduled scan."); @@ -289,7 +289,7 @@ --- a/Makefile +++ b/Makefile -@@ -24,6 +24,12 @@ _OBJS := $(sort $(patsubst %.c,%.o,$(wil +@@ -25,6 +25,12 @@ _OBJS := $(sort $(patsubst %.c,%.o,$(wil VERSION_OBJS := $(filter-out version.o, $(_OBJS)) OBJS := $(VERSION_OBJS) version.o @@ -304,7 +304,7 @@ ifeq ($(NO_PKG_CONFIG),) --- a/station.c +++ b/station.c -@@ -801,10 +801,12 @@ static int handle_station_set_plink(stru +@@ -847,10 +847,12 @@ static int handle_station_set_plink(stru nla_put_failure: return -ENOBUFS; } @@ -317,7 +317,7 @@ static int handle_station_set_vlan(struct nl80211_state *state, struct nl_msg *msg, -@@ -899,11 +901,13 @@ static int handle_station_set_mesh_power +@@ -945,11 +947,13 @@ static int handle_station_set_mesh_power nla_put_failure: return -ENOBUFS; } @@ -333,7 +333,7 @@ struct nl_msg *msg, --- a/interface.c +++ b/interface.c -@@ -668,9 +668,11 @@ static int handle_interface_wds_peer(str +@@ -673,9 +673,11 @@ static int handle_interface_wds_peer(str nla_put_failure: return -ENOBUFS; } @@ -345,7 +345,7 @@ static int set_mcast_rate(struct nl80211_state *state, struct nl_msg *msg, -@@ -760,6 +762,7 @@ static int handle_chan(struct nl80211_st +@@ -765,6 +767,7 @@ static int handle_chan(struct nl80211_st return handle_chanfreq(state, msg, true, argc, argv, id); } @@ -353,22 +353,22 @@ SECTION(switch); COMMAND(switch, freq, " [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz] [beacons ] [block-tx]\n" -@@ -1031,3 +1034,4 @@ COMMAND(set, tidconf, "[peer ", + NL80211_CMD_EPCS_CFG, 0, CIB_NETDEV, handle_set_epcs, + "Enable/Disable EPCS support"); +#endif --- a/phy.c +++ b/phy.c -@@ -403,6 +403,7 @@ err_out: +@@ -394,6 +394,7 @@ err_out: free(cac_trigger_argv); return err; } +#ifdef IW_FULL - TOPLEVEL(cac, "channel [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz]\n" - "freq [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz]\n" - "freq [5|10|20|40|80|80+80|160] [ []]", -@@ -422,6 +423,7 @@ COMMAND(cac, background, + TOPLEVEL(cac, PARSE_CHAN_ARGS("channel ") "\n" + PARSE_FREQ_ARGS("freq ", ""), + 0, 0, CIB_NETDEV, handle_cac, NULL); +@@ -410,6 +411,7 @@ COMMAND(cac, background, NL80211_CMD_RADAR_DETECT, 0, CIB_NETDEV, handle_cac_background, "Start background channel availability check (CAC) looking to look for\n" "radars on the given channel."); diff --git a/package/network/utils/iw/patches/300-wiphy_radios.patch b/package/network/utils/iw/patches/300-wiphy_radios.patch deleted file mode 100644 index 534addf8975..00000000000 --- a/package/network/utils/iw/patches/300-wiphy_radios.patch +++ /dev/null @@ -1,252 +0,0 @@ ---- a/info.c -+++ b/info.c -@@ -295,6 +295,151 @@ static void print_pmsr_capabilities(stru - } - } - -+static void print_interface_combinations(struct nlattr *ifcomb, bool radio) -+{ -+ const char *indent = radio ? "\t" : ""; -+ struct nlattr *nl_combi; -+ bool have_combinations = false; -+ int rem; -+ -+ nla_for_each_nested(nl_combi, ifcomb, rem) { -+ static struct nla_policy iface_combination_policy[NUM_NL80211_IFACE_COMB] = { -+ [NL80211_IFACE_COMB_LIMITS] = { .type = NLA_NESTED }, -+ [NL80211_IFACE_COMB_MAXNUM] = { .type = NLA_U32 }, -+ [NL80211_IFACE_COMB_STA_AP_BI_MATCH] = { .type = NLA_FLAG }, -+ [NL80211_IFACE_COMB_NUM_CHANNELS] = { .type = NLA_U32 }, -+ [NL80211_IFACE_COMB_RADAR_DETECT_WIDTHS] = { .type = NLA_U32 }, -+ }; -+ struct nlattr *tb_comb[NUM_NL80211_IFACE_COMB]; -+ static struct nla_policy iface_limit_policy[NUM_NL80211_IFACE_LIMIT] = { -+ [NL80211_IFACE_LIMIT_TYPES] = { .type = NLA_NESTED }, -+ [NL80211_IFACE_LIMIT_MAX] = { .type = NLA_U32 }, -+ }; -+ struct nlattr *tb_limit[NUM_NL80211_IFACE_LIMIT]; -+ struct nlattr *nl_limit; -+ int err, rem_limit; -+ bool comma = false; -+ -+ if (radio && nla_type(nl_combi) != -+ NL80211_WIPHY_RADIO_ATTR_INTERFACE_COMBINATION) -+ continue; -+ -+ if (!have_combinations) { -+ printf("\t%svalid interface combinations:\n", indent); -+ have_combinations = true; -+ } -+ -+ printf("\t\t%s * ", indent); -+ -+ err = nla_parse_nested(tb_comb, MAX_NL80211_IFACE_COMB, -+ nl_combi, iface_combination_policy); -+ if (err || !tb_comb[NL80211_IFACE_COMB_LIMITS] || -+ !tb_comb[NL80211_IFACE_COMB_MAXNUM] || -+ !tb_comb[NL80211_IFACE_COMB_NUM_CHANNELS]) { -+ printf(" \n"); -+ goto broken_combination; -+ } -+ -+ nla_for_each_nested(nl_limit, tb_comb[NL80211_IFACE_COMB_LIMITS], rem_limit) { -+ err = nla_parse_nested(tb_limit, MAX_NL80211_IFACE_LIMIT, -+ nl_limit, iface_limit_policy); -+ if (err || !tb_limit[NL80211_IFACE_LIMIT_TYPES]) { -+ printf("\n"); -+ goto broken_combination; -+ } -+ -+ if (comma) -+ printf(", "); -+ comma = true; -+ printf("#{ "); -+ print_iftype_line(tb_limit[NL80211_IFACE_LIMIT_TYPES]); -+ printf(" } <= %u", nla_get_u32(tb_limit[NL80211_IFACE_LIMIT_MAX])); -+ } -+ printf(",\n\t\t%s ", indent); -+ -+ printf("total <= %d, #channels <= %d%s", -+ nla_get_u32(tb_comb[NL80211_IFACE_COMB_MAXNUM]), -+ nla_get_u32(tb_comb[NL80211_IFACE_COMB_NUM_CHANNELS]), -+ tb_comb[NL80211_IFACE_COMB_STA_AP_BI_MATCH] ? -+ ", STA/AP BI must match" : ""); -+ if (tb_comb[NL80211_IFACE_COMB_RADAR_DETECT_WIDTHS]) { -+ unsigned long widths = nla_get_u32(tb_comb[NL80211_IFACE_COMB_RADAR_DETECT_WIDTHS]); -+ -+ if (widths) { -+ int width; -+ bool first = true; -+ -+ printf(", radar detect widths: {"); -+ for (width = 0; width < 32; width++) -+ if (widths & (1 << width)) { -+ printf("%s %s", -+ first ? "":",", -+ channel_width_name(width)); -+ first = false; -+ } -+ printf(" }\n"); -+ } -+ } -+ printf("\n"); -+broken_combination: -+ ; -+ } -+ -+ if (!have_combinations) -+ printf("\t%sinterface combinations are not supported\n", indent); -+} -+ -+static void print_radio_freq(struct nlattr *freqs) -+{ -+ struct nlattr *freq; -+ int rem; -+ -+ nla_for_each_nested(freq, freqs, rem) { -+ static struct nla_policy freq_policy[NL80211_WIPHY_RADIO_FREQ_ATTR_MAX + 1] = { -+ [NL80211_WIPHY_RADIO_FREQ_ATTR_START] = { .type = NLA_U32 }, -+ [NL80211_WIPHY_RADIO_FREQ_ATTR_END] = { .type = NLA_U32 }, -+ }; -+ struct nlattr *tb[NL80211_WIPHY_RADIO_FREQ_ATTR_MAX + 1]; -+ uint32_t start, end; -+ -+ if (nla_type(freq) != NL80211_WIPHY_RADIO_ATTR_FREQ_RANGE) -+ continue; -+ -+ if (nla_parse_nested(tb, NL80211_WIPHY_RADIO_ATTR_MAX + 1, -+ freq, freq_policy) || -+ !tb[NL80211_WIPHY_RADIO_FREQ_ATTR_START] || -+ !tb[NL80211_WIPHY_RADIO_FREQ_ATTR_END]) -+ continue; -+ -+ start = nla_get_u32(tb[NL80211_WIPHY_RADIO_FREQ_ATTR_START]); -+ end = nla_get_u32(tb[NL80211_WIPHY_RADIO_FREQ_ATTR_END]); -+ -+ printf("\t\tfreq range: %.1f MHz - %.1f MHz\n", (float)start / 1000, (float)end / 1000); -+ } -+} -+ -+static void print_radios(struct nlattr *radios) -+{ -+ struct nlattr *radio; -+ int rem, idx = 0; -+ -+ nla_for_each_nested(radio, radios, rem) { -+ static struct nla_policy radio_policy[NL80211_WIPHY_RADIO_ATTR_MAX + 1] = { -+ [NL80211_WIPHY_RADIO_ATTR_INDEX] = { .type = NLA_U32 }, -+ }; -+ struct nlattr *tb[NL80211_WIPHY_RADIO_ATTR_MAX + 1]; -+ -+ if (nla_parse_nested(tb, NL80211_WIPHY_RADIO_ATTR_MAX + 1, -+ radio, radio_policy) || -+ !tb[NL80211_WIPHY_RADIO_ATTR_INDEX]) -+ continue; -+ -+ printf("\twiphy radio %d:\n", nla_get_u32(tb[NL80211_WIPHY_RADIO_ATTR_INDEX])); -+ print_radio_freq(radio); -+ print_interface_combinations(radio, true); -+ } -+} -+ - static int print_phy_handler(struct nl_msg *msg, void *arg) - { - struct nlattr *tb_msg[NL80211_ATTR_MAX + 1]; -@@ -565,93 +710,11 @@ next: - "\t\t", tb_msg[NL80211_ATTR_SOFTWARE_IFTYPES]); - #endif - -- if (tb_msg[NL80211_ATTR_INTERFACE_COMBINATIONS]) { -- struct nlattr *nl_combi; -- int rem_combi; -- bool have_combinations = false; -- -- nla_for_each_nested(nl_combi, tb_msg[NL80211_ATTR_INTERFACE_COMBINATIONS], rem_combi) { -- static struct nla_policy iface_combination_policy[NUM_NL80211_IFACE_COMB] = { -- [NL80211_IFACE_COMB_LIMITS] = { .type = NLA_NESTED }, -- [NL80211_IFACE_COMB_MAXNUM] = { .type = NLA_U32 }, -- [NL80211_IFACE_COMB_STA_AP_BI_MATCH] = { .type = NLA_FLAG }, -- [NL80211_IFACE_COMB_NUM_CHANNELS] = { .type = NLA_U32 }, -- [NL80211_IFACE_COMB_RADAR_DETECT_WIDTHS] = { .type = NLA_U32 }, -- }; -- struct nlattr *tb_comb[NUM_NL80211_IFACE_COMB]; -- static struct nla_policy iface_limit_policy[NUM_NL80211_IFACE_LIMIT] = { -- [NL80211_IFACE_LIMIT_TYPES] = { .type = NLA_NESTED }, -- [NL80211_IFACE_LIMIT_MAX] = { .type = NLA_U32 }, -- }; -- struct nlattr *tb_limit[NUM_NL80211_IFACE_LIMIT]; -- struct nlattr *nl_limit; -- int err, rem_limit; -- bool comma = false; -- -- if (!have_combinations) { -- printf("\tvalid interface combinations:\n"); -- have_combinations = true; -- } -- -- printf("\t\t * "); -+ if (tb_msg[NL80211_ATTR_INTERFACE_COMBINATIONS]) -+ print_interface_combinations(tb_msg[NL80211_ATTR_INTERFACE_COMBINATIONS], false); - -- err = nla_parse_nested(tb_comb, MAX_NL80211_IFACE_COMB, -- nl_combi, iface_combination_policy); -- if (err || !tb_comb[NL80211_IFACE_COMB_LIMITS] || -- !tb_comb[NL80211_IFACE_COMB_MAXNUM] || -- !tb_comb[NL80211_IFACE_COMB_NUM_CHANNELS]) { -- printf(" \n"); -- goto broken_combination; -- } -- -- nla_for_each_nested(nl_limit, tb_comb[NL80211_IFACE_COMB_LIMITS], rem_limit) { -- err = nla_parse_nested(tb_limit, MAX_NL80211_IFACE_LIMIT, -- nl_limit, iface_limit_policy); -- if (err || !tb_limit[NL80211_IFACE_LIMIT_TYPES]) { -- printf("\n"); -- goto broken_combination; -- } -- -- if (comma) -- printf(", "); -- comma = true; -- printf("#{ "); -- print_iftype_line(tb_limit[NL80211_IFACE_LIMIT_TYPES]); -- printf(" } <= %u", nla_get_u32(tb_limit[NL80211_IFACE_LIMIT_MAX])); -- } -- printf(",\n\t\t "); -- -- printf("total <= %d, #channels <= %d%s", -- nla_get_u32(tb_comb[NL80211_IFACE_COMB_MAXNUM]), -- nla_get_u32(tb_comb[NL80211_IFACE_COMB_NUM_CHANNELS]), -- tb_comb[NL80211_IFACE_COMB_STA_AP_BI_MATCH] ? -- ", STA/AP BI must match" : ""); -- if (tb_comb[NL80211_IFACE_COMB_RADAR_DETECT_WIDTHS]) { -- unsigned long widths = nla_get_u32(tb_comb[NL80211_IFACE_COMB_RADAR_DETECT_WIDTHS]); -- -- if (widths) { -- int width; -- bool first = true; -- -- printf(", radar detect widths: {"); -- for (width = 0; width < 32; width++) -- if (widths & (1 << width)) { -- printf("%s %s", -- first ? "":",", -- channel_width_name(width)); -- first = false; -- } -- printf(" }\n"); -- } -- } -- printf("\n"); --broken_combination: -- ; -- } -- -- if (!have_combinations) -- printf("\tinterface combinations are not supported\n"); -- } -+ if (tb_msg[NL80211_ATTR_WIPHY_RADIOS]) -+ print_radios(tb_msg[NL80211_ATTR_WIPHY_RADIOS]); - - #ifdef IW_FULL - if (tb_msg[NL80211_ATTR_SUPPORTED_COMMANDS]) { diff --git a/package/network/utils/iw/patches/310-vif_radio_mask.patch b/package/network/utils/iw/patches/310-vif_radio_mask.patch index 724f71cdad5..728f3fb305a 100644 --- a/package/network/utils/iw/patches/310-vif_radio_mask.patch +++ b/package/network/utils/iw/patches/310-vif_radio_mask.patch @@ -77,7 +77,7 @@ NL80211_CMD_NEW_INTERFACE, 0, CIB_NETDEV, handle_interface_add, NULL); static int handle_interface_del(struct nl80211_state *state, -@@ -493,6 +539,19 @@ static int print_iface_handler(struct nl +@@ -498,6 +544,19 @@ static int print_iface_handler(struct nl printf("\n"); } } -- 2.47.3