From 30a078b90a0ab32b642779be3e2e5c827770d840 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Thu, 27 May 2021 13:20:13 +0200 Subject: [PATCH] ucentral: development update * backport latest netifd, mac8021, hostapd, iw * maverick and certificate fixes * update ucentral-wifi * update ucentral-client * add qcom hk14 wifi 6e support (pine) * add tplink ex228 Signed-off-by: John Crispin --- backports/0013-iw-update-to-latest-HEAD.patch | 167 + .../0014-libubox-update-to-latest-HEAD.patch | 32 + .../0037-netifd-update-to-latest-HEAD.patch | 73 + .../0038-mac80211-update-to-latest-HEAD.patch | 4511 +++++++++++++++ .../0039-hostapd-upsate-to-latest-HEAD.patch | 4896 +++++++++++++++++ .../0040-mt76-update-to-latest-HEAD.patch | 30 + .../files/etc/init.d/certificates | 11 +- .../files/usr/libexec/ucentral/maverick.sh | 2 +- .../files/etc/uci-defaults/zzz-ucentral | 2 +- .../files/etc/ucentral/examples/default.json | 7 +- feeds/ucentral/ucentral-wifi/Makefile | 3 +- feeds/wifi-ax/ath11k-firmware/Makefile | 4 +- feeds/wifi-ax/hostapd/Makefile | 2 +- feeds/wifi-ax/hostapd/files/hostapd.sh | 298 +- .../hostapd/patches/600-ubus_support.patch | 49 + .../hostapd/patches/700-wifi-reload.patch | 2 +- .../hostapd/patches/710-vlan_no_bridge.patch | 33 + .../patches/720-iface_max_num_sta.patch | 82 + .../900-hapd-netlink-ubus-bridge.patch | 881 --- .../hostapd/patches/900-max-sta-limit.patch | 100 - feeds/wifi-ax/hostapd/src/src/ap/ubus.c | 70 +- feeds/wifi-ax/hostapd/src/src/ap/ubus.h | 16 + feeds/wifi-ax/iw/Makefile | 72 - .../iw/patches/001-nl80211_h_sync.patch | 21 - .../wifi-ax/iw/patches/120-antenna_gain.patch | 36 - .../wifi-ax/iw/patches/200-reduce_size.patch | 454 -- ...ttribure-support-for-nl80211-message.patch | 40 - ...command-for-tid-specific-retry-count.patch | 200 - ...r-command-for-tid-specific-aggr-conf.patch | 114 - .../507-Add-peer-address-in-noack-map-command | 54 - ...iw-add-airtime-weight-config-support.patch | 107 - .../patches/510-iw-wifi-config-vendor.patch | 71 - .../512-iw-add-wide-band-scan-support.patch | 138 - .../513-iw-add-HE-rate-gi-ltf-support.patch | 398 -- ...o-chan-mappings-for-6GHz-band-per-IE.patch | 61 - ...enable-80M-support-for-6GHz-11s-mesh.patch | 48 - ...nal-argument-to-specify-6Ghz-channel.patch | 109 - ...-HE-rate-configuration-in-6-GHz-band.patch | 125 - ...9-iw-Add-HE-UL-MU-fixed-rate-setting.patch | 165 - .../files/lib/netifd/wireless/mac80211.sh | 184 +- .../mac80211/files/lib/wifi/mac80211.sh | 110 +- ...x-add-the-Qualcomm-AX-target-support.patch | 42 +- ...0018-ramips-add-tplink-ex228-support.patch | 197 + ...netifd-libubox-update-to-latest-HEAD.patch | 476 -- ...26-hostapd-add-a-pile-of-new-options.patch | 257 - ...27-hostapd-fix-civic-location-option.patch | 26 - .../0028-hostapd-add-eap_server-support.patch | 77 - .../0032-hostapd-enhance-ubus-interface.patch | 299 - patches/0033-hostapd-add-more-options.patch | 253 - ...-ability-to-persistently-store-certi.patch | 30 +- profiles/qcom_hk14.yml | 14 + profiles/tplink_ex228.yml | 8 + 52 files changed, 10606 insertions(+), 4851 deletions(-) create mode 100644 backports/0013-iw-update-to-latest-HEAD.patch create mode 100644 backports/0014-libubox-update-to-latest-HEAD.patch create mode 100644 backports/0037-netifd-update-to-latest-HEAD.patch create mode 100644 backports/0038-mac80211-update-to-latest-HEAD.patch create mode 100644 backports/0039-hostapd-upsate-to-latest-HEAD.patch create mode 100644 backports/0040-mt76-update-to-latest-HEAD.patch create mode 100644 feeds/wifi-ax/hostapd/patches/710-vlan_no_bridge.patch create mode 100644 feeds/wifi-ax/hostapd/patches/720-iface_max_num_sta.patch delete mode 100644 feeds/wifi-ax/hostapd/patches/900-hapd-netlink-ubus-bridge.patch delete mode 100644 feeds/wifi-ax/hostapd/patches/900-max-sta-limit.patch delete mode 100644 feeds/wifi-ax/iw/Makefile delete mode 100644 feeds/wifi-ax/iw/patches/001-nl80211_h_sync.patch delete mode 100644 feeds/wifi-ax/iw/patches/120-antenna_gain.patch delete mode 100644 feeds/wifi-ax/iw/patches/200-reduce_size.patch delete mode 100644 feeds/wifi-ax/iw/patches/502-Add-channel-attribure-support-for-nl80211-message.patch delete mode 100644 feeds/wifi-ax/iw/patches/505-Add-user-command-for-tid-specific-retry-count.patch delete mode 100644 feeds/wifi-ax/iw/patches/506-Add-user-command-for-tid-specific-aggr-conf.patch delete mode 100644 feeds/wifi-ax/iw/patches/507-Add-peer-address-in-noack-map-command delete mode 100644 feeds/wifi-ax/iw/patches/508-iw-add-airtime-weight-config-support.patch delete mode 100644 feeds/wifi-ax/iw/patches/510-iw-wifi-config-vendor.patch delete mode 100644 feeds/wifi-ax/iw/patches/512-iw-add-wide-band-scan-support.patch delete mode 100644 feeds/wifi-ax/iw/patches/513-iw-add-HE-rate-gi-ltf-support.patch delete mode 100644 feeds/wifi-ax/iw/patches/514-iw-update-freq-to-chan-mappings-for-6GHz-band-per-IE.patch delete mode 100644 feeds/wifi-ax/iw/patches/516-iw-enable-80M-support-for-6GHz-11s-mesh.patch delete mode 100644 feeds/wifi-ax/iw/patches/517-iw-support-optional-argument-to-specify-6Ghz-channel.patch delete mode 100644 feeds/wifi-ax/iw/patches/518-iw-support-HE-rate-configuration-in-6-GHz-band.patch delete mode 100644 feeds/wifi-ax/iw/patches/519-iw-Add-HE-UL-MU-fixed-rate-setting.patch create mode 100644 patches/0018-ramips-add-tplink-ex228-support.patch delete mode 100644 patches/0024-netifd-libubox-update-to-latest-HEAD.patch delete mode 100644 patches/0026-hostapd-add-a-pile-of-new-options.patch delete mode 100644 patches/0027-hostapd-fix-civic-location-option.patch delete mode 100644 patches/0028-hostapd-add-eap_server-support.patch delete mode 100644 patches/0032-hostapd-enhance-ubus-interface.patch delete mode 100644 patches/0033-hostapd-add-more-options.patch create mode 100644 profiles/qcom_hk14.yml create mode 100644 profiles/tplink_ex228.yml diff --git a/backports/0013-iw-update-to-latest-HEAD.patch b/backports/0013-iw-update-to-latest-HEAD.patch new file mode 100644 index 000000000..c58bb4fdb --- /dev/null +++ b/backports/0013-iw-update-to-latest-HEAD.patch @@ -0,0 +1,167 @@ +From 0ddce2498be815e098154867d0b18293fe613f12 Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Thu, 27 May 2021 11:57:10 +0200 +Subject: [PATCH 13/13] iw: update to latest HEAD + +Signed-off-by: John Crispin +--- + package/network/utils/iw/Makefile | 11 +++---- + .../utils/iw/patches/200-reduce_size.patch | 30 +++++++++---------- + 2 files changed, 21 insertions(+), 20 deletions(-) + +diff --git a/package/network/utils/iw/Makefile b/package/network/utils/iw/Makefile +index 6db9aaf105..8e11046189 100644 +--- a/package/network/utils/iw/Makefile ++++ b/package/network/utils/iw/Makefile +@@ -8,12 +8,13 @@ + include $(TOPDIR)/rules.mk + + PKG_NAME:=iw +-PKG_VERSION:=5.9 +-PKG_RELEASE:=1 ++PKG_VERSION:=5.9-8fab0c9e ++PKG_RELEASE:=$(AUTORELEASE) + +-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +-PKG_SOURCE_URL:=@KERNEL/software/network/iw +-PKG_HASH:=293a07109aeb7e36267cf59e3ce52857e9ffae3a6666eb8ac77894b1839fe1f2 ++PKG_SOURCE_PROTO:=git ++PKG_SOURCE_URL:=https://git.kernel.org/pub/scm/linux/kernel/git/jberg/iw.git ++PKG_SOURCE_VERSION:=8fab0c9ee9db217587a58efcc37421c86edcb638 ++PKG_MIRROR_HASH:=797b322bc03952f3127ae0a7da476c14ada1bbe9a9ae234a56dd6f864c568e16 + + PKG_MAINTAINER:=Felix Fietkau + PKG_LICENSE:=GPL-2.0 +diff --git a/package/network/utils/iw/patches/200-reduce_size.patch b/package/network/utils/iw/patches/200-reduce_size.patch +index af30876012..83e11405cb 100644 +--- a/package/network/utils/iw/patches/200-reduce_size.patch ++++ b/package/network/utils/iw/patches/200-reduce_size.patch +@@ -1,6 +1,6 @@ + --- a/event.c + +++ b/event.c +-@@ -944,6 +944,7 @@ static int print_event(struct nl_msg *ms ++@@ -956,6 +956,7 @@ static int print_event(struct nl_msg *ms + } + + switch (gnlh->cmd) { +@@ -8,7 +8,7 @@ + case NL80211_CMD_NEW_WIPHY: + printf("renamed to %s\n", nla_get_string(tb[NL80211_ATTR_WIPHY_NAME])); + break; +-@@ -979,6 +980,7 @@ static int print_event(struct nl_msg *ms ++@@ -991,6 +992,7 @@ static int print_event(struct nl_msg *ms + case NL80211_CMD_SCHED_SCAN_RESULTS: + printf("got scheduled scan results\n"); + break; +@@ -16,7 +16,7 @@ + case NL80211_CMD_WIPHY_REG_CHANGE: + case NL80211_CMD_REG_CHANGE: + if (gnlh->cmd == NL80211_CMD_WIPHY_REG_CHANGE) +-@@ -1061,6 +1063,7 @@ static int print_event(struct nl_msg *ms ++@@ -1073,6 +1075,7 @@ static int print_event(struct nl_msg *ms + mac_addr_n2a(macbuf, nla_data(tb[NL80211_ATTR_MAC])); + printf("del station %s\n", macbuf); + break; +@@ -24,7 +24,7 @@ + case NL80211_CMD_JOIN_IBSS: + mac_addr_n2a(macbuf, nla_data(tb[NL80211_ATTR_MAC])); + printf("IBSS %s joined\n", macbuf); +-@@ -1254,9 +1257,9 @@ static int print_event(struct nl_msg *ms ++@@ -1271,9 +1274,9 @@ static int print_event(struct nl_msg *ms + case NL80211_CMD_CH_SWITCH_NOTIFY: + parse_ch_switch_notify(tb, gnlh->cmd); + break; +@@ -134,7 +134,7 @@ + { + --- a/scan.c + +++ b/scan.c +-@@ -1297,6 +1297,9 @@ static void print_ht_op(const uint8_t ty ++@@ -1306,6 +1306,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]); +@@ -144,7 +144,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); +-@@ -1707,6 +1710,14 @@ static void print_ie(const struct ie_pri ++@@ -1716,6 +1719,14 @@ 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), }, +@@ -159,7 +159,7 @@ + [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), }, +-@@ -1716,26 +1727,20 @@ static const struct ie_print ieprinters[ ++@@ -1725,26 +1736,20 @@ static const struct ie_print ieprinters[ + [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), }, +@@ -187,15 +187,15 @@ + }; + + static void print_wifi_wpa(const uint8_t type, uint8_t len, const uint8_t *data, +-@@ -2279,6 +2284,7 @@ void print_ies(unsigned char *ie, int ie ++@@ -2326,6 +2331,7 @@ void print_ies(unsigned char *ie, int ie + ieprinters[ie[0]].flags & BIT(ptype)) { + print_ie(&ieprinters[ie[0]], + ie[0], ie[1], ie + 2, &ie_buffer); + +#ifdef IW_FULL + } else if (ie[0] == 221 /* vendor */) { + print_vendor(ie[1], ie + 2, unknown, ptype); +- } else if (unknown) { +-@@ -2288,6 +2294,7 @@ void print_ies(unsigned char *ie, int ie ++ } else if (ie[0] == 255 /* extension */) { ++@@ -2337,6 +2343,7 @@ void print_ies(unsigned char *ie, int ie + for (i=0; i +Date: Tue, 18 May 2021 10:46:43 +0200 +Subject: [PATCH] libubox: update to latest HEAD + +Signed-off-by: John Crispin +--- + package/libs/libubox/Makefile | 4 +- + package/network/config/netifd/Makefile | 4 +- + .../config/netifd/patches/100-8021x.patch | 421 ++++++++++++++++++ + 3 files changed, 425 insertions(+), 4 deletions(-) + create mode 100644 package/network/config/netifd/patches/100-8021x.patch + +diff --git a/package/libs/libubox/Makefile b/package/libs/libubox/Makefile +index 4d582eacfd..8644764d59 100644 +--- a/package/libs/libubox/Makefile ++++ b/package/libs/libubox/Makefile +@@ -5,9 +5,9 @@ PKG_RELEASE=1 + + PKG_SOURCE_PROTO:=git + PKG_SOURCE_URL=$(PROJECT_GIT)/project/libubox.git +-PKG_MIRROR_HASH:=97dc4eba01cf2c5d6a6d0db3747e0cdc0d95cb87e51b3115272e7d3e69a8b255 ++#PKG_MIRROR_HASH:=97dc4eba01cf2c5d6a6d0db3747e0cdc0d95cb87e51b3115272e7d3e69a8b255 + PKG_SOURCE_DATE:=2020-12-12 +-PKG_SOURCE_VERSION:=357877693ca363b12e6e7e14d345639b2440cd07 ++PKG_SOURCE_VERSION:=b14c4688612c05c78ce984d7bde633bce8703b1e + PKG_ABI_VERSION:=$(call abi_version_str,$(PKG_SOURCE_DATE)) + CMAKE_INSTALL:=1 + +-- +2.25.1 + diff --git a/backports/0037-netifd-update-to-latest-HEAD.patch b/backports/0037-netifd-update-to-latest-HEAD.patch new file mode 100644 index 000000000..521d43f82 --- /dev/null +++ b/backports/0037-netifd-update-to-latest-HEAD.patch @@ -0,0 +1,73 @@ +From a830b2677c7076d93ab35a90ec12d382b64551d0 Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Thu, 27 May 2021 13:24:47 +0200 +Subject: [PATCH 37/40] netifd: update to latest HEAD + +Signed-off-by: John Crispin +--- + package/network/config/netifd/Makefile | 12 +++++++++--- + package/network/config/netifd/files/etc/udhcpc.user | 1 + + .../config/netifd/files/lib/netifd/dhcp.script | 3 +++ + 3 files changed, 13 insertions(+), 3 deletions(-) + create mode 100644 package/network/config/netifd/files/etc/udhcpc.user + +diff --git a/package/network/config/netifd/Makefile b/package/network/config/netifd/Makefile +index 7061456b08..2f6b779e6d 100644 +--- a/package/network/config/netifd/Makefile ++++ b/package/network/config/netifd/Makefile +@@ -5,9 +5,9 @@ PKG_RELEASE:=1 + + PKG_SOURCE_PROTO:=git + PKG_SOURCE_URL=$(PROJECT_GIT)/project/netifd.git +-PKG_SOURCE_DATE:=2021-01-09 +-PKG_SOURCE_VERSION:=c00c8335d6188daa326ecfe5a62da15a9b9987e1 +-PKG_MIRROR_HASH:=c740e51e0cec13eec336ba1c7a643db3b64a9a2235f8c1b73a566cb89e841190 ++PKG_SOURCE_DATE:=2021-05-26 ++PKG_SOURCE_VERSION:=899c2a4520526d43113f73cf673f20e2486a40fb ++PKG_MIRROR_HASH:=354905192b30af88ea953241ed332555e67cdb7e3b54dd139250bf1e6ad3a709 + PKG_MAINTAINER:=Felix Fietkau + + PKG_LICENSE:=GPL-2.0 +@@ -25,6 +25,11 @@ define Package/netifd + TITLE:=OpenWrt Network Interface Configuration Daemon + endef + ++define Package/netifd/conffiles ++/etc/udhcpc.user ++/etc/udhcpc.user.d/ ++endef ++ + TARGET_CFLAGS += \ + -I$(STAGING_DIR)/usr/include/libnl-tiny \ + -I$(STAGING_DIR)/usr/include \ +@@ -40,6 +45,7 @@ define Package/netifd/install + $(INSTALL_DIR) $(1)/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/netifd $(1)/sbin/ + $(CP) ./files/* $(1)/ ++ $(INSTALL_DIR) $(1)/etc/udhcpc.user.d/ + $(CP) $(PKG_BUILD_DIR)/scripts/* $(1)/lib/netifd/ + endef + +diff --git a/package/network/config/netifd/files/etc/udhcpc.user b/package/network/config/netifd/files/etc/udhcpc.user +new file mode 100644 +index 0000000000..78e2ba5f18 +--- /dev/null ++++ b/package/network/config/netifd/files/etc/udhcpc.user +@@ -0,0 +1 @@ ++# This script is sourced by udhcpc's dhcp.script at every DHCP event. +diff --git a/package/network/config/netifd/files/lib/netifd/dhcp.script b/package/network/config/netifd/files/lib/netifd/dhcp.script +index 6585b641d6..e46005d84c 100755 +--- a/package/network/config/netifd/files/lib/netifd/dhcp.script ++++ b/package/network/config/netifd/files/lib/netifd/dhcp.script +@@ -112,5 +112,8 @@ esac + + # user rules + [ -f /etc/udhcpc.user ] && . /etc/udhcpc.user "$@" ++for f in /etc/udhcpc.user.d/*; do ++ [ -f "$f" ] && (. "$f" "$@") ++done + + exit 0 +-- +2.25.1 + diff --git a/backports/0038-mac80211-update-to-latest-HEAD.patch b/backports/0038-mac80211-update-to-latest-HEAD.patch new file mode 100644 index 000000000..3bd459acd --- /dev/null +++ b/backports/0038-mac80211-update-to-latest-HEAD.patch @@ -0,0 +1,4511 @@ +From db9935dc0f0dd2e2e081961a2f3550bbea1e009c Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Thu, 27 May 2021 13:25:03 +0200 +Subject: [PATCH 38/40] mac80211: update to latest HEAD + +Signed-off-by: John Crispin +--- + package/kernel/mac80211/Makefile | 8 +- + package/kernel/mac80211/ath.mk | 13 +- + package/kernel/mac80211/broadcom.mk | 4 +- + .../files/lib/netifd/wireless/mac80211.sh | 165 +++- + .../mac80211/files/lib/wifi/mac80211.sh | 105 ++- + .../ath/080-ath10k_thermal_config.patch | 2 +- + ...PN-replay-protection-for-fragmented-.patch | 180 ++++ + ...fragments-with-multicast-DA-for-PCIe.patch | 66 ++ + ...fragments-with-multicast-DA-for-SDIO.patch | 40 + + ...-which-has-discard-flag-set-by-firmw.patch | 54 ++ + ...IP-Michael-MIC-verification-for-PCIe.patch | 48 + + ...first-subframe-of-A-MSDU-before-proc.patch | 109 +++ + .../patches/ath/402-ath_regd_optional.patch | 2 +- + .../ath/500-ath9k_eeprom_debugfs.patch | 4 +- + .../ath/512-ath9k_channelbw_debugfs.patch | 4 +- + .../patches/ath/530-ath9k_extra_leds.patch | 10 +- + .../patches/ath/542-ath9k_debugfs_diag.patch | 4 +- + .../ath/548-ath9k_enable_gpio_chip.patch | 4 +- + .../ath/549-ath9k_enable_gpio_buttons.patch | 2 +- + .../ath/551-ath9k_ubnt_uap_plus_hsr.patch | 4 +- + .../mac80211/patches/ath/552-ahb_of.patch | 2 +- + ...itting-to-stations-in-dynamic-SMPS-m.patch | 49 -- + ...h10k-increase-rx-buffer-size-to-2048.patch | 2 +- + .../ath/930-ath10k_add_tpt_led_trigger.patch | 4 +- + ...rolling-support-for-various-chipsets.patch | 4 +- + ...75-ath10k-use-tpt-trigger-by-default.patch | 2 +- + .../602-rt2x00-introduce-rt2x00eeprom.patch | 2 +- + ...8821ae-upgrade-PHY-and-RF-parameters.patch | 817 ++++++++++++++++++ + ...ent-set_tim-by-update-beacon-content.patch | 118 +++ + .../patches/subsys/010-sync-nl80211_h.patch | 297 +++++++ + .../100-remove-cryptoapi-dependencies.patch | 7 +- + .../subsys/150-disable_addr_notifier.patch | 6 +- + .../mac80211/patches/subsys/210-ap_scan.patch | 2 +- + ...ort-immediate-reconnect-request-hint.patch | 36 +- + ...-driver-based-disconnect-with-reconn.patch | 12 +- + ...port-to-configure-SAE-PWE-value-to-d.patch | 74 ++ + ...320-mac80211_hwsim-add-6GHz-channels.patch | 123 +++ + ...211_hwsim-make-6-GHz-channels-usable.patch | 74 ++ + ...-minstrel_ht-fix-MINSTREL_FRAC-macro.patch | 21 + + .../370-mac80211-fix-TXQ-AC-confusion.patch | 61 -- + ...c80211-fix-time-is-after-bug-in-mlme.patch | 31 - + ...1-assure-all-fragments-are-encrypted.patch | 69 ++ + ...-mixed-key-and-fragment-cache-attack.patch | 87 ++ + ...y-handle-A-MSDUs-that-start-with-an-.patch | 66 ++ + ...-mitigate-A-MSDU-aggregation-attacks.patch | 40 + + ...mac80211-drop-A-MSDUs-on-old-ciphers.patch | 54 ++ + ...80211-add-fragment-cache-to-sta_info.patch | 313 +++++++ + ...heck-defrag-PN-against-current-frame.patch | 109 +++ + ...-prevent-attacks-on-TKIP-WEP-as-well.patch | 62 ++ + ...-accept-forward-invalid-EAPOL-frames.patch | 94 ++ + ...protection-against-mixed-key-and-fra.patch | 68 ++ + .../500-mac80211_configure_antenna_gain.patch | 24 +- + 52 files changed, 3280 insertions(+), 278 deletions(-) + create mode 100644 package/kernel/mac80211/patches/ath/300-ath10k-add-CCMP-PN-replay-protection-for-fragmented-.patch + create mode 100644 package/kernel/mac80211/patches/ath/301-ath10k-drop-fragments-with-multicast-DA-for-PCIe.patch + create mode 100644 package/kernel/mac80211/patches/ath/302-ath10k-drop-fragments-with-multicast-DA-for-SDIO.patch + create mode 100644 package/kernel/mac80211/patches/ath/303-ath10k-drop-MPDU-which-has-discard-flag-set-by-firmw.patch + create mode 100644 package/kernel/mac80211/patches/ath/304-ath10k-Fix-TKIP-Michael-MIC-verification-for-PCIe.patch + create mode 100644 package/kernel/mac80211/patches/ath/305-ath10k-Validate-first-subframe-of-A-MSDU-before-proc.patch + delete mode 100644 package/kernel/mac80211/patches/ath/560-ath9k-fix-transmitting-to-stations-in-dynamic-SMPS-m.patch + create mode 100644 package/kernel/mac80211/patches/rtl/001-v5.12-rtlwifi-8821ae-upgrade-PHY-and-RF-parameters.patch + create mode 100644 package/kernel/mac80211/patches/rtl/002-v5.13-rtlwifi-implement-set_tim-by-update-beacon-content.patch + create mode 100644 package/kernel/mac80211/patches/subsys/010-sync-nl80211_h.patch + create mode 100644 package/kernel/mac80211/patches/subsys/302-cfg80211-Add-support-to-configure-SAE-PWE-value-to-d.patch + create mode 100644 package/kernel/mac80211/patches/subsys/320-mac80211_hwsim-add-6GHz-channels.patch + create mode 100644 package/kernel/mac80211/patches/subsys/321-mac80211_hwsim-make-6-GHz-channels-usable.patch + create mode 100644 package/kernel/mac80211/patches/subsys/353-mac80211-minstrel_ht-fix-MINSTREL_FRAC-macro.patch + delete mode 100644 package/kernel/mac80211/patches/subsys/370-mac80211-fix-TXQ-AC-confusion.patch + delete mode 100644 package/kernel/mac80211/patches/subsys/374-mac80211-fix-time-is-after-bug-in-mlme.patch + create mode 100644 package/kernel/mac80211/patches/subsys/380-mac80211-assure-all-fragments-are-encrypted.patch + create mode 100644 package/kernel/mac80211/patches/subsys/381-mac80211-prevent-mixed-key-and-fragment-cache-attack.patch + create mode 100644 package/kernel/mac80211/patches/subsys/382-mac80211-properly-handle-A-MSDUs-that-start-with-an-.patch + create mode 100644 package/kernel/mac80211/patches/subsys/383-cfg80211-mitigate-A-MSDU-aggregation-attacks.patch + create mode 100644 package/kernel/mac80211/patches/subsys/384-mac80211-drop-A-MSDUs-on-old-ciphers.patch + create mode 100644 package/kernel/mac80211/patches/subsys/385-mac80211-add-fragment-cache-to-sta_info.patch + create mode 100644 package/kernel/mac80211/patches/subsys/386-mac80211-check-defrag-PN-against-current-frame.patch + create mode 100644 package/kernel/mac80211/patches/subsys/387-mac80211-prevent-attacks-on-TKIP-WEP-as-well.patch + create mode 100644 package/kernel/mac80211/patches/subsys/388-mac80211-do-not-accept-forward-invalid-EAPOL-frames.patch + create mode 100644 package/kernel/mac80211/patches/subsys/389-mac80211-extend-protection-against-mixed-key-and-fra.patch + +diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile +index f6ad06452f..4d10de09a7 100644 +--- a/package/kernel/mac80211/Makefile ++++ b/package/kernel/mac80211/Makefile +@@ -10,10 +10,10 @@ include $(INCLUDE_DIR)/kernel.mk + + PKG_NAME:=mac80211 + +-PKG_VERSION:=5.10.16-1 ++PKG_VERSION:=5.10.34-1 + PKG_RELEASE:=1 +-PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v5.10.16/ +-PKG_HASH:=12856db780c5023edc47e2d18486eb3346bb7c82f1f2fc48deb3b163142f7d2d ++PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v5.10.34/ ++PKG_HASH:=03c4ca6bf47d4e50b91b61bc2943a98c788439e56ce2b4080bc4c94141c2c15b + + PKG_SOURCE:=backports-$(PKG_VERSION).tar.xz + PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/backports-$(PKG_VERSION) +@@ -504,6 +504,7 @@ define Build/Patch + $(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/rt2x00,rt2x00/) + $(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/mwl,mwl/) + $(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/brcm,brcm/) ++ $(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/rtl,rtl/) + $(if $(QUILT),touch $(PKG_BUILD_DIR)/.quilt_used) + endef + +@@ -514,6 +515,7 @@ define Quilt/Refresh/Package + $(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/rt2x00,rt2x00/) + $(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/mwl,mwl/) + $(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/brcm,brcm/) ++ $(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/rtl,rtl/) + endef + + define Build/Compile +diff --git a/package/kernel/mac80211/ath.mk b/package/kernel/mac80211/ath.mk +index f209c95ba8..ba03ae11a6 100644 +--- a/package/kernel/mac80211/ath.mk ++++ b/package/kernel/mac80211/ath.mk +@@ -34,7 +34,7 @@ ifdef CONFIG_PACKAGE_MAC80211_TRACING + WIL6210_TRACING + endif + +-config-$(call config_package,ath) += ATH_CARDS ATH_COMMON ATH_REG_DYNAMIC_USER_REG_HINTS ++config-$(call config_package,ath) += ATH_CARDS ATH_COMMON + config-$(CONFIG_PACKAGE_ATH_DEBUG) += ATH_DEBUG ATH10K_DEBUG ATH9K_STATION_STATISTICS + config-$(CONFIG_PACKAGE_ATH_DFS) += ATH9K_DFS_CERTIFIED ATH10K_DFS_CERTIFIED + config-$(CONFIG_PACKAGE_ATH_SPECTRAL) += ATH9K_COMMON_SPECTRAL ATH10K_SPECTRAL +@@ -42,11 +42,10 @@ config-$(CONFIG_PACKAGE_ATH_DYNACK) += ATH9K_DYNACK + config-$(call config_package,ath9k) += ATH9K + config-$(call config_package,ath9k-common) += ATH9K_COMMON + config-$(call config_package,owl-loader) += ATH9K_PCI_NO_EEPROM +-config-$(CONFIG_TARGET_ar71xx) += ATH9K_AHB + config-$(CONFIG_TARGET_ath79) += ATH9K_AHB + config-$(CONFIG_TARGET_ipq40xx) += ATH10K_AHB + config-$(CONFIG_PCI) += ATH9K_PCI +-config-$(CONFIG_ATH_USER_REGD) += ATH_USER_REGD ++config-$(CONFIG_ATH_USER_REGD) += ATH_USER_REGD ATH_REG_DYNAMIC_USER_REG_HINTS + config-$(CONFIG_ATH9K_HWRNG) += ATH9K_HWRNG + config-$(CONFIG_ATH9K_SUPPORT_PCOEM) += ATH9K_PCOEM + config-$(CONFIG_ATH9K_TX99) += ATH9K_TX99 +@@ -126,7 +125,7 @@ endef + define KernelPackage/ath + $(call KernelPackage/mac80211/Default) + TITLE:=Atheros common driver part +- DEPENDS+= @PCI_SUPPORT||USB_SUPPORT||TARGET_ar71xx||TARGET_ath79||TARGET_ath25 +kmod-mac80211 ++ DEPENDS+= @PCI_SUPPORT||USB_SUPPORT||TARGET_ath79||TARGET_ath25 +kmod-mac80211 + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath.ko + MENU:=1 + endef +@@ -191,7 +190,7 @@ define KernelPackage/ath9k-common + TITLE:=Atheros 802.11n wireless devices (common code for ath9k and ath9k_htc) + URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath9k + HIDDEN:=1 +- DEPENDS+= @PCI_SUPPORT||USB_SUPPORT||TARGET_ar71xx||TARGET_ath79 +kmod-ath +@DRIVER_11N_SUPPORT ++ DEPENDS+= @PCI_SUPPORT||USB_SUPPORT||TARGET_ath79 +kmod-ath +@DRIVER_11N_SUPPORT + FILES:= \ + $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_common.ko \ + $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_hw.ko +@@ -201,7 +200,7 @@ define KernelPackage/ath9k + $(call KernelPackage/mac80211/Default) + TITLE:=Atheros 802.11n PCI wireless cards support + URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath9k +- DEPENDS+= @PCI_SUPPORT||TARGET_ar71xx||TARGET_ath79 +kmod-ath9k-common ++ DEPENDS+= @PCI_SUPPORT||TARGET_ath79 +kmod-ath9k-common + FILES:= \ + $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k.ko + AUTOLOAD:=$(call AutoProbe,ath9k) +@@ -231,7 +230,7 @@ define KernelPackage/ath9k/config + + config ATH9K_UBNTHSR + bool "Support for Ubiquiti UniFi Outdoor+ access point" +- depends on PACKAGE_kmod-ath9k && (TARGET_ar71xx_generic||TARGET_ath79) ++ depends on PACKAGE_kmod-ath9k && TARGET_ath79 + default y + + endef +diff --git a/package/kernel/mac80211/broadcom.mk b/package/kernel/mac80211/broadcom.mk +index fb576c5809..473bbf597c 100644 +--- a/package/kernel/mac80211/broadcom.mk ++++ b/package/kernel/mac80211/broadcom.mk +@@ -209,7 +209,7 @@ config PACKAGE_B43_USE_BCMA + default "16,28,29,30" if TARGET_bcm47xx_mips74k + default "5,6,7,8,9,10,11,13,15,16,28,29,30" + help +- This is a comma seperated list of core revision numbers. ++ This is a comma separated list of core revision numbers. + + Example (keep files for rev5 only): + 5 +@@ -224,7 +224,7 @@ config PACKAGE_B43_USE_BCMA + default "N,HT" if TARGET_bcm47xx_mips74k + default "G,N,LP,HT" + help +- This is a comma seperated list of PHY types: ++ This is a comma separated list of PHY types: + A => A-PHY + AG => Dual A-PHY G-PHY + G => G-PHY +diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh +index 92c56afd24..f1ed47802a 100644 +--- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh ++++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh +@@ -26,7 +26,6 @@ drv_mac80211_init_device_config() { + hostapd_common_add_device_config + + config_add_string path phy 'macaddr:macaddr' +- config_add_string hwmode + config_add_string tx_burst + config_add_string distance + config_add_int beacon_int chanbw frag rts +@@ -44,11 +43,24 @@ drv_mac80211_init_device_config() { + su_beamformee \ + mu_beamformer \ + mu_beamformee \ ++ he_su_beamformer \ ++ he_su_beamformee \ ++ he_mu_beamformer \ + vht_txop_ps \ + htc_vht \ + rx_antenna_pattern \ +- tx_antenna_pattern +- config_add_int vht_max_a_mpdu_len_exp vht_max_mpdu vht_link_adapt vht160 rx_stbc tx_stbc ++ tx_antenna_pattern \ ++ he_spr_sr_control \ ++ he_twt_required ++ config_add_int \ ++ vht_max_a_mpdu_len_exp \ ++ vht_max_mpdu \ ++ vht_link_adapt \ ++ vht160 \ ++ rx_stbc \ ++ tx_stbc \ ++ he_bss_color \ ++ he_spr_non_srg_obss_pd_max_offset + config_add_boolean \ + ldpc \ + greenfield \ +@@ -96,6 +108,23 @@ mac80211_add_capabilities() { + export -n -- "$__var=$__out" + } + ++mac80211_add_he_capabilities() { ++ local __out= oifs ++ ++ oifs="$IFS" ++ IFS=: ++ for capab in "$@"; do ++ set -- $capab ++ [ "$(($4))" -gt 0 ] || continue ++ [ "$(((0x$2) & $3))" -gt 0 ] || { ++ eval "$4=0" ++ continue ++ } ++ append base_cfg "$1=1" "$N" ++ done ++ IFS="$oifs" ++} ++ + mac80211_hostapd_setup_base() { + local phy="$1" + +@@ -195,12 +224,14 @@ mac80211_hostapd_setup_base() { + enable_ac=0 + vht_oper_chwidth=0 + vht_center_seg0= ++ chan_ofs=0 ++ [ "$band" = "6g" ] && chan_ofs=1 + + idx="$channel" + case "$htmode" in + VHT20|HE20) enable_ac=1;; + VHT40|HE40) +- case "$(( ($channel / 4) % 2 ))" in ++ case "$(( (($channel / 4) + $chan_ofs) % 2 ))" in + 1) idx=$(($channel + 2));; + 0) idx=$(($channel - 2));; + esac +@@ -208,7 +239,7 @@ mac80211_hostapd_setup_base() { + vht_center_seg0=$idx + ;; + VHT80|HE80) +- case "$(( ($channel / 4) % 4 ))" in ++ case "$(( (($channel / 4) + $chan_ofs) % 4 ))" in + 1) idx=$(($channel + 6));; + 2) idx=$(($channel + 2));; + 3) idx=$(($channel - 2));; +@@ -219,15 +250,35 @@ mac80211_hostapd_setup_base() { + vht_center_seg0=$idx + ;; + VHT160|HE160) +- case "$channel" in +- 36|40|44|48|52|56|60|64) idx=50;; +- 100|104|108|112|116|120|124|128) idx=114;; +- esac ++ if [ "$band" = "6g" ]; then ++ case "$channel" in ++ 1|5|9|13|17|21|25|29) idx=15;; ++ 33|37|41|45|49|53|57|61) idx=47;; ++ 65|69|73|77|81|85|89|93) idx=79;; ++ 97|101|105|109|113|117|121|125) idx=111;; ++ 129|133|137|141|145|149|153|157) idx=143;; ++ 161|165|169|173|177|181|185|189) idx=175;; ++ 193|197|201|205|209|213|217|221) idx=207;; ++ esac ++ else ++ case "$channel" in ++ 36|40|44|48|52|56|60|64) idx=50;; ++ 100|104|108|112|116|120|124|128) idx=114;; ++ esac ++ fi + enable_ac=1 + vht_oper_chwidth=2 + vht_center_seg0=$idx + ;; + esac ++ [ "$band" = "6g" ] && { ++ op_class= ++ case "$htmode" in ++ HE20) op_class=131;; ++ HE*) op_class=$((132 + $vht_oper_chwidth)) ++ esac ++ [ -n "$op_class" ] && append base_cfg "op_class=$op_class" "$N" ++ } + [ "$hwmode" = "a" ] || enable_ac=0 + + if [ "$enable_ac" != "0" ]; then +@@ -337,16 +388,62 @@ mac80211_hostapd_setup_base() { + esac + + if [ "$enable_ax" != "0" ]; then ++ json_get_vars \ ++ he_su_beamformer:1 \ ++ he_su_beamformee:0 \ ++ he_mu_beamformer:1 \ ++ he_twt_required:0 \ ++ he_spr_sr_control:0 \ ++ he_spr_non_srg_obss_pd_max_offset:1 \ ++ he_bss_color ++ ++ he_phy_cap=$(iw phy "$phy" info | awk -F "[()]" '/HE PHY Capabilities/ { print $2 }' | head -1) ++ he_phy_cap=${he_phy_cap:2} ++ he_mac_cap=$(iw phy "$phy" info | awk -F "[()]" '/HE MAC Capabilities/ { print $2 }' | head -1) ++ he_mac_cap=${he_mac_cap:2} ++ + append base_cfg "ieee80211ax=1" "$N" ++ [ -n "$he_bss_color" ] && append base_cfg "he_bss_color=$he_bss_color" "$N" + [ "$hwmode" = "a" ] && { + append base_cfg "he_oper_chwidth=$vht_oper_chwidth" "$N" + append base_cfg "he_oper_centr_freq_seg0_idx=$vht_center_seg0" "$N" + } ++ ++ mac80211_add_he_capabilities \ ++ he_su_beamformer:${he_phy_cap:6:2}:0x80:$he_su_beamformer \ ++ he_su_beamformee:${he_phy_cap:8:2}:0x1:$he_su_beamformee \ ++ he_mu_beamformer:${he_phy_cap:8:2}:0x2:$he_mu_beamformer \ ++ he_spr_sr_control:${he_phy_cap:14:2}:0x1:$he_spr_sr_control \ ++ he_twt_required:${he_mac_cap:0:2}:0x6:$he_twt_required ++ ++ [ "$he_spr_sr_control" -gt 0 ] && append base_cfg "he_spr_non_srg_obss_pd_max_offset=$he_spr_non_srg_obss_pd_max_offset" "$N" ++ + append base_cfg "he_default_pe_duration=4" "$N" + append base_cfg "he_rts_threshold=1023" "$N" +- append base_cfg "he_su_beamformer=1" "$N" +- append base_cfg "he_su_beamformee=1" "$N" +- append base_cfg "he_mu_beamformer=1" "$N" ++ append base_cfg "he_mu_edca_qos_info_param_count=0" "$N" ++ append base_cfg "he_mu_edca_qos_info_q_ack=0" "$N" ++ append base_cfg "he_mu_edca_qos_info_queue_request=0" "$N" ++ append base_cfg "he_mu_edca_qos_info_txop_request=0" "$N" ++ append base_cfg "he_mu_edca_ac_be_aifsn=8" "$N" ++ append base_cfg "he_mu_edca_ac_be_aci=0" "$N" ++ append base_cfg "he_mu_edca_ac_be_ecwmin=9" "$N" ++ append base_cfg "he_mu_edca_ac_be_ecwmax=10" "$N" ++ append base_cfg "he_mu_edca_ac_be_timer=255" "$N" ++ append base_cfg "he_mu_edca_ac_bk_aifsn=15" "$N" ++ append base_cfg "he_mu_edca_ac_bk_aci=1" "$N" ++ append base_cfg "he_mu_edca_ac_bk_ecwmin=9" "$N" ++ append base_cfg "he_mu_edca_ac_bk_ecwmax=10" "$N" ++ append base_cfg "he_mu_edca_ac_bk_timer=255" "$N" ++ append base_cfg "he_mu_edca_ac_vi_ecwmin=5" "$N" ++ append base_cfg "he_mu_edca_ac_vi_ecwmax=7" "$N" ++ append base_cfg "he_mu_edca_ac_vi_aifsn=5" "$N" ++ append base_cfg "he_mu_edca_ac_vi_aci=2" "$N" ++ append base_cfg "he_mu_edca_ac_vi_timer=255" "$N" ++ append base_cfg "he_mu_edca_ac_vo_aifsn=5" "$N" ++ append base_cfg "he_mu_edca_ac_vo_aci=3" "$N" ++ append base_cfg "he_mu_edca_ac_vo_ecwmin=5" "$N" ++ append base_cfg "he_mu_edca_ac_vo_ecwmax=7" "$N" ++ append base_cfg "he_mu_edca_ac_vo_timer=255" "$N" + fi + + hostapd_prepare_device_config "$hostapd_conf_file" nl80211 +@@ -689,14 +786,8 @@ mac80211_prepare_iw_htmode() { + case "$htmode" in + VHT20|HT20) iw_htmode=HT20;; + HT40*|VHT40|VHT160) +- case "$hwmode" in +- a) +- case "$(( ($channel / 4) % 2 ))" in +- 1) iw_htmode="HT40+" ;; +- 0) iw_htmode="HT40-";; +- esac +- ;; +- *) ++ case "$band" in ++ 2g) + case "$htmode" in + HT40+) iw_htmode="HT40+";; + HT40-) iw_htmode="HT40-";; +@@ -709,6 +800,12 @@ mac80211_prepare_iw_htmode() { + ;; + esac + ;; ++ *) ++ case "$(( ($channel / 4) % 2 ))" in ++ 1) iw_htmode="HT40+" ;; ++ 0) iw_htmode="HT40-";; ++ esac ++ ;; + esac + [ "$auto_channel" -gt 0 ] && iw_htmode="HT40+" + ;; +@@ -818,7 +915,6 @@ mac80211_setup_vif() { + mesh) + wireless_vif_parse_encryption + [ -z "$htmode" ] && htmode="NOHT"; +- freq="$(get_freq "$phy" "$channel")" + if [ "$wpa" -gt 0 -o "$auto_channel" -gt 0 ] || chan_is_dfs "$phy" "$channel"; then + mac80211_setup_supplicant $vif_enable || failed=1 + else +@@ -832,7 +928,6 @@ mac80211_setup_vif() { + adhoc) + wireless_vif_parse_encryption + if [ "$wpa" -gt 0 -o "$auto_channel" -gt 0 ]; then +- freq="$(get_freq "$phy" "$channel")" + mac80211_setup_supplicant_noctl $vif_enable || failed=1 + else + mac80211_setup_adhoc $vif_enable +@@ -849,9 +944,29 @@ mac80211_setup_vif() { + + get_freq() { + local phy="$1" +- local chan="$2" +- iw "$phy" info | grep -E -m1 "(\* ${chan:-....} MHz${chan:+|\\[$chan\\]})" | grep MHz | awk '{print $2}' ++ local channel="$2" ++ local band="$3" ++ ++ case "$band" in ++ 2g) band="1:";; ++ 5g) band="2:";; ++ 60g) band="3:";; ++ 6g) band="4:";; ++ esac ++ ++ iw "$phy" info | awk -v band="$band" -v channel="[$channel]" ' ++ ++$1 ~ /Band/ { ++ band_match = band == $2 ++} ++ ++band_match && $3 == "MHz" && $4 == channel { ++ print $2 ++ exit + } ++' ++} ++ + + chan_is_dfs() { + local phy="$1" +@@ -935,7 +1050,7 @@ drv_mac80211_setup() { + done + + # convert channel to frequency +- [ "$auto_channel" -gt 0 ] || freq="$(get_freq "$phy" "$channel")" ++ [ "$auto_channel" -gt 0 ] || freq="$(get_freq "$phy" "$channel" "$band")" + + [ -n "$country" ] && { + iw reg get | grep -q "^country $country:" || { +diff --git a/package/kernel/mac80211/files/lib/wifi/mac80211.sh b/package/kernel/mac80211/files/lib/wifi/mac80211.sh +index 3e99f06693..0763da8fd8 100644 +--- a/package/kernel/mac80211/files/lib/wifi/mac80211.sh ++++ b/package/kernel/mac80211/files/lib/wifi/mac80211.sh +@@ -57,6 +57,85 @@ check_mac80211_device() { + [ "$phy" = "$dev" ] && found=1 + } + ++ ++__get_band_defaults() { ++ local phy="$1" ++ ++ ( iw phy "$phy" info; echo ) | awk ' ++BEGIN { ++ bands = "" ++} ++ ++($1 == "Band" || $1 == "") && band { ++ if (channel) { ++ mode="NOHT" ++ if (ht) mode="HT20" ++ if (vht) mode="VHT80" ++ if (he) mode="HE80" ++ if (he && band == "1:") mode="HE20" ++ sub("\\[", "", channel) ++ sub("\\]", "", channel) ++ bands = bands band channel ":" mode " " ++ } ++ band="" ++} ++ ++$1 == "Band" { ++ band = $2 ++ channel = "" ++ vht = "" ++ ht = "" ++ he = "" ++} ++ ++$0 ~ "Capabilities:" { ++ ht=1 ++} ++ ++$0 ~ "VHT Capabilities:" { ++ vht=1 ++} ++ ++$0 ~ "HE Iftypes" { ++ he=1 ++} ++ ++$1 == "*" && $3 == "MHz" && $0 !~ /disabled/ && band && !channel { ++ channel = $4 ++} ++ ++END { ++ print bands ++}' ++} ++ ++get_band_defaults() { ++ local phy="$1" ++ ++ for c in $(__get_band_defaults "$phy"); do ++ local band="${c%%:*}" ++ c="${c#*:}" ++ local chan="${c%%:*}" ++ c="${c#*:}" ++ local mode="${c%%:*}" ++ ++ case "$band" in ++ 1) band=2g;; ++ 2) band=5g;; ++ 3) band=60g;; ++ 4) band=6g;; ++ *) band="";; ++ esac ++ ++ [ -n "$band" ] || continue ++ [ -n "$mode_band" -a "$band" = "6g" ] && return ++ ++ mode_band="$band" ++ channel="$chan" ++ htmode="$mode" ++ done ++} ++ + detect_mac80211() { + devidx=0 + config_load wireless +@@ -75,26 +154,12 @@ detect_mac80211() { + config_foreach check_mac80211_device wifi-device + [ "$found" -gt 0 ] && continue + +- mode_band="g" +- channel="11" ++ mode_band="" ++ channel="" + htmode="" + ht_capab="" + +- iw phy "$dev" info | grep -q 'Capabilities:' && htmode=HT20 +- +- iw phy "$dev" info | grep -q '\* 5... MHz \[' && { +- mode_band="a" +- channel=$(iw phy "$dev" info | grep '\* 5... MHz \[' | grep '(disabled)' -v -m 1 | sed 's/[^[]*\[\|\].*//g') +- iw phy "$dev" info | grep -q 'VHT Capabilities' && htmode="VHT80" +- } +- +- iw phy "$dev" info | grep -q '\* 5.... MHz \[' && { +- mode_band="ad" +- channel=$(iw phy "$dev" info | grep '\* 5.... MHz \[' | grep '(disabled)' -v -m 1 | sed 's/[^[]*\[\|\|\].*//g') +- iw phy "$dev" info | grep -q 'Capabilities:' && htmode="HT20" +- } +- +- [ -n "$htmode" ] && ht_capab="set wireless.radio${devidx}.htmode=$htmode" ++ get_band_defaults "$dev" + + path="$(mac80211_phy_to_path "$dev")" + if [ -n "$path" ]; then +@@ -106,10 +171,10 @@ detect_mac80211() { + uci -q batch <<-EOF + set wireless.radio${devidx}=wifi-device + set wireless.radio${devidx}.type=mac80211 +- set wireless.radio${devidx}.channel=${channel} +- set wireless.radio${devidx}.hwmode=11${mode_band} + ${dev_id} +- ${ht_capab} ++ set wireless.radio${devidx}.channel=${channel} ++ set wireless.radio${devidx}.band=${mode_band} ++ set wireless.radio${devidx}.htmode=$htmode + set wireless.radio${devidx}.disabled=1 + + set wireless.default_radio${devidx}=wifi-iface +diff --git a/package/kernel/mac80211/patches/ath/080-ath10k_thermal_config.patch b/package/kernel/mac80211/patches/ath/080-ath10k_thermal_config.patch +index de6f9d9bb0..55d48daa79 100644 +--- a/package/kernel/mac80211/patches/ath/080-ath10k_thermal_config.patch ++++ b/package/kernel/mac80211/patches/ath/080-ath10k_thermal_config.patch +@@ -37,7 +37,7 @@ + void ath10k_thermal_event_temperature(struct ath10k *ar, int temperature); + --- a/local-symbols + +++ b/local-symbols +-@@ -142,6 +142,7 @@ ATH10K_SNOC= ++@@ -143,6 +143,7 @@ ATH10K_SNOC= + ATH10K_DEBUG= + ATH10K_DEBUGFS= + ATH10K_SPECTRAL= +diff --git a/package/kernel/mac80211/patches/ath/300-ath10k-add-CCMP-PN-replay-protection-for-fragmented-.patch b/package/kernel/mac80211/patches/ath/300-ath10k-add-CCMP-PN-replay-protection-for-fragmented-.patch +new file mode 100644 +index 0000000000..0ce49b22ab +--- /dev/null ++++ b/package/kernel/mac80211/patches/ath/300-ath10k-add-CCMP-PN-replay-protection-for-fragmented-.patch +@@ -0,0 +1,180 @@ ++From: Wen Gong ++Date: Tue, 11 May 2021 20:02:52 +0200 ++Subject: [PATCH] ath10k: add CCMP PN replay protection for fragmented ++ frames for PCIe ++ ++PN replay check for not fragmented frames is finished in the firmware, ++but this was not done for fragmented frames when ath10k is used with ++QCA6174/QCA6377 PCIe. mac80211 has the function ++ieee80211_rx_h_defragment() for PN replay check for fragmented frames, ++but this does not get checked with QCA6174 due to the ++ieee80211_has_protected() condition not matching the cleared Protected ++bit case. ++ ++Validate the PN of received fragmented frames within ath10k when CCMP is ++used and drop the fragment if the PN is not correct (incremented by ++exactly one from the previous fragment). This applies only for ++QCA6174/QCA6377 PCIe. ++ ++Tested-on: QCA6174 hw3.2 PCI WLAN.RM.4.4.1-00110-QCARMSWP-1 ++ ++Cc: stable@vger.kernel.org ++Signed-off-by: Wen Gong ++Signed-off-by: Jouni Malinen ++Signed-off-by: Johannes Berg ++--- ++ ++--- a/drivers/net/wireless/ath/ath10k/htt.h +++++ b/drivers/net/wireless/ath/ath10k/htt.h ++@@ -846,6 +846,7 @@ enum htt_security_types { ++ ++ #define ATH10K_HTT_TXRX_PEER_SECURITY_MAX 2 ++ #define ATH10K_TXRX_NUM_EXT_TIDS 19 +++#define ATH10K_TXRX_NON_QOS_TID 16 ++ ++ enum htt_security_flags { ++ #define HTT_SECURITY_TYPE_MASK 0x7F ++--- a/drivers/net/wireless/ath/ath10k/htt_rx.c +++++ b/drivers/net/wireless/ath/ath10k/htt_rx.c ++@@ -1746,16 +1746,87 @@ static void ath10k_htt_rx_h_csum_offload ++ msdu->ip_summed = ath10k_htt_rx_get_csum_state(msdu); ++ } ++ +++static u64 ath10k_htt_rx_h_get_pn(struct ath10k *ar, struct sk_buff *skb, +++ u16 offset, +++ enum htt_rx_mpdu_encrypt_type enctype) +++{ +++ struct ieee80211_hdr *hdr; +++ u64 pn = 0; +++ u8 *ehdr; +++ +++ hdr = (struct ieee80211_hdr *)(skb->data + offset); +++ ehdr = skb->data + offset + ieee80211_hdrlen(hdr->frame_control); +++ +++ if (enctype == HTT_RX_MPDU_ENCRYPT_AES_CCM_WPA2) { +++ pn = ehdr[0]; +++ pn |= (u64)ehdr[1] << 8; +++ pn |= (u64)ehdr[4] << 16; +++ pn |= (u64)ehdr[5] << 24; +++ pn |= (u64)ehdr[6] << 32; +++ pn |= (u64)ehdr[7] << 40; +++ } +++ return pn; +++} +++ +++static bool ath10k_htt_rx_h_frag_pn_check(struct ath10k *ar, +++ struct sk_buff *skb, +++ u16 peer_id, +++ u16 offset, +++ enum htt_rx_mpdu_encrypt_type enctype) +++{ +++ struct ath10k_peer *peer; +++ union htt_rx_pn_t *last_pn, new_pn = {0}; +++ struct ieee80211_hdr *hdr; +++ bool more_frags; +++ u8 tid, frag_number; +++ u32 seq; +++ +++ peer = ath10k_peer_find_by_id(ar, peer_id); +++ if (!peer) { +++ ath10k_dbg(ar, ATH10K_DBG_HTT, "invalid peer for frag pn check\n"); +++ return false; +++ } +++ +++ hdr = (struct ieee80211_hdr *)(skb->data + offset); +++ if (ieee80211_is_data_qos(hdr->frame_control)) +++ tid = ieee80211_get_tid(hdr); +++ else +++ tid = ATH10K_TXRX_NON_QOS_TID; +++ +++ last_pn = &peer->frag_tids_last_pn[tid]; +++ new_pn.pn48 = ath10k_htt_rx_h_get_pn(ar, skb, offset, enctype); +++ more_frags = ieee80211_has_morefrags(hdr->frame_control); +++ frag_number = le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG; +++ seq = (__le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_SEQ) >> 4; +++ +++ if (frag_number == 0) { +++ last_pn->pn48 = new_pn.pn48; +++ peer->frag_tids_seq[tid] = seq; +++ } else { +++ if (seq != peer->frag_tids_seq[tid]) +++ return false; +++ +++ if (new_pn.pn48 != last_pn->pn48 + 1) +++ return false; +++ +++ last_pn->pn48 = new_pn.pn48; +++ } +++ +++ return true; +++} +++ ++ static void ath10k_htt_rx_h_mpdu(struct ath10k *ar, ++ struct sk_buff_head *amsdu, ++ struct ieee80211_rx_status *status, ++ bool fill_crypt_header, ++ u8 *rx_hdr, ++- enum ath10k_pkt_rx_err *err) +++ enum ath10k_pkt_rx_err *err, +++ u16 peer_id, +++ bool frag) ++ { ++ struct sk_buff *first; ++ struct sk_buff *last; ++- struct sk_buff *msdu; +++ struct sk_buff *msdu, *temp; ++ struct htt_rx_desc *rxd; ++ struct ieee80211_hdr *hdr; ++ enum htt_rx_mpdu_encrypt_type enctype; ++@@ -1768,6 +1839,7 @@ static void ath10k_htt_rx_h_mpdu(struct ++ bool is_decrypted; ++ bool is_mgmt; ++ u32 attention; +++ bool frag_pn_check = true; ++ ++ if (skb_queue_empty(amsdu)) ++ return; ++@@ -1866,6 +1938,24 @@ static void ath10k_htt_rx_h_mpdu(struct ++ } ++ ++ skb_queue_walk(amsdu, msdu) { +++ if (frag && !fill_crypt_header && is_decrypted && +++ enctype == HTT_RX_MPDU_ENCRYPT_AES_CCM_WPA2) +++ frag_pn_check = ath10k_htt_rx_h_frag_pn_check(ar, +++ msdu, +++ peer_id, +++ 0, +++ enctype); +++ +++ if (!frag_pn_check) { +++ /* Discard the fragment with invalid PN */ +++ temp = msdu->prev; +++ __skb_unlink(msdu, amsdu); +++ dev_kfree_skb_any(msdu); +++ msdu = temp; +++ frag_pn_check = true; +++ continue; +++ } +++ ++ ath10k_htt_rx_h_csum_offload(msdu); ++ ath10k_htt_rx_h_undecap(ar, msdu, status, first_hdr, enctype, ++ is_decrypted); ++@@ -2071,7 +2161,8 @@ static int ath10k_htt_rx_handle_amsdu(st ++ ath10k_htt_rx_h_unchain(ar, &amsdu, &drop_cnt, &unchain_cnt); ++ ++ ath10k_htt_rx_h_filter(ar, &amsdu, rx_status, &drop_cnt_filter); ++- ath10k_htt_rx_h_mpdu(ar, &amsdu, rx_status, true, first_hdr, &err); +++ ath10k_htt_rx_h_mpdu(ar, &amsdu, rx_status, true, first_hdr, &err, 0, +++ false); ++ msdus_to_queue = skb_queue_len(&amsdu); ++ ath10k_htt_rx_h_enqueue(ar, &amsdu, rx_status); ++ ++@@ -3027,7 +3118,7 @@ static int ath10k_htt_rx_in_ord_ind(stru ++ ath10k_htt_rx_h_ppdu(ar, &amsdu, status, vdev_id); ++ ath10k_htt_rx_h_filter(ar, &amsdu, status, NULL); ++ ath10k_htt_rx_h_mpdu(ar, &amsdu, status, false, NULL, ++- NULL); +++ NULL, peer_id, frag); ++ ath10k_htt_rx_h_enqueue(ar, &amsdu, status); ++ break; ++ case -EAGAIN: +diff --git a/package/kernel/mac80211/patches/ath/301-ath10k-drop-fragments-with-multicast-DA-for-PCIe.patch b/package/kernel/mac80211/patches/ath/301-ath10k-drop-fragments-with-multicast-DA-for-PCIe.patch +new file mode 100644 +index 0000000000..7288c66612 +--- /dev/null ++++ b/package/kernel/mac80211/patches/ath/301-ath10k-drop-fragments-with-multicast-DA-for-PCIe.patch +@@ -0,0 +1,66 @@ ++From: Wen Gong ++Date: Tue, 11 May 2021 20:02:53 +0200 ++Subject: [PATCH] ath10k: drop fragments with multicast DA for PCIe ++ ++Fragmentation is not used with multicast frames. Discard unexpected ++fragments with multicast DA. This fixes CVE-2020-26145. ++ ++Tested-on: QCA6174 hw3.2 PCI WLAN.RM.4.4.1-00110-QCARMSWP-1 ++ ++Cc: stable@vger.kernel.org ++Signed-off-by: Wen Gong ++Signed-off-by: Jouni Malinen ++Signed-off-by: Johannes Berg ++--- ++ ++--- a/drivers/net/wireless/ath/ath10k/htt_rx.c +++++ b/drivers/net/wireless/ath/ath10k/htt_rx.c ++@@ -1768,6 +1768,16 @@ static u64 ath10k_htt_rx_h_get_pn(struct ++ return pn; ++ } ++ +++static bool ath10k_htt_rx_h_frag_multicast_check(struct ath10k *ar, +++ struct sk_buff *skb, +++ u16 offset) +++{ +++ struct ieee80211_hdr *hdr; +++ +++ hdr = (struct ieee80211_hdr *)(skb->data + offset); +++ return !is_multicast_ether_addr(hdr->addr1); +++} +++ ++ static bool ath10k_htt_rx_h_frag_pn_check(struct ath10k *ar, ++ struct sk_buff *skb, ++ u16 peer_id, ++@@ -1839,7 +1849,7 @@ static void ath10k_htt_rx_h_mpdu(struct ++ bool is_decrypted; ++ bool is_mgmt; ++ u32 attention; ++- bool frag_pn_check = true; +++ bool frag_pn_check = true, multicast_check = true; ++ ++ if (skb_queue_empty(amsdu)) ++ return; ++@@ -1946,13 +1956,20 @@ static void ath10k_htt_rx_h_mpdu(struct ++ 0, ++ enctype); ++ ++- if (!frag_pn_check) { ++- /* Discard the fragment with invalid PN */ +++ if (frag) +++ multicast_check = ath10k_htt_rx_h_frag_multicast_check(ar, +++ msdu, +++ 0); +++ +++ if (!frag_pn_check || !multicast_check) { +++ /* Discard the fragment with invalid PN or multicast DA +++ */ ++ temp = msdu->prev; ++ __skb_unlink(msdu, amsdu); ++ dev_kfree_skb_any(msdu); ++ msdu = temp; ++ frag_pn_check = true; +++ multicast_check = true; ++ continue; ++ } ++ +diff --git a/package/kernel/mac80211/patches/ath/302-ath10k-drop-fragments-with-multicast-DA-for-SDIO.patch b/package/kernel/mac80211/patches/ath/302-ath10k-drop-fragments-with-multicast-DA-for-SDIO.patch +new file mode 100644 +index 0000000000..85d9ce65e2 +--- /dev/null ++++ b/package/kernel/mac80211/patches/ath/302-ath10k-drop-fragments-with-multicast-DA-for-SDIO.patch +@@ -0,0 +1,40 @@ ++From: Wen Gong ++Date: Tue, 11 May 2021 20:02:54 +0200 ++Subject: [PATCH] ath10k: drop fragments with multicast DA for SDIO ++ ++Fragmentation is not used with multicast frames. Discard unexpected ++fragments with multicast DA. This fixes CVE-2020-26145. ++ ++Tested-on: QCA6174 hw3.2 SDIO WLAN.RMH.4.4.1-00049 ++ ++Cc: stable@vger.kernel.org ++Signed-off-by: Wen Gong ++Signed-off-by: Jouni Malinen ++Signed-off-by: Johannes Berg ++--- ++ ++--- a/drivers/net/wireless/ath/ath10k/htt_rx.c +++++ b/drivers/net/wireless/ath/ath10k/htt_rx.c ++@@ -2617,6 +2617,13 @@ static bool ath10k_htt_rx_proc_rx_frag_i ++ rx_desc = (struct htt_hl_rx_desc *)(skb->data + tot_hdr_len); ++ rx_desc_info = __le32_to_cpu(rx_desc->info); ++ +++ hdr = (struct ieee80211_hdr *)((u8 *)rx_desc + rx_hl->fw_desc.len); +++ +++ if (is_multicast_ether_addr(hdr->addr1)) { +++ /* Discard the fragment with multicast DA */ +++ goto err; +++ } +++ ++ if (!MS(rx_desc_info, HTT_RX_DESC_HL_INFO_ENCRYPTED)) { ++ spin_unlock_bh(&ar->data_lock); ++ return ath10k_htt_rx_proc_rx_ind_hl(htt, &resp->rx_ind_hl, skb, ++@@ -2624,8 +2631,6 @@ static bool ath10k_htt_rx_proc_rx_frag_i ++ HTT_RX_NON_TKIP_MIC); ++ } ++ ++- hdr = (struct ieee80211_hdr *)((u8 *)rx_desc + rx_hl->fw_desc.len); ++- ++ if (ieee80211_has_retry(hdr->frame_control)) ++ goto err; ++ +diff --git a/package/kernel/mac80211/patches/ath/303-ath10k-drop-MPDU-which-has-discard-flag-set-by-firmw.patch b/package/kernel/mac80211/patches/ath/303-ath10k-drop-MPDU-which-has-discard-flag-set-by-firmw.patch +new file mode 100644 +index 0000000000..03bce4231b +--- /dev/null ++++ b/package/kernel/mac80211/patches/ath/303-ath10k-drop-MPDU-which-has-discard-flag-set-by-firmw.patch +@@ -0,0 +1,54 @@ ++From: Wen Gong ++Date: Tue, 11 May 2021 20:02:55 +0200 ++Subject: [PATCH] ath10k: drop MPDU which has discard flag set by firmware ++ for SDIO ++ ++When the discard flag is set by the firmware for an MPDU, it should be ++dropped. This allows a mitigation for CVE-2020-24588 to be implemented ++in the firmware. ++ ++Tested-on: QCA6174 hw3.2 SDIO WLAN.RMH.4.4.1-00049 ++ ++Cc: stable@vger.kernel.org ++Signed-off-by: Wen Gong ++Signed-off-by: Jouni Malinen ++Signed-off-by: Johannes Berg ++--- ++ ++--- a/drivers/net/wireless/ath/ath10k/htt_rx.c +++++ b/drivers/net/wireless/ath/ath10k/htt_rx.c ++@@ -2312,6 +2312,11 @@ static bool ath10k_htt_rx_proc_rx_ind_hl ++ fw_desc = &rx->fw_desc; ++ rx_desc_len = fw_desc->len; ++ +++ if (fw_desc->u.bits.discard) { +++ ath10k_dbg(ar, ATH10K_DBG_HTT, "htt discard mpdu\n"); +++ goto err; +++ } +++ ++ /* I have not yet seen any case where num_mpdu_ranges > 1. ++ * qcacld does not seem handle that case either, so we introduce the ++ * same limitiation here as well. ++--- a/drivers/net/wireless/ath/ath10k/rx_desc.h +++++ b/drivers/net/wireless/ath/ath10k/rx_desc.h ++@@ -1282,7 +1282,19 @@ struct fw_rx_desc_base { ++ #define FW_RX_DESC_UDP (1 << 6) ++ ++ struct fw_rx_desc_hl { ++- u8 info0; +++ union { +++ struct { +++ u8 discard:1, +++ forward:1, +++ any_err:1, +++ dup_err:1, +++ reserved:1, +++ inspect:1, +++ extension:2; +++ } bits; +++ u8 info0; +++ } u; +++ ++ u8 version; ++ u8 len; ++ u8 flags; +diff --git a/package/kernel/mac80211/patches/ath/304-ath10k-Fix-TKIP-Michael-MIC-verification-for-PCIe.patch b/package/kernel/mac80211/patches/ath/304-ath10k-Fix-TKIP-Michael-MIC-verification-for-PCIe.patch +new file mode 100644 +index 0000000000..da9d6802bd +--- /dev/null ++++ b/package/kernel/mac80211/patches/ath/304-ath10k-Fix-TKIP-Michael-MIC-verification-for-PCIe.patch +@@ -0,0 +1,48 @@ ++From: Wen Gong ++Date: Tue, 11 May 2021 20:02:56 +0200 ++Subject: [PATCH] ath10k: Fix TKIP Michael MIC verification for PCIe ++ ++TKIP Michael MIC was not verified properly for PCIe cases since the ++validation steps in ieee80211_rx_h_michael_mic_verify() in mac80211 did ++not get fully executed due to unexpected flag values in ++ieee80211_rx_status. ++ ++Fix this by setting the flags property to meet mac80211 expectations for ++performing Michael MIC validation there. This fixes CVE-2020-26141. It ++does the same as ath10k_htt_rx_proc_rx_ind_hl() for SDIO which passed ++MIC verification case. This applies only to QCA6174/QCA9377 PCIe. ++ ++Tested-on: QCA6174 hw3.2 PCI WLAN.RM.4.4.1-00110-QCARMSWP-1 ++ ++Cc: stable@vger.kernel.org ++Signed-off-by: Wen Gong ++Signed-off-by: Jouni Malinen ++Signed-off-by: Johannes Berg ++--- ++ ++--- a/drivers/net/wireless/ath/ath10k/htt_rx.c +++++ b/drivers/net/wireless/ath/ath10k/htt_rx.c ++@@ -1974,6 +1974,11 @@ static void ath10k_htt_rx_h_mpdu(struct ++ } ++ ++ ath10k_htt_rx_h_csum_offload(msdu); +++ +++ if (frag && !fill_crypt_header && +++ enctype == HTT_RX_MPDU_ENCRYPT_TKIP_WPA) +++ status->flag &= ~RX_FLAG_MMIC_STRIPPED; +++ ++ ath10k_htt_rx_h_undecap(ar, msdu, status, first_hdr, enctype, ++ is_decrypted); ++ ++@@ -1991,6 +1996,11 @@ static void ath10k_htt_rx_h_mpdu(struct ++ ++ hdr = (void *)msdu->data; ++ hdr->frame_control &= ~__cpu_to_le16(IEEE80211_FCTL_PROTECTED); +++ +++ if (frag && !fill_crypt_header && +++ enctype == HTT_RX_MPDU_ENCRYPT_TKIP_WPA) +++ status->flag &= ~RX_FLAG_IV_STRIPPED & +++ ~RX_FLAG_MMIC_STRIPPED; ++ } ++ } ++ +diff --git a/package/kernel/mac80211/patches/ath/305-ath10k-Validate-first-subframe-of-A-MSDU-before-proc.patch b/package/kernel/mac80211/patches/ath/305-ath10k-Validate-first-subframe-of-A-MSDU-before-proc.patch +new file mode 100644 +index 0000000000..0bdbed78d5 +--- /dev/null ++++ b/package/kernel/mac80211/patches/ath/305-ath10k-Validate-first-subframe-of-A-MSDU-before-proc.patch +@@ -0,0 +1,109 @@ ++From: Sriram R ++Date: Tue, 11 May 2021 20:02:57 +0200 ++Subject: [PATCH] ath10k: Validate first subframe of A-MSDU before ++ processing the list ++ ++In certain scenarios a normal MSDU can be received as an A-MSDU when ++the A-MSDU present bit of a QoS header gets flipped during reception. ++Since this bit is unauthenticated, the hardware crypto engine can pass ++the frame to the driver without any error indication. ++ ++This could result in processing unintended subframes collected in the ++A-MSDU list. Hence, validate A-MSDU list by checking if the first frame ++has a valid subframe header. ++ ++Comparing the non-aggregated MSDU and an A-MSDU, the fields of the first ++subframe DA matches the LLC/SNAP header fields of a normal MSDU. ++In order to avoid processing such frames, add a validation to ++filter such A-MSDU frames where the first subframe header DA matches ++with the LLC/SNAP header pattern. ++ ++Tested-on: QCA9984 hw1.0 PCI 10.4-3.10-00047 ++ ++Cc: stable@vger.kernel.org ++Signed-off-by: Sriram R ++Signed-off-by: Jouni Malinen ++Signed-off-by: Johannes Berg ++--- ++ ++--- a/drivers/net/wireless/ath/ath10k/htt_rx.c +++++ b/drivers/net/wireless/ath/ath10k/htt_rx.c ++@@ -2108,14 +2108,62 @@ static void ath10k_htt_rx_h_unchain(stru ++ ath10k_unchain_msdu(amsdu, unchain_cnt); ++ } ++ +++static bool ath10k_htt_rx_validate_amsdu(struct ath10k *ar, +++ struct sk_buff_head *amsdu) +++{ +++ u8 *subframe_hdr; +++ struct sk_buff *first; +++ bool is_first, is_last; +++ struct htt_rx_desc *rxd; +++ struct ieee80211_hdr *hdr; +++ size_t hdr_len, crypto_len; +++ enum htt_rx_mpdu_encrypt_type enctype; +++ int bytes_aligned = ar->hw_params.decap_align_bytes; +++ +++ first = skb_peek(amsdu); +++ +++ rxd = (void *)first->data - sizeof(*rxd); +++ hdr = (void *)rxd->rx_hdr_status; +++ +++ is_first = !!(rxd->msdu_end.common.info0 & +++ __cpu_to_le32(RX_MSDU_END_INFO0_FIRST_MSDU)); +++ is_last = !!(rxd->msdu_end.common.info0 & +++ __cpu_to_le32(RX_MSDU_END_INFO0_LAST_MSDU)); +++ +++ /* Return in case of non-aggregated msdu */ +++ if (is_first && is_last) +++ return true; +++ +++ /* First msdu flag is not set for the first msdu of the list */ +++ if (!is_first) +++ return false; +++ +++ enctype = MS(__le32_to_cpu(rxd->mpdu_start.info0), +++ RX_MPDU_START_INFO0_ENCRYPT_TYPE); +++ +++ hdr_len = ieee80211_hdrlen(hdr->frame_control); +++ crypto_len = ath10k_htt_rx_crypto_param_len(ar, enctype); +++ +++ subframe_hdr = (u8 *)hdr + round_up(hdr_len, bytes_aligned) + +++ crypto_len; +++ +++ /* Validate if the amsdu has a proper first subframe. +++ * There are chances a single msdu can be received as amsdu when +++ * the unauthenticated amsdu flag of a QoS header +++ * gets flipped in non-SPP AMSDU's, in such cases the first +++ * subframe has llc/snap header in place of a valid da. +++ * return false if the da matches rfc1042 pattern +++ */ +++ if (ether_addr_equal(subframe_hdr, rfc1042_header)) +++ return false; +++ +++ return true; +++} +++ ++ static bool ath10k_htt_rx_amsdu_allowed(struct ath10k *ar, ++ struct sk_buff_head *amsdu, ++ struct ieee80211_rx_status *rx_status) ++ { ++- /* FIXME: It might be a good idea to do some fuzzy-testing to drop ++- * invalid/dangerous frames. ++- */ ++- ++ if (!rx_status->freq) { ++ ath10k_dbg(ar, ATH10K_DBG_HTT, "no channel configured; ignoring frame(s)!\n"); ++ return false; ++@@ -2126,6 +2174,11 @@ static bool ath10k_htt_rx_amsdu_allowed( ++ return false; ++ } ++ +++ if (!ath10k_htt_rx_validate_amsdu(ar, amsdu)) { +++ ath10k_dbg(ar, ATH10K_DBG_HTT, "invalid amsdu received\n"); +++ return false; +++ } +++ ++ return true; ++ } ++ +diff --git a/package/kernel/mac80211/patches/ath/402-ath_regd_optional.patch b/package/kernel/mac80211/patches/ath/402-ath_regd_optional.patch +index bf87d3551a..3c9180b113 100644 +--- a/package/kernel/mac80211/patches/ath/402-ath_regd_optional.patch ++++ b/package/kernel/mac80211/patches/ath/402-ath_regd_optional.patch +@@ -82,7 +82,7 @@ + help + --- a/local-symbols + +++ b/local-symbols +-@@ -85,6 +85,7 @@ ADM8211= ++@@ -86,6 +86,7 @@ ADM8211= + ATH_COMMON= + WLAN_VENDOR_ATH= + ATH_DEBUG= +diff --git a/package/kernel/mac80211/patches/ath/500-ath9k_eeprom_debugfs.patch b/package/kernel/mac80211/patches/ath/500-ath9k_eeprom_debugfs.patch +index 786a3ed3fb..48ccc81308 100644 +--- a/package/kernel/mac80211/patches/ath/500-ath9k_eeprom_debugfs.patch ++++ b/package/kernel/mac80211/patches/ath/500-ath9k_eeprom_debugfs.patch +@@ -1,6 +1,6 @@ + --- a/drivers/net/wireless/ath/ath9k/debug.c + +++ b/drivers/net/wireless/ath/ath9k/debug.c +-@@ -1361,6 +1361,53 @@ void ath9k_deinit_debug(struct ath_softc ++@@ -1364,6 +1364,53 @@ void ath9k_deinit_debug(struct ath_softc + ath9k_cmn_spectral_deinit_debug(&sc->spec_priv); + } + +@@ -54,7 +54,7 @@ + int ath9k_init_debug(struct ath_hw *ah) + { + struct ath_common *common = ath9k_hw_common(ah); +-@@ -1380,6 +1427,8 @@ int ath9k_init_debug(struct ath_hw *ah) ++@@ -1383,6 +1430,8 @@ int ath9k_init_debug(struct ath_hw *ah) + ath9k_tx99_init_debug(sc); + ath9k_cmn_spectral_init_debug(&sc->spec_priv, sc->debug.debugfs_phy); + +diff --git a/package/kernel/mac80211/patches/ath/512-ath9k_channelbw_debugfs.patch b/package/kernel/mac80211/patches/ath/512-ath9k_channelbw_debugfs.patch +index 80e33182f7..126d1d5c62 100644 +--- a/package/kernel/mac80211/patches/ath/512-ath9k_channelbw_debugfs.patch ++++ b/package/kernel/mac80211/patches/ath/512-ath9k_channelbw_debugfs.patch +@@ -1,6 +1,6 @@ + --- a/drivers/net/wireless/ath/ath9k/debug.c + +++ b/drivers/net/wireless/ath/ath9k/debug.c +-@@ -1408,6 +1408,52 @@ static const struct file_operations fops ++@@ -1411,6 +1411,52 @@ static const struct file_operations fops + .owner = THIS_MODULE + }; + +@@ -53,7 +53,7 @@ + int ath9k_init_debug(struct ath_hw *ah) + { + struct ath_common *common = ath9k_hw_common(ah); +-@@ -1429,6 +1475,8 @@ int ath9k_init_debug(struct ath_hw *ah) ++@@ -1432,6 +1478,8 @@ int ath9k_init_debug(struct ath_hw *ah) + + debugfs_create_file("eeprom", S_IRUSR, sc->debug.debugfs_phy, sc, + &fops_eeprom); +diff --git a/package/kernel/mac80211/patches/ath/530-ath9k_extra_leds.patch b/package/kernel/mac80211/patches/ath/530-ath9k_extra_leds.patch +index 1f19483064..5fd5c73a2f 100644 +--- a/package/kernel/mac80211/patches/ath/530-ath9k_extra_leds.patch ++++ b/package/kernel/mac80211/patches/ath/530-ath9k_extra_leds.patch +@@ -1,6 +1,6 @@ + --- a/drivers/net/wireless/ath/ath9k/ath9k.h + +++ b/drivers/net/wireless/ath/ath9k/ath9k.h +-@@ -843,6 +843,9 @@ static inline int ath9k_dump_btcoex(stru ++@@ -844,6 +844,9 @@ static inline int ath9k_dump_btcoex(stru + #ifdef CPTCFG_MAC80211_LEDS + void ath_init_leds(struct ath_softc *sc); + void ath_deinit_leds(struct ath_softc *sc); +@@ -10,7 +10,7 @@ + #else + static inline void ath_init_leds(struct ath_softc *sc) + { +-@@ -979,6 +982,13 @@ void ath_ant_comb_scan(struct ath_softc ++@@ -980,6 +983,13 @@ void ath_ant_comb_scan(struct ath_softc + + #define ATH9K_NUM_CHANCTX 2 /* supports 2 operating channels */ + +@@ -24,7 +24,7 @@ + struct ath_softc { + struct ieee80211_hw *hw; + struct device *dev; +-@@ -1032,9 +1042,8 @@ struct ath_softc { ++@@ -1033,9 +1043,8 @@ struct ath_softc { + spinlock_t chan_lock; + + #ifdef CPTCFG_MAC80211_LEDS +@@ -192,7 +192,7 @@ + #endif + --- a/drivers/net/wireless/ath/ath9k/debug.c + +++ b/drivers/net/wireless/ath/ath9k/debug.c +-@@ -1453,6 +1453,61 @@ static const struct file_operations fops ++@@ -1456,6 +1456,61 @@ static const struct file_operations fops + .llseek = default_llseek, + }; + +@@ -254,7 +254,7 @@ + + int ath9k_init_debug(struct ath_hw *ah) + { +-@@ -1477,6 +1532,10 @@ int ath9k_init_debug(struct ath_hw *ah) ++@@ -1480,6 +1535,10 @@ int ath9k_init_debug(struct ath_hw *ah) + &fops_eeprom); + debugfs_create_file("chanbw", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, + sc, &fops_chanbw); +diff --git a/package/kernel/mac80211/patches/ath/542-ath9k_debugfs_diag.patch b/package/kernel/mac80211/patches/ath/542-ath9k_debugfs_diag.patch +index 76cb63a5c8..f93a6fe5cd 100644 +--- a/package/kernel/mac80211/patches/ath/542-ath9k_debugfs_diag.patch ++++ b/package/kernel/mac80211/patches/ath/542-ath9k_debugfs_diag.patch +@@ -1,6 +1,6 @@ + --- a/drivers/net/wireless/ath/ath9k/debug.c + +++ b/drivers/net/wireless/ath/ath9k/debug.c +-@@ -1509,6 +1509,50 @@ static const struct file_operations fops ++@@ -1512,6 +1512,50 @@ static const struct file_operations fops + #endif + + +@@ -51,7 +51,7 @@ + int ath9k_init_debug(struct ath_hw *ah) + { + struct ath_common *common = ath9k_hw_common(ah); +-@@ -1536,6 +1580,8 @@ int ath9k_init_debug(struct ath_hw *ah) ++@@ -1539,6 +1583,8 @@ int ath9k_init_debug(struct ath_hw *ah) + debugfs_create_file("gpio_led", S_IWUSR, + sc->debug.debugfs_phy, sc, &fops_gpio_led); + #endif +diff --git a/package/kernel/mac80211/patches/ath/548-ath9k_enable_gpio_chip.patch b/package/kernel/mac80211/patches/ath/548-ath9k_enable_gpio_chip.patch +index 78206d2860..88198a4562 100644 +--- a/package/kernel/mac80211/patches/ath/548-ath9k_enable_gpio_chip.patch ++++ b/package/kernel/mac80211/patches/ath/548-ath9k_enable_gpio_chip.patch +@@ -18,7 +18,7 @@ Signed-off-by: Felix Fietkau + + #include "common.h" + #include "debug.h" +-@@ -989,6 +990,14 @@ struct ath_led { ++@@ -990,6 +991,14 @@ struct ath_led { + struct led_classdev cdev; + }; + +@@ -33,7 +33,7 @@ Signed-off-by: Felix Fietkau + struct ath_softc { + struct ieee80211_hw *hw; + struct device *dev; +-@@ -1044,6 +1053,9 @@ struct ath_softc { ++@@ -1045,6 +1054,9 @@ struct ath_softc { + #ifdef CPTCFG_MAC80211_LEDS + const char *led_default_trigger; + struct list_head leds; +diff --git a/package/kernel/mac80211/patches/ath/549-ath9k_enable_gpio_buttons.patch b/package/kernel/mac80211/patches/ath/549-ath9k_enable_gpio_buttons.patch +index 716e09f351..83076b8ae4 100644 +--- a/package/kernel/mac80211/patches/ath/549-ath9k_enable_gpio_buttons.patch ++++ b/package/kernel/mac80211/patches/ath/549-ath9k_enable_gpio_buttons.patch +@@ -10,7 +10,7 @@ Signed-off-by: Felix Fietkau + --- + --- a/drivers/net/wireless/ath/ath9k/ath9k.h + +++ b/drivers/net/wireless/ath/ath9k/ath9k.h +-@@ -1055,6 +1055,7 @@ struct ath_softc { ++@@ -1056,6 +1056,7 @@ struct ath_softc { + struct list_head leds; + #ifdef CONFIG_GPIOLIB + struct ath9k_gpio_chip *gpiochip; +diff --git a/package/kernel/mac80211/patches/ath/551-ath9k_ubnt_uap_plus_hsr.patch b/package/kernel/mac80211/patches/ath/551-ath9k_ubnt_uap_plus_hsr.patch +index 7e3e1236f7..cd2bdbf1a0 100644 +--- a/package/kernel/mac80211/patches/ath/551-ath9k_ubnt_uap_plus_hsr.patch ++++ b/package/kernel/mac80211/patches/ath/551-ath9k_ubnt_uap_plus_hsr.patch +@@ -371,7 +371,7 @@ + + --- a/local-symbols + +++ b/local-symbols +-@@ -112,6 +112,7 @@ ATH9K_WOW= ++@@ -113,6 +113,7 @@ ATH9K_WOW= + ATH9K_RFKILL= + ATH9K_CHANNEL_CONTEXT= + ATH9K_PCOEM= +@@ -381,7 +381,7 @@ + ATH9K_HTC_DEBUGFS= + --- a/drivers/net/wireless/ath/ath9k/Kconfig + +++ b/drivers/net/wireless/ath/ath9k/Kconfig +-@@ -60,6 +60,19 @@ config ATH9K_AHB ++@@ -58,6 +58,19 @@ config ATH9K_AHB + Say Y, if you have a SoC with a compatible built-in + wireless MAC. Say N if unsure. + +diff --git a/package/kernel/mac80211/patches/ath/552-ahb_of.patch b/package/kernel/mac80211/patches/ath/552-ahb_of.patch +index 2552bbc7a1..8fd6e4409b 100644 +--- a/package/kernel/mac80211/patches/ath/552-ahb_of.patch ++++ b/package/kernel/mac80211/patches/ath/552-ahb_of.patch +@@ -325,7 +325,7 @@ + + #include "common.h" + #include "debug.h" +-@@ -1011,6 +1012,9 @@ struct ath_softc { ++@@ -1012,6 +1013,9 @@ struct ath_softc { + struct ath_hw *sc_ah; + void __iomem *mem; + int irq; +diff --git a/package/kernel/mac80211/patches/ath/560-ath9k-fix-transmitting-to-stations-in-dynamic-SMPS-m.patch b/package/kernel/mac80211/patches/ath/560-ath9k-fix-transmitting-to-stations-in-dynamic-SMPS-m.patch +deleted file mode 100644 +index 68f3a31548..0000000000 +--- a/package/kernel/mac80211/patches/ath/560-ath9k-fix-transmitting-to-stations-in-dynamic-SMPS-m.patch ++++ /dev/null +@@ -1,49 +0,0 @@ +-From: Felix Fietkau +-Date: Sun, 14 Feb 2021 19:45:50 +0100 +-Subject: [PATCH] ath9k: fix transmitting to stations in dynamic SMPS mode +- +-When transmitting to a receiver in dynamic SMPS mode, all transmissions that +-use multiple spatial streams need to be sent using CTS-to-self or RTS/CTS to +-give the receiver's extra chains some time to wake up. +-This fixes the tx rate getting stuck at <= MCS7 for some clients, especially +-Intel ones, which make aggressive use of SMPS. +- +-Cc: stable@vger.kernel.org +-Reported-by: Martin Kennedy +-Signed-off-by: Felix Fietkau +---- +- +---- a/drivers/net/wireless/ath/ath9k/ath9k.h +-+++ b/drivers/net/wireless/ath/ath9k/ath9k.h +-@@ -179,7 +179,8 @@ struct ath_frame_info { +- s8 txq; +- u8 keyix; +- u8 rtscts_rate; +-- u8 retries : 7; +-+ u8 retries : 6; +-+ u8 dyn_smps : 1; +- u8 baw_tracked : 1; +- u8 tx_power; +- enum ath9k_key_type keytype:2; +---- a/drivers/net/wireless/ath/ath9k/xmit.c +-+++ b/drivers/net/wireless/ath/ath9k/xmit.c +-@@ -1271,6 +1271,11 @@ static void ath_buf_set_rate(struct ath_ +- is_40, is_sgi, is_sp); +- if (rix < 8 && (tx_info->flags & IEEE80211_TX_CTL_STBC)) +- info->rates[i].RateFlags |= ATH9K_RATESERIES_STBC; +-+ if (rix >= 8 && fi->dyn_smps) { +-+ info->rates[i].RateFlags |= +-+ ATH9K_RATESERIES_RTS_CTS; +-+ info->flags |= ATH9K_TXDESC_CTSENA; +-+ } +- +- info->txpower[i] = ath_get_rate_txpower(sc, bf, rix, +- is_40, false); +-@@ -2114,6 +2119,7 @@ static void setup_frame_info(struct ieee +- fi->keyix = an->ps_key; +- else +- fi->keyix = ATH9K_TXKEYIX_INVALID; +-+ fi->dyn_smps = sta && sta->smps_mode == IEEE80211_SMPS_DYNAMIC; +- fi->keytype = keytype; +- fi->framelen = framelen; +- fi->tx_power = txpower; +diff --git a/package/kernel/mac80211/patches/ath/922-ath10k-increase-rx-buffer-size-to-2048.patch b/package/kernel/mac80211/patches/ath/922-ath10k-increase-rx-buffer-size-to-2048.patch +index abce361673..8f7a60eec8 100644 +--- a/package/kernel/mac80211/patches/ath/922-ath10k-increase-rx-buffer-size-to-2048.patch ++++ b/package/kernel/mac80211/patches/ath/922-ath10k-increase-rx-buffer-size-to-2048.patch +@@ -26,7 +26,7 @@ Forwarded: https://patchwork.kernel.org/patch/11367055/ + + --- a/drivers/net/wireless/ath/ath10k/htt.h + +++ b/drivers/net/wireless/ath/ath10k/htt.h +-@@ -2242,7 +2242,7 @@ struct htt_rx_chan_info { ++@@ -2243,7 +2243,7 @@ struct htt_rx_chan_info { + * Should be: sizeof(struct htt_host_rx_desc) + max rx MSDU size, + * rounded up to a cache line size. + */ +diff --git a/package/kernel/mac80211/patches/ath/930-ath10k_add_tpt_led_trigger.patch b/package/kernel/mac80211/patches/ath/930-ath10k_add_tpt_led_trigger.patch +index 1fedd337ac..74b3292e0c 100644 +--- a/package/kernel/mac80211/patches/ath/930-ath10k_add_tpt_led_trigger.patch ++++ b/package/kernel/mac80211/patches/ath/930-ath10k_add_tpt_led_trigger.patch +@@ -1,6 +1,6 @@ + --- a/drivers/net/wireless/ath/ath10k/mac.c + +++ b/drivers/net/wireless/ath/ath10k/mac.c +-@@ -9713,6 +9713,21 @@ static int ath10k_mac_init_rd(struct ath ++@@ -9708,6 +9708,21 @@ static int ath10k_mac_init_rd(struct ath + return 0; + } + +@@ -22,7 +22,7 @@ + int ath10k_mac_register(struct ath10k *ar) + { + static const u32 cipher_suites[] = { +-@@ -10062,6 +10077,12 @@ int ath10k_mac_register(struct ath10k *a ++@@ -10057,6 +10072,12 @@ int ath10k_mac_register(struct ath10k *a + + ar->hw->weight_multiplier = ATH10K_AIRTIME_WEIGHT_MULTIPLIER; + +diff --git a/package/kernel/mac80211/patches/ath/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch b/package/kernel/mac80211/patches/ath/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch +index ab7cb669bb..5e74687826 100644 +--- a/package/kernel/mac80211/patches/ath/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch ++++ b/package/kernel/mac80211/patches/ath/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch +@@ -114,7 +114,7 @@ v13: + ath10k_core-$(CONFIG_DEV_COREDUMP) += coredump.o + --- a/local-symbols + +++ b/local-symbols +-@@ -145,6 +145,7 @@ ATH10K_DEBUG= ++@@ -146,6 +146,7 @@ ATH10K_DEBUG= + ATH10K_DEBUGFS= + ATH10K_SPECTRAL= + ATH10K_THERMAL= +@@ -456,7 +456,7 @@ v13: + { + --- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c + +++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c +-@@ -4585,6 +4585,8 @@ static const struct wmi_ops wmi_tlv_ops ++@@ -4591,6 +4591,8 @@ static const struct wmi_ops wmi_tlv_ops + .gen_echo = ath10k_wmi_tlv_op_gen_echo, + .gen_vdev_spectral_conf = ath10k_wmi_tlv_op_gen_vdev_spectral_conf, + .gen_vdev_spectral_enable = ath10k_wmi_tlv_op_gen_vdev_spectral_enable, +diff --git a/package/kernel/mac80211/patches/ath/975-ath10k-use-tpt-trigger-by-default.patch b/package/kernel/mac80211/patches/ath/975-ath10k-use-tpt-trigger-by-default.patch +index f7569df33c..6da7bfa725 100644 +--- a/package/kernel/mac80211/patches/ath/975-ath10k-use-tpt-trigger-by-default.patch ++++ b/package/kernel/mac80211/patches/ath/975-ath10k-use-tpt-trigger-by-default.patch +@@ -42,7 +42,7 @@ Signed-off-by: Mathias Kresin + if (ret) + --- a/drivers/net/wireless/ath/ath10k/mac.c + +++ b/drivers/net/wireless/ath/ath10k/mac.c +-@@ -10079,7 +10079,7 @@ int ath10k_mac_register(struct ath10k *a ++@@ -10074,7 +10074,7 @@ int ath10k_mac_register(struct ath10k *a + ar->hw->weight_multiplier = ATH10K_AIRTIME_WEIGHT_MULTIPLIER; + + #ifdef CPTCFG_MAC80211_LEDS +diff --git a/package/kernel/mac80211/patches/rt2x00/602-rt2x00-introduce-rt2x00eeprom.patch b/package/kernel/mac80211/patches/rt2x00/602-rt2x00-introduce-rt2x00eeprom.patch +index e74d9a9aa0..1c52132da6 100644 +--- a/package/kernel/mac80211/patches/rt2x00/602-rt2x00-introduce-rt2x00eeprom.patch ++++ b/package/kernel/mac80211/patches/rt2x00/602-rt2x00-introduce-rt2x00eeprom.patch +@@ -1,6 +1,6 @@ + --- a/local-symbols + +++ b/local-symbols +-@@ -332,6 +332,7 @@ RT2X00_LIB_FIRMWARE= ++@@ -333,6 +333,7 @@ RT2X00_LIB_FIRMWARE= + RT2X00_LIB_CRYPTO= + RT2X00_LIB_LEDS= + RT2X00_LIB_DEBUGFS= +diff --git a/package/kernel/mac80211/patches/rtl/001-v5.12-rtlwifi-8821ae-upgrade-PHY-and-RF-parameters.patch b/package/kernel/mac80211/patches/rtl/001-v5.12-rtlwifi-8821ae-upgrade-PHY-and-RF-parameters.patch +new file mode 100644 +index 0000000000..7b6cd99d82 +--- /dev/null ++++ b/package/kernel/mac80211/patches/rtl/001-v5.12-rtlwifi-8821ae-upgrade-PHY-and-RF-parameters.patch +@@ -0,0 +1,817 @@ ++From 8f392a72419c4b10e84e635e51bee24670975364 Mon Sep 17 00:00:00 2001 ++From: Ping-Ke Shih ++Date: Fri, 19 Feb 2021 13:26:07 +0800 ++Subject: [PATCH] rtlwifi: 8821ae: upgrade PHY and RF parameters ++ ++New parameters with new format and its parser are updated by the ++commit 84d26fda52e2 ("rtlwifi: Update 8821ae new phy parameters and its parser."), ++but some parameters are missing. Use this commit to update to the novel ++parameters that use new format. ++ ++Fixes: 84d26fda52e2 ("rtlwifi: Update 8821ae new phy parameters and its parser") ++Signed-off-by: Ping-Ke Shih ++Tested-by: Kai-Heng Feng ++--- ++ .../realtek/rtlwifi/rtl8821ae/table.c | 500 +++++++++++++----- ++ 1 file changed, 370 insertions(+), 130 deletions(-) ++ ++--- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/table.c +++++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/table.c ++@@ -249,7 +249,7 @@ u32 RTL8821AE_PHY_REG_ARRAY[] = { ++ 0x824, 0x00030FE0, ++ 0x828, 0x00000000, ++ 0x82C, 0x002081DD, ++- 0x830, 0x2AAA8E24, +++ 0x830, 0x2AAAEEC8, ++ 0x834, 0x0037A706, ++ 0x838, 0x06489B44, ++ 0x83C, 0x0000095B, ++@@ -324,10 +324,10 @@ u32 RTL8821AE_PHY_REG_ARRAY[] = { ++ 0x9D8, 0x00000000, ++ 0x9DC, 0x00000000, ++ 0x9E0, 0x00005D00, ++- 0x9E4, 0x00000002, +++ 0x9E4, 0x00000003, ++ 0x9E8, 0x00000001, ++ 0xA00, 0x00D047C8, ++- 0xA04, 0x01FF000C, +++ 0xA04, 0x01FF800C, ++ 0xA08, 0x8C8A8300, ++ 0xA0C, 0x2E68000F, ++ 0xA10, 0x9500BB78, ++@@ -1320,7 +1320,11 @@ u32 RTL8821AE_RADIOA_ARRAY[] = { ++ 0x083, 0x00021800, ++ 0x084, 0x00028000, ++ 0x085, 0x00048000, +++ 0x80000111, 0x00000000, 0x40000000, 0x00000000, +++ 0x086, 0x0009483A, +++ 0xA0000000, 0x00000000, ++ 0x086, 0x00094838, +++ 0xB0000000, 0x00000000, ++ 0x087, 0x00044980, ++ 0x088, 0x00048000, ++ 0x089, 0x0000D480, ++@@ -1409,36 +1413,32 @@ u32 RTL8821AE_RADIOA_ARRAY[] = { ++ 0x03C, 0x000CA000, ++ 0x0EF, 0x00000000, ++ 0x0EF, 0x00001100, ++- 0xFF0F0104, 0xABCD, +++ 0x80000111, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x0004ADF3, ++ 0x034, 0x00049DF0, ++- 0xFF0F0204, 0xCDEF, +++ 0x90000110, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x0004ADF3, ++ 0x034, 0x00049DF0, ++- 0xFF0F0404, 0xCDEF, ++- 0x034, 0x0004ADF3, ++- 0x034, 0x00049DF0, ++- 0xFF0F0200, 0xCDEF, +++ 0x90000210, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x0004ADF5, ++ 0x034, 0x00049DF2, ++- 0xFF0F02C0, 0xCDEF, +++ 0x9000020c, 0x00000000, 0x40000000, 0x00000000, +++ 0x034, 0x0004A0F3, +++ 0x034, 0x000490B1, +++ 0x9000040c, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x0004A0F3, ++ 0x034, 0x000490B1, ++- 0xCDCDCDCD, 0xCDCD, +++ 0x90000200, 0x00000000, 0x40000000, 0x00000000, +++ 0x034, 0x0004ADF5, +++ 0x034, 0x00049DF2, +++ 0x90000410, 0x00000000, 0x40000000, 0x00000000, +++ 0x034, 0x0004ADF3, +++ 0x034, 0x00049DF0, +++ 0xA0000000, 0x00000000, ++ 0x034, 0x0004ADF7, ++ 0x034, 0x00049DF3, ++- 0xFF0F0104, 0xDEAD, ++- 0xFF0F0104, 0xABCD, ++- 0x034, 0x00048DED, ++- 0x034, 0x00047DEA, ++- 0x034, 0x00046DE7, ++- 0x034, 0x00045CE9, ++- 0x034, 0x00044CE6, ++- 0x034, 0x000438C6, ++- 0x034, 0x00042886, ++- 0x034, 0x00041486, ++- 0x034, 0x00040447, ++- 0xFF0F0204, 0xCDEF, +++ 0xB0000000, 0x00000000, +++ 0x80000111, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x00048DED, ++ 0x034, 0x00047DEA, ++ 0x034, 0x00046DE7, ++@@ -1448,7 +1448,7 @@ u32 RTL8821AE_RADIOA_ARRAY[] = { ++ 0x034, 0x00042886, ++ 0x034, 0x00041486, ++ 0x034, 0x00040447, ++- 0xFF0F0404, 0xCDEF, +++ 0x90000110, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x00048DED, ++ 0x034, 0x00047DEA, ++ 0x034, 0x00046DE7, ++@@ -1458,7 +1458,17 @@ u32 RTL8821AE_RADIOA_ARRAY[] = { ++ 0x034, 0x00042886, ++ 0x034, 0x00041486, ++ 0x034, 0x00040447, ++- 0xFF0F02C0, 0xCDEF, +++ 0x9000020c, 0x00000000, 0x40000000, 0x00000000, +++ 0x034, 0x000480AE, +++ 0x034, 0x000470AB, +++ 0x034, 0x0004608B, +++ 0x034, 0x00045069, +++ 0x034, 0x00044048, +++ 0x034, 0x00043045, +++ 0x034, 0x00042026, +++ 0x034, 0x00041023, +++ 0x034, 0x00040002, +++ 0x9000040c, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x000480AE, ++ 0x034, 0x000470AB, ++ 0x034, 0x0004608B, ++@@ -1468,7 +1478,17 @@ u32 RTL8821AE_RADIOA_ARRAY[] = { ++ 0x034, 0x00042026, ++ 0x034, 0x00041023, ++ 0x034, 0x00040002, ++- 0xCDCDCDCD, 0xCDCD, +++ 0x90000410, 0x00000000, 0x40000000, 0x00000000, +++ 0x034, 0x00048DED, +++ 0x034, 0x00047DEA, +++ 0x034, 0x00046DE7, +++ 0x034, 0x00045CE9, +++ 0x034, 0x00044CE6, +++ 0x034, 0x000438C6, +++ 0x034, 0x00042886, +++ 0x034, 0x00041486, +++ 0x034, 0x00040447, +++ 0xA0000000, 0x00000000, ++ 0x034, 0x00048DEF, ++ 0x034, 0x00047DEC, ++ 0x034, 0x00046DE9, ++@@ -1478,38 +1498,36 @@ u32 RTL8821AE_RADIOA_ARRAY[] = { ++ 0x034, 0x0004248A, ++ 0x034, 0x0004108D, ++ 0x034, 0x0004008A, ++- 0xFF0F0104, 0xDEAD, ++- 0xFF0F0200, 0xABCD, +++ 0xB0000000, 0x00000000, +++ 0x80000210, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x0002ADF4, ++- 0xFF0F02C0, 0xCDEF, +++ 0x9000020c, 0x00000000, 0x40000000, 0x00000000, +++ 0x034, 0x0002A0F3, +++ 0x9000040c, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x0002A0F3, ++- 0xCDCDCDCD, 0xCDCD, +++ 0x90000200, 0x00000000, 0x40000000, 0x00000000, +++ 0x034, 0x0002ADF4, +++ 0xA0000000, 0x00000000, ++ 0x034, 0x0002ADF7, ++- 0xFF0F0200, 0xDEAD, ++- 0xFF0F0104, 0xABCD, ++- 0x034, 0x00029DF4, ++- 0xFF0F0204, 0xCDEF, +++ 0xB0000000, 0x00000000, +++ 0x80000111, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x00029DF4, ++- 0xFF0F0404, 0xCDEF, +++ 0x90000110, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x00029DF4, ++- 0xFF0F0200, 0xCDEF, +++ 0x90000210, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x00029DF1, ++- 0xFF0F02C0, 0xCDEF, +++ 0x9000020c, 0x00000000, 0x40000000, 0x00000000, +++ 0x034, 0x000290F0, +++ 0x9000040c, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x000290F0, ++- 0xCDCDCDCD, 0xCDCD, +++ 0x90000200, 0x00000000, 0x40000000, 0x00000000, +++ 0x034, 0x00029DF1, +++ 0x90000410, 0x00000000, 0x40000000, 0x00000000, +++ 0x034, 0x00029DF4, +++ 0xA0000000, 0x00000000, ++ 0x034, 0x00029DF2, ++- 0xFF0F0104, 0xDEAD, ++- 0xFF0F0104, 0xABCD, ++- 0x034, 0x00028DF1, ++- 0x034, 0x00027DEE, ++- 0x034, 0x00026DEB, ++- 0x034, 0x00025CEC, ++- 0x034, 0x00024CE9, ++- 0x034, 0x000238CA, ++- 0x034, 0x00022889, ++- 0x034, 0x00021489, ++- 0x034, 0x0002044A, ++- 0xFF0F0204, 0xCDEF, +++ 0xB0000000, 0x00000000, +++ 0x80000111, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x00028DF1, ++ 0x034, 0x00027DEE, ++ 0x034, 0x00026DEB, ++@@ -1519,7 +1537,7 @@ u32 RTL8821AE_RADIOA_ARRAY[] = { ++ 0x034, 0x00022889, ++ 0x034, 0x00021489, ++ 0x034, 0x0002044A, ++- 0xFF0F0404, 0xCDEF, +++ 0x90000110, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x00028DF1, ++ 0x034, 0x00027DEE, ++ 0x034, 0x00026DEB, ++@@ -1529,7 +1547,7 @@ u32 RTL8821AE_RADIOA_ARRAY[] = { ++ 0x034, 0x00022889, ++ 0x034, 0x00021489, ++ 0x034, 0x0002044A, ++- 0xFF0F02C0, 0xCDEF, +++ 0x9000020c, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x000280AF, ++ 0x034, 0x000270AC, ++ 0x034, 0x0002608B, ++@@ -1539,7 +1557,27 @@ u32 RTL8821AE_RADIOA_ARRAY[] = { ++ 0x034, 0x00022026, ++ 0x034, 0x00021023, ++ 0x034, 0x00020002, ++- 0xCDCDCDCD, 0xCDCD, +++ 0x9000040c, 0x00000000, 0x40000000, 0x00000000, +++ 0x034, 0x000280AF, +++ 0x034, 0x000270AC, +++ 0x034, 0x0002608B, +++ 0x034, 0x00025069, +++ 0x034, 0x00024048, +++ 0x034, 0x00023045, +++ 0x034, 0x00022026, +++ 0x034, 0x00021023, +++ 0x034, 0x00020002, +++ 0x90000410, 0x00000000, 0x40000000, 0x00000000, +++ 0x034, 0x00028DF1, +++ 0x034, 0x00027DEE, +++ 0x034, 0x00026DEB, +++ 0x034, 0x00025CEC, +++ 0x034, 0x00024CE9, +++ 0x034, 0x000238CA, +++ 0x034, 0x00022889, +++ 0x034, 0x00021489, +++ 0x034, 0x0002044A, +++ 0xA0000000, 0x00000000, ++ 0x034, 0x00028DEE, ++ 0x034, 0x00027DEB, ++ 0x034, 0x00026CCD, ++@@ -1549,27 +1587,24 @@ u32 RTL8821AE_RADIOA_ARRAY[] = { ++ 0x034, 0x00022849, ++ 0x034, 0x00021449, ++ 0x034, 0x0002004D, ++- 0xFF0F0104, 0xDEAD, ++- 0xFF0F02C0, 0xABCD, +++ 0xB0000000, 0x00000000, +++ 0x8000020c, 0x00000000, 0x40000000, 0x00000000, +++ 0x034, 0x0000A0D7, +++ 0x034, 0x000090D3, +++ 0x034, 0x000080B1, +++ 0x034, 0x000070AE, +++ 0x9000040c, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x0000A0D7, ++ 0x034, 0x000090D3, ++ 0x034, 0x000080B1, ++ 0x034, 0x000070AE, ++- 0xCDCDCDCD, 0xCDCD, +++ 0xA0000000, 0x00000000, ++ 0x034, 0x0000ADF7, ++ 0x034, 0x00009DF4, ++ 0x034, 0x00008DF1, ++ 0x034, 0x00007DEE, ++- 0xFF0F02C0, 0xDEAD, ++- 0xFF0F0104, 0xABCD, ++- 0x034, 0x00006DEB, ++- 0x034, 0x00005CEC, ++- 0x034, 0x00004CE9, ++- 0x034, 0x000038CA, ++- 0x034, 0x00002889, ++- 0x034, 0x00001489, ++- 0x034, 0x0000044A, ++- 0xFF0F0204, 0xCDEF, +++ 0xB0000000, 0x00000000, +++ 0x80000111, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x00006DEB, ++ 0x034, 0x00005CEC, ++ 0x034, 0x00004CE9, ++@@ -1577,7 +1612,7 @@ u32 RTL8821AE_RADIOA_ARRAY[] = { ++ 0x034, 0x00002889, ++ 0x034, 0x00001489, ++ 0x034, 0x0000044A, ++- 0xFF0F0404, 0xCDEF, +++ 0x90000110, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x00006DEB, ++ 0x034, 0x00005CEC, ++ 0x034, 0x00004CE9, ++@@ -1585,7 +1620,7 @@ u32 RTL8821AE_RADIOA_ARRAY[] = { ++ 0x034, 0x00002889, ++ 0x034, 0x00001489, ++ 0x034, 0x0000044A, ++- 0xFF0F02C0, 0xCDEF, +++ 0x9000020c, 0x00000000, 0x40000000, 0x00000000, ++ 0x034, 0x0000608D, ++ 0x034, 0x0000506B, ++ 0x034, 0x0000404A, ++@@ -1593,7 +1628,23 @@ u32 RTL8821AE_RADIOA_ARRAY[] = { ++ 0x034, 0x00002044, ++ 0x034, 0x00001025, ++ 0x034, 0x00000004, ++- 0xCDCDCDCD, 0xCDCD, +++ 0x9000040c, 0x00000000, 0x40000000, 0x00000000, +++ 0x034, 0x0000608D, +++ 0x034, 0x0000506B, +++ 0x034, 0x0000404A, +++ 0x034, 0x00003047, +++ 0x034, 0x00002044, +++ 0x034, 0x00001025, +++ 0x034, 0x00000004, +++ 0x90000410, 0x00000000, 0x40000000, 0x00000000, +++ 0x034, 0x00006DEB, +++ 0x034, 0x00005CEC, +++ 0x034, 0x00004CE9, +++ 0x034, 0x000038CA, +++ 0x034, 0x00002889, +++ 0x034, 0x00001489, +++ 0x034, 0x0000044A, +++ 0xA0000000, 0x00000000, ++ 0x034, 0x00006DCD, ++ 0x034, 0x00005CCD, ++ 0x034, 0x00004CCA, ++@@ -1601,11 +1652,11 @@ u32 RTL8821AE_RADIOA_ARRAY[] = { ++ 0x034, 0x00002888, ++ 0x034, 0x00001488, ++ 0x034, 0x00000486, ++- 0xFF0F0104, 0xDEAD, +++ 0xB0000000, 0x00000000, ++ 0x0EF, 0x00000000, ++ 0x018, 0x0001712A, ++ 0x0EF, 0x00000040, ++- 0xFF0F0104, 0xABCD, +++ 0x80000111, 0x00000000, 0x40000000, 0x00000000, ++ 0x035, 0x00000187, ++ 0x035, 0x00008187, ++ 0x035, 0x00010187, ++@@ -1615,7 +1666,7 @@ u32 RTL8821AE_RADIOA_ARRAY[] = { ++ 0x035, 0x00040188, ++ 0x035, 0x00048188, ++ 0x035, 0x00050188, ++- 0xFF0F0204, 0xCDEF, +++ 0x90000110, 0x00000000, 0x40000000, 0x00000000, ++ 0x035, 0x00000187, ++ 0x035, 0x00008187, ++ 0x035, 0x00010187, ++@@ -1625,7 +1676,37 @@ u32 RTL8821AE_RADIOA_ARRAY[] = { ++ 0x035, 0x00040188, ++ 0x035, 0x00048188, ++ 0x035, 0x00050188, ++- 0xFF0F0404, 0xCDEF, +++ 0x90000210, 0x00000000, 0x40000000, 0x00000000, +++ 0x035, 0x00000128, +++ 0x035, 0x00008128, +++ 0x035, 0x00010128, +++ 0x035, 0x000201C8, +++ 0x035, 0x000281C8, +++ 0x035, 0x000301C8, +++ 0x035, 0x000401C8, +++ 0x035, 0x000481C8, +++ 0x035, 0x000501C8, +++ 0x9000040c, 0x00000000, 0x40000000, 0x00000000, +++ 0x035, 0x00000145, +++ 0x035, 0x00008145, +++ 0x035, 0x00010145, +++ 0x035, 0x00020196, +++ 0x035, 0x00028196, +++ 0x035, 0x00030196, +++ 0x035, 0x000401C7, +++ 0x035, 0x000481C7, +++ 0x035, 0x000501C7, +++ 0x90000200, 0x00000000, 0x40000000, 0x00000000, +++ 0x035, 0x00000128, +++ 0x035, 0x00008128, +++ 0x035, 0x00010128, +++ 0x035, 0x000201C8, +++ 0x035, 0x000281C8, +++ 0x035, 0x000301C8, +++ 0x035, 0x000401C8, +++ 0x035, 0x000481C8, +++ 0x035, 0x000501C8, +++ 0x90000410, 0x00000000, 0x40000000, 0x00000000, ++ 0x035, 0x00000187, ++ 0x035, 0x00008187, ++ 0x035, 0x00010187, ++@@ -1635,7 +1716,7 @@ u32 RTL8821AE_RADIOA_ARRAY[] = { ++ 0x035, 0x00040188, ++ 0x035, 0x00048188, ++ 0x035, 0x00050188, ++- 0xCDCDCDCD, 0xCDCD, +++ 0xA0000000, 0x00000000, ++ 0x035, 0x00000145, ++ 0x035, 0x00008145, ++ 0x035, 0x00010145, ++@@ -1645,11 +1726,11 @@ u32 RTL8821AE_RADIOA_ARRAY[] = { ++ 0x035, 0x000401C7, ++ 0x035, 0x000481C7, ++ 0x035, 0x000501C7, ++- 0xFF0F0104, 0xDEAD, +++ 0xB0000000, 0x00000000, ++ 0x0EF, 0x00000000, ++ 0x018, 0x0001712A, ++ 0x0EF, 0x00000010, ++- 0xFF0F0104, 0xABCD, +++ 0x80000111, 0x00000000, 0x40000000, 0x00000000, ++ 0x036, 0x00085733, ++ 0x036, 0x0008D733, ++ 0x036, 0x00095733, ++@@ -1662,7 +1743,7 @@ u32 RTL8821AE_RADIOA_ARRAY[] = { ++ 0x036, 0x000CE4B4, ++ 0x036, 0x000D64B4, ++ 0x036, 0x000DE4B4, ++- 0xFF0F0204, 0xCDEF, +++ 0x90000110, 0x00000000, 0x40000000, 0x00000000, ++ 0x036, 0x00085733, ++ 0x036, 0x0008D733, ++ 0x036, 0x00095733, ++@@ -1675,7 +1756,46 @@ u32 RTL8821AE_RADIOA_ARRAY[] = { ++ 0x036, 0x000CE4B4, ++ 0x036, 0x000D64B4, ++ 0x036, 0x000DE4B4, ++- 0xFF0F0404, 0xCDEF, +++ 0x90000210, 0x00000000, 0x40000000, 0x00000000, +++ 0x036, 0x000063B5, +++ 0x036, 0x0000E3B5, +++ 0x036, 0x000163B5, +++ 0x036, 0x0001E3B5, +++ 0x036, 0x000263B5, +++ 0x036, 0x0002E3B5, +++ 0x036, 0x000363B5, +++ 0x036, 0x0003E3B5, +++ 0x036, 0x000463B5, +++ 0x036, 0x0004E3B5, +++ 0x036, 0x000563B5, +++ 0x036, 0x0005E3B5, +++ 0x9000040c, 0x00000000, 0x40000000, 0x00000000, +++ 0x036, 0x000056B3, +++ 0x036, 0x0000D6B3, +++ 0x036, 0x000156B3, +++ 0x036, 0x0001D6B3, +++ 0x036, 0x00026634, +++ 0x036, 0x0002E634, +++ 0x036, 0x00036634, +++ 0x036, 0x0003E634, +++ 0x036, 0x000467B4, +++ 0x036, 0x0004E7B4, +++ 0x036, 0x000567B4, +++ 0x036, 0x0005E7B4, +++ 0x90000200, 0x00000000, 0x40000000, 0x00000000, +++ 0x036, 0x000063B5, +++ 0x036, 0x0000E3B5, +++ 0x036, 0x000163B5, +++ 0x036, 0x0001E3B5, +++ 0x036, 0x000263B5, +++ 0x036, 0x0002E3B5, +++ 0x036, 0x000363B5, +++ 0x036, 0x0003E3B5, +++ 0x036, 0x000463B5, +++ 0x036, 0x0004E3B5, +++ 0x036, 0x000563B5, +++ 0x036, 0x0005E3B5, +++ 0x90000410, 0x00000000, 0x40000000, 0x00000000, ++ 0x036, 0x00085733, ++ 0x036, 0x0008D733, ++ 0x036, 0x00095733, ++@@ -1688,7 +1808,7 @@ u32 RTL8821AE_RADIOA_ARRAY[] = { ++ 0x036, 0x000CE4B4, ++ 0x036, 0x000D64B4, ++ 0x036, 0x000DE4B4, ++- 0xCDCDCDCD, 0xCDCD, +++ 0xA0000000, 0x00000000, ++ 0x036, 0x000056B3, ++ 0x036, 0x0000D6B3, ++ 0x036, 0x000156B3, ++@@ -1701,103 +1821,162 @@ u32 RTL8821AE_RADIOA_ARRAY[] = { ++ 0x036, 0x0004E7B4, ++ 0x036, 0x000567B4, ++ 0x036, 0x0005E7B4, ++- 0xFF0F0104, 0xDEAD, +++ 0xB0000000, 0x00000000, ++ 0x0EF, 0x00000000, ++ 0x0EF, 0x00000008, ++- 0xFF0F0104, 0xABCD, +++ 0x80000111, 0x00000000, 0x40000000, 0x00000000, ++ 0x03C, 0x000001C8, ++ 0x03C, 0x00000492, ++- 0xFF0F0204, 0xCDEF, +++ 0x90000110, 0x00000000, 0x40000000, 0x00000000, ++ 0x03C, 0x000001C8, ++ 0x03C, 0x00000492, ++- 0xFF0F0404, 0xCDEF, +++ 0x90000210, 0x00000000, 0x40000000, 0x00000000, +++ 0x03C, 0x000001B6, +++ 0x03C, 0x00000492, +++ 0x9000040c, 0x00000000, 0x40000000, 0x00000000, +++ 0x03C, 0x0000022A, +++ 0x03C, 0x00000594, +++ 0x90000200, 0x00000000, 0x40000000, 0x00000000, +++ 0x03C, 0x000001B6, +++ 0x03C, 0x00000492, +++ 0x90000410, 0x00000000, 0x40000000, 0x00000000, ++ 0x03C, 0x000001C8, ++ 0x03C, 0x00000492, ++- 0xCDCDCDCD, 0xCDCD, +++ 0xA0000000, 0x00000000, ++ 0x03C, 0x0000022A, ++ 0x03C, 0x00000594, ++- 0xFF0F0104, 0xDEAD, ++- 0xFF0F0104, 0xABCD, +++ 0xB0000000, 0x00000000, +++ 0x80000111, 0x00000000, 0x40000000, 0x00000000, ++ 0x03C, 0x00000800, ++- 0xFF0F0204, 0xCDEF, +++ 0x90000110, 0x00000000, 0x40000000, 0x00000000, ++ 0x03C, 0x00000800, ++- 0xFF0F0404, 0xCDEF, +++ 0x90000210, 0x00000000, 0x40000000, 0x00000000, ++ 0x03C, 0x00000800, ++- 0xFF0F02C0, 0xCDEF, +++ 0x9000020c, 0x00000000, 0x40000000, 0x00000000, ++ 0x03C, 0x00000820, ++- 0xCDCDCDCD, 0xCDCD, +++ 0x9000040c, 0x00000000, 0x40000000, 0x00000000, +++ 0x03C, 0x00000820, +++ 0x90000200, 0x00000000, 0x40000000, 0x00000000, +++ 0x03C, 0x00000800, +++ 0x90000410, 0x00000000, 0x40000000, 0x00000000, +++ 0x03C, 0x00000800, +++ 0xA0000000, 0x00000000, ++ 0x03C, 0x00000900, ++- 0xFF0F0104, 0xDEAD, +++ 0xB0000000, 0x00000000, ++ 0x0EF, 0x00000000, ++ 0x018, 0x0001712A, ++ 0x0EF, 0x00000002, ++- 0xFF0F0104, 0xABCD, +++ 0x80000111, 0x00000000, 0x40000000, 0x00000000, ++ 0x008, 0x0004E400, ++- 0xFF0F0204, 0xCDEF, +++ 0x90000110, 0x00000000, 0x40000000, 0x00000000, ++ 0x008, 0x0004E400, ++- 0xFF0F0404, 0xCDEF, +++ 0x90000210, 0x00000000, 0x40000000, 0x00000000, +++ 0x008, 0x00002000, +++ 0x9000020c, 0x00000000, 0x40000000, 0x00000000, +++ 0x008, 0x00002000, +++ 0x9000040c, 0x00000000, 0x40000000, 0x00000000, +++ 0x008, 0x00002000, +++ 0x90000200, 0x00000000, 0x40000000, 0x00000000, +++ 0x008, 0x00002000, +++ 0x90000410, 0x00000000, 0x40000000, 0x00000000, ++ 0x008, 0x0004E400, ++- 0xCDCDCDCD, 0xCDCD, +++ 0xA0000000, 0x00000000, ++ 0x008, 0x00002000, ++- 0xFF0F0104, 0xDEAD, +++ 0xB0000000, 0x00000000, ++ 0x0EF, 0x00000000, ++ 0x0DF, 0x000000C0, ++- 0x01F, 0x00040064, ++- 0xFF0F0104, 0xABCD, +++ 0x01F, 0x00000064, +++ 0x80000111, 0x00000000, 0x40000000, 0x00000000, ++ 0x058, 0x000A7284, ++ 0x059, 0x000600EC, ++- 0xFF0F0204, 0xCDEF, +++ 0x90000110, 0x00000000, 0x40000000, 0x00000000, ++ 0x058, 0x000A7284, ++ 0x059, 0x000600EC, ++- 0xFF0F0404, 0xCDEF, +++ 0x9000020c, 0x00000000, 0x40000000, 0x00000000, +++ 0x058, 0x00081184, +++ 0x059, 0x0006016C, +++ 0x9000040c, 0x00000000, 0x40000000, 0x00000000, +++ 0x058, 0x00081184, +++ 0x059, 0x0006016C, +++ 0x90000200, 0x00000000, 0x40000000, 0x00000000, +++ 0x058, 0x00081184, +++ 0x059, 0x0006016C, +++ 0x90000410, 0x00000000, 0x40000000, 0x00000000, ++ 0x058, 0x000A7284, ++ 0x059, 0x000600EC, ++- 0xCDCDCDCD, 0xCDCD, +++ 0xA0000000, 0x00000000, ++ 0x058, 0x00081184, ++ 0x059, 0x0006016C, ++- 0xFF0F0104, 0xDEAD, ++- 0xFF0F0104, 0xABCD, +++ 0xB0000000, 0x00000000, +++ 0x80000111, 0x00000000, 0x40000000, 0x00000000, ++ 0x061, 0x000E8D73, ++ 0x062, 0x00093FC5, ++- 0xFF0F0204, 0xCDEF, +++ 0x90000110, 0x00000000, 0x40000000, 0x00000000, ++ 0x061, 0x000E8D73, ++ 0x062, 0x00093FC5, ++- 0xFF0F0404, 0xCDEF, +++ 0x90000210, 0x00000000, 0x40000000, 0x00000000, +++ 0x061, 0x000EFD83, +++ 0x062, 0x00093FCC, +++ 0x9000040c, 0x00000000, 0x40000000, 0x00000000, +++ 0x061, 0x000EAD53, +++ 0x062, 0x00093BC4, +++ 0x90000200, 0x00000000, 0x40000000, 0x00000000, +++ 0x061, 0x000EFD83, +++ 0x062, 0x00093FCC, +++ 0x90000410, 0x00000000, 0x40000000, 0x00000000, ++ 0x061, 0x000E8D73, ++ 0x062, 0x00093FC5, ++- 0xCDCDCDCD, 0xCDCD, +++ 0xA0000000, 0x00000000, ++ 0x061, 0x000EAD53, ++ 0x062, 0x00093BC4, ++- 0xFF0F0104, 0xDEAD, ++- 0xFF0F0104, 0xABCD, +++ 0xB0000000, 0x00000000, +++ 0x80000111, 0x00000000, 0x40000000, 0x00000000, ++ 0x063, 0x000110E9, ++- 0xFF0F0204, 0xCDEF, +++ 0x90000110, 0x00000000, 0x40000000, 0x00000000, ++ 0x063, 0x000110E9, ++- 0xFF0F0404, 0xCDEF, +++ 0x90000210, 0x00000000, 0x40000000, 0x00000000, +++ 0x063, 0x000110EB, +++ 0x9000020c, 0x00000000, 0x40000000, 0x00000000, ++ 0x063, 0x000110E9, ++- 0xFF0F0200, 0xCDEF, ++- 0x063, 0x000710E9, ++- 0xFF0F02C0, 0xCDEF, +++ 0x9000040c, 0x00000000, 0x40000000, 0x00000000, ++ 0x063, 0x000110E9, ++- 0xCDCDCDCD, 0xCDCD, +++ 0x90000200, 0x00000000, 0x40000000, 0x00000000, +++ 0x063, 0x000110EB, +++ 0x90000410, 0x00000000, 0x40000000, 0x00000000, +++ 0x063, 0x000110E9, +++ 0xA0000000, 0x00000000, ++ 0x063, 0x000714E9, ++- 0xFF0F0104, 0xDEAD, ++- 0xFF0F0104, 0xABCD, +++ 0xB0000000, 0x00000000, +++ 0x80000111, 0x00000000, 0x40000000, 0x00000000, +++ 0x064, 0x0001C27C, +++ 0x90000110, 0x00000000, 0x40000000, 0x00000000, +++ 0x064, 0x0001C27C, +++ 0x90000210, 0x00000000, 0x40000000, 0x00000000, ++ 0x064, 0x0001C27C, ++- 0xFF0F0204, 0xCDEF, +++ 0x9000040c, 0x00000000, 0x40000000, 0x00000000, +++ 0x064, 0x0001C67C, +++ 0x90000200, 0x00000000, 0x40000000, 0x00000000, ++ 0x064, 0x0001C27C, ++- 0xFF0F0404, 0xCDEF, +++ 0x90000410, 0x00000000, 0x40000000, 0x00000000, ++ 0x064, 0x0001C27C, ++- 0xCDCDCDCD, 0xCDCD, +++ 0xA0000000, 0x00000000, ++ 0x064, 0x0001C67C, ++- 0xFF0F0104, 0xDEAD, ++- 0xFF0F0200, 0xABCD, +++ 0xB0000000, 0x00000000, +++ 0x80000111, 0x00000000, 0x40000000, 0x00000000, +++ 0x065, 0x00091016, +++ 0x90000110, 0x00000000, 0x40000000, 0x00000000, +++ 0x065, 0x00091016, +++ 0x90000210, 0x00000000, 0x40000000, 0x00000000, ++ 0x065, 0x00093016, ++- 0xFF0F02C0, 0xCDEF, +++ 0x9000020c, 0x00000000, 0x40000000, 0x00000000, ++ 0x065, 0x00093015, ++- 0xCDCDCDCD, 0xCDCD, +++ 0x9000040c, 0x00000000, 0x40000000, 0x00000000, +++ 0x065, 0x00093015, +++ 0x90000200, 0x00000000, 0x40000000, 0x00000000, +++ 0x065, 0x00093016, +++ 0xA0000000, 0x00000000, ++ 0x065, 0x00091016, ++- 0xFF0F0200, 0xDEAD, +++ 0xB0000000, 0x00000000, ++ 0x018, 0x00000006, ++ 0x0EF, 0x00002000, ++ 0x03B, 0x0003824B, ++@@ -1895,9 +2074,10 @@ u32 RTL8821AE_RADIOA_ARRAY[] = { ++ 0x0B4, 0x0001214C, ++ 0x0B7, 0x0003000C, ++ 0x01C, 0x000539D2, +++ 0x0C4, 0x000AFE00, ++ 0x018, 0x0001F12A, ++- 0x0FE, 0x00000000, ++- 0x0FE, 0x00000000, +++ 0xFFE, 0x00000000, +++ 0xFFE, 0x00000000, ++ 0x018, 0x0001712A, ++ ++ }; ++@@ -2017,6 +2197,7 @@ u32 RTL8812AE_MAC_REG_ARRAY[] = { ++ u32 RTL8812AE_MAC_1T_ARRAYLEN = ARRAY_SIZE(RTL8812AE_MAC_REG_ARRAY); ++ ++ u32 RTL8821AE_MAC_REG_ARRAY[] = { +++ 0x421, 0x0000000F, ++ 0x428, 0x0000000A, ++ 0x429, 0x00000010, ++ 0x430, 0x00000000, ++@@ -2485,7 +2666,7 @@ u32 RTL8821AE_AGC_TAB_ARRAY[] = { ++ 0x81C, 0xA6360001, ++ 0x81C, 0xA5380001, ++ 0x81C, 0xA43A0001, ++- 0x81C, 0xA33C0001, +++ 0x81C, 0x683C0001, ++ 0x81C, 0x673E0001, ++ 0x81C, 0x66400001, ++ 0x81C, 0x65420001, ++@@ -2519,7 +2700,66 @@ u32 RTL8821AE_AGC_TAB_ARRAY[] = { ++ 0x81C, 0x017A0001, ++ 0x81C, 0x017C0001, ++ 0x81C, 0x017E0001, ++- 0xFF0F02C0, 0xABCD, +++ 0x8000020c, 0x00000000, 0x40000000, 0x00000000, +++ 0x81C, 0xFB000101, +++ 0x81C, 0xFA020101, +++ 0x81C, 0xF9040101, +++ 0x81C, 0xF8060101, +++ 0x81C, 0xF7080101, +++ 0x81C, 0xF60A0101, +++ 0x81C, 0xF50C0101, +++ 0x81C, 0xF40E0101, +++ 0x81C, 0xF3100101, +++ 0x81C, 0xF2120101, +++ 0x81C, 0xF1140101, +++ 0x81C, 0xF0160101, +++ 0x81C, 0xEF180101, +++ 0x81C, 0xEE1A0101, +++ 0x81C, 0xED1C0101, +++ 0x81C, 0xEC1E0101, +++ 0x81C, 0xEB200101, +++ 0x81C, 0xEA220101, +++ 0x81C, 0xE9240101, +++ 0x81C, 0xE8260101, +++ 0x81C, 0xE7280101, +++ 0x81C, 0xE62A0101, +++ 0x81C, 0xE52C0101, +++ 0x81C, 0xE42E0101, +++ 0x81C, 0xE3300101, +++ 0x81C, 0xA5320101, +++ 0x81C, 0xA4340101, +++ 0x81C, 0xA3360101, +++ 0x81C, 0x87380101, +++ 0x81C, 0x863A0101, +++ 0x81C, 0x853C0101, +++ 0x81C, 0x843E0101, +++ 0x81C, 0x69400101, +++ 0x81C, 0x68420101, +++ 0x81C, 0x67440101, +++ 0x81C, 0x66460101, +++ 0x81C, 0x49480101, +++ 0x81C, 0x484A0101, +++ 0x81C, 0x474C0101, +++ 0x81C, 0x2A4E0101, +++ 0x81C, 0x29500101, +++ 0x81C, 0x28520101, +++ 0x81C, 0x27540101, +++ 0x81C, 0x26560101, +++ 0x81C, 0x25580101, +++ 0x81C, 0x245A0101, +++ 0x81C, 0x235C0101, +++ 0x81C, 0x055E0101, +++ 0x81C, 0x04600101, +++ 0x81C, 0x03620101, +++ 0x81C, 0x02640101, +++ 0x81C, 0x01660101, +++ 0x81C, 0x01680101, +++ 0x81C, 0x016A0101, +++ 0x81C, 0x016C0101, +++ 0x81C, 0x016E0101, +++ 0x81C, 0x01700101, +++ 0x81C, 0x01720101, +++ 0x9000040c, 0x00000000, 0x40000000, 0x00000000, ++ 0x81C, 0xFB000101, ++ 0x81C, 0xFA020101, ++ 0x81C, 0xF9040101, ++@@ -2578,7 +2818,7 @@ u32 RTL8821AE_AGC_TAB_ARRAY[] = { ++ 0x81C, 0x016E0101, ++ 0x81C, 0x01700101, ++ 0x81C, 0x01720101, ++- 0xCDCDCDCD, 0xCDCD, +++ 0xA0000000, 0x00000000, ++ 0x81C, 0xFF000101, ++ 0x81C, 0xFF020101, ++ 0x81C, 0xFE040101, ++@@ -2637,7 +2877,7 @@ u32 RTL8821AE_AGC_TAB_ARRAY[] = { ++ 0x81C, 0x046E0101, ++ 0x81C, 0x03700101, ++ 0x81C, 0x02720101, ++- 0xFF0F02C0, 0xDEAD, +++ 0xB0000000, 0x00000000, ++ 0x81C, 0x01740101, ++ 0x81C, 0x01760101, ++ 0x81C, 0x01780101, +diff --git a/package/kernel/mac80211/patches/rtl/002-v5.13-rtlwifi-implement-set_tim-by-update-beacon-content.patch b/package/kernel/mac80211/patches/rtl/002-v5.13-rtlwifi-implement-set_tim-by-update-beacon-content.patch +new file mode 100644 +index 0000000000..3daf65e967 +--- /dev/null ++++ b/package/kernel/mac80211/patches/rtl/002-v5.13-rtlwifi-implement-set_tim-by-update-beacon-content.patch +@@ -0,0 +1,118 @@ ++Date: Mon, 19 Apr 2021 14:59:56 +0800 ++From: Ping-Ke Shih ++To: ++CC: , , ++ ++Subject: [PATCH] rtlwifi: implement set_tim by update beacon content ++ ++Once beacon content is changed, we update the content to wifi card by ++send_beacon_frame(). Then, STA with PS can wake up properly to receive its ++packets. ++ ++Since we update beacon content to PCI wifi devices every beacon interval, ++the only one usb device, 8192CU, needs to update beacon content when ++mac80211 calling set_tim. ++ ++Reported-by: Maciej S. Szmigiero ++Signed-off-by: Ping-Ke Shih ++Tested-by: Maciej S. Szmigiero ++--- ++ drivers/net/wireless/realtek/rtlwifi/core.c | 32 +++++++++++++++++++++ ++ drivers/net/wireless/realtek/rtlwifi/core.h | 1 + ++ drivers/net/wireless/realtek/rtlwifi/usb.c | 3 ++ ++ drivers/net/wireless/realtek/rtlwifi/wifi.h | 1 + ++ 4 files changed, 37 insertions(+) ++ ++--- a/drivers/net/wireless/realtek/rtlwifi/core.c +++++ b/drivers/net/wireless/realtek/rtlwifi/core.c ++@@ -1018,6 +1018,25 @@ static void send_beacon_frame(struct iee ++ } ++ } ++ +++void rtl_update_beacon_work_callback(struct work_struct *work) +++{ +++ struct rtl_works *rtlworks = +++ container_of(work, struct rtl_works, update_beacon_work); +++ struct ieee80211_hw *hw = rtlworks->hw; +++ struct rtl_priv *rtlpriv = rtl_priv(hw); +++ struct ieee80211_vif *vif = rtlpriv->mac80211.vif; +++ +++ if (!vif) { +++ WARN_ONCE(true, "no vif to update beacon\n"); +++ return; +++ } +++ +++ mutex_lock(&rtlpriv->locks.conf_mutex); +++ send_beacon_frame(hw, vif); +++ mutex_unlock(&rtlpriv->locks.conf_mutex); +++} +++EXPORT_SYMBOL_GPL(rtl_update_beacon_work_callback); +++ ++ static void rtl_op_bss_info_changed(struct ieee80211_hw *hw, ++ struct ieee80211_vif *vif, ++ struct ieee80211_bss_conf *bss_conf, ++@@ -1747,6 +1766,18 @@ static void rtl_op_flush(struct ieee8021 ++ rtlpriv->intf_ops->flush(hw, queues, drop); ++ } ++ +++static int rtl_op_set_tim(struct ieee80211_hw *hw, struct ieee80211_sta *sta, +++ bool set) +++{ +++ struct rtl_priv *rtlpriv = rtl_priv(hw); +++ struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); +++ +++ if (rtlhal->hw_type == HARDWARE_TYPE_RTL8192CU) +++ schedule_work(&rtlpriv->works.update_beacon_work); +++ +++ return 0; +++} +++ ++ /* Description: ++ * This routine deals with the Power Configuration CMD ++ * parsing for RTL8723/RTL8188E Series IC. ++@@ -1903,6 +1934,7 @@ const struct ieee80211_ops rtl_ops = { ++ .sta_add = rtl_op_sta_add, ++ .sta_remove = rtl_op_sta_remove, ++ .flush = rtl_op_flush, +++ .set_tim = rtl_op_set_tim, ++ }; ++ EXPORT_SYMBOL_GPL(rtl_ops); ++ ++--- a/drivers/net/wireless/realtek/rtlwifi/core.h +++++ b/drivers/net/wireless/realtek/rtlwifi/core.h ++@@ -60,5 +60,6 @@ void rtl_bb_delay(struct ieee80211_hw *h ++ bool rtl_cmd_send_packet(struct ieee80211_hw *hw, struct sk_buff *skb); ++ bool rtl_btc_status_false(void); ++ void rtl_dm_diginit(struct ieee80211_hw *hw, u32 cur_igval); +++void rtl_update_beacon_work_callback(struct work_struct *work); ++ ++ #endif ++--- a/drivers/net/wireless/realtek/rtlwifi/usb.c +++++ b/drivers/net/wireless/realtek/rtlwifi/usb.c ++@@ -807,6 +807,7 @@ static void rtl_usb_stop(struct ieee8021 ++ ++ tasklet_kill(&rtlusb->rx_work_tasklet); ++ cancel_work_sync(&rtlpriv->works.lps_change_work); +++ cancel_work_sync(&rtlpriv->works.update_beacon_work); ++ ++ flush_workqueue(rtlpriv->works.rtl_wq); ++ ++@@ -1033,6 +1034,8 @@ int rtl_usb_probe(struct usb_interface * ++ rtl_fill_h2c_cmd_work_callback); ++ INIT_WORK(&rtlpriv->works.lps_change_work, ++ rtl_lps_change_work_callback); +++ INIT_WORK(&rtlpriv->works.update_beacon_work, +++ rtl_update_beacon_work_callback); ++ ++ rtlpriv->usb_data_index = 0; ++ init_completion(&rtlpriv->firmware_loading_complete); ++--- a/drivers/net/wireless/realtek/rtlwifi/wifi.h +++++ b/drivers/net/wireless/realtek/rtlwifi/wifi.h ++@@ -2487,6 +2487,7 @@ struct rtl_works { ++ ++ struct work_struct lps_change_work; ++ struct work_struct fill_h2c_cmd; +++ struct work_struct update_beacon_work; ++ }; ++ ++ struct rtl_debug { +diff --git a/package/kernel/mac80211/patches/subsys/010-sync-nl80211_h.patch b/package/kernel/mac80211/patches/subsys/010-sync-nl80211_h.patch +new file mode 100644 +index 0000000000..e1f66ac1c3 +--- /dev/null ++++ b/package/kernel/mac80211/patches/subsys/010-sync-nl80211_h.patch +@@ -0,0 +1,297 @@ ++--- a/include/uapi/linux/nl80211.h +++++ b/include/uapi/linux/nl80211.h ++@@ -655,6 +655,9 @@ ++ * When a security association was established on an 802.1X network using ++ * fast transition, this event should be followed by an ++ * %NL80211_CMD_PORT_AUTHORIZED event. +++ * Following a %NL80211_CMD_ROAM event userspace can issue +++ * %NL80211_CMD_GET_SCAN in order to obtain the scan information for the +++ * new BSS the card/driver roamed to. ++ * @NL80211_CMD_DISCONNECT: drop a given connection; also used to notify ++ * userspace that a connection was dropped by the AP or due to other ++ * reasons, for this the %NL80211_ATTR_DISCONNECTED_BY_AP and ++@@ -757,7 +760,8 @@ ++ * of any other interfaces, and other interfaces will again take ++ * precedence when they are used. ++ * ++- * @NL80211_CMD_SET_WDS_PEER: Set the MAC address of the peer on a WDS interface. +++ * @NL80211_CMD_SET_WDS_PEER: Set the MAC address of the peer on a WDS interface +++ * (no longer supported). ++ * ++ * @NL80211_CMD_SET_MULTICAST_TO_UNICAST: Configure if this AP should perform ++ * multicast to unicast conversion. When enabled, all multicast packets ++@@ -1177,6 +1181,10 @@ ++ * includes the contents of the frame. %NL80211_ATTR_ACK flag is included ++ * if the recipient acknowledged the frame. ++ * +++ * @NL80211_CMD_SET_SAR_SPECS: SAR power limitation configuration is +++ * passed using %NL80211_ATTR_SAR_SPEC. %NL80211_ATTR_WIPHY is used to +++ * specify the wiphy index to be applied to. +++ * ++ * @NL80211_CMD_MAX: highest used command number ++ * @__NL80211_CMD_AFTER_LAST: internal use ++ */ ++@@ -1407,6 +1415,8 @@ enum nl80211_commands { ++ ++ NL80211_CMD_CONTROL_PORT_FRAME_TX_STATUS, ++ +++ NL80211_CMD_SET_SAR_SPECS, +++ ++ /* add new commands above here */ ++ ++ /* used to define NL80211_CMD_MAX below */ ++@@ -1750,8 +1760,9 @@ enum nl80211_commands { ++ * specify just a single bitrate, which is to be used for the beacon. ++ * The driver must also specify support for this with the extended ++ * features NL80211_EXT_FEATURE_BEACON_RATE_LEGACY, ++- * NL80211_EXT_FEATURE_BEACON_RATE_HT and ++- * NL80211_EXT_FEATURE_BEACON_RATE_VHT. +++ * NL80211_EXT_FEATURE_BEACON_RATE_HT, +++ * NL80211_EXT_FEATURE_BEACON_RATE_VHT and +++ * NL80211_EXT_FEATURE_BEACON_RATE_HE. ++ * ++ * @NL80211_ATTR_FRAME_MATCH: A binary attribute which typically must contain ++ * at least one byte, currently used with @NL80211_CMD_REGISTER_FRAME. ++@@ -1955,8 +1966,15 @@ enum nl80211_commands { ++ * @NL80211_ATTR_PROBE_RESP: Probe Response template data. Contains the entire ++ * probe-response frame. The DA field in the 802.11 header is zero-ed out, ++ * to be filled by the FW. ++- * @NL80211_ATTR_DISABLE_HT: Force HT capable interfaces to disable ++- * this feature. Currently, only supported in mac80211 drivers. +++ * @NL80211_ATTR_DISABLE_HT: Force HT capable interfaces to disable +++ * this feature during association. This is a flag attribute. +++ * Currently only supported in mac80211 drivers. +++ * @NL80211_ATTR_DISABLE_VHT: Force VHT capable interfaces to disable +++ * this feature during association. This is a flag attribute. +++ * Currently only supported in mac80211 drivers. +++ * @NL80211_ATTR_DISABLE_HE: Force HE capable interfaces to disable +++ * this feature during association. This is a flag attribute. +++ * Currently only supported in mac80211 drivers. ++ * @NL80211_ATTR_HT_CAPABILITY_MASK: Specify which bits of the ++ * ATTR_HT_CAPABILITY to which attention should be paid. ++ * Currently, only mac80211 NICs support this feature. ++@@ -2077,7 +2095,8 @@ enum nl80211_commands { ++ * until the channel switch event. ++ * @NL80211_ATTR_CH_SWITCH_BLOCK_TX: flag attribute specifying that transmission ++ * must be blocked on the current channel (before the channel switch ++- * operation). +++ * operation). Also included in the channel switch started event if quiet +++ * was requested by the AP. ++ * @NL80211_ATTR_CSA_IES: Nested set of attributes containing the IE information ++ * for the time while performing a channel switch. ++ * @NL80211_ATTR_CNTDWN_OFFS_BEACON: An array of offsets (u16) to the channel ++@@ -2527,6 +2546,20 @@ enum nl80211_commands { ++ * override mask. Used with NL80211_ATTR_S1G_CAPABILITY in ++ * NL80211_CMD_ASSOCIATE or NL80211_CMD_CONNECT. ++ * +++ * @NL80211_ATTR_SAE_PWE: Indicates the mechanism(s) allowed for SAE PWE +++ * derivation in WPA3-Personal networks which are using SAE authentication. +++ * This is a u8 attribute that encapsulates one of the values from +++ * &enum nl80211_sae_pwe_mechanism. +++ * +++ * @NL80211_ATTR_SAR_SPEC: SAR power limitation specification when +++ * used with %NL80211_CMD_SET_SAR_SPECS. The message contains fields +++ * of %nl80211_sar_attrs which specifies the sar type and related +++ * sar specs. Sar specs contains array of %nl80211_sar_specs_attrs. +++ * +++ * @NL80211_ATTR_RECONNECT_REQUESTED: flag attribute, used with deauth and +++ * disassoc events to indicate that an immediate reconnect to the AP +++ * is desired. +++ * ++ * @NUM_NL80211_ATTR: total number of nl80211_attrs available ++ * @NL80211_ATTR_MAX: highest attribute number currently defined ++ * @__NL80211_ATTR_AFTER_LAST: internal use ++@@ -3016,6 +3049,14 @@ enum nl80211_attrs { ++ NL80211_ATTR_S1G_CAPABILITY, ++ NL80211_ATTR_S1G_CAPABILITY_MASK, ++ +++ NL80211_ATTR_SAE_PWE, +++ +++ NL80211_ATTR_RECONNECT_REQUESTED, +++ +++ NL80211_ATTR_SAR_SPEC, +++ +++ NL80211_ATTR_DISABLE_HE, +++ ++ /* add attributes here, update the policy in nl80211.c */ ++ ++ __NL80211_ATTR_AFTER_LAST, ++@@ -5896,6 +5937,19 @@ enum nl80211_feature_flags { ++ * @NL80211_EXT_FEATURE_UNSOL_BCAST_PROBE_RESP: Driver/device supports ++ * unsolicited broadcast probe response transmission ++ * +++ * @NL80211_EXT_FEATURE_BEACON_RATE_HE: Driver supports beacon rate +++ * configuration (AP/mesh) with HE rates. +++ * +++ * @NL80211_EXT_FEATURE_SECURE_LTF: Device supports secure LTF measurement +++ * exchange protocol. +++ * +++ * @NL80211_EXT_FEATURE_SECURE_RTT: Device supports secure RTT measurement +++ * exchange protocol. +++ * +++ * @NL80211_EXT_FEATURE_PROT_RANGE_NEGO_AND_MEASURE: Device supports management +++ * frame protection for all management frames exchanged during the +++ * negotiation and range measurement procedure. +++ * ++ * @NUM_NL80211_EXT_FEATURES: number of extended features. ++ * @MAX_NL80211_EXT_FEATURES: highest extended feature index. ++ */ ++@@ -5956,6 +6010,10 @@ enum nl80211_ext_feature_index { ++ NL80211_EXT_FEATURE_SAE_OFFLOAD_AP, ++ NL80211_EXT_FEATURE_FILS_DISCOVERY, ++ NL80211_EXT_FEATURE_UNSOL_BCAST_PROBE_RESP, +++ NL80211_EXT_FEATURE_BEACON_RATE_HE, +++ NL80211_EXT_FEATURE_SECURE_LTF, +++ NL80211_EXT_FEATURE_SECURE_RTT, +++ NL80211_EXT_FEATURE_PROT_RANGE_NEGO_AND_MEASURE, ++ ++ /* add new features before the definition below */ ++ NUM_NL80211_EXT_FEATURES, ++@@ -6253,11 +6311,13 @@ struct nl80211_vendor_cmd_info { ++ * @NL80211_TDLS_PEER_HT: TDLS peer is HT capable. ++ * @NL80211_TDLS_PEER_VHT: TDLS peer is VHT capable. ++ * @NL80211_TDLS_PEER_WMM: TDLS peer is WMM capable. +++ * @NL80211_TDLS_PEER_HE: TDLS peer is HE capable. ++ */ ++ enum nl80211_tdls_peer_capability { ++ NL80211_TDLS_PEER_HT = 1<<0, ++ NL80211_TDLS_PEER_VHT = 1<<1, ++ NL80211_TDLS_PEER_WMM = 1<<2, +++ NL80211_TDLS_PEER_HE = 1<<3, ++ }; ++ ++ /** ++@@ -6849,6 +6909,9 @@ enum nl80211_peer_measurement_ftm_capa { ++ * if neither %NL80211_PMSR_FTM_REQ_ATTR_TRIGGER_BASED nor ++ * %NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED is set, EDCA based ++ * ranging will be used. +++ * @NL80211_PMSR_FTM_REQ_ATTR_LMR_FEEDBACK: negotiate for LMR feedback. Only +++ * valid if either %NL80211_PMSR_FTM_REQ_ATTR_TRIGGER_BASED or +++ * %NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED is set. ++ * ++ * @NUM_NL80211_PMSR_FTM_REQ_ATTR: internal ++ * @NL80211_PMSR_FTM_REQ_ATTR_MAX: highest attribute number ++@@ -6867,6 +6930,7 @@ enum nl80211_peer_measurement_ftm_req { ++ NL80211_PMSR_FTM_REQ_ATTR_REQUEST_CIVICLOC, ++ NL80211_PMSR_FTM_REQ_ATTR_TRIGGER_BASED, ++ NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED, +++ NL80211_PMSR_FTM_REQ_ATTR_LMR_FEEDBACK, ++ ++ /* keep last */ ++ NUM_NL80211_PMSR_FTM_REQ_ATTR, ++@@ -7124,4 +7188,115 @@ enum nl80211_unsol_bcast_probe_resp_attr ++ NL80211_UNSOL_BCAST_PROBE_RESP_ATTR_MAX = ++ __NL80211_UNSOL_BCAST_PROBE_RESP_ATTR_LAST - 1 ++ }; +++ +++/** +++ * enum nl80211_sae_pwe_mechanism - The mechanism(s) allowed for SAE PWE +++ * derivation. Applicable only when WPA3-Personal SAE authentication is +++ * used. +++ * +++ * @NL80211_SAE_PWE_UNSPECIFIED: not specified, used internally to indicate that +++ * attribute is not present from userspace. +++ * @NL80211_SAE_PWE_HUNT_AND_PECK: hunting-and-pecking loop only +++ * @NL80211_SAE_PWE_HASH_TO_ELEMENT: hash-to-element only +++ * @NL80211_SAE_PWE_BOTH: both hunting-and-pecking loop and hash-to-element +++ * can be used. +++ */ +++enum nl80211_sae_pwe_mechanism { +++ NL80211_SAE_PWE_UNSPECIFIED, +++ NL80211_SAE_PWE_HUNT_AND_PECK, +++ NL80211_SAE_PWE_HASH_TO_ELEMENT, +++ NL80211_SAE_PWE_BOTH, +++}; +++ +++/** +++ * enum nl80211_sar_type - type of SAR specs +++ * +++ * @NL80211_SAR_TYPE_POWER: power limitation specified in 0.25dBm unit +++ * +++ */ +++enum nl80211_sar_type { +++ NL80211_SAR_TYPE_POWER, +++ +++ /* add new type here */ +++ +++ /* Keep last */ +++ NUM_NL80211_SAR_TYPE, +++}; +++ +++/** +++ * enum nl80211_sar_attrs - Attributes for SAR spec +++ * +++ * @NL80211_SAR_ATTR_TYPE: the SAR type as defined in &enum nl80211_sar_type. +++ * +++ * @NL80211_SAR_ATTR_SPECS: Nested array of SAR power +++ * limit specifications. Each specification contains a set +++ * of %nl80211_sar_specs_attrs. +++ * +++ * For SET operation, it contains array of %NL80211_SAR_ATTR_SPECS_POWER +++ * and %NL80211_SAR_ATTR_SPECS_RANGE_INDEX. +++ * +++ * For sar_capa dump, it contains array of +++ * %NL80211_SAR_ATTR_SPECS_START_FREQ +++ * and %NL80211_SAR_ATTR_SPECS_END_FREQ. +++ * +++ * @__NL80211_SAR_ATTR_LAST: Internal +++ * @NL80211_SAR_ATTR_MAX: highest sar attribute +++ * +++ * These attributes are used with %NL80211_CMD_SET_SAR_SPEC +++ */ +++enum nl80211_sar_attrs { +++ __NL80211_SAR_ATTR_INVALID, +++ +++ NL80211_SAR_ATTR_TYPE, +++ NL80211_SAR_ATTR_SPECS, +++ +++ __NL80211_SAR_ATTR_LAST, +++ NL80211_SAR_ATTR_MAX = __NL80211_SAR_ATTR_LAST - 1, +++}; +++ +++/** +++ * enum nl80211_sar_specs_attrs - Attributes for SAR power limit specs +++ * +++ * @NL80211_SAR_ATTR_SPECS_POWER: Required (s32)value to specify the actual +++ * power limit value in units of 0.25 dBm if type is +++ * NL80211_SAR_TYPE_POWER. (i.e., a value of 44 represents 11 dBm). +++ * 0 means userspace doesn't have SAR limitation on this associated range. +++ * +++ * @NL80211_SAR_ATTR_SPECS_RANGE_INDEX: Required (u32) value to specify the +++ * index of exported freq range table and the associated power limitation +++ * is applied to this range. +++ * +++ * Userspace isn't required to set all the ranges advertised by WLAN driver, +++ * and userspace can skip some certain ranges. These skipped ranges don't +++ * have SAR limitations, and they are same as setting the +++ * %NL80211_SAR_ATTR_SPECS_POWER to any unreasonable high value because any +++ * value higher than regulatory allowed value just means SAR power +++ * limitation is removed, but it's required to set at least one range. +++ * It's not allowed to set duplicated range in one SET operation. +++ * +++ * Every SET operation overwrites previous SET operation. +++ * +++ * @NL80211_SAR_ATTR_SPECS_START_FREQ: Required (u32) value to specify the start +++ * frequency of this range edge when registering SAR capability to wiphy. +++ * It's not a channel center frequency. The unit is kHz. +++ * +++ * @NL80211_SAR_ATTR_SPECS_END_FREQ: Required (u32) value to specify the end +++ * frequency of this range edge when registering SAR capability to wiphy. +++ * It's not a channel center frequency. The unit is kHz. +++ * +++ * @__NL80211_SAR_ATTR_SPECS_LAST: Internal +++ * @NL80211_SAR_ATTR_SPECS_MAX: highest sar specs attribute +++ */ +++enum nl80211_sar_specs_attrs { +++ __NL80211_SAR_ATTR_SPECS_INVALID, +++ +++ NL80211_SAR_ATTR_SPECS_POWER, +++ NL80211_SAR_ATTR_SPECS_RANGE_INDEX, +++ NL80211_SAR_ATTR_SPECS_START_FREQ, +++ NL80211_SAR_ATTR_SPECS_END_FREQ, +++ +++ __NL80211_SAR_ATTR_SPECS_LAST, +++ NL80211_SAR_ATTR_SPECS_MAX = __NL80211_SAR_ATTR_SPECS_LAST - 1, +++}; +++ ++ #endif /* __LINUX_NL80211_H */ +diff --git a/package/kernel/mac80211/patches/subsys/100-remove-cryptoapi-dependencies.patch b/package/kernel/mac80211/patches/subsys/100-remove-cryptoapi-dependencies.patch +index 7b036e4e4c..ec6ecbcfce 100644 +--- a/package/kernel/mac80211/patches/subsys/100-remove-cryptoapi-dependencies.patch ++++ b/package/kernel/mac80211/patches/subsys/100-remove-cryptoapi-dependencies.patch +@@ -20,7 +20,7 @@ + ethtool.o \ + --- a/net/mac80211/aead_api.c + +++ /dev/null +-@@ -1,112 +0,0 @@ ++@@ -1,113 +0,0 @@ + -// SPDX-License-Identifier: GPL-2.0-only + -/* + - * Copyright 2003-2004, Instant802 Networks, Inc. +@@ -46,6 +46,7 @@ + - struct aead_request *aead_req; + - int reqsize = sizeof(*aead_req) + crypto_aead_reqsize(tfm); + - u8 *__aad; ++- int ret; + - + - aead_req = kzalloc(reqsize + aad_len, GFP_ATOMIC); + - if (!aead_req) +@@ -63,10 +64,10 @@ + - aead_request_set_crypt(aead_req, sg, sg, data_len, b_0); + - aead_request_set_ad(aead_req, sg[0].length); + - +-- crypto_aead_encrypt(aead_req); ++- ret = crypto_aead_encrypt(aead_req); + - kfree_sensitive(aead_req); + - +-- return 0; ++- return ret; + -} + - + -int aead_decrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad, size_t aad_len, +diff --git a/package/kernel/mac80211/patches/subsys/150-disable_addr_notifier.patch b/package/kernel/mac80211/patches/subsys/150-disable_addr_notifier.patch +index 8a717558a7..9589235f71 100644 +--- a/package/kernel/mac80211/patches/subsys/150-disable_addr_notifier.patch ++++ b/package/kernel/mac80211/patches/subsys/150-disable_addr_notifier.patch +@@ -18,7 +18,7 @@ + static int ieee80211_ifa6_changed(struct notifier_block *nb, + unsigned long data, void *arg) + { +-@@ -1301,14 +1301,14 @@ int ieee80211_register_hw(struct ieee802 ++@@ -1312,14 +1312,14 @@ int ieee80211_register_hw(struct ieee802 + + rtnl_unlock(); + +@@ -35,7 +35,7 @@ + local->ifa6_notifier.notifier_call = ieee80211_ifa6_changed; + result = register_inet6addr_notifier(&local->ifa6_notifier); + if (result) +-@@ -1317,13 +1317,13 @@ int ieee80211_register_hw(struct ieee802 ++@@ -1328,13 +1328,13 @@ int ieee80211_register_hw(struct ieee802 + + return 0; + +@@ -52,7 +52,7 @@ + fail_ifa: + #endif + wiphy_unregister(local->hw.wiphy); +-@@ -1351,10 +1351,10 @@ void ieee80211_unregister_hw(struct ieee ++@@ -1362,10 +1362,10 @@ void ieee80211_unregister_hw(struct ieee + tasklet_kill(&local->tx_pending_tasklet); + tasklet_kill(&local->tasklet); + +diff --git a/package/kernel/mac80211/patches/subsys/210-ap_scan.patch b/package/kernel/mac80211/patches/subsys/210-ap_scan.patch +index 80f995737b..ee49942459 100644 +--- a/package/kernel/mac80211/patches/subsys/210-ap_scan.patch ++++ b/package/kernel/mac80211/patches/subsys/210-ap_scan.patch +@@ -1,6 +1,6 @@ + --- a/net/mac80211/cfg.c + +++ b/net/mac80211/cfg.c +-@@ -2442,7 +2442,7 @@ static int ieee80211_scan(struct wiphy * ++@@ -2444,7 +2444,7 @@ static int ieee80211_scan(struct wiphy * + * the frames sent while scanning on other channel will be + * lost) + */ +diff --git a/package/kernel/mac80211/patches/subsys/300-cfg80211-support-immediate-reconnect-request-hint.patch b/package/kernel/mac80211/patches/subsys/300-cfg80211-support-immediate-reconnect-request-hint.patch +index d3f4aa7972..807d496080 100644 +--- a/package/kernel/mac80211/patches/subsys/300-cfg80211-support-immediate-reconnect-request-hint.patch ++++ b/package/kernel/mac80211/patches/subsys/300-cfg80211-support-immediate-reconnect-request-hint.patch +@@ -31,28 +31,6 @@ Signed-off-by: Johannes Berg + + /** + * cfg80211_rx_unprot_mlme_mgmt - notification of unprotected mlme mgmt frame +---- a/include/uapi/linux/nl80211.h +-+++ b/include/uapi/linux/nl80211.h +-@@ -2527,6 +2527,10 @@ enum nl80211_commands { +- * override mask. Used with NL80211_ATTR_S1G_CAPABILITY in +- * NL80211_CMD_ASSOCIATE or NL80211_CMD_CONNECT. +- * +-+ * @NL80211_ATTR_RECONNECT_REQUESTED: flag attribute, used with deauth and +-+ * disassoc events to indicate that an immediate reconnect to the AP +-+ * is desired. +-+ * +- * @NUM_NL80211_ATTR: total number of nl80211_attrs available +- * @NL80211_ATTR_MAX: highest attribute number currently defined +- * @__NL80211_ATTR_AFTER_LAST: internal use +-@@ -3016,6 +3020,8 @@ enum nl80211_attrs { +- NL80211_ATTR_S1G_CAPABILITY, +- NL80211_ATTR_S1G_CAPABILITY_MASK, +- +-+ NL80211_ATTR_RECONNECT_REQUESTED, +-+ +- /* add attributes here, update the policy in nl80211.c */ +- +- __NL80211_ATTR_AFTER_LAST, + --- a/net/mac80211/mlme.c + +++ b/net/mac80211/mlme.c + @@ -2729,7 +2729,7 @@ static void ieee80211_report_disconnect( +@@ -64,7 +42,7 @@ Signed-off-by: Johannes Berg + else + cfg80211_rx_mlme_mgmt(sdata->dev, buf, len); + +-@@ -4716,7 +4716,8 @@ void ieee80211_mgd_quiesce(struct ieee80 ++@@ -4719,7 +4719,8 @@ void ieee80211_mgd_quiesce(struct ieee80 + if (ifmgd->auth_data) + ieee80211_destroy_auth_data(sdata, false); + cfg80211_tx_mlme_mgmt(sdata->dev, frame_buf, +@@ -166,7 +144,7 @@ Signed-off-by: Johannes Berg + + --- a/net/wireless/nl80211.c + +++ b/net/wireless/nl80211.c +-@@ -732,6 +732,7 @@ static const struct nla_policy nl80211_p ++@@ -736,6 +736,7 @@ static const struct nla_policy nl80211_p + NLA_POLICY_EXACT_LEN(IEEE80211_S1G_CAPABILITY_LEN), + [NL80211_ATTR_S1G_CAPABILITY_MASK] = + NLA_POLICY_EXACT_LEN(IEEE80211_S1G_CAPABILITY_LEN), +@@ -174,7 +152,7 @@ Signed-off-by: Johannes Berg + }; + + /* policy for the key attributes */ +-@@ -15899,7 +15900,7 @@ static void nl80211_send_mlme_event(stru ++@@ -15903,7 +15904,7 @@ static void nl80211_send_mlme_event(stru + const u8 *buf, size_t len, + enum nl80211_commands cmd, gfp_t gfp, + int uapsd_queues, const u8 *req_ies, +@@ -183,7 +161,7 @@ Signed-off-by: Johannes Berg + { + struct sk_buff *msg; + void *hdr; +-@@ -15921,6 +15922,9 @@ static void nl80211_send_mlme_event(stru ++@@ -15925,6 +15926,9 @@ static void nl80211_send_mlme_event(stru + nla_put(msg, NL80211_ATTR_REQ_IE, req_ies_len, req_ies))) + goto nla_put_failure; + +@@ -193,7 +171,7 @@ Signed-off-by: Johannes Berg + if (uapsd_queues >= 0) { + struct nlattr *nla_wmm = + nla_nest_start_noflag(msg, NL80211_ATTR_STA_WME); +-@@ -15949,7 +15953,8 @@ void nl80211_send_rx_auth(struct cfg8021 ++@@ -15953,7 +15957,8 @@ void nl80211_send_rx_auth(struct cfg8021 + size_t len, gfp_t gfp) + { + nl80211_send_mlme_event(rdev, netdev, buf, len, +@@ -203,7 +181,7 @@ Signed-off-by: Johannes Berg + } + + void nl80211_send_rx_assoc(struct cfg80211_registered_device *rdev, +-@@ -15959,23 +15964,25 @@ void nl80211_send_rx_assoc(struct cfg802 ++@@ -15963,23 +15968,25 @@ void nl80211_send_rx_assoc(struct cfg802 + { + nl80211_send_mlme_event(rdev, netdev, buf, len, + NL80211_CMD_ASSOCIATE, gfp, uapsd_queues, +@@ -234,7 +212,7 @@ Signed-off-by: Johannes Berg + } + + void cfg80211_rx_unprot_mlme_mgmt(struct net_device *dev, const u8 *buf, +-@@ -16006,7 +16013,7 @@ void cfg80211_rx_unprot_mlme_mgmt(struct ++@@ -16010,7 +16017,7 @@ void cfg80211_rx_unprot_mlme_mgmt(struct + + trace_cfg80211_rx_unprot_mlme_mgmt(dev, buf, len); + nl80211_send_mlme_event(rdev, dev, buf, len, cmd, GFP_ATOMIC, -1, +diff --git a/package/kernel/mac80211/patches/subsys/301-mac80211-support-driver-based-disconnect-with-reconn.patch b/package/kernel/mac80211/patches/subsys/301-mac80211-support-driver-based-disconnect-with-reconn.patch +index 8f948c140e..59a154a543 100644 +--- a/package/kernel/mac80211/patches/subsys/301-mac80211-support-driver-based-disconnect-with-reconn.patch ++++ b/package/kernel/mac80211/patches/subsys/301-mac80211-support-driver-based-disconnect-with-reconn.patch +@@ -174,7 +174,7 @@ Signed-off-by: Johannes Berg + } + + static int ieee80211_auth(struct ieee80211_sub_if_data *sdata) +-@@ -5431,7 +5462,8 @@ int ieee80211_mgd_auth(struct ieee80211_ ++@@ -5434,7 +5465,8 @@ int ieee80211_mgd_auth(struct ieee80211_ + + ieee80211_report_disconnect(sdata, frame_buf, + sizeof(frame_buf), true, +@@ -184,7 +184,7 @@ Signed-off-by: Johannes Berg + } + + sdata_info(sdata, "authenticate with %pM\n", req->bss->bssid); +-@@ -5503,7 +5535,8 @@ int ieee80211_mgd_assoc(struct ieee80211 ++@@ -5506,7 +5538,8 @@ int ieee80211_mgd_assoc(struct ieee80211 + + ieee80211_report_disconnect(sdata, frame_buf, + sizeof(frame_buf), true, +@@ -194,7 +194,7 @@ Signed-off-by: Johannes Berg + } + + if (ifmgd->auth_data && !ifmgd->auth_data->done) { +-@@ -5802,7 +5835,7 @@ int ieee80211_mgd_deauth(struct ieee8021 ++@@ -5805,7 +5838,7 @@ int ieee80211_mgd_deauth(struct ieee8021 + ieee80211_destroy_auth_data(sdata, false); + ieee80211_report_disconnect(sdata, frame_buf, + sizeof(frame_buf), true, +@@ -203,7 +203,7 @@ Signed-off-by: Johannes Berg + + return 0; + } +-@@ -5822,7 +5855,7 @@ int ieee80211_mgd_deauth(struct ieee8021 ++@@ -5825,7 +5858,7 @@ int ieee80211_mgd_deauth(struct ieee8021 + ieee80211_destroy_assoc_data(sdata, false, true); + ieee80211_report_disconnect(sdata, frame_buf, + sizeof(frame_buf), true, +@@ -212,7 +212,7 @@ Signed-off-by: Johannes Berg + return 0; + } + +-@@ -5837,7 +5870,7 @@ int ieee80211_mgd_deauth(struct ieee8021 ++@@ -5840,7 +5873,7 @@ int ieee80211_mgd_deauth(struct ieee8021 + req->reason_code, tx, frame_buf); + ieee80211_report_disconnect(sdata, frame_buf, + sizeof(frame_buf), true, +@@ -221,7 +221,7 @@ Signed-off-by: Johannes Berg + return 0; + } + +-@@ -5870,7 +5903,7 @@ int ieee80211_mgd_disassoc(struct ieee80 ++@@ -5873,7 +5906,7 @@ int ieee80211_mgd_disassoc(struct ieee80 + frame_buf); + + ieee80211_report_disconnect(sdata, frame_buf, sizeof(frame_buf), true, +diff --git a/package/kernel/mac80211/patches/subsys/302-cfg80211-Add-support-to-configure-SAE-PWE-value-to-d.patch b/package/kernel/mac80211/patches/subsys/302-cfg80211-Add-support-to-configure-SAE-PWE-value-to-d.patch +new file mode 100644 +index 0000000000..acfdae0f5b +--- /dev/null ++++ b/package/kernel/mac80211/patches/subsys/302-cfg80211-Add-support-to-configure-SAE-PWE-value-to-d.patch +@@ -0,0 +1,74 @@ ++From: Rohan Dutta ++Date: Tue, 27 Oct 2020 12:09:10 +0200 ++Subject: [PATCH] cfg80211: Add support to configure SAE PWE value to drivers ++ ++Add support to configure SAE PWE preference from userspace to drivers in ++both AP and STA modes. This is needed for cases where the driver takes ++care of Authentication frame processing (SME in the driver) so that ++correct enforcement of the acceptable PWE derivation mechanism can be ++performed. ++ ++The userspace applications can pass the sae_pwe value using the ++NL80211_ATTR_SAE_PWE attribute in the NL80211_CMD_CONNECT and ++NL80211_CMD_START_AP commands to the driver. This allows selection ++between the hunting-and-pecking loop and hash-to-element options for PWE ++derivation. For backwards compatibility, this new attribute is optional ++and if not included, the driver is notified of the value being ++unspecified. ++ ++Signed-off-by: Rohan Dutta ++Signed-off-by: Jouni Malinen ++Link: https://lore.kernel.org/r/20201027100910.22283-1-jouni@codeaurora.org ++Signed-off-by: Johannes Berg ++--- ++ ++--- a/include/net/cfg80211.h +++++ b/include/net/cfg80211.h ++@@ -1009,6 +1009,14 @@ struct survey_info { ++ * @sae_pwd: password for SAE authentication (for devices supporting SAE ++ * offload) ++ * @sae_pwd_len: length of SAE password (for devices supporting SAE offload) +++ * @sae_pwe: The mechanisms allowed for SAE PWE derivation +++ * NL80211_SAE_PWE_UNSPECIFIED: Not-specified, used to indicate userspace +++ * did not specify any preference. The driver should follow its +++ * internal policy in such a scenario. +++ * NL80211_SAE_PWE_HUNT_AND_PECK: Allow hunting-and-pecking loop only +++ * NL80211_SAE_PWE_HASH_TO_ELEMENT: Allow hash-to-element only +++ * NL80211_SAE_PWE_BOTH: Allow either hunting-and-pecking loop +++ * or hash-to-element ++ */ ++ struct cfg80211_crypto_settings { ++ u32 wpa_versions; ++@@ -1027,6 +1035,7 @@ struct cfg80211_crypto_settings { ++ const u8 *psk; ++ const u8 *sae_pwd; ++ u8 sae_pwd_len; +++ enum nl80211_sae_pwe_mechanism sae_pwe; ++ }; ++ ++ /** ++--- a/net/wireless/nl80211.c +++++ b/net/wireless/nl80211.c ++@@ -736,6 +736,9 @@ static const struct nla_policy nl80211_p ++ NLA_POLICY_EXACT_LEN(IEEE80211_S1G_CAPABILITY_LEN), ++ [NL80211_ATTR_S1G_CAPABILITY_MASK] = ++ NLA_POLICY_EXACT_LEN(IEEE80211_S1G_CAPABILITY_LEN), +++ [NL80211_ATTR_SAE_PWE] = +++ NLA_POLICY_RANGE(NLA_U8, NL80211_SAE_PWE_HUNT_AND_PECK, +++ NL80211_SAE_PWE_BOTH), ++ [NL80211_ATTR_RECONNECT_REQUESTED] = { .type = NLA_REJECT }, ++ }; ++ ++@@ -9764,6 +9767,12 @@ static int nl80211_crypto_settings(struc ++ nla_len(info->attrs[NL80211_ATTR_SAE_PASSWORD]); ++ } ++ +++ if (info->attrs[NL80211_ATTR_SAE_PWE]) +++ settings->sae_pwe = +++ nla_get_u8(info->attrs[NL80211_ATTR_SAE_PWE]); +++ else +++ settings->sae_pwe = NL80211_SAE_PWE_UNSPECIFIED; +++ ++ return 0; ++ } ++ +diff --git a/package/kernel/mac80211/patches/subsys/320-mac80211_hwsim-add-6GHz-channels.patch b/package/kernel/mac80211/patches/subsys/320-mac80211_hwsim-add-6GHz-channels.patch +new file mode 100644 +index 0000000000..a7c09f00bc +--- /dev/null ++++ b/package/kernel/mac80211/patches/subsys/320-mac80211_hwsim-add-6GHz-channels.patch +@@ -0,0 +1,123 @@ ++From: Ramon Fontes ++Date: Sun, 27 Dec 2020 00:11:55 -0300 ++Subject: [PATCH] mac80211_hwsim: add 6GHz channels ++ ++Advertise 6GHz channels to mac80211. ++ ++Signed-off-by: Ramon Fontes ++Link: https://lore.kernel.org/r/20201227031155.81161-1-ramonreisfontes@gmail.com ++[reword commit message] ++Signed-off-by: Johannes Berg ++--- ++ ++--- a/drivers/net/wireless/mac80211_hwsim.c +++++ b/drivers/net/wireless/mac80211_hwsim.c ++@@ -311,6 +311,12 @@ static struct net_device *hwsim_mon; /* ++ .hw_value = (_freq), \ ++ } ++ +++#define CHAN6G(_freq) { \ +++ .band = NL80211_BAND_6GHZ, \ +++ .center_freq = (_freq), \ +++ .hw_value = (_freq), \ +++} +++ ++ static const struct ieee80211_channel hwsim_channels_2ghz[] = { ++ CHAN2G(2412), /* Channel 1 */ ++ CHAN2G(2417), /* Channel 2 */ ++@@ -377,6 +383,68 @@ static const struct ieee80211_channel hw ++ CHAN5G(5925), /* Channel 185 */ ++ }; ++ +++static const struct ieee80211_channel hwsim_channels_6ghz[] = { +++ CHAN6G(5955), /* Channel 1 */ +++ CHAN6G(5975), /* Channel 5 */ +++ CHAN6G(5995), /* Channel 9 */ +++ CHAN6G(6015), /* Channel 13 */ +++ CHAN6G(6035), /* Channel 17 */ +++ CHAN6G(6055), /* Channel 21 */ +++ CHAN6G(6075), /* Channel 25 */ +++ CHAN6G(6095), /* Channel 29 */ +++ CHAN6G(6115), /* Channel 33 */ +++ CHAN6G(6135), /* Channel 37 */ +++ CHAN6G(6155), /* Channel 41 */ +++ CHAN6G(6175), /* Channel 45 */ +++ CHAN6G(6195), /* Channel 49 */ +++ CHAN6G(6215), /* Channel 53 */ +++ CHAN6G(6235), /* Channel 57 */ +++ CHAN6G(6255), /* Channel 61 */ +++ CHAN6G(6275), /* Channel 65 */ +++ CHAN6G(6295), /* Channel 69 */ +++ CHAN6G(6315), /* Channel 73 */ +++ CHAN6G(6335), /* Channel 77 */ +++ CHAN6G(6355), /* Channel 81 */ +++ CHAN6G(6375), /* Channel 85 */ +++ CHAN6G(6395), /* Channel 89 */ +++ CHAN6G(6415), /* Channel 93 */ +++ CHAN6G(6435), /* Channel 97 */ +++ CHAN6G(6455), /* Channel 181 */ +++ CHAN6G(6475), /* Channel 105 */ +++ CHAN6G(6495), /* Channel 109 */ +++ CHAN6G(6515), /* Channel 113 */ +++ CHAN6G(6535), /* Channel 117 */ +++ CHAN6G(6555), /* Channel 121 */ +++ CHAN6G(6575), /* Channel 125 */ +++ CHAN6G(6595), /* Channel 129 */ +++ CHAN6G(6615), /* Channel 133 */ +++ CHAN6G(6635), /* Channel 137 */ +++ CHAN6G(6655), /* Channel 141 */ +++ CHAN6G(6675), /* Channel 145 */ +++ CHAN6G(6695), /* Channel 149 */ +++ CHAN6G(6715), /* Channel 153 */ +++ CHAN6G(6735), /* Channel 157 */ +++ CHAN6G(6755), /* Channel 161 */ +++ CHAN6G(6775), /* Channel 165 */ +++ CHAN6G(6795), /* Channel 169 */ +++ CHAN6G(6815), /* Channel 173 */ +++ CHAN6G(6835), /* Channel 177 */ +++ CHAN6G(6855), /* Channel 181 */ +++ CHAN6G(6875), /* Channel 185 */ +++ CHAN6G(6895), /* Channel 189 */ +++ CHAN6G(6915), /* Channel 193 */ +++ CHAN6G(6935), /* Channel 197 */ +++ CHAN6G(6955), /* Channel 201 */ +++ CHAN6G(6975), /* Channel 205 */ +++ CHAN6G(6995), /* Channel 209 */ +++ CHAN6G(7015), /* Channel 213 */ +++ CHAN6G(7035), /* Channel 217 */ +++ CHAN6G(7055), /* Channel 221 */ +++ CHAN6G(7075), /* Channel 225 */ +++ CHAN6G(7095), /* Channel 229 */ +++ CHAN6G(7115), /* Channel 233 */ +++}; +++ ++ #define NUM_S1G_CHANS_US 51 ++ static struct ieee80211_channel hwsim_channels_s1g[NUM_S1G_CHANS_US]; ++ ++@@ -548,6 +616,7 @@ struct mac80211_hwsim_data { ++ struct ieee80211_supported_band bands[NUM_NL80211_BANDS]; ++ struct ieee80211_channel channels_2ghz[ARRAY_SIZE(hwsim_channels_2ghz)]; ++ struct ieee80211_channel channels_5ghz[ARRAY_SIZE(hwsim_channels_5ghz)]; +++ struct ieee80211_channel channels_6ghz[ARRAY_SIZE(hwsim_channels_6ghz)]; ++ struct ieee80211_channel channels_s1g[ARRAY_SIZE(hwsim_channels_s1g)]; ++ struct ieee80211_rate rates[ARRAY_SIZE(hwsim_rates)]; ++ struct ieee80211_iface_combination if_combination; ++@@ -578,7 +647,8 @@ struct mac80211_hwsim_data { ++ struct ieee80211_channel *channel; ++ unsigned long next_start, start, end; ++ } survey_data[ARRAY_SIZE(hwsim_channels_2ghz) + ++- ARRAY_SIZE(hwsim_channels_5ghz)]; +++ ARRAY_SIZE(hwsim_channels_5ghz) + +++ ARRAY_SIZE(hwsim_channels_6ghz)]; ++ ++ struct ieee80211_channel *channel; ++ u64 beacon_int /* beacon interval in us */; ++@@ -3149,6 +3219,8 @@ static int mac80211_hwsim_new_radio(stru ++ sizeof(hwsim_channels_2ghz)); ++ memcpy(data->channels_5ghz, hwsim_channels_5ghz, ++ sizeof(hwsim_channels_5ghz)); +++ memcpy(data->channels_6ghz, hwsim_channels_6ghz, +++ sizeof(hwsim_channels_6ghz)); ++ memcpy(data->channels_s1g, hwsim_channels_s1g, ++ sizeof(hwsim_channels_s1g)); ++ memcpy(data->rates, hwsim_rates, sizeof(hwsim_rates)); +diff --git a/package/kernel/mac80211/patches/subsys/321-mac80211_hwsim-make-6-GHz-channels-usable.patch b/package/kernel/mac80211/patches/subsys/321-mac80211_hwsim-make-6-GHz-channels-usable.patch +new file mode 100644 +index 0000000000..4bac10eefe +--- /dev/null ++++ b/package/kernel/mac80211/patches/subsys/321-mac80211_hwsim-make-6-GHz-channels-usable.patch +@@ -0,0 +1,74 @@ ++From: Felix Fietkau ++Date: Mon, 24 May 2021 11:46:09 +0200 ++Subject: [PATCH] mac80211_hwsim: make 6 GHz channels usable ++ ++The previous commit that claimed to add 6 GHz channels didn't actually make ++them usable, since the 6 GHz band was not registered with mac80211. ++ ++Fixes: 28881922abd7 ("mac80211_hwsim: add 6GHz channels") ++Signed-off-by: Felix Fietkau ++--- ++ ++--- a/drivers/net/wireless/mac80211_hwsim.c +++++ b/drivers/net/wireless/mac80211_hwsim.c ++@@ -2968,15 +2968,19 @@ static void mac80211_hwsim_he_capab(stru ++ { ++ u16 n_iftype_data; ++ ++- if (sband->band == NL80211_BAND_2GHZ) { +++ switch (sband->band) { +++ case NL80211_BAND_2GHZ: ++ n_iftype_data = ARRAY_SIZE(he_capa_2ghz); ++ sband->iftype_data = ++ (struct ieee80211_sband_iftype_data *)he_capa_2ghz; ++- } else if (sband->band == NL80211_BAND_5GHZ) { +++ break; +++ case NL80211_BAND_5GHZ: +++ case NL80211_BAND_6GHZ: ++ n_iftype_data = ARRAY_SIZE(he_capa_5ghz); ++ sband->iftype_data = ++ (struct ieee80211_sband_iftype_data *)he_capa_5ghz; ++- } else { +++ break; +++ default: ++ return; ++ } ++ ++@@ -3265,6 +3269,12 @@ static int mac80211_hwsim_new_radio(stru ++ sband->vht_cap.vht_mcs.tx_mcs_map = ++ sband->vht_cap.vht_mcs.rx_mcs_map; ++ break; +++ case NL80211_BAND_6GHZ: +++ sband->channels = data->channels_6ghz; +++ sband->n_channels = ARRAY_SIZE(hwsim_channels_6ghz); +++ sband->bitrates = data->rates + 4; +++ sband->n_bitrates = ARRAY_SIZE(hwsim_rates) - 4; +++ break; ++ case NL80211_BAND_S1GHZ: ++ memcpy(&sband->s1g_cap, &hwsim_s1g_cap, ++ sizeof(sband->s1g_cap)); ++@@ -3275,6 +3285,13 @@ static int mac80211_hwsim_new_radio(stru ++ continue; ++ } ++ +++ mac80211_hwsim_he_capab(sband); +++ +++ hw->wiphy->bands[band] = sband; +++ +++ if (band == NL80211_BAND_6GHZ) +++ continue; +++ ++ sband->ht_cap.ht_supported = true; ++ sband->ht_cap.cap = IEEE80211_HT_CAP_SUP_WIDTH_20_40 | ++ IEEE80211_HT_CAP_GRN_FLD | ++@@ -3288,10 +3305,6 @@ static int mac80211_hwsim_new_radio(stru ++ sband->ht_cap.mcs.rx_mask[0] = 0xff; ++ sband->ht_cap.mcs.rx_mask[1] = 0xff; ++ sband->ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED; ++- ++- mac80211_hwsim_he_capab(sband); ++- ++- hw->wiphy->bands[band] = sband; ++ } ++ ++ /* By default all radios belong to the first group */ +diff --git a/package/kernel/mac80211/patches/subsys/353-mac80211-minstrel_ht-fix-MINSTREL_FRAC-macro.patch b/package/kernel/mac80211/patches/subsys/353-mac80211-minstrel_ht-fix-MINSTREL_FRAC-macro.patch +new file mode 100644 +index 0000000000..0d475b7329 +--- /dev/null ++++ b/package/kernel/mac80211/patches/subsys/353-mac80211-minstrel_ht-fix-MINSTREL_FRAC-macro.patch +@@ -0,0 +1,21 @@ ++From: Felix Fietkau ++Date: Wed, 28 Apr 2021 21:03:13 +0200 ++Subject: [PATCH] mac80211: minstrel_ht: fix MINSTREL_FRAC macro ++ ++Add missing braces to avoid issues with e.g. using additions in the ++div expression ++ ++Signed-off-by: Felix Fietkau ++--- ++ ++--- a/net/mac80211/rc80211_minstrel_ht.h +++++ b/net/mac80211/rc80211_minstrel_ht.h ++@@ -14,7 +14,7 @@ ++ ++ /* scaled fraction values */ ++ #define MINSTREL_SCALE 12 ++-#define MINSTREL_FRAC(val, div) (((val) << MINSTREL_SCALE) / div) +++#define MINSTREL_FRAC(val, div) (((val) << MINSTREL_SCALE) / (div)) ++ #define MINSTREL_TRUNC(val) ((val) >> MINSTREL_SCALE) ++ ++ #define EWMA_LEVEL 96 /* ewma weighting factor [/EWMA_DIV] */ +diff --git a/package/kernel/mac80211/patches/subsys/370-mac80211-fix-TXQ-AC-confusion.patch b/package/kernel/mac80211/patches/subsys/370-mac80211-fix-TXQ-AC-confusion.patch +deleted file mode 100644 +index 0b7c8dd49b..0000000000 +--- a/package/kernel/mac80211/patches/subsys/370-mac80211-fix-TXQ-AC-confusion.patch ++++ /dev/null +@@ -1,61 +0,0 @@ +-From: Johannes Berg +-Date: Tue, 23 Mar 2021 21:05:01 +0100 +-Subject: [PATCH] mac80211: fix TXQ AC confusion +- +-Normally, TXQs have +- +- txq->tid = tid; +- txq->ac = ieee80211_ac_from_tid(tid); +- +-However, the special management TXQ actually has +- +- txq->tid = IEEE80211_NUM_TIDS; // 16 +- txq->ac = IEEE80211_AC_VO; +- +-This makes sense, but ieee80211_ac_from_tid(16) is the same +-as ieee80211_ac_from_tid(0) which is just IEEE80211_AC_BE. +- +-Now, normally this is fine. However, if the netdev queues +-were stopped, then the code in ieee80211_tx_dequeue() will +-propagate the stop from the interface (vif->txqs_stopped[]) +-if the AC 2 (ieee80211_ac_from_tid(txq->tid)) is marked as +-stopped. On wake, however, __ieee80211_wake_txqs() will wake +-the TXQ if AC 0 (txq->ac) is woken up. +- +-If a driver stops all queues with ieee80211_stop_tx_queues() +-and then wakes them again with ieee80211_wake_tx_queues(), +-the ieee80211_wake_txqs() tasklet will run to resync queue +-and TXQ state. If all queues were woken, then what'll happen +-is that _ieee80211_wake_txqs() will run in order of HW queues +-0-3, typically (and certainly for iwlwifi) corresponding to +-ACs 0-3, so it'll call __ieee80211_wake_txqs() for each AC in +-order 0-3. +- +-When __ieee80211_wake_txqs() is called for AC 0 (VO) that'll +-wake up the management TXQ (remember its tid is 16), and the +-driver's wake_tx_queue() will be called. That tries to get a +-frame, which will immediately *stop* the TXQ again, because +-now we check against AC 2, and AC 2 hasn't yet been marked as +-woken up again in sdata->vif.txqs_stopped[] since we're only +-in the __ieee80211_wake_txqs() call for AC 0. +- +-Thus, the management TXQ will never be started again. +- +-Fix this by checking txq->ac directly instead of calculating +-the AC as ieee80211_ac_from_tid(txq->tid). +- +-Fixes: adf8ed01e4fd ("mac80211: add an optional TXQ for other PS-buffered frames") +-Signed-off-by: Johannes Berg +---- +- +---- a/net/mac80211/tx.c +-+++ b/net/mac80211/tx.c +-@@ -3589,7 +3589,7 @@ begin: +- test_bit(IEEE80211_TXQ_STOP_NETIF_TX, &txqi->flags)) +- goto out; +- +-- if (vif->txqs_stopped[ieee80211_ac_from_tid(txq->tid)]) { +-+ if (vif->txqs_stopped[txq->ac]) { +- set_bit(IEEE80211_TXQ_STOP_NETIF_TX, &txqi->flags); +- goto out; +- } +diff --git a/package/kernel/mac80211/patches/subsys/374-mac80211-fix-time-is-after-bug-in-mlme.patch b/package/kernel/mac80211/patches/subsys/374-mac80211-fix-time-is-after-bug-in-mlme.patch +deleted file mode 100644 +index 0573aece64..0000000000 +--- a/package/kernel/mac80211/patches/subsys/374-mac80211-fix-time-is-after-bug-in-mlme.patch ++++ /dev/null +@@ -1,31 +0,0 @@ +-From: Ben Greear +-Date: Tue, 30 Mar 2021 16:07:49 -0700 +-Subject: [PATCH] mac80211: fix time-is-after bug in mlme +- +-The incorrect timeout check caused probing to happen when it did +-not need to happen. This in turn caused tx performance drop +-for around 5 seconds in ath10k-ct driver. Possibly that tx drop +-is due to a secondary issue, but fixing the probe to not happen +-when traffic is running fixes the symptom. +- +-Signed-off-by: Ben Greear +-Fixes: 9abf4e49830d ("mac80211: optimize station connection monitor") +-Acked-by: Felix Fietkau +-Link: https://lore.kernel.org/r/20210330230749.14097-1-greearb@candelatech.com +-Signed-off-by: Johannes Berg +---- +- +---- a/net/mac80211/mlme.c +-+++ b/net/mac80211/mlme.c +-@@ -4691,7 +4691,10 @@ static void ieee80211_sta_conn_mon_timer +- timeout = sta->rx_stats.last_rx; +- timeout += IEEE80211_CONNECTION_IDLE_TIME; +- +-- if (time_is_before_jiffies(timeout)) { +-+ /* If timeout is after now, then update timer to fire at +-+ * the later date, but do not actually probe at this time. +-+ */ +-+ if (time_is_after_jiffies(timeout)) { +- mod_timer(&ifmgd->conn_mon_timer, round_jiffies_up(timeout)); +- return; +- } +diff --git a/package/kernel/mac80211/patches/subsys/380-mac80211-assure-all-fragments-are-encrypted.patch b/package/kernel/mac80211/patches/subsys/380-mac80211-assure-all-fragments-are-encrypted.patch +new file mode 100644 +index 0000000000..69398459f1 +--- /dev/null ++++ b/package/kernel/mac80211/patches/subsys/380-mac80211-assure-all-fragments-are-encrypted.patch +@@ -0,0 +1,69 @@ ++From: Mathy Vanhoef ++Date: Tue, 11 May 2021 20:02:42 +0200 ++Subject: [PATCH] mac80211: assure all fragments are encrypted ++ ++Do not mix plaintext and encrypted fragments in protected Wi-Fi ++networks. This fixes CVE-2020-26147. ++ ++Previously, an attacker was able to first forward a legitimate encrypted ++fragment towards a victim, followed by a plaintext fragment. The ++encrypted and plaintext fragment would then be reassembled. For further ++details see Section 6.3 and Appendix D in the paper "Fragment and Forge: ++Breaking Wi-Fi Through Frame Aggregation and Fragmentation". ++ ++Because of this change there are now two equivalent conditions in the ++code to determine if a received fragment requires sequential PNs, so we ++also move this test to a separate function to make the code easier to ++maintain. ++ ++Cc: stable@vger.kernel.org ++Signed-off-by: Mathy Vanhoef ++Signed-off-by: Johannes Berg ++--- ++ ++--- a/net/mac80211/rx.c +++++ b/net/mac80211/rx.c ++@@ -2204,6 +2204,16 @@ ieee80211_reassemble_find(struct ieee802 ++ return NULL; ++ } ++ +++static bool requires_sequential_pn(struct ieee80211_rx_data *rx, __le16 fc) +++{ +++ return rx->key && +++ (rx->key->conf.cipher == WLAN_CIPHER_SUITE_CCMP || +++ rx->key->conf.cipher == WLAN_CIPHER_SUITE_CCMP_256 || +++ rx->key->conf.cipher == WLAN_CIPHER_SUITE_GCMP || +++ rx->key->conf.cipher == WLAN_CIPHER_SUITE_GCMP_256) && +++ ieee80211_has_protected(fc); +++} +++ ++ static ieee80211_rx_result debug_noinline ++ ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx) ++ { ++@@ -2248,12 +2258,7 @@ ieee80211_rx_h_defragment(struct ieee802 ++ /* This is the first fragment of a new frame. */ ++ entry = ieee80211_reassemble_add(rx->sdata, frag, seq, ++ rx->seqno_idx, &(rx->skb)); ++- if (rx->key && ++- (rx->key->conf.cipher == WLAN_CIPHER_SUITE_CCMP || ++- rx->key->conf.cipher == WLAN_CIPHER_SUITE_CCMP_256 || ++- rx->key->conf.cipher == WLAN_CIPHER_SUITE_GCMP || ++- rx->key->conf.cipher == WLAN_CIPHER_SUITE_GCMP_256) && ++- ieee80211_has_protected(fc)) { +++ if (requires_sequential_pn(rx, fc)) { ++ int queue = rx->security_idx; ++ ++ /* Store CCMP/GCMP PN so that we can verify that the ++@@ -2295,11 +2300,7 @@ ieee80211_rx_h_defragment(struct ieee802 ++ u8 pn[IEEE80211_CCMP_PN_LEN], *rpn; ++ int queue; ++ ++- if (!rx->key || ++- (rx->key->conf.cipher != WLAN_CIPHER_SUITE_CCMP && ++- rx->key->conf.cipher != WLAN_CIPHER_SUITE_CCMP_256 && ++- rx->key->conf.cipher != WLAN_CIPHER_SUITE_GCMP && ++- rx->key->conf.cipher != WLAN_CIPHER_SUITE_GCMP_256)) +++ if (!requires_sequential_pn(rx, fc)) ++ return RX_DROP_UNUSABLE; ++ memcpy(pn, entry->last_pn, IEEE80211_CCMP_PN_LEN); ++ for (i = IEEE80211_CCMP_PN_LEN - 1; i >= 0; i--) { +diff --git a/package/kernel/mac80211/patches/subsys/381-mac80211-prevent-mixed-key-and-fragment-cache-attack.patch b/package/kernel/mac80211/patches/subsys/381-mac80211-prevent-mixed-key-and-fragment-cache-attack.patch +new file mode 100644 +index 0000000000..de0f89a5b0 +--- /dev/null ++++ b/package/kernel/mac80211/patches/subsys/381-mac80211-prevent-mixed-key-and-fragment-cache-attack.patch +@@ -0,0 +1,87 @@ ++From: Mathy Vanhoef ++Date: Tue, 11 May 2021 20:02:43 +0200 ++Subject: [PATCH] mac80211: prevent mixed key and fragment cache attacks ++ ++Simultaneously prevent mixed key attacks (CVE-2020-24587) and fragment ++cache attacks (CVE-2020-24586). This is accomplished by assigning a ++unique color to every key (per interface) and using this to track which ++key was used to decrypt a fragment. When reassembling frames, it is ++now checked whether all fragments were decrypted using the same key. ++ ++To assure that fragment cache attacks are also prevented, the ID that is ++assigned to keys is unique even over (re)associations and (re)connects. ++This means fragments separated by a (re)association or (re)connect will ++not be reassembled. Because mac80211 now also prevents the reassembly of ++mixed encrypted and plaintext fragments, all cache attacks are prevented. ++ ++Cc: stable@vger.kernel.org ++Signed-off-by: Mathy Vanhoef ++Signed-off-by: Johannes Berg ++--- ++ ++--- a/net/mac80211/ieee80211_i.h +++++ b/net/mac80211/ieee80211_i.h ++@@ -97,6 +97,7 @@ struct ieee80211_fragment_entry { ++ u8 rx_queue; ++ bool check_sequential_pn; /* needed for CCMP/GCMP */ ++ u8 last_pn[6]; /* PN of the last fragment if CCMP was used */ +++ unsigned int key_color; ++ }; ++ ++ ++--- a/net/mac80211/key.c +++++ b/net/mac80211/key.c ++@@ -799,6 +799,7 @@ int ieee80211_key_link(struct ieee80211_ ++ struct ieee80211_sub_if_data *sdata, ++ struct sta_info *sta) ++ { +++ static atomic_t key_color = ATOMIC_INIT(0); ++ struct ieee80211_key *old_key; ++ int idx = key->conf.keyidx; ++ bool pairwise = key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE; ++@@ -850,6 +851,12 @@ int ieee80211_key_link(struct ieee80211_ ++ key->sdata = sdata; ++ key->sta = sta; ++ +++ /* +++ * Assign a unique ID to every key so we can easily prevent mixed +++ * key and fragment cache attacks. +++ */ +++ key->color = atomic_inc_return(&key_color); +++ ++ increment_tailroom_need_count(sdata); ++ ++ ret = ieee80211_key_replace(sdata, sta, pairwise, old_key, key); ++--- a/net/mac80211/key.h +++++ b/net/mac80211/key.h ++@@ -128,6 +128,8 @@ struct ieee80211_key { ++ } debugfs; ++ #endif ++ +++ unsigned int color; +++ ++ /* ++ * key config, must be last because it contains key ++ * material as variable length member ++--- a/net/mac80211/rx.c +++++ b/net/mac80211/rx.c ++@@ -2265,6 +2265,7 @@ ieee80211_rx_h_defragment(struct ieee802 ++ * next fragment has a sequential PN value. ++ */ ++ entry->check_sequential_pn = true; +++ entry->key_color = rx->key->color; ++ memcpy(entry->last_pn, ++ rx->key->u.ccmp.rx_pn[queue], ++ IEEE80211_CCMP_PN_LEN); ++@@ -2302,6 +2303,11 @@ ieee80211_rx_h_defragment(struct ieee802 ++ ++ if (!requires_sequential_pn(rx, fc)) ++ return RX_DROP_UNUSABLE; +++ +++ /* Prevent mixed key and fragment cache attacks */ +++ if (entry->key_color != rx->key->color) +++ return RX_DROP_UNUSABLE; +++ ++ memcpy(pn, entry->last_pn, IEEE80211_CCMP_PN_LEN); ++ for (i = IEEE80211_CCMP_PN_LEN - 1; i >= 0; i--) { ++ pn[i]++; +diff --git a/package/kernel/mac80211/patches/subsys/382-mac80211-properly-handle-A-MSDUs-that-start-with-an-.patch b/package/kernel/mac80211/patches/subsys/382-mac80211-properly-handle-A-MSDUs-that-start-with-an-.patch +new file mode 100644 +index 0000000000..d59fa05091 +--- /dev/null ++++ b/package/kernel/mac80211/patches/subsys/382-mac80211-properly-handle-A-MSDUs-that-start-with-an-.patch +@@ -0,0 +1,66 @@ ++From: Mathy Vanhoef ++Date: Tue, 11 May 2021 20:02:44 +0200 ++Subject: [PATCH] mac80211: properly handle A-MSDUs that start with an ++ RFC 1042 header ++ ++Properly parse A-MSDUs whose first 6 bytes happen to equal a rfc1042 ++header. This can occur in practice when the destination MAC address ++equals AA:AA:03:00:00:00. More importantly, this simplifies the next ++patch to mitigate A-MSDU injection attacks. ++ ++Cc: stable@vger.kernel.org ++Signed-off-by: Mathy Vanhoef ++Signed-off-by: Johannes Berg ++--- ++ ++--- a/include/net/cfg80211.h +++++ b/include/net/cfg80211.h ++@@ -5637,7 +5637,7 @@ unsigned int ieee80211_get_mesh_hdrlen(s ++ */ ++ int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr, ++ const u8 *addr, enum nl80211_iftype iftype, ++- u8 data_offset); +++ u8 data_offset, bool is_amsdu); ++ ++ /** ++ * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3 ++@@ -5649,7 +5649,7 @@ int ieee80211_data_to_8023_exthdr(struct ++ static inline int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr, ++ enum nl80211_iftype iftype) ++ { ++- return ieee80211_data_to_8023_exthdr(skb, NULL, addr, iftype, 0); +++ return ieee80211_data_to_8023_exthdr(skb, NULL, addr, iftype, 0, false); ++ } ++ ++ /** ++--- a/net/mac80211/rx.c +++++ b/net/mac80211/rx.c ++@@ -2696,7 +2696,7 @@ __ieee80211_rx_h_amsdu(struct ieee80211_ ++ if (ieee80211_data_to_8023_exthdr(skb, ðhdr, ++ rx->sdata->vif.addr, ++ rx->sdata->vif.type, ++- data_offset)) +++ data_offset, true)) ++ return RX_DROP_UNUSABLE; ++ ++ ieee80211_amsdu_to_8023s(skb, &frame_list, dev->dev_addr, ++--- a/net/wireless/util.c +++++ b/net/wireless/util.c ++@@ -541,7 +541,7 @@ EXPORT_SYMBOL(ieee80211_get_mesh_hdrlen) ++ ++ int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr, ++ const u8 *addr, enum nl80211_iftype iftype, ++- u8 data_offset) +++ u8 data_offset, bool is_amsdu) ++ { ++ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; ++ struct { ++@@ -629,7 +629,7 @@ int ieee80211_data_to_8023_exthdr(struct ++ skb_copy_bits(skb, hdrlen, &payload, sizeof(payload)); ++ tmp.h_proto = payload.proto; ++ ++- if (likely((ether_addr_equal(payload.hdr, rfc1042_header) && +++ if (likely((!is_amsdu && ether_addr_equal(payload.hdr, rfc1042_header) && ++ tmp.h_proto != htons(ETH_P_AARP) && ++ tmp.h_proto != htons(ETH_P_IPX)) || ++ ether_addr_equal(payload.hdr, bridge_tunnel_header))) +diff --git a/package/kernel/mac80211/patches/subsys/383-cfg80211-mitigate-A-MSDU-aggregation-attacks.patch b/package/kernel/mac80211/patches/subsys/383-cfg80211-mitigate-A-MSDU-aggregation-attacks.patch +new file mode 100644 +index 0000000000..8ea78dca84 +--- /dev/null ++++ b/package/kernel/mac80211/patches/subsys/383-cfg80211-mitigate-A-MSDU-aggregation-attacks.patch +@@ -0,0 +1,40 @@ ++From: Mathy Vanhoef ++Date: Tue, 11 May 2021 20:02:45 +0200 ++Subject: [PATCH] cfg80211: mitigate A-MSDU aggregation attacks ++ ++Mitigate A-MSDU injection attacks (CVE-2020-24588) by detecting if the ++destination address of a subframe equals an RFC1042 (i.e., LLC/SNAP) ++header, and if so dropping the complete A-MSDU frame. This mitigates ++known attacks, although new (unknown) aggregation-based attacks may ++remain possible. ++ ++This defense works because in A-MSDU aggregation injection attacks, a ++normal encrypted Wi-Fi frame is turned into an A-MSDU frame. This means ++the first 6 bytes of the first A-MSDU subframe correspond to an RFC1042 ++header. In other words, the destination MAC address of the first A-MSDU ++subframe contains the start of an RFC1042 header during an aggregation ++attack. We can detect this and thereby prevent this specific attack. ++For details, see Section 7.2 of "Fragment and Forge: Breaking Wi-Fi ++Through Frame Aggregation and Fragmentation". ++ ++Note that for kernel 4.9 and above this patch depends on "mac80211: ++properly handle A-MSDUs that start with a rfc1042 header". Otherwise ++this patch has no impact and attacks will remain possible. ++ ++Cc: stable@vger.kernel.org ++Signed-off-by: Mathy Vanhoef ++Signed-off-by: Johannes Berg ++--- ++ ++--- a/net/wireless/util.c +++++ b/net/wireless/util.c ++@@ -775,6 +775,9 @@ void ieee80211_amsdu_to_8023s(struct sk_ ++ remaining = skb->len - offset; ++ if (subframe_len > remaining) ++ goto purge; +++ /* mitigate A-MSDU aggregation injection attacks */ +++ if (ether_addr_equal(eth.h_dest, rfc1042_header)) +++ goto purge; ++ ++ offset += sizeof(struct ethhdr); ++ last = remaining <= subframe_len + padding; +diff --git a/package/kernel/mac80211/patches/subsys/384-mac80211-drop-A-MSDUs-on-old-ciphers.patch b/package/kernel/mac80211/patches/subsys/384-mac80211-drop-A-MSDUs-on-old-ciphers.patch +new file mode 100644 +index 0000000000..1b5084c37d +--- /dev/null ++++ b/package/kernel/mac80211/patches/subsys/384-mac80211-drop-A-MSDUs-on-old-ciphers.patch +@@ -0,0 +1,54 @@ ++From: Johannes Berg ++Date: Tue, 11 May 2021 20:02:46 +0200 ++Subject: [PATCH] mac80211: drop A-MSDUs on old ciphers ++ ++With old ciphers (WEP and TKIP) we shouldn't be using A-MSDUs ++since A-MSDUs are only supported if we know that they are, and ++the only practical way for that is HT support which doesn't ++support old ciphers. ++ ++However, we would normally accept them anyway. Since we check ++the MMIC before deaggregating A-MSDUs, and the A-MSDU bit in ++the QoS header is not protected in TKIP (or WEP), this enables ++attacks similar to CVE-2020-24588. To prevent that, drop A-MSDUs ++completely with old ciphers. ++ ++Cc: stable@vger.kernel.org ++Signed-off-by: Johannes Berg ++--- ++ ++--- a/net/mac80211/rx.c +++++ b/net/mac80211/rx.c ++@@ -6,7 +6,7 @@ ++ * Copyright 2007-2010 Johannes Berg ++ * Copyright 2013-2014 Intel Mobile Communications GmbH ++ * Copyright(c) 2015 - 2017 Intel Deutschland GmbH ++- * Copyright (C) 2018-2020 Intel Corporation +++ * Copyright (C) 2018-2021 Intel Corporation ++ */ ++ ++ #include ++@@ -2753,6 +2753,23 @@ ieee80211_rx_h_amsdu(struct ieee80211_rx ++ if (is_multicast_ether_addr(hdr->addr1)) ++ return RX_DROP_UNUSABLE; ++ +++ if (rx->key) { +++ /* +++ * We should not receive A-MSDUs on pre-HT connections, +++ * and HT connections cannot use old ciphers. Thus drop +++ * them, as in those cases we couldn't even have SPP +++ * A-MSDUs or such. +++ */ +++ switch (rx->key->conf.cipher) { +++ case WLAN_CIPHER_SUITE_WEP40: +++ case WLAN_CIPHER_SUITE_WEP104: +++ case WLAN_CIPHER_SUITE_TKIP: +++ return RX_DROP_UNUSABLE; +++ default: +++ break; +++ } +++ } +++ ++ return __ieee80211_rx_h_amsdu(rx, 0); ++ } ++ +diff --git a/package/kernel/mac80211/patches/subsys/385-mac80211-add-fragment-cache-to-sta_info.patch b/package/kernel/mac80211/patches/subsys/385-mac80211-add-fragment-cache-to-sta_info.patch +new file mode 100644 +index 0000000000..b536126d38 +--- /dev/null ++++ b/package/kernel/mac80211/patches/subsys/385-mac80211-add-fragment-cache-to-sta_info.patch +@@ -0,0 +1,313 @@ ++From: Johannes Berg ++Date: Tue, 11 May 2021 20:02:47 +0200 ++Subject: [PATCH] mac80211: add fragment cache to sta_info ++ ++Prior patches protected against fragmentation cache attacks ++by coloring keys, but this shows that it can lead to issues ++when multiple stations use the same sequence number. Add a ++fragment cache to struct sta_info (in addition to the one in ++the interface) to separate fragments for different stations ++properly. ++ ++This then automatically clear most of the fragment cache when a ++station disconnects (or reassociates) from an AP, or when client ++interfaces disconnect from the network, etc. ++ ++On the way, also fix the comment there since this brings us in line ++with the recommendation in 802.11-2016 ("An AP should support ..."). ++Additionally, remove a useless condition (since there's no problem ++purging an already empty list). ++ ++Cc: stable@vger.kernel.org ++Signed-off-by: Johannes Berg ++--- ++ ++--- a/net/mac80211/ieee80211_i.h +++++ b/net/mac80211/ieee80211_i.h ++@@ -50,12 +50,6 @@ struct ieee80211_local; ++ #define IEEE80211_ENCRYPT_HEADROOM 8 ++ #define IEEE80211_ENCRYPT_TAILROOM 18 ++ ++-/* IEEE 802.11 (Ch. 9.5 Defragmentation) requires support for concurrent ++- * reception of at least three fragmented frames. This limit can be increased ++- * by changing this define, at the cost of slower frame reassembly and ++- * increased memory use (about 2 kB of RAM per entry). */ ++-#define IEEE80211_FRAGMENT_MAX 4 ++- ++ /* power level hasn't been configured (or set to automatic) */ ++ #define IEEE80211_UNSET_POWER_LEVEL INT_MIN ++ ++@@ -88,19 +82,6 @@ extern const u8 ieee80211_ac_to_qos_mask ++ ++ #define IEEE80211_MAX_NAN_INSTANCE_ID 255 ++ ++-struct ieee80211_fragment_entry { ++- struct sk_buff_head skb_list; ++- unsigned long first_frag_time; ++- u16 seq; ++- u16 extra_len; ++- u16 last_frag; ++- u8 rx_queue; ++- bool check_sequential_pn; /* needed for CCMP/GCMP */ ++- u8 last_pn[6]; /* PN of the last fragment if CCMP was used */ ++- unsigned int key_color; ++-}; ++- ++- ++ struct ieee80211_bss { ++ u32 device_ts_beacon, device_ts_presp; ++ ++@@ -912,9 +893,7 @@ struct ieee80211_sub_if_data { ++ ++ char name[IFNAMSIZ]; ++ ++- /* Fragment table for host-based reassembly */ ++- struct ieee80211_fragment_entry fragments[IEEE80211_FRAGMENT_MAX]; ++- unsigned int fragment_next; +++ struct ieee80211_fragment_cache frags; ++ ++ /* TID bitmap for NoAck policy */ ++ u16 noack_map; ++@@ -2329,4 +2308,7 @@ u32 ieee80211_calc_expected_tx_airtime(s ++ #define debug_noinline ++ #endif ++ +++void ieee80211_init_frag_cache(struct ieee80211_fragment_cache *cache); +++void ieee80211_destroy_frag_cache(struct ieee80211_fragment_cache *cache); +++ ++ #endif /* IEEE80211_I_H */ ++--- a/net/mac80211/iface.c +++++ b/net/mac80211/iface.c ++@@ -8,7 +8,7 @@ ++ * Copyright 2008, Johannes Berg ++ * Copyright 2013-2014 Intel Mobile Communications GmbH ++ * Copyright (c) 2016 Intel Deutschland GmbH ++- * Copyright (C) 2018-2020 Intel Corporation +++ * Copyright (C) 2018-2021 Intel Corporation ++ */ ++ #include ++ #include ++@@ -679,16 +679,12 @@ static void ieee80211_set_multicast_list ++ */ ++ static void ieee80211_teardown_sdata(struct ieee80211_sub_if_data *sdata) ++ { ++- int i; ++- ++ /* free extra data */ ++ ieee80211_free_keys(sdata, false); ++ ++ ieee80211_debugfs_remove_netdev(sdata); ++ ++- for (i = 0; i < IEEE80211_FRAGMENT_MAX; i++) ++- __skb_queue_purge(&sdata->fragments[i].skb_list); ++- sdata->fragment_next = 0; +++ ieee80211_destroy_frag_cache(&sdata->frags); ++ ++ if (ieee80211_vif_is_mesh(&sdata->vif)) ++ ieee80211_mesh_teardown_sdata(sdata); ++@@ -2038,8 +2034,7 @@ int ieee80211_if_add(struct ieee80211_lo ++ sdata->wdev.wiphy = local->hw.wiphy; ++ sdata->local = local; ++ ++- for (i = 0; i < IEEE80211_FRAGMENT_MAX; i++) ++- skb_queue_head_init(&sdata->fragments[i].skb_list); +++ ieee80211_init_frag_cache(&sdata->frags); ++ ++ INIT_LIST_HEAD(&sdata->key_list); ++ ++--- a/net/mac80211/rx.c +++++ b/net/mac80211/rx.c ++@@ -2133,19 +2133,34 @@ ieee80211_rx_h_decrypt(struct ieee80211_ ++ return result; ++ } ++ +++void ieee80211_init_frag_cache(struct ieee80211_fragment_cache *cache) +++{ +++ int i; +++ +++ for (i = 0; i < ARRAY_SIZE(cache->entries); i++) +++ skb_queue_head_init(&cache->entries[i].skb_list); +++} +++ +++void ieee80211_destroy_frag_cache(struct ieee80211_fragment_cache *cache) +++{ +++ int i; +++ +++ for (i = 0; i < ARRAY_SIZE(cache->entries); i++) +++ __skb_queue_purge(&cache->entries[i].skb_list); +++} +++ ++ static inline struct ieee80211_fragment_entry * ++-ieee80211_reassemble_add(struct ieee80211_sub_if_data *sdata, +++ieee80211_reassemble_add(struct ieee80211_fragment_cache *cache, ++ unsigned int frag, unsigned int seq, int rx_queue, ++ struct sk_buff **skb) ++ { ++ struct ieee80211_fragment_entry *entry; ++ ++- entry = &sdata->fragments[sdata->fragment_next++]; ++- if (sdata->fragment_next >= IEEE80211_FRAGMENT_MAX) ++- sdata->fragment_next = 0; +++ entry = &cache->entries[cache->next++]; +++ if (cache->next >= IEEE80211_FRAGMENT_MAX) +++ cache->next = 0; ++ ++- if (!skb_queue_empty(&entry->skb_list)) ++- __skb_queue_purge(&entry->skb_list); +++ __skb_queue_purge(&entry->skb_list); ++ ++ __skb_queue_tail(&entry->skb_list, *skb); /* no need for locking */ ++ *skb = NULL; ++@@ -2160,14 +2175,14 @@ ieee80211_reassemble_add(struct ieee8021 ++ } ++ ++ static inline struct ieee80211_fragment_entry * ++-ieee80211_reassemble_find(struct ieee80211_sub_if_data *sdata, +++ieee80211_reassemble_find(struct ieee80211_fragment_cache *cache, ++ unsigned int frag, unsigned int seq, ++ int rx_queue, struct ieee80211_hdr *hdr) ++ { ++ struct ieee80211_fragment_entry *entry; ++ int i, idx; ++ ++- idx = sdata->fragment_next; +++ idx = cache->next; ++ for (i = 0; i < IEEE80211_FRAGMENT_MAX; i++) { ++ struct ieee80211_hdr *f_hdr; ++ struct sk_buff *f_skb; ++@@ -2176,7 +2191,7 @@ ieee80211_reassemble_find(struct ieee802 ++ if (idx < 0) ++ idx = IEEE80211_FRAGMENT_MAX - 1; ++ ++- entry = &sdata->fragments[idx]; +++ entry = &cache->entries[idx]; ++ if (skb_queue_empty(&entry->skb_list) || entry->seq != seq || ++ entry->rx_queue != rx_queue || ++ entry->last_frag + 1 != frag) ++@@ -2217,6 +2232,7 @@ static bool requires_sequential_pn(struc ++ static ieee80211_rx_result debug_noinline ++ ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx) ++ { +++ struct ieee80211_fragment_cache *cache = &rx->sdata->frags; ++ struct ieee80211_hdr *hdr; ++ u16 sc; ++ __le16 fc; ++@@ -2238,6 +2254,9 @@ ieee80211_rx_h_defragment(struct ieee802 ++ goto out_no_led; ++ } ++ +++ if (rx->sta) +++ cache = &rx->sta->frags; +++ ++ if (likely(!ieee80211_has_morefrags(fc) && frag == 0)) ++ goto out; ++ ++@@ -2256,7 +2275,7 @@ ieee80211_rx_h_defragment(struct ieee802 ++ ++ if (frag == 0) { ++ /* This is the first fragment of a new frame. */ ++- entry = ieee80211_reassemble_add(rx->sdata, frag, seq, +++ entry = ieee80211_reassemble_add(cache, frag, seq, ++ rx->seqno_idx, &(rx->skb)); ++ if (requires_sequential_pn(rx, fc)) { ++ int queue = rx->security_idx; ++@@ -2284,7 +2303,7 @@ ieee80211_rx_h_defragment(struct ieee802 ++ /* This is a fragment for a frame that should already be pending in ++ * fragment cache. Add this fragment to the end of the pending entry. ++ */ ++- entry = ieee80211_reassemble_find(rx->sdata, frag, seq, +++ entry = ieee80211_reassemble_find(cache, frag, seq, ++ rx->seqno_idx, hdr); ++ if (!entry) { ++ I802_DEBUG_INC(rx->local->rx_handlers_drop_defrag); ++--- a/net/mac80211/sta_info.c +++++ b/net/mac80211/sta_info.c ++@@ -4,7 +4,7 @@ ++ * Copyright 2006-2007 Jiri Benc ++ * Copyright 2013-2014 Intel Mobile Communications GmbH ++ * Copyright (C) 2015 - 2017 Intel Deutschland GmbH ++- * Copyright (C) 2018-2020 Intel Corporation +++ * Copyright (C) 2018-2021 Intel Corporation ++ */ ++ ++ #include ++@@ -393,6 +393,8 @@ struct sta_info *sta_info_alloc(struct i ++ ++ u64_stats_init(&sta->rx_stats.syncp); ++ +++ ieee80211_init_frag_cache(&sta->frags); +++ ++ sta->sta_state = IEEE80211_STA_NONE; ++ ++ /* Mark TID as unreserved */ ++@@ -1103,6 +1105,8 @@ static void __sta_info_destroy_part2(str ++ ++ ieee80211_sta_debugfs_remove(sta); ++ +++ ieee80211_destroy_frag_cache(&sta->frags); +++ ++ cleanup_single_sta(sta); ++ } ++ ++--- a/net/mac80211/sta_info.h +++++ b/net/mac80211/sta_info.h ++@@ -3,7 +3,7 @@ ++ * Copyright 2002-2005, Devicescape Software, Inc. ++ * Copyright 2013-2014 Intel Mobile Communications GmbH ++ * Copyright(c) 2015-2017 Intel Deutschland GmbH ++- * Copyright(c) 2020 Intel Corporation +++ * Copyright(c) 2020-2021 Intel Corporation ++ */ ++ ++ #ifndef STA_INFO_H ++@@ -439,6 +439,33 @@ struct ieee80211_sta_rx_stats { ++ }; ++ ++ /* +++ * IEEE 802.11-2016 (10.6 "Defragmentation") recommends support for "concurrent +++ * reception of at least one MSDU per access category per associated STA" +++ * on APs, or "at least one MSDU per access category" on other interface types. +++ * +++ * This limit can be increased by changing this define, at the cost of slower +++ * frame reassembly and increased memory use while fragments are pending. +++ */ +++#define IEEE80211_FRAGMENT_MAX 4 +++ +++struct ieee80211_fragment_entry { +++ struct sk_buff_head skb_list; +++ unsigned long first_frag_time; +++ u16 seq; +++ u16 extra_len; +++ u16 last_frag; +++ u8 rx_queue; +++ bool check_sequential_pn; /* needed for CCMP/GCMP */ +++ u8 last_pn[6]; /* PN of the last fragment if CCMP was used */ +++ unsigned int key_color; +++}; +++ +++struct ieee80211_fragment_cache { +++ struct ieee80211_fragment_entry entries[IEEE80211_FRAGMENT_MAX]; +++ unsigned int next; +++}; +++ +++/* ++ * The bandwidth threshold below which the per-station CoDel parameters will be ++ * scaled to be more lenient (to prevent starvation of slow stations). This ++ * value will be scaled by the number of active stations when it is being ++@@ -531,6 +558,7 @@ struct ieee80211_sta_rx_stats { ++ * @status_stats.last_ack_signal: last ACK signal ++ * @status_stats.ack_signal_filled: last ACK signal validity ++ * @status_stats.avg_ack_signal: average ACK signal +++ * @frags: fragment cache ++ */ ++ struct sta_info { ++ /* General information, mostly static */ ++@@ -639,6 +667,8 @@ struct sta_info { ++ ++ struct cfg80211_chan_def tdls_chandef; ++ +++ struct ieee80211_fragment_cache frags; +++ ++ /* keep last! */ ++ struct ieee80211_sta sta; ++ }; +diff --git a/package/kernel/mac80211/patches/subsys/386-mac80211-check-defrag-PN-against-current-frame.patch b/package/kernel/mac80211/patches/subsys/386-mac80211-check-defrag-PN-against-current-frame.patch +new file mode 100644 +index 0000000000..fb2747a609 +--- /dev/null ++++ b/package/kernel/mac80211/patches/subsys/386-mac80211-check-defrag-PN-against-current-frame.patch +@@ -0,0 +1,109 @@ ++From: Johannes Berg ++Date: Tue, 11 May 2021 20:02:48 +0200 ++Subject: [PATCH] mac80211: check defrag PN against current frame ++ ++As pointed out by Mathy Vanhoef, we implement the RX PN check ++on fragmented frames incorrectly - we check against the last ++received PN prior to the new frame, rather than to the one in ++this frame itself. ++ ++Prior patches addressed the security issue here, but in order ++to be able to reason better about the code, fix it to really ++compare against the current frame's PN, not the last stored ++one. ++ ++Cc: stable@vger.kernel.org ++Signed-off-by: Johannes Berg ++--- ++ ++--- a/net/mac80211/ieee80211_i.h +++++ b/net/mac80211/ieee80211_i.h ++@@ -227,8 +227,15 @@ struct ieee80211_rx_data { ++ */ ++ int security_idx; ++ ++- u32 tkip_iv32; ++- u16 tkip_iv16; +++ union { +++ struct { +++ u32 iv32; +++ u16 iv16; +++ } tkip; +++ struct { +++ u8 pn[IEEE80211_CCMP_PN_LEN]; +++ } ccm_gcm; +++ }; ++ }; ++ ++ struct ieee80211_csa_settings { ++--- a/net/mac80211/rx.c +++++ b/net/mac80211/rx.c ++@@ -2318,7 +2318,6 @@ ieee80211_rx_h_defragment(struct ieee802 ++ if (entry->check_sequential_pn) { ++ int i; ++ u8 pn[IEEE80211_CCMP_PN_LEN], *rpn; ++- int queue; ++ ++ if (!requires_sequential_pn(rx, fc)) ++ return RX_DROP_UNUSABLE; ++@@ -2333,8 +2332,8 @@ ieee80211_rx_h_defragment(struct ieee802 ++ if (pn[i]) ++ break; ++ } ++- queue = rx->security_idx; ++- rpn = rx->key->u.ccmp.rx_pn[queue]; +++ +++ rpn = rx->ccm_gcm.pn; ++ if (memcmp(pn, rpn, IEEE80211_CCMP_PN_LEN)) ++ return RX_DROP_UNUSABLE; ++ memcpy(entry->last_pn, pn, IEEE80211_CCMP_PN_LEN); ++--- a/net/mac80211/wpa.c +++++ b/net/mac80211/wpa.c ++@@ -3,6 +3,7 @@ ++ * Copyright 2002-2004, Instant802 Networks, Inc. ++ * Copyright 2008, Jouni Malinen ++ * Copyright (C) 2016-2017 Intel Deutschland GmbH +++ * Copyright (C) 2020-2021 Intel Corporation ++ */ ++ ++ #include ++@@ -167,8 +168,8 @@ ieee80211_rx_h_michael_mic_verify(struct ++ ++ update_iv: ++ /* update IV in key information to be able to detect replays */ ++- rx->key->u.tkip.rx[rx->security_idx].iv32 = rx->tkip_iv32; ++- rx->key->u.tkip.rx[rx->security_idx].iv16 = rx->tkip_iv16; +++ rx->key->u.tkip.rx[rx->security_idx].iv32 = rx->tkip.iv32; +++ rx->key->u.tkip.rx[rx->security_idx].iv16 = rx->tkip.iv16; ++ ++ return RX_CONTINUE; ++ ++@@ -294,8 +295,8 @@ ieee80211_crypto_tkip_decrypt(struct iee ++ key, skb->data + hdrlen, ++ skb->len - hdrlen, rx->sta->sta.addr, ++ hdr->addr1, hwaccel, rx->security_idx, ++- &rx->tkip_iv32, ++- &rx->tkip_iv16); +++ &rx->tkip.iv32, +++ &rx->tkip.iv16); ++ if (res != TKIP_DECRYPT_OK) ++ return RX_DROP_UNUSABLE; ++ ++@@ -552,6 +553,8 @@ ieee80211_crypto_ccmp_decrypt(struct iee ++ } ++ ++ memcpy(key->u.ccmp.rx_pn[queue], pn, IEEE80211_CCMP_PN_LEN); +++ if (unlikely(ieee80211_is_frag(hdr))) +++ memcpy(rx->ccm_gcm.pn, pn, IEEE80211_CCMP_PN_LEN); ++ } ++ ++ /* Remove CCMP header and MIC */ ++@@ -782,6 +785,8 @@ ieee80211_crypto_gcmp_decrypt(struct iee ++ } ++ ++ memcpy(key->u.gcmp.rx_pn[queue], pn, IEEE80211_GCMP_PN_LEN); +++ if (unlikely(ieee80211_is_frag(hdr))) +++ memcpy(rx->ccm_gcm.pn, pn, IEEE80211_CCMP_PN_LEN); ++ } ++ ++ /* Remove GCMP header and MIC */ +diff --git a/package/kernel/mac80211/patches/subsys/387-mac80211-prevent-attacks-on-TKIP-WEP-as-well.patch b/package/kernel/mac80211/patches/subsys/387-mac80211-prevent-attacks-on-TKIP-WEP-as-well.patch +new file mode 100644 +index 0000000000..bc582a6cc2 +--- /dev/null ++++ b/package/kernel/mac80211/patches/subsys/387-mac80211-prevent-attacks-on-TKIP-WEP-as-well.patch +@@ -0,0 +1,62 @@ ++From: Johannes Berg ++Date: Tue, 11 May 2021 20:02:49 +0200 ++Subject: [PATCH] mac80211: prevent attacks on TKIP/WEP as well ++ ++Similar to the issues fixed in previous patches, TKIP and WEP ++should be protected even if for TKIP we have the Michael MIC ++protecting it, and WEP is broken anyway. ++ ++However, this also somewhat protects potential other algorithms ++that drivers might implement. ++ ++Cc: stable@vger.kernel.org ++Signed-off-by: Johannes Berg ++--- ++ ++--- a/net/mac80211/rx.c +++++ b/net/mac80211/rx.c ++@@ -2284,6 +2284,7 @@ ieee80211_rx_h_defragment(struct ieee802 ++ * next fragment has a sequential PN value. ++ */ ++ entry->check_sequential_pn = true; +++ entry->is_protected = true; ++ entry->key_color = rx->key->color; ++ memcpy(entry->last_pn, ++ rx->key->u.ccmp.rx_pn[queue], ++@@ -2296,6 +2297,9 @@ ieee80211_rx_h_defragment(struct ieee802 ++ sizeof(rx->key->u.gcmp.rx_pn[queue])); ++ BUILD_BUG_ON(IEEE80211_CCMP_PN_LEN != ++ IEEE80211_GCMP_PN_LEN); +++ } else if (rx->key && ieee80211_has_protected(fc)) { +++ entry->is_protected = true; +++ entry->key_color = rx->key->color; ++ } ++ return RX_QUEUED; ++ } ++@@ -2337,6 +2341,14 @@ ieee80211_rx_h_defragment(struct ieee802 ++ if (memcmp(pn, rpn, IEEE80211_CCMP_PN_LEN)) ++ return RX_DROP_UNUSABLE; ++ memcpy(entry->last_pn, pn, IEEE80211_CCMP_PN_LEN); +++ } else if (entry->is_protected && +++ (!rx->key || !ieee80211_has_protected(fc) || +++ rx->key->color != entry->key_color)) { +++ /* Drop this as a mixed key or fragment cache attack, even +++ * if for TKIP Michael MIC should protect us, and WEP is a +++ * lost cause anyway. +++ */ +++ return RX_DROP_UNUSABLE; ++ } ++ ++ skb_pull(rx->skb, ieee80211_hdrlen(fc)); ++--- a/net/mac80211/sta_info.h +++++ b/net/mac80211/sta_info.h ++@@ -455,7 +455,8 @@ struct ieee80211_fragment_entry { ++ u16 extra_len; ++ u16 last_frag; ++ u8 rx_queue; ++- bool check_sequential_pn; /* needed for CCMP/GCMP */ +++ u8 check_sequential_pn:1, /* needed for CCMP/GCMP */ +++ is_protected:1; ++ u8 last_pn[6]; /* PN of the last fragment if CCMP was used */ ++ unsigned int key_color; ++ }; +diff --git a/package/kernel/mac80211/patches/subsys/388-mac80211-do-not-accept-forward-invalid-EAPOL-frames.patch b/package/kernel/mac80211/patches/subsys/388-mac80211-do-not-accept-forward-invalid-EAPOL-frames.patch +new file mode 100644 +index 0000000000..9a0b78def1 +--- /dev/null ++++ b/package/kernel/mac80211/patches/subsys/388-mac80211-do-not-accept-forward-invalid-EAPOL-frames.patch +@@ -0,0 +1,94 @@ ++From: Johannes Berg ++Date: Tue, 11 May 2021 20:02:50 +0200 ++Subject: [PATCH] mac80211: do not accept/forward invalid EAPOL frames ++ ++EAPOL frames are used for authentication and key management between the ++AP and each individual STA associated in the BSS. Those frames are not ++supposed to be sent by one associated STA to another associated STA ++(either unicast for broadcast/multicast). ++ ++Similarly, in 802.11 they're supposed to be sent to the authenticator ++(AP) address. ++ ++Since it is possible for unexpected EAPOL frames to result in misbehavior ++in supplicant implementations, it is better for the AP to not allow such ++cases to be forwarded to other clients either directly, or indirectly if ++the AP interface is part of a bridge. ++ ++Accept EAPOL (control port) frames only if they're transmitted to the ++own address, or, due to interoperability concerns, to the PAE group ++address. ++ ++Disable forwarding of EAPOL (or well, the configured control port ++protocol) frames back to wireless medium in all cases. Previously, these ++frames were accepted from fully authenticated and authorized stations ++and also from unauthenticated stations for one of the cases. ++ ++Additionally, to avoid forwarding by the bridge, rewrite the PAE group ++address case to the local MAC address. ++ ++Cc: stable@vger.kernel.org ++Co-developed-by: Jouni Malinen ++Signed-off-by: Jouni Malinen ++Signed-off-by: Johannes Berg ++--- ++ ++--- a/net/mac80211/rx.c +++++ b/net/mac80211/rx.c ++@@ -2541,13 +2541,13 @@ static bool ieee80211_frame_allowed(stru ++ struct ethhdr *ehdr = (struct ethhdr *) rx->skb->data; ++ ++ /* ++- * Allow EAPOL frames to us/the PAE group address regardless ++- * of whether the frame was encrypted or not. +++ * Allow EAPOL frames to us/the PAE group address regardless of +++ * whether the frame was encrypted or not, and always disallow +++ * all other destination addresses for them. ++ */ ++- if (ehdr->h_proto == rx->sdata->control_port_protocol && ++- (ether_addr_equal(ehdr->h_dest, rx->sdata->vif.addr) || ++- ether_addr_equal(ehdr->h_dest, pae_group_addr))) ++- return true; +++ if (unlikely(ehdr->h_proto == rx->sdata->control_port_protocol)) +++ return ether_addr_equal(ehdr->h_dest, rx->sdata->vif.addr) || +++ ether_addr_equal(ehdr->h_dest, pae_group_addr); ++ ++ if (ieee80211_802_1x_port_control(rx) || ++ ieee80211_drop_unencrypted(rx, fc)) ++@@ -2572,8 +2572,28 @@ static void ieee80211_deliver_skb_to_loc ++ cfg80211_rx_control_port(dev, skb, noencrypt); ++ dev_kfree_skb(skb); ++ } else { +++ struct ethhdr *ehdr = (void *)skb_mac_header(skb); +++ ++ memset(skb->cb, 0, sizeof(skb->cb)); ++ +++ /* +++ * 802.1X over 802.11 requires that the authenticator address +++ * be used for EAPOL frames. However, 802.1X allows the use of +++ * the PAE group address instead. If the interface is part of +++ * a bridge and we pass the frame with the PAE group address, +++ * then the bridge will forward it to the network (even if the +++ * client was not associated yet), which isn't supposed to +++ * happen. +++ * To avoid that, rewrite the destination address to our own +++ * address, so that the authenticator (e.g. hostapd) will see +++ * the frame, but bridge won't forward it anywhere else. Note +++ * that due to earlier filtering, the only other address can +++ * be the PAE group address. +++ */ +++ if (unlikely(skb->protocol == sdata->control_port_protocol && +++ !ether_addr_equal(ehdr->h_dest, sdata->vif.addr))) +++ ether_addr_copy(ehdr->h_dest, sdata->vif.addr); +++ ++ /* deliver to local stack */ ++ if (rx->list) ++ #if LINUX_VERSION_IS_GEQ(4,19,0) ++@@ -2617,6 +2637,7 @@ ieee80211_deliver_skb(struct ieee80211_r ++ if ((sdata->vif.type == NL80211_IFTYPE_AP || ++ sdata->vif.type == NL80211_IFTYPE_AP_VLAN) && ++ !(sdata->flags & IEEE80211_SDATA_DONT_BRIDGE_PACKETS) && +++ ehdr->h_proto != rx->sdata->control_port_protocol && ++ (sdata->vif.type != NL80211_IFTYPE_AP_VLAN || !sdata->u.vlan.sta)) { ++ if (is_multicast_ether_addr(ehdr->h_dest) && ++ ieee80211_vif_get_num_mcast_if(sdata) != 0) { +diff --git a/package/kernel/mac80211/patches/subsys/389-mac80211-extend-protection-against-mixed-key-and-fra.patch b/package/kernel/mac80211/patches/subsys/389-mac80211-extend-protection-against-mixed-key-and-fra.patch +new file mode 100644 +index 0000000000..17809263e9 +--- /dev/null ++++ b/package/kernel/mac80211/patches/subsys/389-mac80211-extend-protection-against-mixed-key-and-fra.patch +@@ -0,0 +1,68 @@ ++From: Wen Gong ++Date: Tue, 11 May 2021 20:02:51 +0200 ++Subject: [PATCH] mac80211: extend protection against mixed key and ++ fragment cache attacks ++ ++For some chips/drivers, e.g., QCA6174 with ath10k, the decryption is ++done by the hardware, and the Protected bit in the Frame Control field ++is cleared in the lower level driver before the frame is passed to ++mac80211. In such cases, the condition for ieee80211_has_protected() is ++not met in ieee80211_rx_h_defragment() of mac80211 and the new security ++validation steps are not executed. ++ ++Extend mac80211 to cover the case where the Protected bit has been ++cleared, but the frame is indicated as having been decrypted by the ++hardware. This extends protection against mixed key and fragment cache ++attack for additional drivers/chips. This fixes CVE-2020-24586 and ++CVE-2020-24587 for such cases. ++ ++Tested-on: QCA6174 hw3.2 PCI WLAN.RM.4.4.1-00110-QCARMSWP-1 ++ ++Cc: stable@vger.kernel.org ++Signed-off-by: Wen Gong ++Signed-off-by: Jouni Malinen ++Signed-off-by: Johannes Berg ++--- ++ ++--- a/net/mac80211/rx.c +++++ b/net/mac80211/rx.c ++@@ -2239,6 +2239,7 @@ ieee80211_rx_h_defragment(struct ieee802 ++ unsigned int frag, seq; ++ struct ieee80211_fragment_entry *entry; ++ struct sk_buff *skb; +++ struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(rx->skb); ++ ++ hdr = (struct ieee80211_hdr *)rx->skb->data; ++ fc = hdr->frame_control; ++@@ -2297,7 +2298,9 @@ ieee80211_rx_h_defragment(struct ieee802 ++ sizeof(rx->key->u.gcmp.rx_pn[queue])); ++ BUILD_BUG_ON(IEEE80211_CCMP_PN_LEN != ++ IEEE80211_GCMP_PN_LEN); ++- } else if (rx->key && ieee80211_has_protected(fc)) { +++ } else if (rx->key && +++ (ieee80211_has_protected(fc) || +++ (status->flag & RX_FLAG_DECRYPTED))) { ++ entry->is_protected = true; ++ entry->key_color = rx->key->color; ++ } ++@@ -2342,13 +2345,19 @@ ieee80211_rx_h_defragment(struct ieee802 ++ return RX_DROP_UNUSABLE; ++ memcpy(entry->last_pn, pn, IEEE80211_CCMP_PN_LEN); ++ } else if (entry->is_protected && ++- (!rx->key || !ieee80211_has_protected(fc) || +++ (!rx->key || +++ (!ieee80211_has_protected(fc) && +++ !(status->flag & RX_FLAG_DECRYPTED)) || ++ rx->key->color != entry->key_color)) { ++ /* Drop this as a mixed key or fragment cache attack, even ++ * if for TKIP Michael MIC should protect us, and WEP is a ++ * lost cause anyway. ++ */ ++ return RX_DROP_UNUSABLE; +++ } else if (entry->is_protected && rx->key && +++ entry->key_color != rx->key->color && +++ (status->flag & RX_FLAG_DECRYPTED)) { +++ return RX_DROP_UNUSABLE; ++ } ++ ++ skb_pull(rx->skb, ieee80211_hdrlen(fc)); +diff --git a/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch b/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch +index 3d1bb3d6c8..febe42eb9d 100644 +--- a/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch ++++ b/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch +@@ -1,6 +1,6 @@ + --- a/include/net/cfg80211.h + +++ b/include/net/cfg80211.h +-@@ -3736,6 +3736,7 @@ struct mgmt_frame_regs { ++@@ -3745,6 +3745,7 @@ struct mgmt_frame_regs { + * (as advertised by the nl80211 feature flag.) + * @get_tx_power: store the current TX power into the dbm variable; + * return 0 if successful +@@ -8,7 +8,7 @@ + * + * @set_wds_peer: set the WDS peer for a WDS interface + * +-@@ -4058,6 +4059,7 @@ struct cfg80211_ops { ++@@ -4067,6 +4068,7 @@ struct cfg80211_ops { + enum nl80211_tx_power_setting type, int mbm); + int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev, + int *dbm); +@@ -36,7 +36,7 @@ + u8 ps_dtim_period; + --- a/include/uapi/linux/nl80211.h + +++ b/include/uapi/linux/nl80211.h +-@@ -2531,6 +2531,9 @@ enum nl80211_commands { ++@@ -2560,6 +2560,9 @@ enum nl80211_commands { + * disassoc events to indicate that an immediate reconnect to the AP + * is desired. + * +@@ -46,9 +46,9 @@ + * @NUM_NL80211_ATTR: total number of nl80211_attrs available + * @NL80211_ATTR_MAX: highest attribute number currently defined + * @__NL80211_ATTR_AFTER_LAST: internal use +-@@ -3022,6 +3025,8 @@ enum nl80211_attrs { ++@@ -3057,6 +3060,8 @@ enum nl80211_attrs { + +- NL80211_ATTR_RECONNECT_REQUESTED, ++ NL80211_ATTR_DISABLE_HE, + + + NL80211_ATTR_WIPHY_ANTENNA_GAIN, + + +@@ -57,7 +57,7 @@ + __NL80211_ATTR_AFTER_LAST, + --- a/net/mac80211/cfg.c + +++ b/net/mac80211/cfg.c +-@@ -2707,6 +2707,19 @@ static int ieee80211_get_tx_power(struct ++@@ -2709,6 +2709,19 @@ static int ieee80211_get_tx_power(struct + return 0; + } + +@@ -77,7 +77,7 @@ + static int ieee80211_set_wds_peer(struct wiphy *wiphy, struct net_device *dev, + const u8 *addr) + { +-@@ -4137,6 +4150,7 @@ const struct cfg80211_ops mac80211_confi ++@@ -4139,6 +4152,7 @@ const struct cfg80211_ops mac80211_confi + .set_wiphy_params = ieee80211_set_wiphy_params, + .set_tx_power = ieee80211_set_tx_power, + .get_tx_power = ieee80211_get_tx_power, +@@ -87,7 +87,7 @@ + CFG80211_TESTMODE_CMD(ieee80211_testmode_cmd) + --- a/net/mac80211/ieee80211_i.h + +++ b/net/mac80211/ieee80211_i.h +-@@ -1403,6 +1403,7 @@ struct ieee80211_local { ++@@ -1390,6 +1390,7 @@ struct ieee80211_local { + int dynamic_ps_forced_timeout; + + int user_power_level; /* in dBm, for all interfaces */ +@@ -129,15 +129,15 @@ + local->hw.max_mtu = IEEE80211_MAX_DATA_LEN; + --- a/net/wireless/nl80211.c + +++ b/net/wireless/nl80211.c +-@@ -733,6 +733,7 @@ static const struct nla_policy nl80211_p +- [NL80211_ATTR_S1G_CAPABILITY_MASK] = +- NLA_POLICY_EXACT_LEN(IEEE80211_S1G_CAPABILITY_LEN), ++@@ -740,6 +740,7 @@ static const struct nla_policy nl80211_p ++ NLA_POLICY_RANGE(NLA_U8, NL80211_SAE_PWE_HUNT_AND_PECK, ++ NL80211_SAE_PWE_BOTH), + [NL80211_ATTR_RECONNECT_REQUESTED] = { .type = NLA_REJECT }, + + [NL80211_ATTR_WIPHY_ANTENNA_GAIN] = { .type = NLA_U32 }, + }; + + /* policy for the key attributes */ +-@@ -3241,6 +3242,20 @@ static int nl80211_set_wiphy(struct sk_b ++@@ -3248,6 +3249,20 @@ static int nl80211_set_wiphy(struct sk_b + if (result) + return result; + } +-- +2.25.1 + diff --git a/backports/0039-hostapd-upsate-to-latest-HEAD.patch b/backports/0039-hostapd-upsate-to-latest-HEAD.patch new file mode 100644 index 000000000..17e63d2cf --- /dev/null +++ b/backports/0039-hostapd-upsate-to-latest-HEAD.patch @@ -0,0 +1,4896 @@ +From f6aa5e93e709cc71aa601b430936eb1b89bf6585 Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Thu, 27 May 2021 13:25:19 +0200 +Subject: [PATCH 01/31] hostapd: upsate to latest HEAD + +Signed-off-by: John Crispin +--- + package/network/services/hostapd/Makefile | 9 +- + .../hostapd/files/hostapd-basic.config | 2 +- + .../network/services/hostapd/files/hostapd.sh | 87 ++++-- + ...-fix-frequency-setup-with-HE-enabled.patch | 196 ------------- + .../001-wolfssl-init-RNG-with-ECC-key.patch | 43 +++ + ...-init-order-disable-pri-sec-channel-.patch | 126 --------- + ...andle-HT40-and-mode-downgrade-in-AP-.patch | 102 ------- + ...ix-frequency-config-for-non-p2p-vht-.patch | 63 ----- + ...nable-vht-and-he-in-default-config-p.patch | 25 -- + ...er-debug-messages-for-some-error-cas.patch | 83 ------ + ...lper-functions-for-vht-he-parameters.patch | 27 -- + ...ompletion-callback-to-complete-mesh-.patch | 108 -------- + ...-frequency-as-pri-sec-channel-switch.patch | 26 -- + ...hannels-to-be-selected-if-dfs-is-ena.patch | 10 +- + ...offchanok-on-DFS-channels-in-non-ETS.patch | 53 ---- + ...rministic-channel-on-channel-switch.patch} | 2 +- + ...-fix-channel-switch-error-during-CAC.patch | 66 ----- + ...rnel-driver-DFS-handler-in-userspace.patch | 48 ---- + .../014-mesh-fixes-for-mesh-init-deinit.patch | 158 ----------- + .../015-mesh-fix-DFS-deinit-init.patch | 262 ------------------ + ...sts-DFS-test-for-wpa_supplicant-mesh.patch | 94 ------- + .../patches/017-mesh-fix-mesh_oom-test.patch | 24 -- + ...ve-mesh-freq-setting-to-own-function.patch | 93 ------- + ...020-ignore-4addr-mode-enabling-error.patch | 78 ------ + ...0-mesh-make-forwarding-configurable.patch} | 28 +- + ...ix-sta-add-after-previous-connection.patch | 26 ++ + ...-case-in-peer-addition-based-on-PD-R.patch | 45 --- + .../patches/110-notify-mgmt-frames.patch | 116 -------- + .../patches/110-wolfssl-compile-fix.patch | 10 - + .../120-reconfigure-wps-credentials.patch | 178 ------------ + .../hostapd/patches/200-multicall.patch | 80 +++--- + .../services/hostapd/patches/300-noscan.patch | 6 +- + .../hostapd/patches/301-mesh-noscan.patch | 10 +- + .../patches/310-rescan_immediately.patch | 2 +- + .../hostapd/patches/320-optional_rfkill.patch | 8 +- + .../patches/330-nl80211_fix_set_freq.patch | 2 +- + .../patches/340-reload_freq_change.patch | 6 +- + .../341-mesh-ctrl-iface-channel-switch.patch | 2 +- + .../patches/350-nl80211_del_beacon_bss.patch | 12 +- + .../patches/360-ctrl_iface_reload.patch | 10 +- + .../hostapd/patches/370-ap_sta_support.patch | 67 ++--- + .../patches/380-disable_ctrl_iface_mib.patch | 34 +-- + .../patches/390-wpa_ie_cap_workaround.patch | 4 +- + .../patches/420-indicate-features.patch | 4 +- + .../patches/430-hostapd_cli_ifdef.patch | 4 +- + ...dd-new-config-params-to-be-used-with.patch | 8 +- + ...-use-new-parameters-during-ibss-join.patch | 4 +- + .../patches/463-add-mcast_rate-to-11s.patch | 10 +- + .../patches/464-fix-mesh-obss-check.patch | 2 +- + .../patches/470-survey_data_fallback.patch | 2 +- + .../patches/500-lto-jobserver-support.patch | 19 +- + .../hostapd/patches/600-ubus_support.patch | 125 ++++++--- + .../hostapd/patches/700-wifi-reload.patch | 51 ++-- + .../hostapd/patches/710-vlan_no_bridge.patch | 33 +++ + .../720-ACS-fix-channel-100-frequency.patch | 30 ++ + .../patches/720-iface_max_num_sta.patch | 82 ++++++ + ...ate-if-no-available-channel-is-found.patch | 37 --- + ...of-secondary-device-types-for-P2P-gr.patch | 33 --- + .../services/hostapd/src/src/ap/ubus.c | 70 ++++- + .../services/hostapd/src/src/ap/ubus.h | 16 ++ + 60 files changed, 654 insertions(+), 2307 deletions(-) + delete mode 100644 package/network/services/hostapd/patches/001-HE-VHT-fix-frequency-setup-with-HE-enabled.patch + create mode 100644 package/network/services/hostapd/patches/001-wolfssl-init-RNG-with-ECC-key.patch + delete mode 100644 package/network/services/hostapd/patches/002-mesh-fix-channel-init-order-disable-pri-sec-channel-.patch + delete mode 100644 package/network/services/hostapd/patches/003-wpa_supplicant-handle-HT40-and-mode-downgrade-in-AP-.patch + delete mode 100644 package/network/services/hostapd/patches/004-wpa_supplicant-fix-frequency-config-for-non-p2p-vht-.patch + delete mode 100644 package/network/services/hostapd/patches/005-wpa_supplicant-enable-vht-and-he-in-default-config-p.patch + delete mode 100644 package/network/services/hostapd/patches/006-hw_features-better-debug-messages-for-some-error-cas.patch + delete mode 100644 package/network/services/hostapd/patches/007-dfs-use-helper-functions-for-vht-he-parameters.patch + delete mode 100644 package/network/services/hostapd/patches/008-mesh-use-setup-completion-callback-to-complete-mesh-.patch + delete mode 100644 package/network/services/hostapd/patches/009-mesh-update-ssid-frequency-as-pri-sec-channel-switch.patch + delete mode 100644 package/network/services/hostapd/patches/011-mesh-do-not-set-offchanok-on-DFS-channels-in-non-ETS.patch + rename package/network/services/hostapd/patches/{019-mesh-use-deterministic-channel-on-channel-switch.patch => 011-mesh-use-deterministic-channel-on-channel-switch.patch} (97%) + delete mode 100644 package/network/services/hostapd/patches/012-mesh-fix-channel-switch-error-during-CAC.patch + delete mode 100644 package/network/services/hostapd/patches/013-mesh-inform-kernel-driver-DFS-handler-in-userspace.patch + delete mode 100644 package/network/services/hostapd/patches/014-mesh-fixes-for-mesh-init-deinit.patch + delete mode 100644 package/network/services/hostapd/patches/015-mesh-fix-DFS-deinit-init.patch + delete mode 100644 package/network/services/hostapd/patches/016-tests-DFS-test-for-wpa_supplicant-mesh.patch + delete mode 100644 package/network/services/hostapd/patches/017-mesh-fix-mesh_oom-test.patch + delete mode 100644 package/network/services/hostapd/patches/018-mesh-move-mesh-freq-setting-to-own-function.patch + delete mode 100644 package/network/services/hostapd/patches/020-ignore-4addr-mode-enabling-error.patch + rename package/network/services/hostapd/patches/{050-mesh-make-forwarding-configurable.patch => 020-mesh-make-forwarding-configurable.patch} (89%) + create mode 100644 package/network/services/hostapd/patches/021-fix-sta-add-after-previous-connection.patch + delete mode 100644 package/network/services/hostapd/patches/060-P2P-Fix-a-corner-case-in-peer-addition-based-on-PD-R.patch + delete mode 100644 package/network/services/hostapd/patches/110-notify-mgmt-frames.patch + delete mode 100644 package/network/services/hostapd/patches/110-wolfssl-compile-fix.patch + delete mode 100644 package/network/services/hostapd/patches/120-reconfigure-wps-credentials.patch + create mode 100644 package/network/services/hostapd/patches/710-vlan_no_bridge.patch + create mode 100644 package/network/services/hostapd/patches/720-ACS-fix-channel-100-frequency.patch + create mode 100644 package/network/services/hostapd/patches/720-iface_max_num_sta.patch + delete mode 100644 package/network/services/hostapd/patches/800-dfs-enter-DFS-state-if-no-available-channel-is-found.patch + delete mode 100644 package/network/services/hostapd/patches/801-P2P-Fix-copying-of-secondary-device-types-for-P2P-gr.patch + +diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile +index bd2a7c96ad..e0e55ab99e 100644 +--- a/package/network/services/hostapd/Makefile ++++ b/package/network/services/hostapd/Makefile +@@ -7,13 +7,13 @@ + include $(TOPDIR)/rules.mk + + PKG_NAME:=hostapd +-PKG_RELEASE:=32 ++PKG_RELEASE:=34 + + PKG_SOURCE_URL:=http://w1.fi/hostap.git + PKG_SOURCE_PROTO:=git +-PKG_SOURCE_DATE:=2020-06-08 +-PKG_SOURCE_VERSION:=5a8b366233f5585e68a4ffbb604fbb4a848eb325 +-PKG_MIRROR_HASH:=1b2a4947034142587a3f81eac2ea27dd64650e77f8943d973623b47533be2393 ++PKG_SOURCE_DATE:=2021-05-21 ++PKG_SOURCE_VERSION:=d98f4c46600d9449fa97186bd5263b76bedaf06e ++PKG_MIRROR_HASH:=62ddbd570c0a86391c617b0cd7b337cdb49f6ae9dfbd227d58c0e1e9b43fef81 + + PKG_MAINTAINER:=Felix Fietkau + PKG_LICENSE:=BSD-3-Clause +@@ -524,6 +524,7 @@ define Build/RunMake + LIBS_c="$(TARGET_LDFLAGS_C)" \ + AR="$(TARGET_CROSS)gcc-ar" \ + BCHECK= \ ++ $(if $(findstring s,$(OPENWRT_VERBOSE)),V=1) \ + $(2) + endef + +diff --git a/package/network/services/hostapd/files/hostapd-basic.config b/package/network/services/hostapd/files/hostapd-basic.config +index 947e2fa200..33c38192b1 100644 +--- a/package/network/services/hostapd/files/hostapd-basic.config ++++ b/package/network/services/hostapd/files/hostapd-basic.config +@@ -384,7 +384,7 @@ CONFIG_TLS=internal + #CONFIG_OWE=y + + # Airtime policy support +-#CONFIG_AIRTIME_POLICY=y ++CONFIG_AIRTIME_POLICY=y + + # Override default value for the wpa_disable_eapol_key_retries configuration + # parameter. See that parameter in hostapd.conf for more details. +diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh +index 45a49b8faa..9993bc9047 100644 +--- a/package/network/services/hostapd/files/hostapd.sh ++++ b/package/network/services/hostapd/files/hostapd.sh +@@ -91,6 +91,7 @@ hostapd_add_log_config() { + hostapd_common_add_device_config() { + config_add_array basic_rate + config_add_array supported_rates ++ config_add_string beacon_rate + + config_add_string country + config_add_boolean country_ie doth +@@ -99,6 +100,10 @@ hostapd_common_add_device_config() { + config_add_string require_mode + config_add_boolean legacy_rates + config_add_int cell_density ++ config_add_int rts_threshold ++ config_add_int rssi_reject_assoc_rssi ++ config_add_int rssi_ignore_probe_request ++ config_add_int maxassoc + + config_add_string acs_chan_bias + config_add_array hostapd_options +@@ -115,7 +120,8 @@ hostapd_prepare_device_config() { + local base_cfg= + + json_get_vars country country_ie beacon_int:100 dtim_period:2 doth require_mode legacy_rates \ +- acs_chan_bias local_pwr_constraint spectrum_mgmt_required airtime_mode cell_density ++ acs_chan_bias local_pwr_constraint spectrum_mgmt_required airtime_mode cell_density \ ++ rts_threshold beacon_rate rssi_reject_assoc_rssi rssi_ignore_probe_request maxassoc + + hostapd_set_log_options base_cfg + +@@ -206,11 +212,16 @@ hostapd_prepare_device_config() { + hostapd_add_rate brlist "$br" + done + ++ [ -n "$rssi_reject_assoc_rssi" ] && append base_cfg "rssi_reject_assoc_rssi=$rssi_reject_assoc_rssi" "$N" ++ [ -n "$rssi_ignore_probe_request" ] && append base_cfg "rssi_ignore_probe_request=$rssi_ignore_probe_request" "$N" ++ [ -n "$beacon_rate" ] && append base_cfg "beacon_rate=$beacon_rate" "$N" + [ -n "$rlist" ] && append base_cfg "supported_rates=$rlist" "$N" + [ -n "$brlist" ] && append base_cfg "basic_rates=$brlist" "$N" + append base_cfg "beacon_int=$beacon_int" "$N" ++ [ -n "$rts_threshold" ] && append base_cfg "rts_threshold=$rts_threshold" "$N" + append base_cfg "dtim_period=$dtim_period" "$N" + [ "$airtime_mode" -gt 0 ] && append base_cfg "airtime_mode=$airtime_mode" "$N" ++ [ -n "$maxassoc" ] && append base_cfg "iface_max_num_sta=$maxassoc" "$N" + + json_get_values opts hostapd_options + for val in $opts; do +@@ -266,7 +277,7 @@ hostapd_common_add_bss_config() { + config_add_array domain_match domain_match2 domain_suffix_match domain_suffix_match2 + config_add_string ieee80211w_mgmt_cipher + +- config_add_int dynamic_vlan vlan_naming ++ config_add_int dynamic_vlan vlan_naming vlan_no_bridge + config_add_string vlan_tagged_interface vlan_bridge + config_add_string vlan_file + +@@ -316,7 +327,7 @@ hostapd_common_add_bss_config() { + config_add_int iw_ipaddr_type_availability iw_gas_address3 + config_add_string iw_hessid iw_network_auth_type iw_qos_map_set + config_add_array iw_roaming_consortium iw_domain_name iw_anqp_3gpp_cell_net iw_nai_realm +- config_add_array iw_anqp_elem ++ config_add_array iw_anqp_elem iw_venue_name iw_venue_url + + config_add_boolean hs20 disable_dgaf osen + config_add_int anqp_domain_id +@@ -327,12 +338,18 @@ hostapd_common_add_bss_config() { + config_add_array hs20_conn_capab + config_add_string osu_ssid hs20_wan_metrics hs20_operating_class hs20_t_c_filename hs20_t_c_timestamp + ++ config_add_string hs20_t_c_server_url ++ + config_add_array airtime_sta_weight + config_add_int airtime_bss_weight airtime_bss_limit + +- config_add_boolean multicast_to_unicast per_sta_vif ++ config_add_boolean multicast_to_unicast proxy_arp per_sta_vif + + config_add_array hostapd_bss_options ++ ++ config_add_boolean request_cui ++ config_add_array radius_auth_req_attr ++ config_add_array radius_acct_req_attr + } + + hostapd_set_vlan_file() { +@@ -396,10 +413,22 @@ append_iw_nai_realm() { + [ -n "$1" ] && append bss_conf "nai_realm=$1" "$N" + } + ++append_iw_venue_name() { ++ append bss_conf "venue_name=$1" "$N" ++} ++ ++append_iw_venue_url() { ++ append bss_conf "venue_url=$1" "$N" ++} ++ + append_hs20_oper_friendly_name() { + append bss_conf "hs20_oper_friendly_name=$1" "$N" + } + ++append_osu_provider_friendly_name() { ++ append bss_conf "osu_friendly_name=$1" "$N" ++} ++ + append_osu_provider_service_desc() { + append bss_conf "osu_service_desc=$1" "$N" + } +@@ -447,6 +476,7 @@ append_osu_provider() { + append bss_conf "osu_method_list=$osu_method_list" "$N" + + config_list_foreach "$1" osu_service_desc append_osu_provider_service_desc ++ config_list_foreach "$1" osu_friendly_name append_osu_friendly_name + config_list_foreach "$1" osu_icon append_osu_icon + + append bss_conf "$N" +@@ -456,6 +486,14 @@ append_hs20_conn_capab() { + [ -n "$1" ] && append bss_conf "hs20_conn_capab=$1" "$N" + } + ++append_radius_acct_req_attr() { ++ append bss_conf "radius_acct_req_attr=$1" "$N" ++} ++ ++append_radius_auth_req_attr() { ++ append bss_conf "radius_auth_req_attr=$1" "$N" ++} ++ + append_airtime_sta_weight() { + [ -n "$1" ] && append bss_conf "airtime_sta_weight=$1" "$N" + } +@@ -482,7 +520,7 @@ hostapd_set_bss_options() { + bss_load_update_period chan_util_avg_period sae_require_mfp \ + multi_ap multi_ap_backhaul_ssid multi_ap_backhaul_key skip_inactivity_poll \ + airtime_bss_weight airtime_bss_limit airtime_sta_weight \ +- multicast_to_unicast per_sta_vif ++ multicast_to_unicast proxy_arp per_sta_vif + + set_default isolate 0 + set_default maxassoc 0 +@@ -547,6 +585,7 @@ hostapd_set_bss_options() { + append bss_conf "acct_server_shared_secret=$acct_secret" "$N" + [ -n "$acct_interval" ] && \ + append bss_conf "radius_acct_interim_interval=$acct_interval" "$N" ++ json_for_each_item append_radius_acct_req_attr radius_acct_req_attr + } + + case "$auth_type" in +@@ -601,7 +640,7 @@ hostapd_set_bss_options() { + auth_server auth_secret auth_port \ + dae_client dae_secret dae_port \ + ownip radius_client_addr \ +- eap_reauth_period ++ eap_reauth_period request_cui + + # radius can provide VLAN ID for clients + vlan_possible=1 +@@ -613,18 +652,20 @@ hostapd_set_bss_options() { + + set_default auth_port 1812 + set_default dae_port 3799 +- ++ set_default request_cui 0 + + append bss_conf "auth_server_addr=$auth_server" "$N" + append bss_conf "auth_server_port=$auth_port" "$N" + append bss_conf "auth_server_shared_secret=$auth_secret" "$N" + ++ [ "$request_cui" -gt 0 ] && append bss_conf "radius_request_cui=$request_cui" "$N" + [ -n "$eap_reauth_period" ] && append bss_conf "eap_reauth_period=$eap_reauth_period" "$N" + + [ -n "$dae_client" -a -n "$dae_secret" ] && { + append bss_conf "radius_das_port=$dae_port" "$N" + append bss_conf "radius_das_client=$dae_client $dae_secret" "$N" + } ++ json_for_each_item append_radius_auth_req_attr radius_auth_req_attr + + [ -n "$ownip" ] && append bss_conf "own_ip_addr=$ownip" "$N" + [ -n "$radius_client_addr" ] && append bss_conf "radius_client_addr=$radius_client_addr" "$N" +@@ -733,7 +774,7 @@ hostapd_set_bss_options() { + append bss_conf "ftm_responder=1" "$N" + [ "$stationary_ap" -eq "1" ] && append bss_conf "stationary_ap=1" "$N" + [ -n "$lci" ] && append bss_conf "lci=$lci" "$N" +- [ -n "$civic" ] && append bss_conf "lci=$civic" "$N" ++ [ -n "$civic" ] && append bss_conf "civic=$civic" "$N" + } + fi + +@@ -856,13 +897,17 @@ hostapd_set_bss_options() { + } + + [ -n "$vlan_possible" -a -n "$dynamic_vlan" ] && { +- json_get_vars vlan_naming vlan_tagged_interface vlan_bridge vlan_file ++ json_get_vars vlan_naming vlan_tagged_interface vlan_bridge vlan_file vlan_no_bridge + set_default vlan_naming 1 + [ -z "$vlan_file" ] && set_default vlan_file /var/run/hostapd-$ifname.vlan + append bss_conf "dynamic_vlan=$dynamic_vlan" "$N" + append bss_conf "vlan_naming=$vlan_naming" "$N" +- [ -n "$vlan_bridge" ] && \ ++ if [ -n "$vlan_bridge" ]; then + append bss_conf "vlan_bridge=$vlan_bridge" "$N" ++ else ++ set_default vlan_no_bridge 1 ++ fi ++ append bss_conf "vlan_no_bridge=$vlan_no_bridge" "$N" + [ -n "$vlan_tagged_interface" ] && \ + append bss_conf "vlan_tagged_interface=$vlan_tagged_interface" "$N" + [ -n "$vlan_file" ] && { +@@ -875,6 +920,7 @@ hostapd_set_bss_options() { + json_get_vars iw_hessid iw_venue_group iw_venue_type iw_network_auth_type + json_get_vars iw_roaming_consortium iw_domain_name iw_anqp_3gpp_cell_net iw_nai_realm + json_get_vars iw_anqp_elem iw_qos_map_set iw_ipaddr_type_availability iw_gas_address3 ++ json_get_vars iw_venue_name iw_venue_url + + set_default iw_enabled 0 + if [ "$iw_enabled" = "1" ]; then +@@ -903,6 +949,8 @@ hostapd_set_bss_options() { + json_for_each_item append_iw_roaming_consortium iw_roaming_consortium + json_for_each_item append_iw_anqp_elem iw_anqp_elem + json_for_each_item append_iw_nai_realm iw_nai_realm ++ json_for_each_item append_iw_venue_name iw_venue_name ++ json_for_each_item append_iw_venue_url iw_venue_url + + iw_domain_name_conf= + json_for_each_item append_iw_domain_name iw_domain_name +@@ -917,9 +965,11 @@ hostapd_set_bss_options() { + + + local hs20 disable_dgaf osen anqp_domain_id hs20_deauth_req_timeout \ +- osu_ssid hs20_wan_metrics hs20_operating_class hs20_t_c_filename hs20_t_c_timestamp ++ osu_ssid hs20_wan_metrics hs20_operating_class hs20_t_c_filename hs20_t_c_timestamp \ ++ hs20_t_c_server_url + json_get_vars hs20 disable_dgaf osen anqp_domain_id hs20_deauth_req_timeout \ +- osu_ssid hs20_wan_metrics hs20_operating_class hs20_t_c_filename hs20_t_c_timestamp ++ osu_ssid hs20_wan_metrics hs20_operating_class hs20_t_c_filename hs20_t_c_timestamp \ ++ hs20_t_c_server_url + + set_default hs20 0 + set_default disable_dgaf $hs20 +@@ -938,8 +988,9 @@ hostapd_set_bss_options() { + [ -n "$hs20_operating_class" ] && append bss_conf "hs20_operating_class=$hs20_operating_class" "$N" + [ -n "$hs20_t_c_filename" ] && append bss_conf "hs20_t_c_filename=$hs20_t_c_filename" "$N" + [ -n "$hs20_t_c_timestamp" ] && append bss_conf "hs20_t_c_timestamp=$hs20_t_c_timestamp" "$N" +- json_for_each_item append_hs20_conn_capab hs20_conn_capab ++ [ -n "$hs20_t_c_server_url" ] && append bss_conf "hs20_t_c_server_url=$hs20_t_c_server_url" "$N" + json_for_each_item append_hs20_oper_friendly_name hs20_oper_friendly_name ++ json_for_each_item append_hs20_conn_capab hs20_conn_capab + json_for_each_item append_osu_provider osu_provider + json_for_each_item append_operator_icon operator_icon + fi +@@ -948,6 +999,10 @@ hostapd_set_bss_options() { + if [ "$multicast_to_unicast" -gt 0 ]; then + append bss_conf "multicast_to_unicast=$multicast_to_unicast" "$N" + fi ++ set_default proxy_arp 0 ++ if [ "$proxy_arp" -gt 0 ]; then ++ append bss_conf "proxy_arp=$proxy_arp" "$N" ++ fi + + set_default per_sta_vif 0 + if [ "$per_sta_vif" -gt 0 ]; then +@@ -1079,9 +1134,9 @@ wpa_supplicant_set_fixed_freq() { + VHT*) append network_data "vht=1" "$N$T";; + esac + case "$htmode" in +- VHT80) append network_data "max_oper_chwidth=1" "$N$T";; +- VHT160) append network_data "max_oper_chwidth=2" "$N$T";; +- VHT20|VHT40) append network_data "max_oper_chwidth=0" "$N$T";; ++ HE80|VHT80) append network_data "max_oper_chwidth=1" "$N$T";; ++ HE160|VHT160) append network_data "max_oper_chwidth=2" "$N$T";; ++ HE20|HE40|VHT20|VHT40) append network_data "max_oper_chwidth=0" "$N$T";; + *) append network_data "disable_vht=1" "$N$T";; + esac + } +diff --git a/package/network/services/hostapd/patches/001-HE-VHT-fix-frequency-setup-with-HE-enabled.patch b/package/network/services/hostapd/patches/001-HE-VHT-fix-frequency-setup-with-HE-enabled.patch +deleted file mode 100644 +index 37c17c50af..0000000000 +--- a/package/network/services/hostapd/patches/001-HE-VHT-fix-frequency-setup-with-HE-enabled.patch ++++ /dev/null +@@ -1,196 +0,0 @@ +-From 91976250359b263a44861aebe553b20627fe487e Mon Sep 17 00:00:00 2001 +-From: Markus Theil +-Date: Tue, 30 Jun 2020 13:53:17 +0200 +-Subject: [PATCH 01/19] HE/VHT: fix frequency setup with HE enabled +- +-Some places in the code base were not using the +-wrappers like hostapd_set_oper_centr_freq_seg0_idx +-and friends. This could lead to errors, for example when +-joining 80 MHz mesh networks. Fix this, by enforcing +-usage of these wrappers. +- +-wpa_supplicant_conf_ap_ht now checks for HE capability +-before dealing with VHT in order for these wrappers to work, +-as they first check HE support in the config. +- +-While doing these changes, I've noticed that the extra +-channel setup code for mesh networks in wpa_supplicant/mesh.c +-should not be necessary anymore and dropped it. +-wpa_supplicant_conf_ap_ht should handle this setup already. +- +-Acked-by: John Crispin +-Signed-off-by: Markus Theil +---- +- src/ap/dfs.c | 8 ++++---- +- wpa_supplicant/ap.c | 40 +++++++++++++++++++++++----------------- +- wpa_supplicant/mesh.c | 24 ------------------------ +- 3 files changed, 27 insertions(+), 45 deletions(-) +- +---- a/src/ap/dfs.c +-+++ b/src/ap/dfs.c +-@@ -1028,7 +1028,7 @@ static int hostapd_dfs_start_channel_swi +- unsigned int i; +- int err = 1; +- struct hostapd_hw_modes *cmode = iface->current_mode; +-- u8 current_vht_oper_chwidth = iface->conf->vht_oper_chwidth; +-+ u8 current_vht_oper_chwidth = hostapd_get_oper_chwidth(iface->conf); +- +- wpa_printf(MSG_DEBUG, "%s called (CAC active: %s, CSA active: %s)", +- __func__, iface->cac_started ? "yes" : "no", +-@@ -1089,8 +1089,8 @@ static int hostapd_dfs_start_channel_swi +- "freq=%d chan=%d sec_chan=%d", channel->freq, +- channel->chan, secondary_channel); +- +-- new_vht_oper_chwidth = iface->conf->vht_oper_chwidth; +-- iface->conf->vht_oper_chwidth = current_vht_oper_chwidth; +-+ new_vht_oper_chwidth = hostapd_get_oper_chwidth(iface->conf); +-+ hostapd_set_oper_chwidth(iface->conf, current_vht_oper_chwidth); +- +- /* Setup CSA request */ +- os_memset(&csa_settings, 0, sizeof(csa_settings)); +-@@ -1130,7 +1130,7 @@ static int hostapd_dfs_start_channel_swi +- iface->freq = channel->freq; +- iface->conf->channel = channel->chan; +- iface->conf->secondary_channel = secondary_channel; +-- iface->conf->vht_oper_chwidth = new_vht_oper_chwidth; +-+ hostapd_set_oper_chwidth(iface->conf, new_vht_oper_chwidth); +- hostapd_set_oper_centr_freq_seg0_idx(iface->conf, +- oper_centr_freq_seg0_idx); +- hostapd_set_oper_centr_freq_seg1_idx(iface->conf, +---- a/wpa_supplicant/ap.c +-+++ b/wpa_supplicant/ap.c +-@@ -52,6 +52,7 @@ static void wpas_conf_ap_vht(struct wpa_ +- #ifdef CONFIG_P2P +- u8 center_chan = 0; +- u8 channel = conf->channel; +-+ u8 freq_seg_idx; +- #endif /* CONFIG_P2P */ +- +- if (!conf->secondary_channel) +-@@ -59,19 +60,21 @@ static void wpas_conf_ap_vht(struct wpa_ +- +- /* Use the maximum oper channel width if it's given. */ +- if (ssid->max_oper_chwidth) +-- conf->vht_oper_chwidth = ssid->max_oper_chwidth; +-+ hostapd_set_oper_chwidth(conf, ssid->max_oper_chwidth); +- +- ieee80211_freq_to_chan(ssid->vht_center_freq2, +-- &conf->vht_oper_centr_freq_seg1_idx); +-+ &freq_seg_idx); +-+ hostapd_set_oper_centr_freq_seg1_idx(conf, freq_seg_idx); +- +- if (!ssid->p2p_group) { +- if (!ssid->vht_center_freq1 || +-- conf->vht_oper_chwidth == CHANWIDTH_USE_HT) +-+ hostapd_get_oper_chwidth(conf) == CHANWIDTH_USE_HT) +- goto no_vht; +- ieee80211_freq_to_chan(ssid->vht_center_freq1, +-- &conf->vht_oper_centr_freq_seg0_idx); +-+ &freq_seg_idx); +-+ hostapd_set_oper_centr_freq_seg0_idx(conf, freq_seg_idx); +- wpa_printf(MSG_DEBUG, "VHT seg0 index %d for AP", +-- conf->vht_oper_centr_freq_seg0_idx); +-+ hostapd_get_oper_centr_freq_seg0_idx(conf)); +- return; +- } +- +-@@ -96,14 +99,14 @@ static void wpas_conf_ap_vht(struct wpa_ +- * try oper_cwidth 160 MHz first then VHT 80 MHz, if 160 MHz is +- * not supported. +- */ +-- conf->vht_oper_chwidth = CHANWIDTH_160MHZ; +-+ hostapd_set_oper_chwidth(conf, CHANWIDTH_160MHZ); +- center_chan = wpas_p2p_get_vht160_center(wpa_s, mode, channel); +- if (center_chan) { +- wpa_printf(MSG_DEBUG, +- "VHT center channel %u for auto-selected 160 MHz bandwidth", +- center_chan); +- } else { +-- conf->vht_oper_chwidth = CHANWIDTH_80MHZ; +-+ hostapd_set_oper_chwidth(conf, CHANWIDTH_80MHZ); +- center_chan = wpas_p2p_get_vht80_center(wpa_s, mode, +- channel); +- wpa_printf(MSG_DEBUG, +-@@ -115,9 +118,9 @@ static void wpas_conf_ap_vht(struct wpa_ +- if (!center_chan) +- goto no_vht; +- +-- conf->vht_oper_centr_freq_seg0_idx = center_chan; +-+ hostapd_set_oper_centr_freq_seg0_idx(conf, center_chan); +- wpa_printf(MSG_DEBUG, "VHT seg0 index %d for P2P GO", +-- conf->vht_oper_centr_freq_seg0_idx); +-+ hostapd_get_oper_centr_freq_seg0_idx(conf)); +- return; +- #endif /* CONFIG_P2P */ +- +-@@ -125,9 +128,9 @@ no_vht: +- wpa_printf(MSG_DEBUG, +- "No VHT higher bandwidth support for the selected channel %d", +- conf->channel); +-- conf->vht_oper_centr_freq_seg0_idx = +-- conf->channel + conf->secondary_channel * 2; +-- conf->vht_oper_chwidth = CHANWIDTH_USE_HT; +-+ hostapd_set_oper_centr_freq_seg0_idx(conf, +-+ conf->channel + conf->secondary_channel * 2); +-+ hostapd_set_oper_chwidth(conf, CHANWIDTH_USE_HT); +- } +- +- +-@@ -231,16 +234,19 @@ int wpa_supplicant_conf_ap_ht(struct wpa +- HT_CAP_INFO_TX_STBC | +- HT_CAP_INFO_MAX_AMSDU_SIZE); +- +-+ /* check this before VHT, because setting oper chan +-+ * width and friends is the same call for HE and VHT +-+ * and checks if conf->ieee8021ax == 1 */ +-+ if (mode->he_capab[wpas_mode_to_ieee80211_mode( +-+ ssid->mode)].he_supported && +-+ ssid->he) +-+ conf->ieee80211ax = 1; +-+ +- if (mode->vht_capab && ssid->vht) { +- conf->ieee80211ac = 1; +- conf->vht_capab |= mode->vht_capab; +- wpas_conf_ap_vht(wpa_s, ssid, conf, mode); +- } +-- +-- if (mode->he_capab[wpas_mode_to_ieee80211_mode( +-- ssid->mode)].he_supported && +-- ssid->he) +-- conf->ieee80211ax = 1; +- } +- } +- +---- a/wpa_supplicant/mesh.c +-+++ b/wpa_supplicant/mesh.c +-@@ -333,30 +333,6 @@ static int wpa_supplicant_mesh_init(stru +- frequency); +- goto out_free; +- } +-- if (ssid->ht40) +-- conf->secondary_channel = ssid->ht40; +-- if (conf->hw_mode == HOSTAPD_MODE_IEEE80211A && ssid->vht) { +-- if (ssid->max_oper_chwidth != DEFAULT_MAX_OPER_CHWIDTH) +-- conf->vht_oper_chwidth = ssid->max_oper_chwidth; +-- switch (conf->vht_oper_chwidth) { +-- case CHANWIDTH_80MHZ: +-- case CHANWIDTH_80P80MHZ: +-- ieee80211_freq_to_chan( +-- frequency, +-- &conf->vht_oper_centr_freq_seg0_idx); +-- conf->vht_oper_centr_freq_seg0_idx += ssid->ht40 * 2; +-- break; +-- case CHANWIDTH_160MHZ: +-- ieee80211_freq_to_chan( +-- frequency, +-- &conf->vht_oper_centr_freq_seg0_idx); +-- conf->vht_oper_centr_freq_seg0_idx += ssid->ht40 * 2; +-- conf->vht_oper_centr_freq_seg0_idx += 40 / 5; +-- break; +-- } +-- ieee80211_freq_to_chan(ssid->vht_center_freq2, +-- &conf->vht_oper_centr_freq_seg1_idx); +-- } +- +- if (ssid->mesh_basic_rates == NULL) { +- /* +diff --git a/package/network/services/hostapd/patches/001-wolfssl-init-RNG-with-ECC-key.patch b/package/network/services/hostapd/patches/001-wolfssl-init-RNG-with-ECC-key.patch +new file mode 100644 +index 0000000000..84fc1c9351 +--- /dev/null ++++ b/package/network/services/hostapd/patches/001-wolfssl-init-RNG-with-ECC-key.patch +@@ -0,0 +1,43 @@ ++From 21ce83b4ae2b9563175fdb4fc4312096cc399cf8 Mon Sep 17 00:00:00 2001 ++From: David Bauer ++Date: Wed, 5 May 2021 00:44:34 +0200 ++Subject: [PATCH] wolfssl: add RNG to EC key ++ ++Since upstream commit 6467de5a8840 ("Randomize z ordinates in ++scalar mult when timing resistant") WolfSSL requires a RNG for ++the EC key when built hardened which is the default. ++ ++Set the RNG for the EC key to fix connections for OWE clients. ++ ++Signed-off-by: David Bauer ++--- ++ src/crypto/crypto_wolfssl.c | 4 ++++ ++ 1 file changed, 4 insertions(+) ++ ++--- a/src/crypto/crypto_wolfssl.c +++++ b/src/crypto/crypto_wolfssl.c ++@@ -1303,6 +1303,7 @@ int ecc_projective_add_point(ecc_point * ++ ++ struct crypto_ec { ++ ecc_key key; +++ WC_RNG rng; ++ mp_int a; ++ mp_int prime; ++ mp_int order; ++@@ -1357,6 +1358,8 @@ struct crypto_ec * crypto_ec_init(int gr ++ return NULL; ++ ++ if (wc_ecc_init(&e->key) != 0 || +++ wc_InitRng(&e->rng) != 0 || +++ wc_ecc_set_rng(&e->key, &e->rng) != 0 || ++ wc_ecc_set_curve(&e->key, 0, curve_id) != 0 || ++ mp_init(&e->a) != MP_OKAY || ++ mp_init(&e->prime) != MP_OKAY || ++@@ -1388,6 +1391,7 @@ void crypto_ec_deinit(struct crypto_ec* ++ mp_clear(&e->order); ++ mp_clear(&e->prime); ++ mp_clear(&e->a); +++ wc_FreeRng(&e->rng); ++ wc_ecc_free(&e->key); ++ os_free(e); ++ } +diff --git a/package/network/services/hostapd/patches/002-mesh-fix-channel-init-order-disable-pri-sec-channel-.patch b/package/network/services/hostapd/patches/002-mesh-fix-channel-init-order-disable-pri-sec-channel-.patch +deleted file mode 100644 +index c7101b1dbc..0000000000 +--- a/package/network/services/hostapd/patches/002-mesh-fix-channel-init-order-disable-pri-sec-channel-.patch ++++ /dev/null +@@ -1,126 +0,0 @@ +-From d869c753b79a1423c2bd9b0afdfa0d89d55a930c Mon Sep 17 00:00:00 2001 +-From: Markus Theil +-Date: Tue, 30 Jun 2020 13:53:18 +0200 +-Subject: [PATCH 02/19] mesh: fix channel init order, disable pri/sec channel +- switch +- +-wpa_supplicant_conf_ap_ht has to happen before hostapd_setup_interface +-in order for its configuration settings to have effect on interface +-configuration. +- +-Disable primary and secondary channel switch because of missing tie +-breaking rule/frames in mesh networks. A rather long comment about +-this issue is placed in mesh.c in the corresponding place. +- +-In consequence, remove mesh coex test, which contradicts this change. +- +-I was not able to reproduce the memory corruption during +-mesh_secure_ocv_mix_legacy, which lead to a revert of a similar patch +-in the past. +- +-Signed-off-by: Markus Theil +---- +- tests/hwsim/test_wpas_mesh.py | 50 ----------------------------------- +- wpa_supplicant/mesh.c | 25 ++++++++++++++++-- +- 2 files changed, 23 insertions(+), 52 deletions(-) +- +---- a/tests/hwsim/test_wpas_mesh.py +-+++ b/tests/hwsim/test_wpas_mesh.py +-@@ -933,56 +933,6 @@ def _test_wpas_mesh_open_5ghz(dev, apdev +- dev[0].dump_monitor() +- dev[1].dump_monitor() +- +--def test_wpas_mesh_open_5ghz_coex(dev, apdev): +-- """Mesh network on 5 GHz band and 20/40 coex change""" +-- try: +-- _test_wpas_mesh_open_5ghz_coex(dev, apdev) +-- finally: +-- dev[0].request("MESH_GROUP_REMOVE " + dev[0].ifname) +-- dev[1].request("MESH_GROUP_REMOVE " + dev[1].ifname) +-- set_world_reg(apdev0=apdev[0], dev0=dev[0]) +-- dev[0].flush_scan_cache() +-- dev[1].flush_scan_cache() +-- +--def _test_wpas_mesh_open_5ghz_coex(dev, apdev): +-- check_mesh_support(dev[0]) +-- subprocess.call(['iw', 'reg', 'set', 'US']) +-- +-- # Start a 20 MHz BSS on channel 40 that would be the secondary channel of +-- # HT40+ mesh on channel 36. +-- params = {"ssid": "test-ht40", +-- "hw_mode": "a", +-- "channel": "40", +-- "country_code": "US"} +-- hapd = hostapd.add_ap(apdev[0], params) +-- bssid = hapd.own_addr() +-- +-- for i in range(2): +-- for j in range(5): +-- ev = dev[i].wait_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=5) +-- if ev is None: +-- raise Exception("No regdom change event") +-- if "alpha2=US" in ev: +-- break +-- dev[i].scan_for_bss(bssid, freq=5200) +-- add_open_mesh_network(dev[i], freq="5180") +-- +-- check_mesh_joined_connected(dev) +-- +-- freq = dev[0].get_status_field("freq") +-- if freq != "5200": +-- raise Exception("Unexpected STATUS freq=" + freq) +-- sig = dev[0].request("SIGNAL_POLL").splitlines() +-- if "FREQUENCY=5200" not in sig: +-- raise Exception("Unexpected SIGNAL_POLL output: " + str(sig)) +-- +-- hapd.disable() +-- dev[0].mesh_group_remove() +-- dev[1].mesh_group_remove() +-- check_mesh_group_removed(dev[0]) +-- check_mesh_group_removed(dev[1]) +-- dev[0].dump_monitor() +-- dev[1].dump_monitor() +- +- def test_wpas_mesh_open_ht40(dev, apdev): +- """Mesh and HT40 support difference""" +---- a/wpa_supplicant/mesh.c +-+++ b/wpa_supplicant/mesh.c +-@@ -363,6 +363,29 @@ static int wpa_supplicant_mesh_init(stru +- conf->basic_rates[rate_len] = -1; +- } +- +-+ /* While it can enhance performance to switch the primary channel, which +-+ * is also the secondary channel of another network at the same time), +-+ * to the other primary channel, problems exist with this in mesh networks. +-+ * +-+ * Example with problems: +-+ * - 3 mesh nodes M1-M3, freq (5200, 5180) +-+ * - other node O1, e.g. AP mode, freq (5180, 5200), +-+ * Locations: O1 M1 M2 M3 +-+ * +-+ * M3 can only send frames to M1 over M2, no direct connection is possible +-+ * Start O1, M1 and M3 first, M1 or O1 will switch channels to align with +-+ * each other. M3 does not swap, because M1 or O1 cannot be reached. +-+ * M2 is started afterwards and can either connect to M3 or M1 because of +-+ * this primary secondary channel switch. +-+ * +-+ * Solutions: (1) central coordination -> not always possible +-+ * (2) disable pri/sec channel switch in mesh networks +-+ * +-+ * In AP mode, when all nodes can work independently, this poses of course +-+ * no problem, therefore disable it only in mesh mode.`*/ +-+ conf->no_pri_sec_switch = 1; +-+ wpa_supplicant_conf_ap_ht(wpa_s, ssid, conf); +-+ +- if (wpa_drv_init_mesh(wpa_s)) { +- wpa_msg(wpa_s, MSG_ERROR, "Failed to init mesh in driver"); +- return -1; +-@@ -374,8 +397,6 @@ static int wpa_supplicant_mesh_init(stru +- return -1; +- } +- +-- wpa_supplicant_conf_ap_ht(wpa_s, ssid, conf); +-- +- return 0; +- out_free: +- wpa_supplicant_mesh_deinit(wpa_s); +diff --git a/package/network/services/hostapd/patches/003-wpa_supplicant-handle-HT40-and-mode-downgrade-in-AP-.patch b/package/network/services/hostapd/patches/003-wpa_supplicant-handle-HT40-and-mode-downgrade-in-AP-.patch +deleted file mode 100644 +index f42620042d..0000000000 +--- a/package/network/services/hostapd/patches/003-wpa_supplicant-handle-HT40-and-mode-downgrade-in-AP-.patch ++++ /dev/null +@@ -1,102 +0,0 @@ +-From 978a59514ccde994b5c06e1cbb49cc8cebe6381c Mon Sep 17 00:00:00 2001 +-From: Markus Theil +-Date: Tue, 30 Jun 2020 13:53:19 +0200 +-Subject: [PATCH 03/19] wpa_supplicant: handle HT40 and mode downgrade in AP +- mode +- +-This patch adds some missing pieces to the interface configuration +-of AP/mesh mode in wpa_supplicant. +- - check for secondary channel and HT40 capability +- - try to downgrade to 11b if 11g is not available +-Especially with the HT40 check, this code now performs all settings, +-which the deleted/duplicated mesh code did. +- +-Signed-off-by: Markus Theil +---- +- wpa_supplicant/ap.c | 49 ++++++++++++++++++++++++++++++++++++--------- +- 1 file changed, 40 insertions(+), 9 deletions(-) +- +---- a/wpa_supplicant/ap.c +-+++ b/wpa_supplicant/ap.c +-@@ -134,6 +134,23 @@ no_vht: +- } +- +- +-+static struct hostapd_hw_modes *wpa_supplicant_find_hw_mode(struct wpa_supplicant *wpa_s, +-+ enum hostapd_hw_mode hw_mode) +-+{ +-+ struct hostapd_hw_modes *mode = NULL; +-+ int i; +-+ +-+ for (i = 0; i < wpa_s->hw.num_modes; i++) { +-+ if (wpa_s->hw.modes[i].mode == hw_mode) { +-+ mode = &wpa_s->hw.modes[i]; +-+ break; +-+ } +-+ } +-+ +-+ return mode; +-+} +-+ +-+ +- int wpa_supplicant_conf_ap_ht(struct wpa_supplicant *wpa_s, +- struct wpa_ssid *ssid, +- struct hostapd_config *conf) +-@@ -147,9 +164,6 @@ int wpa_supplicant_conf_ap_ht(struct wpa +- return -1; +- } +- +-- /* TODO: enable HT40 if driver supports it; +-- * drop to 11b if driver does not support 11g */ +-- +- /* +- * Enable HT20 if the driver supports it, by setting conf->ieee80211n +- * and a mask of allowed capabilities within conf->ht_capab. +-@@ -158,17 +172,27 @@ int wpa_supplicant_conf_ap_ht(struct wpa +- */ +- if (wpa_s->hw.modes) { +- struct hostapd_hw_modes *mode = NULL; +-- int i, no_ht = 0; +-+ int no_ht = 0; +- +- wpa_printf(MSG_DEBUG, +- "Determining HT/VHT options based on driver capabilities (freq=%u chan=%u)", +- ssid->frequency, conf->channel); +- +-- for (i = 0; i < wpa_s->hw.num_modes; i++) { +-- if (wpa_s->hw.modes[i].mode == conf->hw_mode) { +-- mode = &wpa_s->hw.modes[i]; +-- break; +-- } +-+ mode = wpa_supplicant_find_hw_mode(wpa_s, conf->hw_mode); +-+ +-+ /* may drop drop to 11b if driver does not support 11g */ +-+ if (!mode && conf->hw_mode == HOSTAPD_MODE_IEEE80211G) { +-+ conf->hw_mode = HOSTAPD_MODE_IEEE80211B; +-+ wpa_printf(MSG_INFO, +-+ "Try downgrade to IEEE 802.11b as 802.11g is not " +-+ "supported by the current hardware"); +-+ mode = wpa_supplicant_find_hw_mode(wpa_s, conf->hw_mode); +-+ } +-+ +-+ if (!mode) { +-+ wpa_printf(MSG_ERROR, +-+ "No match between requested and supported hw modes found"); +-+ return -1; +- } +- +- #ifdef CONFIG_HT_OVERRIDES +-@@ -193,6 +217,13 @@ int wpa_supplicant_conf_ap_ht(struct wpa +- HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET), +- ssid->ht40); +- conf->ieee80211n = 1; +-+ +-+ if (ssid->ht40 && +-+ mode->ht_capab & HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET) +-+ conf->secondary_channel = ssid->ht40; +-+ else +-+ conf->secondary_channel = 0; +-+ +- #ifdef CONFIG_P2P +- if (ssid->p2p_group && +- conf->hw_mode == HOSTAPD_MODE_IEEE80211A && +diff --git a/package/network/services/hostapd/patches/004-wpa_supplicant-fix-frequency-config-for-non-p2p-vht-.patch b/package/network/services/hostapd/patches/004-wpa_supplicant-fix-frequency-config-for-non-p2p-vht-.patch +deleted file mode 100644 +index e8682af644..0000000000 +--- a/package/network/services/hostapd/patches/004-wpa_supplicant-fix-frequency-config-for-non-p2p-vht-.patch ++++ /dev/null +@@ -1,63 +0,0 @@ +-From 7f7325dae1d03a3964d4e91940d8369f3fed7b43 Mon Sep 17 00:00:00 2001 +-From: Markus Theil +-Date: Tue, 30 Jun 2020 13:53:20 +0200 +-Subject: [PATCH 04/19] wpa_supplicant: fix frequency config for non p2p vht/he +- cases +- +-Fix compile without CONFIG_P2P and only set secondary channel seg idx +-if we use a mode supporting a sec channel for vht/he. +- +-Signed-off-by: Markus Theil +---- +- wpa_supplicant/ap.c | 23 +++++++++++++---------- +- 1 file changed, 13 insertions(+), 10 deletions(-) +- +---- a/wpa_supplicant/ap.c +-+++ b/wpa_supplicant/ap.c +-@@ -52,8 +52,8 @@ static void wpas_conf_ap_vht(struct wpa_ +- #ifdef CONFIG_P2P +- u8 center_chan = 0; +- u8 channel = conf->channel; +-- u8 freq_seg_idx; +- #endif /* CONFIG_P2P */ +-+ u8 freq_seg_idx; +- +- if (!conf->secondary_channel) +- goto no_vht; +-@@ -62,24 +62,27 @@ static void wpas_conf_ap_vht(struct wpa_ +- if (ssid->max_oper_chwidth) +- hostapd_set_oper_chwidth(conf, ssid->max_oper_chwidth); +- +-- ieee80211_freq_to_chan(ssid->vht_center_freq2, +-- &freq_seg_idx); +-- hostapd_set_oper_centr_freq_seg1_idx(conf, freq_seg_idx); +-- +- if (!ssid->p2p_group) { +-- if (!ssid->vht_center_freq1 || +-- hostapd_get_oper_chwidth(conf) == CHANWIDTH_USE_HT) +-+ if (!ssid->vht_center_freq1) +- goto no_vht; +- ieee80211_freq_to_chan(ssid->vht_center_freq1, +- &freq_seg_idx); +- hostapd_set_oper_centr_freq_seg0_idx(conf, freq_seg_idx); +-- wpa_printf(MSG_DEBUG, "VHT seg0 index %d for AP", +-- hostapd_get_oper_centr_freq_seg0_idx(conf)); +-+ +-+ if (hostapd_get_oper_chwidth(conf) == CHANWIDTH_80P80MHZ) { +-+ ieee80211_freq_to_chan(ssid->vht_center_freq2, +-+ &freq_seg_idx); +-+ hostapd_set_oper_centr_freq_seg1_idx(conf, freq_seg_idx); +-+ } +-+ +-+ wpa_printf(MSG_DEBUG, "VHT seg0 index %d and seg1 index %d for AP", +-+ hostapd_get_oper_centr_freq_seg0_idx(conf), +-+ hostapd_get_oper_centr_freq_seg1_idx(conf)); +- return; +- } +- +- #ifdef CONFIG_P2P +-- switch (conf->vht_oper_chwidth) { +-+ switch (hostapd_get_oper_chwidth(conf)) { +- case CHANWIDTH_80MHZ: +- case CHANWIDTH_80P80MHZ: +- center_chan = wpas_p2p_get_vht80_center(wpa_s, mode, channel); +diff --git a/package/network/services/hostapd/patches/005-wpa_supplicant-enable-vht-and-he-in-default-config-p.patch b/package/network/services/hostapd/patches/005-wpa_supplicant-enable-vht-and-he-in-default-config-p.patch +deleted file mode 100644 +index 25d74252cd..0000000000 +--- a/package/network/services/hostapd/patches/005-wpa_supplicant-enable-vht-and-he-in-default-config-p.patch ++++ /dev/null +@@ -1,25 +0,0 @@ +-From ff7fb3fa0831c8521327d777c5607a3b7d8736b8 Mon Sep 17 00:00:00 2001 +-From: Markus Theil +-Date: Tue, 30 Jun 2020 13:53:21 +0200 +-Subject: [PATCH 05/19] wpa_supplicant: enable vht and he in default config +- parameters +- +-Enable VHT and HE as default config parameters in order for +-wpa_supplicant AP mode to use it, if hw support is given. +- +-Signed-off-by: Markus Theil +---- +- wpa_supplicant/config.c | 2 ++ +- 1 file changed, 2 insertions(+) +- +---- a/wpa_supplicant/config.c +-+++ b/wpa_supplicant/config.c +-@@ -3036,6 +3036,8 @@ void wpa_config_set_network_defaults(str +- ssid->wpa_deny_ptk0_rekey = PTK0_REKEY_ALLOW_ALWAYS; +- ssid->bg_scan_period = DEFAULT_BG_SCAN_PERIOD; +- ssid->ht = 1; +-+ ssid->vht = 1; +-+ ssid->he = 1; +- #ifdef IEEE8021X_EAPOL +- ssid->eapol_flags = DEFAULT_EAPOL_FLAGS; +- ssid->eap_workaround = DEFAULT_EAP_WORKAROUND; +diff --git a/package/network/services/hostapd/patches/006-hw_features-better-debug-messages-for-some-error-cas.patch b/package/network/services/hostapd/patches/006-hw_features-better-debug-messages-for-some-error-cas.patch +deleted file mode 100644 +index 31b1ac0d38..0000000000 +--- a/package/network/services/hostapd/patches/006-hw_features-better-debug-messages-for-some-error-cas.patch ++++ /dev/null +@@ -1,83 +0,0 @@ +-From 6522dcbbcf71abcb80cce84b93b4a9a5cfcd4fca Mon Sep 17 00:00:00 2001 +-From: Markus Theil +-Date: Tue, 30 Jun 2020 13:53:22 +0200 +-Subject: [PATCH 06/19] hw_features: better debug messages for some error cases +- +-Signed-off-by: Markus Theil +---- +- src/common/hw_features_common.c | 29 ++++++++++++++++++++++------- +- 1 file changed, 22 insertions(+), 7 deletions(-) +- +---- a/src/common/hw_features_common.c +-+++ b/src/common/hw_features_common.c +-@@ -540,13 +540,18 @@ int hostapd_set_freq_params(struct hosta +- if (center_segment1 || +- (center_segment0 != 0 && +- 5000 + center_segment0 * 5 != data->center_freq1 && +-- 2407 + center_segment0 * 5 != data->center_freq1)) +-+ 2407 + center_segment0 * 5 != data->center_freq1)) { +-+ wpa_printf(MSG_ERROR, "20/40 MHz: center segment 0 (=%i) and center freq 1 (=%i) not in sync", +-+ center_segment0, data->center_freq1); +- return -1; +-+ } +- break; +- case CHANWIDTH_80P80MHZ: +- if (center_segment1 == center_segment0 + 4 || +-- center_segment1 == center_segment0 - 4) +-+ center_segment1 == center_segment0 - 4) { +-+ wpa_printf(MSG_ERROR, "80+80 MHz: center segment 1 only 20 MHz apart"); +- return -1; +-+ } +- data->center_freq2 = 5000 + center_segment1 * 5; +- /* fall through */ +- case CHANWIDTH_80MHZ: +-@@ -555,8 +560,10 @@ int hostapd_set_freq_params(struct hosta +- center_segment1) || +- (oper_chwidth == CHANWIDTH_80P80MHZ && +- !center_segment1) || +-- !sec_channel_offset) +-+ !sec_channel_offset) { +-+ wpa_printf(MSG_ERROR, "80/80+80 MHz: center segment 1 wrong or no second channel offset"); +- return -1; +-+ } +- if (!center_segment0) { +- if (channel <= 48) +- center_segment0 = 42; +-@@ -582,16 +589,22 @@ int hostapd_set_freq_params(struct hosta +- center_segment0 == channel - 2 || +- center_segment0 == channel - 6) +- data->center_freq1 = 5000 + center_segment0 * 5; +-- else +-+ else { +-+ wpa_printf(MSG_ERROR, "Wrong coupling between HT and VHT/HE channel setting"); +- return -1; +-+ } +- } +- break; +- case CHANWIDTH_160MHZ: +- data->bandwidth = 160; +-- if (center_segment1) +-+ if (center_segment1) { +-+ wpa_printf(MSG_ERROR, "160 MHz: center segment 1 should not be set"); +- return -1; +-- if (!sec_channel_offset) +-+ } +-+ if (!sec_channel_offset) { +-+ wpa_printf(MSG_ERROR, "160 MHz: second channel offset not set"); +- return -1; +-+ } +- /* +- * Note: HT/VHT config and params are coupled. Check if +- * HT40 channel band is in VHT160 channel band configuration. +-@@ -605,8 +618,10 @@ int hostapd_set_freq_params(struct hosta +- center_segment0 == channel - 10 || +- center_segment0 == channel - 14) +- data->center_freq1 = 5000 + center_segment0 * 5; +-- else +-+ else { +-+ wpa_printf(MSG_ERROR, "160 MHz: HT40 channel band is not in 160 MHz band"); +- return -1; +-+ } +- break; +- } +- +diff --git a/package/network/services/hostapd/patches/007-dfs-use-helper-functions-for-vht-he-parameters.patch b/package/network/services/hostapd/patches/007-dfs-use-helper-functions-for-vht-he-parameters.patch +deleted file mode 100644 +index 3481c52eef..0000000000 +--- a/package/network/services/hostapd/patches/007-dfs-use-helper-functions-for-vht-he-parameters.patch ++++ /dev/null +@@ -1,27 +0,0 @@ +-From 6eacc14904b6f09a1490e697c01adf5dc56c4905 Mon Sep 17 00:00:00 2001 +-From: Markus Theil +-Date: Tue, 30 Jun 2020 13:53:23 +0200 +-Subject: [PATCH 07/19] dfs: use helper functions for vht/he parameters +- +-Signed-off-by: Markus Theil +---- +- src/ap/dfs.c | 6 ++++-- +- 1 file changed, 4 insertions(+), 2 deletions(-) +- +---- a/src/ap/dfs.c +-+++ b/src/ap/dfs.c +-@@ -955,10 +955,12 @@ dfs_downgrade_bandwidth(struct hostapd_i +- if (*skip_radar) { +- *skip_radar = 0; +- } else { +-- if (iface->conf->vht_oper_chwidth == CHANWIDTH_USE_HT) +-+ int oper_chwidth = hostapd_get_oper_chwidth(iface->conf); +-+ +-+ if (oper_chwidth == CHANWIDTH_USE_HT) +- break; +- *skip_radar = 1; +-- iface->conf->vht_oper_chwidth--; +-+ hostapd_set_oper_chwidth(iface->conf, oper_chwidth - 1); +- } +- } +- +diff --git a/package/network/services/hostapd/patches/008-mesh-use-setup-completion-callback-to-complete-mesh-.patch b/package/network/services/hostapd/patches/008-mesh-use-setup-completion-callback-to-complete-mesh-.patch +deleted file mode 100644 +index 28c283d035..0000000000 +--- a/package/network/services/hostapd/patches/008-mesh-use-setup-completion-callback-to-complete-mesh-.patch ++++ /dev/null +@@ -1,108 +0,0 @@ +-From 11e5bbe58eebdb10793eec374b6c8ccc7daf7ec8 Mon Sep 17 00:00:00 2001 +-From: Peter Oh +-Date: Tue, 30 Jun 2020 14:18:56 +0200 +-Subject: [PATCH 08/19] mesh: use setup completion callback to complete mesh +- join +- +-mesh join function is the last function to be called during +-mesh join process, but it's been called a bit earlier than +-it's supposed to be, so that some mesh parameter values +-such as VHT capabilities not applied correct when mesh join +-is in process. +-Moreover current design of mesh join that is called directly +-after mesh initialization isn't suitable for DFS channels to use, +-since mesh join process should be paused until DFS CAC is +-done and resumed after it's done. +-The callback will be called by hostapd_setup_interface_complete_sync. +-There is possiblity that completing mesh init fails, so add error +-handle codes. +- +-Signed-off-by: Peter Oh +---- +- src/ap/hostapd.c | 11 ++++++++++- +- wpa_supplicant/mesh.c | 12 ++++++++++-- +- 2 files changed, 20 insertions(+), 3 deletions(-) +- +---- a/src/ap/hostapd.c +-+++ b/src/ap/hostapd.c +-@@ -434,6 +434,8 @@ static void hostapd_free_hapd_data(struc +- #ifdef CONFIG_MESH +- wpabuf_free(hapd->mesh_pending_auth); +- hapd->mesh_pending_auth = NULL; +-+ /* handling setup failure is already done */ +-+ hapd->setup_complete_cb = NULL; +- #endif /* CONFIG_MESH */ +- +- hostapd_clean_rrm(hapd); +-@@ -2156,6 +2158,13 @@ dfs_offload: +- if (hapd->setup_complete_cb) +- hapd->setup_complete_cb(hapd->setup_complete_cb_ctx); +- +-+#ifdef CONFIG_MESH +-+ if (delay_apply_cfg && iface->mconf == NULL) { +-+ wpa_printf(MSG_ERROR, "Error while completing mesh init"); +-+ goto fail; +-+ } +-+#endif /* CONFIG_MESH */ +-+ +- wpa_printf(MSG_DEBUG, "%s: Setup of interface done.", +- iface->bss[0]->conf->iface); +- if (iface->interfaces && iface->interfaces->terminate_on_error > 0) +-@@ -2299,7 +2308,7 @@ int hostapd_setup_interface(struct hosta +- ret = setup_interface(iface); +- if (ret) { +- wpa_printf(MSG_ERROR, "%s: Unable to setup interface.", +-- iface->bss[0]->conf->iface); +-+ iface->conf ? iface->conf->bss[0]->iface : "N/A"); +- return -1; +- } +- +---- a/wpa_supplicant/mesh.c +-+++ b/wpa_supplicant/mesh.c +-@@ -193,7 +193,6 @@ static int wpas_mesh_init_rsn(struct wpa +- return !wpa_s->mesh_rsn ? -1 : 0; +- } +- +-- +- static int wpas_mesh_complete(struct wpa_supplicant *wpa_s) +- { +- struct hostapd_iface *ifmsh = wpa_s->ifmsh; +-@@ -244,6 +243,13 @@ static int wpas_mesh_complete(struct wpa +- } +- +- +-+static void wpas_mesh_complete_cb(void *arg) +-+{ +-+ struct wpa_supplicant *wpa_s = arg; +-+ wpas_mesh_complete(wpa_s); +-+} +-+ +-+ +- static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s, +- struct wpa_ssid *ssid, +- struct hostapd_freq_params *freq) +-@@ -267,6 +273,7 @@ static int wpa_supplicant_mesh_init(stru +- if (!ifmsh) +- return -ENOMEM; +- +-+ ifmsh->owner = wpa_s; +- ifmsh->drv_flags = wpa_s->drv_flags; +- ifmsh->drv_flags2 = wpa_s->drv_flags2; +- ifmsh->num_bss = 1; +-@@ -285,6 +292,8 @@ static int wpa_supplicant_mesh_init(stru +- bss->drv_priv = wpa_s->drv_priv; +- bss->iface = ifmsh; +- bss->mesh_sta_free_cb = mesh_mpm_free_sta; +-+ bss->setup_complete_cb = wpas_mesh_complete_cb; +-+ bss->setup_complete_cb_ctx = wpa_s; +- frequency = ssid->frequency; +- if (frequency != freq->freq && +- frequency == freq->freq + freq->sec_channel_offset * 20) { +-@@ -523,7 +532,6 @@ int wpa_supplicant_join_mesh(struct wpa_ +- goto out; +- } +- +-- ret = wpas_mesh_complete(wpa_s); +- out: +- return ret; +- } +diff --git a/package/network/services/hostapd/patches/009-mesh-update-ssid-frequency-as-pri-sec-channel-switch.patch b/package/network/services/hostapd/patches/009-mesh-update-ssid-frequency-as-pri-sec-channel-switch.patch +deleted file mode 100644 +index b48de67636..0000000000 +--- a/package/network/services/hostapd/patches/009-mesh-update-ssid-frequency-as-pri-sec-channel-switch.patch ++++ /dev/null +@@ -1,26 +0,0 @@ +-From 87c5e8883898e7eb8e9637e212350c1925a22654 Mon Sep 17 00:00:00 2001 +-From: Peter Oh +-Date: Tue, 30 Jun 2020 14:18:57 +0200 +-Subject: [PATCH 09/19] mesh: update ssid->frequency as pri/sec channel switch +- +-ssid->frequency is one of variables used to gets channel +-number from given frequency. Leave it as unchanged when +-pri/sec channel switched will cause picking up wrong +-channel number after applying secondary channel offset +-for HT40 and leads failing interface bring-up. +- +-Signed-off-by: Peter Oh +---- +- wpa_supplicant/mesh.c | 1 + +- 1 file changed, 1 insertion(+) +- +---- a/wpa_supplicant/mesh.c +-+++ b/wpa_supplicant/mesh.c +-@@ -299,6 +299,7 @@ static int wpa_supplicant_mesh_init(stru +- frequency == freq->freq + freq->sec_channel_offset * 20) { +- wpa_printf(MSG_DEBUG, "mesh: pri/sec channels switched"); +- frequency = freq->freq; +-+ ssid->frequency = frequency; +- } +- wpa_s->assoc_freq = frequency; +- wpa_s->current_ssid = ssid; +diff --git a/package/network/services/hostapd/patches/010-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch b/package/network/services/hostapd/patches/010-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch +index 8afeba93ed..d948c41b30 100644 +--- a/package/network/services/hostapd/patches/010-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch ++++ b/package/network/services/hostapd/patches/010-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch +@@ -14,7 +14,7 @@ Signed-off-by: Peter Oh + + --- a/wpa_supplicant/wpa_supplicant.c + +++ b/wpa_supplicant/wpa_supplicant.c +-@@ -2349,6 +2349,8 @@ void ibss_mesh_setup_freq(struct wpa_sup ++@@ -2395,6 +2395,8 @@ void ibss_mesh_setup_freq(struct wpa_sup + int chwidth, seg0, seg1; + u32 vht_caps = 0; + int is_24ghz; +@@ -23,7 +23,7 @@ Signed-off-by: Peter Oh + + freq->freq = ssid->frequency; + +-@@ -2436,8 +2438,11 @@ void ibss_mesh_setup_freq(struct wpa_sup ++@@ -2484,8 +2486,11 @@ void ibss_mesh_setup_freq(struct wpa_sup + return; + + /* Check primary channel flags */ +@@ -36,7 +36,7 @@ Signed-off-by: Peter Oh + + freq->channel = pri_chan->chan; + +-@@ -2470,8 +2475,11 @@ void ibss_mesh_setup_freq(struct wpa_sup ++@@ -2518,8 +2523,11 @@ void ibss_mesh_setup_freq(struct wpa_sup + return; + + /* Check secondary channel flags */ +@@ -49,7 +49,7 @@ Signed-off-by: Peter Oh + + if (ht40 == -1) { + if (!(pri_chan->flag & HOSTAPD_CHAN_HT40MINUS)) +-@@ -2564,8 +2572,11 @@ skip_ht40: ++@@ -2612,8 +2620,11 @@ skip_ht40: + return; + + /* Back to HT configuration if channel not usable */ +@@ -62,7 +62,7 @@ Signed-off-by: Peter Oh + } + + chwidth = CHANWIDTH_80MHZ; +-@@ -2585,10 +2596,12 @@ skip_ht40: ++@@ -2633,10 +2644,12 @@ skip_ht40: + if (!chan) + continue; + +diff --git a/package/network/services/hostapd/patches/011-mesh-do-not-set-offchanok-on-DFS-channels-in-non-ETS.patch b/package/network/services/hostapd/patches/011-mesh-do-not-set-offchanok-on-DFS-channels-in-non-ETS.patch +deleted file mode 100644 +index d491f7c4bc..0000000000 +--- a/package/network/services/hostapd/patches/011-mesh-do-not-set-offchanok-on-DFS-channels-in-non-ETS.patch ++++ /dev/null +@@ -1,53 +0,0 @@ +-From af8dcbc87466ed6472850a4f1cfe252652cb3d26 Mon Sep 17 00:00:00 2001 +-From: Peter Oh +-Date: Tue, 30 Jun 2020 14:18:59 +0200 +-Subject: [PATCH 11/19] mesh: do not set offchanok on DFS channels in non-ETSI +- +-mac80211 does not allow mgmt tx to use off channel on +-DFS channels in non-ETSI domain, because it will invalidate +-CAC result on current operating channel. +-(mac80211 commit: 34373d12f3cbb74960a73431138ef619d857996f) +-Hence don't set offchanok for mgmt tx in case of DFS channels +-in non-ETSI. +- +-Signed-off-by: Peter Oh +---- +- src/drivers/driver_nl80211.c | 19 +++++++++++++++++++ +- 1 file changed, 19 insertions(+) +- +---- a/src/drivers/driver_nl80211.c +-+++ b/src/drivers/driver_nl80211.c +-@@ -7788,7 +7788,11 @@ static int wpa_driver_nl80211_send_actio +- int ret = -1; +- u8 *buf; +- struct ieee80211_hdr *hdr; +-+ struct hostapd_hw_modes *modes; +- int offchanok = 1; +-+ u16 num_modes, flags; +-+ u8 dfs_domain; +-+ int i; +- +- if (is_ap_interface(drv->nlmode) && (int) freq == bss->freq && +- bss->beacon_set) +-@@ -7817,6 +7821,21 @@ static int wpa_driver_nl80211_send_actio +- os_memset(bss->rand_addr, 0, ETH_ALEN); +- } +- +-+ if (is_mesh_interface(drv->nlmode)) { +-+ modes = nl80211_get_hw_feature_data(bss, &num_modes, +-+ &flags, &dfs_domain); +-+ if (dfs_domain != HOSTAPD_DFS_REGION_ETSI && +-+ ieee80211_is_dfs(bss->freq, modes, num_modes)) +-+ offchanok = 0; +-+ if (modes) { +-+ for (i = 0; i < num_modes; i++) { +-+ os_free(modes[i].channels); +-+ os_free(modes[i].rates); +-+ } +-+ os_free(modes); +-+ } +-+ } +-+ +- if (is_ap_interface(drv->nlmode) && +- (!(drv->capa.flags & WPA_DRIVER_FLAGS_OFFCHANNEL_TX) || +- (int) freq == bss->freq || drv->device_ap_sme || +diff --git a/package/network/services/hostapd/patches/019-mesh-use-deterministic-channel-on-channel-switch.patch b/package/network/services/hostapd/patches/011-mesh-use-deterministic-channel-on-channel-switch.patch +similarity index 97% +rename from package/network/services/hostapd/patches/019-mesh-use-deterministic-channel-on-channel-switch.patch +rename to package/network/services/hostapd/patches/011-mesh-use-deterministic-channel-on-channel-switch.patch +index 8e38a8e53c..03a1e339a9 100644 +--- a/package/network/services/hostapd/patches/019-mesh-use-deterministic-channel-on-channel-switch.patch ++++ b/package/network/services/hostapd/patches/011-mesh-use-deterministic-channel-on-channel-switch.patch +@@ -68,7 +68,7 @@ Signed-off-by: Markus Theil + if (!chan) { + --- a/src/drivers/driver_nl80211.c + +++ b/src/drivers/driver_nl80211.c +-@@ -9473,6 +9473,10 @@ static int nl80211_switch_channel(void * ++@@ -9872,6 +9872,10 @@ static int nl80211_switch_channel(void * + if (ret) + goto error; + +diff --git a/package/network/services/hostapd/patches/012-mesh-fix-channel-switch-error-during-CAC.patch b/package/network/services/hostapd/patches/012-mesh-fix-channel-switch-error-during-CAC.patch +deleted file mode 100644 +index f324d81ae3..0000000000 +--- a/package/network/services/hostapd/patches/012-mesh-fix-channel-switch-error-during-CAC.patch ++++ /dev/null +@@ -1,66 +0,0 @@ +-From ab6995f15aae17af93507dd2344615f91672a31a Mon Sep 17 00:00:00 2001 +-From: Peter Oh +-Date: Tue, 30 Jun 2020 14:19:00 +0200 +-Subject: [PATCH 12/19] mesh: fix channel switch error during CAC +- +-Mesh interface has used its channel parameters that configured +-during its initialization even after channel switched due to +-DFS radar detection during CAC which caused channel switch error. +-This change fixes the error by updating its channel parameters +-when channel's been changed from initial one. +- +-Signed-off-by: Peter Oh +---- +- wpa_supplicant/mesh.c | 34 ++++++++++++++++++++++++++++++++++ +- 1 file changed, 34 insertions(+) +- +---- a/wpa_supplicant/mesh.c +-+++ b/wpa_supplicant/mesh.c +-@@ -13,6 +13,7 @@ +- #include "utils/uuid.h" +- #include "common/ieee802_11_defs.h" +- #include "common/wpa_ctrl.h" +-+#include "common/hw_features_common.h" +- #include "ap/sta_info.h" +- #include "ap/hostapd.h" +- #include "ap/ieee802_11.h" +-@@ -206,6 +207,39 @@ static int wpas_mesh_complete(struct wpa +- return -1; +- } +- +-+ /* +-+ * inspect if channel's been changed since initialized. +-+ * i.e. DFS radar detection +-+ */ +-+ if (ifmsh->freq != params->freq.freq) { +-+ wpa_s->assoc_freq = ifmsh->freq; +-+ ssid->frequency = ifmsh->freq; +-+ struct he_capabilities *he_capab = NULL; +-+ +-+ if (ifmsh->current_mode) +-+ he_capab = &ifmsh->current_mode->he_capab[IEEE80211_MODE_MESH]; +-+ +-+ if (hostapd_set_freq_params(¶ms->freq, +-+ ifmsh->conf->hw_mode, +-+ ifmsh->freq, +-+ ifmsh->conf->channel, +-+ ifmsh->conf->enable_edmg, +-+ ifmsh->conf->edmg_channel, +-+ ifmsh->conf->ieee80211n, +-+ ifmsh->conf->ieee80211ac, +-+ ifmsh->conf->ieee80211ax, +-+ ifmsh->conf->secondary_channel, +-+ hostapd_get_oper_chwidth(ifmsh->conf), +-+ hostapd_get_oper_centr_freq_seg0_idx(ifmsh->conf), +-+ hostapd_get_oper_centr_freq_seg1_idx(ifmsh->conf), +-+ ifmsh->conf->vht_capab, +-+ he_capab)) { +-+ wpa_printf(MSG_ERROR, "Error updating mesh frequency params."); +-+ wpa_supplicant_mesh_deinit(wpa_s); +-+ return -1; +-+ } +-+ } +-+ +- if (ifmsh->mconf->security != MESH_CONF_SEC_NONE && +- wpas_mesh_init_rsn(wpa_s)) { +- wpa_printf(MSG_ERROR, +diff --git a/package/network/services/hostapd/patches/013-mesh-inform-kernel-driver-DFS-handler-in-userspace.patch b/package/network/services/hostapd/patches/013-mesh-inform-kernel-driver-DFS-handler-in-userspace.patch +deleted file mode 100644 +index fb4e68636e..0000000000 +--- a/package/network/services/hostapd/patches/013-mesh-inform-kernel-driver-DFS-handler-in-userspace.patch ++++ /dev/null +@@ -1,48 +0,0 @@ +-From f1118eca5b1a63a4acb2a11ceea15dc4bc259c77 Mon Sep 17 00:00:00 2001 +-From: Peter Oh +-Date: Tue, 30 Jun 2020 14:19:01 +0200 +-Subject: [PATCH 13/19] mesh: inform kernel driver DFS handler in userspace +- +-NL80211_ATTR_HANDLE_DFS is required by kerenel space +-to enable DFS channels that indicates DFS handler +-resides in userspace. +- +-Signed-off-by: Peter Oh +---- +- src/drivers/driver.h | 1 + +- src/drivers/driver_nl80211.c | 3 +++ +- wpa_supplicant/mesh.c | 1 + +- 3 files changed, 5 insertions(+) +- +---- a/src/drivers/driver.h +-+++ b/src/drivers/driver.h +-@@ -1542,6 +1542,7 @@ struct wpa_driver_mesh_join_params { +- #define WPA_DRIVER_MESH_FLAG_SAE_AUTH 0x00000004 +- #define WPA_DRIVER_MESH_FLAG_AMPE 0x00000008 +- unsigned int flags; +-+ u8 handle_dfs; +- }; +- +- struct wpa_driver_set_key_params { +---- a/src/drivers/driver_nl80211.c +-+++ b/src/drivers/driver_nl80211.c +-@@ -10070,6 +10070,9 @@ static int nl80211_join_mesh(struct i802 +- +- wpa_printf(MSG_DEBUG, " * flags=%08X", params->flags); +- +-+ if (params->handle_dfs) +-+ if (nla_put_flag(msg, NL80211_ATTR_HANDLE_DFS)) +-+ goto fail; +- container = nla_nest_start(msg, NL80211_ATTR_MESH_SETUP); +- if (!container) +- goto fail; +---- a/wpa_supplicant/mesh.c +-+++ b/wpa_supplicant/mesh.c +-@@ -355,6 +355,7 @@ static int wpa_supplicant_mesh_init(stru +- conf->country[0] = wpa_s->conf->country[0]; +- conf->country[1] = wpa_s->conf->country[1]; +- conf->country[2] = ' '; +-+ wpa_s->mesh_params->handle_dfs = 1; +- } +- +- bss->iconf = conf; +diff --git a/package/network/services/hostapd/patches/014-mesh-fixes-for-mesh-init-deinit.patch b/package/network/services/hostapd/patches/014-mesh-fixes-for-mesh-init-deinit.patch +deleted file mode 100644 +index fe12d401e4..0000000000 +--- a/package/network/services/hostapd/patches/014-mesh-fixes-for-mesh-init-deinit.patch ++++ /dev/null +@@ -1,158 +0,0 @@ +-From 30bdefd7559d57eae8c3c7e6f721ecf7be929bf2 Mon Sep 17 00:00:00 2001 +-From: Markus Theil +-Date: Tue, 30 Jun 2020 14:19:02 +0200 +-Subject: [PATCH 14/19] mesh: fixes for mesh init/deinit +- +-Send mesh group started notification after join completion +-callback is called. +- +-Implement outstanding TODO, to leave the mesh network on deinit. +- +-Signed-off-by: Markus Theil +---- +- wpa_supplicant/mesh.c | 32 ++++++++++++++++++++------------ +- wpa_supplicant/mesh.h | 6 ++++-- +- wpa_supplicant/wpa_supplicant.c | 8 ++------ +- 3 files changed, 26 insertions(+), 20 deletions(-) +- +---- a/wpa_supplicant/mesh.c +-+++ b/wpa_supplicant/mesh.c +-@@ -30,20 +30,20 @@ +- +- static void wpa_supplicant_mesh_deinit(struct wpa_supplicant *wpa_s) +- { +-- wpa_supplicant_mesh_iface_deinit(wpa_s, wpa_s->ifmsh); +-+ wpa_supplicant_mesh_iface_deinit(wpa_s, wpa_s->ifmsh, true); +- wpa_s->ifmsh = NULL; +- wpa_s->current_ssid = NULL; +- os_free(wpa_s->mesh_rsn); +- wpa_s->mesh_rsn = NULL; +- os_free(wpa_s->mesh_params); +- wpa_s->mesh_params = NULL; +-- /* TODO: leave mesh (stop beacon). This will happen on link down +-- * anyway, so it's not urgent */ +-+ wpa_supplicant_leave_mesh(wpa_s, false); +- } +- +- +- void wpa_supplicant_mesh_iface_deinit(struct wpa_supplicant *wpa_s, +-- struct hostapd_iface *ifmsh) +-+ struct hostapd_iface *ifmsh, +-+ bool also_clear_hostapd) +- { +- if (!ifmsh) +- return; +-@@ -64,8 +64,10 @@ void wpa_supplicant_mesh_iface_deinit(st +- } +- +- /* take care of shared data */ +-- hostapd_interface_deinit(ifmsh); +-- hostapd_interface_free(ifmsh); +-+ if (also_clear_hostapd) { +-+ hostapd_interface_deinit(ifmsh); +-+ hostapd_interface_free(ifmsh); +-+ } +- } +- +- +-@@ -244,8 +246,7 @@ static int wpas_mesh_complete(struct wpa +- wpas_mesh_init_rsn(wpa_s)) { +- wpa_printf(MSG_ERROR, +- "mesh: RSN initialization failed - deinit mesh"); +-- wpa_supplicant_mesh_deinit(wpa_s); +-- wpa_drv_leave_mesh(wpa_s); +-+ wpa_supplicant_mesh_iface_deinit(wpa_s, wpa_s->ifmsh, false); +- return -1; +- } +- +-@@ -270,9 +271,15 @@ static int wpas_mesh_complete(struct wpa +- /* hostapd sets the interface down until we associate */ +- wpa_drv_set_operstate(wpa_s, 1); +- +-- if (!ret) +-+ if (!ret) { +- wpa_supplicant_set_state(wpa_s, WPA_COMPLETED); +- +-+ wpa_msg(wpa_s, MSG_INFO, MESH_GROUP_STARTED "ssid=\"%s\" id=%d", +-+ wpa_ssid_txt(ssid->ssid, ssid->ssid_len), +-+ ssid->id); +-+ wpas_notify_mesh_group_started(wpa_s, ssid); +-+ } +-+ +- return ret; +- } +- +-@@ -563,7 +570,7 @@ int wpa_supplicant_join_mesh(struct wpa_ +- wpa_s->mesh_params = params; +- if (wpa_supplicant_mesh_init(wpa_s, ssid, ¶ms->freq)) { +- wpa_msg(wpa_s, MSG_ERROR, "Failed to init mesh"); +-- wpa_drv_leave_mesh(wpa_s); +-+ wpa_supplicant_leave_mesh(wpa_s, true); +- ret = -1; +- goto out; +- } +-@@ -573,14 +580,15 @@ out: +- } +- +- +--int wpa_supplicant_leave_mesh(struct wpa_supplicant *wpa_s) +-+int wpa_supplicant_leave_mesh(struct wpa_supplicant *wpa_s, bool need_deinit) +- { +- int ret = 0; +- +- wpa_msg(wpa_s, MSG_INFO, "leaving mesh"); +- +- /* Need to send peering close messages first */ +-- wpa_supplicant_mesh_deinit(wpa_s); +-+ if (need_deinit) +-+ wpa_supplicant_mesh_deinit(wpa_s); +- +- ret = wpa_drv_leave_mesh(wpa_s); +- if (ret) +---- a/wpa_supplicant/mesh.h +-+++ b/wpa_supplicant/mesh.h +-@@ -11,9 +11,11 @@ +- +- int wpa_supplicant_join_mesh(struct wpa_supplicant *wpa_s, +- struct wpa_ssid *ssid); +--int wpa_supplicant_leave_mesh(struct wpa_supplicant *wpa_s); +-+int wpa_supplicant_leave_mesh(struct wpa_supplicant *wpa_s, +-+ bool need_deinit); +- void wpa_supplicant_mesh_iface_deinit(struct wpa_supplicant *wpa_s, +-- struct hostapd_iface *ifmsh); +-+ struct hostapd_iface *ifmsh, +-+ bool also_clear_hostapd); +- int wpas_mesh_scan_result_text(const u8 *ies, size_t ies_len, char *buf, +- char *end); +- int wpas_mesh_add_interface(struct wpa_supplicant *wpa_s, char *ifname, +---- a/wpa_supplicant/wpa_supplicant.c +-+++ b/wpa_supplicant/wpa_supplicant.c +-@@ -2225,10 +2225,6 @@ void wpa_supplicant_associate(struct wpa +- return; +- } +- wpa_s->current_bss = bss; +-- wpa_msg(wpa_s, MSG_INFO, MESH_GROUP_STARTED "ssid=\"%s\" id=%d", +-- wpa_ssid_txt(ssid->ssid, ssid->ssid_len), +-- ssid->id); +-- wpas_notify_mesh_group_started(wpa_s, ssid); +- #else /* CONFIG_MESH */ +- wpa_msg(wpa_s, MSG_ERROR, +- "mesh mode support not included in the build"); +-@@ -3938,7 +3934,7 @@ void wpa_supplicant_deauthenticate(struc +- wpa_s->ifname); +- wpas_notify_mesh_group_removed(wpa_s, mconf->meshid, +- mconf->meshid_len, reason_code); +-- wpa_supplicant_leave_mesh(wpa_s); +-+ wpa_supplicant_leave_mesh(wpa_s, true); +- } +- #endif /* CONFIG_MESH */ +- +-@@ -6551,7 +6547,7 @@ static void wpa_supplicant_deinit_iface( +- +- #ifdef CONFIG_MESH +- if (wpa_s->ifmsh) { +-- wpa_supplicant_mesh_iface_deinit(wpa_s, wpa_s->ifmsh); +-+ wpa_supplicant_mesh_iface_deinit(wpa_s, wpa_s->ifmsh, true); +- wpa_s->ifmsh = NULL; +- } +- #endif /* CONFIG_MESH */ +diff --git a/package/network/services/hostapd/patches/015-mesh-fix-DFS-deinit-init.patch b/package/network/services/hostapd/patches/015-mesh-fix-DFS-deinit-init.patch +deleted file mode 100644 +index c540dd6786..0000000000 +--- a/package/network/services/hostapd/patches/015-mesh-fix-DFS-deinit-init.patch ++++ /dev/null +@@ -1,262 +0,0 @@ +-From d017f5d98a143c46c3c3fcb0e6507ca0b2bebdb0 Mon Sep 17 00:00:00 2001 +-From: Markus Theil +-Date: Tue, 30 Jun 2020 14:19:03 +0200 +-Subject: [PATCH 15/19] mesh: fix DFS deinit/init +- +-The hostapd DFS code deinitializes and initializes the +-AP interface, if a clean channel switch is not possible. +-In this case the AP code paths would deinit the driver, for +-example nl80211, without wpa_supplicant code paths getting +-notice of this. +- +-Therefore add callbacks for wpa_supplicant mesh methods, +-which are called on init/deinit of the AP bss. These +-callbacks are then used to handle the reset in the mesh +-code. +- +-Signed-off-by: Markus Theil +---- +- src/ap/dfs.c | 2 +- +- src/ap/hostapd.c | 17 ++++++-- +- src/ap/hostapd.h | 6 +++ +- wpa_supplicant/mesh.c | 90 +++++++++++++++++++++++++++++++++++++------ +- 4 files changed, 100 insertions(+), 15 deletions(-) +- +---- a/src/ap/dfs.c +-+++ b/src/ap/dfs.c +-@@ -1112,7 +1112,7 @@ static int hostapd_dfs_start_channel_swi +- oper_centr_freq_seg0_idx, +- oper_centr_freq_seg1_idx, +- cmode->vht_capab, +-- &cmode->he_capab[IEEE80211_MODE_AP]); +-+ &cmode->he_capab[iface->conf->hw_mode]); +- +- if (err) { +- wpa_printf(MSG_ERROR, "DFS failed to calculate CSA freq params"); +---- a/src/ap/hostapd.c +-+++ b/src/ap/hostapd.c +-@@ -354,7 +354,7 @@ static int hostapd_broadcast_wep_set(str +- #endif /* CONFIG_WEP */ +- +- +--static void hostapd_free_hapd_data(struct hostapd_data *hapd) +-+void hostapd_free_hapd_data(struct hostapd_data *hapd) +- { +- os_free(hapd->probereq_cb); +- hapd->probereq_cb = NULL; +-@@ -498,7 +498,7 @@ static void sta_track_deinit(struct host +- } +- +- +--static void hostapd_cleanup_iface_partial(struct hostapd_iface *iface) +-+void hostapd_cleanup_iface_partial(struct hostapd_iface *iface) +- { +- wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface); +- #ifdef NEED_AP_MLME +-@@ -626,7 +626,7 @@ static int hostapd_flush_old_stations(st +- } +- +- +--static void hostapd_bss_deinit_no_free(struct hostapd_data *hapd) +-+void hostapd_bss_deinit_no_free(struct hostapd_data *hapd) +- { +- hostapd_free_stas(hapd); +- hostapd_flush_old_stations(hapd, WLAN_REASON_DEAUTH_LEAVING); +-@@ -2690,6 +2690,13 @@ int hostapd_enable_iface(struct hostapd_ +- { +- size_t j; +- +-+ if (hapd_iface == NULL) +-+ return -1; +-+ +-+ if (hapd_iface->enable_iface_cb != NULL) { +-+ return hapd_iface->enable_iface_cb(hapd_iface); +-+ } +-+ +- if (hapd_iface->bss[0]->drv_priv != NULL) { +- wpa_printf(MSG_ERROR, "Interface %s already enabled", +- hapd_iface->conf->bss[0]->iface); +-@@ -2751,6 +2758,10 @@ int hostapd_disable_iface(struct hostapd +- if (hapd_iface == NULL) +- return -1; +- +-+ if (hapd_iface->disable_iface_cb != NULL) { +-+ return hapd_iface->disable_iface_cb(hapd_iface); +-+ } +-+ +- if (hapd_iface->bss[0]->drv_priv == NULL) { +- wpa_printf(MSG_INFO, "Interface %s already disabled", +- hapd_iface->conf->bss[0]->iface); +---- a/src/ap/hostapd.h +-+++ b/src/ap/hostapd.h +-@@ -589,6 +589,9 @@ struct hostapd_iface { +- +- /* Previous WMM element information */ +- struct hostapd_wmm_ac_params prev_wmm[WMM_AC_NUM]; +-+ +-+ int (*enable_iface_cb)(struct hostapd_iface *iface); +-+ int (*disable_iface_cb)(struct hostapd_iface *iface); +- }; +- +- /* hostapd.c */ +-@@ -617,6 +620,9 @@ void hostapd_interface_deinit_free(struc +- int hostapd_enable_iface(struct hostapd_iface *hapd_iface); +- int hostapd_reload_iface(struct hostapd_iface *hapd_iface); +- int hostapd_disable_iface(struct hostapd_iface *hapd_iface); +-+void hostapd_bss_deinit_no_free(struct hostapd_data *hapd); +-+void hostapd_free_hapd_data(struct hostapd_data *hapd); +-+void hostapd_cleanup_iface_partial(struct hostapd_iface *iface); +- int hostapd_add_iface(struct hapd_interfaces *ifaces, char *buf); +- int hostapd_remove_iface(struct hapd_interfaces *ifaces, char *buf); +- void hostapd_channel_list_updated(struct hostapd_iface *iface, int initiator); +---- a/wpa_supplicant/mesh.c +-+++ b/wpa_supplicant/mesh.c +-@@ -28,15 +28,20 @@ +- #include "mesh.h" +- +- +--static void wpa_supplicant_mesh_deinit(struct wpa_supplicant *wpa_s) +-+static void wpa_supplicant_mesh_deinit(struct wpa_supplicant *wpa_s, bool also_clear_hostapd) +- { +-- wpa_supplicant_mesh_iface_deinit(wpa_s, wpa_s->ifmsh, true); +-- wpa_s->ifmsh = NULL; +-- wpa_s->current_ssid = NULL; +-+ wpa_supplicant_mesh_iface_deinit(wpa_s, wpa_s->ifmsh, also_clear_hostapd); +-+ +-+ if (also_clear_hostapd) { +-+ wpa_s->ifmsh = NULL; +-+ wpa_s->current_ssid = NULL; +-+ os_free(wpa_s->mesh_params); +-+ wpa_s->mesh_params = NULL; +-+ } +-+ +- os_free(wpa_s->mesh_rsn); +- wpa_s->mesh_rsn = NULL; +-- os_free(wpa_s->mesh_params); +-- wpa_s->mesh_params = NULL; +-+ +- wpa_supplicant_leave_mesh(wpa_s, false); +- } +- +-@@ -237,7 +242,7 @@ static int wpas_mesh_complete(struct wpa +- ifmsh->conf->vht_capab, +- he_capab)) { +- wpa_printf(MSG_ERROR, "Error updating mesh frequency params."); +-- wpa_supplicant_mesh_deinit(wpa_s); +-+ wpa_supplicant_mesh_deinit(wpa_s, true); +- return -1; +- } +- } +-@@ -246,7 +251,7 @@ static int wpas_mesh_complete(struct wpa +- wpas_mesh_init_rsn(wpa_s)) { +- wpa_printf(MSG_ERROR, +- "mesh: RSN initialization failed - deinit mesh"); +-- wpa_supplicant_mesh_iface_deinit(wpa_s, wpa_s->ifmsh, false); +-+ wpa_supplicant_mesh_deinit(wpa_s, false); +- return -1; +- } +- +-@@ -291,6 +296,67 @@ static void wpas_mesh_complete_cb(void * +- } +- +- +-+static int wpa_supplicant_mesh_enable_iface_cb(struct hostapd_iface *ifmsh) +-+{ +-+ struct wpa_supplicant *wpa_s = ifmsh->owner; +-+ struct hostapd_data *bss; +-+ +-+ ifmsh->mconf = mesh_config_create(wpa_s, wpa_s->current_ssid); +-+ +-+ bss = ifmsh->bss[0]; +-+ bss->msg_ctx = wpa_s; +-+ os_memcpy(bss->own_addr, wpa_s->own_addr, ETH_ALEN); +-+ bss->driver = wpa_s->driver; +-+ bss->drv_priv = wpa_s->drv_priv; +-+ bss->iface = ifmsh; +-+ bss->mesh_sta_free_cb = mesh_mpm_free_sta; +-+ bss->setup_complete_cb = wpas_mesh_complete_cb; +-+ bss->setup_complete_cb_ctx = wpa_s; +-+ +-+ bss->conf->start_disabled = 1; +-+ bss->conf->mesh = MESH_ENABLED; +-+ bss->conf->ap_max_inactivity = wpa_s->conf->mesh_max_inactivity; +-+ +-+ if (wpa_drv_init_mesh(wpa_s)) { +-+ wpa_msg(wpa_s, MSG_ERROR, "Failed to init mesh in driver"); +-+ return -1; +-+ } +-+ +-+ if (hostapd_setup_interface(ifmsh)) { +-+ wpa_printf(MSG_ERROR, +-+ "Failed to initialize hostapd interface for mesh"); +-+ return -1; +-+ } +-+ +-+ return 0; +-+} +-+ +-+ +-+static int wpa_supplicant_mesh_disable_iface_cb(struct hostapd_iface *ifmsh) +-+{ +-+ struct wpa_supplicant *wpa_s = ifmsh->owner; +-+ int j; +-+ +-+ wpa_supplicant_mesh_deinit(wpa_s, false); +-+ +-+#ifdef NEED_AP_MLME +-+ for (j = 0; j < ifmsh->num_bss; j++) +-+ hostapd_cleanup_cs_params(ifmsh->bss[j]); +-+#endif /* NEED_AP_MLME */ +-+ +-+ /* same as hostapd_interface_deinit without deinitializing ctrl-iface */ +-+ for (j = 0; j < ifmsh->num_bss; j++) { +-+ struct hostapd_data *hapd = ifmsh->bss[j]; +-+ hostapd_bss_deinit_no_free(hapd); +-+ hostapd_free_hapd_data(hapd); +-+ } +-+ +-+ hostapd_cleanup_iface_partial(ifmsh); +-+ +-+ return 0; +-+} +-+ +-+ +- static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s, +- struct wpa_ssid *ssid, +- struct hostapd_freq_params *freq) +-@@ -318,6 +384,8 @@ static int wpa_supplicant_mesh_init(stru +- ifmsh->drv_flags = wpa_s->drv_flags; +- ifmsh->drv_flags2 = wpa_s->drv_flags2; +- ifmsh->num_bss = 1; +-+ ifmsh->enable_iface_cb = wpa_supplicant_mesh_enable_iface_cb; +-+ ifmsh->disable_iface_cb = wpa_supplicant_mesh_disable_iface_cb; +- ifmsh->bss = os_calloc(wpa_s->ifmsh->num_bss, +- sizeof(struct hostapd_data *)); +- if (!ifmsh->bss) +-@@ -451,7 +519,7 @@ static int wpa_supplicant_mesh_init(stru +- +- return 0; +- out_free: +-- wpa_supplicant_mesh_deinit(wpa_s); +-+ wpa_supplicant_mesh_deinit(wpa_s, true); +- return -ENOMEM; +- } +- +-@@ -499,7 +567,7 @@ int wpa_supplicant_join_mesh(struct wpa_ +- goto out; +- } +- +-- wpa_supplicant_mesh_deinit(wpa_s); +-+ wpa_supplicant_mesh_deinit(wpa_s, true); +- +- wpa_s->pairwise_cipher = WPA_CIPHER_NONE; +- wpa_s->group_cipher = WPA_CIPHER_NONE; +-@@ -588,7 +656,7 @@ int wpa_supplicant_leave_mesh(struct wpa +- +- /* Need to send peering close messages first */ +- if (need_deinit) +-- wpa_supplicant_mesh_deinit(wpa_s); +-+ wpa_supplicant_mesh_deinit(wpa_s, true); +- +- ret = wpa_drv_leave_mesh(wpa_s); +- if (ret) +diff --git a/package/network/services/hostapd/patches/016-tests-DFS-test-for-wpa_supplicant-mesh.patch b/package/network/services/hostapd/patches/016-tests-DFS-test-for-wpa_supplicant-mesh.patch +deleted file mode 100644 +index b6a51b2f35..0000000000 +--- a/package/network/services/hostapd/patches/016-tests-DFS-test-for-wpa_supplicant-mesh.patch ++++ /dev/null +@@ -1,94 +0,0 @@ +-From 6ee4e70d469b8ce05013ed524eea32ea303e6563 Mon Sep 17 00:00:00 2001 +-From: Markus Theil +-Date: Tue, 30 Jun 2020 14:19:04 +0200 +-Subject: [PATCH 16/19] tests: DFS test for wpa_supplicant mesh +- +-Add a test with uses a DFS channel, waits for CAC +-afterwards successfull mesh join and then triggers +-a radar event and check if the mesh comes up again +-on the same device. +- +-Signed-off-by: Markus Theil +---- +- tests/hwsim/test_wpas_mesh.py | 56 +++++++++++++++++++++++++++++++++-- +- 1 file changed, 54 insertions(+), 2 deletions(-) +- +---- a/tests/hwsim/test_wpas_mesh.py +-+++ b/tests/hwsim/test_wpas_mesh.py +-@@ -80,8 +80,23 @@ def check_mesh_scan(dev, params, other_s +- if '[MESH]' not in bss['flags']: +- raise Exception("BSS output did not include MESH flag") +- +--def check_mesh_group_added(dev): +-- ev = dev.wait_event(["MESH-GROUP-STARTED"]) +-+def check_dfs_started(dev, timeout=10): +-+ ev = dev.wait_event(["DFS-CAC-START"], timeout=timeout) +-+ if ev is None: +-+ raise Exception("Test exception: CAC did not start") +-+ +-+def check_dfs_finished(dev, timeout=70): +-+ ev = dev.wait_event(["DFS-CAC-COMPLETED"], timeout=timeout) +-+ if ev is None: +-+ raise Exception("Test exception: CAC did not finish") +-+ +-+def check_mesh_radar_handling_finished(dev, timeout=75): +-+ ev = dev.wait_event(["CTRL-EVENT-CHANNEL-SWITCH", "MESH-GROUP-STARTED"], timeout=timeout) +-+ if ev is None: +-+ raise Exception("Test exception: Couldn't join mesh") +-+ +-+def check_mesh_group_added(dev, timeout=10): +-+ ev = dev.wait_event(["MESH-GROUP-STARTED"], timeout=timeout) +- if ev is None: +- raise Exception("Test exception: Couldn't join mesh") +- +-@@ -91,6 +106,10 @@ def check_mesh_group_removed(dev): +- if ev is None: +- raise Exception("Test exception: Couldn't leave mesh") +- +-+def check_regdom_change(dev, timeout=10): +-+ ev = dev.wait_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=timeout) +-+ if ev is None: +-+ raise Exception("Test exception: No regdom change happened.") +- +- def check_mesh_peer_connected(dev, timeout=10): +- ev = dev.wait_event(["MESH-PEER-CONNECTED"], timeout=timeout) +-@@ -167,6 +186,39 @@ def test_wpas_mesh_group_remove(dev): +- check_mesh_group_removed(dev[0]) +- dev[0].mesh_group_remove() +- +-+def dfs_simulate_radar(dev): +-+ logger.info("Trigger a simulated radar event") +-+ phyname = dev.get_driver_status_field("phyname") +-+ radar_file = '/sys/kernel/debug/ieee80211/' + phyname + '/hwsim/dfs_simulate_radar' +-+ with open(radar_file, 'w') as f: +-+ f.write('1') +-+ +-+@long_duration_test +-+def test_wpas_mesh_peer_connected_dfs(dev): +-+ """wpa_supplicant MESH peer connected""" +-+ dev[0].set("country", "DE") +-+ dev[1].set("country", "DE") +-+ +-+ check_regdom_change(dev[0]) +-+ check_regdom_change(dev[1]) +-+ +-+ check_mesh_support(dev[0]) +-+ add_open_mesh_network(dev[0], freq="5500", beacon_int=160) +-+ add_open_mesh_network(dev[1], freq="5500", beacon_int=160) +-+ check_dfs_started(dev[0]) +-+ check_dfs_finished(dev[0]) +-+ check_mesh_joined_connected(dev, timeout0=10) +-+ +-+ dfs_simulate_radar(dev[0]) +-+ +-+ check_mesh_radar_handling_finished(dev[0], timeout=75) +-+ +-+ dev[0].set("country", "00") +-+ dev[1].set("country", "00") +-+ +-+ check_regdom_change(dev[0]) +-+ check_regdom_change(dev[1]) +-+ +- def test_wpas_mesh_peer_connected(dev): +- """wpa_supplicant MESH peer connected""" +- check_mesh_support(dev[0]) +diff --git a/package/network/services/hostapd/patches/017-mesh-fix-mesh_oom-test.patch b/package/network/services/hostapd/patches/017-mesh-fix-mesh_oom-test.patch +deleted file mode 100644 +index cc566c7de2..0000000000 +--- a/package/network/services/hostapd/patches/017-mesh-fix-mesh_oom-test.patch ++++ /dev/null +@@ -1,24 +0,0 @@ +-From 928da9a270deaf4409aee4d87a33a6f61b56c136 Mon Sep 17 00:00:00 2001 +-From: Markus Theil +-Date: Tue, 30 Jun 2020 14:19:05 +0200 +-Subject: [PATCH 17/19] mesh: fix mesh_oom test +- +-Only change freq params, if ifmsh->freq is set initially, which only +-happens if hostapd_get_hw_features in setup_interface2 succeeds. +- +-Signed-off-by: Markus Theil +---- +- wpa_supplicant/mesh.c | 2 +- +- 1 file changed, 1 insertion(+), 1 deletion(-) +- +---- a/wpa_supplicant/mesh.c +-+++ b/wpa_supplicant/mesh.c +-@@ -218,7 +218,7 @@ static int wpas_mesh_complete(struct wpa +- * inspect if channel's been changed since initialized. +- * i.e. DFS radar detection +- */ +-- if (ifmsh->freq != params->freq.freq) { +-+ if (ifmsh->freq > 0 && ifmsh->freq != params->freq.freq) { +- wpa_s->assoc_freq = ifmsh->freq; +- ssid->frequency = ifmsh->freq; +- struct he_capabilities *he_capab = NULL; +diff --git a/package/network/services/hostapd/patches/018-mesh-move-mesh-freq-setting-to-own-function.patch b/package/network/services/hostapd/patches/018-mesh-move-mesh-freq-setting-to-own-function.patch +deleted file mode 100644 +index 1dd7d37411..0000000000 +--- a/package/network/services/hostapd/patches/018-mesh-move-mesh-freq-setting-to-own-function.patch ++++ /dev/null +@@ -1,93 +0,0 @@ +-From 1eab0e62920f443f8814bad846f6439843223b69 Mon Sep 17 00:00:00 2001 +-From: Markus Theil +-Date: Tue, 30 Jun 2020 14:19:06 +0200 +-Subject: [PATCH 18/19] mesh: move mesh freq setting to own function +- +-Signed-off-by: Markus Theil +---- +- wpa_supplicant/mesh.c | 59 ++++++++++++++++++++++++++----------------- +- 1 file changed, 36 insertions(+), 23 deletions(-) +- +---- a/wpa_supplicant/mesh.c +-+++ b/wpa_supplicant/mesh.c +-@@ -201,6 +201,40 @@ static int wpas_mesh_init_rsn(struct wpa +- return !wpa_s->mesh_rsn ? -1 : 0; +- } +- +-+ +-+static int wpas_mesh_update_freq_params(struct wpa_supplicant *wpa_s) +-+{ +-+ struct wpa_driver_mesh_join_params *params = wpa_s->mesh_params; +-+ struct hostapd_iface *ifmsh = wpa_s->ifmsh; +-+ struct he_capabilities *he_capab = NULL; +-+ +-+ if (ifmsh->current_mode) +-+ he_capab = &ifmsh->current_mode->he_capab[IEEE80211_MODE_MESH]; +-+ +-+ if (hostapd_set_freq_params(¶ms->freq, +-+ ifmsh->conf->hw_mode, +-+ ifmsh->freq, +-+ ifmsh->conf->channel, +-+ ifmsh->conf->enable_edmg, +-+ ifmsh->conf->edmg_channel, +-+ ifmsh->conf->ieee80211n, +-+ ifmsh->conf->ieee80211ac, +-+ ifmsh->conf->ieee80211ax, +-+ ifmsh->conf->secondary_channel, +-+ hostapd_get_oper_chwidth(ifmsh->conf), +-+ hostapd_get_oper_centr_freq_seg0_idx(ifmsh->conf), +-+ hostapd_get_oper_centr_freq_seg1_idx(ifmsh->conf), +-+ ifmsh->conf->vht_capab, +-+ he_capab)) { +-+ wpa_printf(MSG_ERROR, "Error updating mesh frequency params."); +-+ wpa_supplicant_mesh_deinit(wpa_s, true); +-+ return -1; +-+ } +-+ +-+ return 0; +-+} +-+ +-+ +- static int wpas_mesh_complete(struct wpa_supplicant *wpa_s) +- { +- struct hostapd_iface *ifmsh = wpa_s->ifmsh; +-@@ -221,30 +255,8 @@ static int wpas_mesh_complete(struct wpa +- if (ifmsh->freq > 0 && ifmsh->freq != params->freq.freq) { +- wpa_s->assoc_freq = ifmsh->freq; +- ssid->frequency = ifmsh->freq; +-- struct he_capabilities *he_capab = NULL; +-- +-- if (ifmsh->current_mode) +-- he_capab = &ifmsh->current_mode->he_capab[IEEE80211_MODE_MESH]; +-- +-- if (hostapd_set_freq_params(¶ms->freq, +-- ifmsh->conf->hw_mode, +-- ifmsh->freq, +-- ifmsh->conf->channel, +-- ifmsh->conf->enable_edmg, +-- ifmsh->conf->edmg_channel, +-- ifmsh->conf->ieee80211n, +-- ifmsh->conf->ieee80211ac, +-- ifmsh->conf->ieee80211ax, +-- ifmsh->conf->secondary_channel, +-- hostapd_get_oper_chwidth(ifmsh->conf), +-- hostapd_get_oper_centr_freq_seg0_idx(ifmsh->conf), +-- hostapd_get_oper_centr_freq_seg1_idx(ifmsh->conf), +-- ifmsh->conf->vht_capab, +-- he_capab)) { +-- wpa_printf(MSG_ERROR, "Error updating mesh frequency params."); +-- wpa_supplicant_mesh_deinit(wpa_s, true); +-+ if (wpas_mesh_update_freq_params(wpa_s) != 0) +- return -1; +-- } +- } +- +- if (ifmsh->mconf->security != MESH_CONF_SEC_NONE && +-@@ -518,6 +530,7 @@ static int wpa_supplicant_mesh_init(stru +- } +- +- return 0; +-+ +- out_free: +- wpa_supplicant_mesh_deinit(wpa_s, true); +- return -ENOMEM; +diff --git a/package/network/services/hostapd/patches/020-ignore-4addr-mode-enabling-error.patch b/package/network/services/hostapd/patches/020-ignore-4addr-mode-enabling-error.patch +deleted file mode 100644 +index 3431ac0949..0000000000 +--- a/package/network/services/hostapd/patches/020-ignore-4addr-mode-enabling-error.patch ++++ /dev/null +@@ -1,78 +0,0 @@ +-From c7cca9b08f3e1e49c4a4a59ec66c47d91448e6ae Mon Sep 17 00:00:00 2001 +-From: Jouni Malinen +-Date: Sat, 13 Feb 2021 23:59:28 +0200 +-Subject: [PATCH] nl80211: Ignore 4addr mode enabling error if it was already +- enabled +- +-nl80211_set_4addr_mode() could fail when trying to enable 4addr mode on +-an interface that is in a bridge and has 4addr mode already enabled. +-This operation would not have been necessary in the first place and this +-failure results in disconnecting, e.g., when roaming from one backhaul +-BSS to another BSS with Multi AP. +- +-Avoid this issue by ignoring the nl80211 command failure in the case +-where 4addr mode is being enabled while it has already been enabled. +- +-Signed-off-by: Jouni Malinen +---- +- src/drivers/driver_nl80211.c | 23 +++++++++++++++++++++++ +- 1 file changed, 23 insertions(+) +- +-diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c +-index 72189da24..011a15e68 100644 +---- a/src/drivers/driver_nl80211.c +-+++ b/src/drivers/driver_nl80211.c +-@@ -617,6 +617,7 @@ struct wiphy_idx_data { +- int wiphy_idx; +- enum nl80211_iftype nlmode; +- u8 *macaddr; +-+ u8 use_4addr; +- }; +- +- +-@@ -639,6 +640,9 @@ static int netdev_info_handler(struct nl_msg *msg, void *arg) +- os_memcpy(info->macaddr, nla_data(tb[NL80211_ATTR_MAC]), +- ETH_ALEN); +- +-+ if (tb[NL80211_ATTR_4ADDR]) +-+ info->use_4addr = nla_get_u8(tb[NL80211_ATTR_4ADDR]); +-+ +- return NL_SKIP; +- } +- +-@@ -691,6 +695,20 @@ static int nl80211_get_macaddr(struct i802_bss *bss) +- } +- +- +-+static int nl80211_get_4addr(struct i802_bss *bss) +-+{ +-+ struct nl_msg *msg; +-+ struct wiphy_idx_data data = { +-+ .use_4addr = 0, +-+ }; +-+ +-+ if (!(msg = nl80211_cmd_msg(bss, 0, NL80211_CMD_GET_INTERFACE)) || +-+ send_and_recv_msgs(bss->drv, msg, netdev_info_handler, &data)) +-+ return -1; +-+ return data.use_4addr; +-+} +-+ +-+ +- static int nl80211_register_beacons(struct wpa_driver_nl80211_data *drv, +- struct nl80211_wiphy_data *w) +- { +-@@ -11482,6 +11500,11 @@ static int nl80211_set_4addr_mode(void *priv, const char *bridge_ifname, +- +- ret = send_and_recv_msgs(drv, msg, NULL, NULL); +- msg = NULL; +-+ if (ret && val && nl80211_get_4addr(bss) == 1) { +-+ wpa_printf(MSG_DEBUG, +-+ "nl80211: 4addr mode was already enabled"); +-+ ret = 0; +-+ } +- if (!ret) { +- if (bridge_ifname[0] && val && +- i802_check_bridge(drv, bss, bridge_ifname, bss->ifname) < 0) +--- +-2.29.2 +- +diff --git a/package/network/services/hostapd/patches/050-mesh-make-forwarding-configurable.patch b/package/network/services/hostapd/patches/020-mesh-make-forwarding-configurable.patch +similarity index 89% +rename from package/network/services/hostapd/patches/050-mesh-make-forwarding-configurable.patch +rename to package/network/services/hostapd/patches/020-mesh-make-forwarding-configurable.patch +index 0ecb9ba078..75726a6750 100644 +--- a/package/network/services/hostapd/patches/050-mesh-make-forwarding-configurable.patch ++++ b/package/network/services/hostapd/patches/020-mesh-make-forwarding-configurable.patch +@@ -31,7 +31,7 @@ Signed-off-by: Daniel Golle + }; + + #define MAX_STA_COUNT 2007 +-@@ -701,6 +702,7 @@ struct hostapd_bss_config { ++@@ -696,6 +697,7 @@ struct hostapd_bss_config { + + #define MESH_ENABLED BIT(0) + int mesh; +@@ -41,7 +41,7 @@ Signed-off-by: Daniel Golle + + --- a/src/drivers/driver.h + +++ b/src/drivers/driver.h +-@@ -1515,6 +1515,7 @@ struct wpa_driver_mesh_bss_params { ++@@ -1584,6 +1584,7 @@ struct wpa_driver_mesh_bss_params { + #define WPA_DRIVER_MESH_CONF_FLAG_MAX_PEER_LINKS 0x00000004 + #define WPA_DRIVER_MESH_CONF_FLAG_HT_OP_MODE 0x00000008 + #define WPA_DRIVER_MESH_CONF_FLAG_RSSI_THRESHOLD 0x00000010 +@@ -49,7 +49,7 @@ Signed-off-by: Daniel Golle + /* + * TODO: Other mesh configuration parameters would go here. + * See NL80211_MESHCONF_* for all the mesh config parameters. +-@@ -1524,6 +1525,7 @@ struct wpa_driver_mesh_bss_params { ++@@ -1593,6 +1594,7 @@ struct wpa_driver_mesh_bss_params { + int peer_link_timeout; + int max_peer_links; + int rssi_threshold; +@@ -59,7 +59,7 @@ Signed-off-by: Daniel Golle + + --- a/src/drivers/driver_nl80211.c + +++ b/src/drivers/driver_nl80211.c +-@@ -10023,6 +10023,9 @@ static int nl80211_put_mesh_config(struc ++@@ -10456,6 +10456,9 @@ static int nl80211_put_mesh_config(struc + if (((params->flags & WPA_DRIVER_MESH_CONF_FLAG_AUTO_PLINKS) && + nla_put_u8(msg, NL80211_MESHCONF_AUTO_OPEN_PLINKS, + params->auto_plinks)) || +@@ -71,7 +71,7 @@ Signed-off-by: Daniel Golle + params->max_peer_links)) || + --- a/wpa_supplicant/config.c + +++ b/wpa_supplicant/config.c +-@@ -2473,6 +2473,7 @@ static const struct parse_data ssid_fiel ++@@ -2527,6 +2527,7 @@ static const struct parse_data ssid_fiel + #ifdef CONFIG_MESH + { INT_RANGE(mode, 0, 5) }, + { INT_RANGE(no_auto_peer, 0, 1) }, +@@ -79,7 +79,7 @@ Signed-off-by: Daniel Golle + { INT_RANGE(mesh_rssi_threshold, -255, 1) }, + #else /* CONFIG_MESH */ + { INT_RANGE(mode, 0, 4) }, +-@@ -3049,6 +3050,7 @@ void wpa_config_set_network_defaults(str ++@@ -3106,6 +3107,7 @@ void wpa_config_set_network_defaults(str + ssid->dot11MeshRetryTimeout = DEFAULT_MESH_RETRY_TIMEOUT; + ssid->dot11MeshConfirmTimeout = DEFAULT_MESH_CONFIRM_TIMEOUT; + ssid->dot11MeshHoldingTimeout = DEFAULT_MESH_HOLDING_TIMEOUT; +@@ -87,7 +87,7 @@ Signed-off-by: Daniel Golle + ssid->mesh_rssi_threshold = DEFAULT_MESH_RSSI_THRESHOLD; + #endif /* CONFIG_MESH */ + #ifdef CONFIG_HT_OVERRIDES +-@@ -4276,6 +4278,7 @@ struct wpa_config * wpa_config_alloc_emp ++@@ -4347,6 +4349,7 @@ struct wpa_config * wpa_config_alloc_emp + config->user_mpm = DEFAULT_USER_MPM; + config->max_peer_links = DEFAULT_MAX_PEER_LINKS; + config->mesh_max_inactivity = DEFAULT_MESH_MAX_INACTIVITY; +@@ -95,7 +95,7 @@ Signed-off-by: Daniel Golle + config->dot11RSNASAERetransPeriod = + DEFAULT_DOT11_RSNA_SAE_RETRANS_PERIOD; + config->fast_reauth = DEFAULT_FAST_REAUTH; +-@@ -4914,6 +4917,7 @@ static const struct global_parse_data gl ++@@ -5047,6 +5050,7 @@ static const struct global_parse_data gl + { INT(user_mpm), 0 }, + { INT_RANGE(max_peer_links, 0, 255), 0 }, + { INT(mesh_max_inactivity), 0 }, +@@ -113,7 +113,7 @@ Signed-off-by: Daniel Golle + /* + * The default dot11RSNASAERetransPeriod is defined as 40 ms in the standard, + * but use 1000 ms in practice to avoid issues on low power CPUs. +-@@ -1351,6 +1352,14 @@ struct wpa_config { ++@@ -1378,6 +1379,14 @@ struct wpa_config { + int mesh_max_inactivity; + + /** +@@ -130,7 +130,7 @@ Signed-off-by: Daniel Golle + * This timeout value is used in mesh STA to retransmit + --- a/wpa_supplicant/config_file.c + +++ b/wpa_supplicant/config_file.c +-@@ -866,6 +866,7 @@ static void wpa_config_write_network(FIL ++@@ -768,6 +768,7 @@ static void wpa_config_write_network(FIL + #endif /* IEEE8021X_EAPOL */ + INT(mode); + INT(no_auto_peer); +@@ -138,7 +138,7 @@ Signed-off-by: Daniel Golle + INT(frequency); + INT(enable_edmg); + INT(edmg_channel); +-@@ -1527,6 +1528,9 @@ static void wpa_config_write_global(FILE ++@@ -1449,6 +1450,9 @@ static void wpa_config_write_global(FILE + fprintf(f, "mesh_max_inactivity=%d\n", + config->mesh_max_inactivity); + +@@ -164,7 +164,7 @@ Signed-off-by: Daniel Golle + + --- a/wpa_supplicant/mesh.c + +++ b/wpa_supplicant/mesh.c +-@@ -137,6 +137,7 @@ static struct mesh_conf * mesh_config_cr ++@@ -140,6 +140,7 @@ static struct mesh_conf * mesh_config_cr + conf->mesh_cc_id = 0; + conf->mesh_sp_id = MESH_SYNC_METHOD_NEIGHBOR_OFFSET; + conf->mesh_auth_id = (conf->security & MESH_CONF_SEC_AUTH) ? 1 : 0; +@@ -172,7 +172,7 @@ Signed-off-by: Daniel Golle + conf->dot11MeshMaxRetries = ssid->dot11MeshMaxRetries; + conf->dot11MeshRetryTimeout = ssid->dot11MeshRetryTimeout; + conf->dot11MeshConfirmTimeout = ssid->dot11MeshConfirmTimeout; +-@@ -434,6 +435,7 @@ static int wpa_supplicant_mesh_init(stru ++@@ -441,6 +442,7 @@ static int wpa_supplicant_mesh_init(stru + bss->conf->start_disabled = 1; + bss->conf->mesh = MESH_ENABLED; + bss->conf->ap_max_inactivity = wpa_s->conf->mesh_max_inactivity; +@@ -180,7 +180,7 @@ Signed-off-by: Daniel Golle + + if (ieee80211_is_dfs(ssid->frequency, wpa_s->hw.modes, + wpa_s->hw.num_modes) && wpa_s->conf->country[0]) { +-@@ -647,6 +649,10 @@ int wpa_supplicant_join_mesh(struct wpa_ ++@@ -655,6 +657,10 @@ int wpa_supplicant_join_mesh(struct wpa_ + } + params->conf.peer_link_timeout = wpa_s->conf->mesh_max_inactivity; + +diff --git a/package/network/services/hostapd/patches/021-fix-sta-add-after-previous-connection.patch b/package/network/services/hostapd/patches/021-fix-sta-add-after-previous-connection.patch +new file mode 100644 +index 0000000000..124fd8bdf1 +--- /dev/null ++++ b/package/network/services/hostapd/patches/021-fix-sta-add-after-previous-connection.patch +@@ -0,0 +1,26 @@ ++--- a/src/ap/ieee802_11.c +++++ b/src/ap/ieee802_11.c ++@@ -4942,6 +4942,13 @@ static int add_associated_sta(struct hos ++ * drivers to accept the STA parameter configuration. Since this is ++ * after a new FT-over-DS exchange, a new TK has been derived, so key ++ * reinstallation is not a concern for this case. +++ * +++ * If the STA was associated and authorized earlier, but came for a new +++ * connection (!added_unassoc + !reassoc), remove the existing STA entry +++ * so that it can be re-added. This case is rarely seen when the AP could +++ * not receive the deauth/disassoc frame from the STA. And the STA comes +++ * back with new connection within a short period or before the inactive +++ * STA entry is removed from the list. ++ */ ++ wpa_printf(MSG_DEBUG, "Add associated STA " MACSTR ++ " (added_unassoc=%d auth_alg=%u ft_over_ds=%u reassoc=%d authorized=%d ft_tk=%d fils_tk=%d)", ++@@ -4955,7 +4962,8 @@ static int add_associated_sta(struct hos ++ (!(sta->flags & WLAN_STA_AUTHORIZED) || ++ (reassoc && sta->ft_over_ds && sta->auth_alg == WLAN_AUTH_FT) || ++ (!wpa_auth_sta_ft_tk_already_set(sta->wpa_sm) && ++- !wpa_auth_sta_fils_tk_already_set(sta->wpa_sm)))) { +++ !wpa_auth_sta_fils_tk_already_set(sta->wpa_sm)) || +++ (!reassoc && (sta->flags & WLAN_STA_AUTHORIZED)))) { ++ hostapd_drv_sta_remove(hapd, sta->addr); ++ wpa_auth_sm_event(sta->wpa_sm, WPA_DRV_STA_REMOVED); ++ set = 0; +diff --git a/package/network/services/hostapd/patches/060-P2P-Fix-a-corner-case-in-peer-addition-based-on-PD-R.patch b/package/network/services/hostapd/patches/060-P2P-Fix-a-corner-case-in-peer-addition-based-on-PD-R.patch +deleted file mode 100644 +index 1202ff3725..0000000000 +--- a/package/network/services/hostapd/patches/060-P2P-Fix-a-corner-case-in-peer-addition-based-on-PD-R.patch ++++ /dev/null +@@ -1,45 +0,0 @@ +-From 8460e3230988ef2ec13ce6b69b687e941f6cdb32 Mon Sep 17 00:00:00 2001 +-From: Jouni Malinen +-Date: Tue, 8 Dec 2020 23:52:50 +0200 +-Subject: [PATCH] P2P: Fix a corner case in peer addition based on PD Request +- +-p2p_add_device() may remove the oldest entry if there is no room in the +-peer table for a new peer. This would result in any pointer to that +-removed entry becoming stale. A corner case with an invalid PD Request +-frame could result in such a case ending up using (read+write) freed +-memory. This could only by triggered when the peer table has reached its +-maximum size and the PD Request frame is received from the P2P Device +-Address of the oldest remaining entry and the frame has incorrect P2P +-Device Address in the payload. +- +-Fix this by fetching the dev pointer again after having called +-p2p_add_device() so that the stale pointer cannot be used. +- +-Fixes: 17bef1e97a50 ("P2P: Add peer entry based on Provision Discovery Request") +-Signed-off-by: Jouni Malinen +---- +- src/p2p/p2p_pd.c | 12 +++++------- +- 1 file changed, 5 insertions(+), 7 deletions(-) +- +---- a/src/p2p/p2p_pd.c +-+++ b/src/p2p/p2p_pd.c +-@@ -595,14 +595,12 @@ void p2p_process_prov_disc_req(struct p2 +- goto out; +- } +- +-+ dev = p2p_get_device(p2p, sa); +- if (!dev) { +-- dev = p2p_get_device(p2p, sa); +-- if (!dev) { +-- p2p_dbg(p2p, +-- "Provision Discovery device not found " +-- MACSTR, MAC2STR(sa)); +-- goto out; +-- } +-+ p2p_dbg(p2p, +-+ "Provision Discovery device not found " +-+ MACSTR, MAC2STR(sa)); +-+ goto out; +- } +- } else if (msg.wfd_subelems) { +- wpabuf_free(dev->info.wfd_subelems); +diff --git a/package/network/services/hostapd/patches/110-notify-mgmt-frames.patch b/package/network/services/hostapd/patches/110-notify-mgmt-frames.patch +deleted file mode 100644 +index 9e187253d4..0000000000 +--- a/package/network/services/hostapd/patches/110-notify-mgmt-frames.patch ++++ /dev/null +@@ -1,116 +0,0 @@ +-From 53f8fdb534d5222a0e852e38afde3f49832ace06 Mon Sep 17 00:00:00 2001 +-From: =?UTF-8?q?Rapha=C3=ABl=20M=C3=A9lotte?= +-Date: Thu, 26 Nov 2020 09:27:40 +0100 +-Subject: [PATCH] hostapd: Add an option to notify management frames on +- ctrl_iface +-MIME-Version: 1.0 +-Content-Type: text/plain; charset=UTF-8 +-Content-Transfer-Encoding: 8bit +- +-In some contexts (e.g. Multi-AP) it can be useful to have access to +-some of the management frames in upper layers (e.g. to be able to +-process the content of association requests externally). +- +-Add 'notify_mgmt_frames'. When enabled, it will notify the ctrl_iface +-when a management frame arrives using 'AP_MGMT_FRAME_RECEIVED'. +- +-Note that to avoid completely flooding the ctrl_iface, not all +-management frames are included (e.g. beacons are excluded). +- +-Signed-off-by: Raphaël Mélotte +---- +- hostapd/config_file.c | 2 ++ +- hostapd/hostapd.conf | 4 ++++ +- src/ap/ap_config.h | 2 ++ +- src/ap/ieee802_11.c | 25 +++++++++++++++++++++++++ +- src/common/wpa_ctrl.h | 3 +++ +- 5 files changed, 36 insertions(+) +- +---- a/hostapd/config_file.c +-+++ b/hostapd/config_file.c +-@@ -4456,6 +4456,8 @@ static int hostapd_config_fill(struct ho +- bss->multicast_to_unicast = atoi(pos); +- } else if (os_strcmp(buf, "broadcast_deauth") == 0) { +- bss->broadcast_deauth = atoi(pos); +-+ } else if (os_strcmp(buf, "notify_mgmt_frames") == 0) { +-+ conf->notify_mgmt_frames = atoi(pos); +- #ifdef CONFIG_DPP +- } else if (os_strcmp(buf, "dpp_name") == 0) { +- os_free(bss->dpp_name); +---- a/hostapd/hostapd.conf +-+++ b/hostapd/hostapd.conf +-@@ -571,6 +571,10 @@ wmm_ac_vo_acm=0 +- # Default: 1 (enabled) +- #broadcast_deauth=1 +- +-+# Get notifications for management frames: +-+# Default: 0 (disabled) +-+#notify_mgmt_frames=0 +-+ +- ##### IEEE 802.11n related configuration ###################################### +- +- # ieee80211n: Whether IEEE 802.11n (HT) is enabled +---- a/src/ap/ap_config.h +-+++ b/src/ap/ap_config.h +-@@ -1060,6 +1060,8 @@ struct hostapd_config { +- unsigned int airtime_update_interval; +- #define AIRTIME_MODE_MAX (__AIRTIME_MODE_MAX - 1) +- #endif /* CONFIG_AIRTIME_POLICY */ +-+ +-+ u8 notify_mgmt_frames; +- }; +- +- +---- a/src/ap/ieee802_11.c +-+++ b/src/ap/ieee802_11.c +-@@ -4878,6 +4878,28 @@ static int handle_action(struct hostapd_ +- return 1; +- } +- +-+/** +-+ * notify_mgmt_frame - notify of management frames on the control interface. +-+ * @hapd: hostapd BSS data structure (the BSS to which the management frame was +-+ * sent to) +-+ * @buf: management frame data (starting from IEEE 802.11 header) +-+ * @len: length of frame data in octets +-+ * +-+ * Notify the control interface of any management frame. +-+ */ +-+static void notify_mgmt_frame(struct hostapd_data *hapd, const u8 *buf, +-+ size_t len) +-+{ +-+ +-+ int hex_len = len * 2 + 1; +-+ char *hex = os_malloc(hex_len); +-+ +-+ if (hex) { +-+ wpa_snprintf_hex(hex, hex_len, buf, len); +-+ wpa_msg_ctrl(hapd->msg_ctx, MSG_INFO, AP_MGMT_FRAME_RECEIVED "buf=%s", hex); +-+ os_free(hex); +-+ } +-+} +- +- /** +- * ieee802_11_mgmt - process incoming IEEE 802.11 management frames +-@@ -4969,6 +4991,9 @@ int ieee802_11_mgmt(struct hostapd_data +- if (hapd->iconf->track_sta_max_num) +- sta_track_add(hapd->iface, mgmt->sa, ssi_signal); +- +-+ if (hapd->iconf->notify_mgmt_frames) +-+ notify_mgmt_frame(hapd, buf, len); +-+ +- switch (stype) { +- case WLAN_FC_STYPE_AUTH: +- wpa_printf(MSG_DEBUG, "mgmt::auth"); +---- a/src/common/wpa_ctrl.h +-+++ b/src/common/wpa_ctrl.h +-@@ -396,6 +396,9 @@ extern "C" { +- #define BIT(x) (1U << (x)) +- #endif +- +-+/* Event triggered for received management frame */ +-+#define AP_MGMT_FRAME_RECEIVED "AP-MGMT-FRAME-RECEIVED " +-+ +- /* BSS command information masks */ +- +- #define WPA_BSS_MASK_ALL 0xFFFDFFFF +diff --git a/package/network/services/hostapd/patches/110-wolfssl-compile-fix.patch b/package/network/services/hostapd/patches/110-wolfssl-compile-fix.patch +deleted file mode 100644 +index a7b5409602..0000000000 +--- a/package/network/services/hostapd/patches/110-wolfssl-compile-fix.patch ++++ /dev/null +@@ -1,10 +0,0 @@ +---- a/src/crypto/tls_wolfssl.c +-+++ b/src/crypto/tls_wolfssl.c +-@@ -19,6 +19,7 @@ +- #include +- #include +- #include +-+#include +- +- #if defined(EAP_FAST) || defined(EAP_FAST_DYNAMIC) || defined(EAP_SERVER_FAST) +- #define HAVE_AESGCM +diff --git a/package/network/services/hostapd/patches/120-reconfigure-wps-credentials.patch b/package/network/services/hostapd/patches/120-reconfigure-wps-credentials.patch +deleted file mode 100644 +index 1826b6685b..0000000000 +--- a/package/network/services/hostapd/patches/120-reconfigure-wps-credentials.patch ++++ /dev/null +@@ -1,178 +0,0 @@ +-From b389a77a0f6dccf495dbce5be9476000f6ec06a2 Mon Sep 17 00:00:00 2001 +-From: =?UTF-8?q?Rapha=C3=ABl=20M=C3=A9lotte?= +-Date: Wed, 9 Dec 2020 19:55:53 +0100 +-Subject: [PATCH] wps: reconfigure credentials on reload +-MIME-Version: 1.0 +-Content-Type: text/plain; charset=UTF-8 +-Content-Transfer-Encoding: 8bit +- +-When new credentials are configured and hostapd is reconfigured using +-SIGHUP (or reload on the ctrl_iface), also update the wps credentials. +- +-Before these changes, when WPS is triggered the registar always serves +-the credentials that were configured when hostapd started. +- +-Signed-off-by: Raphaël Mélotte +---- +- src/ap/wps_hostapd.c | 86 +++++++++++++++++++++++++++++++++++++++-- +- src/wps/wps.h | 6 +++ +- src/wps/wps_registrar.c | 29 ++++++++++++++ +- 3 files changed, 118 insertions(+), 3 deletions(-) +- +---- a/src/ap/wps_hostapd.c +-+++ b/src/ap/wps_hostapd.c +-@@ -1375,6 +1375,43 @@ static void hostapd_wps_nfc_clear(struct +- #endif /* CONFIG_WPS_NFC */ +- } +- +-+int hostapd_wps_update_multi_ap(struct hostapd_data *hapd, +-+ struct wps_registrar *reg) { +-+ struct hostapd_bss_config *conf = hapd->conf; +-+ u8 *multi_ap_backhaul_network_key = NULL; +-+ size_t multi_ap_backhaul_network_key_len = 0; +-+ int ret = -1; +-+ +-+ if ((conf->multi_ap & FRONTHAUL_BSS) && +-+ conf->multi_ap_backhaul_ssid.ssid_len) { +-+ if (conf->multi_ap_backhaul_ssid.wpa_passphrase) { +-+ multi_ap_backhaul_network_key = +-+ (u8 *) os_strdup(conf->multi_ap_backhaul_ssid.wpa_passphrase); +-+ if (multi_ap_backhaul_network_key == NULL) +-+ return -1; +-+ multi_ap_backhaul_network_key_len = +-+ os_strlen(conf->multi_ap_backhaul_ssid.wpa_passphrase); +-+ } else if (conf->multi_ap_backhaul_ssid.wpa_psk) { +-+ multi_ap_backhaul_network_key = os_malloc(2 * PMK_LEN + 1); +-+ if (multi_ap_backhaul_network_key == NULL) +-+ return -1; +-+ wpa_snprintf_hex((char *) multi_ap_backhaul_network_key, +-+ 2 * PMK_LEN + 1, +-+ conf->multi_ap_backhaul_ssid.wpa_psk->psk, +-+ PMK_LEN); +-+ multi_ap_backhaul_network_key_len = 2 * PMK_LEN; +-+ } +-+ ret = wps_registrar_update_multi_ap(reg, +-+ conf->multi_ap_backhaul_ssid.ssid, +-+ conf->multi_ap_backhaul_ssid.ssid_len, +-+ multi_ap_backhaul_network_key, +-+ multi_ap_backhaul_network_key_len); +-+ os_free(multi_ap_backhaul_network_key); +-+ } +-+ return ret; +-+} +-+ +-+ +- +- void hostapd_deinit_wps(struct hostapd_data *hapd) +- { +-@@ -1409,11 +1446,54 @@ void hostapd_update_wps(struct hostapd_d +- hapd->wps->upc = hapd->conf->upc; +- #endif /* CONFIG_WPS_UPNP */ +- +-- hostapd_wps_set_vendor_ext(hapd, hapd->wps); +-- hostapd_wps_set_application_ext(hapd, hapd->wps); +-+ struct wps_context *wps = hapd->wps; +-+ struct hostapd_bss_config *conf = hapd->conf; +-+ +-+ os_memcpy(wps->ssid, conf->ssid.ssid, conf->ssid.ssid_len); +-+ wps->ssid_len = conf->ssid.ssid_len; +-+ +-+ /* Clear wps settings, then fill them again */ +-+ os_free(wps->network_key); +-+ wps->network_key = NULL; +-+ wps->network_key_len = 0; +-+ wps->psk_set = 0; +-+ if (conf->ssid.wpa_psk_file) { +-+ /* Use per-device PSKs */ +-+ } else if (conf->ssid.wpa_passphrase) { +-+ wps->network_key = (u8 *) os_strdup(conf->ssid.wpa_passphrase); +-+ if (wps->network_key == NULL) +-+ return; +-+ wps->network_key_len = os_strlen(conf->ssid.wpa_passphrase); +-+ } else if (conf->ssid.wpa_psk) { +-+ wps->network_key = os_malloc(2 * PMK_LEN + 1); +-+ if (wps->network_key == NULL) +-+ return; +-+ wpa_snprintf_hex((char *) wps->network_key, 2 * PMK_LEN + 1, +-+ conf->ssid.wpa_psk->psk, PMK_LEN); +-+ wps->network_key_len = 2 * PMK_LEN; +-+#ifdef CONFIG_WEP +-+ } else if (conf->ssid.wep.keys_set && conf->ssid.wep.key[0]) { +-+ wps->network_key = os_malloc(conf->ssid.wep.len[0]); +-+ if (wps->network_key == NULL) +-+ return; +-+ os_memcpy(wps->network_key, conf->ssid.wep.key[0], +-+ conf->ssid.wep.len[0]); +-+ wps->network_key_len = conf->ssid.wep.len[0]; +-+#endif /* CONFIG_WEP */ +-+ } +-+ +-+ if (conf->ssid.wpa_psk) { +-+ os_memcpy(wps->psk, conf->ssid.wpa_psk->psk, PMK_LEN); +-+ wps->psk_set = 1; +-+ } +-+ +-+ hostapd_wps_update_multi_ap(hapd, wps->registrar); +-+ +-+ hostapd_wps_set_vendor_ext(hapd, wps); +-+ hostapd_wps_set_application_ext(hapd, wps); +- +- if (hapd->conf->wps_state) +-- wps_registrar_update_ie(hapd->wps->registrar); +-+ wps_registrar_update_ie(wps->registrar); +- else +- hostapd_deinit_wps(hapd); +- } +---- a/src/wps/wps.h +-+++ b/src/wps/wps.h +-@@ -938,6 +938,12 @@ struct wpabuf * wps_build_nfc_handover_s +- struct wpabuf *nfc_dh_pubkey, +- struct wpabuf *nfc_dev_pw); +- +-+int wps_registrar_update_multi_ap(struct wps_registrar *reg, +-+ const u8 *multi_ap_backhaul_ssid, +-+ size_t multi_ap_backhaul_ssid_len, +-+ const u8 *multi_ap_backhaul_network_key, +-+ size_t multi_ap_backhaul_network_key_len); +-+ +- /* ndef.c */ +- struct wpabuf * ndef_parse_wifi(const struct wpabuf *buf); +- struct wpabuf * ndef_build_wifi(const struct wpabuf *buf); +---- a/src/wps/wps_registrar.c +-+++ b/src/wps/wps_registrar.c +-@@ -3669,6 +3669,35 @@ int wps_registrar_config_ap(struct wps_r +- } +- +- +-+int wps_registrar_update_multi_ap(struct wps_registrar *reg, +-+ const u8 *multi_ap_backhaul_ssid, +-+ size_t multi_ap_backhaul_ssid_len, +-+ const u8 *multi_ap_backhaul_network_key, +-+ size_t multi_ap_backhaul_network_key_len) +-+{ +-+ if (multi_ap_backhaul_ssid != NULL) { +-+ os_memcpy(reg->multi_ap_backhaul_ssid, +-+ multi_ap_backhaul_ssid, +-+ multi_ap_backhaul_ssid_len); +-+ reg->multi_ap_backhaul_ssid_len = +-+ multi_ap_backhaul_ssid_len; +-+ } +-+ os_free(reg->multi_ap_backhaul_network_key); +-+ reg->multi_ap_backhaul_network_key = NULL; +-+ reg->multi_ap_backhaul_network_key_len = 0; +-+ +-+ if (multi_ap_backhaul_network_key != NULL) { +-+ reg->multi_ap_backhaul_network_key = +-+ os_memdup(multi_ap_backhaul_network_key, +-+ multi_ap_backhaul_network_key_len); +-+ if (reg->multi_ap_backhaul_network_key == NULL) +-+ return -1; +-+ reg->multi_ap_backhaul_network_key_len = +-+ multi_ap_backhaul_network_key_len; +-+ } +-+ return 0; +-+} +-+ +- #ifdef CONFIG_WPS_NFC +- +- int wps_registrar_add_nfc_pw_token(struct wps_registrar *reg, +diff --git a/package/network/services/hostapd/patches/200-multicall.patch b/package/network/services/hostapd/patches/200-multicall.patch +index 4f3e3decfe..8dce260871 100644 +--- a/package/network/services/hostapd/patches/200-multicall.patch ++++ b/package/network/services/hostapd/patches/200-multicall.patch +@@ -1,14 +1,14 @@ + --- a/hostapd/Makefile + +++ b/hostapd/Makefile +-@@ -31,6 +31,7 @@ CFLAGS += -I$(abspath ../src/utils) +- export BINDIR ?= /usr/local/bin/ ++@@ -1,6 +1,7 @@ ++ ALL=hostapd hostapd_cli ++ CONFIG_FILE = .config + +- -include .config + +-include $(if $(MULTICALL), ../wpa_supplicant/.config) ++ include ../src/build.rules + +- ifndef CONFIG_NO_GITVER +- # Add VERSION_STR postfix for builds from a git repository +-@@ -204,7 +205,8 @@ endif ++ ifdef LIBS ++@@ -199,7 +200,8 @@ endif + + ifdef CONFIG_NO_VLAN + CFLAGS += -DCONFIG_NO_VLAN +@@ -18,7 +18,7 @@ + OBJS += ../src/ap/vlan_init.o + OBJS += ../src/ap/vlan_ifconfig.o + OBJS += ../src/ap/vlan.o +-@@ -354,10 +356,14 @@ CFLAGS += -DCONFIG_MBO ++@@ -349,10 +351,14 @@ CFLAGS += -DCONFIG_MBO + OBJS += ../src/ap/mbo_ap.o + endif + +@@ -36,9 +36,9 @@ + LIBS += $(DRV_AP_LIBS) + + ifdef CONFIG_L2_PACKET +-@@ -1311,6 +1317,12 @@ install: $(addprefix $(DESTDIR)$(BINDIR) +- +- BCHECK=../src/drivers/build.hostapd ++@@ -1277,6 +1283,12 @@ install: $(addprefix $(DESTDIR)$(BINDIR) ++ _OBJS_VAR := OBJS ++ include ../src/objs.mk + + +hostapd_multi.a: $(BCHECK) $(OBJS) + + $(Q)$(CC) -c -o hostapd_multi.o -Dmain=hostapd_main $(CFLAGS) main.c +@@ -46,12 +46,12 @@ + + @rm -f $@ + + @$(AR) cr $@ hostapd_multi.o $(OBJS) + + +- hostapd: $(BCHECK) $(OBJS) ++ hostapd: $(OBJS) + $(Q)$(CC) $(LDFLAGS) -o hostapd $(OBJS) $(LIBS) + @$(E) " LD " $@ +-@@ -1374,6 +1386,12 @@ SOBJS += ../src/crypto/sha256-kdf.o +- SOBJS += ../src/crypto/sha384-kdf.o +- SOBJS += ../src/crypto/sha512-kdf.o ++@@ -1351,6 +1363,12 @@ include ../src/objs.mk ++ _OBJS_VAR := SOBJS ++ include ../src/objs.mk + + +dump_cflags: + + @printf "%s " "$(CFLAGS)" +@@ -64,15 +64,15 @@ + @$(E) " LD " $@ + --- a/wpa_supplicant/Makefile + +++ b/wpa_supplicant/Makefile +-@@ -27,6 +27,7 @@ CFLAGS += -I$(abspath ../src) +- CFLAGS += -I$(abspath ../src/utils) ++@@ -17,6 +17,7 @@ endif ++ EXTRA_TARGETS=dynamic_eap_methods + +- -include .config ++ CONFIG_FILE=.config + +-include $(if $(MULTICALL),../hostapd/.config) ++ include ../src/build.rules + +- ifndef CONFIG_NO_GITVER +- # Add VERSION_STR postfix for builds from a git repository +-@@ -369,7 +370,9 @@ endif ++ ifdef LIBS ++@@ -359,7 +360,9 @@ endif + ifdef CONFIG_IBSS_RSN + NEED_RSN_AUTHENTICATOR=y + CFLAGS += -DCONFIG_IBSS_RSN +@@ -82,7 +82,7 @@ + OBJS += ibss_rsn.o + endif + +-@@ -890,6 +893,10 @@ ifdef CONFIG_DYNAMIC_EAP_METHODS ++@@ -897,6 +900,10 @@ ifdef CONFIG_DYNAMIC_EAP_METHODS + CFLAGS += -DCONFIG_DYNAMIC_EAP_METHODS + LIBS += -ldl -rdynamic + endif +@@ -93,7 +93,7 @@ + endif + + ifdef CONFIG_AP +-@@ -897,9 +904,11 @@ NEED_EAP_COMMON=y ++@@ -904,9 +911,11 @@ NEED_EAP_COMMON=y + NEED_RSN_AUTHENTICATOR=y + CFLAGS += -DCONFIG_AP + OBJS += ap.o +@@ -105,7 +105,7 @@ + OBJS += ../src/ap/hostapd.o + OBJS += ../src/ap/wpa_auth_glue.o + OBJS += ../src/ap/utils.o +-@@ -979,6 +988,12 @@ endif ++@@ -986,6 +995,12 @@ endif + ifdef CONFIG_HS20 + OBJS += ../src/ap/hs20.o + endif +@@ -118,7 +118,7 @@ + endif + + ifdef CONFIG_MBO +-@@ -987,7 +1002,9 @@ CFLAGS += -DCONFIG_MBO ++@@ -994,7 +1009,9 @@ CFLAGS += -DCONFIG_MBO + endif + + ifdef NEED_RSN_AUTHENTICATOR +@@ -128,10 +128,10 @@ + NEED_AES_WRAP=y + OBJS += ../src/ap/wpa_auth.o + OBJS += ../src/ap/wpa_auth_ie.o +-@@ -1897,6 +1914,12 @@ wpa_priv: $(BCHECK) $(OBJS_priv) +- +- $(OBJS_c) $(OBJS_t) $(OBJS_t2) $(OBJS) $(BCHECK) $(EXTRA_progs): .config ++@@ -1889,6 +1906,12 @@ wpa_priv: $(BCHECK) $(OBJS_priv) + ++ _OBJS_VAR := OBJS ++ include ../src/objs.mk + +wpa_supplicant_multi.a: .config $(BCHECK) $(OBJS) $(EXTRA_progs) + + $(Q)$(CC) -c -o wpa_supplicant_multi.o -Dmain=wpa_supplicant_main $(CFLAGS) main.c + + @$(E) " CC " $< +@@ -141,7 +141,7 @@ + wpa_supplicant: $(BCHECK) $(OBJS) $(EXTRA_progs) + $(Q)$(LDO) $(LDFLAGS) -o wpa_supplicant $(OBJS) $(LIBS) $(EXTRALIBS) + @$(E) " LD " $@ +-@@ -1997,6 +2020,12 @@ endif ++@@ -2021,6 +2044,12 @@ eap_gpsk.so: $(SRC_EAP_GPSK) + $(Q)sed -e 's|\@BINDIR\@|$(BINDIR)|g' $< >$@ + @$(E) " sed" $< + +@@ -156,7 +156,7 @@ + wpa_cli.exe: wpa_cli + --- a/src/drivers/driver.h + +++ b/src/drivers/driver.h +-@@ -5886,8 +5886,8 @@ union wpa_event_data { ++@@ -6025,8 +6025,8 @@ union wpa_event_data { + * Driver wrapper code should call this function whenever an event is received + * from the driver. + */ +@@ -167,7 +167,7 @@ + + /** + * wpa_supplicant_event_global - Report a driver event for wpa_supplicant +-@@ -5899,7 +5899,7 @@ void wpa_supplicant_event(void *ctx, enu ++@@ -6038,7 +6038,7 @@ void wpa_supplicant_event(void *ctx, enu + * Same as wpa_supplicant_event(), but we search for the interface in + * wpa_global. + */ +@@ -178,7 +178,7 @@ + /* + --- a/src/ap/drv_callbacks.c + +++ b/src/ap/drv_callbacks.c +-@@ -1789,8 +1789,8 @@ err: ++@@ -1836,8 +1836,8 @@ err: + #endif /* CONFIG_OWE */ + + +@@ -189,7 +189,7 @@ + { + struct hostapd_data *hapd = ctx; + #ifndef CONFIG_NO_STDOUT_DEBUG +-@@ -2035,7 +2035,7 @@ void wpa_supplicant_event(void *ctx, enu ++@@ -2082,7 +2082,7 @@ void wpa_supplicant_event(void *ctx, enu + } + + +@@ -231,7 +231,7 @@ + os_memset(&global, 0, sizeof(global)); + --- a/wpa_supplicant/events.c + +++ b/wpa_supplicant/events.c +-@@ -4581,8 +4581,8 @@ static void wpas_event_unprot_beacon(str ++@@ -4665,8 +4665,8 @@ static void wpas_event_unprot_beacon(str + } + + +@@ -242,7 +242,7 @@ + { + struct wpa_supplicant *wpa_s = ctx; + int resched; +-@@ -5400,7 +5400,7 @@ void wpa_supplicant_event(void *ctx, enu ++@@ -5511,7 +5511,7 @@ void wpa_supplicant_event(void *ctx, enu + } + + +@@ -253,7 +253,7 @@ + struct wpa_supplicant *wpa_s; + --- a/wpa_supplicant/wpa_supplicant.c + +++ b/wpa_supplicant/wpa_supplicant.c +-@@ -6594,7 +6594,6 @@ struct wpa_interface * wpa_supplicant_ma ++@@ -6819,7 +6819,6 @@ struct wpa_interface * wpa_supplicant_ma + return NULL; + } + +@@ -261,7 +261,7 @@ + /** + * wpa_supplicant_match_existing - Match existing interfaces + * @global: Pointer to global data from wpa_supplicant_init() +-@@ -6631,6 +6630,11 @@ static int wpa_supplicant_match_existing ++@@ -6854,6 +6853,11 @@ static int wpa_supplicant_match_existing + + #endif /* CONFIG_MATCH_IFACE */ + +@@ -273,7 +273,7 @@ + + /** + * wpa_supplicant_add_iface - Add a new network interface +-@@ -6887,6 +6891,8 @@ struct wpa_global * wpa_supplicant_init( ++@@ -7110,6 +7114,8 @@ struct wpa_global * wpa_supplicant_init( + #ifndef CONFIG_NO_WPA_MSG + wpa_msg_register_ifname_cb(wpa_supplicant_msg_ifname_cb); + #endif /* CONFIG_NO_WPA_MSG */ +@@ -296,7 +296,7 @@ + + #ifdef CONFIG_WPS + static int gen_uuid(const char *txt_addr) +-@@ -684,6 +689,8 @@ int main(int argc, char *argv[]) ++@@ -683,6 +688,8 @@ int main(int argc, char *argv[]) + return -1; + #endif /* CONFIG_DPP */ + +@@ -333,7 +333,7 @@ + + const struct wpa_driver_ops *const wpa_drivers[] = { NULL }; + +-@@ -1292,6 +1297,10 @@ static void usage(void) ++@@ -1291,6 +1296,10 @@ static void usage(void) + "option several times.\n"); + } + +@@ -344,7 +344,7 @@ + + int main(int argc, char *argv[]) + { +-@@ -1312,6 +1321,8 @@ int main(int argc, char *argv[]) ++@@ -1311,6 +1320,8 @@ int main(int argc, char *argv[]) + if (os_program_init()) + return -1; + +diff --git a/package/network/services/hostapd/patches/300-noscan.patch b/package/network/services/hostapd/patches/300-noscan.patch +index 638b76f84e..93b0934283 100644 +--- a/package/network/services/hostapd/patches/300-noscan.patch ++++ b/package/network/services/hostapd/patches/300-noscan.patch +@@ -1,6 +1,6 @@ + --- a/hostapd/config_file.c + +++ b/hostapd/config_file.c +-@@ -3493,6 +3493,10 @@ static int hostapd_config_fill(struct ho ++@@ -3459,6 +3459,10 @@ static int hostapd_config_fill(struct ho + if (bss->ocv && !bss->ieee80211w) + bss->ieee80211w = 1; + #endif /* CONFIG_OCV */ +@@ -13,7 +13,7 @@ + } else if (os_strcmp(buf, "ht_capab") == 0) { + --- a/src/ap/ap_config.h + +++ b/src/ap/ap_config.h +-@@ -984,6 +984,8 @@ struct hostapd_config { ++@@ -1009,6 +1009,8 @@ struct hostapd_config { + + int ht_op_mode_fixed; + u16 ht_capab; +@@ -24,7 +24,7 @@ + int no_pri_sec_switch; + --- a/src/ap/hw_features.c + +++ b/src/ap/hw_features.c +-@@ -500,7 +500,8 @@ static int ieee80211n_check_40mhz(struct ++@@ -517,7 +517,8 @@ static int ieee80211n_check_40mhz(struct + int ret; + + /* Check that HT40 is used and PRI / SEC switch is allowed */ +diff --git a/package/network/services/hostapd/patches/301-mesh-noscan.patch b/package/network/services/hostapd/patches/301-mesh-noscan.patch +index f85b72453e..0d78329441 100644 +--- a/package/network/services/hostapd/patches/301-mesh-noscan.patch ++++ b/package/network/services/hostapd/patches/301-mesh-noscan.patch +@@ -1,6 +1,6 @@ + --- a/wpa_supplicant/config.c + +++ b/wpa_supplicant/config.c +-@@ -2478,6 +2478,7 @@ static const struct parse_data ssid_fiel ++@@ -2532,6 +2532,7 @@ static const struct parse_data ssid_fiel + #else /* CONFIG_MESH */ + { INT_RANGE(mode, 0, 4) }, + #endif /* CONFIG_MESH */ +@@ -10,7 +10,7 @@ + { STR(id_str) }, + --- a/wpa_supplicant/config_file.c + +++ b/wpa_supplicant/config_file.c +-@@ -866,6 +866,7 @@ static void wpa_config_write_network(FIL ++@@ -768,6 +768,7 @@ static void wpa_config_write_network(FIL + #endif /* IEEE8021X_EAPOL */ + INT(mode); + INT(no_auto_peer); +@@ -20,7 +20,7 @@ + INT(enable_edmg); + --- a/wpa_supplicant/mesh.c + +++ b/wpa_supplicant/mesh.c +-@@ -467,6 +467,8 @@ static int wpa_supplicant_mesh_init(stru ++@@ -474,6 +474,8 @@ static int wpa_supplicant_mesh_init(stru + frequency); + goto out_free; + } +@@ -31,7 +31,7 @@ + /* + --- a/wpa_supplicant/wpa_supplicant.c + +++ b/wpa_supplicant/wpa_supplicant.c +-@@ -2334,12 +2334,12 @@ void ibss_mesh_setup_freq(struct wpa_sup ++@@ -2384,12 +2384,12 @@ void ibss_mesh_setup_freq(struct wpa_sup + int ieee80211_mode = wpas_mode_to_ieee80211_mode(ssid->mode); + enum hostapd_hw_mode hw_mode; + struct hostapd_hw_modes *mode = NULL; +@@ -46,7 +46,7 @@ + unsigned int j, k; + struct hostapd_freq_params vht_freq; + int chwidth, seg0, seg1; +-@@ -2421,7 +2421,7 @@ void ibss_mesh_setup_freq(struct wpa_sup ++@@ -2473,7 +2473,7 @@ void ibss_mesh_setup_freq(struct wpa_sup + #endif /* CONFIG_HE_OVERRIDES */ + + /* Setup higher BW only for 5 GHz */ +diff --git a/package/network/services/hostapd/patches/310-rescan_immediately.patch b/package/network/services/hostapd/patches/310-rescan_immediately.patch +index 0040b61c6b..7f5e207069 100644 +--- a/package/network/services/hostapd/patches/310-rescan_immediately.patch ++++ b/package/network/services/hostapd/patches/310-rescan_immediately.patch +@@ -1,6 +1,6 @@ + --- a/wpa_supplicant/wpa_supplicant.c + +++ b/wpa_supplicant/wpa_supplicant.c +-@@ -4949,7 +4949,7 @@ wpa_supplicant_alloc(struct wpa_supplica ++@@ -5154,7 +5154,7 @@ wpa_supplicant_alloc(struct wpa_supplica + if (wpa_s == NULL) + return NULL; + wpa_s->scan_req = INITIAL_SCAN_REQ; +diff --git a/package/network/services/hostapd/patches/320-optional_rfkill.patch b/package/network/services/hostapd/patches/320-optional_rfkill.patch +index a703c7e132..01537790e0 100644 +--- a/package/network/services/hostapd/patches/320-optional_rfkill.patch ++++ b/package/network/services/hostapd/patches/320-optional_rfkill.patch +@@ -1,6 +1,6 @@ + --- a/src/drivers/drivers.mak + +++ b/src/drivers/drivers.mak +-@@ -50,7 +50,6 @@ NEED_SME=y ++@@ -54,7 +54,6 @@ NEED_SME=y + NEED_AP_MLME=y + NEED_NETLINK=y + NEED_LINUX_IOCTL=y +@@ -8,7 +8,7 @@ + NEED_RADIOTAP=y + NEED_LIBNL=y + endif +-@@ -107,7 +106,6 @@ DRV_WPA_CFLAGS += -DCONFIG_DRIVER_WEXT ++@@ -111,7 +110,6 @@ DRV_WPA_CFLAGS += -DCONFIG_DRIVER_WEXT + CONFIG_WIRELESS_EXTENSION=y + NEED_NETLINK=y + NEED_LINUX_IOCTL=y +@@ -16,7 +16,7 @@ + endif + + ifdef CONFIG_DRIVER_NDIS +-@@ -133,7 +131,6 @@ endif ++@@ -137,7 +135,6 @@ endif + ifdef CONFIG_WIRELESS_EXTENSION + DRV_WPA_CFLAGS += -DCONFIG_WIRELESS_EXTENSION + DRV_WPA_OBJS += ../src/drivers/driver_wext.o +@@ -24,7 +24,7 @@ + endif + + ifdef NEED_NETLINK +-@@ -142,6 +139,7 @@ endif ++@@ -146,6 +143,7 @@ endif + + ifdef NEED_RFKILL + DRV_OBJS += ../src/drivers/rfkill.o +diff --git a/package/network/services/hostapd/patches/330-nl80211_fix_set_freq.patch b/package/network/services/hostapd/patches/330-nl80211_fix_set_freq.patch +index 9e2551ce60..9ced08801e 100644 +--- a/package/network/services/hostapd/patches/330-nl80211_fix_set_freq.patch ++++ b/package/network/services/hostapd/patches/330-nl80211_fix_set_freq.patch +@@ -1,6 +1,6 @@ + --- a/src/drivers/driver_nl80211.c + +++ b/src/drivers/driver_nl80211.c +-@@ -4646,7 +4646,7 @@ static int nl80211_set_channel(struct i8 ++@@ -4973,7 +4973,7 @@ static int nl80211_set_channel(struct i8 + freq->freq, freq->ht_enabled, freq->vht_enabled, freq->he_enabled, + freq->bandwidth, freq->center_freq1, freq->center_freq2); + +diff --git a/package/network/services/hostapd/patches/340-reload_freq_change.patch b/package/network/services/hostapd/patches/340-reload_freq_change.patch +index e0e62c2a11..3d51a47a1e 100644 +--- a/package/network/services/hostapd/patches/340-reload_freq_change.patch ++++ b/package/network/services/hostapd/patches/340-reload_freq_change.patch +@@ -1,6 +1,6 @@ + --- a/src/ap/hostapd.c + +++ b/src/ap/hostapd.c +-@@ -114,6 +114,28 @@ static void hostapd_reload_bss(struct ho ++@@ -115,6 +115,28 @@ static void hostapd_reload_bss(struct ho + #endif /* CONFIG_NO_RADIUS */ + + ssid = &hapd->conf->ssid; +@@ -29,7 +29,7 @@ + if (!ssid->wpa_psk_set && ssid->wpa_psk && !ssid->wpa_psk->next && + ssid->wpa_passphrase_set && ssid->wpa_passphrase) { + /* +-@@ -215,6 +237,7 @@ int hostapd_reload_config(struct hostapd ++@@ -216,6 +238,7 @@ int hostapd_reload_config(struct hostapd + struct hostapd_data *hapd = iface->bss[0]; + struct hostapd_config *newconf, *oldconf; + size_t j; +@@ -37,7 +37,7 @@ + + if (iface->config_fname == NULL) { + /* Only in-memory config in use - assume it has been updated */ +-@@ -265,24 +288,20 @@ int hostapd_reload_config(struct hostapd ++@@ -266,24 +289,20 @@ int hostapd_reload_config(struct hostapd + } + iface->conf = newconf; + +diff --git a/package/network/services/hostapd/patches/341-mesh-ctrl-iface-channel-switch.patch b/package/network/services/hostapd/patches/341-mesh-ctrl-iface-channel-switch.patch +index 90fa5eff5d..73f81f65e6 100644 +--- a/package/network/services/hostapd/patches/341-mesh-ctrl-iface-channel-switch.patch ++++ b/package/network/services/hostapd/patches/341-mesh-ctrl-iface-channel-switch.patch +@@ -1,6 +1,6 @@ + --- a/wpa_supplicant/ap.c + +++ b/wpa_supplicant/ap.c +-@@ -1466,15 +1466,35 @@ int ap_switch_channel(struct wpa_supplic ++@@ -1513,15 +1513,35 @@ int ap_switch_channel(struct wpa_supplic + + + #ifdef CONFIG_CTRL_IFACE +diff --git a/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch b/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch +index a2a03c04f7..1f9b74e97e 100644 +--- a/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch ++++ b/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch +@@ -1,6 +1,6 @@ + --- a/src/drivers/driver_nl80211.c + +++ b/src/drivers/driver_nl80211.c +-@@ -2788,10 +2788,15 @@ static int wpa_driver_nl80211_del_beacon ++@@ -2918,10 +2918,15 @@ static int wpa_driver_nl80211_del_beacon + struct nl_msg *msg; + struct wpa_driver_nl80211_data *drv = bss->drv; + +@@ -15,10 +15,10 @@ + nl80211_put_wiphy_data_ap(bss); + - msg = nl80211_drv_msg(drv, 0, NL80211_CMD_DEL_BEACON); + + msg = nl80211_bss_msg(bss, 0, NL80211_CMD_DEL_BEACON); +- return send_and_recv_msgs(drv, msg, NULL, NULL); ++ return send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); + } + +-@@ -5261,7 +5266,7 @@ static void nl80211_teardown_ap(struct i ++@@ -5602,7 +5607,7 @@ static void nl80211_teardown_ap(struct i + nl80211_mgmt_unsubscribe(bss, "AP teardown"); + + nl80211_put_wiphy_data_ap(bss); +@@ -27,7 +27,7 @@ + } + + +-@@ -7679,8 +7684,6 @@ static int wpa_driver_nl80211_if_remove( ++@@ -8051,8 +8056,6 @@ static int wpa_driver_nl80211_if_remove( + } else { + wpa_printf(MSG_DEBUG, "nl80211: First BSS - reassign context"); + nl80211_teardown_ap(bss); +@@ -36,7 +36,7 @@ + nl80211_destroy_bss(bss); + if (!bss->added_if) + i802_set_iface_flags(bss, 0); +-@@ -8074,7 +8077,6 @@ static int wpa_driver_nl80211_deinit_ap( ++@@ -8449,7 +8452,6 @@ static int wpa_driver_nl80211_deinit_ap( + if (!is_ap_interface(drv->nlmode)) + return -1; + wpa_driver_nl80211_del_beacon(bss); +@@ -44,7 +44,7 @@ + + /* + * If the P2P GO interface was dynamically added, then it is +-@@ -8094,7 +8096,6 @@ static int wpa_driver_nl80211_stop_ap(vo ++@@ -8469,7 +8471,6 @@ static int wpa_driver_nl80211_stop_ap(vo + if (!is_ap_interface(drv->nlmode)) + return -1; + wpa_driver_nl80211_del_beacon(bss); +diff --git a/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch b/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch +index 31c5102cb1..349522e06a 100644 +--- a/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch ++++ b/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch +@@ -1,6 +1,6 @@ + --- a/hostapd/ctrl_iface.c + +++ b/hostapd/ctrl_iface.c +-@@ -65,6 +65,7 @@ ++@@ -67,6 +67,7 @@ + #include "fst/fst_ctrl_iface.h" + #include "config_file.h" + #include "ctrl_iface.h" +@@ -8,7 +8,7 @@ + + + #define HOSTAPD_CLI_DUP_VALUE_MAX_LEN 256 +-@@ -80,6 +81,7 @@ static void hostapd_ctrl_iface_send(stru ++@@ -82,6 +83,7 @@ static void hostapd_ctrl_iface_send(stru + enum wpa_msg_type type, + const char *buf, size_t len); + +@@ -16,7 +16,7 @@ + + static int hostapd_ctrl_iface_attach(struct hostapd_data *hapd, + struct sockaddr_storage *from, +-@@ -131,6 +133,61 @@ static int hostapd_ctrl_iface_new_sta(st ++@@ -133,6 +135,61 @@ static int hostapd_ctrl_iface_new_sta(st + return 0; + } + +@@ -78,7 +78,7 @@ + + #ifdef NEED_AP_MLME + static int hostapd_ctrl_iface_sa_query(struct hostapd_data *hapd, +-@@ -3546,6 +3603,8 @@ static int hostapd_ctrl_iface_receive_pr ++@@ -3754,6 +3811,8 @@ static int hostapd_ctrl_iface_receive_pr + } else if (os_strncmp(buf, "VENDOR ", 7) == 0) { + reply_len = hostapd_ctrl_iface_vendor(hapd, buf + 7, reply, + reply_size); +@@ -89,7 +89,7 @@ + #ifdef RADIUS_SERVER + --- a/src/ap/ctrl_iface_ap.c + +++ b/src/ap/ctrl_iface_ap.c +-@@ -917,7 +917,13 @@ int hostapd_parse_csa_settings(const cha ++@@ -919,7 +919,13 @@ int hostapd_parse_csa_settings(const cha + + int hostapd_ctrl_iface_stop_ap(struct hostapd_data *hapd) + { +diff --git a/package/network/services/hostapd/patches/370-ap_sta_support.patch b/package/network/services/hostapd/patches/370-ap_sta_support.patch +index a7a646d2d1..c5cad3bb8d 100644 +--- a/package/network/services/hostapd/patches/370-ap_sta_support.patch ++++ b/package/network/services/hostapd/patches/370-ap_sta_support.patch +@@ -1,17 +1,6 @@ + --- a/wpa_supplicant/Makefile + +++ b/wpa_supplicant/Makefile +-@@ -26,6 +26,10 @@ CFLAGS += $(EXTRA_CFLAGS) +- CFLAGS += -I$(abspath ../src) +- CFLAGS += -I$(abspath ../src/utils) +- +-+ifdef MULTICALL +-+CFLAGS += -DMULTICALL +-+endif +-+ +- -include .config +- -include $(if $(MULTICALL),../hostapd/.config) +- +-@@ -118,6 +122,8 @@ OBJS_c += ../src/utils/common.o ++@@ -108,6 +108,8 @@ OBJS_c += ../src/utils/common.o + OBJS_c += ../src/common/cli.o + OBJS += wmm_ac.o + +@@ -30,7 +19,7 @@ + #include "drivers/driver.h" + #include "eap_peer/eap.h" + #include "wpa_supplicant_i.h" +-@@ -294,6 +295,10 @@ void calculate_update_time(const struct ++@@ -282,6 +283,10 @@ void calculate_update_time(const struct + static void wpa_bss_copy_res(struct wpa_bss *dst, struct wpa_scan_res *src, + struct os_reltime *fetch_time) + { +@@ -41,7 +30,7 @@ + dst->flags = src->flags; + os_memcpy(dst->bssid, src->bssid, ETH_ALEN); + dst->freq = src->freq; +-@@ -306,6 +311,15 @@ static void wpa_bss_copy_res(struct wpa_ ++@@ -294,6 +299,15 @@ static void wpa_bss_copy_res(struct wpa_ + dst->est_throughput = src->est_throughput; + dst->snr = src->snr; + +@@ -59,7 +48,7 @@ + + --- a/wpa_supplicant/bss.h + +++ b/wpa_supplicant/bss.h +-@@ -83,6 +83,10 @@ struct wpa_bss { ++@@ -94,6 +94,10 @@ struct wpa_bss { + u8 ssid[SSID_MAX_LEN]; + /** Length of SSID */ + size_t ssid_len; +@@ -110,7 +99,7 @@ + break; + --- a/wpa_supplicant/wpa_supplicant.c + +++ b/wpa_supplicant/wpa_supplicant.c +-@@ -129,6 +129,54 @@ static void wpas_update_fils_connect_par ++@@ -130,6 +130,54 @@ static void wpas_update_fils_connect_par + static void wpas_update_owe_connect_params(struct wpa_supplicant *wpa_s); + #endif /* CONFIG_OWE */ + +@@ -165,7 +154,7 @@ + + #ifdef CONFIG_WEP + /* Configure default/group WEP keys for static WEP */ +-@@ -991,6 +1039,8 @@ void wpa_supplicant_set_state(struct wpa ++@@ -1007,6 +1055,8 @@ void wpa_supplicant_set_state(struct wpa + + sme_sched_obss_scan(wpa_s, 1); + +@@ -174,7 +163,7 @@ + #if defined(CONFIG_FILS) && defined(IEEE8021X_EAPOL) + if (!fils_hlp_sent && ssid && ssid->eap.erp) + update_fils_connect_params = true; +-@@ -1001,6 +1051,8 @@ void wpa_supplicant_set_state(struct wpa ++@@ -1017,6 +1067,8 @@ void wpa_supplicant_set_state(struct wpa + #endif /* CONFIG_OWE */ + } else if (state == WPA_DISCONNECTED || state == WPA_ASSOCIATING || + state == WPA_ASSOCIATED) { +@@ -183,7 +172,7 @@ + wpa_s->new_connection = 1; + wpa_drv_set_operstate(wpa_s, 0); + #ifndef IEEE8021X_EAPOL +-@@ -2225,6 +2277,8 @@ void wpa_supplicant_associate(struct wpa ++@@ -2276,6 +2328,8 @@ void wpa_supplicant_associate(struct wpa + return; + } + wpa_s->current_bss = bss; +@@ -192,7 +181,7 @@ + #else /* CONFIG_MESH */ + wpa_msg(wpa_s, MSG_ERROR, + "mesh mode support not included in the build"); +-@@ -6207,6 +6261,16 @@ static int wpa_supplicant_init_iface(str ++@@ -6426,6 +6480,16 @@ static int wpa_supplicant_init_iface(str + sizeof(wpa_s->bridge_ifname)); + } + +@@ -209,7 +198,7 @@ + /* RSNA Supplicant Key Management - INITIALIZE */ + eapol_sm_notify_portEnabled(wpa_s->eapol, false); + eapol_sm_notify_portValid(wpa_s->eapol, false); +-@@ -6540,6 +6604,11 @@ static void wpa_supplicant_deinit_iface( ++@@ -6763,6 +6827,11 @@ static void wpa_supplicant_deinit_iface( + if (terminate) + wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_TERMINATING); + +@@ -218,12 +207,12 @@ + + wpa_s->hostapd = NULL; + + } + + +- if (wpa_s->ctrl_iface) { +- wpa_supplicant_ctrl_iface_deinit(wpa_s->ctrl_iface); +- wpa_s->ctrl_iface = NULL; ++ wpa_supplicant_ctrl_iface_deinit(wpa_s, wpa_s->ctrl_iface); ++ wpa_s->ctrl_iface = NULL; ++ + --- a/wpa_supplicant/wpa_supplicant_i.h + +++ b/wpa_supplicant/wpa_supplicant_i.h +-@@ -104,6 +104,11 @@ struct wpa_interface { ++@@ -103,6 +103,11 @@ struct wpa_interface { + const char *ifname; + + /** +@@ -235,7 +224,7 @@ + * bridge_ifname - Optional bridge interface name + * + * If the driver interface (ifname) is included in a Linux bridge +-@@ -530,6 +535,8 @@ struct wpa_supplicant { ++@@ -615,6 +620,8 @@ struct wpa_supplicant { + #endif /* CONFIG_CTRL_IFACE_BINDER */ + char bridge_ifname[16]; + +@@ -246,7 +235,7 @@ + + --- a/hostapd/ctrl_iface.c + +++ b/hostapd/ctrl_iface.c +-@@ -2712,6 +2712,11 @@ static int hostapd_ctrl_iface_chan_switc ++@@ -2883,6 +2883,11 @@ static int hostapd_ctrl_iface_chan_switc + return 0; + } + +@@ -257,12 +246,12 @@ + + + for (i = 0; i < iface->num_bss; i++) { + +- /* Save CHAN_SWITCH VHT config */ ++ /* Save CHAN_SWITCH VHT and HE config */ + --- a/src/ap/beacon.c + +++ b/src/ap/beacon.c +-@@ -1468,11 +1468,6 @@ int ieee802_11_set_beacon(struct hostapd +- struct wpabuf *beacon, *proberesp, *assocresp; +- int res, ret = -1; ++@@ -1758,11 +1758,6 @@ int ieee802_11_set_beacon(struct hostapd ++ return -1; ++ } + + - if (hapd->csa_in_progress) { + - wpa_printf(MSG_ERROR, "Cannot set beacons during CSA period"); +@@ -274,7 +263,7 @@ + if (ieee802_11_build_ap_params(hapd, ¶ms) < 0) + --- a/wpa_supplicant/events.c + +++ b/wpa_supplicant/events.c +-@@ -4581,6 +4581,60 @@ static void wpas_event_unprot_beacon(str ++@@ -4665,6 +4665,60 @@ static void wpas_event_unprot_beacon(str + } + + +@@ -335,7 +324,7 @@ + void supplicant_event(void *ctx, enum wpa_event_type event, + union wpa_event_data *data) + { +-@@ -4883,8 +4937,10 @@ void supplicant_event(void *ctx, enum wp ++@@ -4980,8 +5034,10 @@ void supplicant_event(void *ctx, enum wp + channel_width_to_string(data->ch_switch.ch_width), + data->ch_switch.cf1, + data->ch_switch.cf2); +@@ -349,7 +338,7 @@ + wpa_s->current_ssid->frequency = data->ch_switch.freq; + --- a/src/drivers/driver.h + +++ b/src/drivers/driver.h +-@@ -5690,6 +5690,7 @@ union wpa_event_data { ++@@ -5829,6 +5829,7 @@ union wpa_event_data { + + /** + * struct ch_switch +@@ -357,7 +346,7 @@ + * @freq: Frequency of new channel in MHz + * @ht_enabled: Whether this is an HT channel + * @ch_offset: Secondary channel offset +-@@ -5698,6 +5699,7 @@ union wpa_event_data { ++@@ -5837,6 +5838,7 @@ union wpa_event_data { + * @cf2: Center frequency 2 + */ + struct ch_switch { +@@ -367,7 +356,7 @@ + int ch_offset; + --- a/src/drivers/driver_nl80211_event.c + +++ b/src/drivers/driver_nl80211_event.c +-@@ -541,7 +541,7 @@ static void mlme_event_ch_switch(struct ++@@ -684,7 +684,7 @@ static void mlme_event_ch_switch(struct + struct nlattr *ifindex, struct nlattr *freq, + struct nlattr *type, struct nlattr *bw, + struct nlattr *cf1, struct nlattr *cf2, +@@ -376,7 +365,7 @@ + { + struct i802_bss *bss; + union wpa_event_data data; +-@@ -600,6 +600,8 @@ static void mlme_event_ch_switch(struct ++@@ -745,6 +745,8 @@ static void mlme_event_ch_switch(struct + data.ch_switch.cf1 = nla_get_u32(cf1); + if (cf2) + data.ch_switch.cf2 = nla_get_u32(cf2); +@@ -385,7 +374,7 @@ + + if (finished) + bss->freq = data.ch_switch.freq; +-@@ -2686,6 +2688,7 @@ static void do_process_drv_event(struct ++@@ -3003,6 +3005,7 @@ static void do_process_drv_event(struct + tb[NL80211_ATTR_CHANNEL_WIDTH], + tb[NL80211_ATTR_CENTER_FREQ1], + tb[NL80211_ATTR_CENTER_FREQ2], +@@ -393,7 +382,7 @@ + 0); + break; + case NL80211_CMD_CH_SWITCH_NOTIFY: +-@@ -2696,6 +2699,7 @@ static void do_process_drv_event(struct ++@@ -3013,6 +3016,7 @@ static void do_process_drv_event(struct + tb[NL80211_ATTR_CHANNEL_WIDTH], + tb[NL80211_ATTR_CENTER_FREQ1], + tb[NL80211_ATTR_CENTER_FREQ2], +diff --git a/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch b/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch +index b98b2d0cba..ca634077b7 100644 +--- a/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch ++++ b/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch +@@ -1,6 +1,6 @@ + --- a/hostapd/Makefile + +++ b/hostapd/Makefile +-@@ -226,6 +226,9 @@ endif ++@@ -221,6 +221,9 @@ endif + ifdef CONFIG_NO_CTRL_IFACE + CFLAGS += -DCONFIG_NO_CTRL_IFACE + else +@@ -12,7 +12,7 @@ + else + --- a/hostapd/ctrl_iface.c + +++ b/hostapd/ctrl_iface.c +-@@ -3370,6 +3370,7 @@ static int hostapd_ctrl_iface_receive_pr ++@@ -3569,6 +3569,7 @@ static int hostapd_ctrl_iface_receive_pr + reply_size); + } else if (os_strcmp(buf, "STATUS-DRIVER") == 0) { + reply_len = hostapd_drv_status(hapd, reply, reply_size); +@@ -20,7 +20,7 @@ + } else if (os_strcmp(buf, "MIB") == 0) { + reply_len = ieee802_11_get_mib(hapd, reply, reply_size); + if (reply_len >= 0) { +-@@ -3411,6 +3412,7 @@ static int hostapd_ctrl_iface_receive_pr ++@@ -3610,6 +3611,7 @@ static int hostapd_ctrl_iface_receive_pr + } else if (os_strncmp(buf, "STA-NEXT ", 9) == 0) { + reply_len = hostapd_ctrl_iface_sta_next(hapd, buf + 9, reply, + reply_size); +@@ -30,7 +30,7 @@ + reply_len = -1; + --- a/wpa_supplicant/Makefile + +++ b/wpa_supplicant/Makefile +-@@ -952,6 +952,9 @@ ifdef CONFIG_FILS ++@@ -955,6 +955,9 @@ ifdef CONFIG_FILS + OBJS += ../src/ap/fils_hlp.o + endif + ifdef CONFIG_CTRL_IFACE +@@ -42,7 +42,7 @@ + + --- a/wpa_supplicant/ctrl_iface.c + +++ b/wpa_supplicant/ctrl_iface.c +-@@ -2267,7 +2267,7 @@ static int wpa_supplicant_ctrl_iface_sta ++@@ -2308,7 +2308,7 @@ static int wpa_supplicant_ctrl_iface_sta + pos += ret; + } + +@@ -51,7 +51,7 @@ + if (wpa_s->ap_iface) { + pos += ap_ctrl_iface_wpa_get_status(wpa_s, pos, + end - pos, +-@@ -10366,6 +10366,7 @@ char * wpa_supplicant_ctrl_iface_process ++@@ -10919,6 +10919,7 @@ char * wpa_supplicant_ctrl_iface_process + reply_len = -1; + } else if (os_strncmp(buf, "NOTE ", 5) == 0) { + wpa_printf(MSG_INFO, "NOTE: %s", buf + 5); +@@ -59,7 +59,7 @@ + } else if (os_strcmp(buf, "MIB") == 0) { + reply_len = wpa_sm_get_mib(wpa_s->wpa, reply, reply_size); + if (reply_len >= 0) { +-@@ -10378,6 +10379,7 @@ char * wpa_supplicant_ctrl_iface_process ++@@ -10931,6 +10932,7 @@ char * wpa_supplicant_ctrl_iface_process + reply_size - reply_len); + #endif /* CONFIG_MACSEC */ + } +@@ -67,7 +67,7 @@ + } else if (os_strncmp(buf, "STATUS", 6) == 0) { + reply_len = wpa_supplicant_ctrl_iface_status( + wpa_s, buf + 6, reply, reply_size); +-@@ -10862,6 +10864,7 @@ char * wpa_supplicant_ctrl_iface_process ++@@ -11419,6 +11421,7 @@ char * wpa_supplicant_ctrl_iface_process + reply_len = wpa_supplicant_ctrl_iface_bss( + wpa_s, buf + 4, reply, reply_size); + #ifdef CONFIG_AP +@@ -75,7 +75,7 @@ + } else if (os_strcmp(buf, "STA-FIRST") == 0) { + reply_len = ap_ctrl_iface_sta_first(wpa_s, reply, reply_size); + } else if (os_strncmp(buf, "STA ", 4) == 0) { +-@@ -10870,12 +10873,15 @@ char * wpa_supplicant_ctrl_iface_process ++@@ -11427,12 +11430,15 @@ char * wpa_supplicant_ctrl_iface_process + } else if (os_strncmp(buf, "STA-NEXT ", 9) == 0) { + reply_len = ap_ctrl_iface_sta_next(wpa_s, buf + 9, reply, + reply_size); +@@ -109,7 +109,7 @@ + + #ifdef CONFIG_P2P_MANAGER + static int p2p_manager_disconnect(struct hostapd_data *hapd, u16 stype, +-@@ -806,12 +808,12 @@ int hostapd_ctrl_iface_status(struct hos ++@@ -807,12 +809,12 @@ int hostapd_ctrl_iface_status(struct hos + return len; + len += ret; + } +@@ -126,7 +126,7 @@ + if (os_snprintf_error(buflen - len, ret)) + --- a/src/ap/ieee802_1x.c + +++ b/src/ap/ieee802_1x.c +-@@ -2711,6 +2711,7 @@ static const char * bool_txt(bool val) ++@@ -2712,6 +2712,7 @@ static const char * bool_txt(bool val) + return val ? "TRUE" : "FALSE"; + } + +@@ -134,7 +134,7 @@ + + int ieee802_1x_get_mib(struct hostapd_data *hapd, char *buf, size_t buflen) + { +-@@ -2897,6 +2898,7 @@ int ieee802_1x_get_mib_sta(struct hostap ++@@ -2898,6 +2899,7 @@ int ieee802_1x_get_mib_sta(struct hostap + return len; + } + +@@ -144,7 +144,7 @@ + static void ieee802_1x_wnm_notif_send(void *eloop_ctx, void *timeout_ctx) + --- a/src/ap/wpa_auth.c + +++ b/src/ap/wpa_auth.c +-@@ -4451,6 +4451,7 @@ static const char * wpa_bool_txt(int val ++@@ -4519,6 +4519,7 @@ static const char * wpa_bool_txt(int val + return val ? "TRUE" : "FALSE"; + } + +@@ -152,7 +152,7 @@ + + #define RSN_SUITE "%02x-%02x-%02x-%d" + #define RSN_SUITE_ARG(s) \ +-@@ -4601,7 +4602,7 @@ int wpa_get_mib_sta(struct wpa_state_mac ++@@ -4669,7 +4670,7 @@ int wpa_get_mib_sta(struct wpa_state_mac + + return len; + } +@@ -163,7 +163,7 @@ + { + --- a/src/rsn_supp/wpa.c + +++ b/src/rsn_supp/wpa.c +-@@ -2728,6 +2728,8 @@ static u32 wpa_key_mgmt_suite(struct wpa ++@@ -2767,6 +2767,8 @@ static u32 wpa_key_mgmt_suite(struct wpa + } + + +@@ -172,7 +172,7 @@ + #define RSN_SUITE "%02x-%02x-%02x-%d" + #define RSN_SUITE_ARG(s) \ + ((s) >> 24) & 0xff, ((s) >> 16) & 0xff, ((s) >> 8) & 0xff, (s) & 0xff +-@@ -2809,6 +2811,7 @@ int wpa_sm_get_mib(struct wpa_sm *sm, ch ++@@ -2848,6 +2850,7 @@ int wpa_sm_get_mib(struct wpa_sm *sm, ch + + return (int) len; + } +@@ -182,7 +182,7 @@ + + --- a/wpa_supplicant/ap.c + +++ b/wpa_supplicant/ap.c +-@@ -1324,7 +1324,7 @@ int wpas_ap_wps_nfc_report_handover(stru ++@@ -1364,7 +1364,7 @@ int wpas_ap_wps_nfc_report_handover(stru + #endif /* CONFIG_WPS */ + + +diff --git a/package/network/services/hostapd/patches/390-wpa_ie_cap_workaround.patch b/package/network/services/hostapd/patches/390-wpa_ie_cap_workaround.patch +index 9dee2d738e..65a8b07e65 100644 +--- a/package/network/services/hostapd/patches/390-wpa_ie_cap_workaround.patch ++++ b/package/network/services/hostapd/patches/390-wpa_ie_cap_workaround.patch +@@ -1,6 +1,6 @@ + --- a/src/common/wpa_common.c + +++ b/src/common/wpa_common.c +-@@ -2121,6 +2121,31 @@ u32 wpa_akm_to_suite(int akm) ++@@ -2444,6 +2444,31 @@ u32 wpa_akm_to_suite(int akm) + } + + +@@ -32,7 +32,7 @@ + int wpa_compare_rsn_ie(int ft_initial_assoc, + const u8 *ie1, size_t ie1len, + const u8 *ie2, size_t ie2len) +-@@ -2128,8 +2153,19 @@ int wpa_compare_rsn_ie(int ft_initial_as ++@@ -2451,8 +2476,19 @@ int wpa_compare_rsn_ie(int ft_initial_as + if (ie1 == NULL || ie2 == NULL) + return -1; + +diff --git a/package/network/services/hostapd/patches/420-indicate-features.patch b/package/network/services/hostapd/patches/420-indicate-features.patch +index 9f216347f4..f9dff66073 100644 +--- a/package/network/services/hostapd/patches/420-indicate-features.patch ++++ b/package/network/services/hostapd/patches/420-indicate-features.patch +@@ -8,7 +8,7 @@ + #include "crypto/random.h" + #include "crypto/tls.h" + #include "common/version.h" +-@@ -692,7 +693,7 @@ int main(int argc, char *argv[]) ++@@ -691,7 +692,7 @@ int main(int argc, char *argv[]) + wpa_supplicant_event = hostapd_wpa_event; + wpa_supplicant_event_global = hostapd_wpa_event_global; + for (;;) { +@@ -17,7 +17,7 @@ + if (c < 0) + break; + switch (c) { +-@@ -729,6 +730,8 @@ int main(int argc, char *argv[]) ++@@ -728,6 +729,8 @@ int main(int argc, char *argv[]) + break; + #endif /* CONFIG_DEBUG_LINUX_TRACING */ + case 'v': +diff --git a/package/network/services/hostapd/patches/430-hostapd_cli_ifdef.patch b/package/network/services/hostapd/patches/430-hostapd_cli_ifdef.patch +index 3744464c89..dc1fa3d29d 100644 +--- a/package/network/services/hostapd/patches/430-hostapd_cli_ifdef.patch ++++ b/package/network/services/hostapd/patches/430-hostapd_cli_ifdef.patch +@@ -32,7 +32,7 @@ + + + static int hostapd_cli_cmd_disassoc_imminent(struct wpa_ctrl *ctrl, int argc, +-@@ -1532,13 +1528,10 @@ static const struct hostapd_cli_cmd host ++@@ -1579,13 +1575,10 @@ static const struct hostapd_cli_cmd host + { "disassociate", hostapd_cli_cmd_disassociate, + hostapd_complete_stations, + " = disassociate a station" }, +@@ -46,7 +46,7 @@ + { "wps_pin", hostapd_cli_cmd_wps_pin, NULL, + " [timeout] [addr] = add WPS Enrollee PIN" }, + { "wps_check_pin", hostapd_cli_cmd_wps_check_pin, NULL, +-@@ -1563,7 +1556,6 @@ static const struct hostapd_cli_cmd host ++@@ -1610,7 +1603,6 @@ static const struct hostapd_cli_cmd host + " = configure AP" }, + { "wps_get_status", hostapd_cli_cmd_wps_get_status, NULL, + "= show current WPS status" }, +diff --git a/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch b/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch +index 99c552821b..e0e687e161 100644 +--- a/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch ++++ b/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch +@@ -22,7 +22,7 @@ Signed-hostap: Antonio Quartulli + #include "common/defs.h" + #include "common/ieee802_11_defs.h" + #include "common/wpa_common.h" +-@@ -850,6 +851,9 @@ struct wpa_driver_associate_params { ++@@ -851,6 +852,9 @@ struct wpa_driver_associate_params { + * responsible for selecting with which BSS to associate. */ + const u8 *bssid; + +@@ -42,7 +42,7 @@ Signed-hostap: Antonio Quartulli + #include "config.h" + + +-@@ -2269,6 +2270,97 @@ static char * wpa_config_write_peerkey(c ++@@ -2321,6 +2322,97 @@ static char * wpa_config_write_peerkey(c + #endif /* NO_CONFIG_WRITE */ + + +@@ -140,7 +140,7 @@ Signed-hostap: Antonio Quartulli + /* Helper macros for network block parser */ + + #ifdef OFFSET +-@@ -2552,6 +2644,8 @@ static const struct parse_data ssid_fiel ++@@ -2606,6 +2698,8 @@ static const struct parse_data ssid_fiel + { INT(ap_max_inactivity) }, + { INT(dtim_period) }, + { INT(beacon_int) }, +@@ -174,7 +174,7 @@ Signed-hostap: Antonio Quartulli + * macsec_policy - Determines the policy for MACsec secure session + --- a/wpa_supplicant/wpa_supplicant.c + +++ b/wpa_supplicant/wpa_supplicant.c +-@@ -3638,6 +3638,12 @@ static void wpas_start_assoc_cb(struct w ++@@ -3726,6 +3726,12 @@ static void wpas_start_assoc_cb(struct w + params.beacon_int = ssid->beacon_int; + else + params.beacon_int = wpa_s->conf->beacon_int; +diff --git a/package/network/services/hostapd/patches/461-driver_nl80211-use-new-parameters-during-ibss-join.patch b/package/network/services/hostapd/patches/461-driver_nl80211-use-new-parameters-during-ibss-join.patch +index 61d2089bc8..1d2a053faa 100644 +--- a/package/network/services/hostapd/patches/461-driver_nl80211-use-new-parameters-during-ibss-join.patch ++++ b/package/network/services/hostapd/patches/461-driver_nl80211-use-new-parameters-during-ibss-join.patch +@@ -10,7 +10,7 @@ Signed-hostap: Antonio Quartulli + + --- a/src/drivers/driver_nl80211.c + +++ b/src/drivers/driver_nl80211.c +-@@ -5584,7 +5584,7 @@ static int wpa_driver_nl80211_ibss(struc ++@@ -5951,7 +5951,7 @@ static int wpa_driver_nl80211_ibss(struc + struct wpa_driver_associate_params *params) + { + struct nl_msg *msg; +@@ -19,7 +19,7 @@ Signed-hostap: Antonio Quartulli + int count = 0; + + wpa_printf(MSG_DEBUG, "nl80211: Join IBSS (ifindex=%d)", drv->ifindex); +-@@ -5611,6 +5611,37 @@ retry: ++@@ -5978,6 +5978,37 @@ retry: + nl80211_put_beacon_int(msg, params->beacon_int)) + goto fail; + +diff --git a/package/network/services/hostapd/patches/463-add-mcast_rate-to-11s.patch b/package/network/services/hostapd/patches/463-add-mcast_rate-to-11s.patch +index 33ef097e75..1794befe95 100644 +--- a/package/network/services/hostapd/patches/463-add-mcast_rate-to-11s.patch ++++ b/package/network/services/hostapd/patches/463-add-mcast_rate-to-11s.patch +@@ -19,17 +19,17 @@ Tested-by: Simon Wunderlich + + --- a/src/drivers/driver.h + +++ b/src/drivers/driver.h +-@@ -1549,6 +1549,7 @@ struct wpa_driver_mesh_join_params { ++@@ -1618,6 +1618,7 @@ struct wpa_driver_mesh_join_params { + #define WPA_DRIVER_MESH_FLAG_AMPE 0x00000008 + unsigned int flags; +- u8 handle_dfs; ++ bool handle_dfs; + + int mcast_rate; + }; + + struct wpa_driver_set_key_params { + --- a/src/drivers/driver_nl80211.c + +++ b/src/drivers/driver_nl80211.c +-@@ -10043,6 +10043,18 @@ static int nl80211_put_mesh_id(struct nl ++@@ -10476,6 +10476,18 @@ static int nl80211_put_mesh_id(struct nl + } + + +@@ -48,7 +48,7 @@ Tested-by: Simon Wunderlich + static int nl80211_put_mesh_config(struct nl_msg *msg, + struct wpa_driver_mesh_bss_params *params) + { +-@@ -10104,6 +10116,7 @@ static int nl80211_join_mesh(struct i802 ++@@ -10537,6 +10549,7 @@ static int nl80211_join_mesh(struct i802 + nl80211_put_basic_rates(msg, params->basic_rates) || + nl80211_put_mesh_id(msg, params->meshid, params->meshid_len) || + nl80211_put_beacon_int(msg, params->beacon_int) || +@@ -58,7 +58,7 @@ Tested-by: Simon Wunderlich + + --- a/wpa_supplicant/mesh.c + +++ b/wpa_supplicant/mesh.c +-@@ -592,6 +592,7 @@ int wpa_supplicant_join_mesh(struct wpa_ ++@@ -600,6 +600,7 @@ int wpa_supplicant_join_mesh(struct wpa_ + + params->meshid = ssid->ssid; + params->meshid_len = ssid->ssid_len; +diff --git a/package/network/services/hostapd/patches/464-fix-mesh-obss-check.patch b/package/network/services/hostapd/patches/464-fix-mesh-obss-check.patch +index 6d48175163..4c7cb9ea36 100644 +--- a/package/network/services/hostapd/patches/464-fix-mesh-obss-check.patch ++++ b/package/network/services/hostapd/patches/464-fix-mesh-obss-check.patch +@@ -1,6 +1,6 @@ + --- a/wpa_supplicant/wpa_supplicant.c + +++ b/wpa_supplicant/wpa_supplicant.c +-@@ -2407,11 +2407,13 @@ void ibss_mesh_setup_freq(struct wpa_sup ++@@ -2457,11 +2457,13 @@ void ibss_mesh_setup_freq(struct wpa_sup + for (j = 0; j < wpa_s->last_scan_res_used; j++) { + struct wpa_bss *bss = wpa_s->last_scan_res[j]; + +diff --git a/package/network/services/hostapd/patches/470-survey_data_fallback.patch b/package/network/services/hostapd/patches/470-survey_data_fallback.patch +index 57a78ee865..efd82599d3 100644 +--- a/package/network/services/hostapd/patches/470-survey_data_fallback.patch ++++ b/package/network/services/hostapd/patches/470-survey_data_fallback.patch +@@ -20,7 +20,7 @@ + + total = survey->channel_time; + +-@@ -415,20 +409,19 @@ static int acs_usable_vht160_chan(const ++@@ -422,20 +416,19 @@ static int acs_usable_bw160_chan(const s + static int acs_survey_is_sufficient(struct freq_survey *survey) + { + if (!(survey->filled & SURVEY_HAS_NF)) { +diff --git a/package/network/services/hostapd/patches/500-lto-jobserver-support.patch b/package/network/services/hostapd/patches/500-lto-jobserver-support.patch +index 46030859de..1475590d06 100644 +--- a/package/network/services/hostapd/patches/500-lto-jobserver-support.patch ++++ b/package/network/services/hostapd/patches/500-lto-jobserver-support.patch +@@ -1,16 +1,17 @@ + --- a/hostapd/Makefile + +++ b/hostapd/Makefile +-@@ -1327,14 +1327,14 @@ hostapd_multi.a: $(BCHECK) $(OBJS) ++@@ -1293,7 +1293,7 @@ hostapd_multi.a: $(BCHECK) $(OBJS) + @$(AR) cr $@ hostapd_multi.o $(OBJS) + +- hostapd: $(BCHECK) $(OBJS) ++ hostapd: $(OBJS) + - $(Q)$(CC) $(LDFLAGS) -o hostapd $(OBJS) $(LIBS) + + +$(Q)$(CC) $(LDFLAGS) -o hostapd $(OBJS) $(LIBS) + @$(E) " LD " $@ + + ifdef CONFIG_WPA_TRACE +- OBJS_c += ../src/utils/trace.o +- endif ++@@ -1304,7 +1304,7 @@ _OBJS_VAR := OBJS_c ++ include ../src/objs.mk ++ + hostapd_cli: $(OBJS_c) + - $(Q)$(CC) $(LDFLAGS) -o hostapd_cli $(OBJS_c) $(LIBS_c) + + +$(Q)$(CC) $(LDFLAGS) -o hostapd_cli $(OBJS_c) $(LIBS_c) +@@ -19,7 +20,7 @@ + NOBJS = nt_password_hash.o ../src/crypto/ms_funcs.o $(SHA1OBJS) + --- a/wpa_supplicant/Makefile + +++ b/wpa_supplicant/Makefile +-@@ -1930,23 +1930,23 @@ wpa_supplicant_multi.a: .config $(BCHECK ++@@ -1918,31 +1918,31 @@ wpa_supplicant_multi.a: .config $(BCHECK + @$(AR) cr $@ wpa_supplicant_multi.o $(OBJS) + + wpa_supplicant: $(BCHECK) $(OBJS) $(EXTRA_progs) +@@ -27,21 +28,29 @@ + + +$(Q)$(LDO) $(LDFLAGS) -o wpa_supplicant $(OBJS) $(LIBS) $(EXTRALIBS) + @$(E) " LD " $@ + ++ _OBJS_VAR := OBJS_t ++ include ../src/objs.mk + eapol_test: $(OBJS_t) + - $(Q)$(LDO) $(LDFLAGS) -o eapol_test $(OBJS_t) $(LIBS) + + +$(Q)$(LDO) $(LDFLAGS) -o eapol_test $(OBJS_t) $(LIBS) + @$(E) " LD " $@ + ++ _OBJS_VAR := OBJS_t2 ++ include ../src/objs.mk + preauth_test: $(OBJS_t2) + - $(Q)$(LDO) $(LDFLAGS) -o preauth_test $(OBJS_t2) $(LIBS) + + +$(Q)$(LDO) $(LDFLAGS) -o preauth_test $(OBJS_t2) $(LIBS) + @$(E) " LD " $@ + ++ _OBJS_VAR := OBJS_p ++ include ../src/objs.mk + wpa_passphrase: $(OBJS_p) + - $(Q)$(LDO) $(LDFLAGS) -o wpa_passphrase $(OBJS_p) $(LIBS_p) $(LIBS) + + +$(Q)$(LDO) $(LDFLAGS) -o wpa_passphrase $(OBJS_p) $(LIBS_p) $(LIBS) + @$(E) " LD " $@ + ++ _OBJS_VAR := OBJS_c ++ include ../src/objs.mk + wpa_cli: $(OBJS_c) + - $(Q)$(LDO) $(LDFLAGS) -o wpa_cli $(OBJS_c) $(LIBS_c) + + +$(Q)$(LDO) $(LDFLAGS) -o wpa_cli $(OBJS_c) $(LIBS_c) +diff --git a/package/network/services/hostapd/patches/600-ubus_support.patch b/package/network/services/hostapd/patches/600-ubus_support.patch +index 938840755a..71537c9ec6 100644 +--- a/package/network/services/hostapd/patches/600-ubus_support.patch ++++ b/package/network/services/hostapd/patches/600-ubus_support.patch +@@ -1,6 +1,6 @@ + --- a/hostapd/Makefile + +++ b/hostapd/Makefile +-@@ -171,6 +171,11 @@ OBJS += ../src/common/hw_features_common ++@@ -166,6 +166,11 @@ OBJS += ../src/common/hw_features_common + + OBJS += ../src/eapol_auth/eapol_auth_sm.o + +@@ -39,7 +39,7 @@ + int interface_added; /* virtual interface added for this BSS */ + unsigned int started:1; + unsigned int disabled:1; +-@@ -606,6 +608,7 @@ hostapd_alloc_bss_data(struct hostapd_if ++@@ -610,6 +612,7 @@ hostapd_alloc_bss_data(struct hostapd_if + struct hostapd_bss_config *bss); + int hostapd_setup_interface(struct hostapd_iface *iface); + int hostapd_setup_interface_complete(struct hostapd_iface *iface, int err); +@@ -49,7 +49,7 @@ + struct hostapd_iface * hostapd_alloc_iface(void); + --- a/src/ap/hostapd.c + +++ b/src/ap/hostapd.c +-@@ -395,6 +395,7 @@ void hostapd_free_hapd_data(struct hosta ++@@ -396,6 +396,7 @@ void hostapd_free_hapd_data(struct hosta + hapd->beacon_set_done = 0; + + wpa_printf(MSG_DEBUG, "%s(%s)", __func__, hapd->conf->iface); +@@ -57,7 +57,7 @@ + accounting_deinit(hapd); + hostapd_deinit_wpa(hapd); + vlan_deinit(hapd); +-@@ -1417,6 +1418,8 @@ static int hostapd_setup_bss(struct host ++@@ -1422,6 +1423,8 @@ static int hostapd_setup_bss(struct host + if (hapd->driver && hapd->driver->set_operstate) + hapd->driver->set_operstate(hapd->drv_priv, 1); + +@@ -66,7 +66,7 @@ + return 0; + } + +-@@ -1999,6 +2002,7 @@ static int hostapd_setup_interface_compl ++@@ -2028,6 +2031,7 @@ static int hostapd_setup_interface_compl + if (err) + goto fail; + +@@ -74,7 +74,7 @@ + wpa_printf(MSG_DEBUG, "Completing interface initialization"); + if (iface->freq) { + #ifdef NEED_AP_MLME +-@@ -2196,6 +2200,7 @@ dfs_offload: ++@@ -2225,6 +2229,7 @@ dfs_offload: + + fail: + wpa_printf(MSG_ERROR, "Interface initialization failed"); +@@ -82,7 +82,7 @@ + hostapd_set_state(iface, HAPD_IFACE_DISABLED); + wpa_msg(hapd->msg_ctx, MSG_INFO, AP_EVENT_DISABLED); + #ifdef CONFIG_FST +-@@ -2669,6 +2674,7 @@ void hostapd_interface_deinit_free(struc ++@@ -2700,6 +2705,7 @@ void hostapd_interface_deinit_free(struc + (unsigned int) iface->conf->num_bss); + driver = iface->bss[0]->driver; + drv_priv = iface->bss[0]->drv_priv; +@@ -92,7 +92,7 @@ + __func__, driver, drv_priv); + --- a/src/ap/ieee802_11.c + +++ b/src/ap/ieee802_11.c +-@@ -2327,13 +2327,18 @@ static void handle_auth(struct hostapd_d ++@@ -3553,13 +3553,18 @@ static void handle_auth(struct hostapd_d + u16 auth_alg, auth_transaction, status_code; + u16 resp = WLAN_STATUS_SUCCESS; + struct sta_info *sta = NULL; +@@ -112,7 +112,7 @@ + + if (len < IEEE80211_HDRLEN + sizeof(mgmt->u.auth)) { + wpa_printf(MSG_INFO, "handle_auth - too short payload (len=%lu)", +-@@ -2493,6 +2498,13 @@ static void handle_auth(struct hostapd_d ++@@ -3727,6 +3732,13 @@ static void handle_auth(struct hostapd_d + resp = WLAN_STATUS_UNSPECIFIED_FAILURE; + goto fail; + } +@@ -126,16 +126,16 @@ + if (res == HOSTAPD_ACL_PENDING) + return; + +-@@ -4166,7 +4178,7 @@ static void handle_assoc(struct hostapd_ ++@@ -5454,7 +5466,7 @@ static void handle_assoc(struct hostapd_ + int resp = WLAN_STATUS_SUCCESS; +- u16 reply_res; ++ u16 reply_res = WLAN_STATUS_UNSPECIFIED_FAILURE; + const u8 *pos; + - int left, i; + + int left, i, ubus_resp; + struct sta_info *sta; + u8 *tmp = NULL; + #ifdef CONFIG_FILS +-@@ -4379,6 +4391,11 @@ static void handle_assoc(struct hostapd_ ++@@ -5667,6 +5679,11 @@ static void handle_assoc(struct hostapd_ + left = res; + } + #endif /* CONFIG_FILS */ +@@ -147,7 +147,7 @@ + + /* followed by SSID and Supported rates; and HT capabilities if 802.11n + * is used */ +-@@ -4543,6 +4560,14 @@ static void handle_assoc(struct hostapd_ ++@@ -5831,6 +5848,14 @@ static void handle_assoc(struct hostapd_ + pos, left, rssi, omit_rsnxe); + os_free(tmp); + +@@ -160,9 +160,9 @@ + + } + + + /* +- * Remove the station in case tranmission of a success response fails ++ * Remove the station in case transmission of a success response fails + * (the STA was added associated to the driver) or if the station was +-@@ -4570,6 +4595,7 @@ static void handle_disassoc(struct hosta ++@@ -5858,6 +5883,7 @@ static void handle_disassoc(struct hosta + wpa_printf(MSG_DEBUG, "disassocation: STA=" MACSTR " reason_code=%d", + MAC2STR(mgmt->sa), + le_to_host16(mgmt->u.disassoc.reason_code)); +@@ -170,9 +170,9 @@ + + sta = ap_get_sta(hapd, mgmt->sa); + if (sta == NULL) { +-@@ -4636,6 +4662,8 @@ static void handle_deauth(struct hostapd +- " reason_code=%d", +- MAC2STR(mgmt->sa), le_to_host16(mgmt->u.deauth.reason_code)); ++@@ -5927,6 +5953,8 @@ static void handle_deauth(struct hostapd ++ /* Clear the PTKSA cache entries for PASN */ ++ ptksa_cache_flush(hapd->ptksa, mgmt->sa, WPA_CIPHER_NONE); + + + hostapd_ubus_notify(hapd, "deauth", mgmt->sa); + + +@@ -181,7 +181,7 @@ + wpa_msg(hapd->msg_ctx, MSG_DEBUG, "Station " MACSTR " trying " + --- a/src/ap/beacon.c + +++ b/src/ap/beacon.c +-@@ -814,6 +814,12 @@ void handle_probe_req(struct hostapd_dat ++@@ -823,6 +823,12 @@ void handle_probe_req(struct hostapd_dat + u16 csa_offs[2]; + size_t csa_offs_len; + struct radius_sta rad_info; +@@ -192,9 +192,9 @@ + + .elems = &elems, + + }; + +- if (len < IEEE80211_HDRLEN) +- return; +-@@ -996,6 +1002,12 @@ void handle_probe_req(struct hostapd_dat ++ if (hapd->iconf->rssi_ignore_probe_request && ssi_signal && ++ ssi_signal < hapd->iconf->rssi_ignore_probe_request) ++@@ -1009,6 +1015,12 @@ void handle_probe_req(struct hostapd_dat + } + #endif /* CONFIG_P2P */ + +@@ -209,7 +209,7 @@ + + --- a/src/ap/drv_callbacks.c + +++ b/src/ap/drv_callbacks.c +-@@ -119,6 +119,10 @@ int hostapd_notif_assoc(struct hostapd_d ++@@ -145,6 +145,10 @@ int hostapd_notif_assoc(struct hostapd_d + u16 reason = WLAN_REASON_UNSPECIFIED; + int status = WLAN_STATUS_SUCCESS; + const u8 *p2p_dev_addr = NULL; +@@ -220,7 +220,7 @@ + + if (addr == NULL) { + /* +-@@ -211,6 +215,12 @@ int hostapd_notif_assoc(struct hostapd_d ++@@ -237,6 +241,12 @@ int hostapd_notif_assoc(struct hostapd_d + goto fail; + } + +@@ -235,7 +235,7 @@ + wpabuf_free(sta->p2p_ie); + --- a/src/ap/sta_info.c + +++ b/src/ap/sta_info.c +-@@ -424,6 +424,7 @@ void ap_handle_timer(void *eloop_ctx, vo ++@@ -459,6 +459,7 @@ void ap_handle_timer(void *eloop_ctx, vo + HOSTAPD_LEVEL_INFO, "deauthenticated due to " + "local deauth request"); + ap_free_sta(hapd, sta); +@@ -243,7 +243,7 @@ + return; + } + +-@@ -579,6 +580,7 @@ skip_poll: ++@@ -614,6 +615,7 @@ skip_poll: + hapd, sta, + WLAN_REASON_PREV_AUTH_NOT_VALID); + ap_free_sta(hapd, sta); +@@ -251,7 +251,7 @@ + break; + } + } +-@@ -1294,6 +1296,7 @@ void ap_sta_set_authorized(struct hostap ++@@ -1329,6 +1331,7 @@ void ap_sta_set_authorized(struct hostap + buf, ip_addr, keyid_buf); + } else { + wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_DISCONNECTED "%s", buf); +@@ -261,7 +261,7 @@ + hapd->msg_ctx_parent != hapd->msg_ctx) + --- a/src/ap/wpa_auth_glue.c + +++ b/src/ap/wpa_auth_glue.c +-@@ -259,6 +259,7 @@ static void hostapd_wpa_auth_psk_failure ++@@ -265,6 +265,7 @@ static void hostapd_wpa_auth_psk_failure + struct hostapd_data *hapd = ctx; + wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_POSSIBLE_PSK_MISMATCH MACSTR, + MAC2STR(addr)); +@@ -271,7 +271,7 @@ + + --- a/wpa_supplicant/Makefile + +++ b/wpa_supplicant/Makefile +-@@ -190,6 +190,12 @@ ifdef CONFIG_EAPOL_TEST ++@@ -176,6 +176,12 @@ ifdef CONFIG_EAPOL_TEST + CFLAGS += -Werror -DEAPOL_TEST + endif + +@@ -284,7 +284,7 @@ + ifdef CONFIG_CODE_COVERAGE + CFLAGS += -O0 -fprofile-arcs -ftest-coverage + LIBS += -lgcov +-@@ -956,6 +962,9 @@ ifdef CONFIG_CTRL_IFACE_MIB ++@@ -959,6 +965,9 @@ ifdef CONFIG_CTRL_IFACE_MIB + CFLAGS += -DCONFIG_CTRL_IFACE_MIB + endif + OBJS += ../src/ap/ctrl_iface_ap.o +@@ -296,7 +296,7 @@ + CFLAGS += -DEAP_SERVER -DEAP_SERVER_IDENTITY + --- a/wpa_supplicant/wpa_supplicant.c + +++ b/wpa_supplicant/wpa_supplicant.c +-@@ -6794,6 +6794,8 @@ struct wpa_supplicant * wpa_supplicant_a ++@@ -7017,6 +7017,8 @@ struct wpa_supplicant * wpa_supplicant_a + } + #endif /* CONFIG_P2P */ + +@@ -305,7 +305,7 @@ + return wpa_s; + } + +-@@ -6820,6 +6822,8 @@ int wpa_supplicant_remove_iface(struct w ++@@ -7043,6 +7045,8 @@ int wpa_supplicant_remove_iface(struct w + struct wpa_supplicant *parent = wpa_s->parent; + #endif /* CONFIG_MESH */ + +@@ -314,7 +314,7 @@ + /* Remove interface from the global list of interfaces */ + prev = global->ifaces; + if (prev == wpa_s) { +-@@ -7123,8 +7127,12 @@ int wpa_supplicant_run(struct wpa_global ++@@ -7346,8 +7350,12 @@ int wpa_supplicant_run(struct wpa_global + eloop_register_signal_terminate(wpa_supplicant_terminate, global); + eloop_register_signal_reconfig(wpa_supplicant_reconfig, global); + +@@ -329,7 +329,7 @@ + + --- a/wpa_supplicant/wpa_supplicant_i.h + +++ b/wpa_supplicant/wpa_supplicant_i.h +-@@ -17,6 +17,7 @@ ++@@ -19,6 +19,7 @@ + #include "wps/wps_defs.h" + #include "config_ssid.h" + #include "wmm_ac.h" +@@ -337,7 +337,7 @@ + + extern const char *const wpa_supplicant_version; + extern const char *const wpa_supplicant_license; +-@@ -310,6 +311,8 @@ struct wpa_global { ++@@ -321,6 +322,8 @@ struct wpa_global { + #endif /* CONFIG_WIFI_DISPLAY */ + + struct psk_list_entry *add_psk; /* From group formation */ +@@ -346,7 +346,7 @@ + }; + + +-@@ -520,6 +523,7 @@ struct wpa_supplicant { ++@@ -605,6 +608,7 @@ struct wpa_supplicant { + unsigned char own_addr[ETH_ALEN]; + unsigned char perm_addr[ETH_ALEN]; + char ifname[100]; +@@ -375,7 +375,7 @@ + + --- a/hostapd/main.c + +++ b/hostapd/main.c +-@@ -896,6 +896,7 @@ int main(int argc, char *argv[]) ++@@ -895,6 +895,7 @@ int main(int argc, char *argv[]) + } + + hostapd_global_ctrl_iface_init(&interfaces); +@@ -383,7 +383,7 @@ + + if (hostapd_global_run(&interfaces, daemonize, pid_file)) { + wpa_printf(MSG_ERROR, "Failed to start eloop"); +-@@ -905,6 +906,7 @@ int main(int argc, char *argv[]) ++@@ -904,6 +905,7 @@ int main(int argc, char *argv[]) + ret = 0; + + out: +@@ -424,3 +424,52 @@ + } + + ++--- a/src/ap/vlan_init.c +++++ b/src/ap/vlan_init.c ++@@ -22,6 +22,7 @@ ++ static int vlan_if_add(struct hostapd_data *hapd, struct hostapd_vlan *vlan, ++ int existsok) ++ { +++ bool vlan_exists = iface_exists(vlan->ifname); ++ int ret; ++ #ifdef CONFIG_WEP ++ int i; ++@@ -36,7 +37,7 @@ static int vlan_if_add(struct hostapd_da ++ } ++ #endif /* CONFIG_WEP */ ++ ++- if (!iface_exists(vlan->ifname)) +++ if (!vlan_exists) ++ ret = hostapd_vlan_if_add(hapd, vlan->ifname); ++ else if (!existsok) ++ return -1; ++@@ -51,6 +52,9 @@ static int vlan_if_add(struct hostapd_da ++ if (hapd->wpa_auth) ++ ret = wpa_auth_ensure_group(hapd->wpa_auth, vlan->vlan_id); ++ +++ if (!ret && !vlan_exists) +++ hostapd_ubus_add_vlan(hapd, vlan); +++ ++ if (ret == 0) ++ return ret; ++ ++@@ -77,6 +81,8 @@ int vlan_if_remove(struct hostapd_data * ++ "WPA deinitialization for VLAN %d failed (%d)", ++ vlan->vlan_id, ret); ++ +++ hostapd_ubus_remove_vlan(hapd, vlan); +++ ++ return hostapd_vlan_if_remove(hapd, vlan->ifname); ++ } ++ ++--- a/src/ap/dfs.c +++++ b/src/ap/dfs.c ++@@ -1193,6 +1193,8 @@ int hostapd_dfs_radar_detected(struct ho ++ "freq=%d ht_enabled=%d chan_offset=%d chan_width=%d cf1=%d cf2=%d", ++ freq, ht_enabled, chan_offset, chan_width, cf1, cf2); ++ +++ hostapd_ubus_notify_radar_detected(iface, freq, chan_width, cf1, cf2); +++ ++ /* Proceed only if DFS is not offloaded to the driver */ ++ if (iface->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD) ++ return 0; +diff --git a/package/network/services/hostapd/patches/700-wifi-reload.patch b/package/network/services/hostapd/patches/700-wifi-reload.patch +index d5520d0b77..5993b0d445 100644 +--- a/package/network/services/hostapd/patches/700-wifi-reload.patch ++++ b/package/network/services/hostapd/patches/700-wifi-reload.patch +@@ -1,6 +1,6 @@ + --- a/hostapd/config_file.c + +++ b/hostapd/config_file.c +-@@ -2501,6 +2501,8 @@ static int hostapd_config_fill(struct ho ++@@ -2453,6 +2453,8 @@ static int hostapd_config_fill(struct ho + bss->isolate = atoi(pos); + } else if (os_strcmp(buf, "ap_max_inactivity") == 0) { + bss->ap_max_inactivity = atoi(pos); +@@ -9,7 +9,7 @@ + } else if (os_strcmp(buf, "skip_inactivity_poll") == 0) { + bss->skip_inactivity_poll = atoi(pos); + } else if (os_strcmp(buf, "country_code") == 0) { +-@@ -3197,6 +3199,8 @@ static int hostapd_config_fill(struct ho ++@@ -3153,6 +3155,8 @@ static int hostapd_config_fill(struct ho + } + } else if (os_strcmp(buf, "acs_exclude_dfs") == 0) { + conf->acs_exclude_dfs = atoi(pos); +@@ -20,7 +20,7 @@ + } else if (os_strcmp(buf, "channel") == 0) { + --- a/src/ap/ap_config.c + +++ b/src/ap/ap_config.c +-@@ -780,6 +780,7 @@ void hostapd_config_free_bss(struct host ++@@ -791,6 +791,7 @@ void hostapd_config_free_bss(struct host + os_free(conf->radius_req_attr_sqlite); + os_free(conf->rsn_preauth_interfaces); + os_free(conf->ctrl_interface); +@@ -28,7 +28,7 @@ + os_free(conf->ca_cert); + os_free(conf->server_cert); + os_free(conf->server_cert2); +-@@ -972,6 +973,7 @@ void hostapd_config_free(struct hostapd_ ++@@ -987,6 +988,7 @@ void hostapd_config_free(struct hostapd_ + + for (i = 0; i < conf->num_bss; i++) + hostapd_config_free_bss(conf->bss[i]); +@@ -38,25 +38,26 @@ + os_free(conf->basic_rates); + --- a/src/ap/ap_config.h + +++ b/src/ap/ap_config.h +-@@ -871,6 +871,7 @@ struct hostapd_bss_config { +- */ +- u8 mka_psk_set; +- #endif /* CONFIG_MACSEC */ ++@@ -279,6 +279,8 @@ struct hostapd_bss_config { ++ char vlan_bridge[IFNAMSIZ + 1]; ++ char wds_bridge[IFNAMSIZ + 1]; ++ + + char *config_id; +- }; +++ ++ enum hostapd_logger_level logger_syslog_level, logger_stdout_level; + +- /** +-@@ -1062,6 +1063,7 @@ struct hostapd_config { +- unsigned int airtime_update_interval; +- #define AIRTIME_MODE_MAX (__AIRTIME_MODE_MAX - 1) +- #endif /* CONFIG_AIRTIME_POLICY */ ++ unsigned int logger_syslog; /* module bitfield */ ++@@ -938,6 +940,7 @@ struct spatial_reuse { ++ struct hostapd_config { ++ struct hostapd_bss_config **bss, *last_bss; ++ size_t num_bss; + + char *config_id; + +- u8 notify_mgmt_frames; +- }; ++ u16 beacon_int; ++ int rts_threshold; + --- a/src/ap/hostapd.c + +++ b/src/ap/hostapd.c +-@@ -218,6 +218,10 @@ static int hostapd_iface_conf_changed(st ++@@ -219,6 +219,10 @@ static int hostapd_iface_conf_changed(st + { + size_t i; + +@@ -67,7 +68,7 @@ + if (newconf->num_bss != oldconf->num_bss) + return 1; + +-@@ -231,7 +235,7 @@ static int hostapd_iface_conf_changed(st ++@@ -232,7 +236,7 @@ static int hostapd_iface_conf_changed(st + } + + +@@ -76,7 +77,7 @@ + { + struct hapd_interfaces *interfaces = iface->interfaces; + struct hostapd_data *hapd = iface->bss[0]; +-@@ -254,13 +258,16 @@ int hostapd_reload_config(struct hostapd ++@@ -255,13 +259,16 @@ int hostapd_reload_config(struct hostapd + if (newconf == NULL) + return -1; + +@@ -95,7 +96,7 @@ + wpa_printf(MSG_DEBUG, + "Configuration changes include interface/BSS modification - force full disable+enable sequence"); + fname = os_strdup(iface->config_fname); +-@@ -285,6 +292,24 @@ int hostapd_reload_config(struct hostapd ++@@ -286,6 +293,24 @@ int hostapd_reload_config(struct hostapd + wpa_printf(MSG_ERROR, + "Failed to enable interface on config reload"); + return res; +@@ -120,7 +121,7 @@ + } + iface->conf = newconf; + +-@@ -301,6 +326,12 @@ int hostapd_reload_config(struct hostapd ++@@ -302,6 +327,12 @@ int hostapd_reload_config(struct hostapd + + for (j = 0; j < iface->num_bss; j++) { + hapd = iface->bss[j]; +@@ -133,7 +134,7 @@ + hapd->iconf = newconf; + hapd->conf = newconf->bss[j]; + hostapd_reload_bss(hapd); +-@@ -2366,6 +2397,10 @@ hostapd_alloc_bss_data(struct hostapd_if ++@@ -2397,6 +2428,10 @@ hostapd_alloc_bss_data(struct hostapd_if + hapd->iconf = conf; + hapd->conf = bss; + hapd->iface = hapd_iface; +@@ -163,7 +164,7 @@ + int interface_added; /* virtual interface added for this BSS */ + unsigned int started:1; + unsigned int disabled:1; +-@@ -600,7 +601,7 @@ struct hostapd_iface { ++@@ -604,7 +605,7 @@ struct hostapd_iface { + int hostapd_for_each_interface(struct hapd_interfaces *interfaces, + int (*cb)(struct hostapd_iface *iface, + void *ctx), void *ctx); +@@ -174,7 +175,7 @@ + hostapd_alloc_bss_data(struct hostapd_iface *hapd_iface, + --- a/src/drivers/driver_nl80211.c + +++ b/src/drivers/driver_nl80211.c +-@@ -4493,6 +4493,9 @@ static int wpa_driver_nl80211_set_ap(voi ++@@ -4820,6 +4820,9 @@ static int wpa_driver_nl80211_set_ap(voi + if (ret) { + wpa_printf(MSG_DEBUG, "nl80211: Beacon set failed: %d (%s)", + ret, strerror(-ret)); +@@ -186,7 +187,7 @@ + nl80211_set_bss(bss, params->cts_protect, params->preamble, + --- a/hostapd/ctrl_iface.c + +++ b/hostapd/ctrl_iface.c +-@@ -184,7 +184,7 @@ static int hostapd_ctrl_iface_update(str ++@@ -186,7 +186,7 @@ static int hostapd_ctrl_iface_update(str + iface->interfaces->config_read_cb = hostapd_ctrl_iface_config_read; + reload_opts = txt; + +diff --git a/package/network/services/hostapd/patches/710-vlan_no_bridge.patch b/package/network/services/hostapd/patches/710-vlan_no_bridge.patch +new file mode 100644 +index 0000000000..d5aa33520b +--- /dev/null ++++ b/package/network/services/hostapd/patches/710-vlan_no_bridge.patch +@@ -0,0 +1,33 @@ ++--- a/src/ap/ap_config.h +++++ b/src/ap/ap_config.h ++@@ -115,6 +115,7 @@ struct hostapd_ssid { ++ #define DYNAMIC_VLAN_OPTIONAL 1 ++ #define DYNAMIC_VLAN_REQUIRED 2 ++ int dynamic_vlan; +++ int vlan_no_bridge; ++ #define DYNAMIC_VLAN_NAMING_WITHOUT_DEVICE 0 ++ #define DYNAMIC_VLAN_NAMING_WITH_DEVICE 1 ++ #define DYNAMIC_VLAN_NAMING_END 2 ++--- a/src/ap/vlan_full.c +++++ b/src/ap/vlan_full.c ++@@ -466,6 +466,9 @@ void vlan_newlink(const char *ifname, st ++ ++ wpa_printf(MSG_DEBUG, "VLAN: vlan_newlink(%s)", ifname); ++ +++ if (hapd->conf->ssid.vlan_no_bridge) +++ return; +++ ++ for (vlan = hapd->conf->vlan; vlan; vlan = vlan->next) { ++ if (vlan->configured || ++ os_strcmp(ifname, vlan->ifname) != 0) ++--- a/hostapd/config_file.c +++++ b/hostapd/config_file.c ++@@ -3366,6 +3366,8 @@ static int hostapd_config_fill(struct ho ++ #ifndef CONFIG_NO_VLAN ++ } else if (os_strcmp(buf, "dynamic_vlan") == 0) { ++ bss->ssid.dynamic_vlan = atoi(pos); +++ } else if (os_strcmp(buf, "vlan_no_bridge") == 0) { +++ bss->ssid.vlan_no_bridge = atoi(pos); ++ } else if (os_strcmp(buf, "per_sta_vif") == 0) { ++ bss->ssid.per_sta_vif = atoi(pos); ++ } else if (os_strcmp(buf, "vlan_file") == 0) { +diff --git a/package/network/services/hostapd/patches/720-ACS-fix-channel-100-frequency.patch b/package/network/services/hostapd/patches/720-ACS-fix-channel-100-frequency.patch +new file mode 100644 +index 0000000000..3ef19e5298 +--- /dev/null ++++ b/package/network/services/hostapd/patches/720-ACS-fix-channel-100-frequency.patch +@@ -0,0 +1,30 @@ ++From 5a24286ed6315e1fef755ca1970792554f59b1fc Mon Sep 17 00:00:00 2001 ++From: David Bauer ++Date: Wed, 26 May 2021 22:15:35 +0200 ++Subject: [PATCH] ACS: fix channel 100 frequency ++ ++Channel 100 is a valid channel to choose for 80MHz operation. However, ++it's assigned to 5500 MHz, not 5550MHz. In fact, there is no channel ++assigned to this frequency. ++ ++Fix this obbvious typo to allow ACS to select channel 100 for 80 MHz ++operation again. ++ ++Fixes commit bef5eee4f7b2 ("Convert channel to frequency based selection for AP mode ACS") ++ ++Signed-off-by: David Bauer ++--- ++ src/ap/acs.c | 2 +- ++ 1 file changed, 1 insertion(+), 1 deletion(-) ++ ++--- a/src/ap/acs.c +++++ b/src/ap/acs.c ++@@ -386,7 +386,7 @@ static int acs_usable_bw40_chan(const st ++ ++ static int acs_usable_bw80_chan(const struct hostapd_channel_data *chan) ++ { ++- const int allowed[] = { 5180, 5260, 5550, 5580, 5660, 5745, 5955, 6035, +++ const int allowed[] = { 5180, 5260, 5500, 5580, 5660, 5745, 5955, 6035, ++ 6115, 6195, 6275, 6355, 6435, 6515, 6595, 6675, ++ 6755, 6835, 6915, 6995 }; ++ unsigned int i; +diff --git a/package/network/services/hostapd/patches/720-iface_max_num_sta.patch b/package/network/services/hostapd/patches/720-iface_max_num_sta.patch +new file mode 100644 +index 0000000000..b93a0bcbef +--- /dev/null ++++ b/package/network/services/hostapd/patches/720-iface_max_num_sta.patch +@@ -0,0 +1,82 @@ ++--- a/hostapd/config_file.c +++++ b/hostapd/config_file.c ++@@ -2873,6 +2873,14 @@ static int hostapd_config_fill(struct ho ++ line, bss->max_num_sta, MAX_STA_COUNT); ++ return 1; ++ } +++ } else if (os_strcmp(buf, "iface_max_num_sta") == 0) { +++ conf->max_num_sta = atoi(pos); +++ if (conf->max_num_sta < 0 || +++ conf->max_num_sta > MAX_STA_COUNT) { +++ wpa_printf(MSG_ERROR, "Line %d: Invalid max_num_sta=%d; allowed range 0..%d", +++ line, conf->max_num_sta, MAX_STA_COUNT); +++ return 1; +++ } ++ } else if (os_strcmp(buf, "wpa") == 0) { ++ bss->wpa = atoi(pos); ++ } else if (os_strcmp(buf, "extended_key_id") == 0) { ++--- a/src/ap/hostapd.h +++++ b/src/ap/hostapd.h ++@@ -648,6 +648,7 @@ void hostapd_cleanup_cs_params(struct ho ++ void hostapd_periodic_iface(struct hostapd_iface *iface); ++ int hostapd_owe_trans_get_info(struct hostapd_data *hapd); ++ void hostapd_ocv_check_csa_sa_query(void *eloop_ctx, void *timeout_ctx); +++int hostapd_check_max_sta(struct hostapd_data *hapd); ++ ++ /* utils.c */ ++ int hostapd_register_probereq_cb(struct hostapd_data *hapd, ++--- a/src/ap/hostapd.c +++++ b/src/ap/hostapd.c ++@@ -236,6 +236,30 @@ static int hostapd_iface_conf_changed(st ++ } ++ ++ +++static inline int hostapd_iface_num_sta(struct hostapd_iface *iface) +++{ +++ int num_sta = 0; +++ int i; +++ +++ for (i = 0; i < iface->num_bss; i++) +++ num_sta += iface->bss[i]->num_sta; +++ +++ return num_sta; +++} +++ +++ +++int hostapd_check_max_sta(struct hostapd_data *hapd) +++{ +++ if (hapd->num_sta >= hapd->conf->max_num_sta) +++ return 1; +++ +++ if (hapd->iconf->max_num_sta && +++ hostapd_iface_num_sta(hapd->iface) >= hapd->iconf->max_num_sta) +++ return 1; +++ +++ return 0; +++} +++ ++ int hostapd_reload_config(struct hostapd_iface *iface, int reconf) ++ { ++ struct hapd_interfaces *interfaces = iface->interfaces; ++--- a/src/ap/beacon.c +++++ b/src/ap/beacon.c ++@@ -1039,7 +1039,7 @@ void handle_probe_req(struct hostapd_dat ++ if (hapd->conf->no_probe_resp_if_max_sta && ++ is_multicast_ether_addr(mgmt->da) && ++ is_multicast_ether_addr(mgmt->bssid) && ++- hapd->num_sta >= hapd->conf->max_num_sta && +++ hostapd_check_max_sta(hapd) && ++ !ap_get_sta(hapd, mgmt->sa)) { ++ wpa_printf(MSG_MSGDUMP, "%s: Ignore Probe Request from " MACSTR ++ " since no room for additional STA", ++--- a/src/ap/ap_config.h +++++ b/src/ap/ap_config.h ++@@ -976,6 +976,8 @@ struct hostapd_config { ++ unsigned int track_sta_max_num; ++ unsigned int track_sta_max_age; ++ +++ int max_num_sta; +++ ++ char country[3]; /* first two octets: country code as described in ++ * ISO/IEC 3166-1. Third octet: ++ * ' ' (ascii 32): all environments +diff --git a/package/network/services/hostapd/patches/800-dfs-enter-DFS-state-if-no-available-channel-is-found.patch b/package/network/services/hostapd/patches/800-dfs-enter-DFS-state-if-no-available-channel-is-found.patch +deleted file mode 100644 +index 3e4638d7ff..0000000000 +--- a/package/network/services/hostapd/patches/800-dfs-enter-DFS-state-if-no-available-channel-is-found.patch ++++ /dev/null +@@ -1,37 +0,0 @@ +-From cefc52e6b93731c713f1bba1cb5e7e92105b758b Mon Sep 17 00:00:00 2001 +-From: David Bauer +-Date: Fri, 3 Jul 2020 23:00:34 +0200 +-Subject: [PATCH] dfs: enter DFS state if no available channel is found +- +-Previously hostapd would not stop transmitting when a DFS event was +-detected and no available channel to switch to was available. +- +-Disable and re-enable the interface to enter DFS state. This way, TX +-does not happen until the kernel notifies hostapd about the NOP +-expiring. +- +-Signed-off-by: David Bauer +---- +- src/ap/dfs.c | 11 +++++++++-- +- 1 file changed, 9 insertions(+), 2 deletions(-) +- +---- a/src/ap/dfs.c +-+++ b/src/ap/dfs.c +-@@ -1086,8 +1086,15 @@ static int hostapd_dfs_start_channel_swi +- &oper_centr_freq_seg0_idx, +- &oper_centr_freq_seg1_idx, +- &skip_radar); +-- if (!channel) +-- return err; +-+ if (!channel) { +-+ /* +-+ * Toggle interface state to enter DFS state +-+ * until NOP is finished. +-+ */ +-+ hostapd_disable_iface(iface); +-+ hostapd_enable_iface(iface); +-+ return 0; +-+ } +- if (!skip_radar) { +- iface->freq = channel->freq; +- iface->conf->channel = channel->chan; +diff --git a/package/network/services/hostapd/patches/801-P2P-Fix-copying-of-secondary-device-types-for-P2P-gr.patch b/package/network/services/hostapd/patches/801-P2P-Fix-copying-of-secondary-device-types-for-P2P-gr.patch +deleted file mode 100644 +index 944f7d71c9..0000000000 +--- a/package/network/services/hostapd/patches/801-P2P-Fix-copying-of-secondary-device-types-for-P2P-gr.patch ++++ /dev/null +@@ -1,33 +0,0 @@ +-From 947272febe24a8f0ea828b5b2f35f13c3821901e Mon Sep 17 00:00:00 2001 +-From: Jouni Malinen +-Date: Mon, 9 Nov 2020 11:43:12 +0200 +-Subject: [PATCH] P2P: Fix copying of secondary device types for P2P group +- client +- +-Parsing and copying of WPS secondary device types list was verifying +-that the contents is not too long for the internal maximum in the case +-of WPS messages, but similar validation was missing from the case of P2P +-group information which encodes this information in a different +-attribute. This could result in writing beyond the memory area assigned +-for these entries and corrupting memory within an instance of struct +-p2p_device. This could result in invalid operations and unexpected +-behavior when trying to free pointers from that corrupted memory. +- +-Credit to OSS-Fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=27269 +-Fixes: e57ae6e19edf ("P2P: Keep track of secondary device types for peers") +-Signed-off-by: Jouni Malinen +---- +- src/p2p/p2p.c | 2 ++ +- 1 file changed, 2 insertions(+) +- +---- a/src/p2p/p2p.c +-+++ b/src/p2p/p2p.c +-@@ -453,6 +453,8 @@ static void p2p_copy_client_info(struct +- dev->info.config_methods = cli->config_methods; +- os_memcpy(dev->info.pri_dev_type, cli->pri_dev_type, 8); +- dev->info.wps_sec_dev_type_list_len = 8 * cli->num_sec_dev_types; +-+ if (dev->info.wps_sec_dev_type_list_len > WPS_SEC_DEV_TYPE_MAX_LEN) +-+ dev->info.wps_sec_dev_type_list_len = WPS_SEC_DEV_TYPE_MAX_LEN; +- os_memcpy(dev->info.wps_sec_dev_type_list, cli->sec_dev_types, +- dev->info.wps_sec_dev_type_list_len); +- } +diff --git a/package/network/services/hostapd/src/src/ap/ubus.c b/package/network/services/hostapd/src/src/ap/ubus.c +index d03b848f94..7cc2059fc1 100644 +--- a/package/network/services/hostapd/src/src/ap/ubus.c ++++ b/package/network/services/hostapd/src/src/ap/ubus.c +@@ -728,6 +728,8 @@ hostapd_switch_chan(struct ubus_context *ctx, struct ubus_object *obj, + struct blob_attr *tb[__CSA_MAX]; + struct hostapd_data *hapd = get_hapd_from_object(obj); + struct csa_settings css; ++ int ret = UBUS_STATUS_OK; ++ int i; + + blobmsg_parse(csa_policy, __CSA_MAX, tb, blob_data(msg), blob_len(msg)); + +@@ -752,10 +754,14 @@ hostapd_switch_chan(struct ubus_context *ctx, struct ubus_object *obj, + SET_CSA_SETTING(CSA_VHT, freq_params.vht_enabled, bool); + SET_CSA_SETTING(CSA_BLOCK_TX, block_tx, bool); + ++ for (i = 0; i < hapd->iface->num_bss; i++) { ++ struct hostapd_data *bss = hapd->iface->bss[i]; + +- if (hostapd_switch_channel(hapd, &css) != 0) +- return UBUS_STATUS_NOT_SUPPORTED; +- return UBUS_STATUS_OK; ++ if (hostapd_switch_channel(bss, &css) != 0) ++ ret = UBUS_STATUS_NOT_SUPPORTED; ++ } ++ ++ return ret; + #undef SET_CSA_SETTING + } + #endif +@@ -1364,6 +1370,43 @@ void hostapd_ubus_free_bss(struct hostapd_data *hapd) + free(name); + } + ++static void ++hostapd_ubus_vlan_action(struct hostapd_data *hapd, struct hostapd_vlan *vlan, ++ const char *action) ++{ ++ struct vlan_description *desc = &vlan->vlan_desc; ++ void *c; ++ int i; ++ ++ if (!hapd->ubus.obj.has_subscribers) ++ return; ++ ++ blob_buf_init(&b, 0); ++ blobmsg_add_string(&b, "ifname", vlan->ifname); ++ blobmsg_add_string(&b, "bridge", vlan->bridge); ++ blobmsg_add_u32(&b, "vlan_id", vlan->vlan_id); ++ ++ if (desc->notempty) { ++ blobmsg_add_u32(&b, "untagged", desc->untagged); ++ c = blobmsg_open_array(&b, "tagged"); ++ for (i = 0; i < ARRAY_SIZE(desc->tagged) && desc->tagged[i]; i++) ++ blobmsg_add_u32(&b, "", desc->tagged[i]); ++ blobmsg_close_array(&b, c); ++ } ++ ++ ubus_notify(ctx, &hapd->ubus.obj, action, b.head, -1); ++} ++ ++void hostapd_ubus_add_vlan(struct hostapd_data *hapd, struct hostapd_vlan *vlan) ++{ ++ hostapd_ubus_vlan_action(hapd, vlan, "vlan_add"); ++} ++ ++void hostapd_ubus_remove_vlan(struct hostapd_data *hapd, struct hostapd_vlan *vlan) ++{ ++ hostapd_ubus_vlan_action(hapd, vlan, "vlan_remove"); ++} ++ + static const struct ubus_method daemon_methods[] = { + UBUS_METHOD("config_add", hostapd_config_add, config_add_policy), + UBUS_METHOD("config_remove", hostapd_config_remove, config_remove_policy), +@@ -1550,3 +1593,24 @@ void hostapd_ubus_notify_beacon_report( + + ubus_notify(ctx, &hapd->ubus.obj, "beacon-report", b.head, -1); + } ++ ++void hostapd_ubus_notify_radar_detected(struct hostapd_iface *iface, int frequency, ++ int chan_width, int cf1, int cf2) ++{ ++ struct hostapd_data *hapd; ++ int i; ++ ++ if (!hapd->ubus.obj.has_subscribers) ++ return; ++ ++ blob_buf_init(&b, 0); ++ blobmsg_add_u16(&b, "frequency", frequency); ++ blobmsg_add_u16(&b, "width", chan_width); ++ blobmsg_add_u16(&b, "center1", cf1); ++ blobmsg_add_u16(&b, "center2", cf2); ++ ++ for (i = 0; i < iface->num_bss; i++) { ++ hapd = iface->bss[i]; ++ ubus_notify(ctx, &hapd->ubus.obj, "radar-detected", b.head, -1); ++ } ++} +diff --git a/package/network/services/hostapd/src/src/ap/ubus.h b/package/network/services/hostapd/src/src/ap/ubus.h +index e16017394f..acdac74360 100644 +--- a/package/network/services/hostapd/src/src/ap/ubus.h ++++ b/package/network/services/hostapd/src/src/ap/ubus.h +@@ -43,6 +43,8 @@ void hostapd_ubus_add_iface(struct hostapd_iface *iface); + void hostapd_ubus_free_iface(struct hostapd_iface *iface); + void hostapd_ubus_add_bss(struct hostapd_data *hapd); + void hostapd_ubus_free_bss(struct hostapd_data *hapd); ++void hostapd_ubus_add_vlan(struct hostapd_data *hapd, struct hostapd_vlan *vlan); ++void hostapd_ubus_remove_vlan(struct hostapd_data *hapd, struct hostapd_vlan *vlan); + + int hostapd_ubus_handle_event(struct hostapd_data *hapd, struct hostapd_ubus_request *req); + void hostapd_ubus_notify(struct hostapd_data *hapd, const char *type, const u8 *mac); +@@ -50,6 +52,8 @@ void hostapd_ubus_notify_beacon_report(struct hostapd_data *hapd, + const u8 *addr, u8 token, u8 rep_mode, + struct rrm_measurement_beacon_report *rep, + size_t len); ++void hostapd_ubus_notify_radar_detected(struct hostapd_iface *iface, int frequency, ++ int chan_width, int cf1, int cf2); + + void hostapd_ubus_add(struct hapd_interfaces *interfaces); + void hostapd_ubus_free(struct hapd_interfaces *interfaces); +@@ -74,6 +78,14 @@ static inline void hostapd_ubus_free_bss(struct hostapd_data *hapd) + { + } + ++static inline void hostapd_ubus_add_vlan(struct hostapd_data *hapd, struct hostapd_vlan *vlan) ++{ ++} ++ ++static inline void hostapd_ubus_remove_vlan(struct hostapd_data *hapd, struct hostapd_vlan *vlan) ++{ ++} ++ + static inline int hostapd_ubus_handle_event(struct hostapd_data *hapd, struct hostapd_ubus_request *req) + { + return 0; +@@ -90,6 +102,10 @@ static inline void hostapd_ubus_notify_beacon_report(struct hostapd_data *hapd, + size_t len) + { + } ++static inline void hostapd_ubus_notify_radar_detected(struct hostapd_iface *iface, int frequency, ++ int chan_width, int cf1, int cf2) ++{ ++} + + static inline void hostapd_ubus_add(struct hapd_interfaces *interfaces) + { +-- +2.25.1 + diff --git a/backports/0040-mt76-update-to-latest-HEAD.patch b/backports/0040-mt76-update-to-latest-HEAD.patch new file mode 100644 index 000000000..395ca4065 --- /dev/null +++ b/backports/0040-mt76-update-to-latest-HEAD.patch @@ -0,0 +1,30 @@ +From d0634b3177d6aeaaf71d1fe4f143846a6d47fea5 Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Thu, 27 May 2021 13:25:41 +0200 +Subject: [PATCH 40/40] mt76: update to latest HEAD + +Signed-off-by: John Crispin +--- + package/kernel/mt76/Makefile | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile +index e9e95fa9b3..5104c3ec53 100644 +--- a/package/kernel/mt76/Makefile ++++ b/package/kernel/mt76/Makefile +@@ -8,9 +8,9 @@ PKG_LICENSE_FILES:= + + PKG_SOURCE_URL:=https://github.com/openwrt/mt76 + PKG_SOURCE_PROTO:=git +-PKG_SOURCE_DATE:=2021-04-11 +-PKG_SOURCE_VERSION:=bf45b30d891961dd7c4139dddb58b909ea2c2b5a +-PKG_MIRROR_HASH:=431cecf80dafa986e805f809522721c2bb26289867d6770695d49baf8b471bea ++PKG_SOURCE_DATE:=2021-05-15 ++PKG_SOURCE_VERSION:=9d736545bb5ac9707e60b7900b7d6b290492e24d ++PKG_MIRROR_HASH:=8fd98f488579c18cfd8c442cff1796dcd70e2ecbc59c5d5b92ee8c0f06efafcf + + PKG_MAINTAINER:=Felix Fietkau + PKG_BUILD_PARALLEL:=1 +-- +2.25.1 + diff --git a/feeds/tip/certificates/files/etc/init.d/certificates b/feeds/tip/certificates/files/etc/init.d/certificates index 3d2f96a9a..df9e751d3 100755 --- a/feeds/tip/certificates/files/etc/init.d/certificates +++ b/feeds/tip/certificates/files/etc/init.d/certificates @@ -7,10 +7,15 @@ boot() { . /lib/functions.sh mkdir -p /certificates /etc/ucentral/ local mtd=$(find_mtd_index certificates) - [ -n "$mtd" -a -f /sys/class/mtd/mtd15/oobsize ] && ubiattach -p /dev/mtd$mtd - [ -n "$(ubinfo -a | grep certificates)" ] && { + [ -n "$mtd" -a -f /sys/class/mtd/mtd$mtd/oobsize ] && ubiattach -p /dev/mtd$mtd + if [ -n "$(ubinfo -a | grep certificates)" ]; then mount -t ubifs ubi0:certificates /certificates mount -t ubifs ubi1:certificates /certificates + else + mount -t squashfs /dev/mtdblock$mtd /certificates + fi + [ -f /certificates/dev-id ] && { + cp /certificates/*.pem /etc/ucentral/ + cp /certificates/dev-id /etc/ucentral/ } - [ -f /certificates/dev-id ] && cp /certificates/* /etc/ucentral/ } diff --git a/feeds/tip/maverick/files/usr/libexec/ucentral/maverick.sh b/feeds/tip/maverick/files/usr/libexec/ucentral/maverick.sh index 130f0f352..ed209a927 100755 --- a/feeds/tip/maverick/files/usr/libexec/ucentral/maverick.sh +++ b/feeds/tip/maverick/files/usr/libexec/ucentral/maverick.sh @@ -1,7 +1,7 @@ #!/bin/sh rm /etc/config/network /etc/config/wireless -cp /rom/etc/config/uhttpd /rom/etc/config/firewall /rom/etc/config/dhcp /etc/config +cp /rom/etc/config/uhttpd /rom/etc/config/firewall /rom/etc/config/dhcp /rom/etc/config/dropbear /etc/config config_generate wifi config diff --git a/feeds/ucentral/ucentral-client/files/etc/uci-defaults/zzz-ucentral b/feeds/ucentral/ucentral-client/files/etc/uci-defaults/zzz-ucentral index d6c35ec0f..7e54cdc4b 100755 --- a/feeds/ucentral/ucentral-client/files/etc/uci-defaults/zzz-ucentral +++ b/feeds/ucentral/ucentral-client/files/etc/uci-defaults/zzz-ucentral @@ -6,5 +6,5 @@ uci commit cp -r /etc/config/ /etc/config-shadow/ rm /etc/config/network -cp /rom/etc/config/dhcp /etc/config/ +cp /rom/etc/config/uhttpd /rom/etc/config/firewall /rom/etc/config/dhcp /rom/etc/config/dropbear /etc/config config_generate diff --git a/feeds/ucentral/ucentral-schema/files/etc/ucentral/examples/default.json b/feeds/ucentral/ucentral-schema/files/etc/ucentral/examples/default.json index cc7ed65b9..703f92543 100644 --- a/feeds/ucentral/ucentral-schema/files/etc/ucentral/examples/default.json +++ b/feeds/ucentral/ucentral-schema/files/etc/ucentral/examples/default.json @@ -14,6 +14,7 @@ { "name": "WAN", "role": "upstream", + "services": [ "lldp" ], "ethernet": [ { "select-ports": [ @@ -42,7 +43,7 @@ { "name": "LAN", "role": "downstream", - "services": [ "ssh" ], + "services": [ "ssh", "lldp" ], "ethernet": [ { "select-ports": [ @@ -86,6 +87,10 @@ } }, "services": { + "lldp": { + "describe": "uCentral", + "location": "universe" + }, "ssh": { "port": 22 } diff --git a/feeds/ucentral/ucentral-wifi/Makefile b/feeds/ucentral/ucentral-wifi/Makefile index 506429855..3c5d82187 100644 --- a/feeds/ucentral/ucentral-wifi/Makefile +++ b/feeds/ucentral/ucentral-wifi/Makefile @@ -6,7 +6,8 @@ PKG_RELEASE:=1 PKG_SOURCE_URL=https://github.com/blogic/ucentral-wifi.git PKG_SOURCE_PROTO:=git PKG_SOURCE_DATE:=2021-04-13 -PKG_SOURCE_VERSION:=6b9129154507559edcb298680a84c9c0c6fa1449 +PKG_SOURCE_VERSION:=06733b8471fe81cea7f232d838209ce2ead26e94 +PKG_MIRROR_HASH:=a8000b3cf43ce9ebfa7305661475fec98ec1dba2dc7b062028c2e17d7c2ec50b PKG_MAINTAINER:=John Crispin PKG_LICENSE:=BSD-3-Clause diff --git a/feeds/wifi-ax/ath11k-firmware/Makefile b/feeds/wifi-ax/ath11k-firmware/Makefile index bb77ad917..44d5809d0 100644 --- a/feeds/wifi-ax/ath11k-firmware/Makefile +++ b/feeds/wifi-ax/ath11k-firmware/Makefile @@ -61,9 +61,9 @@ define Package/ath11k-firmware-ipq807x/install endef define Package/ath11k-firmware-qcn9000/install - $(INSTALL_DIR) $(1)/lib/firmware/qcn9000 + $(INSTALL_DIR) $(1)/lib/firmware/ath11k/qcn9000/hw1.0/ $(INSTALL_DATA) ./files/QCN9000/* \ - $(1)/lib/firmware/qcn9000 + $(1)/lib/firmware/ath11k/qcn9000/hw1.0/ endef $(eval $(call BuildPackage,ath11k-firmware-ipq60xx)) diff --git a/feeds/wifi-ax/hostapd/Makefile b/feeds/wifi-ax/hostapd/Makefile index e0a8205d9..d36c149c9 100644 --- a/feeds/wifi-ax/hostapd/Makefile +++ b/feeds/wifi-ax/hostapd/Makefile @@ -13,7 +13,7 @@ PKG_SOURCE_URL:=http://w1.fi/hostap.git PKG_SOURCE_PROTO:=git PKG_SOURCE_DATE:=2020-07-02 PKG_SOURCE_VERSION:=58b384f467 -#PKG_MIRROR_HASH:=1b2a4947034142587a3f81eac2ea27dd64650e77f8943d973623b47533be2393 +PKG_MIRROR_HASH:=75547b2cca6edf1010180af2b6b0ab0592ffc2c13c861c163ff851490108f81b PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=BSD-3-Clause diff --git a/feeds/wifi-ax/hostapd/files/hostapd.sh b/feeds/wifi-ax/hostapd/files/hostapd.sh index c88e839cc..9993bc904 100644 --- a/feeds/wifi-ax/hostapd/files/hostapd.sh +++ b/feeds/wifi-ax/hostapd/files/hostapd.sh @@ -45,7 +45,6 @@ hostapd_append_wpa_key_mgmt() { append wpa_key_mgmt "WPA-$auth_type_l" [ "${ieee80211r:-0}" -gt 0 ] && append wpa_key_mgmt "FT-${auth_type_l}" [ "${ieee80211w:-0}" -gt 0 ] && append wpa_key_mgmt "WPA-${auth_type_l}-SHA256" - [ "${ieee80211ai:-0}" -gt 0 ] && append wpa_key_mgmt "FILS-SHA256" ;; eap192) append wpa_key_mgmt "WPA-EAP-SUITE-B-192" @@ -92,20 +91,24 @@ hostapd_add_log_config() { hostapd_common_add_device_config() { config_add_array basic_rate config_add_array supported_rates + config_add_string beacon_rate config_add_string country config_add_boolean country_ie doth config_add_boolean spectrum_mgmt_required config_add_int local_pwr_constraint - config_add_int maxassoc config_add_string require_mode config_add_boolean legacy_rates + config_add_int cell_density + config_add_int rts_threshold + config_add_int rssi_reject_assoc_rssi + config_add_int rssi_ignore_probe_request + config_add_int maxassoc config_add_string acs_chan_bias config_add_array hostapd_options config_add_int airtime_mode - config_add_boolean multiple_bssid rnr_beacon he_co_locate ema hostapd_add_log_config } @@ -114,27 +117,20 @@ hostapd_prepare_device_config() { local config="$1" local driver="$2" - local base="${config%%.conf}" local base_cfg= json_get_vars country country_ie beacon_int:100 dtim_period:2 doth require_mode legacy_rates \ - acs_chan_bias local_pwr_constraint spectrum_mgmt_required airtime_mode maxassoc \ - multiple_bssid he_co_locate rnr_beacon ema + acs_chan_bias local_pwr_constraint spectrum_mgmt_required airtime_mode cell_density \ + rts_threshold beacon_rate rssi_reject_assoc_rssi rssi_ignore_probe_request maxassoc hostapd_set_log_options base_cfg set_default country_ie 1 set_default spectrum_mgmt_required 0 set_default doth 1 - set_default legacy_rates 1 + set_default legacy_rates 0 set_default airtime_mode 0 - set_default multiple_bssid 0 - set_default rnr_beacon 0 - set_default he_co_locate 0 - set_default ema 0 - set_default maxassoc 0 - - [ "$hwmode" = "b" ] && legacy_rates=1 + set_default cell_density 0 [ -n "$country" ] && { append base_cfg "country_code=$country" "$N" @@ -147,7 +143,6 @@ hostapd_prepare_device_config() { [ "$hwmode" = "a" -a "$doth" -gt 0 ] && append base_cfg "ieee80211h=1" "$N" } - [ "$maxassoc" -gt 0 ] && append base_cfg "global_max_num_sta=$maxassoc" "$N" [ -n "$acs_chan_bias" ] && append base_cfg "acs_chan_bias=$acs_chan_bias" "$N" local brlist= br @@ -156,16 +151,57 @@ hostapd_prepare_device_config() { json_get_values rate_list supported_rates [ -n "$hwmode" ] && append base_cfg "hw_mode=$hwmode" "$N" - [ "$legacy_rates" -eq 0 ] && set_default require_mode g - - [ "$hwmode" = "g" ] && { - [ "$legacy_rates" -eq 0 ] && set_default rate_list "6000 9000 12000 18000 24000 36000 48000 54000" - [ -n "$require_mode" ] && set_default basic_rate_list "6000 12000 24000" - } - - case "$require_mode" in - n) append base_cfg "require_ht=1" "$N";; - ac) append base_cfg "require_vht=1" "$N";; + if [ "$hwmode" = "g" ] || [ "$hwmode" = "a" ]; then + [ -n "$require_mode" ] && legacy_rates=0 + case "$require_mode" in + n) append base_cfg "require_ht=1" "$N";; + ac) append base_cfg "require_vht=1" "$N";; + esac + fi + case "$hwmode" in + b) + if [ "$cell_density" -eq 1 ]; then + set_default rate_list "5500 11000" + set_default basic_rate_list "5500 11000" + elif [ "$cell_density" -ge 2 ]; then + set_default rate_list "11000" + set_default basic_rate_list "11000" + fi + ;; + g) + if [ "$cell_density" -eq 0 ] || [ "$cell_density" -eq 1 ]; then + if [ "$legacy_rates" -eq 0 ]; then + set_default rate_list "6000 9000 12000 18000 24000 36000 48000 54000" + set_default basic_rate_list "6000 12000 24000" + elif [ "$cell_density" -eq 1 ]; then + set_default rate_list "5500 6000 9000 11000 12000 18000 24000 36000 48000 54000" + set_default basic_rate_list "5500 11000" + fi + elif [ "$cell_density" -ge 3 ] && [ "$legacy_rates" -ne 0 ] || [ "$cell_density" -eq 2 ]; then + if [ "$legacy_rates" -eq 0 ]; then + set_default rate_list "12000 18000 24000 36000 48000 54000" + set_default basic_rate_list "12000 24000" + else + set_default rate_list "11000 12000 18000 24000 36000 48000 54000" + set_default basic_rate_list "11000" + fi + elif [ "$cell_density" -ge 3 ]; then + set_default rate_list "24000 36000 48000 54000" + set_default basic_rate_list "24000" + fi + ;; + a) + if [ "$cell_density" -eq 1 ]; then + set_default rate_list "6000 9000 12000 18000 24000 36000 48000 54000" + set_default basic_rate_list "6000 12000 24000" + elif [ "$cell_density" -eq 2 ]; then + set_default rate_list "12000 18000 24000 36000 48000 54000" + set_default basic_rate_list "12000 24000" + elif [ "$cell_density" -ge 3 ]; then + set_default rate_list "24000 36000 48000 54000" + set_default basic_rate_list "24000" + fi + ;; esac for r in $rate_list; do @@ -176,15 +212,16 @@ hostapd_prepare_device_config() { hostapd_add_rate brlist "$br" done + [ -n "$rssi_reject_assoc_rssi" ] && append base_cfg "rssi_reject_assoc_rssi=$rssi_reject_assoc_rssi" "$N" + [ -n "$rssi_ignore_probe_request" ] && append base_cfg "rssi_ignore_probe_request=$rssi_ignore_probe_request" "$N" + [ -n "$beacon_rate" ] && append base_cfg "beacon_rate=$beacon_rate" "$N" [ -n "$rlist" ] && append base_cfg "supported_rates=$rlist" "$N" [ -n "$brlist" ] && append base_cfg "basic_rates=$brlist" "$N" append base_cfg "beacon_int=$beacon_int" "$N" + [ -n "$rts_threshold" ] && append base_cfg "rts_threshold=$rts_threshold" "$N" append base_cfg "dtim_period=$dtim_period" "$N" [ "$airtime_mode" -gt 0 ] && append base_cfg "airtime_mode=$airtime_mode" "$N" - [ "$multiple_bssid" -gt 0 ] && append base_cfg "multiple_bssid=$multiple_bssid" "$N" - [ "$rnr_beacon" -gt 0 ] && append base_cfg "rnr_beacon=$rnr_beacon" "$N" - [ "$ema" -gt 0 ] && append base_cfg "ema=$ema" "$N" - [ "$he_co_locate" -gt 0 ] && append base_cfg "he_co_locate=$he_co_locate" "$N" + [ -n "$maxassoc" ] && append base_cfg "iface_max_num_sta=$maxassoc" "$N" json_get_values opts hostapd_options for val in $opts; do @@ -202,7 +239,7 @@ hostapd_common_add_bss_config() { config_add_boolean wds wmm uapsd hidden utf8_ssid config_add_int maxassoc max_inactivity - config_add_boolean disassoc_low_ack isolate short_preamble + config_add_boolean disassoc_low_ack isolate short_preamble skip_inactivity_poll config_add_int \ wep_rekey eap_reauth_period \ @@ -214,7 +251,6 @@ hostapd_common_add_bss_config() { config_add_boolean rsn_preauth auth_cache config_add_int ieee80211w - config_add_int ieee80211ai config_add_int eapol_version config_add_string 'auth_server:host' 'server:host' @@ -241,7 +277,7 @@ hostapd_common_add_bss_config() { config_add_array domain_match domain_match2 domain_suffix_match domain_suffix_match2 config_add_string ieee80211w_mgmt_cipher - config_add_int dynamic_vlan vlan_naming + config_add_int dynamic_vlan vlan_naming vlan_no_bridge config_add_string vlan_tagged_interface vlan_bridge config_add_string vlan_file @@ -291,11 +327,7 @@ hostapd_common_add_bss_config() { config_add_int iw_ipaddr_type_availability iw_gas_address3 config_add_string iw_hessid iw_network_auth_type iw_qos_map_set config_add_array iw_roaming_consortium iw_domain_name iw_anqp_3gpp_cell_net iw_nai_realm - config_add_array iw_anqp_elem - - config_add_int beacon_rate - config_add_int rssi_reject_assoc_rssi - config_add_int rssi_ignore_probe_request + config_add_array iw_anqp_elem iw_venue_name iw_venue_url config_add_boolean hs20 disable_dgaf osen config_add_int anqp_domain_id @@ -304,21 +336,20 @@ hostapd_common_add_bss_config() { config_add_array osu_provider config_add_array operator_icon config_add_array hs20_conn_capab - config_add_array roaming_consortium - config_add_array venue_name - config_add_array venue_url - config_add_array nai_realm config_add_string osu_ssid hs20_wan_metrics hs20_operating_class hs20_t_c_filename hs20_t_c_timestamp - config_add_boolean interworking internet - config_add_int access_network_type asra esr uesa venue_group venue_type ipaddr_type_availability \ - gas_address3 - config_add_string hessid network_auth_type \ - anqp_3gpp_cell_net anqp_elem domain_name qos_map_set hs20_t_c_server_url + config_add_string hs20_t_c_server_url config_add_array airtime_sta_weight config_add_int airtime_bss_weight airtime_bss_limit - config_add_int rts_threshold + + config_add_boolean multicast_to_unicast proxy_arp per_sta_vif + + config_add_array hostapd_bss_options + + config_add_boolean request_cui + config_add_array radius_auth_req_attr + config_add_array radius_acct_req_attr } hostapd_set_vlan_file() { @@ -382,28 +413,24 @@ append_iw_nai_realm() { [ -n "$1" ] && append bss_conf "nai_realm=$1" "$N" } -append_roaming_consortium() { - [ -n "$1" ] && append bss_conf "roaming_consortium=$1" "$N" +append_iw_venue_name() { + append bss_conf "venue_name=$1" "$N" } -append_venue_name() { - [ -n "$1" ] && append bss_conf "venue_name=$1" "$N" -} - -append_venue_url() { - [ -n "$1" ] && append bss_conf "venue_url=$1" "$N" -} - -append_nai_realm() { - [ -n "$1" ] && append bss_conf "nai_realm=$1" "$N" +append_iw_venue_url() { + append bss_conf "venue_url=$1" "$N" } append_hs20_oper_friendly_name() { - [ -n "$1" ] && append bss_conf "hs20_oper_friendly_name=$1" "$N" + append bss_conf "hs20_oper_friendly_name=$1" "$N" +} + +append_osu_provider_friendly_name() { + append bss_conf "osu_friendly_name=$1" "$N" } append_osu_provider_service_desc() { - [ -n "$1" ] && append bss_conf "osu_service_desc=$1" "$N" + append bss_conf "osu_service_desc=$1" "$N" } append_hs20_icon() { @@ -423,15 +450,15 @@ append_hs20_icons() { } append_operator_icon() { - [ -n "$1" ] && append bss_conf "operator_icon=$1" "$N" + append bss_conf "operator_icon=$1" "$N" } append_osu_icon() { - [ -n "$1" ] && append bss_conf "osu_icon=$1" "$N" + append bss_conf "osu_icon=$1" "$N" } append_osu_provider() { - local cfgtype osu_server_uri osu_nai osu_nai2 osu_method_list + local cfgtype osu_server_uri osu_friendly_name osu_nai osu_nai2 osu_method_list config_load wireless config_get cfgtype "$1" TYPE @@ -443,10 +470,10 @@ append_osu_provider() { config_get osu_nai2 "$1" osu_nai2 config_get osu_method_list "$1" osu_method - [ -n "$osu_server_uri" ] && append bss_conf "osu_server_uri=$osu_server_uri" "$N" - [ -n "$osu_nai" ] && append bss_conf "osu_nai=$osu_nai" "$N" - [ -n "$osu_nai2" ] && append bss_conf "osu_nai2=$osu_nai2" "$N" - [ -n "$osu_method_list" ] && append bss_conf "osu_method_list=$osu_method_list" "$N" + append bss_conf "osu_server_uri=$osu_server_uri" "$N" + append bss_conf "osu_nai=$osu_nai" "$N" + append bss_conf "osu_nai2=$osu_nai2" "$N" + append bss_conf "osu_method_list=$osu_method_list" "$N" config_list_foreach "$1" osu_service_desc append_osu_provider_service_desc config_list_foreach "$1" osu_friendly_name append_osu_friendly_name @@ -459,6 +486,14 @@ append_hs20_conn_capab() { [ -n "$1" ] && append bss_conf "hs20_conn_capab=$1" "$N" } +append_radius_acct_req_attr() { + append bss_conf "radius_acct_req_attr=$1" "$N" +} + +append_radius_auth_req_attr() { + append bss_conf "radius_auth_req_attr=$1" "$N" +} + append_airtime_sta_weight() { [ -n "$1" ] && append bss_conf "airtime_sta_weight=$1" "$N" } @@ -480,24 +515,25 @@ hostapd_set_bss_options() { wps_pushbutton wps_label ext_registrar wps_pbc_in_m1 wps_ap_setup_locked \ wps_independent wps_device_type wps_device_name wps_manufacturer wps_pin \ macfilter ssid utf8_ssid wmm uapsd hidden short_preamble rsn_preauth \ - iapp_interface eapol_version dynamic_vlan ieee80211w ieee80211ai nasid \ + iapp_interface eapol_version dynamic_vlan ieee80211w nasid \ acct_server acct_secret acct_port acct_interval \ bss_load_update_period chan_util_avg_period sae_require_mfp \ - multi_ap multi_ap_backhaul_ssid multi_ap_backhaul_key \ + multi_ap multi_ap_backhaul_ssid multi_ap_backhaul_key skip_inactivity_poll \ airtime_bss_weight airtime_bss_limit airtime_sta_weight \ - rssi_reject_assoc_rssi rssi_ignore_probe_request rts_threshold + multicast_to_unicast proxy_arp per_sta_vif set_default isolate 0 set_default maxassoc 0 set_default max_inactivity 0 set_default short_preamble 1 set_default disassoc_low_ack 1 + set_default skip_inactivity_poll 0 set_default hidden 0 set_default wmm 1 set_default uapsd 1 set_default wpa_disable_eapol_key_retries 0 set_default tdls_prohibit 0 - set_default eapol_version 0 + set_default eapol_version $((wpa & 1)) set_default acct_port 1813 set_default bss_load_update_period 60 set_default chan_util_avg_period 600 @@ -505,9 +541,6 @@ hostapd_set_bss_options() { set_default multi_ap 0 set_default airtime_bss_weight 0 set_default airtime_bss_limit 0 - set_default rssi_reject_assoc_rssi 0 - set_default rssi_ignore_probe_request 0 - set_default rts_threshold -1 append bss_conf "ctrl_interface=/var/run/hostapd" if [ "$isolate" -gt 0 ]; then @@ -527,15 +560,13 @@ hostapd_set_bss_options() { append bss_conf "bss_load_update_period=$bss_load_update_period" "$N" append bss_conf "chan_util_avg_period=$chan_util_avg_period" "$N" append bss_conf "disassoc_low_ack=$disassoc_low_ack" "$N" + append bss_conf "skip_inactivity_poll=$skip_inactivity_poll" "$N" append bss_conf "preamble=$short_preamble" "$N" append bss_conf "wmm_enabled=$wmm" "$N" append bss_conf "ignore_broadcast_ssid=$hidden" "$N" append bss_conf "uapsd_advertisement_enabled=$uapsd" "$N" append bss_conf "utf8_ssid=$utf8_ssid" "$N" append bss_conf "multi_ap=$multi_ap" "$N" - append bss_conf "rssi_reject_assoc_rssi=$rssi_reject_assoc_rssi" "$N" - append bss_conf "rssi_ignore_probe_request=$rssi_ignore_probe_request" "$N" - append bss_conf "rts_threshold=$rts_threshold" "$N" [ "$tdls_prohibit" -gt 0 ] && append bss_conf "tdls_prohibit=$tdls_prohibit" "$N" @@ -554,6 +585,7 @@ hostapd_set_bss_options() { append bss_conf "acct_server_shared_secret=$acct_secret" "$N" [ -n "$acct_interval" ] && \ append bss_conf "radius_acct_interim_interval=$acct_interval" "$N" + json_for_each_item append_radius_acct_req_attr radius_acct_req_attr } case "$auth_type" in @@ -608,7 +640,7 @@ hostapd_set_bss_options() { auth_server auth_secret auth_port \ dae_client dae_secret dae_port \ ownip radius_client_addr \ - eap_reauth_period + eap_reauth_period request_cui # radius can provide VLAN ID for clients vlan_possible=1 @@ -620,18 +652,20 @@ hostapd_set_bss_options() { set_default auth_port 1812 set_default dae_port 3799 - + set_default request_cui 0 append bss_conf "auth_server_addr=$auth_server" "$N" append bss_conf "auth_server_port=$auth_port" "$N" append bss_conf "auth_server_shared_secret=$auth_secret" "$N" + [ "$request_cui" -gt 0 ] && append bss_conf "radius_request_cui=$request_cui" "$N" [ -n "$eap_reauth_period" ] && append bss_conf "eap_reauth_period=$eap_reauth_period" "$N" [ -n "$dae_client" -a -n "$dae_secret" ] && { append bss_conf "radius_das_port=$dae_port" "$N" append bss_conf "radius_das_client=$dae_client $dae_secret" "$N" } + json_for_each_item append_radius_auth_req_attr radius_auth_req_attr [ -n "$ownip" ] && append bss_conf "own_ip_addr=$ownip" "$N" [ -n "$radius_client_addr" ] && append bss_conf "radius_client_addr=$radius_client_addr" "$N" @@ -673,7 +707,7 @@ hostapd_set_bss_options() { set_default wps_independent 1 wps_state=2 - [ -n "$wps_configured" ] && wps_state=1 + [ -n "$wps_not_configured" ] && wps_state=1 [ "$ext_registrar" -gt 0 -a -n "$network_bridge" ] && append bss_conf "upnp_iface=$network_bridge" "$N" @@ -711,6 +745,8 @@ hostapd_set_bss_options() { } json_get_vars time_advertisement time_zone wnm_sleep_mode bss_transition + set_default bss_transition 0 + set_default wnm_sleep_mode 0 [ -n "$time_advertisement" ] && append bss_conf "time_advertisement=$time_advertisement" "$N" [ -n "$time_zone" ] && append bss_conf "time_zone=$time_zone" "$N" @@ -722,18 +758,23 @@ hostapd_set_bss_options() { if [ "$ieee80211k" -eq "1" ]; then set_default rrm_neighbor_report 1 set_default rrm_beacon_report 1 + else + set_default rrm_neighbor_report 0 + set_default rrm_beacon_report 0 fi [ "$rrm_neighbor_report" -eq "1" ] && append bss_conf "rrm_neighbor_report=1" "$N" [ "$rrm_beacon_report" -eq "1" ] && append bss_conf "rrm_beacon_report=1" "$N" json_get_vars ftm_responder stationary_ap lci civic + set_default ftm_responder 0 if [ "$ftm_responder" -eq "1" ]; then + set_default stationary_ap 0 iw phy "$phy" info | grep -q "ENABLE_FTM_RESPONDER" && { append bss_conf "ftm_responder=1" "$N" [ "$stationary_ap" -eq "1" ] && append bss_conf "stationary_ap=1" "$N" [ -n "$lci" ] && append bss_conf "lci=$lci" "$N" - [ -n "$civic" ] && append bss_conf "lci=$civic" "$N" + [ -n "$civic" ] && append bss_conf "civic=$civic" "$N" } fi @@ -743,7 +784,7 @@ hostapd_set_bss_options() { if [ "$ieee80211r" -gt "0" ]; then json_get_vars mobility_domain ft_psk_generate_local ft_over_ds reassociation_deadline - + set_default mobility_domain "$(echo "$ssid" | md5sum | head -c 4)" set_default ft_over_ds 1 set_default reassociation_deadline 1000 @@ -856,13 +897,17 @@ hostapd_set_bss_options() { } [ -n "$vlan_possible" -a -n "$dynamic_vlan" ] && { - json_get_vars vlan_naming vlan_tagged_interface vlan_bridge vlan_file + json_get_vars vlan_naming vlan_tagged_interface vlan_bridge vlan_file vlan_no_bridge set_default vlan_naming 1 [ -z "$vlan_file" ] && set_default vlan_file /var/run/hostapd-$ifname.vlan append bss_conf "dynamic_vlan=$dynamic_vlan" "$N" append bss_conf "vlan_naming=$vlan_naming" "$N" - [ -n "$vlan_bridge" ] && \ + if [ -n "$vlan_bridge" ]; then append bss_conf "vlan_bridge=$vlan_bridge" "$N" + else + set_default vlan_no_bridge 1 + fi + append bss_conf "vlan_no_bridge=$vlan_no_bridge" "$N" [ -n "$vlan_tagged_interface" ] && \ append bss_conf "vlan_tagged_interface=$vlan_tagged_interface" "$N" [ -n "$vlan_file" ] && { @@ -875,6 +920,7 @@ hostapd_set_bss_options() { json_get_vars iw_hessid iw_venue_group iw_venue_type iw_network_auth_type json_get_vars iw_roaming_consortium iw_domain_name iw_anqp_3gpp_cell_net iw_nai_realm json_get_vars iw_anqp_elem iw_qos_map_set iw_ipaddr_type_availability iw_gas_address3 + json_get_vars iw_venue_name iw_venue_url set_default iw_enabled 0 if [ "$iw_enabled" = "1" ]; then @@ -903,6 +949,8 @@ hostapd_set_bss_options() { json_for_each_item append_iw_roaming_consortium iw_roaming_consortium json_for_each_item append_iw_anqp_elem iw_anqp_elem json_for_each_item append_iw_nai_realm iw_nai_realm + json_for_each_item append_iw_venue_name iw_venue_name + json_for_each_item append_iw_venue_url iw_venue_url iw_domain_name_conf= json_for_each_item append_iw_domain_name iw_domain_name @@ -918,15 +966,9 @@ hostapd_set_bss_options() { local hs20 disable_dgaf osen anqp_domain_id hs20_deauth_req_timeout \ osu_ssid hs20_wan_metrics hs20_operating_class hs20_t_c_filename hs20_t_c_timestamp \ - interworking internet access_network_type asra esr uesa venue_group venue_type \ - ipaddr_type_availability gas_address3 hessid \ - network_auth_type anqp_3gpp_cell_net domain_name anqp_elem qos_map_set \ hs20_t_c_server_url json_get_vars hs20 disable_dgaf osen anqp_domain_id hs20_deauth_req_timeout \ osu_ssid hs20_wan_metrics hs20_operating_class hs20_t_c_filename hs20_t_c_timestamp \ - interworking internet access_network_type asra esr uesa venue_group venue_type \ - ipaddr_type_availability gas_address3 hessid \ - network_auth_type anqp_3gpp_cell_net domain_name anqp_elem qos_map_set \ hs20_t_c_server_url set_default hs20 0 @@ -937,44 +979,41 @@ hostapd_set_bss_options() { if [ "$hs20" = "1" ]; then append bss_conf "hs20=1" "$N" append_hs20_icons - [ -n "$disable_dgaf"] && append bss_conf "disable_dgaf=$disable_dgaf" "$N" - [ -n "$osen"] && append bss_conf "osen=$osen" "$N" - [ -n "$anqp_domain_id"] && append bss_conf "anqp_domain_id=$anqp_domain_id" "$N" - [ -n "$hs20_deauth_req_timeout"] && append bss_conf "hs20_deauth_req_timeout=$hs20_deauth_req_timeout" "$N" + append bss_conf "disable_dgaf=$disable_dgaf" "$N" + append bss_conf "osen=$osen" "$N" + append bss_conf "anqp_domain_id=$anqp_domain_id" "$N" + append bss_conf "hs20_deauth_req_timeout=$hs20_deauth_req_timeout" "$N" [ -n "$osu_ssid" ] && append bss_conf "osu_ssid=$osu_ssid" "$N" [ -n "$hs20_wan_metrics" ] && append bss_conf "hs20_wan_metrics=$hs20_wan_metrics" "$N" [ -n "$hs20_operating_class" ] && append bss_conf "hs20_operating_class=$hs20_operating_class" "$N" [ -n "$hs20_t_c_filename" ] && append bss_conf "hs20_t_c_filename=$hs20_t_c_filename" "$N" [ -n "$hs20_t_c_timestamp" ] && append bss_conf "hs20_t_c_timestamp=$hs20_t_c_timestamp" "$N" + [ -n "$hs20_t_c_server_url" ] && append bss_conf "hs20_t_c_server_url=$hs20_t_c_server_url" "$N" json_for_each_item append_hs20_oper_friendly_name hs20_oper_friendly_name - json_for_each_item append_roaming_consortium roaming_consortium - json_for_each_item append_venue_name venue_name - json_for_each_item append_venue_url venue_url - json_for_each_item append_nai_realm nai_realm json_for_each_item append_hs20_conn_capab hs20_conn_capab - json_for_each_item append_hs20_oper_friendly_name hs20_oper_friendly_name json_for_each_item append_osu_provider osu_provider json_for_each_item append_operator_icon operator_icon - [ -n "$interworking" ] && append bss_conf "interworking=$interworking" "$N" - [ -n "$internet" ] && append bss_conf "internet=$internet" "$N" - [ -n "$access_network_type" ] && append bss_conf "access_network_type=$access_network_type" "$N" - [ -n "$asra" ] && append bss_conf "asra=$asra" "$N" - [ -n "$esr" ] && append bss_conf "esr=$esr" "$N" - [ -n "$uesa" ] && append bss_conf "uesa=$uesa" "$N" - [ -n "$venue_group" ] && append bss_conf "venue_group=$venue_group" "$N" - [ -n "$venue_type" ] && append bss_conf "venue_type=$venue_type" "$N" - [ -n "$ipaddr_type_availability" ] && append bss_conf "ipaddr_type_availability=$ipaddr_type_availability" "$N" - [ -n "$gas_address3" ] && append bss_conf "gas_address3=$gas_address3" "$N" - [ -n "$hessid" ] && append bss_conf "hessid=$hessid" "$N" - [ -n "$network_auth_type" ] && append bss_conf "network_auth_type=$network_auth_type" "$N" - [ -n "$anqp_3gpp_cell_net" ] && append bss_conf "anqp_3gpp_cell_net=$anqp_3gpp_cell_net" "$N" - [ -n "$nai_realm" ] && append bss_conf "nai_realm=$nai_realm" "$N" - [ -n "$anqp_elem" ] && append bss_conf "anqp_elem=$anqp_elem" "$N" - [ -n "$qos_map_set" ] && append bss_conf "qos_map_set=$qos_map_set" "$N" - [ -n "$domain_name" ] && append bss_conf "domain_name=$domain_name" "$N" - [ -n "$hs20_t_c_server_url" ] && append bss_conf "hs20_t_c_server_url=$hs20_t_c_server_url" "$N" fi + set_default multicast_to_unicast 0 + if [ "$multicast_to_unicast" -gt 0 ]; then + append bss_conf "multicast_to_unicast=$multicast_to_unicast" "$N" + fi + set_default proxy_arp 0 + if [ "$proxy_arp" -gt 0 ]; then + append bss_conf "proxy_arp=$proxy_arp" "$N" + fi + + set_default per_sta_vif 0 + if [ "$per_sta_vif" -gt 0 ]; then + append bss_conf "per_sta_vif=$per_sta_vif" "$N" + fi + + json_get_values opts hostapd_bss_options + for val in $opts; do + append bss_conf "$val" "$N" + done + bss_md5sum=$(echo $bss_conf | md5sum | cut -d" " -f1) append bss_conf "config_id=$bss_md5sum" "$N" @@ -1095,9 +1134,9 @@ wpa_supplicant_set_fixed_freq() { VHT*) append network_data "vht=1" "$N$T";; esac case "$htmode" in - VHT80|HE80) append network_data "max_oper_chwidth=1" "$N$T";; - VHT160|HE160) append network_data "max_oper_chwidth=2" "$N$T";; - VHT20|HE20|VHT40|HE40) append network_data "max_oper_chwidth=0" "$N$T";; + HE80|VHT80) append network_data "max_oper_chwidth=1" "$N$T";; + HE160|VHT160) append network_data "max_oper_chwidth=2" "$N$T";; + HE20|HE40|VHT20|VHT40) append network_data "max_oper_chwidth=0" "$N$T";; *) append network_data "disable_vht=1" "$N$T";; esac } @@ -1130,7 +1169,6 @@ wpa_supplicant_add_network() { set_default multi_ap 0 local key_mgmt='NONE' - local enc_str= local network_data= local T=" " @@ -1340,6 +1378,11 @@ wpa_supplicant_add_network() { ;; esac + [ "$wpa_cipher" = GCMP ] && { + append network_data "pairwise=GCMP" "$N$T" + append network_data "group=GCMP" "$N$T" + } + [ "$mode" = mesh ] || { case "$wpa" in 1) @@ -1380,7 +1423,7 @@ wpa_supplicant_add_network() { append network_data "mcast_rate=$mc_rate" "$N$T" } - if [ "$key_mgnt" = "WPS" ]; then + if [ "$key_mgmt" = "WPS" ]; then echo "wps_cred_processing=1" >> "$_config" else cat >> "$_config" <ifname); + int ret; + #ifdef CONFIG_WEP + int i; +@@ -36,7 +37,7 @@ static int vlan_if_add(struct hostapd_da + } + #endif /* CONFIG_WEP */ + +- if (!iface_exists(vlan->ifname)) ++ if (!vlan_exists) + ret = hostapd_vlan_if_add(hapd, vlan->ifname); + else if (!existsok) + return -1; +@@ -51,6 +52,9 @@ static int vlan_if_add(struct hostapd_da + if (hapd->wpa_auth) + ret = wpa_auth_ensure_group(hapd->wpa_auth, vlan->vlan_id); + ++ if (!ret && !vlan_exists) ++ hostapd_ubus_add_vlan(hapd, vlan); ++ + if (ret == 0) + return ret; + +@@ -77,6 +81,8 @@ int vlan_if_remove(struct hostapd_data * + "WPA deinitialization for VLAN %d failed (%d)", + vlan->vlan_id, ret); + ++ hostapd_ubus_remove_vlan(hapd, vlan); ++ + return hostapd_vlan_if_remove(hapd, vlan->ifname); + } + +--- a/src/ap/dfs.c ++++ b/src/ap/dfs.c +@@ -1179,6 +1179,8 @@ int hostapd_dfs_radar_detected(struct ho + "freq=%d ht_enabled=%d chan_offset=%d chan_width=%d cf1=%d cf2=%d", + freq, ht_enabled, chan_offset, chan_width, cf1, cf2); + ++ hostapd_ubus_notify_radar_detected(iface, freq, chan_width, cf1, cf2); ++ + /* Proceed only if DFS is not offloaded to the driver */ + if (iface->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD) + return 0; diff --git a/feeds/wifi-ax/hostapd/patches/700-wifi-reload.patch b/feeds/wifi-ax/hostapd/patches/700-wifi-reload.patch index 894978920..2fdba4072 100644 --- a/feeds/wifi-ax/hostapd/patches/700-wifi-reload.patch +++ b/feeds/wifi-ax/hostapd/patches/700-wifi-reload.patch @@ -174,7 +174,7 @@ hostapd_alloc_bss_data(struct hostapd_iface *hapd_iface, --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -4493,6 +4493,9 @@ static int wpa_driver_nl80211_set_ap(voi +@@ -4511,6 +4511,9 @@ static int wpa_driver_nl80211_set_ap(voi if (ret) { wpa_printf(MSG_DEBUG, "nl80211: Beacon set failed: %d (%s)", ret, strerror(-ret)); diff --git a/feeds/wifi-ax/hostapd/patches/710-vlan_no_bridge.patch b/feeds/wifi-ax/hostapd/patches/710-vlan_no_bridge.patch new file mode 100644 index 000000000..7de4e2c1d --- /dev/null +++ b/feeds/wifi-ax/hostapd/patches/710-vlan_no_bridge.patch @@ -0,0 +1,33 @@ +--- a/src/ap/ap_config.h ++++ b/src/ap/ap_config.h +@@ -115,6 +115,7 @@ struct hostapd_ssid { + #define DYNAMIC_VLAN_OPTIONAL 1 + #define DYNAMIC_VLAN_REQUIRED 2 + int dynamic_vlan; ++ int vlan_no_bridge; + #define DYNAMIC_VLAN_NAMING_WITHOUT_DEVICE 0 + #define DYNAMIC_VLAN_NAMING_WITH_DEVICE 1 + #define DYNAMIC_VLAN_NAMING_END 2 +--- a/src/ap/vlan_full.c ++++ b/src/ap/vlan_full.c +@@ -466,6 +466,9 @@ void vlan_newlink(const char *ifname, st + + wpa_printf(MSG_DEBUG, "VLAN: vlan_newlink(%s)", ifname); + ++ if (hapd->conf->ssid.vlan_no_bridge) ++ return; ++ + for (vlan = hapd->conf->vlan; vlan; vlan = vlan->next) { + if (vlan->configured || + os_strcmp(ifname, vlan->ifname) != 0) +--- a/hostapd/config_file.c ++++ b/hostapd/config_file.c +@@ -3400,6 +3400,8 @@ static int hostapd_config_fill(struct ho + #ifndef CONFIG_NO_VLAN + } else if (os_strcmp(buf, "dynamic_vlan") == 0) { + bss->ssid.dynamic_vlan = atoi(pos); ++ } else if (os_strcmp(buf, "vlan_no_bridge") == 0) { ++ bss->ssid.vlan_no_bridge = atoi(pos); + } else if (os_strcmp(buf, "per_sta_vif") == 0) { + bss->ssid.per_sta_vif = atoi(pos); + } else if (os_strcmp(buf, "vlan_file") == 0) { diff --git a/feeds/wifi-ax/hostapd/patches/720-iface_max_num_sta.patch b/feeds/wifi-ax/hostapd/patches/720-iface_max_num_sta.patch new file mode 100644 index 000000000..b93a0bcbe --- /dev/null +++ b/feeds/wifi-ax/hostapd/patches/720-iface_max_num_sta.patch @@ -0,0 +1,82 @@ +--- a/hostapd/config_file.c ++++ b/hostapd/config_file.c +@@ -2873,6 +2873,14 @@ static int hostapd_config_fill(struct ho + line, bss->max_num_sta, MAX_STA_COUNT); + return 1; + } ++ } else if (os_strcmp(buf, "iface_max_num_sta") == 0) { ++ conf->max_num_sta = atoi(pos); ++ if (conf->max_num_sta < 0 || ++ conf->max_num_sta > MAX_STA_COUNT) { ++ wpa_printf(MSG_ERROR, "Line %d: Invalid max_num_sta=%d; allowed range 0..%d", ++ line, conf->max_num_sta, MAX_STA_COUNT); ++ return 1; ++ } + } else if (os_strcmp(buf, "wpa") == 0) { + bss->wpa = atoi(pos); + } else if (os_strcmp(buf, "extended_key_id") == 0) { +--- a/src/ap/hostapd.h ++++ b/src/ap/hostapd.h +@@ -648,6 +648,7 @@ void hostapd_cleanup_cs_params(struct ho + void hostapd_periodic_iface(struct hostapd_iface *iface); + int hostapd_owe_trans_get_info(struct hostapd_data *hapd); + void hostapd_ocv_check_csa_sa_query(void *eloop_ctx, void *timeout_ctx); ++int hostapd_check_max_sta(struct hostapd_data *hapd); + + /* utils.c */ + int hostapd_register_probereq_cb(struct hostapd_data *hapd, +--- a/src/ap/hostapd.c ++++ b/src/ap/hostapd.c +@@ -236,6 +236,30 @@ static int hostapd_iface_conf_changed(st + } + + ++static inline int hostapd_iface_num_sta(struct hostapd_iface *iface) ++{ ++ int num_sta = 0; ++ int i; ++ ++ for (i = 0; i < iface->num_bss; i++) ++ num_sta += iface->bss[i]->num_sta; ++ ++ return num_sta; ++} ++ ++ ++int hostapd_check_max_sta(struct hostapd_data *hapd) ++{ ++ if (hapd->num_sta >= hapd->conf->max_num_sta) ++ return 1; ++ ++ if (hapd->iconf->max_num_sta && ++ hostapd_iface_num_sta(hapd->iface) >= hapd->iconf->max_num_sta) ++ return 1; ++ ++ return 0; ++} ++ + int hostapd_reload_config(struct hostapd_iface *iface, int reconf) + { + struct hapd_interfaces *interfaces = iface->interfaces; +--- a/src/ap/beacon.c ++++ b/src/ap/beacon.c +@@ -1039,7 +1039,7 @@ void handle_probe_req(struct hostapd_dat + if (hapd->conf->no_probe_resp_if_max_sta && + is_multicast_ether_addr(mgmt->da) && + is_multicast_ether_addr(mgmt->bssid) && +- hapd->num_sta >= hapd->conf->max_num_sta && ++ hostapd_check_max_sta(hapd) && + !ap_get_sta(hapd, mgmt->sa)) { + wpa_printf(MSG_MSGDUMP, "%s: Ignore Probe Request from " MACSTR + " since no room for additional STA", +--- a/src/ap/ap_config.h ++++ b/src/ap/ap_config.h +@@ -976,6 +976,8 @@ struct hostapd_config { + unsigned int track_sta_max_num; + unsigned int track_sta_max_age; + ++ int max_num_sta; ++ + char country[3]; /* first two octets: country code as described in + * ISO/IEC 3166-1. Third octet: + * ' ' (ascii 32): all environments diff --git a/feeds/wifi-ax/hostapd/patches/900-hapd-netlink-ubus-bridge.patch b/feeds/wifi-ax/hostapd/patches/900-hapd-netlink-ubus-bridge.patch deleted file mode 100644 index 54904ff42..000000000 --- a/feeds/wifi-ax/hostapd/patches/900-hapd-netlink-ubus-bridge.patch +++ /dev/null @@ -1,881 +0,0 @@ ---- a/hostapd/main.c -+++ b/hostapd/main.c -@@ -41,7 +41,7 @@ struct hapd_global { - static struct hapd_global global; - static int daemonize = 0; - static char *pid_file = NULL; -- -+uint32_t cached_events_nr = 0; - - #ifndef CONFIG_NO_HOSTAPD_LOGGER - static void hostapd_logger_cb(void *ctx, const u8 *addr, unsigned int module, ---- a/src/ap/hostapd.h -+++ b/src/ap/hostapd.h -@@ -97,6 +97,10 @@ struct hostapd_probereq_cb { - }; - - #define HOSTAPD_RATE_BASIC 0x00000001 -+/* max number of cached events */ -+#define HOSTAPD_MAX_CACHED_EVENTS 500 -+/* event counter */ -+uint32_t cached_events_nr; - - struct hostapd_rate_data { - int rate; /* rate in 100 kbps */ ---- a/src/ap/ieee802_11.c -+++ b/src/ap/ieee802_11.c -@@ -4908,6 +4908,7 @@ int ieee802_11_mgmt(struct hostapd_data - int ret = 0; - unsigned int freq; - int ssi_signal = fi ? fi->ssi_signal : 0; -+ int ubus_resp; - - if (len < 24) - return 0; -@@ -4977,25 +4978,52 @@ int ieee802_11_mgmt(struct hostapd_data - if (hapd->iconf->track_sta_max_num) - sta_track_add(hapd->iface, mgmt->sa, ssi_signal); - -+ /* ubus request */ -+ struct hostapd_ubus_request req = { -+ .type = HOSTAPD_UBUS_TYPE_MAX, -+ .mgmt_frame = mgmt, -+ .ssi_signal = ssi_signal -+ }; -+ - switch (stype) { - case WLAN_FC_STYPE_AUTH: - wpa_printf(MSG_DEBUG, "mgmt::auth"); - handle_auth(hapd, mgmt, len, ssi_signal, 0); -+ hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211, -+ HOSTAPD_LEVEL_DEBUG, "mgmt: [%d] [%s]", -+ stype, -+ "AUTH"); -+ req.type = HOSTAPD_UBUS_AUTH_REQ; - ret = 1; - break; - case WLAN_FC_STYPE_ASSOC_REQ: - wpa_printf(MSG_DEBUG, "mgmt::assoc_req"); - handle_assoc(hapd, mgmt, len, 0, ssi_signal); -+ hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211, -+ HOSTAPD_LEVEL_DEBUG, "mgmt: [%d] [%s]", -+ stype, -+ "ASSOC"); -+ req.type = HOSTAPD_UBUS_ASSOC_REQ; - ret = 1; - break; - case WLAN_FC_STYPE_REASSOC_REQ: - wpa_printf(MSG_DEBUG, "mgmt::reassoc_req"); - handle_assoc(hapd, mgmt, len, 1, ssi_signal); -+ hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211, -+ HOSTAPD_LEVEL_DEBUG, "mgmt: [%d] [%s]", -+ stype, -+ "RE-ASSOC"); -+ req.type = HOSTAPD_UBUS_REASSOC_REQ; - ret = 1; - break; - case WLAN_FC_STYPE_DISASSOC: - wpa_printf(MSG_DEBUG, "mgmt::disassoc"); - handle_disassoc(hapd, mgmt, len); -+ hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211, -+ HOSTAPD_LEVEL_DEBUG, "mgmt: [%d] [%s]", -+ stype, -+ "DISASSOC"); -+ req.type = HOSTAPD_UBUS_DISASSOC_REQ; - ret = 1; - break; - case WLAN_FC_STYPE_DEAUTH: -@@ -5014,6 +5042,15 @@ int ieee802_11_mgmt(struct hostapd_data - break; - } - -+ /* ubus send */ -+ if (req.type != HOSTAPD_UBUS_TYPE_MAX) { -+ ubus_resp = hostapd_ubus_handle_rt_event(hapd, &req); -+ if (ubus_resp) { -+ hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211, -+ HOSTAPD_LEVEL_INFO, -+ "hostapd_ubus_handle_rt_event: ERROR"); -+ } -+ } - return ret; - } - ---- a/src/ap/sta_info.c -+++ b/src/ap/sta_info.c -@@ -423,8 +423,14 @@ void ap_handle_timer(void *eloop_ctx, vo - hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, - HOSTAPD_LEVEL_INFO, "deauthenticated due to " - "local deauth request"); -- ap_free_sta(hapd, sta); - hostapd_ubus_notify(hapd, "local-deauth", sta->addr); -+ struct hostapd_ubus_request req = { -+ .type = HOSTAPD_UBUS_DISASSOC_REQ, -+ .sta = sta, -+ .reason = sta->deauth_reason -+ }; -+ hostapd_ubus_handle_rt_event(hapd, &req); -+ ap_free_sta(hapd, sta); - return; - } - -@@ -530,6 +536,14 @@ skip_poll: - WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY : - WLAN_REASON_PREV_AUTH_NOT_VALID; - -+ /* sessions */ -+ struct hostapd_ubus_request req = { -+ .type = HOSTAPD_UBUS_DISASSOC_REQ, -+ .sta = sta, -+ .reason = reason -+ }; -+ hostapd_ubus_handle_rt_event(hapd, &req); -+ - hostapd_drv_sta_disassoc(hapd, sta->addr, reason); - } - } -@@ -566,6 +580,15 @@ skip_poll: - __func__, MAC2STR(sta->addr), AP_DEAUTH_DELAY); - eloop_register_timeout(AP_DEAUTH_DELAY, 0, ap_handle_timer, - hapd, sta); -+ -+ /* sessions */ -+ struct hostapd_ubus_request req = { -+ .type = HOSTAPD_UBUS_DISASSOC_REQ, -+ .sta = sta, -+ .reason = reason -+ }; -+ hostapd_ubus_handle_rt_event(hapd, &req); -+ - mlme_disassociate_indication(hapd, sta, reason); - break; - case STA_DEAUTH: ---- a/src/ap/sta_info.h -+++ b/src/ap/sta_info.h -@@ -77,6 +77,9 @@ struct sta_info { - u8 supported_rates[WLAN_SUPP_RATES_MAX]; - int supported_rates_len; - u8 qosinfo; /* Valid when WLAN_STA_WMM is set */ -+ u64 cl_session_id; /* client fnv1a 64bit session id */ -+ u8 fdata; /* client first data flag */ -+ u8 first_ip; /* client first ip flag */ - - #ifdef CONFIG_MESH - enum mesh_plink_state plink_state; ---- a/src/ap/ubus.c -+++ b/src/ap/ubus.c -@@ -24,7 +24,10 @@ - - static struct ubus_context *ctx; - static struct blob_buf b; -+static struct blob_buf b_ev; - static int ctx_ref; -+static char** bss_lst = NULL; -+static size_t bss_nr = 0; - - static inline struct hapd_interfaces *get_hapd_interfaces_from_object(struct ubus_object *obj) - { -@@ -63,6 +66,21 @@ static void hostapd_ubus_connection_lost - eloop_register_timeout(1, 0, ubus_reconnect_timeout, ctx, NULL); - } - -+static int avl_compare_sess_id(const void *k1, const void *k2, void *ptr) -+{ -+ const uint32_t *id1 = k1, *id2 = k2; -+ -+ if (*id1 < *id2) -+ return -1; -+ else -+ return *id1 > *id2; -+} -+ -+uint64_t get_time_in_ms(struct timespec *ts) -+{ -+ return (uint64_t) ts->tv_sec * 1000 + ts->tv_nsec / 1000000; -+} -+ - static bool hostapd_ubus_init(void) - { - if (ctx) -@@ -525,6 +543,177 @@ static const struct blobmsg_policy csa_p - }; - - #ifdef NEED_AP_MLME -+enum { CSESS_REQ_SESS_ID, -+ __CSESS_REQ_MAX, -+}; -+ -+static const struct blobmsg_policy client_session_del_policy[__CSESS_REQ_MAX] = { -+ [CSESS_REQ_SESS_ID] = { .name = "session_id", .type = BLOBMSG_TYPE_INT64 }, -+}; -+ -+static int hostapd_clear_session(struct ubus_context *ctx, -+ struct ubus_object *obj, -+ struct ubus_request_data *req, -+ const char *method, -+ struct blob_attr *msg) -+{ -+ struct blob_attr *tb[__CSESS_REQ_MAX]; -+ struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj); -+ struct hostapd_event_avl_rec *rec = NULL; -+ struct hostapd_event_avl_rec *rec_next = NULL; -+ uint64_t session_id = 0; -+ -+ blobmsg_parse(client_session_del_policy, __CSESS_REQ_MAX, tb, -+ blob_data(msg), blob_len(msg)); -+ -+ if (!tb[CSESS_REQ_SESS_ID]) -+ return UBUS_STATUS_INVALID_ARGUMENT; -+ -+ session_id = blobmsg_get_u64(tb[CSESS_REQ_SESS_ID]); -+ /* remove from AVL and ubus session object) */ -+ avl_for_each_element_safe(&hapd->ubus.rt_events, rec, avl, rec_next) -+ { -+ if (session_id == rec->session_id) { -+ /* dec counter and delete */ -+ cached_events_nr -= rec->rec_nr; -+ avl_delete(&hapd->ubus.rt_events, &rec->avl); -+ os_free(rec->records); -+ os_free(rec); -+ } -+ } -+ return 0; -+} -+ -+static int hostapd_clear_sessions(struct ubus_context *ctx, -+ struct ubus_object *obj, -+ struct ubus_request_data *req, -+ const char *method, -+ struct blob_attr *msg) -+{ -+ struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj); -+ struct hostapd_event_avl_rec *rec = NULL; -+ struct hostapd_event_avl_rec *rec_n = NULL; -+ -+ avl_remove_all_elements(&hapd->ubus.rt_events, rec, avl, rec_n) -+ { -+ /* free events array */ -+ os_free(rec->records); -+ os_free(rec); -+ } -+ /* reset counter */ -+ cached_events_nr = 0; -+ return 0; -+} -+ -+static int hostapd_sessions(struct ubus_context *ctx, -+ struct ubus_object *obj, -+ struct ubus_request_data *req, -+ const char *method, -+ struct blob_attr *msg) -+{ -+ struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj); -+ void *a = NULL; -+ void *t = NULL; -+ void *t_msg = NULL; -+ struct hostapd_event_avl_rec *rec = NULL; -+ struct client_session_record *c_rec = NULL; -+ -+ blob_buf_init(&b_ev, 0); -+ a = blobmsg_open_table(&b_ev, "sessions"); -+ avl_for_each_element(&hapd->ubus.rt_events, rec, avl) -+ { -+ /* open session */ -+ t = blobmsg_open_table(&b_ev, "ClientSession"); -+ blobmsg_add_u64(&b_ev, "session_id", rec->session_id); -+ /* messages for current session */ -+ for (size_t i = 0; i < rec->rec_nr; i++) { -+ c_rec = &rec->records[i]; -+ /* check message type */ -+ switch (c_rec->type) { -+ /* ClientAuthEvent */ -+ case CST_AUTH: { -+ struct client_auth_event *p = &c_rec->u.auth; -+ t_msg = blobmsg_open_table(&b_ev, "ClientAuthEvent"); -+ blobmsg_add_u64(&b_ev, "session_id", rec->session_id); -+ blobmsg_add_u64(&b_ev, "timestamp", c_rec->timestamp); -+ blobmsg_add_string(&b_ev, "sta_mac", p->sta_mac); -+ blobmsg_add_u32(&b_ev, "band", p->band); -+ blobmsg_add_u32(&b_ev, "auth_status", p->auth_status); -+ blobmsg_add_string(&b_ev, "ssid", p->ssid); -+ blobmsg_close_table(&b_ev, t_msg); -+ break; -+ } -+ -+ /* ClientAssocEvent */ -+ case CST_ASSOC: { -+ struct client_assoc_event *p = &c_rec->u.assoc; -+ t_msg = blobmsg_open_table(&b_ev, "ClientAssocEvent"); -+ blobmsg_add_u64(&b_ev, "session_id", rec->session_id); -+ blobmsg_add_u64(&b_ev, "timestamp", c_rec->timestamp); -+ blobmsg_add_string(&b_ev, "sta_mac", p->sta_mac); -+ blobmsg_add_u32(&b_ev, "band", p->band); -+ blobmsg_add_u32(&b_ev, "assoc_type", 0); -+ blobmsg_add_u32(&b_ev, "rssi", p->rssi); -+ blobmsg_add_u32(&b_ev, "internal_sc", 0); -+ blobmsg_add_u8(&b_ev, "using11k", p->using11k); -+ blobmsg_add_u8(&b_ev, "using11r", p->using11r); -+ blobmsg_add_u8(&b_ev, "using11v", p->using11v); -+ blobmsg_add_string(&b_ev, "ssid", p->ssid); -+ blobmsg_close_table(&b_ev, t_msg); -+ break; -+ } -+ -+ /* ClientDisconnectEvent */ -+ case CST_DISASSOC: { -+ struct client_disassoc_event *p = &c_rec->u.disassoc; -+ t_msg = blobmsg_open_table(&b_ev, "ClientDisconnectEvent"); -+ blobmsg_add_u64(&b_ev, "session_id", rec->session_id); -+ blobmsg_add_u64(&b_ev, "timestamp", c_rec->timestamp); -+ blobmsg_add_string(&b_ev, "sta_mac", p->sta_mac); -+ blobmsg_add_u32(&b_ev, "band", p->band); -+ blobmsg_add_u32(&b_ev, "rssi", p->rssi); -+ blobmsg_add_u32(&b_ev, "internal_rc", p->internal_rc); -+ blobmsg_add_string(&b_ev, "ssid", p->ssid); -+ blobmsg_close_table(&b_ev, t_msg); -+ break; -+ } -+ -+ /* ClientFirstDataEvent */ -+ case CST_FDATA: { -+ struct client_fdata_event *p = &c_rec->u.fdata; -+ t_msg = blobmsg_open_table(&b_ev, "ClientFirstDataEvent"); -+ blobmsg_add_u64(&b_ev, "session_id", rec->session_id); -+ blobmsg_add_u64(&b_ev, "timestamp", c_rec->timestamp); -+ blobmsg_add_string(&b_ev, "sta_mac", p->sta_mac); -+ blobmsg_add_u64(&b_ev, "fdata_tx_up_ts_in_us", p->tx_ts.tv_sec * (uint64_t)1000000); -+ blobmsg_add_u64(&b_ev, "fdata_rx_up_ts_in_us", p->rx_ts.tv_sec * (uint64_t)1000000); -+ blobmsg_close_table(&b_ev, t_msg); -+ break; -+ } -+ -+ /* ClientIpEvent */ -+ case CST_IP: { -+ struct client_ip_event *p = &c_rec->u.ip; -+ t_msg = blobmsg_open_table(&b_ev, "ClientIpEvent"); -+ blobmsg_add_u64(&b_ev, "session_id", rec->session_id); -+ blobmsg_add_u64(&b_ev, "timestamp", c_rec->timestamp); -+ blobmsg_add_string(&b_ev, "sta_mac", p->sta_mac); -+ blobmsg_add_string(&b_ev, "ip_address", p->ip_addr); -+ blobmsg_close_table(&b_ev, t_msg); -+ break; -+ } -+ -+ default: -+ break; -+ } -+ } -+ blobmsg_close_table(&b_ev, t); -+ } -+ blobmsg_close_table(&b_ev, a); -+ ubus_send_reply(ctx, req, b_ev.head); -+ return 0; -+} -+ - static int - hostapd_switch_chan(struct ubus_context *ctx, struct ubus_object *obj, - struct ubus_request_data *req, const char *method, -@@ -1148,6 +1337,9 @@ static const struct ubus_method bss_meth - UBUS_METHOD_NOARG("get_features", hostapd_bss_get_features), - #ifdef NEED_AP_MLME - UBUS_METHOD("switch_chan", hostapd_switch_chan, csa_policy), -+ UBUS_METHOD_NOARG("get_sessions", hostapd_sessions), -+ UBUS_METHOD_NOARG("clear_sessions", hostapd_clear_sessions), -+ UBUS_METHOD("clear_session", hostapd_clear_session, client_session_del_policy), - #endif - UBUS_METHOD("set_vendor_elements", hostapd_vendor_elements, ve_policy), - UBUS_METHOD("notify_response", hostapd_notify_response, notify_policy), -@@ -1187,6 +1379,7 @@ void hostapd_ubus_add_bss(struct hostapd - if (asprintf(&name, "hostapd.%s", hapd->conf->iface) < 0) - return; - -+ avl_init(&hapd->ubus.rt_events, avl_compare_sess_id, false, NULL); - avl_init(&hapd->ubus.banned, avl_compare_macaddr, false, NULL); - obj->name = name; - obj->type = &bss_object_type; -@@ -1194,6 +1387,9 @@ void hostapd_ubus_add_bss(struct hostapd - obj->n_methods = bss_object_type.n_methods; - ret = ubus_add_object(ctx, obj); - hostapd_ubus_ref_inc(); -+ bss_nr++; -+ bss_lst = os_realloc(bss_lst, sizeof(char *) * bss_nr); -+ bss_lst[bss_nr - 1] = strdup(name); - if (hapd->conf->signal_stay_min > -128) - eloop_register_timeout(3, 0, hostapd_bss_signal_check, NULL, hapd); /* Start up the poll timer. */ - } -@@ -1212,11 +1408,42 @@ void hostapd_ubus_free_bss(struct hostap - } - - free(name); -+ for (size_t i = 0; i < bss_nr; i++) -+ os_free(bss_lst[i]); -+ free(bss_lst); -+ bss_lst = NULL; -+} -+ -+static int hostapd_get_bss_list(struct ubus_context *ctx, -+ struct ubus_object *obj, -+ struct ubus_request_data *req, -+ const char *method, -+ struct blob_attr *msg) -+{ -+ if (!bss_lst) -+ return 0; -+ -+ void *a = NULL; -+ void *b = NULL; -+ -+ /* create reply */ -+ blob_buf_init(&b_ev, 0); -+ a = blobmsg_open_array(&b_ev, "bss_list"); -+ /* check bss list from hapd */ -+ for (size_t i = 0; i < bss_nr; i++) { -+ b = blobmsg_open_table(&b_ev, NULL); -+ blobmsg_add_string(&b_ev, "name", bss_lst[i]); -+ blobmsg_close_table(&b_ev, b); -+ } -+ blobmsg_close_array(&b_ev, a); -+ ubus_send_reply(ctx, req, b_ev.head); -+ return 0; - } - - static const struct ubus_method daemon_methods[] = { - UBUS_METHOD("config_add", hostapd_config_add, config_add_policy), - UBUS_METHOD("config_remove", hostapd_config_remove, config_remove_policy), -+ UBUS_METHOD_NOARG("get_bss_list", hostapd_get_bss_list), - }; - - static struct ubus_object_type daemon_object_type = -@@ -1260,6 +1487,18 @@ struct ubus_event_req { - int resp; - }; - -+static uint64_t hash_fnv1a_64bit(const void *key, int len) -+{ -+ if (key == NULL) -+ return 0; -+ unsigned char *p = (unsigned char *)key; -+ uint64_t h = 14695981039346656037UL; -+ int i; -+ for (i = 0; i < len; i++) -+ h = (h ^ p[i]) * 1099511628211UL; -+ return h; -+} -+ - static void - ubus_event_cb(struct ubus_notify_request *req, int idx, int ret) - { -@@ -1268,6 +1507,224 @@ ubus_event_cb(struct ubus_notify_request - ureq->resp = ret; - } - -+int hostapd_ubus_handle_rt_event(struct hostapd_data *hapd, -+ struct hostapd_ubus_request *req) -+{ -+ /* check event counter */ -+ if (cached_events_nr > HOSTAPD_MAX_CACHED_EVENTS) { -+ hostapd_logger( -+ hapd, NULL, HOSTAPD_MODULE_IEEE80211, -+ HOSTAPD_LEVEL_WARNING, -+ "hostapd_ubus_handle_rt_event: HOSTAPD_MAX_CACHED_EVENTS [%d] exceeded", -+ HOSTAPD_MAX_CACHED_EVENTS); -+ return WLAN_STATUS_SUCCESS; -+ } -+ struct hostapd_event_avl_rec *rec = NULL; -+ struct timespec ts; -+ uint64_t timestamp = 0; -+ clock_gettime(CLOCK_REALTIME, &ts); -+ timestamp = get_time_in_ms(&ts); -+ uint64_t session_id = 0; -+ uint8_t new_rec = 0; -+ const struct ieee80211_mgmt *mgmt = req->mgmt_frame; -+ struct sta_info *sta = req->sta ? (void *)req->sta : ap_get_sta(hapd, mgmt->sa); -+ /* null pointer check */ -+ if (!sta) return WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA; -+ -+ struct hostapd_bss_config *bss_conf = hapd->conf; -+ session_id = sta->cl_session_id; -+ -+ /* find by session id */ -+ rec = avl_find_element(&hapd->ubus.rt_events, &session_id, rec, avl); -+ -+ /* prepare rec if not found */ -+ if (!rec) { -+ new_rec = 1; -+ rec = os_zalloc(sizeof(struct hostapd_event_avl_rec)); -+ session_id = hash_fnv1a_64bit(&ts, sizeof(struct timespec)); -+ } -+ hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211, -+ HOSTAPD_LEVEL_DEBUG, -+ "hostapd_ubus_handle_rt_event: REQ TYPE [%d]", -+ req->type); -+ -+ switch (req->type) { -+ case HOSTAPD_UBUS_AUTH_REQ: { -+ /* session id */ -+ rec->session_id = session_id; -+ rec->rec_nr++; -+ rec->records = os_realloc(rec->records, -+ sizeof(struct client_session_record) * rec->rec_nr); -+ struct client_session_record *rp = &rec->records[rec->rec_nr - 1]; -+ rp->type = CST_AUTH; -+ rp->u.auth.session_id = rec->session_id; -+ -+ /* timestamp */ -+ rp->timestamp = timestamp; -+ /* frequency */ -+ rp->u.auth.band = hapd->iface->freq; -+ /* STA MAC */ -+ sprintf(rp->u.auth.sta_mac, MACSTR, MAC2STR(sta->addr)); -+ /* ssid */ -+ rp->u.auth.ssid[0] = 0; -+ printf_encode(rp->u.auth.ssid, sizeof(rp->u.auth.ssid), -+ bss_conf->ssid.ssid, bss_conf->ssid.ssid_len); -+ /* auth status */ -+ rp->u.auth.auth_status = le_to_host16(mgmt->u.auth.status_code); -+ hostapd_logger( -+ hapd, NULL, HOSTAPD_MODULE_IEEE80211, -+ HOSTAPD_LEVEL_DEBUG, -+ "hostapd_ubus_handle_rt_event:HOSTAPD_UBUS_AUTH_REQ"); -+ /* inc counter */ -+ cached_events_nr++; -+ break; -+ } -+ case HOSTAPD_UBUS_ASSOC_REQ: { -+ /* session id */ -+ rec->session_id = session_id; -+ rec->rec_nr++; -+ rec->records = os_realloc(rec->records, -+ sizeof(struct client_session_record) * rec->rec_nr); -+ struct client_session_record *rp = &rec->records[rec->rec_nr - 1]; -+ rp->type = CST_ASSOC; -+ rp->u.assoc.session_id = rec->session_id; -+ /* timestamp */ -+ rp->timestamp = timestamp; -+ /* frequency */ -+ rp->u.assoc.band = hapd->iface->freq; -+ /* STA MAC */ -+ sprintf(rp->u.assoc.sta_mac, MACSTR, MAC2STR(sta->addr)); -+ /* ssid */ -+ rp->u.assoc.ssid[0] = 0; -+ printf_encode(rp->u.assoc.ssid, sizeof(rp->u.assoc.ssid), -+ bss_conf->ssid.ssid, bss_conf->ssid.ssid_len); -+ /* rssi */ -+ rp->u.assoc.rssi = req->ssi_signal; -+ /* using 11r */ -+ rp->u.assoc.using11r = (sta->auth_alg & WPA_AUTH_ALG_FT); -+ /* using 11k */ -+ if (sta->rrm_enabled_capa[0] || sta->rrm_enabled_capa[1] || -+ sta->rrm_enabled_capa[2] || sta->rrm_enabled_capa[3] || -+ sta->rrm_enabled_capa[4]) -+ rp->u.assoc.using11k = 1; -+ else -+ rp->u.assoc.using11k = 0; -+ /* using 11v */ -+ if (bss_conf->time_advertisement || bss_conf->wnm_sleep_mode || -+ bss_conf->bss_transition) -+ rp->u.assoc.using11v = 1; -+ else -+ rp->u.assoc.using11v = 0; -+ hostapd_logger( -+ hapd, NULL, HOSTAPD_MODULE_IEEE80211, -+ HOSTAPD_LEVEL_DEBUG, -+ "hostapd_ubus_handle_rt_event:HOSTAPD_UBUS_ASSOC_REQ"); -+ /* inc counter */ -+ cached_events_nr++; -+ break; -+ } -+ case HOSTAPD_UBUS_DISASSOC_REQ: { -+ /* session id */ -+ rec->session_id = session_id; -+ rec->rec_nr++; -+ rec->records = os_realloc(rec->records, -+ sizeof(struct client_session_record) * rec->rec_nr); -+ struct client_session_record *rp = &rec->records[rec->rec_nr - 1]; -+ rp->type = CST_DISASSOC; -+ rp->u.disassoc.session_id = rec->session_id; -+ /* timestamp */ -+ rp->timestamp = timestamp; -+ /* frequency */ -+ rp->u.disassoc.band = hapd->iface->freq; -+ /* STA MAC */ -+ sprintf(rp->u.disassoc.sta_mac, MACSTR, MAC2STR(sta->addr)); -+ /* ssid */ -+ rp->u.disassoc.ssid[0] = 0; -+ printf_encode(rp->u.disassoc.ssid, sizeof(rp->u.disassoc.ssid), -+ bss_conf->ssid.ssid, bss_conf->ssid.ssid_len); -+ /* rssi */ -+ rp->u.disassoc.rssi = req->ssi_signal; -+ /* internal_rc */ -+ rp->u.disassoc.internal_rc = req->reason; -+ hostapd_logger( -+ hapd, NULL, HOSTAPD_MODULE_IEEE80211, -+ HOSTAPD_LEVEL_DEBUG, -+ "hostapd_ubus_handle_rt_event:HOSTAPD_UBUS_DISASSOC_REQ"); -+ /* inc counter */ -+ cached_events_nr++; -+ break; -+ } -+ case HOSTAPD_UBUS_FDATA_REQ: { -+ /* session id */ -+ rec->session_id = session_id; -+ rec->rec_nr++; -+ rec->records = os_realloc(rec->records, -+ sizeof(struct client_session_record) * rec->rec_nr); -+ struct client_session_record *rp = &rec->records[rec->rec_nr - 1]; -+ rp->type = CST_FDATA; -+ rp->u.fdata.session_id = rec->session_id; -+ /* timestamp */ -+ rp->timestamp = timestamp; -+ /* STA MAC */ -+ sprintf(rp->u.fdata.sta_mac, MACSTR, MAC2STR(sta->addr)); -+ /* rx ts */ -+ rp->u.fdata.rx_ts = ts; -+ /* tx ts */ -+ rp->u.fdata.tx_ts = ts; -+ /* single event only */ -+ sta->fdata = 1; -+ hostapd_logger( -+ hapd, NULL, HOSTAPD_MODULE_IEEE80211, -+ HOSTAPD_LEVEL_DEBUG, -+ "hostapd_ubus_handle_rt_event:HOSTAPD_UBUS_FDATA_REQ"); -+ /* inc counter */ -+ cached_events_nr++; -+ break; -+ } -+ case HOSTAPD_UBUS_IP_REQ: { -+ if(sta->first_ip) break; -+ /* session id */ -+ rec->session_id = session_id; -+ rec->rec_nr++; -+ rec->records = os_realloc(rec->records, -+ sizeof(struct client_session_record) * rec->rec_nr); -+ struct client_session_record *rp = &rec->records[rec->rec_nr - 1]; -+ rp->type = CST_IP; -+ rp->u.ip.session_id = rec->session_id; -+ /* timestamp */ -+ rp->timestamp = timestamp; -+ /* STA MAC */ -+ sprintf(rp->u.ip.sta_mac, MACSTR, MAC2STR(sta->addr)); -+ /* ip address */ -+ snprintf(rp->u.ip.ip_addr, 20, "%u.%u.%u.%u", -+ (req->ipaddr >> 24) & 0xFF, -+ (req->ipaddr >> 16) & 0xFF, -+ (req->ipaddr >> 8) & 0xFF, -+ req->ipaddr & 0xFF); -+ /* single event only */ -+ sta->first_ip = 1; -+ /* inc counter */ -+ cached_events_nr++; -+ break; -+ } -+ default: -+ hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211, -+ HOSTAPD_LEVEL_DEBUG, -+ "hostapd_ubus_handle_rt_event:UNKNOWN"); -+ new_rec = 0; -+ break; -+ } -+ if (new_rec) { -+ /* insert new client session */ -+ rec->avl.key = &rec->session_id; -+ sta->cl_session_id = session_id; -+ if (avl_insert(&hapd->ubus.rt_events, &rec->avl)) -+ return WLAN_STATUS_UNSPECIFIED_FAILURE; -+ } -+ -+ return WLAN_STATUS_SUCCESS; -+} -+ - int hostapd_ubus_handle_event(struct hostapd_data *hapd, struct hostapd_ubus_request *req) - { - struct ubus_banned_client *ban; ---- a/src/ap/ubus.h -+++ b/src/ap/ubus.h -@@ -12,6 +12,11 @@ enum hostapd_ubus_event_type { - HOSTAPD_UBUS_PROBE_REQ, - HOSTAPD_UBUS_AUTH_REQ, - HOSTAPD_UBUS_ASSOC_REQ, -+ HOSTAPD_UBUS_REASSOC_REQ, -+ HOSTAPD_UBUS_DISASSOC_REQ, -+ HOSTAPD_UBUS_DEAUTH_REQ, -+ HOSTAPD_UBUS_FDATA_REQ, -+ HOSTAPD_UBUS_IP_REQ, - HOSTAPD_UBUS_TYPE_MAX - }; - -@@ -19,8 +24,11 @@ struct hostapd_ubus_request { - enum hostapd_ubus_event_type type; - const struct ieee80211_mgmt *mgmt_frame; - const struct ieee802_11_elems *elems; -+ const struct sta_info *sta; - int ssi_signal; /* dBm */ -+ int reason; - const u8 *addr; -+ be32 ipaddr; - }; - - struct hostapd_iface; -@@ -37,6 +45,80 @@ struct hostapd_ubus_bss { - struct ubus_object obj; - struct avl_tree banned; - int notify_response; -+ struct avl_tree rt_events; -+}; -+ -+enum client_sess_type { -+ CST_ASSOC, -+ CST_AUTH, -+ CST_DISASSOC, -+ CST_FDATA, -+ CST_IP -+}; -+ -+struct client_assoc_event { -+ unsigned char sta_mac[20]; -+ uint64_t session_id; -+ char ssid[SSID_MAX_LEN]; -+ int band; -+ int assoc_type; -+ int status; -+ int rssi; -+ int internal_sc; -+ uint8_t using11k; -+ uint8_t using11r; -+ uint8_t using11v; -+}; -+ -+struct client_disassoc_event { -+ unsigned char sta_mac[20]; -+ uint64_t session_id; -+ char ssid[SSID_MAX_LEN]; -+ int band; -+ int assoc_type; -+ int status; -+ int rssi; -+ int internal_rc; -+}; -+ -+struct client_auth_event { -+ unsigned char sta_mac[20]; -+ uint64_t session_id; -+ char ssid[SSID_MAX_LEN]; -+ int band; -+ uint32_t auth_status; -+}; -+ -+struct client_fdata_event { -+ unsigned char sta_mac[20]; -+ uint64_t session_id; -+ struct timespec rx_ts; -+ struct timespec tx_ts; -+}; -+ -+struct client_ip_event { -+ unsigned char sta_mac[20]; -+ uint64_t session_id; -+ unsigned char ip_addr[16]; -+}; -+ -+struct client_session_record { -+ int type; -+ uint64_t timestamp; -+ union { -+ struct client_assoc_event assoc; -+ struct client_disassoc_event disassoc; -+ struct client_auth_event auth; -+ struct client_fdata_event fdata; -+ struct client_ip_event ip; -+ } u; -+}; -+ -+struct hostapd_event_avl_rec { -+ uint64_t session_id; -+ struct client_session_record *records; -+ size_t rec_nr; -+ struct avl_node avl; - }; - - void hostapd_ubus_add_iface(struct hostapd_iface *iface); -@@ -45,6 +127,7 @@ void hostapd_ubus_add_bss(struct hostapd - void hostapd_ubus_free_bss(struct hostapd_data *hapd); - - int hostapd_ubus_handle_event(struct hostapd_data *hapd, struct hostapd_ubus_request *req); -+int hostapd_ubus_handle_rt_event(struct hostapd_data *hapd, struct hostapd_ubus_request *req); - void hostapd_ubus_notify(struct hostapd_data *hapd, const char *type, const u8 *mac); - void hostapd_ubus_notify_beacon_report(struct hostapd_data *hapd, - const u8 *addr, u8 token, u8 rep_mode, -@@ -78,6 +161,11 @@ static inline int hostapd_ubus_handle_ev - { - return 0; - } -+ -+static inline int hostapd_ubus_handle_rt_event(struct hostapd_data *hapd, struct hostapd_ubus_request *req) -+{ -+ return 0; -+} - - static inline void hostapd_ubus_notify(struct hostapd_data *hapd, const char *type, const u8 *mac) - { ---- a/src/ap/hostapd.c -+++ b/src/ap/hostapd.c -@@ -1406,19 +1406,22 @@ static int hostapd_setup_bss(struct host - "Generic snooping infrastructure initialization failed"); - return -1; - } -- -- if (dhcp_snoop_init(hapd)) { -- wpa_printf(MSG_ERROR, -- "DHCP snooping initialization failed"); -- return -1; -- } -- - if (ndisc_snoop_init(hapd)) { - wpa_printf(MSG_ERROR, - "Neighbor Discovery snooping initialization failed"); - return -1; - } - } -+ if (dhcp_snoop_init(hapd)) { -+ wpa_printf(MSG_ERROR, -+ "DHCP snooping initialization failed"); -+ hostapd_logger( -+ hapd, NULL, HOSTAPD_MODULE_IEEE80211, -+ HOSTAPD_LEVEL_DEBUG, -+ "dfranusic:DHCP snooping initialization failed"); -+ -+ return -1; -+ } - - if (!hostapd_drv_none(hapd) && vlan_init(hapd)) { - wpa_printf(MSG_ERROR, "VLAN initialization failed."); ---- a/src/ap/dhcp_snoop.c -+++ b/src/ap/dhcp_snoop.c -@@ -40,6 +40,7 @@ static void handle_dhcp(void *ctx, const - int res, msgtype = 0, prefixlen = 32; - u32 subnet_mask = 0; - u16 ip_len; -+ int ubus_resp; - - exten_len = len - ETH_HLEN - (sizeof(*b) - sizeof(b->exten)); - if (exten_len < 4) -@@ -112,6 +113,19 @@ static void handle_dhcp(void *ctx, const - ipaddr_str(be_to_host32(b->your_ip)), - prefixlen); - -+ struct hostapd_ubus_request req = { -+ .type = HOSTAPD_UBUS_IP_REQ, -+ .sta = sta, -+ .ipaddr = be_to_host32(b->your_ip) -+ }; -+ ubus_resp = hostapd_ubus_handle_rt_event(hapd, &req); -+ if (ubus_resp) { -+ hostapd_logger( -+ hapd, NULL, HOSTAPD_MODULE_IEEE80211, -+ HOSTAPD_LEVEL_DEBUG, -+ "hostapd_ubus_handle_rt_event: ERROR"); -+ } -+ - if (sta->ipaddr == b->your_ip) - return; - diff --git a/feeds/wifi-ax/hostapd/patches/900-max-sta-limit.patch b/feeds/wifi-ax/hostapd/patches/900-max-sta-limit.patch deleted file mode 100644 index 73330b801..000000000 --- a/feeds/wifi-ax/hostapd/patches/900-max-sta-limit.patch +++ /dev/null @@ -1,100 +0,0 @@ -Index: hostapd-2020-06-08-5a8b3662/hostapd/config_file.c -=================================================================== ---- hostapd-2020-06-08-5a8b3662.orig/hostapd/config_file.c -+++ hostapd-2020-06-08-5a8b3662/hostapd/config_file.c -@@ -2909,6 +2909,11 @@ static int hostapd_config_fill(struct ho - line); - return 1; - } -+ } else if (os_strcmp(buf, "global_max_num_sta") == 0) { -+ conf->global_max_num_sta = atoi(pos); -+ if (conf->global_max_num_sta < 0 || -+ conf->global_max_num_sta > MAX_STA_COUNT) -+ conf->global_max_num_sta = MAX_STA_COUNT; - } else if (os_strcmp(buf, "max_num_sta") == 0) { - bss->max_num_sta = atoi(pos); - if (bss->max_num_sta < 0 || -Index: hostapd-2020-06-08-5a8b3662/src/ap/ap_config.c -=================================================================== ---- hostapd-2020-06-08-5a8b3662.orig/src/ap/ap_config.c -+++ hostapd-2020-06-08-5a8b3662/src/ap/ap_config.c -@@ -228,6 +228,8 @@ struct hostapd_config * hostapd_config_d - - conf->num_bss = 1; - -+ conf->global_max_num_sta = 0; -+ - conf->beacon_int = 100; - conf->rts_threshold = -2; /* use driver default: 2347 */ - conf->fragm_threshold = -2; /* user driver default: 2346 */ -Index: hostapd-2020-06-08-5a8b3662/src/ap/ap_config.h -=================================================================== ---- hostapd-2020-06-08-5a8b3662.orig/src/ap/ap_config.h -+++ hostapd-2020-06-08-5a8b3662/src/ap/ap_config.h -@@ -1069,6 +1069,7 @@ struct hostapd_config { - #define AIRTIME_MODE_MAX (__AIRTIME_MODE_MAX - 1) - #endif /* CONFIG_AIRTIME_POLICY */ - char *config_id; -+ int global_max_num_sta; - }; - - -Index: hostapd-2020-06-08-5a8b3662/src/ap/beacon.c -=================================================================== ---- hostapd-2020-06-08-5a8b3662.orig/src/ap/beacon.c -+++ hostapd-2020-06-08-5a8b3662/src/ap/beacon.c -@@ -1030,7 +1030,8 @@ void handle_probe_req(struct hostapd_dat - if (hapd->conf->no_probe_resp_if_max_sta && - is_multicast_ether_addr(mgmt->da) && - is_multicast_ether_addr(mgmt->bssid) && -- hapd->num_sta >= hapd->conf->max_num_sta && -+ hapd_check_max_sta(hapd) && -+// hapd->num_sta >= hapd->conf->max_num_sta && - !ap_get_sta(hapd, mgmt->sa)) { - wpa_printf(MSG_MSGDUMP, "%s: Ignore Probe Request from " MACSTR - " since no room for additional STA", -Index: hostapd-2020-06-08-5a8b3662/src/ap/sta_info.c -=================================================================== ---- hostapd-2020-06-08-5a8b3662.orig/src/ap/sta_info.c -+++ hostapd-2020-06-08-5a8b3662/src/ap/sta_info.c -@@ -705,7 +705,8 @@ struct sta_info * ap_sta_add(struct host - return sta; - - wpa_printf(MSG_DEBUG, " New STA"); -- if (hapd->num_sta >= hapd->conf->max_num_sta) { -+ if (hapd_check_max_sta(hapd)) { -+// if (hapd->num_sta >= hapd->conf->max_num_sta) { - /* FIX: might try to remove some old STAs first? */ - wpa_printf(MSG_DEBUG, "no more room for new STAs (%d/%d)", - hapd->num_sta, hapd->conf->max_num_sta); -Index: hostapd-2020-06-08-5a8b3662/src/ap/hostapd.c -=================================================================== ---- hostapd-2020-06-08-5a8b3662.orig/src/ap/hostapd.c -+++ hostapd-2020-06-08-5a8b3662/src/ap/hostapd.c -@@ -3779,3 +3779,15 @@ void hostapd_ocv_check_csa_sa_query(void - } - } - #endif /* CONFIG_OCV */ -+ -+int hapd_check_max_sta(struct hostapd_data *hapd) -+{ -+ int cnt = 0, i; -+ -+ if (!hapd->iconf->global_max_num_sta) -+ return hapd->num_sta >= hapd->conf->max_num_sta; -+ -+ for (i = 0; i < hapd->iface->num_bss; i++) -+ cnt += hapd->iface->bss[i]->num_sta; -+ return cnt >= hapd->iconf->global_max_num_sta; -+} -Index: hostapd-2020-06-08-5a8b3662/src/ap/hostapd.h -=================================================================== ---- hostapd-2020-06-08-5a8b3662.orig/src/ap/hostapd.h -+++ hostapd-2020-06-08-5a8b3662/src/ap/hostapd.h -@@ -693,4 +693,6 @@ void fst_hostapd_fill_iface_obj(struct h - struct fst_wpa_obj *iface_obj); - #endif /* CONFIG_FST */ - -+int hapd_check_max_sta(struct hostapd_data *hapd); -+ - #endif /* HOSTAPD_H */ diff --git a/feeds/wifi-ax/hostapd/src/src/ap/ubus.c b/feeds/wifi-ax/hostapd/src/src/ap/ubus.c index d0fd07c3e..9452acdc3 100644 --- a/feeds/wifi-ax/hostapd/src/src/ap/ubus.c +++ b/feeds/wifi-ax/hostapd/src/src/ap/ubus.c @@ -490,6 +490,8 @@ hostapd_switch_chan(struct ubus_context *ctx, struct ubus_object *obj, struct blob_attr *tb[__CSA_MAX]; struct hostapd_data *hapd = get_hapd_from_object(obj); struct csa_settings css; + int ret = UBUS_STATUS_OK; + int i; blobmsg_parse(csa_policy, __CSA_MAX, tb, blob_data(msg), blob_len(msg)); @@ -514,10 +516,14 @@ hostapd_switch_chan(struct ubus_context *ctx, struct ubus_object *obj, SET_CSA_SETTING(CSA_VHT, freq_params.vht_enabled, bool); SET_CSA_SETTING(CSA_BLOCK_TX, block_tx, bool); + for (i = 0; i < hapd->iface->num_bss; i++) { + struct hostapd_data *bss = hapd->iface->bss[i]; - if (hostapd_switch_channel(hapd, &css) != 0) - return UBUS_STATUS_NOT_SUPPORTED; - return UBUS_STATUS_OK; + if (hostapd_switch_channel(bss, &css) != 0) + ret = UBUS_STATUS_NOT_SUPPORTED; + } + + return ret; #undef SET_CSA_SETTING } #endif @@ -1104,6 +1110,43 @@ void hostapd_ubus_free_bss(struct hostapd_data *hapd) free(name); } +static void +hostapd_ubus_vlan_action(struct hostapd_data *hapd, struct hostapd_vlan *vlan, + const char *action) +{ + struct vlan_description *desc = &vlan->vlan_desc; + void *c; + int i; + + if (!hapd->ubus.obj.has_subscribers) + return; + + blob_buf_init(&b, 0); + blobmsg_add_string(&b, "ifname", vlan->ifname); + blobmsg_add_string(&b, "bridge", vlan->bridge); + blobmsg_add_u32(&b, "vlan_id", vlan->vlan_id); + + if (desc->notempty) { + blobmsg_add_u32(&b, "untagged", desc->untagged); + c = blobmsg_open_array(&b, "tagged"); + for (i = 0; i < ARRAY_SIZE(desc->tagged) && desc->tagged[i]; i++) + blobmsg_add_u32(&b, "", desc->tagged[i]); + blobmsg_close_array(&b, c); + } + + ubus_notify(ctx, &hapd->ubus.obj, action, b.head, -1); +} + +void hostapd_ubus_add_vlan(struct hostapd_data *hapd, struct hostapd_vlan *vlan) +{ + hostapd_ubus_vlan_action(hapd, vlan, "vlan_add"); +} + +void hostapd_ubus_remove_vlan(struct hostapd_data *hapd, struct hostapd_vlan *vlan) +{ + hostapd_ubus_vlan_action(hapd, vlan, "vlan_remove"); +} + static const struct ubus_method daemon_methods[] = { UBUS_METHOD("config_add", hostapd_config_add, config_add_policy), UBUS_METHOD("config_remove", hostapd_config_remove, config_remove_policy), @@ -1290,3 +1333,24 @@ void hostapd_ubus_notify_beacon_report( ubus_notify(ctx, &hapd->ubus.obj, "beacon-report", b.head, -1); } + +void hostapd_ubus_notify_radar_detected(struct hostapd_iface *iface, int frequency, + int chan_width, int cf1, int cf2) +{ + struct hostapd_data *hapd; + int i; + + if (!hapd->ubus.obj.has_subscribers) + return; + + blob_buf_init(&b, 0); + blobmsg_add_u16(&b, "frequency", frequency); + blobmsg_add_u16(&b, "width", chan_width); + blobmsg_add_u16(&b, "center1", cf1); + blobmsg_add_u16(&b, "center2", cf2); + + for (i = 0; i < iface->num_bss; i++) { + hapd = iface->bss[i]; + ubus_notify(ctx, &hapd->ubus.obj, "radar-detected", b.head, -1); + } +} diff --git a/feeds/wifi-ax/hostapd/src/src/ap/ubus.h b/feeds/wifi-ax/hostapd/src/src/ap/ubus.h index e16017394..acdac7436 100644 --- a/feeds/wifi-ax/hostapd/src/src/ap/ubus.h +++ b/feeds/wifi-ax/hostapd/src/src/ap/ubus.h @@ -43,6 +43,8 @@ void hostapd_ubus_add_iface(struct hostapd_iface *iface); void hostapd_ubus_free_iface(struct hostapd_iface *iface); void hostapd_ubus_add_bss(struct hostapd_data *hapd); void hostapd_ubus_free_bss(struct hostapd_data *hapd); +void hostapd_ubus_add_vlan(struct hostapd_data *hapd, struct hostapd_vlan *vlan); +void hostapd_ubus_remove_vlan(struct hostapd_data *hapd, struct hostapd_vlan *vlan); int hostapd_ubus_handle_event(struct hostapd_data *hapd, struct hostapd_ubus_request *req); void hostapd_ubus_notify(struct hostapd_data *hapd, const char *type, const u8 *mac); @@ -50,6 +52,8 @@ void hostapd_ubus_notify_beacon_report(struct hostapd_data *hapd, const u8 *addr, u8 token, u8 rep_mode, struct rrm_measurement_beacon_report *rep, size_t len); +void hostapd_ubus_notify_radar_detected(struct hostapd_iface *iface, int frequency, + int chan_width, int cf1, int cf2); void hostapd_ubus_add(struct hapd_interfaces *interfaces); void hostapd_ubus_free(struct hapd_interfaces *interfaces); @@ -74,6 +78,14 @@ static inline void hostapd_ubus_free_bss(struct hostapd_data *hapd) { } +static inline void hostapd_ubus_add_vlan(struct hostapd_data *hapd, struct hostapd_vlan *vlan) +{ +} + +static inline void hostapd_ubus_remove_vlan(struct hostapd_data *hapd, struct hostapd_vlan *vlan) +{ +} + static inline int hostapd_ubus_handle_event(struct hostapd_data *hapd, struct hostapd_ubus_request *req) { return 0; @@ -90,6 +102,10 @@ static inline void hostapd_ubus_notify_beacon_report(struct hostapd_data *hapd, size_t len) { } +static inline void hostapd_ubus_notify_radar_detected(struct hostapd_iface *iface, int frequency, + int chan_width, int cf1, int cf2) +{ +} static inline void hostapd_ubus_add(struct hapd_interfaces *interfaces) { diff --git a/feeds/wifi-ax/iw/Makefile b/feeds/wifi-ax/iw/Makefile deleted file mode 100644 index 215265393..000000000 --- a/feeds/wifi-ax/iw/Makefile +++ /dev/null @@ -1,72 +0,0 @@ -# -# Copyright (C) 2007-2011 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -include $(TOPDIR)/rules.mk - -PKG_NAME:=iw -PKG_VERSION:=5.4 -PKG_RELEASE:=1 - -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz -PKG_SOURCE_URL:=@KERNEL/software/network/iw -PKG_HASH:=a2469f677088d7b1070a7fbb28f3c747041697e8f6ec70783339cb1bc27a395f - -PKG_MAINTAINER:=Felix Fietkau -PKG_LICENSE:=GPL-2.0 - -include $(INCLUDE_DIR)/package.mk - -define Package/iw - SECTION:=net - CATEGORY:=Network - TITLE:=cfg80211 interface configuration utility - URL:=http://wireless.kernel.org/en/users/Documentation/iw - DEPENDS:= +libnl-tiny - VARIANT:=tiny -endef - -define Package/iw-full - $(Package/iw) - TITLE += (full version) - VARIANT:=full - PROVIDES:=iw -endef - -define Build/Configure - echo "const char iw_version[] = \"$(PKG_VERSION)\";" > $(PKG_BUILD_DIR)/version.c - echo "#!/bin/sh" > $(PKG_BUILD_DIR)/version.sh - chmod +x $(PKG_BUILD_DIR)/version.sh -endef - -TARGET_CPPFLAGS:= \ - -I$(STAGING_DIR)/usr/include/libnl-tiny \ - $(TARGET_CPPFLAGS) \ - -DCONFIG_LIBNL20 \ - -D_GNU_SOURCE - -ifeq ($(BUILD_VARIANT),full) - TARGET_CPPFLAGS += -DIW_FULL - MAKE_FLAGS += IW_FULL=1 -endif - -MAKE_FLAGS += \ - CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -ffunction-sections -fdata-sections" \ - LDFLAGS="$(TARGET_LDFLAGS) -Wl,--gc-sections" \ - NL1FOUND="" NL2FOUND=Y \ - NLLIBNAME="libnl-tiny" \ - LIBS="-lm -lnl-tiny" \ - V=1 - -define Package/iw/install - $(INSTALL_DIR) $(1)/usr/sbin - $(INSTALL_BIN) $(PKG_BUILD_DIR)/iw $(1)/usr/sbin/ -endef - -Package/iw-full/install=$(Package/iw/install) - -$(eval $(call BuildPackage,iw)) -$(eval $(call BuildPackage,iw-full)) diff --git a/feeds/wifi-ax/iw/patches/001-nl80211_h_sync.patch b/feeds/wifi-ax/iw/patches/001-nl80211_h_sync.patch deleted file mode 100644 index ffd708c8f..000000000 --- a/feeds/wifi-ax/iw/patches/001-nl80211_h_sync.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- a/nl80211.h -+++ b/nl80211.h -@@ -2361,6 +2361,9 @@ enum nl80211_commands { - * @NL80211_ATTR_HE_OBSS_PD: nested attribute for OBSS Packet Detection - * functionality. - * -+ * @NL80211_ATTR_WIPHY_ANTENNA_GAIN: Configured antenna gain. Used to reduce -+ * transmit power to stay within regulatory limits. u32, dBi. -+ * - * @NUM_NL80211_ATTR: total number of nl80211_attrs available - * @NL80211_ATTR_MAX: highest attribute number currently defined - * @__NL80211_ATTR_AFTER_LAST: internal use -@@ -2820,6 +2823,8 @@ enum nl80211_attrs { - - NL80211_ATTR_HE_OBSS_PD, - -+ NL80211_ATTR_WIPHY_ANTENNA_GAIN, -+ - /* add attributes here, update the policy in nl80211.c */ - - __NL80211_ATTR_AFTER_LAST, diff --git a/feeds/wifi-ax/iw/patches/120-antenna_gain.patch b/feeds/wifi-ax/iw/patches/120-antenna_gain.patch deleted file mode 100644 index 21768d33f..000000000 --- a/feeds/wifi-ax/iw/patches/120-antenna_gain.patch +++ /dev/null @@ -1,36 +0,0 @@ ---- a/phy.c -+++ b/phy.c -@@ -740,6 +740,33 @@ COMMAND(set, antenna, " | all | - "Set a bitmap of allowed antennas to use for TX and RX.\n" - "The driver may reject antenna configurations it cannot support."); - -+static int handle_antenna_gain(struct nl80211_state *state, -+ struct nl_msg *msg, -+ int argc, char **argv, -+ enum id_input id) -+{ -+ char *endptr; -+ int dbm; -+ -+ /* get the required args */ -+ if (argc != 1) -+ return 1; -+ -+ dbm = strtol(argv[0], &endptr, 10); -+ if (*endptr) -+ return 2; -+ -+ NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_ANTENNA_GAIN, dbm); -+ -+ return 0; -+ -+ nla_put_failure: -+ return -ENOBUFS; -+} -+COMMAND(set, antenna_gain, "", -+ NL80211_CMD_SET_WIPHY, 0, CIB_PHY, handle_antenna_gain, -+ "Specify antenna gain."); -+ - static int handle_set_txq(struct nl80211_state *state, - struct nl_msg *msg, - int argc, char **argv, diff --git a/feeds/wifi-ax/iw/patches/200-reduce_size.patch b/feeds/wifi-ax/iw/patches/200-reduce_size.patch deleted file mode 100644 index 10bcff5fc..000000000 --- a/feeds/wifi-ax/iw/patches/200-reduce_size.patch +++ /dev/null @@ -1,454 +0,0 @@ ---- a/event.c -+++ b/event.c -@@ -42,6 +42,7 @@ static int parse_beacon_hint_chan(struct - return 0; - } - -+#ifdef IW_FULL - static void print_frame(struct print_event_args *args, struct nlattr *attr) - { - uint8_t *frame; -@@ -292,7 +293,7 @@ static void parse_wowlan_wake_event(stru - if (tb[NL80211_WOWLAN_TRIG_WAKEUP_TCP_NOMORETOKENS]) - printf("\t* TCP connection ran out of tokens\n"); - } -- -+#endif - static void parse_nan_term(struct nlattr **attrs) - { - struct nlattr *func[NL80211_NAN_FUNC_ATTR_MAX + 1]; -@@ -653,15 +654,18 @@ static void parse_nan_match(struct nlatt - static int print_event(struct nl_msg *msg, void *arg) - { - struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg)); -- struct nlattr *tb[NL80211_ATTR_MAX + 1], *nst; -+ struct nlattr *tb[NL80211_ATTR_MAX + 1]; - struct print_event_args *args = arg; - char ifname[100]; - char macbuf[6*3]; - __u8 reg_type; - struct ieee80211_beacon_channel chan_before_beacon, chan_after_beacon; - __u32 wiphy_idx = 0; -+#ifdef IW_FULL -+ struct nlattr *nst; - int rem_nst; - __u16 status; -+#endif - - if (args->time || args->reltime) { - unsigned long long usecs, previous; -@@ -699,6 +703,7 @@ static int print_event(struct nl_msg *ms - } - - switch (gnlh->cmd) { -+#ifdef IW_FULL - case NL80211_CMD_NEW_WIPHY: - printf("renamed to %s\n", nla_get_string(tb[NL80211_ATTR_WIPHY_NAME])); - break; -@@ -734,6 +739,7 @@ static int print_event(struct nl_msg *ms - case NL80211_CMD_SCHED_SCAN_RESULTS: - printf("got scheduled scan results\n"); - break; -+#endif - case NL80211_CMD_REG_CHANGE: - printf("regulatory domain change: "); - -@@ -812,6 +818,7 @@ static int print_event(struct nl_msg *ms - mac_addr_n2a(macbuf, nla_data(tb[NL80211_ATTR_MAC])); - printf("del station %s\n", macbuf); - break; -+#ifdef IW_FULL - case NL80211_CMD_JOIN_IBSS: - mac_addr_n2a(macbuf, nla_data(tb[NL80211_ATTR_MAC])); - printf("IBSS %s joined\n", macbuf); -@@ -976,6 +983,7 @@ static int print_event(struct nl_msg *ms - case NL80211_CMD_DEL_WIPHY: - printf("delete wiphy\n"); - break; -+#endif - case NL80211_CMD_PEER_MEASUREMENT_RESULT: - parse_pmsr_result(tb, args); - break; -@@ -990,8 +998,7 @@ static int print_event(struct nl_msg *ms - break; - } - default: -- printf("unknown event %d (%s)\n", -- gnlh->cmd, command_name(gnlh->cmd)); -+ printf("unknown event %d\n", gnlh->cmd); - break; - } - ---- a/info.c -+++ b/info.c -@@ -19,6 +19,7 @@ static void print_flag(const char *name, - *open = 1; - } - -+#ifdef IW_FULL - static char *cipher_name(__u32 c) - { - static char buf[20]; -@@ -56,6 +57,7 @@ static char *cipher_name(__u32 c) - return buf; - } - } -+#endif - - static int ext_feature_isset(const unsigned char *ext_features, int ext_features_len, - enum nl80211_ext_feature_index ftidx) -@@ -95,20 +97,21 @@ static int print_phy_handler(struct nl_m - [NL80211_FREQUENCY_ATTR_RADAR] = { .type = NLA_FLAG }, - [NL80211_FREQUENCY_ATTR_MAX_TX_POWER] = { .type = NLA_U32 }, - }; -- -+#ifdef IW_FULL - struct nlattr *tb_rate[NL80211_BITRATE_ATTR_MAX + 1]; - static struct nla_policy rate_policy[NL80211_BITRATE_ATTR_MAX + 1] = { - [NL80211_BITRATE_ATTR_RATE] = { .type = NLA_U32 }, - [NL80211_BITRATE_ATTR_2GHZ_SHORTPREAMBLE] = { .type = NLA_FLAG }, - }; -- -- struct nlattr *nl_band; -- struct nlattr *nl_freq; - struct nlattr *nl_rate; -- struct nlattr *nl_mode; - struct nlattr *nl_cmd; - struct nlattr *nl_if, *nl_ftype; -- int rem_band, rem_freq, rem_rate, rem_mode, rem_cmd, rem_ftype, rem_if; -+ int rem_rate, rem_cmd, rem_ftype, rem_if; -+#endif -+ struct nlattr *nl_band; -+ struct nlattr *nl_freq; -+ struct nlattr *nl_mode; -+ int rem_band, rem_freq, rem_mode; - int open; - /* - * static variables only work here, other applications need to use the -@@ -213,6 +216,7 @@ next: - } - } - -+#ifdef IW_FULL - 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) { -@@ -229,6 +233,7 @@ next: - printf("\n"); - } - } -+#endif - } - } - -@@ -294,6 +299,7 @@ next: - printf("\tCoverage class: %d (up to %dm)\n", coverage, 450 * coverage); - } - -+#ifdef IW_FULL - if (tb_msg[NL80211_ATTR_CIPHER_SUITES]) { - int num = nla_len(tb_msg[NL80211_ATTR_CIPHER_SUITES]) / sizeof(__u32); - int i; -@@ -305,6 +311,7 @@ next: - cipher_name(ciphers[i])); - } - } -+#endif - - if (tb_msg[NL80211_ATTR_WIPHY_ANTENNA_AVAIL_TX] && - tb_msg[NL80211_ATTR_WIPHY_ANTENNA_AVAIL_RX]) -@@ -324,11 +331,13 @@ next: - printf("\t\t * %s\n", iftype_name(nla_type(nl_mode))); - } - -+#ifdef IW_FULL - if (tb_msg[NL80211_ATTR_SOFTWARE_IFTYPES]) { - printf("\tsoftware interface modes (can always be added):\n"); - nla_for_each_nested(nl_mode, tb_msg[NL80211_ATTR_SOFTWARE_IFTYPES], rem_mode) - printf("\t\t * %s\n", iftype_name(nla_type(nl_mode))); - } -+#endif - - if (tb_msg[NL80211_ATTR_INTERFACE_COMBINATIONS]) { - struct nlattr *nl_combi; -@@ -425,6 +434,7 @@ broken_combination: - printf("\tinterface combinations are not supported\n"); - } - -+#ifdef IW_FULL - 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) -@@ -522,6 +532,7 @@ broken_combination: - printf("\t\t * wake up on TCP connection\n"); - } - } -+#endif - - if (tb_msg[NL80211_ATTR_ROAM_SUPPORT]) - printf("\tDevice supports roaming.\n"); -@@ -560,6 +571,7 @@ broken_combination: - } - } - -+#ifdef IW_FULL - if (tb_msg[NL80211_ATTR_FEATURE_FLAGS]) { - unsigned int features = nla_get_u32(tb_msg[NL80211_ATTR_FEATURE_FLAGS]); - -@@ -627,6 +639,10 @@ broken_combination: - - if (tb_msg[NL80211_ATTR_TDLS_SUPPORT]) - printf("\tDevice supports T-DLS.\n"); -+ if (features & NL80211_FEATURE_TDLS_CHANNEL_SWITCH) -+ printf("\tDevice supports TDLS channel switching\n"); -+ } -+#endif - - if (tb_msg[NL80211_ATTR_EXT_FEATURES]) { - struct nlattr *tb = tb_msg[NL80211_ATTR_EXT_FEATURES]; -@@ -732,6 +748,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); - -+#ifdef IW_FULL - static int handle_commands(struct nl80211_state *state, struct nl_msg *msg, - int argc, char **argv, enum id_input id) - { -@@ -743,6 +760,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"); -+#endif - - static int print_feature_handler(struct nl_msg *msg, void *arg) - { ---- a/scan.c -+++ b/scan.c -@@ -559,6 +559,7 @@ static void print_ssid(const uint8_t typ - #define BSS_MEMBERSHIP_SELECTOR_VHT_PHY 126 - #define BSS_MEMBERSHIP_SELECTOR_HT_PHY 127 - -+#ifdef IW_FULL - static void print_supprates(const uint8_t type, uint8_t len, - const uint8_t *data, - const struct print_ies_data *ie_buffer) -@@ -676,6 +677,7 @@ static void print_erp(const uint8_t type - printf(" Barker_Preamble_Mode"); - printf("\n"); - } -+#endif - - static void print_cipher(const uint8_t *data) - { -@@ -993,12 +995,14 @@ static void print_rsn_ie(const char *def - _print_rsn_ie(defcipher, defauth, len, data, 0); - } - -+#ifdef IW_FULL - static void print_osen_ie(const char *defcipher, const char *defauth, - uint8_t len, const uint8_t *data) - { - printf("\n\t"); - _print_rsn_ie(defcipher, defauth, len, data, 1); - } -+#endif - - static void print_rsn(const uint8_t type, uint8_t len, const uint8_t *data, - const struct print_ies_data *ie_buffer) -@@ -1016,6 +1020,7 @@ static void print_ht_capa(const uint8_t - print_ht_mcs(data + 3); - } - -+#ifdef IW_FULL - static const char* ntype_11u(uint8_t t) - { - switch (t) { -@@ -1168,6 +1173,7 @@ static void print_11u_rcon(const uint8_t - } - } - } -+#endif - - static const char *ht_secondary_offset[4] = { - "no secondary", -@@ -1195,6 +1201,7 @@ 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]); -+ return; - 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); -@@ -1207,6 +1214,7 @@ static void print_ht_op(const uint8_t ty - printf("\t\t * PCO phase: %d\n", (data[5] & 0x8) >> 3); - } - -+#ifdef IW_FULL - static void print_capabilities(const uint8_t type, uint8_t len, - const uint8_t *data, - const struct print_ies_data *ie_buffer) -@@ -1384,6 +1392,7 @@ static void print_ibssatim(const uint8_t - { - printf(" %d TUs\n", (data[1] << 8) + data[0]); - } -+#endif - - static void print_vht_capa(const uint8_t type, uint8_t len, const uint8_t *data, - const struct print_ies_data *ie_buffer) -@@ -1412,6 +1421,7 @@ static void print_vht_oper(const uint8_t - printf("\t\t * VHT basic MCS set: 0x%.2x%.2x\n", data[4], data[3]); - } - -+#ifdef IW_FULL - static void print_obss_scan_params(const uint8_t type, uint8_t len, - const uint8_t *data, - const struct print_ies_data *ie_buffer) -@@ -1426,6 +1436,7 @@ static void print_obss_scan_params(const - printf("\t\t * OBSS Scan Activity Threshold: %d.%02d %%\n", - ((data[13] << 8) | data[12]) / 100, ((data[13] << 8) | data[12]) % 100); - } -+#endif - - static void print_secchan_offs(const uint8_t type, uint8_t len, - const uint8_t *data, -@@ -1437,6 +1448,7 @@ static void print_secchan_offs(const uin - printf(" %d\n", data[0]); - } - -+#ifdef IW_FULL - static void print_bss_load(const uint8_t type, uint8_t len, const uint8_t *data, - const struct print_ies_data *ie_buffer) - { -@@ -1478,6 +1490,7 @@ static void print_mesh_conf(const uint8_ - if (data[6] & 0x40) - printf("\t\t\t Mesh Power Save Level\n"); - } -+#endif - - struct ie_print { - const char *name; -@@ -1522,6 +1535,13 @@ 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), }, -+ [45] = { "HT capabilities", print_ht_capa, 26, 26, BIT(PRINT_SCAN), }, -+ [48] = { "RSN", print_rsn, 2, 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), }, -+#ifdef IW_FULL - [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), }, -@@ -1531,14 +1551,8 @@ static const struct ie_print ieprinters[ - [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), }, - [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), }, - [113] = { "MESH Configuration", print_mesh_conf, 7, 7, BIT(PRINT_SCAN), }, - [114] = { "MESH ID", print_ssid, 0, 32, BIT(PRINT_SCAN) | BIT(PRINT_LINK), }, -@@ -1546,8 +1560,10 @@ static const struct ie_print ieprinters[ - [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, 0, 255, BIT(PRINT_SCAN), }, -+#endif - }; - -+#ifdef IW_FULL - static void print_wifi_wpa(const uint8_t type, uint8_t len, const uint8_t *data, - const struct print_ies_data *ie_buffer) - { -@@ -1822,6 +1838,7 @@ static const struct ie_print wifiprinter - [2] = { "WMM", print_wifi_wmm, 1, 255, BIT(PRINT_SCAN), }, - [4] = { "WPS", print_wifi_wps, 0, 255, BIT(PRINT_SCAN), }, - }; -+#endif - - static inline void print_p2p(const uint8_t type, uint8_t len, - const uint8_t *data, -@@ -1917,6 +1934,7 @@ static inline void print_hs20_ind(const - printf("\t\tUnexpected length: %i\n", len); - } - -+#ifdef IW_FULL - static void print_wifi_owe_tarns(const uint8_t type, uint8_t len, - const uint8_t *data, - const struct print_ies_data *ie_buffer) -@@ -2010,6 +2028,7 @@ static void print_vendor(unsigned char l - printf(" %.2x", data[i]); - printf("\n"); - } -+#endif - - void print_ies(unsigned char *ie, int ielen, bool unknown, - enum print_ie_type ptype) -@@ -2024,6 +2043,7 @@ void print_ies(unsigned char *ie, int ie - ieprinters[ie[0]].flags & BIT(ptype)) { - print_ie(&ieprinters[ie[0]], - ie[0], ie[1], ie + 2, &ie_buffer); -+#ifdef IW_FULL - } else if (ie[0] == 221 /* vendor */) { - print_vendor(ie[1], ie + 2, unknown, ptype); - } else if (unknown) { -@@ -2033,6 +2053,7 @@ void print_ies(unsigned char *ie, int ie - for (i=0; i 45000) - is_dmg = true; -+#endif - } - if (bss[NL80211_BSS_BEACON_INTERVAL]) - printf("\tbeacon interval: %d TUs\n", ---- a/util.c -+++ b/util.c -@@ -147,6 +147,7 @@ const char *iftype_name(enum nl80211_ift - return modebuf; - } - -+#ifdef IW_FULL - static const char *commands[NL80211_CMD_MAX + 1] = { - #include "nl80211-commands.inc" - }; -@@ -160,6 +161,7 @@ const char *command_name(enum nl80211_co - sprintf(cmdbuf, "Unknown command (%d)", cmd); - return cmdbuf; - } -+#endif - - int ieee80211_channel_to_frequency(int chan, enum nl80211_band band) - { diff --git a/feeds/wifi-ax/iw/patches/502-Add-channel-attribure-support-for-nl80211-message.patch b/feeds/wifi-ax/iw/patches/502-Add-channel-attribure-support-for-nl80211-message.patch deleted file mode 100644 index 37f416294..000000000 --- a/feeds/wifi-ax/iw/patches/502-Add-channel-attribure-support-for-nl80211-message.patch +++ /dev/null @@ -1,40 +0,0 @@ -Add channel attribure support for nl80211 message - ---- - info.c | 9 +++++++-- - nl80211.h | 1 + - 2 files changed, 8 insertions(+), 2 deletions(-) - ---- a/info.c -+++ b/info.c -@@ -180,13 +180,18 @@ static int print_phy_handler(struct nl_m - band_had_freq = true; - } - nla_for_each_nested(nl_freq, tb_band[NL80211_BAND_ATTR_FREQS], rem_freq) { -- uint32_t freq; -+ uint32_t freq,channel; - nla_parse(tb_freq, NL80211_FREQUENCY_ATTR_MAX, nla_data(nl_freq), - nla_len(nl_freq), freq_policy); - if (!tb_freq[NL80211_FREQUENCY_ATTR_FREQ]) - continue; - freq = nla_get_u32(tb_freq[NL80211_FREQUENCY_ATTR_FREQ]); -- printf("\t\t\t* %d MHz [%d]", freq, ieee80211_frequency_to_channel(freq)); -+ if (tb_freq[NL80211_FREQUENCY_ATTR_CHANNEL]) -+ channel = nla_get_u16(tb_freq[NL80211_FREQUENCY_ATTR_CHANNEL]); -+ else -+ channel = ieee80211_frequency_to_channel(freq); -+ printf("\t\t\t* %d MHz [%d]", freq, channel); -+ - - if (tb_freq[NL80211_FREQUENCY_ATTR_MAX_TX_POWER] && - !tb_freq[NL80211_FREQUENCY_ATTR_DISABLED]) ---- a/nl80211.h -+++ b/nl80211.h -@@ -3561,6 +3561,7 @@ enum nl80211_frequency_attr { - NL80211_FREQUENCY_ATTR_NO_20MHZ, - NL80211_FREQUENCY_ATTR_NO_10MHZ, - NL80211_FREQUENCY_ATTR_WMM, -+ NL80211_FREQUENCY_ATTR_CHANNEL, - - /* keep last */ - __NL80211_FREQUENCY_ATTR_AFTER_LAST, diff --git a/feeds/wifi-ax/iw/patches/505-Add-user-command-for-tid-specific-retry-count.patch b/feeds/wifi-ax/iw/patches/505-Add-user-command-for-tid-specific-retry-count.patch deleted file mode 100644 index 2de32399b..000000000 --- a/feeds/wifi-ax/iw/patches/505-Add-user-command-for-tid-specific-retry-count.patch +++ /dev/null @@ -1,200 +0,0 @@ ---- a/interface.c -+++ b/interface.c -@@ -727,3 +727,78 @@ COMMAND(switch, freq, - "Switch the operating channel by sending a channel switch announcement (CSA)."); - COMMAND(switch, channel, " [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz] [beacons ] [block-tx]", - NL80211_CMD_CHANNEL_SWITCH, 0, CIB_NETDEV, handle_chan, NULL); -+ -+static int handle_retry_count(struct nl80211_state *state, -+ struct nl_msg *msg, -+ int argc, char **argv, -+ enum id_input id) -+{ -+ struct nl_msg *tid = NULL; -+ unsigned char mac_addr[ETH_ALEN]; -+ uint8_t retry_short, retry_long, tid_no; -+ char *end; -+ int ret = -ENOSPC; -+ -+ if (argc < 4) -+ return 1; -+ -+ tid = nlmsg_alloc(); -+ if (!tid) -+ return -ENOMEM; -+ -+ while (argc) { -+ if (strcmp(argv[0], "tid") == 0) { -+ if (argc < 2) -+ return 1; -+ -+ tid_no = strtoul(argv[1], &end, 8); -+ if (*end) -+ return 1; -+ -+ NLA_PUT_U8(tid, NL80211_ATTR_TID, tid_no); -+ } else if (strcmp(argv[0], "peer") == 0) { -+ if (argc < 2) -+ return 1; -+ -+ if (mac_addr_a2n(mac_addr, argv[1])) { -+ fprintf(stderr, "invalid mac address\n"); -+ return 2; -+ } -+ -+ NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, mac_addr); -+ } else if (strcmp(argv[0], "short") == 0) { -+ if (argc < 2) -+ return 1; -+ -+ retry_short = strtoul(argv[1], &end, 0); -+ if (*end) -+ return 1; -+ -+ NLA_PUT_U8(tid, NL80211_ATTR_TID_RETRY_SHORT, retry_short); -+ } else if (strcmp(argv[0], "long") == 0) { -+ if (argc < 2) -+ return 1; -+ retry_long = strtoul(argv[1], &end, 0); -+ if (*end) -+ return 1; -+ -+ NLA_PUT_U8(tid, NL80211_ATTR_TID_RETRY_LONG, retry_long); -+ } else { -+ return 1; -+ } -+ argc -= 2; -+ argv += 2; -+ } -+ -+ NLA_PUT_FLAG(tid, NL80211_ATTR_TID_RETRY_CONFIG); -+ nla_put_nested(msg, NL80211_ATTR_TID_CONFIG, tid); -+ -+ ret = 0; -+ -+nla_put_failure: -+ nlmsg_free(tid); -+ return ret; -+} -+COMMAND(set, tid_retry_count, "tid <[peer ] short long ]>", -+ NL80211_CMD_SET_TID_CONFIG, 0, CIB_NETDEV, handle_retry_count, -+ "Set the retry count for the TIDs "); ---- a/nl80211.h -+++ b/nl80211.h -@@ -1101,6 +1101,10 @@ - * peer MAC address and %NL80211_ATTR_FRAME is used to specify the frame - * content. The frame is ethernet data. - * -+ * @NL80211_CMD_SET_TID_CONFIG: Data frame TID specific configuration -+ * is passed through this command using %NL80211_ATTR_TID_CONFIG -+ * nested attributes. -+ * - * @NL80211_CMD_MAX: highest used command number - * @__NL80211_CMD_AFTER_LAST: internal use - */ -@@ -1325,6 +1329,8 @@ enum nl80211_commands { - - NL80211_CMD_PROBE_MESH_LINK, - -+ NL80211_CMD_SET_TID_CONFIG, -+ - /* add new commands above here */ - - /* used to define NL80211_CMD_MAX below */ -@@ -2367,15 +2373,23 @@ enum nl80211_commands { - * functionality. - * - * @NL80211_ATTR_WIPHY_EDMG_CHANNELS: bitmap that indicates the 2.16 GHz -- * channel(s) that are allowed to be used for EDMG transmissions. -- * Defined by IEEE P802.11ay/D4.0 section 9.4.2.251. (u8 attribute) -+ * channel(s) that are allowed to be used for EDMG transmissions. -+ * Defined by IEEE P802.11ay/D4.0 section 9.4.2.251. (u8 attribute) - * @NL80211_ATTR_WIPHY_EDMG_BW_CONFIG: Channel BW Configuration subfield encodes -- * the allowed channel bandwidth configurations. (u8 attribute) -- * Defined by IEEE P802.11ay/D4.0 section 9.4.2.251, Table 13. -+ * the allowed channel bandwidth configurations. (u8 attribute) -+ * Defined by IEEE P802.11ay/D4.0 section 9.4.2.251, Table 13. -+ * -+ * @NL80211_ATTR_VLAN_ID: VLAN ID (1..4094) for the station and VLAN group key -+ * (u16). - * - * @NL80211_ATTR_WIPHY_ANTENNA_GAIN: Configured antenna gain. Used to reduce - * transmit power to stay within regulatory limits. u32, dBi. - * -+ * @NL80211_ATTR_TID_CONFIG: TID specific configuration in a -+ * nested attribute with %NL80211_ATTR_TID_* sub-attributes. -+ * @NL80211_ATTR_MAX_RETRY_COUNT: The upper limit for the retry count -+ * configuration that the driver can accept. -+ * - * @NUM_NL80211_ATTR: total number of nl80211_attrs available - * @NL80211_ATTR_MAX: highest attribute number currently defined - * @__NL80211_ATTR_AFTER_LAST: internal use -@@ -2838,6 +2852,11 @@ enum nl80211_attrs { - NL80211_ATTR_WIPHY_EDMG_CHANNELS, - NL80211_ATTR_WIPHY_EDMG_BW_CONFIG, - -+ NL80211_ATTR_VLAN_ID, -+ -+ NL80211_ATTR_TID_CONFIG, -+ NL80211_ATTR_MAX_RETRY_COUNT, -+ - NL80211_ATTR_WIPHY_ANTENNA_GAIN, - - /* add attributes here, update the policy in nl80211.c */ -@@ -4601,7 +4620,55 @@ enum nl80211_ps_state { - NL80211_PS_DISABLED, - NL80211_PS_ENABLED, - }; -- -+/* -+ * @NL80211_ATTR_TID: a TID value (u8 attribute) -+ * @NL80211_ATTR_TID_RETRY_CONFIG: Data frame retry count should be -+ * applied with the value passed through %NL80211_ATTR_RETRY_LONG -+ * and/or %NL80211_ATTR_RETRY_SHORT. This configuration is per-TID, -+ * TID is specified with %NL80211_ATTR_TID. If the peer MAC address -+ * is passed in %NL80211_ATTR_MAC, the retry configuration is applied -+ * to the data frame for the tid to that connected station. -+ * This attribute will be useful to notfiy the driver to apply default -+ * retry values for the connected station (%NL80211_ATTR_MAC), when the -+ * command received without %NL80211_ATTR_RETRY_LONG and/or -+ * %NL80211_ATTR_RETRY_SHORT. -+ * Station specific retry configuration is valid only for STA's -+ * current connection. i.e. the configuration will be reset to default when -+ * the station connects back after disconnection/roaming. -+ * when user-space does not include %NL80211_ATTR_MAC, this configuration -+ * should be treated as per-netdev configuration. This configuration will -+ * be cleared when the interface goes down and on the disconnection from a -+ * BSS. When retry count has never been configured using this command, the -+ * other available radio level retry configuration -+ * (%NL80211_ATTR_WIPHY_RETRY_SHORT and %NL80211_ATTR_WIPHY_RETRY_LONG) -+ * should be used. Driver supporting this feature should advertise -+ * NL80211_EXT_FEATURE_PER_TID_RETRY_CONFIG and supporting per station -+ * retry count configuration should advertise -+ * NL80211_EXT_FEATURE_PER_STA_RETRY_CONFIG. -+ * @NL80211_ATTR_TID_RETRY_SHORT: Number of retries used with data frame -+ * transmission, user-space sets this configuration in -+ * &NL80211_CMD_SET_TID_CONFIG. Its type is u8, min value is 1 and -+ * the max value should be advertised by the driver through -+ * max_data_retry_count. when this attribute is not present, the driver -+ * would use the default configuration. -+ * @NL80211_ATTR_TID_RETRY_LONG: Number of retries used with data frame -+ * transmission, user-space sets this configuration in -+ * &NL80211_CMD_SET_TID_CONFIG. Its type is u8, min value is 1 and -+ * the max value should be advertised by the driver through -+ * max_data_retry_count. when this attribute is not present, the driver -+ * would use the default configuration. -+ */ -+enum nl80211_attr_tid_config { -+ __NL80211_ATTR_TID_INVALID, -+ NL80211_ATTR_TID, -+ NL80211_ATTR_TID_RETRY_CONFIG, -+ NL80211_ATTR_TID_RETRY_SHORT, -+ NL80211_ATTR_TID_RETRY_LONG, -+ -+ /* keep last */ -+ __NL80211_ATTR_TID_AFTER_LAST, -+ NL80211_ATTR_TID_MAX = __NL80211_ATTR_TID_AFTER_LAST - 1 -+}; - /** - * enum nl80211_attr_cqm - connection quality monitor attributes - * @__NL80211_ATTR_CQM_INVALID: invalid diff --git a/feeds/wifi-ax/iw/patches/506-Add-user-command-for-tid-specific-aggr-conf.patch b/feeds/wifi-ax/iw/patches/506-Add-user-command-for-tid-specific-aggr-conf.patch deleted file mode 100644 index c589560ca..000000000 --- a/feeds/wifi-ax/iw/patches/506-Add-user-command-for-tid-specific-aggr-conf.patch +++ /dev/null @@ -1,114 +0,0 @@ ---- a/interface.c -+++ b/interface.c -@@ -802,3 +802,68 @@ nla_put_failure: - COMMAND(set, tid_retry_count, "tid <[peer ] short long ]>", - NL80211_CMD_SET_TID_CONFIG, 0, CIB_NETDEV, handle_retry_count, - "Set the retry count for the TIDs "); -+ -+static int handle_aggr_conf(struct nl80211_state *state, -+ struct nl_msg *msg, -+ int argc, char **argv, -+ enum id_input id) -+{ -+ struct nl_msg *tid = NULL; -+ unsigned char mac_addr[ETH_ALEN]; -+ uint8_t tid_no; -+ char *end; -+ int ret = -ENOSPC; -+ -+ if (argc < 4) -+ return 1; -+ -+ tid = nlmsg_alloc(); -+ if (!tid) -+ return -ENOMEM; -+ -+ while (argc) { -+ if (strcmp(argv[0], "tid") == 0) { -+ if (argc < 2) -+ return 1; -+ -+ tid_no = strtoul(argv[1], &end, 8); -+ if (*end) -+ return 1; -+ -+ NLA_PUT_U8(tid, NL80211_ATTR_TID, tid_no); -+ } else if (strcmp(argv[0], "peer") == 0) { -+ if (argc < 2) -+ return 1; -+ -+ if (mac_addr_a2n(mac_addr, argv[1])) { -+ fprintf(stderr, "invalid mac address\n"); -+ return 2; -+ } -+ -+ NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, mac_addr); -+ } else if (strcmp(argv[0], "aggr") == 0) { -+ if (argc < 2) -+ return 1; -+ if (strcmp(argv[1], "on") == 0) -+ NLA_PUT_U8(tid, NL80211_ATTR_TID_AMPDU_AGGR_CTRL, 1); -+ else if (strcmp(argv[1], "off") == 0) -+ NLA_PUT_U8(tid, NL80211_ATTR_TID_AMPDU_AGGR_CTRL, 0); -+ else -+ return 1; -+ } else { -+ return 1; -+ } -+ argc -= 2; -+ argv += 2; -+ } -+ -+ nla_put_nested(msg, NL80211_ATTR_TID_CONFIG, tid); -+ ret = 0; -+ -+nla_put_failure: -+ nlmsg_free(tid); -+ return ret; -+} -+COMMAND(set, tid_aggr_conf, "tid <[peer ] aggr on|off>", -+ NL80211_CMD_SET_TID_CONFIG, 0, CIB_NETDEV, handle_aggr_conf, -+ "Enable/disable aggregation for the TIDs "); ---- a/nl80211.h -+++ b/nl80211.h -@@ -4635,17 +4635,32 @@ enum nl80211_ps_state { - * the max value should be advertised by the driver through - * max_data_retry_count. when this attribute is not present, the driver - * would use the default configuration. -+ * @NL80211_ATTR_TID_AMPDU_AGGR_CTRL: Enable/Disable aggregation for the TID -+ * specified in %%NL80211_ATTR_TID. Its type is u8, if the peer MAC address -+ * is passed in %NL80211_ATTR_MAC, the aggregation configuration is applied -+ * to the data frame for the tid to that connected station. -+ * Station specific aggregation configuration is valid only for STA's -+ * current connection. i.e. the configuration will be reset to default when -+ * the station connects back after disconnection/roaming. -+ * when user-space does not include %NL80211_ATTR_MAC, this configuration -+ * should be treated as per-netdev configuration. This configuration will -+ * be cleared when the interface goes down and on the disconnection from a -+ * BSS. Driver supporting this feature should advertise -+ * NL80211_EXT_FEATURE_PER_STA_AMPDU_AGGR_CTRL and supporting per station -+ * aggregation configuration should advertise -+ * NL80211_EXT_FEATURE_PER_STA_AMPDU_AGGR_CTRL. - */ - enum nl80211_attr_tid_config { -- __NL80211_ATTR_TID_INVALID, -- NL80211_ATTR_TID, -- NL80211_ATTR_TID_RETRY_CONFIG, -- NL80211_ATTR_TID_RETRY_SHORT, -- NL80211_ATTR_TID_RETRY_LONG, -+ __NL80211_ATTR_TID_INVALID, -+ NL80211_ATTR_TID, -+ NL80211_ATTR_TID_RETRY_CONFIG, -+ NL80211_ATTR_TID_RETRY_SHORT, -+ NL80211_ATTR_TID_RETRY_LONG, -+ NL80211_ATTR_TID_AMPDU_AGGR_CTRL, - -- /* keep last */ -- __NL80211_ATTR_TID_AFTER_LAST, -- NL80211_ATTR_TID_MAX = __NL80211_ATTR_TID_AFTER_LAST - 1 -+ /* keep last */ -+ __NL80211_ATTR_TID_AFTER_LAST, -+ NL80211_ATTR_TID_MAX = __NL80211_ATTR_TID_AFTER_LAST - 1 - }; - /** - * enum nl80211_attr_cqm - connection quality monitor attributes diff --git a/feeds/wifi-ax/iw/patches/507-Add-peer-address-in-noack-map-command b/feeds/wifi-ax/iw/patches/507-Add-peer-address-in-noack-map-command deleted file mode 100644 index 665cc21f5..000000000 --- a/feeds/wifi-ax/iw/patches/507-Add-peer-address-in-noack-map-command +++ /dev/null @@ -1,54 +0,0 @@ ---- a/interface.c -+++ b/interface.c -@@ -579,23 +579,43 @@ static int handle_interface_noack_map(st - enum id_input id) - { - uint16_t noack_map; -+ unsigned char mac_addr[ETH_ALEN]; - char *end; - -- if (argc != 1) -+ if (argc < 1) - return 1; - -- noack_map = strtoul(argv[0], &end, 16); -- if (*end) -- return 1; -- -- NLA_PUT_U16(msg, NL80211_ATTR_NOACK_MAP, noack_map); -+ if (strcmp(argv[0], "peer") == 0) { -+ if (argc < 2) -+ return 1; -+ -+ if (mac_addr_a2n(mac_addr, argv[1])) { -+ fprintf(stderr, "Invalid MAC address\n"); -+ return 2; -+ } -+ -+ NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, mac_addr); -+ argc -= 2; -+ argv += 2; -+ } -+ -+ if (argc) { -+ if (argc > 1) -+ return 1; -+ -+ noack_map = strtoul(argv[0], &end, 16); -+ if (*end) -+ return 1; -+ NLA_PUT_U16(msg, NL80211_ATTR_NOACK_MAP, noack_map); -+ } - - return 0; -- nla_put_failure: -+ -+nla_put_failure: - return -ENOBUFS; - - } --COMMAND(set, noack_map, "", -+COMMAND(set, noack_map, "<[peer ] [map]>", - NL80211_CMD_SET_NOACK_MAP, 0, CIB_NETDEV, handle_interface_noack_map, - "Set the NoAck map for the TIDs. (0x0009 = BE, 0x0006 = BK, 0x0030 = VI, 0x00C0 = VO)"); - diff --git a/feeds/wifi-ax/iw/patches/508-iw-add-airtime-weight-config-support.patch b/feeds/wifi-ax/iw/patches/508-iw-add-airtime-weight-config-support.patch deleted file mode 100644 index c14fc5a49..000000000 --- a/feeds/wifi-ax/iw/patches/508-iw-add-airtime-weight-config-support.patch +++ /dev/null @@ -1,107 +0,0 @@ ---- a/station.c -+++ b/station.c -@@ -321,9 +321,10 @@ static int print_sta_handler(struct nl_m - [NL80211_STA_INFO_TID_STATS] = { .type = NLA_NESTED }, - [NL80211_STA_INFO_BSS_PARAM] = { .type = NLA_NESTED }, - [NL80211_STA_INFO_RX_DURATION] = { .type = NLA_U64 }, -- [NL80211_STA_INFO_TX_DURATION] = { .type = NLA_U64 }, - [NL80211_STA_INFO_ACK_SIGNAL] = {.type = NLA_U8 }, - [NL80211_STA_INFO_ACK_SIGNAL_AVG] = { .type = NLA_U8 }, -+ [NL80211_STA_INFO_TX_DURATION] = {.type = NLA_U64}, -+ [NL80211_STA_INFO_AIRTIME_WEIGHT] = {.type = NLA_U16}, - }; - char *chain; - -@@ -414,10 +415,6 @@ static int print_sta_handler(struct nl_m - printf("\n\ttx bitrate:\t%s", buf); - } - -- if (sinfo[NL80211_STA_INFO_TX_DURATION]) -- printf("\n\ttx duration:\t%lld us", -- (unsigned long long)nla_get_u64(sinfo[NL80211_STA_INFO_TX_DURATION])); -- - if (sinfo[NL80211_STA_INFO_RX_BITRATE]) { - char buf[100]; - -@@ -437,6 +434,10 @@ static int print_sta_handler(struct nl_m - printf("\n\tavg ack signal:\t%d dBm", - (int8_t)nla_get_u8(sinfo[NL80211_STA_INFO_ACK_SIGNAL_AVG])); - -+ if (sinfo[NL80211_STA_INFO_TX_DURATION]) -+ printf("\n\ttx duration:\t%lld us", -+ (unsigned long long)nla_get_u64(sinfo[NL80211_STA_INFO_TX_DURATION])); -+ - if (sinfo[NL80211_STA_INFO_AIRTIME_WEIGHT]) { - printf("\n\tairtime weight: %d", nla_get_u16(sinfo[NL80211_STA_INFO_AIRTIME_WEIGHT])); - } -@@ -671,6 +672,7 @@ COMMAND(station, del, " [su - - static const struct cmd *station_set_plink; - static const struct cmd *station_set_vlan; -+static const struct cmd *station_set_airtime; - static const struct cmd *station_set_mesh_power_mode; - static const struct cmd *station_set_airtime_weight; - static const struct cmd *station_set_txpwr; -@@ -683,6 +685,8 @@ static const struct cmd *select_station_ - return station_set_plink; - if (strcmp(argv[1], "vlan") == 0) - return station_set_vlan; -+ if (strcmp(argv[1], "airtime") == 0) -+ return station_set_airtime; - if (strcmp(argv[1], "mesh_power_mode") == 0) - return station_set_mesh_power_mode; - if (strcmp(argv[1], "airtime_weight") == 0) -@@ -788,6 +792,53 @@ COMMAND_ALIAS(station, set, " airtime ", -+ NL80211_CMD_SET_STATION, 0, CIB_NETDEV, handle_station_set_airtime, -+ "Set airtime weight for this station.", -+ select_station_cmd, station_set_airtime); -+ - static int handle_station_set_mesh_power_mode(struct nl80211_state *state, - struct nl_msg *msg, - int argc, char **argv, diff --git a/feeds/wifi-ax/iw/patches/510-iw-wifi-config-vendor.patch b/feeds/wifi-ax/iw/patches/510-iw-wifi-config-vendor.patch deleted file mode 100644 index 00f78d532..000000000 --- a/feeds/wifi-ax/iw/patches/510-iw-wifi-config-vendor.patch +++ /dev/null @@ -1,71 +0,0 @@ ---- a/iw.h -+++ b/iw.h -@@ -62,6 +62,19 @@ enum id_input { - II_WDEV, - }; - -+/* Attributes for data used by -+ * QCA_NL80211_VENDOR_SUBCMD_SET_WIFI_CONFIGURATION and -+ * QCA_NL80211_VENDOR_SUBCMD_GET_WIFI_CONFIGURATION subcommands. -+ */ -+enum qca_wlan_vendor_attr_config { -+ QCA_WLAN_VENDOR_ATTR_CONFIG_GTX = 57, -+ -+ /* keep last */ -+ QCA_WLAN_VENDOR_ATTR_CONFIG_AFTER_LAST, -+ QCA_WLAN_VENDOR_ATTR_CONFIG_MAX = -+ QCA_WLAN_VENDOR_ATTR_CONFIG_AFTER_LAST - 1, -+}; -+ - #define HANDLER_RET_USAGE 1 - #define HANDLER_RET_DONE 3 - ---- a/vendor.c -+++ b/vendor.c -@@ -78,9 +78,12 @@ static int handle_vendor(struct nl80211_ - { - unsigned int oui; - unsigned int subcmd; -+ struct nlattr *params; - char buf[2048] = {}; - int res, count = 0; - FILE *file = NULL; -+ char *end; -+ unsigned int ap_ps; - - if (argc < 3) - return 1; -@@ -105,6 +108,33 @@ static int handle_vendor(struct nl80211_ - NLA_PUT_U32(msg, NL80211_ATTR_VENDOR_ID, oui); - NLA_PUT_U32(msg, NL80211_ATTR_VENDOR_SUBCMD, subcmd); - -+ if (subcmd == 0x4a) { -+ argc -= 2; -+ argv += 2; -+ -+ if (!argc) -+ return 1; -+ -+ params = nla_nest_start(msg, NL80211_ATTR_VENDOR_DATA | NLA_F_NESTED); -+ -+ if (!strcmp(argv[0], "ap-ps")) { -+ if (argc < 2) -+ return 1; -+ ap_ps = strtol(argv[1], &end, 10); -+ if (*end) -+ return 2; -+ -+ if (ap_ps > 1) -+ return -EINVAL; -+ -+ if (ap_ps) -+ NLA_PUT_FLAG(msg, QCA_WLAN_VENDOR_ATTR_CONFIG_GTX); -+ } -+ -+ nla_nest_end(msg, params); -+ return 0; -+ } -+ - if (file) { - count = read_file(file, buf, sizeof(buf)); - if (file != stdin) diff --git a/feeds/wifi-ax/iw/patches/512-iw-add-wide-band-scan-support.patch b/feeds/wifi-ax/iw/patches/512-iw-add-wide-band-scan-support.patch deleted file mode 100644 index d37613c3c..000000000 --- a/feeds/wifi-ax/iw/patches/512-iw-add-wide-band-scan-support.patch +++ /dev/null @@ -1,138 +0,0 @@ ---- a/scan.c -+++ b/scan.c -@@ -378,19 +378,23 @@ static int handle_scan(struct nl80211_st - enum { - NONE, - FREQ, -+ MODE, -+ CHECK_SCAN_FLAG_AP, - IES, - SSID, - MESHID, - DURATION, - DONE, - } parse = NONE; -- int freq; -+ int freq = 0; - unsigned int duration = 0; - bool passive = false, have_ssids = false, have_freqs = false; -+ bool have_chandef = false; - bool duration_mandatory = false; - size_t ies_len = 0, meshid_len = 0; - unsigned char *ies = NULL, *meshid = NULL, *tmpies = NULL; - unsigned int flags = 0; -+ struct chandef chandef; - - ssids = nlmsg_alloc(); - if (!ssids) -@@ -407,7 +411,6 @@ static int handle_scan(struct nl80211_st - case NONE: - if (strcmp(argv[i], "freq") == 0) { - parse = FREQ; -- have_freqs = true; - break; - } else if (strcmp(argv[i], "ies") == 0) { - parse = IES; -@@ -451,15 +454,35 @@ static int handle_scan(struct nl80211_st - err = 1; - goto nla_put_failure; - case FREQ: -- freq = strtoul(argv[i], &eptr, 10); -- if (eptr != argv[i] + strlen(argv[i])) { -- /* failed to parse as number -- maybe a tag? */ -- i--; -- parse = NONE; -- continue; -+ parse_freqchan(&chandef, false, argc - i, argv + i, NULL); -+ -+ if (!chandef.control_freq || have_freqs) { -+ freq = strtoul(argv[i], &eptr, 10); -+ if (eptr != argv[i] + strlen(argv[i])) { -+ /* failed to parse as number -- maybe a tag? */ -+ i--; -+ parse = NONE; -+ continue; -+ } -+ NLA_PUT_U32(freqs, i, freq); -+ } else { -+ if (chandef.width == NL80211_CHAN_WIDTH_20_NOHT){ -+ have_freqs = true; -+ NLA_PUT_U32(freqs, i, chandef.control_freq); -+ } else { -+ parse = MODE; -+ } - } - NLA_PUT_U32(freqs, i, freq); - break; -+ case MODE: -+ have_chandef = true; -+ parse = CHECK_SCAN_FLAG_AP; -+ break; -+ case CHECK_SCAN_FLAG_AP: -+ if (strcmp(argv[i], "ap-force") == 0) -+ flags |= NL80211_SCAN_FLAG_AP; -+ break; - case IES: - if (ies) - free(ies); -@@ -506,8 +529,11 @@ static int handle_scan(struct nl80211_st - if (!passive) - nla_put_nested(msg, NL80211_ATTR_SCAN_SSIDS, ssids); - -- if (have_freqs) -+ if (have_chandef) -+ put_chandef(msg, &chandef); -+ else if (have_freqs) - nla_put_nested(msg, NL80211_ATTR_SCAN_FREQUENCIES, freqs); -+ - if (flags) - NLA_PUT_U32(msg, NL80211_ATTR_SCAN_FLAGS, flags); - if (duration) -@@ -2344,20 +2370,24 @@ static int handle_scan_combined(struct n - dump_argv[0] = argv[0]; - return handle_cmd(state, id, dump_argc, dump_argv); - } --TOPLEVEL(scan, "[-u] [freq *] [duration ] [ies ] [meshid ] [lowpri,flush,ap-force,duration-mandatory] [randomise[=/]] [ssid *|passive]", 0, 0, -+TOPLEVEL(scan, "[-u] [freq *] [HT40+|HT40-|80MHz] [duration ] [ies ] [meshid ] [lowpri,flush,ap-force,duration-mandatory] [randomise[=/]] [ssid *|passive]", 0, 0, - CIB_NETDEV, handle_scan_combined, - "Scan on the given frequencies and probe for the given SSIDs\n" - "(or wildcard if not given) unless passive scanning is requested.\n" -+ "If channel mode/width is provided along with frequency, only \n" -+ "scanning on primary frequency of channel mode/width is done.\n" - "If -u is specified print unknown data in the scan results.\n" - "Specified (vendor) IEs must be well-formed."); - COMMAND(scan, dump, "[-u]", - NL80211_CMD_GET_SCAN, NLM_F_DUMP, CIB_NETDEV, handle_scan_dump, - "Dump the current scan results. If -u is specified, print unknown\n" - "data in scan results."); --COMMAND(scan, trigger, "[freq *] [duration ] [ies ] [meshid ] [lowpri,flush,ap-force,duration-mandatory] [randomise[=/]] [ssid *|passive]", -+COMMAND(scan, trigger, "[freq *] [HT40+|HT40-|80MHz] [duration ] [ies ] [meshid ] [lowpri,flush,ap-force,duration-mandatory] [randomise[=/]] [ssid *|passive]", - NL80211_CMD_TRIGGER_SCAN, 0, CIB_NETDEV, handle_scan, - "Trigger a scan on the given frequencies with probing for the given\n" - "SSIDs (or wildcard if not given) unless passive scanning is requested.\n" -+ "If channel mode/width is provided along with frequency, only \n" -+ "scanning on primary frequency of channel mode/width is done.\n" - "Duration(in TUs), if specified, will be used to set dwell times.\n"); - - ---- a/util.c -+++ b/util.c -@@ -613,6 +613,9 @@ int parse_freqchan(struct chandef *chand - - if (!argv[0]) - goto out; -+ -+ memset(chandef, 0, sizeof(struct chandef)); -+ - freq = strtoul(argv[0], &end, 10); - if (*end) { - res = 1; -@@ -621,8 +624,6 @@ int parse_freqchan(struct chandef *chand - - _parsed += 1; - -- memset(chandef, 0, sizeof(struct chandef)); -- - if (chan) { - enum nl80211_band band; - diff --git a/feeds/wifi-ax/iw/patches/513-iw-add-HE-rate-gi-ltf-support.patch b/feeds/wifi-ax/iw/patches/513-iw-add-HE-rate-gi-ltf-support.patch deleted file mode 100644 index fbbae5569..000000000 --- a/feeds/wifi-ax/iw/patches/513-iw-add-HE-rate-gi-ltf-support.patch +++ /dev/null @@ -1,398 +0,0 @@ -From ebd46629ad718be6811c66bed748f61d9ea67f1b Mon Sep 17 00:00:00 2001 -From: Miles Hu -Date: Tue, 5 Nov 2019 14:49:16 -0800 -Subject: [PATCH] iw: add HE rate/gi/ltf support - -Signed-off-by: Miles Hu ---- - bitrate.c | 172 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++------ - nl80211.h | 24 +++++++++ - 2 files changed, 181 insertions(+), 15 deletions(-) - ---- a/bitrate.c -+++ b/bitrate.c -@@ -4,13 +4,22 @@ - #include "iw.h" - - --static int parse_vht_chunk(const char *arg, __u8 *nss, __u16 *mcs) -+static int parse_rate_chunk(const char *arg, __u8 *nss, __u16 *mcs, unsigned int mode) - { - unsigned int count, i; -- unsigned int inss, mcs_start, mcs_end, tab[10]; -+ unsigned int inss, mcs_start, mcs_end, tab[12]; -+ unsigned int max_mcs = 0, max_nss = 0; - - *nss = 0; *mcs = 0; - -+ if (mode == NL80211_TXRATE_HE) { -+ max_mcs = 11; -+ max_nss = NL80211_HE_NSS_MAX; -+ } else { -+ max_mcs = 9; -+ max_nss = NL80211_VHT_NSS_MAX; -+ } -+ - if (strchr(arg, '-')) { - /* Format: NSS:MCS_START-MCS_END */ - count = sscanf(arg, "%u:%u-%u", &inss, &mcs_start, &mcs_end); -@@ -18,13 +27,13 @@ static int parse_vht_chunk(const char *a - if (count != 3) - return 0; - -- if (inss < 1 || inss > NL80211_VHT_NSS_MAX) -+ if (inss < 1 || inss > max_nss) - return 0; - - if (mcs_start > mcs_end) - return 0; - -- if (mcs_start > 9 || mcs_end > 9) -+ if (mcs_start > max_mcs || mcs_end > max_mcs) - return 0; - - *nss = inss; -@@ -33,19 +42,26 @@ static int parse_vht_chunk(const char *a - - } else { - /* Format: NSS:MCSx,MCSy,... */ -- count = sscanf(arg, "%u:%u,%u,%u,%u,%u,%u,%u,%u,%u,%u", &inss, -- &tab[0], &tab[1], &tab[2], &tab[3], &tab[4], &tab[5], -- &tab[6], &tab[7], &tab[8], &tab[9]); -+ if (mode == NL80211_TXRATE_HE) { -+ count = sscanf(arg, "%u:%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u", -+ &inss, &tab[0], &tab[1], &tab[2], &tab[3], -+ &tab[4], &tab[5], &tab[6], &tab[7], &tab[8], -+ &tab[9], &tab[10], &tab[11]); -+ } else { -+ count = sscanf(arg, "%u:%u,%u,%u,%u,%u,%u,%u,%u,%u,%u", &inss, -+ &tab[0], &tab[1], &tab[2], &tab[3], &tab[4], -+ &tab[5], &tab[6], &tab[7], &tab[8], &tab[9]); -+ } - - if (count < 2) - return 0; - -- if (inss < 1 || inss > NL80211_VHT_NSS_MAX) -+ if (inss < 1 || inss > max_nss) - return 0; - - *nss = inss; - for (i = 0; i < count - 1; i++) { -- if (tab[i] > 9) -+ if (tab[i] > max_mcs) - return 0; - *mcs |= 1 << tab[i]; - } -@@ -54,6 +70,16 @@ static int parse_vht_chunk(const char *a - return 1; - } - -+static int parse_vht_chunk(const char *arg, __u8 *nss, __u16 *mcs) -+{ -+ return parse_rate_chunk(arg, nss, mcs, NL80211_TXRATE_VHT); -+} -+ -+static int parse_he_chunk(const char *arg, __u8 *nss, __u16 *mcs) -+{ -+ return parse_rate_chunk(arg, nss, mcs, NL80211_TXRATE_HE); -+} -+ - static int setup_vht(struct nl80211_txrate_vht *txrate_vht, - int argc, char **argv) - { -@@ -74,6 +100,45 @@ static int setup_vht(struct nl80211_txra - return 1; - } - -+static int setup_he(struct nl80211_txrate_he *txrate_he, -+ int argc, char **argv) -+{ -+ __u8 nss; -+ __u16 mcs; -+ int i; -+ -+ memset(txrate_he, 0, sizeof(*txrate_he)); -+ -+ for (i = 0; i < argc; i++) { -+ if (!parse_he_chunk(argv[i], &nss, &mcs)) -+ return 0; -+ -+ nss--; -+ txrate_he->mcs[nss] |= mcs; -+ } -+ -+ return 1; -+} -+ -+#define HE_GI_STR_MAX 16 -+#define HE_GI_08_STR "0.8" -+#define HE_GI_16_STR "1.6" -+#define HE_GI_32_STR "3.2" -+int parse_he_gi(char *he_gi) -+{ -+ if (he_gi == NULL) -+ return 0; -+ -+ if (!strncmp(he_gi, HE_GI_08_STR, sizeof(HE_GI_08_STR))) -+ return NL80211_RATE_INFO_HE_GI_0_8; -+ if (!strncmp(he_gi, HE_GI_16_STR, sizeof(HE_GI_16_STR))) -+ return NL80211_RATE_INFO_HE_GI_1_6; -+ if (!strncmp(he_gi, HE_GI_32_STR, sizeof(HE_GI_32_STR))) -+ return NL80211_RATE_INFO_HE_GI_3_2; -+ -+ return -1; -+} -+ - #define VHT_ARGC_MAX 100 - - static int handle_bitrates(struct nl80211_state *state, -@@ -90,24 +155,35 @@ static int handle_bitrates(struct nl8021 - int *n_legacy = NULL; - bool have_ht_mcs_24 = false, have_ht_mcs_5 = false; - bool have_vht_mcs_24 = false, have_vht_mcs_5 = false; -+ bool have_he_mcs_24 = false, have_he_mcs_5 = false; - uint8_t ht_mcs_24[77], ht_mcs_5[77]; - int n_ht_mcs_24 = 0, n_ht_mcs_5 = 0; - struct nl80211_txrate_vht txrate_vht_24 = {}; - struct nl80211_txrate_vht txrate_vht_5 = {}; -+ struct nl80211_txrate_he txrate_he_24 = {}; -+ struct nl80211_txrate_he txrate_he_5 = {}; - uint8_t *mcs = NULL; - int *n_mcs = NULL; - char *vht_argv_5[VHT_ARGC_MAX] = {}; char *vht_argv_24[VHT_ARGC_MAX] = {}; -- char **vht_argv = NULL; -+ char *he_argv_5[VHT_ARGC_MAX] = {}; char *he_argv_24[VHT_ARGC_MAX] = {}; -+ char **vht_argv = NULL, **he_argv = NULL; - int vht_argc_5 = 0; int vht_argc_24 = 0; -- int *vht_argc = NULL; -+ int he_argc_5 = 0; int he_argc_24 = 0; -+ int *vht_argc = NULL, *he_argc = NULL; - int sgi_24 = 0, sgi_5 = 0, lgi_24 = 0, lgi_5 = 0; -+ int has_he_gi_24 = 0, has_he_gi_5 = 0, has_he_ltf_24 = 0, has_he_ltf_5 = 0; -+ int he_gi = 0, he_ltf = 0; -+ char *he_gi_argv = NULL; - - enum { - S_NONE, - S_LEGACY, - S_HT, - S_VHT, -+ S_HE, - S_GI, -+ S_HE_GI, -+ S_HE_LTF, - } parser_state = S_NONE; - - for (i = 0; i < argc; i++) { -@@ -158,6 +234,20 @@ static int handle_bitrates(struct nl8021 - vht_argv = vht_argv_5; - vht_argc = &vht_argc_5; - have_vht_mcs_5 = true; -+ } else if (strcmp(argv[i], "he-mcs-2.4") == 0) { -+ if (have_he_mcs_24) -+ return 1; -+ parser_state = S_HE; -+ he_argv = he_argv_24; -+ he_argc = &he_argc_24; -+ have_he_mcs_24 = true; -+ } else if (strcmp(argv[i], "he-mcs-5") == 0) { -+ if (have_he_mcs_5) -+ return 1; -+ parser_state = S_HE; -+ he_argv = he_argv_5; -+ he_argc = &he_argc_5; -+ have_he_mcs_5 = true; - } else if (strcmp(argv[i], "sgi-2.4") == 0) { - sgi_24 = 1; - parser_state = S_GI; -@@ -170,6 +260,18 @@ static int handle_bitrates(struct nl8021 - } else if (strcmp(argv[i], "lgi-5") == 0) { - lgi_5 = 1; - parser_state = S_GI; -+ } else if (strcmp(argv[i], "he-gi-2.4") == 0) { -+ has_he_gi_24 = 1; -+ parser_state = S_HE_GI; -+ } else if (strcmp(argv[i], "he-gi-5") == 0) { -+ has_he_gi_5 = 1; -+ parser_state = S_HE_GI; -+ } else if (strcmp(argv[i], "he-ltf-2.4") == 0) { -+ has_he_ltf_24 = 1; -+ parser_state = S_HE_LTF; -+ } else if (strcmp(argv[i], "he-ltf-5") == 0) { -+ has_he_ltf_5 = 1; -+ parser_state = S_HE_LTF; - } else switch (parser_state) { - case S_LEGACY: - tmpd = strtod(argv[i], &end); -@@ -192,8 +294,24 @@ static int handle_bitrates(struct nl8021 - return 1; - vht_argv[(*vht_argc)++] = argv[i]; - break; -+ case S_HE: -+ if (*he_argc >= VHT_ARGC_MAX) -+ return 1; -+ he_argv[(*he_argc)++] = argv[i]; -+ break; - case S_GI: - break; -+ case S_HE_GI: -+ he_gi_argv = argv[i]; -+ break; -+ case S_HE_LTF: -+ he_ltf = strtol(argv[i], &end, 0); -+ if (*end != '\0') -+ return 1; -+ if (he_ltf < 0 || he_ltf > 4) -+ return 1; -+ he_ltf = he_ltf >> 1; -+ break; - default: - return 1; - } -@@ -207,17 +325,32 @@ static int handle_bitrates(struct nl8021 - if(!setup_vht(&txrate_vht_5, vht_argc_5, vht_argv_5)) - return -EINVAL; - -+ if (have_he_mcs_24) -+ if (!setup_he(&txrate_he_24, he_argc_24, he_argv_24)) -+ return -EINVAL; -+ -+ if (have_he_mcs_5) -+ if (!setup_he(&txrate_he_5, he_argc_5, he_argv_5)) -+ return -EINVAL; -+ - if (sgi_5 && lgi_5) - return 1; - - if (sgi_24 && lgi_24) - return 1; - -+ if (he_gi_argv) { -+ he_gi = parse_he_gi(he_gi_argv); -+ if (he_gi < 0) -+ return 1; -+ } -+ - nl_rates = nla_nest_start(msg, NL80211_ATTR_TX_RATES); - if (!nl_rates) - goto nla_put_failure; - -- if (have_legacy_24 || have_ht_mcs_24 || have_vht_mcs_24 || sgi_24 || lgi_24) { -+ if (have_legacy_24 || have_ht_mcs_24 || have_vht_mcs_24 || have_he_mcs_24 || -+ sgi_24 || lgi_24 || has_he_gi_24 || has_he_ltf_24) { - nl_band = nla_nest_start(msg, NL80211_BAND_2GHZ); - if (!nl_band) - goto nla_put_failure; -@@ -227,14 +360,22 @@ static int handle_bitrates(struct nl8021 - nla_put(msg, NL80211_TXRATE_HT, n_ht_mcs_24, ht_mcs_24); - if (have_vht_mcs_24) - nla_put(msg, NL80211_TXRATE_VHT, sizeof(txrate_vht_24), &txrate_vht_24); -+ if (have_he_mcs_24) -+ nla_put(msg, NL80211_TXRATE_HE, sizeof(txrate_he_24), -+ &txrate_he_24); - if (sgi_24) - nla_put_u8(msg, NL80211_TXRATE_GI, NL80211_TXRATE_FORCE_SGI); - if (lgi_24) - nla_put_u8(msg, NL80211_TXRATE_GI, NL80211_TXRATE_FORCE_LGI); -+ if (has_he_gi_24) -+ nla_put_u8(msg, NL80211_TXRATE_HE_GI, he_gi); -+ if (has_he_ltf_24) -+ nla_put_u8(msg, NL80211_TXRATE_HE_LTF, he_ltf); - nla_nest_end(msg, nl_band); - } - -- if (have_legacy_5 || have_ht_mcs_5 || have_vht_mcs_5 || sgi_5 || lgi_5) { -+ if (have_legacy_5 || have_ht_mcs_5 || have_vht_mcs_5 || have_he_mcs_5 || -+ sgi_5 || lgi_5 || has_he_gi_5 || has_he_ltf_5) { - nl_band = nla_nest_start(msg, NL80211_BAND_5GHZ); - if (!nl_band) - goto nla_put_failure; -@@ -244,10 +385,17 @@ static int handle_bitrates(struct nl8021 - nla_put(msg, NL80211_TXRATE_HT, n_ht_mcs_5, ht_mcs_5); - if (have_vht_mcs_5) - nla_put(msg, NL80211_TXRATE_VHT, sizeof(txrate_vht_5), &txrate_vht_5); -+ if (have_he_mcs_5) -+ nla_put(msg, NL80211_TXRATE_HE, sizeof(txrate_he_5), -+ &txrate_he_5); - if (sgi_5) - nla_put_u8(msg, NL80211_TXRATE_GI, NL80211_TXRATE_FORCE_SGI); - if (lgi_5) - nla_put_u8(msg, NL80211_TXRATE_GI, NL80211_TXRATE_FORCE_LGI); -+ if (has_he_gi_5) -+ nla_put_u8(msg, NL80211_TXRATE_HE_GI, he_gi); -+ if (has_he_ltf_5) -+ nla_put_u8(msg, NL80211_TXRATE_HE_LTF, he_ltf); - nla_nest_end(msg, nl_band); - } - -@@ -259,9 +407,9 @@ static int handle_bitrates(struct nl8021 - } - - #define DESCR_LEGACY "[legacy-<2.4|5> *]" --#define DESCR DESCR_LEGACY " [ht-mcs-<2.4|5> *] [vht-mcs-<2.4|5> *] [sgi-2.4|lgi-2.4] [sgi-5|lgi-5]" -+#define DESCR DESCR_LEGACY " [ht-mcs-<2.4|5> *] [vht-mcs-<2.4|5> [he-mcs-<2.4|5> *] [sgi-2.4|lgi-2.4] [sgi-5|lgi-5]" - --COMMAND(set, bitrates, "[legacy-<2.4|5> *] [ht-mcs-<2.4|5> *] [vht-mcs-<2.4|5> *] [sgi-2.4|lgi-2.4] [sgi-5|lgi-5]", -+COMMAND(set, bitrates, "[legacy-<2.4|5> *] [ht-mcs-<2.4|5> *] [vht-mcs-<2.4|5> [he-mcs-<2.4|5> *] [sgi-2.4|lgi-2.4] [sgi-5|lgi-5] [he-gi-2.4:0.8/1.6/3.2] [he-gi-5:0.8/1.6/3.2] [he-ltf-2.4:1/2/4] [he-ltf-5:1/2/4]", - NL80211_CMD_SET_TX_BITRATE_MASK, 0, CIB_NETDEV, handle_bitrates, - "Sets up the specified rate masks.\n" - "Not passing any arguments would clear the existing mask (if any)."); ---- a/nl80211.h -+++ b/nl80211.h -@@ -3059,6 +3059,18 @@ enum nl80211_he_gi { - }; - - /** -+ * enum nl80211_he_ltf - HE long training field -+ * @NL80211_RATE_INFO_HE_1xLTF: 3.2 usec -+ * @NL80211_RATE_INFO_HE_2xLTF: 6.4 usec -+ * @NL80211_RATE_INFO_HE_4xLTF: 12.8 usec -+ */ -+enum nl80211_he_ltf { -+ NL80211_RATE_INFO_HE_1XLTF, -+ NL80211_RATE_INFO_HE_2XLTF, -+ NL80211_RATE_INFO_HE_4XLTF, -+}; -+ -+/** - * enum nl80211_he_ru_alloc - HE RU allocation values - * @NL80211_RATE_INFO_HE_RU_ALLOC_26: 26-tone RU allocation - * @NL80211_RATE_INFO_HE_RU_ALLOC_52: 52-tone RU allocation -@@ -4570,6 +4582,10 @@ enum nl80211_key_attributes { - * in an array of MCS numbers. - * @NL80211_TXRATE_VHT: VHT rates allowed for TX rate selection, - * see &struct nl80211_txrate_vht -+ * @NL80211_TXRATE_HE: HE rates allowed for TX rate selection, -+ * see &struct nl80211_txrate_he -+ * @NL80211_TXRATE_HE_GI: configure HE GI, 0.8us, 1.6us and 3.2us. -+ * @NL80211_TXRATE_HE_LTF: configure HE LTF, 1XLTF, 2XLTF and 4XLTF. - * @NL80211_TXRATE_GI: configure GI, see &enum nl80211_txrate_gi - * @__NL80211_TXRATE_AFTER_LAST: internal - * @NL80211_TXRATE_MAX: highest TX rate attribute -@@ -4580,6 +4596,9 @@ enum nl80211_tx_rate_attributes { - NL80211_TXRATE_HT, - NL80211_TXRATE_VHT, - NL80211_TXRATE_GI, -+ NL80211_TXRATE_HE, -+ NL80211_TXRATE_HE_GI, -+ NL80211_TXRATE_HE_LTF, - - /* keep last */ - __NL80211_TXRATE_AFTER_LAST, -@@ -4597,6 +4616,15 @@ struct nl80211_txrate_vht { - __u16 mcs[NL80211_VHT_NSS_MAX]; - }; - -+#define NL80211_HE_NSS_MAX 8 -+/** -+ * struct nl80211_txrate_he - HE MCS/NSS txrate bitmap -+ * @mcs: MCS bitmap table for each NSS (array index 0 for 1 stream, etc.) -+ */ -+struct nl80211_txrate_he { -+ __u16 mcs[NL80211_HE_NSS_MAX]; -+}; -+ - enum nl80211_txrate_gi { - NL80211_TXRATE_DEFAULT_GI, - NL80211_TXRATE_FORCE_SGI, diff --git a/feeds/wifi-ax/iw/patches/514-iw-update-freq-to-chan-mappings-for-6GHz-band-per-IE.patch b/feeds/wifi-ax/iw/patches/514-iw-update-freq-to-chan-mappings-for-6GHz-band-per-IE.patch deleted file mode 100644 index 48043add7..000000000 --- a/feeds/wifi-ax/iw/patches/514-iw-update-freq-to-chan-mappings-for-6GHz-band-per-IE.patch +++ /dev/null @@ -1,61 +0,0 @@ -From ade60d37824164c85ce0d90e35d69d22956bd759 Mon Sep 17 00:00:00 2001 -From: Pradeep Kumar Chitrapu -Date: Fri, 19 Jun 2020 18:47:54 -0700 -Subject: [PATCH] iw-update-freq-to-chan-mappings-for-6GHz-band-per-IE - -This fixes dfferences in 6GHz frequencies which were updated in -IEEE P802.11ax/D6.1. - -Also sync 60GHz band channel to freq mapping with kernel. - -Signed-off-by: Pradeep Kumar Chitrapu ---- - util.c | 19 ++++++++++++++++--- - 1 file changed, 16 insertions(+), 3 deletions(-) - -diff --git a/util.c b/util.c -index cdedd7a23bb0..8c63ae49ad8d 100644 ---- a/util.c -+++ b/util.c -@@ -182,8 +182,15 @@ int ieee80211_channel_to_frequency(int chan, enum nl80211_band band) - else - return 5000 + chan * 5; - break; -+ case NL80211_BAND_6GHZ: -+ /* see 802.11ax D6.1 27.3.23.2 */ -+ if (chan == 2) -+ return 5935; -+ if (chan <= 253) -+ return 5950 + chan * 5; -+ break; - case NL80211_BAND_60GHZ: -- if (chan < 5) -+ if (chan < 7) - return 56160 + chan * 2160; - break; - default: -@@ -197,13 +204,19 @@ int ieee80211_frequency_to_channel(int freq) - /* see 802.11-2007 17.3.8.3.2 and Annex J */ - if (freq == 2484) - return 14; -+ /* see 802.11ax D6.1 27.3.23.2 and Annex E */ -+ else if (freq == 5935) -+ return 2; - else if (freq < 2484) - return (freq - 2407) / 5; - else if (freq >= 4910 && freq <= 4980) - return (freq - 4000) / 5; -- else if (freq <= 45000) /* DMG band lower limit */ -+ else if (freq < 5950) - return (freq - 5000) / 5; -- else if (freq >= 58320 && freq <= 64800) -+ else if (freq <= 45000) /* DMG band lower limit */ -+ /* see 802.11ax D6.1 27.3.23.2 */ -+ return (freq - 5950) / 5; -+ else if (freq >= 58320 && freq <= 70200) - return (freq - 56160) / 2160; - else - return 0; --- -2.17.1 - diff --git a/feeds/wifi-ax/iw/patches/516-iw-enable-80M-support-for-6GHz-11s-mesh.patch b/feeds/wifi-ax/iw/patches/516-iw-enable-80M-support-for-6GHz-11s-mesh.patch deleted file mode 100644 index 9f82b023a..000000000 --- a/feeds/wifi-ax/iw/patches/516-iw-enable-80M-support-for-6GHz-11s-mesh.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 7bc4688806777e9f6131289c9befba141a8e0f6c Mon Sep 17 00:00:00 2001 -From: Pradeep Kumar Chitrapu -Date: Wed, 2 Sep 2020 17:56:04 -0700 -Subject: [PATCH] iw: enable 80M support for 6GHz 11s mesh - -without this 11s mesh could not be configured for 80MHz using iw. -example: -iw mesh join freq 6195 HT40+ ---> 40MHz -iw mesh join freq 6195 80MHz ---> 80MHz - -Signed-off-by: Pradeep Kumar Chitrapu ---- - util.c | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) - -diff --git a/util.c b/util.c -index 8c63ae49ad8d..37c1447bb877 100644 ---- a/util.c -+++ b/util.c -@@ -1228,20 +1228,20 @@ void iw_hexdump(const char *prefix, const __u8 *buf, size_t size) - int get_cf1(const struct chanmode *chanmode, unsigned long freq) - { - unsigned int cf1 = freq, j; -- unsigned int vht80[] = { 5180, 5260, 5500, 5580, 5660, 5745 }; -+ unsigned int bw80[] = { 5180, 5260, 5500, 5580, 5660, 5745, 5955, 6035, 6115, 6195, 6275, 6355, 6435, 6515, 6595, 6675, 6755, 6835, 6195, 6995}; - - switch (chanmode->width) { - case NL80211_CHAN_WIDTH_80: - /* setup center_freq1 */ -- for (j = 0; j < ARRAY_SIZE(vht80); j++) { -- if (freq >= vht80[j] && freq < vht80[j] + 80) -+ for (j = 0; j < ARRAY_SIZE(bw80); j++) { -+ if (freq >= bw80[j] && freq < bw80[j] + 80) - break; - } - -- if (j == ARRAY_SIZE(vht80)) -+ if (j == ARRAY_SIZE(bw80)) - break; - -- cf1 = vht80[j] + 30; -+ cf1 = bw80[j] + 30; - break; - default: - cf1 = freq + chanmode->freq1_diff; --- -2.17.1 - diff --git a/feeds/wifi-ax/iw/patches/517-iw-support-optional-argument-to-specify-6Ghz-channel.patch b/feeds/wifi-ax/iw/patches/517-iw-support-optional-argument-to-specify-6Ghz-channel.patch deleted file mode 100644 index 2e5582042..000000000 --- a/feeds/wifi-ax/iw/patches/517-iw-support-optional-argument-to-specify-6Ghz-channel.patch +++ /dev/null @@ -1,109 +0,0 @@ -From 092d838b9660999c7e7212fe9430a5bd0eed8ef9 Mon Sep 17 00:00:00 2001 -From: Pradeep Kumar Chitrapu -Date: Thu, 3 Sep 2020 16:45:40 -0700 -Subject: [PATCH] iw: support optional argument to parse 6Ghz channel - -Channel numbers of 6GHz band overlaps with those of 2G or 5G bands. -Therefore additional argument "6G" is expected next to channel -number to map it to correct frequency. If not specified defaults to -matching 2G or 5G frequency. -example: iw wlanX set channel 1 6G 80MHz - -Signed-off-by: Pradeep Kumar Chitrapu ---- - interface.c | 6 ++++-- - phy.c | 8 ++++---- - util.c | 14 ++++++++++---- - 3 files changed, 18 insertions(+), 10 deletions(-) - -diff --git a/interface.c b/interface.c -index 931d77a278c0..c37cd08cc56c 100644 ---- a/interface.c -+++ b/interface.c -@@ -755,8 +755,10 @@ COMMAND(switch, freq, - " [5|10|20|40|80|80+80|160] [ []] [beacons ] [block-tx]", - NL80211_CMD_CHANNEL_SWITCH, 0, CIB_NETDEV, handle_freq, - "Switch the operating channel by sending a channel switch announcement (CSA)."); --COMMAND(switch, channel, " [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz] [beacons ] [block-tx]", -- NL80211_CMD_CHANNEL_SWITCH, 0, CIB_NETDEV, handle_chan, NULL); -+COMMAND(switch, channel, " [6G] [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz] [beacons ] [block-tx]", -+ NL80211_CMD_CHANNEL_SWITCH, 0, CIB_NETDEV, handle_chan, -+ "Switch the operating channel by sending a channel switch announcement (CSA)." -+ "6GHz channels expects '6G' in argument. Defaults to 5GHz or 2GHz channels"); - - static int handle_retry_count(struct nl80211_state *state, - struct nl_msg *msg, -diff --git a/phy.c b/phy.c -index 7dbf66200a51..37079b31d7d9 100644 ---- a/phy.c -+++ b/phy.c -@@ -222,9 +222,9 @@ static int handle_chan(struct nl80211_state *state, struct nl_msg *msg, - - return put_chandef(msg, &chandef); - } --COMMAND(set, channel, " [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz]", -+COMMAND(set, channel, " [6G] [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz]", - NL80211_CMD_SET_WIPHY, 0, CIB_PHY, handle_chan, NULL); --COMMAND(set, channel, " [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz]", -+COMMAND(set, channel, " [6G] [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz] [6G]", - NL80211_CMD_SET_WIPHY, 0, CIB_NETDEV, handle_chan, NULL); - - -@@ -369,12 +369,12 @@ err_out: - free(cac_trigger_argv); - return err; - } --TOPLEVEL(cac, "channel [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz]\n" -+TOPLEVEL(cac, "channel [6G] [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] [ []]", - 0, 0, CIB_NETDEV, handle_cac, NULL); - COMMAND(cac, trigger, -- "channel [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz]\n" -+ "channel [6G] [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] [ []]", - NL80211_CMD_RADAR_DETECT, 0, CIB_NETDEV, handle_cac_trigger, -diff --git a/util.c b/util.c -index 37c1447bb877..3dbe7c8fcc9f 100644 ---- a/util.c -+++ b/util.c -@@ -571,7 +571,8 @@ static int parse_freqs(struct chandef *chandef, int argc, char **argv, - * user by giving "NOHT" instead. - * - * The working specifier if chan is set are: -- * [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz] -+ * [6G] [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz] -+ * channel number defaults to 5G or 2G band unless 6G is specified. - * - * And if frequency is set: - * [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz] -@@ -640,7 +641,12 @@ int parse_freqchan(struct chandef *chandef, bool chan, int argc, char **argv, - if (chan) { - enum nl80211_band band; - -- band = freq <= 14 ? NL80211_BAND_2GHZ : NL80211_BAND_5GHZ; -+ if (argc > 1 && strcmp(argv[1], "6G") == 0) { -+ band = NL80211_BAND_6GHZ; -+ _parsed += 1; -+ } else { -+ band = freq <= 14 ? NL80211_BAND_2GHZ : NL80211_BAND_5GHZ; -+ } - freq = ieee80211_channel_to_frequency(freq, band); - } - chandef->control_freq = freq; -@@ -648,9 +654,9 @@ int parse_freqchan(struct chandef *chandef, bool chan, int argc, char **argv, - chandef->center_freq1 = freq; - - /* Try to parse HT mode definitions */ -- if (argc > 1) { -+ if ((argc - _parsed) > 0) { - for (i = 0; i < ARRAY_SIZE(chanmode); i++) { -- if (strcasecmp(chanmode[i].name, argv[1]) == 0) { -+ if (strcasecmp(chanmode[i].name, argv[_parsed]) == 0) { - chanmode_selected = &chanmode[i]; - _parsed += 1; - break; --- -2.17.1 - diff --git a/feeds/wifi-ax/iw/patches/518-iw-support-HE-rate-configuration-in-6-GHz-band.patch b/feeds/wifi-ax/iw/patches/518-iw-support-HE-rate-configuration-in-6-GHz-band.patch deleted file mode 100644 index 6d09bb5ce..000000000 --- a/feeds/wifi-ax/iw/patches/518-iw-support-HE-rate-configuration-in-6-GHz-band.patch +++ /dev/null @@ -1,125 +0,0 @@ -From 1be1ed17b60a44d02fde7ccbf8baadf8d020b558 Mon Sep 17 00:00:00 2001 -From: Rajkumar Manoharan -Date: Wed, 16 Sep 2020 10:05:10 -0700 -Subject: [PATCH] iw: support HE rate configuration in 6 GHz band - -Allow HE-MCS, HE-GI, HE-LTF in 6 GHz band as well and allow only -MCS rates in 6 GHz. - -Signed-off-by: Rajkumar Manoharan ---- - bitrate.c | 40 ++++++++++++++++++++++++++++++++++++++-- - 1 file changed, 38 insertions(+), 2 deletions(-) - -diff --git a/bitrate.c b/bitrate.c -index 70a23fb6ac83..460708a1dbea 100644 ---- a/bitrate.c -+++ b/bitrate.c -@@ -156,22 +156,27 @@ static int handle_bitrates(struct nl80211_state *state, - bool have_ht_mcs_24 = false, have_ht_mcs_5 = false; - bool have_vht_mcs_24 = false, have_vht_mcs_5 = false; - bool have_he_mcs_24 = false, have_he_mcs_5 = false; -+ bool have_he_mcs_6 = false; - uint8_t ht_mcs_24[77], ht_mcs_5[77]; - int n_ht_mcs_24 = 0, n_ht_mcs_5 = 0; - struct nl80211_txrate_vht txrate_vht_24 = {}; - struct nl80211_txrate_vht txrate_vht_5 = {}; - struct nl80211_txrate_he txrate_he_24 = {}; - struct nl80211_txrate_he txrate_he_5 = {}; -+ struct nl80211_txrate_he txrate_he_6 = {}; - uint8_t *mcs = NULL; - int *n_mcs = NULL; - char *vht_argv_5[VHT_ARGC_MAX] = {}; char *vht_argv_24[VHT_ARGC_MAX] = {}; - char *he_argv_5[VHT_ARGC_MAX] = {}; char *he_argv_24[VHT_ARGC_MAX] = {}; -+ char *he_argv_6[VHT_ARGC_MAX] = {}; - char **vht_argv = NULL, **he_argv = NULL; - int vht_argc_5 = 0; int vht_argc_24 = 0; - int he_argc_5 = 0; int he_argc_24 = 0; -+ int he_argc_6 = 0; - int *vht_argc = NULL, *he_argc = NULL; - int sgi_24 = 0, sgi_5 = 0, lgi_24 = 0, lgi_5 = 0; - int has_he_gi_24 = 0, has_he_gi_5 = 0, has_he_ltf_24 = 0, has_he_ltf_5 = 0; -+ int has_he_gi_6 = 0, has_he_ltf_6 = 0; - int he_gi = 0, he_ltf = 0; - char *he_gi_argv = NULL; - -@@ -248,6 +253,13 @@ static int handle_bitrates(struct nl80211_state *state, - he_argv = he_argv_5; - he_argc = &he_argc_5; - have_he_mcs_5 = true; -+ } else if (strcmp(argv[i], "he-mcs-6") == 0) { -+ if (have_he_mcs_6) -+ return 1; -+ parser_state = S_HE; -+ he_argv = he_argv_6; -+ he_argc = &he_argc_6; -+ have_he_mcs_6 = true; - } else if (strcmp(argv[i], "sgi-2.4") == 0) { - sgi_24 = 1; - parser_state = S_GI; -@@ -266,12 +278,18 @@ static int handle_bitrates(struct nl80211_state *state, - } else if (strcmp(argv[i], "he-gi-5") == 0) { - has_he_gi_5 = 1; - parser_state = S_HE_GI; -+ } else if (strcmp(argv[i], "he-gi-6") == 0) { -+ has_he_gi_6 = 1; -+ parser_state = S_HE_GI; - } else if (strcmp(argv[i], "he-ltf-2.4") == 0) { - has_he_ltf_24 = 1; - parser_state = S_HE_LTF; - } else if (strcmp(argv[i], "he-ltf-5") == 0) { - has_he_ltf_5 = 1; - parser_state = S_HE_LTF; -+ } else if (strcmp(argv[i], "he-ltf-6") == 0) { -+ has_he_ltf_6 = 1; -+ parser_state = S_HE_LTF; - } else switch (parser_state) { - case S_LEGACY: - tmpd = strtod(argv[i], &end); -@@ -333,6 +351,10 @@ static int handle_bitrates(struct nl80211_state *state, - if (!setup_he(&txrate_he_5, he_argc_5, he_argv_5)) - return -EINVAL; - -+ if (have_he_mcs_6) -+ if (!setup_he(&txrate_he_6, he_argc_6, he_argv_6)) -+ return -EINVAL; -+ - if (sgi_5 && lgi_5) - return 1; - -@@ -399,6 +421,20 @@ static int handle_bitrates(struct nl80211_state *state, - nla_nest_end(msg, nl_band); - } - -+ if (have_he_mcs_6 || has_he_gi_6 || has_he_ltf_6) { -+ nl_band = nla_nest_start(msg, NL80211_BAND_6GHZ); -+ if (!nl_band) -+ goto nla_put_failure; -+ if (have_he_mcs_6) -+ nla_put(msg, NL80211_TXRATE_HE, sizeof(txrate_he_6), -+ &txrate_he_6); -+ if (has_he_gi_6) -+ nla_put_u8(msg, NL80211_TXRATE_HE_GI, he_gi); -+ if (has_he_ltf_6) -+ nla_put_u8(msg, NL80211_TXRATE_HE_LTF, he_ltf); -+ nla_nest_end(msg, nl_band); -+ } -+ - nla_nest_end(msg, nl_rates); - - return 0; -@@ -407,9 +443,9 @@ static int handle_bitrates(struct nl80211_state *state, - } - - #define DESCR_LEGACY "[legacy-<2.4|5> *]" --#define DESCR DESCR_LEGACY " [ht-mcs-<2.4|5> *] [vht-mcs-<2.4|5> [he-mcs-<2.4|5> *] [sgi-2.4|lgi-2.4] [sgi-5|lgi-5]" -+#define DESCR DESCR_LEGACY " [ht-mcs-<2.4|5> *] [vht-mcs-<2.4|5> [he-mcs-<2.4|5|6> *] [sgi-2.4|lgi-2.4] [sgi-5|lgi-5]" - --COMMAND(set, bitrates, "[legacy-<2.4|5> *] [ht-mcs-<2.4|5> *] [vht-mcs-<2.4|5> [he-mcs-<2.4|5> *] [sgi-2.4|lgi-2.4] [sgi-5|lgi-5] [he-gi-2.4:0.8/1.6/3.2] [he-gi-5:0.8/1.6/3.2] [he-ltf-2.4:1/2/4] [he-ltf-5:1/2/4]", -+COMMAND(set, bitrates, "[legacy-<2.4|5> *] [ht-mcs-<2.4|5> *] [vht-mcs-<2.4|5> [he-mcs-<2.4|5|6> *] [sgi-2.4|lgi-2.4] [sgi-5|lgi-5] [he-gi-<2.4|5|6> <0.8|1.6|3.2>] [he-ltf-<2.4|5|6> <1|2|4>]", - NL80211_CMD_SET_TX_BITRATE_MASK, 0, CIB_NETDEV, handle_bitrates, - "Sets up the specified rate masks.\n" - "Not passing any arguments would clear the existing mask (if any)."); --- -2.7.4 - diff --git a/feeds/wifi-ax/iw/patches/519-iw-Add-HE-UL-MU-fixed-rate-setting.patch b/feeds/wifi-ax/iw/patches/519-iw-Add-HE-UL-MU-fixed-rate-setting.patch deleted file mode 100644 index 0592a505f..000000000 --- a/feeds/wifi-ax/iw/patches/519-iw-Add-HE-UL-MU-fixed-rate-setting.patch +++ /dev/null @@ -1,165 +0,0 @@ -From c6e29601fc643c84ada00fc065e1d54353a4f6a3 Mon Sep 17 00:00:00 2001 -From: Muna Sinada -Date: Thu, 8 Oct 2020 04:59:37 -0700 -Subject: [PATCH] iw: Add HE UL MU fixed rate setting - -Adding mcs fixed rate settings for HE UL MU traffic, which -encompasses both UL-OFDMA and UL-MUMIO. - -Signed-off-by: Muna Sinada ---- - bitrate.c | 51 +++++++++++++++++++++++++++++++++++++++++++++------ - nl80211.h | 1 + - 2 files changed, 46 insertions(+), 6 deletions(-) - -diff --git a/bitrate.c b/bitrate.c -index 323bf4ce5fe7..bd91461938e9 100644 ---- a/bitrate.c -+++ b/bitrate.c -@@ -156,6 +156,7 @@ static int handle_bitrates(struct nl80211_state *state, - bool have_ht_mcs_24 = false, have_ht_mcs_5 = false; - bool have_vht_mcs_24 = false, have_vht_mcs_5 = false; - bool have_he_mcs_24 = false, have_he_mcs_5 = false; -+ bool have_he_ul_mcs_24 = false, have_he_ul_mcs_5 = false; - bool have_he_mcs_6 = false; - uint8_t ht_mcs_24[77], ht_mcs_5[77]; - int n_ht_mcs_24 = 0, n_ht_mcs_5 = 0; -@@ -164,16 +165,20 @@ static int handle_bitrates(struct nl80211_state *state, - struct nl80211_txrate_he txrate_he_24 = {}; - struct nl80211_txrate_he txrate_he_5 = {}; - struct nl80211_txrate_he txrate_he_6 = {}; -+ struct nl80211_txrate_he txrate_he_ul_24 = {}; -+ struct nl80211_txrate_he txrate_he_ul_5 = {}; - uint8_t *mcs = NULL; - int *n_mcs = NULL; - char *vht_argv_5[VHT_ARGC_MAX] = {}; char *vht_argv_24[VHT_ARGC_MAX] = {}; - char *he_argv_5[VHT_ARGC_MAX] = {}; char *he_argv_24[VHT_ARGC_MAX] = {}; - char *he_argv_6[VHT_ARGC_MAX] = {}; -- char **vht_argv = NULL, **he_argv = NULL; -+ char *he_ul_argv_5[VHT_ARGC_MAX] = {}; char *he_ul_argv_24[VHT_ARGC_MAX] = {}; -+ char **vht_argv = NULL, **he_argv = NULL, **he_ul_argv = NULL; - int vht_argc_5 = 0; int vht_argc_24 = 0; - int he_argc_5 = 0; int he_argc_24 = 0; - int he_argc_6 = 0; -- int *vht_argc = NULL, *he_argc = NULL; -+ int he_ul_argc_5 = 0; int he_ul_argc_24 = 0; -+ int *vht_argc = NULL, *he_argc = NULL, *he_ul_argc = NULL; - int sgi_24 = 0, sgi_5 = 0, lgi_24 = 0, lgi_5 = 0; - int has_he_gi_24 = 0, has_he_gi_5 = 0, has_he_ltf_24 = 0, has_he_ltf_5 = 0; - int has_he_gi_6 = 0, has_he_ltf_6 = 0; -@@ -189,6 +194,7 @@ static int handle_bitrates(struct nl80211_state *state, - S_GI, - S_HE_GI, - S_HE_LTF, -+ S_HE_UL, - } parser_state = S_NONE; - - for (i = 0; i < argc; i++) { -@@ -290,6 +296,20 @@ static int handle_bitrates(struct nl80211_state *state, - } else if (strcmp(argv[i], "he-ltf-6") == 0) { - has_he_ltf_6 = 1; - parser_state = S_HE_LTF; -+ } else if (strcmp(argv[i], "he-ul-mcs-2.4") == 0) { -+ if (have_he_ul_mcs_24) -+ return 1; -+ parser_state = S_HE_UL; -+ he_ul_argv = he_ul_argv_24; -+ he_ul_argc = &he_ul_argc_24; -+ have_he_ul_mcs_24 = true; -+ } else if (strcmp(argv[i], "he-ul-mcs-5") == 0) { -+ if (have_he_ul_mcs_5) -+ return 1; -+ parser_state = S_HE_UL; -+ he_ul_argv = he_ul_argv_5; -+ he_ul_argc = &he_ul_argc_5; -+ have_he_ul_mcs_5 = true; - } else switch (parser_state) { - case S_LEGACY: - tmpd = strtod(argv[i], &end); -@@ -330,6 +350,11 @@ static int handle_bitrates(struct nl80211_state *state, - return 1; - he_ltf = he_ltf >> 1; - break; -+ case S_HE_UL: -+ if (*he_ul_argc >= VHT_ARGC_MAX) -+ return 1; -+ he_ul_argv[(*he_ul_argc)++] = argv [i]; -+ break; - default: - return 1; - } -@@ -367,12 +392,20 @@ static int handle_bitrates(struct nl80211_state *state, - return 1; - } - -+ if (have_he_ul_mcs_24) -+ if (!setup_he(&txrate_he_ul_24, he_ul_argc_24, he_ul_argv_24)) -+ return -EINVAL; -+ -+ if (have_he_ul_mcs_5) -+ if (!setup_he(&txrate_he_ul_5, he_ul_argc_5, he_ul_argv_5)) -+ return -EINVAL; -+ - nl_rates = nla_nest_start(msg, NL80211_ATTR_TX_RATES); - if (!nl_rates) - goto nla_put_failure; - - if (have_legacy_24 || have_ht_mcs_24 || have_vht_mcs_24 || have_he_mcs_24 || -- sgi_24 || lgi_24 || has_he_gi_24 || has_he_ltf_24) { -+ sgi_24 || lgi_24 || has_he_gi_24 || has_he_ltf_24 || have_he_ul_mcs_24) { - nl_band = nla_nest_start(msg, NL80211_BAND_2GHZ); - if (!nl_band) - goto nla_put_failure; -@@ -393,11 +426,14 @@ static int handle_bitrates(struct nl80211_state *state, - nla_put_u8(msg, NL80211_TXRATE_HE_GI, he_gi); - if (has_he_ltf_24) - nla_put_u8(msg, NL80211_TXRATE_HE_LTF, he_ltf); -+ if (have_he_ul_mcs_24) -+ nla_put(msg, NL80211_TXRATE_HE_UL, sizeof(txrate_he_ul_24), -+ &txrate_he_ul_24); - nla_nest_end(msg, nl_band); - } - - if (have_legacy_5 || have_ht_mcs_5 || have_vht_mcs_5 || have_he_mcs_5 || -- sgi_5 || lgi_5 || has_he_gi_5 || has_he_ltf_5) { -+ sgi_5 || lgi_5 || has_he_gi_5 || has_he_ltf_5 || have_he_ul_mcs_5) { - nl_band = nla_nest_start(msg, NL80211_BAND_5GHZ); - if (!nl_band) - goto nla_put_failure; -@@ -418,6 +454,9 @@ static int handle_bitrates(struct nl80211_state *state, - nla_put_u8(msg, NL80211_TXRATE_HE_GI, he_gi); - if (has_he_ltf_5) - nla_put_u8(msg, NL80211_TXRATE_HE_LTF, he_ltf); -+ if (have_he_ul_mcs_5) -+ nla_put(msg, NL80211_TXRATE_HE_UL, sizeof(txrate_he_ul_5), -+ &txrate_he_ul_5); - nla_nest_end(msg, nl_band); - } - -@@ -443,9 +482,9 @@ static int handle_bitrates(struct nl80211_state *state, - } - - #define DESCR_LEGACY "[legacy-<2.4|5> *]" --#define DESCR DESCR_LEGACY " [ht-mcs-<2.4|5> *] [vht-mcs-<2.4|5> [he-mcs-<2.4|5|6> *] [sgi-2.4|lgi-2.4] [sgi-5|lgi-5]" -+#define DESCR DESCR_LEGACY " [ht-mcs-<2.4|5> *] [vht-mcs-<2.4|5> [he-mcs-<2.4|5|6> *] [sgi-2.4|lgi-2.4] [sgi-5|lgi-5] [he-ul-mcs-<2.4|5> ]" - --COMMAND(set, bitrates, "[legacy-<2.4|5> *] [ht-mcs-<2.4|5> *] [vht-mcs-<2.4|5> [he-mcs-<2.4|5|6> *] [sgi-2.4|lgi-2.4] [sgi-5|lgi-5] [he-gi-<2.4|5|6> <0.8|1.6|3.2>] [he-ltf-<2.4|5|6> <1|2|4>]", -+COMMAND(set, bitrates, "[legacy-<2.4|5> *] [ht-mcs-<2.4|5> *] [vht-mcs-<2.4|5> [he-mcs-<2.4|5|6> *] [sgi-2.4|lgi-2.4] [sgi-5|lgi-5] [he-gi-<2.4|5|6> <0.8|1.6|3.2>] [he-ltf-<2.4|5|6> <1|2|4>] [he-ul-mcs-<2.4|5> ]", - NL80211_CMD_SET_TX_BITRATE_MASK, 0, CIB_NETDEV, handle_bitrates, - "Sets up the specified rate masks.\n" - "Not passing any arguments would clear the existing mask (if any)."); -diff --git a/nl80211.h b/nl80211.h -index 17386c0d8c8f..5f1faaf27760 100644 ---- a/nl80211.h -+++ b/nl80211.h -@@ -4589,6 +4589,7 @@ enum nl80211_tx_rate_attributes { - NL80211_TXRATE_HE, - NL80211_TXRATE_HE_GI, - NL80211_TXRATE_HE_LTF, -+ NL80211_TXRATE_HE_UL, - - /* keep last */ - __NL80211_TXRATE_AFTER_LAST, --- -2.7.4 - diff --git a/feeds/wifi-ax/mac80211/files/lib/netifd/wireless/mac80211.sh b/feeds/wifi-ax/mac80211/files/lib/netifd/wireless/mac80211.sh index edd36b273..f1ed47802 100644 --- a/feeds/wifi-ax/mac80211/files/lib/netifd/wireless/mac80211.sh +++ b/feeds/wifi-ax/mac80211/files/lib/netifd/wireless/mac80211.sh @@ -26,7 +26,6 @@ drv_mac80211_init_device_config() { hostapd_common_add_device_config config_add_string path phy 'macaddr:macaddr' - config_add_string hwmode config_add_string tx_burst config_add_string distance config_add_int beacon_int chanbw frag rts @@ -44,11 +43,24 @@ drv_mac80211_init_device_config() { su_beamformee \ mu_beamformer \ mu_beamformee \ + he_su_beamformer \ + he_su_beamformee \ + he_mu_beamformer \ vht_txop_ps \ htc_vht \ rx_antenna_pattern \ - tx_antenna_pattern - config_add_int vht_max_a_mpdu_len_exp vht_max_mpdu vht_link_adapt vht160 rx_stbc tx_stbc + tx_antenna_pattern \ + he_spr_sr_control \ + he_twt_required + config_add_int \ + vht_max_a_mpdu_len_exp \ + vht_max_mpdu \ + vht_link_adapt \ + vht160 \ + rx_stbc \ + tx_stbc \ + he_bss_color \ + he_spr_non_srg_obss_pd_max_offset config_add_boolean \ ldpc \ greenfield \ @@ -56,13 +68,6 @@ drv_mac80211_init_device_config() { short_gi_40 \ max_amsdu \ dsss_cck_40 - config_add_int \ - he_su_beamformer \ - he_su_beamformee \ - he_mu_beamformer \ - he_bss_color \ - he_spr_sr_control \ - he_spr_non_srg_obss_pd_max_offset } drv_mac80211_init_iface_config() { @@ -76,7 +81,6 @@ drv_mac80211_init_iface_config() { config_add_int max_listen_int config_add_int dtim_period config_add_int start_disabled - config_add_int he_twt_required he_spr_sr_control # mesh config_add_string mesh_id @@ -112,7 +116,10 @@ mac80211_add_he_capabilities() { for capab in "$@"; do set -- $capab [ "$(($4))" -gt 0 ] || continue - [ "$(((0x$2) & $3))" -gt 0 ] || continue + [ "$(((0x$2) & $3))" -gt 0 ] || { + eval "$4=0" + continue + } append base_cfg "$1=1" "$N" done IFS="$oifs" @@ -197,11 +204,6 @@ mac80211_hostapd_setup_base() { [ "$rx_stbc" -lt "$cap_rx_stbc" ] && cap_rx_stbc="$rx_stbc" ht_cap_mask="$(( ($ht_cap_mask & ~(0x300)) | ($cap_rx_stbc << 8) ))" - conf_tx_ant=$(iw phy "$phy" info | grep 'Configured Antennas:' | cut -d: -f2) - set -- $conf_tx_ant - if [ "$2" == "0x1" -o "$2" == "0x10" ]; then - tx_stbc=0 - fi mac80211_add_capabilities ht_capab_flags $ht_cap_mask \ LDPC:0x1::$ldpc \ GF:0x10::$greenfield \ @@ -222,12 +224,14 @@ mac80211_hostapd_setup_base() { enable_ac=0 vht_oper_chwidth=0 vht_center_seg0= + chan_ofs=0 + [ "$band" = "6g" ] && chan_ofs=1 idx="$channel" case "$htmode" in VHT20|HE20) enable_ac=1;; VHT40|HE40) - case "$(( ($channel / 4) % 2 ))" in + case "$(( (($channel / 4) + $chan_ofs) % 2 ))" in 1) idx=$(($channel + 2));; 0) idx=$(($channel - 2));; esac @@ -235,7 +239,7 @@ mac80211_hostapd_setup_base() { vht_center_seg0=$idx ;; VHT80|HE80) - case "$(( ($channel / 4) % 4 ))" in + case "$(( (($channel / 4) + $chan_ofs) % 4 ))" in 1) idx=$(($channel + 6));; 2) idx=$(($channel + 2));; 3) idx=$(($channel - 2));; @@ -246,15 +250,35 @@ mac80211_hostapd_setup_base() { vht_center_seg0=$idx ;; VHT160|HE160) - case "$channel" in - 36|40|44|48|52|56|60|64) idx=50;; - 100|104|108|112|116|120|124|128) idx=114;; - esac + if [ "$band" = "6g" ]; then + case "$channel" in + 1|5|9|13|17|21|25|29) idx=15;; + 33|37|41|45|49|53|57|61) idx=47;; + 65|69|73|77|81|85|89|93) idx=79;; + 97|101|105|109|113|117|121|125) idx=111;; + 129|133|137|141|145|149|153|157) idx=143;; + 161|165|169|173|177|181|185|189) idx=175;; + 193|197|201|205|209|213|217|221) idx=207;; + esac + else + case "$channel" in + 36|40|44|48|52|56|60|64) idx=50;; + 100|104|108|112|116|120|124|128) idx=114;; + esac + fi enable_ac=1 vht_oper_chwidth=2 vht_center_seg0=$idx ;; esac + [ "$band" = "6g" ] && { + op_class= + case "$htmode" in + HE20) op_class=131;; + HE*) op_class=$((132 + $vht_oper_chwidth)) + esac + [ -n "$op_class" ] && append base_cfg "op_class=$op_class" "$N" + } [ "$hwmode" = "a" ] || enable_ac=0 if [ "$enable_ac" != "0" ]; then @@ -291,11 +315,6 @@ mac80211_hostapd_setup_base() { [ "$rx_stbc" -lt "$cap_rx_stbc" ] && cap_rx_stbc="$rx_stbc" vht_cap="$(( ($vht_cap & ~(0x700)) | ($cap_rx_stbc << 8) ))" - conf_tx_ant=$(iw phy "$phy" info | grep 'Configured Antennas:' | cut -d: -f2) - set -- $conf_tx_ant - if [ "$2" == "0x1" -o "$2" == "0x10" ]; then - tx_stbc_2by1=0 - fi mac80211_add_capabilities vht_capab $vht_cap \ RXLDPC:0x10::$rxldpc \ SHORT-GI-80:0x20::$short_gi_80 \ @@ -365,9 +384,7 @@ mac80211_hostapd_setup_base() { # 802.11ax enable_ax=0 case "$htmode" in - HE20|HE40|HE80| HE160) - enable_ax=1 - ;; + HE*) enable_ax=1 ;; esac if [ "$enable_ax" != "0" ]; then @@ -378,20 +395,20 @@ mac80211_hostapd_setup_base() { he_twt_required:0 \ he_spr_sr_control:0 \ he_spr_non_srg_obss_pd_max_offset:1 \ - he_bss_color:64 + he_bss_color - - append base_cfg "ieee80211ax=1" "$N" - append base_cfg "he_bss_color=$he_bss_color" "$N" - [ "$hwmode" = "a" ] && { - append base_cfg "he_oper_chwidth=$vht_oper_chwidth" "$N" - append base_cfg "he_oper_centr_freq_seg0_idx=$vht_center_seg0" "$N" - } he_phy_cap=$(iw phy "$phy" info | awk -F "[()]" '/HE PHY Capabilities/ { print $2 }' | head -1) he_phy_cap=${he_phy_cap:2} he_mac_cap=$(iw phy "$phy" info | awk -F "[()]" '/HE MAC Capabilities/ { print $2 }' | head -1) he_mac_cap=${he_mac_cap:2} + append base_cfg "ieee80211ax=1" "$N" + [ -n "$he_bss_color" ] && append base_cfg "he_bss_color=$he_bss_color" "$N" + [ "$hwmode" = "a" ] && { + append base_cfg "he_oper_chwidth=$vht_oper_chwidth" "$N" + append base_cfg "he_oper_centr_freq_seg0_idx=$vht_center_seg0" "$N" + } + mac80211_add_he_capabilities \ he_su_beamformer:${he_phy_cap:6:2}:0x80:$he_su_beamformer \ he_su_beamformee:${he_phy_cap:8:2}:0x1:$he_su_beamformee \ @@ -399,10 +416,7 @@ mac80211_hostapd_setup_base() { he_spr_sr_control:${he_phy_cap:14:2}:0x1:$he_spr_sr_control \ he_twt_required:${he_mac_cap:0:2}:0x6:$he_twt_required - [ "$he_spr_sr_control" != "0" ] && { - append base_cfg "he_spr_sr_control=$he_spr_sr_control" "$N" - append base_cfg "he_spr_non_srg_obss_pd_max_offset=$he_spr_non_srg_obss_pd_max_offset" "$N" - } + [ "$he_spr_sr_control" -gt 0 ] && append base_cfg "he_spr_non_srg_obss_pd_max_offset=$he_spr_non_srg_obss_pd_max_offset" "$N" append base_cfg "he_default_pe_duration=4" "$N" append base_cfg "he_rts_threshold=1023" "$N" @@ -484,7 +498,6 @@ mac80211_get_addr() { mac80211_generate_mac() { local phy="$1" - local multiple_bssid="$2" local id="${macidx:-0}" local ref="$(cat /sys/class/ieee80211/${phy}/macaddress)" @@ -493,7 +506,7 @@ mac80211_generate_mac() { [ "$mask" = "00:00:00:00:00:00" ] && { mask="ff:ff:ff:ff:ff:ff"; - [ "$(wc -l < /sys/class/ieee80211/${phy}/addresses)" -gt 1 ] && { + [ "$(wc -l < /sys/class/ieee80211/${phy}/addresses)" -gt $id ] && { addr="$(mac80211_get_addr "$phy" "$id")" [ -n "$addr" ] && { echo "$addr" @@ -509,16 +522,11 @@ mac80211_generate_mac() { local oIFS="$IFS"; IFS=":"; set -- $ref; IFS="$oIFS" - [ "$multiple_bssid" -eq 1 ] && { - printf "02:%s:%s:%s:%s:%02x" $b1 $2 $3 $4 $5 $macidx - return - } - macidx=$(($id + 1)) [ "$((0x$mask1))" -gt 0 ] && { b1="0x$1" [ "$id" -gt 0 ] && \ - b1=$(($b1 ^ ((($id - !($b1 & 2)) << 2) | 0x2))) + b1=$(($b1 ^ ((($id - !($b1 & 2)) << 2)) | 0x2)) printf "%02x:%s:%s:%s:%s:%s" $b1 $2 $3 $4 $5 $6 return } @@ -622,7 +630,6 @@ mac80211_iw_interface_add() { } mac80211_prepare_vif() { - local multiple_bssid=$1 json_select config json_get_vars ifname mode ssid wds powersave macaddr enable wpa_psk_file vlan_file @@ -636,7 +643,7 @@ mac80211_prepare_vif() { json_select .. [ -n "$macaddr" ] || { - macaddr="$(mac80211_generate_mac $phy $multiple_bssid)" + macaddr="$(mac80211_generate_mac $phy)" macidx="$(($macidx + 1))" } @@ -777,17 +784,10 @@ mac80211_setup_supplicant_noctl() { mac80211_prepare_iw_htmode() { case "$htmode" in - VHT20|HT20|HE20) iw_htmode=HT20;; - HT40*|VHT40|VHT160|\ - HE40|HE40|HE160) - case "$hwmode" in - a) - case "$(( ($channel / 4) % 2 ))" in - 1) iw_htmode="HT40+" ;; - 0) iw_htmode="HT40-";; - esac - ;; - *) + VHT20|HT20) iw_htmode=HT20;; + HT40*|VHT40|VHT160) + case "$band" in + 2g) case "$htmode" in HT40+) iw_htmode="HT40+";; HT40-) iw_htmode="HT40-";; @@ -800,10 +800,16 @@ mac80211_prepare_iw_htmode() { ;; esac ;; + *) + case "$(( ($channel / 4) % 2 ))" in + 1) iw_htmode="HT40+" ;; + 0) iw_htmode="HT40-";; + esac + ;; esac [ "$auto_channel" -gt 0 ] && iw_htmode="HT40+" ;; - VHT80|HE80) + VHT80) iw_htmode="80MHZ" ;; NONE|NOHT) @@ -909,7 +915,6 @@ mac80211_setup_vif() { mesh) wireless_vif_parse_encryption [ -z "$htmode" ] && htmode="NOHT"; - freq="$(get_freq "$phy" "$channel")" if [ "$wpa" -gt 0 -o "$auto_channel" -gt 0 ] || chan_is_dfs "$phy" "$channel"; then mac80211_setup_supplicant $vif_enable || failed=1 else @@ -923,7 +928,6 @@ mac80211_setup_vif() { adhoc) wireless_vif_parse_encryption if [ "$wpa" -gt 0 -o "$auto_channel" -gt 0 ]; then - freq="$(get_freq "$phy" "$channel")" mac80211_setup_supplicant_noctl $vif_enable || failed=1 else mac80211_setup_adhoc $vif_enable @@ -940,10 +944,30 @@ mac80211_setup_vif() { get_freq() { local phy="$1" - local chan="$2" - iw "$phy" info | grep -E -m1 "(\* ${chan:-....} MHz${chan:+|\\[$chan\\]})" | grep MHz | awk '{print $2}' + local channel="$2" + local band="$3" + + case "$band" in + 2g) band="1:";; + 5g) band="2:";; + 60g) band="3:";; + 6g) band="4:";; + esac + + iw "$phy" info | awk -v band="$band" -v channel="[$channel]" ' + +$1 ~ /Band/ { + band_match = band == $2 } +band_match && $3 == "MHz" && $4 == channel { + print $2 + exit +} +' +} + + chan_is_dfs() { local phy="$1" local chan="$2" @@ -987,8 +1011,7 @@ drv_mac80211_setup() { country chanbw distance \ txpower antenna_gain \ rxantenna txantenna \ - frag rts beacon_int:100 htmode \ - multiple_bssid:0 + frag rts beacon_int:100 htmode json_get_values basic_rate_list basic_rate json_get_values scan_list scan_list json_select .. @@ -1027,7 +1050,7 @@ drv_mac80211_setup() { done # convert channel to frequency - [ "$auto_channel" -gt 0 ] || freq="$(get_freq "$phy" "$channel")" + [ "$auto_channel" -gt 0 ] || freq="$(get_freq "$phy" "$channel" "$band")" [ -n "$country" ] && { iw reg get | grep -q "^country $country:" || { @@ -1083,7 +1106,7 @@ drv_mac80211_setup() { mac80211_prepare_iw_htmode for_each_interface "sta adhoc mesh monitor" mac80211_prepare_vif NEWAPLIST= - for_each_interface "ap" mac80211_prepare_vif ${multiple_bssid} + for_each_interface "ap" mac80211_prepare_vif NEW_MD5=$(test -e "${hostapd_conf_file}" && md5sum ${hostapd_conf_file}) OLD_MD5=$(uci -q -P /var/state get wireless._${phy}.md5) if [ "${NEWAPLIST}" != "${OLDAPLIST}" ]; then @@ -1111,15 +1134,14 @@ drv_mac80211_setup() { if [ "$no_reload" != "0" ]; then add_ap=1 ubus wait_for hostapd - ubus call hostapd config_add "{\"iface\":\"$primary_ap\", \"config\":\"${hostapd_conf_file}\"}" - local hostapd_pid=$(ubus call service list '{"name": "wpad"}' | jsonfilter -l 1 -e "@['wpad'].instances['hostapd'].pid") - wireless_add_process "$hostapd_pid" "/usr/sbin/hostapd" 1 + local hostapd_res="$(ubus call hostapd config_add "{\"iface\":\"$primary_ap\", \"config\":\"${hostapd_conf_file}\"}")" + ret="$?" + [ "$ret" != 0 -o -z "$hostapd_res" ] && { + wireless_setup_failed HOSTAPD_START_FAILED + return + } + wireless_add_process "$(jsonfilter -s "$hostapd_res" -l 1 -e @.pid)" "/usr/sbin/hostapd" 1 1 fi - ret="$?" - [ "$ret" != 0 ] && { - wireless_setup_failed HOSTAPD_START_FAILED - return - } } uci -q -P /var/state set wireless._${phy}.aplist="${NEWAPLIST}" uci -q -P /var/state set wireless._${phy}.md5="${NEW_MD5}" diff --git a/feeds/wifi-ax/mac80211/files/lib/wifi/mac80211.sh b/feeds/wifi-ax/mac80211/files/lib/wifi/mac80211.sh index 6fc611459..0763da8fd 100644 --- a/feeds/wifi-ax/mac80211/files/lib/wifi/mac80211.sh +++ b/feeds/wifi-ax/mac80211/files/lib/wifi/mac80211.sh @@ -57,6 +57,85 @@ check_mac80211_device() { [ "$phy" = "$dev" ] && found=1 } + +__get_band_defaults() { + local phy="$1" + + ( iw phy "$phy" info; echo ) | awk ' +BEGIN { + bands = "" +} + +($1 == "Band" || $1 == "") && band { + if (channel) { + mode="NOHT" + if (ht) mode="HT20" + if (vht) mode="VHT80" + if (he) mode="HE80" + if (he && band == "1:") mode="HE20" + sub("\\[", "", channel) + sub("\\]", "", channel) + bands = bands band channel ":" mode " " + } + band="" +} + +$1 == "Band" { + band = $2 + channel = "" + vht = "" + ht = "" + he = "" +} + +$0 ~ "Capabilities:" { + ht=1 +} + +$0 ~ "VHT Capabilities:" { + vht=1 +} + +$0 ~ "HE Iftypes" { + he=1 +} + +$1 == "*" && $3 == "MHz" && $0 !~ /disabled/ && band && !channel { + channel = $4 +} + +END { + print bands +}' +} + +get_band_defaults() { + local phy="$1" + + for c in $(__get_band_defaults "$phy"); do + local band="${c%%:*}" + c="${c#*:}" + local chan="${c%%:*}" + c="${c#*:}" + local mode="${c%%:*}" + + case "$band" in + 1) band=2g;; + 2) band=5g;; + 3) band=60g;; + 4) band=6g;; + *) band="";; + esac + + [ -n "$band" ] || continue + [ -n "$mode_band" -a "$band" = "6g" ] && return + + mode_band="$band" + channel="$chan" + htmode="$mode" + done +} + detect_mac80211() { devidx=0 config_load wireless @@ -75,31 +154,12 @@ detect_mac80211() { config_foreach check_mac80211_device wifi-device [ "$found" -gt 0 ] && continue - mode_band="g" - channel="11" + mode_band="" + channel="" htmode="" ht_capab="" - iw phy "$dev" info | grep -q 'Capabilities:' && { - htmode=HT20 - iw phy "$dev" info | grep -q 'HE.*Capabilities' && htmode="HE20" - } - - iw phy "$dev" info | grep -q '5180 MHz' && { - mode_band="a" - channel="36" - iw phy "$dev" info | grep -q '5180 MHz.*disabled' && channel=149 - iw phy "$dev" info | grep -q 'VHT Capabilities' && htmode="VHT80" - iw phy "$dev" info | grep -q 'HE.*Capabilities' && htmode="HE80" - } - - iw phy "$dev" info | grep -q '5955 MHz' && { - mode_band="a" - channel="1" - htmode="HE80" - } - - [ -n "$htmode" ] && ht_capab="set wireless.radio${devidx}.htmode=$htmode" + get_band_defaults "$dev" path="$(mac80211_phy_to_path "$dev")" if [ -n "$path" ]; then @@ -111,10 +171,10 @@ detect_mac80211() { uci -q batch <<-EOF set wireless.radio${devidx}=wifi-device set wireless.radio${devidx}.type=mac80211 - set wireless.radio${devidx}.channel=${channel} - set wireless.radio${devidx}.hwmode=11${mode_band} ${dev_id} - ${ht_capab} + set wireless.radio${devidx}.channel=${channel} + set wireless.radio${devidx}.band=${mode_band} + set wireless.radio${devidx}.htmode=$htmode set wireless.radio${devidx}.disabled=1 set wireless.default_radio${devidx}=wifi-iface diff --git a/patches/0017-ipq807x-add-the-Qualcomm-AX-target-support.patch b/patches/0017-ipq807x-add-the-Qualcomm-AX-target-support.patch index 661dcffb7..3267807f9 100644 --- a/patches/0017-ipq807x-add-the-Qualcomm-AX-target-support.patch +++ b/patches/0017-ipq807x-add-the-Qualcomm-AX-target-support.patch @@ -1,7 +1,7 @@ -From 08ee04152e51ed8bf1eddd3b914ae23c53541814 Mon Sep 17 00:00:00 2001 +From 70327bf769598c991896f6216bc23b3c6d6be46d Mon Sep 17 00:00:00 2001 From: John Crispin Date: Sat, 18 Jul 2020 08:53:44 +0200 -Subject: [PATCH 01/18] ipq807x: add the Qualcomm AX target support +Subject: [PATCH 01/23] ipq807x: add the Qualcomm AX target support Signed-off-by: John Crispin --- @@ -19,7 +19,7 @@ Signed-off-by: John Crispin .../ipq807x/base-files/etc/init.d/bootcount | 12 + .../linux/ipq807x/base-files/etc/init.d/wdt | 14 + ...G4_v5.4.B-AQR_CIG_WIFI_ID44715_VER1673.cld | Bin 0 -> 391170 bytes - .../base-files/lib/upgrade/platform.sh | 62 + + .../base-files/lib/upgrade/platform.sh | 64 + target/linux/ipq807x/config-4.4 | 821 +++++++++ .../arm/boot/dts/qcom-ipq6018-cig-wf188.dts | 18 + .../arm/boot/dts/qcom-ipq6018-cig-wf188n.dts | 18 + @@ -38,10 +38,10 @@ Signed-off-by: John Crispin target/linux/ipq807x/ipq60xx/config-default | 144 ++ .../linux/ipq807x/ipq60xx/profiles/default.mk | 9 + target/linux/ipq807x/ipq60xx/target.mk | 8 + - target/linux/ipq807x/ipq807x/config-default | 74 + + target/linux/ipq807x/ipq807x/config-default | 75 + .../linux/ipq807x/ipq807x/profiles/default.mk | 9 + target/linux/ipq807x/ipq807x/target.mk | 7 + - target/linux/ipq807x/modules.mk | 58 + + target/linux/ipq807x/modules.mk | 61 + .../linux/ipq807x/patches/100-qrtr-ns.patch | 976 +++++++++++ .../linux/ipq807x/patches/101-squashfs.patch | 16 + .../linux/ipq807x/patches/102-cig-wf188.patch | 869 ++++++++++ @@ -53,7 +53,7 @@ Signed-off-by: John Crispin .../linux/ipq807x/patches/108-log-spam.patch | 37 + target/linux/ipq807x/patches/109-tplink.patch | 1518 +++++++++++++++++ .../ipq807x/patches/110-add-esmt-nand.patch | 37 + - 48 files changed, 9307 insertions(+), 3 deletions(-) + 48 files changed, 9313 insertions(+), 3 deletions(-) create mode 100644 package/boot/uboot-envtools/files/ipq807x create mode 100644 target/linux/ipq807x/109-logspam.patch create mode 100644 target/linux/ipq807x/Makefile @@ -312,7 +312,7 @@ index 0000000000..39f4c941c0 +exit 0 diff --git a/target/linux/ipq807x/base-files/etc/board.d/02_network b/target/linux/ipq807x/base-files/etc/board.d/02_network new file mode 100755 -index 0000000000..d2c7687947 +index 0000000000..eaa440943b --- /dev/null +++ b/target/linux/ipq807x/base-files/etc/board.d/02_network @@ -0,0 +1,77 @@ @@ -341,10 +341,6 @@ index 0000000000..d2c7687947 + ucidef_set_interface_lan "eth0 eth1 eth2 eth3 eth4" + ucidef_set_interface_wan "eth5" + ;; -+ xiaomi,ax1800) -+ ucidef_set_interface_lan "eth0 eth1 eth2" -+ ucidef_set_interface_wan "eth3" -+ ;; + cig,wf194c|\ + sercomm,wallaby) + ucidef_set_interface_lan "eth0" @@ -359,6 +355,10 @@ index 0000000000..d2c7687947 + ucidef_set_interface_lan "eth1" + ucidef_set_interface_wan "eth0" + ;; ++ qcom,ipq807x-hk14) ++ ucidef_set_interface_lan "eth0 eth1 eth2 eth3" ++ ucidef_set_interface_wan "eth4" ++ ;; + esac +} + @@ -4736,10 +4736,10 @@ HcmV?d00001 diff --git a/target/linux/ipq807x/base-files/lib/upgrade/platform.sh b/target/linux/ipq807x/base-files/lib/upgrade/platform.sh new file mode 100755 -index 0000000000..ef940fe13c +index 0000000000..de64559bce --- /dev/null +++ b/target/linux/ipq807x/base-files/lib/upgrade/platform.sh -@@ -0,0 +1,62 @@ +@@ -0,0 +1,64 @@ +. /lib/functions/system.sh + +qca_do_upgrade() { @@ -4770,7 +4770,8 @@ index 0000000000..ef940fe13c + tplink,ex227|\ + tplink,ex447|\ + qcom,ipq6018-cp01|\ -+ qcom,ipq807x-hk01) ++ qcom,ipq807x-hk01|\ ++ qcom,ipq807x-hk14) + [ "$magic_long" = "73797375" ] && return 0 + ;; + esac @@ -4791,6 +4792,7 @@ index 0000000000..ef940fe13c + cig,wf194c|\ + qcom,ipq6018-cp01|\ + qcom,ipq807x-hk01|\ ++ qcom,ipq807x-hk14|\ + tplink,ex447|\ + tplink,ex227) + nand_upgrade_tar "$1" @@ -7578,10 +7580,10 @@ index 0000000000..cf2bf7b9cd +endef diff --git a/target/linux/ipq807x/ipq807x/config-default b/target/linux/ipq807x/ipq807x/config-default new file mode 100644 -index 0000000000..74862253e6 +index 0000000000..837fdcda8a --- /dev/null +++ b/target/linux/ipq807x/ipq807x/config-default -@@ -0,0 +1,74 @@ +@@ -0,0 +1,75 @@ +# CONFIG_AHCI_IPQ is not set +CONFIG_ARCH_IPQ807x=y +# CONFIG_DIAGFWD_BRIDGE_CODE is not set @@ -7656,6 +7658,7 @@ index 0000000000..74862253e6 +CONFIG_QCOM_QMI_POWER_COLLAPSE=y +CONFIG_RMNET_CTL=y +CONFIG_RMNET_CTL_DEBUG=y ++# CONFIG_MHI_BUS_TEST is not set diff --git a/target/linux/ipq807x/ipq807x/profiles/default.mk b/target/linux/ipq807x/ipq807x/profiles/default.mk new file mode 100644 index 0000000000..f47e73acfc @@ -7686,10 +7689,10 @@ index 0000000000..7c24b66e60 +endef diff --git a/target/linux/ipq807x/modules.mk b/target/linux/ipq807x/modules.mk new file mode 100644 -index 0000000000..3b772a5726 +index 0000000000..0223ff2590 --- /dev/null +++ b/target/linux/ipq807x/modules.mk -@@ -0,0 +1,58 @@ +@@ -0,0 +1,61 @@ +define KernelPackage/usb-phy-ipq807x + TITLE:=DWC3 USB QCOM PHY driver for IPQ807x + DEPENDS:=@TARGET_ipq807x @@ -7716,6 +7719,9 @@ index 0000000000..3b772a5726 + DEPENDS+= @TARGET_ipq807x + KCONFIG:= \ + CONFIG_QRTR=y \ ++ CONFIG_QRTR_MHI=y \ ++ CONFIG_MHI_BUS=y \ ++ CONFIG_MHI_QTI=y \ + CONFIG_QCOM_APCS_IPC=y \ + CONFIG_QCOM_GLINK_SSR=y \ + CONFIG_QCOM_Q6V5_WCSS=y \ diff --git a/patches/0018-ramips-add-tplink-ex228-support.patch b/patches/0018-ramips-add-tplink-ex228-support.patch new file mode 100644 index 000000000..9015988d0 --- /dev/null +++ b/patches/0018-ramips-add-tplink-ex228-support.patch @@ -0,0 +1,197 @@ +From 842b431559c3992e182190b7f96c4407978723c7 Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Thu, 27 May 2021 16:48:27 +0200 +Subject: [PATCH] ramips: add tplink ex228 support + +Signed-off-by: John Crispin +--- + .../linux/ramips/dts/mt7621_tplink_ex228.dts | 129 ++++++++++++++++++ + target/linux/ramips/image/mt7621.mk | 10 ++ + .../mt7621/base-files/etc/board.d/02_network | 1 + + .../mt7621/base-files/lib/upgrade/platform.sh | 1 + + 4 files changed, 141 insertions(+) + create mode 100644 target/linux/ramips/dts/mt7621_tplink_ex228.dts + +diff --git a/target/linux/ramips/dts/mt7621_tplink_ex228.dts b/target/linux/ramips/dts/mt7621_tplink_ex228.dts +new file mode 100644 +index 0000000000..9e5cc9ef01 +--- /dev/null ++++ b/target/linux/ramips/dts/mt7621_tplink_ex228.dts +@@ -0,0 +1,129 @@ ++#include "mt7621.dtsi" ++ ++#include ++#include ++ ++/ { ++ compatible = "tplink,ex228", "mediatek,mt7621-soc"; ++ model = "TP-Link EX228"; ++ ++ aliases { ++ led-boot = &led_status; ++ led-failsafe = &led_status; ++ led-running = &led_status; ++ led-upgrade = &led_status; ++ }; ++ ++ chosen { ++ bootargs = "console=ttyS0,115200"; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ ++ led_status: blue { ++ label = "blue:status"; ++ gpios = <&gpio 7 GPIO_ACTIVE_LOW>; ++ }; ++ ++ green { ++ label = "green:system"; ++ gpios = <&gpio 8 GPIO_ACTIVE_LOW>; ++ }; ++ ++ red { ++ label = "green:system"; ++ gpios = <&gpio 12 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++ ++ keys { ++ compatible = "gpio-keys"; ++ ++ reset { ++ label = "reset"; ++ gpios = <&gpio 16 GPIO_ACTIVE_HIGH>; ++ linux,code = ; ++ }; ++ }; ++}; ++ ++&nand { ++ status = "okay"; ++ ++ partitions { ++ compatible = "fixed-partitions"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ partition@0 { ++ label = "u-boot"; ++ reg = <0x0 0x80000>; ++ read-only; ++ }; ++ ++ partition@80000 { ++ label = "u-boot-env"; ++ reg = <0x80000 0x80000>; ++ read-only; ++ }; ++ ++ factory: partition@100000 { ++ label = "factory"; ++ reg = <0x100000 0x80000>; ++ read-only; ++ }; ++ ++ partition@180000 { ++ label = "kernel"; ++ reg = <0x180000 0x400000>; ++ }; ++ ++ partition@580000 { ++ label = "ubi"; ++ reg = <0x580000 0x7a60000>; ++ }; ++ }; ++}; ++ ++&pcie { ++ status = "okay"; ++}; ++ ++&pcie1 { ++ mt76@0,0 { ++ reg = <0x0000 0 0 0 0>; ++ mediatek,mtd-eeprom = <&factory 0x0000>; ++ }; ++}; ++ ++&switch0 { ++ ports { ++ port@1 { ++ status = "okay"; ++ label = "lan1"; ++ }; ++ ++ port@2 { ++ status = "okay"; ++ label = "lan2"; ++ }; ++ ++ port@3 { ++ status = "okay"; ++ label = "lan3"; ++ }; ++ ++ port@0 { ++ status = "okay"; ++ label = "wan"; ++ }; ++ }; ++}; ++ ++&state_default { ++ gpio { ++ groups = "uart3", "jtag"; ++ function = "gpio"; ++ }; ++}; +diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk +index a8f558326d..1a84abc842 100644 +--- a/target/linux/ramips/image/mt7621.mk ++++ b/target/linux/ramips/image/mt7621.mk +@@ -1138,6 +1138,16 @@ define Device/tplink_eap235-wall-v1 + endef + TARGET_DEVICES += tplink_eap235-wall-v1 + ++define Device/tplink_ex228 ++ $(Device/uimage-lzma-loader) ++ DEVICE_VENDOR := TP-Link ++ DEVICE_MODEL := EX228 ++ DEVICE_PACKAGES := kmod-mt7915e ++ IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata | check-size ++ IMAGE_SIZE=20000k ++endef ++TARGET_DEVICES += tplink_ex228 ++ + define Device/tplink_re350-v1 + $(Device/dsa-migration) + $(Device/tplink-safeloader) +diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network +index 89e679be7c..b6b8b6482d 100755 +--- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network ++++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network +@@ -36,6 +36,7 @@ ramips_setup_interfaces() + ;; + gehua,ghl-r-001|\ + hiwifi,hc5962|\ ++ tplink,ex228|\ + xiaomi,mi-router-3-pro|\ + xiaomi,mi-router-ac2100|\ + xiaomi,redmi-router-ac2100) +diff --git a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh +index c9152c5cf4..853a464ea5 100755 +--- a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh ++++ b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh +@@ -61,6 +61,7 @@ platform_do_upgrade() { + netgear,wac104|\ + netgear,wac124|\ + netis,wf2881|\ ++ tplink,ex228|\ + xiaomi,mi-router-3g|\ + xiaomi,mi-router-3-pro|\ + xiaomi,mi-router-4|\ +-- +2.25.1 + diff --git a/patches/0024-netifd-libubox-update-to-latest-HEAD.patch b/patches/0024-netifd-libubox-update-to-latest-HEAD.patch deleted file mode 100644 index 8f0cb379c..000000000 --- a/patches/0024-netifd-libubox-update-to-latest-HEAD.patch +++ /dev/null @@ -1,476 +0,0 @@ -From 5171503cfa4387370fd4c33bbcf0d8c4b6ec86e4 Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Tue, 18 May 2021 10:46:43 +0200 -Subject: [PATCH] netifd/libubox: update to latest HEAD - -* required for wired ieee8021x - -Signed-off-by: John Crispin ---- - package/libs/libubox/Makefile | 4 +- - package/network/config/netifd/Makefile | 4 +- - .../config/netifd/patches/100-8021x.patch | 421 ++++++++++++++++++ - 3 files changed, 425 insertions(+), 4 deletions(-) - create mode 100644 package/network/config/netifd/patches/100-8021x.patch - -diff --git a/package/libs/libubox/Makefile b/package/libs/libubox/Makefile -index 4d582eacfd..8644764d59 100644 ---- a/package/libs/libubox/Makefile -+++ b/package/libs/libubox/Makefile -@@ -5,9 +5,9 @@ PKG_RELEASE=1 - - PKG_SOURCE_PROTO:=git - PKG_SOURCE_URL=$(PROJECT_GIT)/project/libubox.git --PKG_MIRROR_HASH:=97dc4eba01cf2c5d6a6d0db3747e0cdc0d95cb87e51b3115272e7d3e69a8b255 -+#PKG_MIRROR_HASH:=97dc4eba01cf2c5d6a6d0db3747e0cdc0d95cb87e51b3115272e7d3e69a8b255 - PKG_SOURCE_DATE:=2020-12-12 --PKG_SOURCE_VERSION:=357877693ca363b12e6e7e14d345639b2440cd07 -+PKG_SOURCE_VERSION:=b14c4688612c05c78ce984d7bde633bce8703b1e - PKG_ABI_VERSION:=$(call abi_version_str,$(PKG_SOURCE_DATE)) - CMAKE_INSTALL:=1 - -diff --git a/package/network/config/netifd/Makefile b/package/network/config/netifd/Makefile -index 7061456b08..03e3c3ca2a 100644 ---- a/package/network/config/netifd/Makefile -+++ b/package/network/config/netifd/Makefile -@@ -6,8 +6,8 @@ PKG_RELEASE:=1 - PKG_SOURCE_PROTO:=git - PKG_SOURCE_URL=$(PROJECT_GIT)/project/netifd.git - PKG_SOURCE_DATE:=2021-01-09 --PKG_SOURCE_VERSION:=c00c8335d6188daa326ecfe5a62da15a9b9987e1 --PKG_MIRROR_HASH:=c740e51e0cec13eec336ba1c7a643db3b64a9a2235f8c1b73a566cb89e841190 -+PKG_SOURCE_VERSION:=3052f2f67686f3d540d4d941e4664730de530741 -+#PKG_MIRROR_HASH:=c740e51e0cec13eec336ba1c7a643db3b64a9a2235f8c1b73a566cb89e841190 - PKG_MAINTAINER:=Felix Fietkau - - PKG_LICENSE:=GPL-2.0 -diff --git a/package/network/config/netifd/patches/100-8021x.patch b/package/network/config/netifd/patches/100-8021x.patch -new file mode 100644 -index 0000000000..eb8eaaa6fb ---- /dev/null -+++ b/package/network/config/netifd/patches/100-8021x.patch -@@ -0,0 +1,421 @@ -+Return-path: -+X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on ds12 -+X-Spam-Level: -+X-Spam-Status: No, score=-8.0 required=5.0 tests=BAYES_00,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 -+Envelope-to: john@phrozen.org -+Delivery-date: Mon, 17 May 2021 11:23:58 +0200 -+Received: from p54ae9ff2.dip0.t-ipconnect.de ([84.174.159.242] helo=localhost.localdomain) -+ by ds12 with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) -+ (Exim 4.89) -+ (envelope-from ) -+ id 1liZTi-0007JJ-8s -+ for john@phrozen.org; Mon, 17 May 2021 11:23:58 +0200 -+From: Felix Fietkau -+To: john@phrozen.org -+Subject: [PATCH netifd] device: add support for configuring devices with external auth handler -+Date: Mon, 17 May 2021 11:23:56 +0200 -+Message-Id: <20210517092356.85402-1-nbd@nbd.name> -+X-Mailer: git-send-email 2.30.1 -+MIME-Version: 1.0 -+Content-Transfer-Encoding: 8bit -+ -+This can be used to support 802.1x on wired devices. -+In order to use this, the device section for each port needing authentication -+needs to contain the option auth 1 -+When set, this option prevents devices from being added to bridges or configured -+with IP settings by default, until the set_state ubus call on network.device -+sets "auth_status" to true for the device. -+ -+Signed-off-by: Felix Fietkau -+--- -+ bridge.c | 58 +++++++++++++++++++++++++++++++++++++---------------- -+ device.c | 34 +++++++++++++++++++++++++++++++ -+ device.h | 17 +++++++++++++++- -+ interface.c | 21 ++++++++++++++----- -+ ubus.c | 6 ++++++ -+ 5 files changed, 113 insertions(+), 23 deletions(-) -+ -+diff --git a/bridge.c b/bridge.c -+index 099dfe4d24ef..397ac979daaf 100644 -+--- a/bridge.c -++++ b/bridge.c -+@@ -122,6 +122,7 @@ struct bridge_member { -+ struct device_user dev; -+ uint16_t pvid; -+ bool present; -++ bool active; -+ char name[]; -+ }; -+ -+@@ -299,19 +300,21 @@ bridge_set_vlan_state(struct bridge_state *bst, struct bridge_vlan *vlan, bool a -+ } -+ -+ static int -+-bridge_disable_member(struct bridge_member *bm) -++bridge_disable_member(struct bridge_member *bm, bool keep_dev) -+ { -+ struct bridge_state *bst = bm->bst; -+ struct bridge_vlan *vlan; -+ -+- if (!bm->present) -++ if (!bm->present || !bm->active) -+ return 0; -+ -++ bm->active = false; -+ vlist_for_each_element(&bst->dev.vlans, vlan, node) -+ bridge_set_member_vlan(bm, vlan, false); -+ -+ system_bridge_delif(&bst->dev, bm->dev.dev); -+- device_release(&bm->dev); -++ if (!keep_dev) -++ device_release(&bm->dev); -+ -+ device_broadcast_event(&bst->dev, DEV_EVENT_TOPO_CHANGE); -+ -+@@ -356,6 +359,7 @@ bridge_enable_member(struct bridge_member *bm) -+ { -+ struct bridge_state *bst = bm->bst; -+ struct bridge_vlan *vlan; -++ struct device *dev; -+ int ret; -+ -+ if (!bm->present) -+@@ -375,12 +379,20 @@ bridge_enable_member(struct bridge_member *bm) -+ if (ret < 0) -+ goto error; -+ -++ dev = bm->dev.dev; -++ if (dev->settings.auth && !dev->auth_status) -++ return -1; -++ -++ if (bm->active) -++ return 0; -++ -+ ret = system_bridge_addif(&bst->dev, bm->dev.dev); -+ if (ret < 0) { -+ D(DEVICE, "Bridge device %s could not be added\n", bm->dev.dev->ifname); -+ goto error; -+ } -+ -++ bm->active = true; -+ if (bst->has_vlans) { -+ /* delete default VLAN 1 */ -+ system_bridge_vlan(bm->dev.dev->ifname, 1, false, 0); -+@@ -412,7 +424,7 @@ bridge_remove_member(struct bridge_member *bm) -+ return; -+ -+ if (bst->dev.active) -+- bridge_disable_member(bm); -++ bridge_disable_member(bm, false); -+ -+ bm->present = false; -+ bm->bst->n_present--; -+@@ -481,10 +493,11 @@ bridge_check_retry(struct bridge_state *bst) -+ } -+ -+ static void -+-bridge_member_cb(struct device_user *dev, enum device_event ev) -++bridge_member_cb(struct device_user *dep, enum device_event ev) -+ { -+- struct bridge_member *bm = container_of(dev, struct bridge_member, dev); -++ struct bridge_member *bm = container_of(dep, struct bridge_member, dev); -+ struct bridge_state *bst = bm->bst; -++ struct device *dev = dep->dev; -+ -+ switch (ev) { -+ case DEV_EVENT_ADD: -+@@ -495,19 +508,30 @@ bridge_member_cb(struct device_user *dev, enum device_event ev) -+ -+ if (bst->n_present == 1) -+ device_set_present(&bst->dev, true); -+- if (bst->dev.active && !bridge_enable_member(bm)) { -+- /* -+- * Adding a bridge member can overwrite the bridge mtu -+- * in the kernel, apply the bridge settings in case the -+- * bridge mtu is set -+- */ -+- system_if_apply_settings(&bst->dev, &bst->dev.settings, -+- DEV_OPT_MTU | DEV_OPT_MTU6); -+- } -++ fallthrough; -++ case DEV_EVENT_AUTH_UP: -++ if (!bst->dev.active) -++ break; -++ -++ if (bridge_enable_member(bm)) -++ break; -++ -++ /* -++ * Adding a bridge member can overwrite the bridge mtu -++ * in the kernel, apply the bridge settings in case the -++ * bridge mtu is set -++ */ -++ system_if_apply_settings(&bst->dev, &bst->dev.settings, -++ DEV_OPT_MTU | DEV_OPT_MTU6); -++ break; -++ case DEV_EVENT_LINK_DOWN: -++ if (!dev->settings.auth) -++ break; -+ -++ bridge_disable_member(bm, true); -+ break; -+ case DEV_EVENT_REMOVE: -+- if (dev->hotplug) { -++ if (dep->hotplug) { -+ vlist_delete(&bst->members, &bm->node); -+ return; -+ } -+@@ -529,7 +553,7 @@ bridge_set_down(struct bridge_state *bst) -+ bst->set_state(&bst->dev, false); -+ -+ vlist_for_each_element(&bst->members, bm, node) -+- bridge_disable_member(bm); -++ bridge_disable_member(bm, false); -+ -+ bridge_disable_interface(bst); -+ -+diff --git a/device.c b/device.c -+index 7f011b615fbf..26254cc2eb90 100644 -+--- a/device.c -++++ b/device.c -+@@ -59,6 +59,7 @@ static const struct blobmsg_policy dev_attrs[__DEV_ATTR_MAX] = { -+ [DEV_ATTR_DROP_GRATUITOUS_ARP] = { .name = "drop_gratuitous_arp", .type = BLOBMSG_TYPE_BOOL }, -+ [DEV_ATTR_DROP_UNSOLICITED_NA] = { .name = "drop_unsolicited_na", .type = BLOBMSG_TYPE_BOOL }, -+ [DEV_ATTR_ARP_ACCEPT] = { .name = "arp_accept", .type = BLOBMSG_TYPE_BOOL }, -++ [DEV_ATTR_AUTH] = { .name = "auth", .type = BLOBMSG_TYPE_BOOL }, -+ }; -+ -+ const struct uci_blob_param_list device_attr_list = { -+@@ -270,6 +271,7 @@ device_merge_settings(struct device *dev, struct device_settings *n) -+ s->drop_unsolicited_na : os->drop_unsolicited_na; -+ n->arp_accept = s->flags & DEV_OPT_ARP_ACCEPT ? -+ s->arp_accept : os->arp_accept; -++ n->auth = s->flags & DEV_OPT_AUTH ? s->auth : os->auth; -+ n->flags = s->flags | os->flags | os->valid_flags; -+ } -+ -+@@ -439,6 +441,11 @@ device_init_settings(struct device *dev, struct blob_attr **tb) -+ s->flags |= DEV_OPT_ARP_ACCEPT; -+ } -+ -++ if ((cur = tb[DEV_ATTR_AUTH])) { -++ s->auth = blobmsg_get_bool(cur); -++ s->flags |= DEV_OPT_AUTH; -++ } -++ -+ device_set_disabled(dev, disabled); -+ } -+ -+@@ -716,6 +723,28 @@ device_refresh_present(struct device *dev) -+ __device_set_present(dev, state); -+ } -+ -++void -++device_set_auth_status(struct device *dev, bool value) -++{ -++ if (dev->auth_status == value) -++ return; -++ -++ dev->auth_status = value; -++ if (!dev->present) -++ return; -++ -++ if (dev->auth_status) { -++ device_broadcast_event(dev, DEV_EVENT_AUTH_UP); -++ return; -++ } -++ -++ device_broadcast_event(dev, DEV_EVENT_LINK_DOWN); -++ if (!dev->link_active) -++ return; -++ -++ device_broadcast_event(dev, DEV_EVENT_LINK_UP); -++} -++ -+ void device_set_present(struct device *dev, bool state) -+ { -+ if (dev->sys_present == state) -+@@ -734,6 +763,8 @@ void device_set_link(struct device *dev, bool state) -+ netifd_log_message(L_NOTICE, "%s '%s' link is %s\n", dev->type->name, dev->ifname, state ? "up" : "down" ); -+ -+ dev->link_active = state; -++ if (!state) -++ dev->auth_status = false; -+ device_broadcast_event(dev, state ? DEV_EVENT_LINK_UP : DEV_EVENT_LINK_DOWN); -+ } -+ -+@@ -1091,6 +1122,7 @@ device_dump_status(struct blob_buf *b, struct device *dev) -+ -+ blobmsg_add_u8(b, "up", !!dev->active); -+ blobmsg_add_u8(b, "carrier", !!dev->link_active); -++ blobmsg_add_u8(b, "auth_status", !!dev->auth_status); -+ -+ if (dev->type->dump_info) -+ dev->type->dump_info(dev, b); -+@@ -1157,6 +1189,8 @@ device_dump_status(struct blob_buf *b, struct device *dev) -+ blobmsg_add_u8(b, "drop_unsolicited_na", st.drop_unsolicited_na); -+ if (st.flags & DEV_OPT_ARP_ACCEPT) -+ blobmsg_add_u8(b, "arp_accept", st.arp_accept); -++ if (st.flags & DEV_OPT_AUTH) -++ blobmsg_add_u8(b, "auth", st.auth); -+ } -+ -+ s = blobmsg_open_table(b, "statistics"); -+diff --git a/device.h b/device.h -+index f6eaf275e18c..ed07791ba458 100644 -+--- a/device.h -++++ b/device.h -+@@ -59,6 +59,7 @@ enum { -+ DEV_ATTR_DROP_GRATUITOUS_ARP, -+ DEV_ATTR_DROP_UNSOLICITED_NA, -+ DEV_ATTR_ARP_ACCEPT, -++ DEV_ATTR_AUTH, -+ __DEV_ATTR_MAX, -+ }; -+ -+@@ -100,7 +101,7 @@ enum { -+ DEV_OPT_MLDVERSION = (1 << 8), -+ DEV_OPT_NEIGHREACHABLETIME = (1 << 9), -+ DEV_OPT_DEFAULT_MACADDR = (1 << 10), -+- /* 1 bit hole */ -++ DEV_OPT_AUTH = (1 << 11), -+ DEV_OPT_MTU6 = (1 << 12), -+ DEV_OPT_DADTRANSMITS = (1 << 13), -+ DEV_OPT_MULTICAST_TO_UNICAST = (1 << 14), -+@@ -134,6 +135,7 @@ enum device_event { -+ DEV_EVENT_UP, -+ DEV_EVENT_DOWN, -+ -++ DEV_EVENT_AUTH_UP, -+ DEV_EVENT_LINK_UP, -+ DEV_EVENT_LINK_DOWN, -+ -+@@ -192,6 +194,7 @@ struct device_settings { -+ bool drop_gratuitous_arp; -+ bool drop_unsolicited_na; -+ bool arp_accept; -++ bool auth; -+ }; -+ -+ /* -+@@ -220,6 +223,7 @@ struct device { -+ int active; -+ /* DEV_EVENT_LINK_UP */ -+ bool link_active; -++ bool auth_status; -+ -+ bool external; -+ bool disabled; -+@@ -324,6 +328,8 @@ struct device *get_vlan_device_chain(const char *ifname, bool create); -+ void alias_notify_device(const char *name, struct device *dev); -+ struct device *device_alias_get(const char *name); -+ -++void device_set_auth_status(struct device *dev, bool value); -++ -+ static inline void -+ device_set_deferred(struct device *dev, bool value) -+ { -+@@ -338,6 +344,15 @@ device_set_disabled(struct device *dev, bool value) -+ device_refresh_present(dev); -+ } -+ -++static inline bool -++device_link_active(struct device *dev) -++{ -++ if (dev->settings.auth && !dev->auth_status) -++ return false; -++ -++ return dev->link_active; -++} -++ -+ bool device_check_ip6segmentrouting(void); -+ -+ #endif -+diff --git a/interface.c b/interface.c -+index 2a8f604207c3..a91246a1ae03 100644 -+--- a/interface.c -++++ b/interface.c -+@@ -99,6 +99,17 @@ interface_error_flush(struct interface *iface) -+ } -+ } -+ -++static bool -++interface_force_link(struct interface *iface) -++{ -++ struct device *dev = iface->main_dev.dev; -++ -++ if (dev && dev->settings.auth) -++ return false; -++ -++ return iface->force_link; -++} -++ -+ static void -+ interface_clear_errors(struct interface *iface) -+ { -+@@ -344,7 +355,7 @@ __interface_set_up(struct interface *iface) -+ static void -+ interface_check_state(struct interface *iface) -+ { -+- bool link_state = iface->link_state || iface->force_link; -++ bool link_state = iface->link_state || interface_force_link(iface); -+ -+ switch (iface->state) { -+ case IFS_UP: -+@@ -390,7 +401,8 @@ interface_set_link_state(struct interface *iface, bool new_state) -+ iface->link_state = new_state; -+ interface_check_state(iface); -+ -+- if (new_state && iface->force_link && iface->state == IFS_UP && !iface->link_up_event) { -++ if (new_state && interface_force_link(iface) && -++ iface->state == IFS_UP && !iface->link_up_event) { -+ interface_event(iface, IFEV_LINK_UP); -+ iface->link_up_event = true; -+ } -+@@ -424,11 +436,10 @@ interface_main_dev_cb(struct device_user *dep, enum device_event ev) -+ case DEV_EVENT_DOWN: -+ interface_set_enabled(iface, false); -+ break; -++ case DEV_EVENT_AUTH_UP: -+ case DEV_EVENT_LINK_UP: -+- interface_set_link_state(iface, true); -+- break; -+ case DEV_EVENT_LINK_DOWN: -+- interface_set_link_state(iface, false); -++ interface_set_link_state(iface, device_link_active(dep->dev)); -+ break; -+ case DEV_EVENT_TOPO_CHANGE: -+ interface_proto_event(iface->proto, PROTO_CMD_RENEW, false); -+diff --git a/ubus.c b/ubus.c -+index 9098c662cc41..be150626bc02 100644 -+--- a/ubus.c -++++ b/ubus.c -+@@ -298,12 +298,14 @@ error: -+ enum { -+ DEV_STATE_NAME, -+ DEV_STATE_DEFER, -++ DEV_STATE_AUTH_STATUS, -+ __DEV_STATE_MAX, -+ }; -+ -+ static const struct blobmsg_policy dev_state_policy[__DEV_STATE_MAX] = { -+ [DEV_STATE_NAME] = { .name = "name", .type = BLOBMSG_TYPE_STRING }, -+ [DEV_STATE_DEFER] = { .name = "defer", .type = BLOBMSG_TYPE_BOOL }, -++ [DEV_STATE_AUTH_STATUS] = { .name = "auth_status", .type = BLOBMSG_TYPE_BOOL }, -+ }; -+ -+ static int -+@@ -329,6 +331,10 @@ netifd_handle_set_state(struct ubus_context *ctx, struct ubus_object *obj, -+ if (cur) -+ device_set_deferred(dev, !!blobmsg_get_u8(cur)); -+ -++ cur = tb[DEV_STATE_AUTH_STATUS]; -++ if (cur) -++ device_set_auth_status(dev, !!blobmsg_get_u8(cur)); -++ -+ return 0; -+ } -+ -+-- -+2.30.1 -+ --- -2.25.1 - diff --git a/patches/0026-hostapd-add-a-pile-of-new-options.patch b/patches/0026-hostapd-add-a-pile-of-new-options.patch deleted file mode 100644 index 6cbf6180c..000000000 --- a/patches/0026-hostapd-add-a-pile-of-new-options.patch +++ /dev/null @@ -1,257 +0,0 @@ -From 0bdafa77ec675b81d9254cb4ce429e76ca84fcea Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Thu, 1 Apr 2021 09:31:19 +0200 -Subject: [PATCH 1/2] hostapd: add a pile of new options - -Signed-off-by: John Crispin ---- - .../network/services/hostapd/files/hostapd.sh | 84 +++++++++++++------ - 1 file changed, 60 insertions(+), 24 deletions(-) - -diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh -index 45a49b8faa..05b901fb6b 100644 ---- a/package/network/services/hostapd/files/hostapd.sh -+++ b/package/network/services/hostapd/files/hostapd.sh -@@ -311,12 +311,12 @@ hostapd_common_add_bss_config() { - - config_add_string 'owe_transition_bssid:macaddr' 'owe_transition_ssid:string' - -- config_add_boolean iw_enabled iw_internet iw_asra iw_esr iw_uesa -+ config_add_boolean interworking iw_internet iw_asra iw_esr iw_uesa - config_add_int iw_access_network_type iw_venue_group iw_venue_type - config_add_int iw_ipaddr_type_availability iw_gas_address3 - config_add_string iw_hessid iw_network_auth_type iw_qos_map_set - config_add_array iw_roaming_consortium iw_domain_name iw_anqp_3gpp_cell_net iw_nai_realm -- config_add_array iw_anqp_elem -+ config_add_array iw_anqp_elem iw_venue_name iw_venue_url - - config_add_boolean hs20 disable_dgaf osen - config_add_int anqp_domain_id -@@ -327,12 +327,20 @@ hostapd_common_add_bss_config() { - config_add_array hs20_conn_capab - config_add_string osu_ssid hs20_wan_metrics hs20_operating_class hs20_t_c_filename hs20_t_c_timestamp - -+ config_add_boolean interworking -+ config_add_string hs20_t_c_server_url -+ - config_add_array airtime_sta_weight - config_add_int airtime_bss_weight airtime_bss_limit - - config_add_boolean multicast_to_unicast per_sta_vif - - config_add_array hostapd_bss_options -+ -+ config_add_boolean request_cui -+ config_add_array radius_auth_req_attr -+ config_add_array radius_acct_req_attr -+ config_add_int rts_threshold - } - - hostapd_set_vlan_file() { -@@ -396,12 +404,20 @@ append_iw_nai_realm() { - [ -n "$1" ] && append bss_conf "nai_realm=$1" "$N" - } - -+append_iw_venue_name() { -+ [ -n "$1" ] && append bss_conf "venue_name=$1" "$N" -+} -+ -+append_iw_venue_url() { -+ [ -n "$1" ] && append bss_conf "venue_url=$1" "$N" -+} -+ - append_hs20_oper_friendly_name() { -- append bss_conf "hs20_oper_friendly_name=$1" "$N" -+ [ -n "$1" ] && append bss_conf "hs20_oper_friendly_name=$1" "$N" - } - - append_osu_provider_service_desc() { -- append bss_conf "osu_service_desc=$1" "$N" -+ [ -n "$1" ] && append bss_conf "osu_service_desc=$1" "$N" - } - - append_hs20_icon() { -@@ -421,15 +437,15 @@ append_hs20_icons() { - } - - append_operator_icon() { -- append bss_conf "operator_icon=$1" "$N" -+ [ -n "$1" ] && append bss_conf "operator_icon=$1" "$N" - } - - append_osu_icon() { -- append bss_conf "osu_icon=$1" "$N" -+ [ -n "$1" ] && append bss_conf "osu_icon=$1" "$N" - } - - append_osu_provider() { -- local cfgtype osu_server_uri osu_friendly_name osu_nai osu_nai2 osu_method_list -+ local cfgtype osu_server_uri osu_nai osu_nai2 osu_method_list - - config_load wireless - config_get cfgtype "$1" TYPE -@@ -441,12 +457,13 @@ append_osu_provider() { - config_get osu_nai2 "$1" osu_nai2 - config_get osu_method_list "$1" osu_method - -- append bss_conf "osu_server_uri=$osu_server_uri" "$N" -- append bss_conf "osu_nai=$osu_nai" "$N" -- append bss_conf "osu_nai2=$osu_nai2" "$N" -- append bss_conf "osu_method_list=$osu_method_list" "$N" -+ [ -n "$osu_server_uri" ] && append bss_conf "osu_server_uri=$osu_server_uri" "$N" -+ [ -n "$osu_nai" ] && append bss_conf "osu_nai=$osu_nai" "$N" -+ [ -n "$osu_nai2" ] && append bss_conf "osu_nai2=$osu_nai2" "$N" -+ [ -n "$osu_method_list" ] && append bss_conf "osu_method_list=$osu_method_list" "$N" - - config_list_foreach "$1" osu_service_desc append_osu_provider_service_desc -+ config_list_foreach "$1" osu_friendly_name append_osu_friendly_name - config_list_foreach "$1" osu_icon append_osu_icon - - append bss_conf "$N" -@@ -456,6 +473,14 @@ append_hs20_conn_capab() { - [ -n "$1" ] && append bss_conf "hs20_conn_capab=$1" "$N" - } - -+append_radius_acct_req_attr() { -+ [ -n "$1" ] && append bss_conf "radius_acct_req_attr=$1" "$N" -+} -+ -+append_radius_auth_req_attr() { -+ [ -n "$1" ] && append bss_conf "radius_auth_req_attr=$1" "$N" -+} -+ - append_airtime_sta_weight() { - [ -n "$1" ] && append bss_conf "airtime_sta_weight=$1" "$N" - } -@@ -482,7 +507,7 @@ hostapd_set_bss_options() { - bss_load_update_period chan_util_avg_period sae_require_mfp \ - multi_ap multi_ap_backhaul_ssid multi_ap_backhaul_key skip_inactivity_poll \ - airtime_bss_weight airtime_bss_limit airtime_sta_weight \ -- multicast_to_unicast per_sta_vif -+ multicast_to_unicast per_sta_vif rts_threshold - - set_default isolate 0 - set_default maxassoc 0 -@@ -503,6 +528,7 @@ hostapd_set_bss_options() { - set_default multi_ap 0 - set_default airtime_bss_weight 0 - set_default airtime_bss_limit 0 -+ set_default rts_threshold -1 - - append bss_conf "ctrl_interface=/var/run/hostapd" - if [ "$isolate" -gt 0 ]; then -@@ -529,6 +555,7 @@ hostapd_set_bss_options() { - append bss_conf "uapsd_advertisement_enabled=$uapsd" "$N" - append bss_conf "utf8_ssid=$utf8_ssid" "$N" - append bss_conf "multi_ap=$multi_ap" "$N" -+ append bss_conf "rts_threshold=$rts_threshold" "$N" - - [ "$tdls_prohibit" -gt 0 ] && append bss_conf "tdls_prohibit=$tdls_prohibit" "$N" - -@@ -547,6 +574,7 @@ hostapd_set_bss_options() { - append bss_conf "acct_server_shared_secret=$acct_secret" "$N" - [ -n "$acct_interval" ] && \ - append bss_conf "radius_acct_interim_interval=$acct_interval" "$N" -+ json_for_each_item append_radius_acct_req_attr radius_acct_req_attr - } - - case "$auth_type" in -@@ -601,7 +629,7 @@ hostapd_set_bss_options() { - auth_server auth_secret auth_port \ - dae_client dae_secret dae_port \ - ownip radius_client_addr \ -- eap_reauth_period -+ eap_reauth_period request_cui - - # radius can provide VLAN ID for clients - vlan_possible=1 -@@ -613,18 +641,20 @@ hostapd_set_bss_options() { - - set_default auth_port 1812 - set_default dae_port 3799 -- -+ set_default request_cui 0 - - append bss_conf "auth_server_addr=$auth_server" "$N" - append bss_conf "auth_server_port=$auth_port" "$N" - append bss_conf "auth_server_shared_secret=$auth_secret" "$N" - -+ [ "$request_cui" -gt 0 ] && append bss_conf "radius_request_cui=$request_cui" "$N" - [ -n "$eap_reauth_period" ] && append bss_conf "eap_reauth_period=$eap_reauth_period" "$N" - - [ -n "$dae_client" -a -n "$dae_secret" ] && { - append bss_conf "radius_das_port=$dae_port" "$N" - append bss_conf "radius_das_client=$dae_client $dae_secret" "$N" - } -+ json_for_each_item append_radius_auth_req_attr radius_auth_req_attr - - [ -n "$ownip" ] && append bss_conf "own_ip_addr=$ownip" "$N" - [ -n "$radius_client_addr" ] && append bss_conf "radius_client_addr=$radius_client_addr" "$N" -@@ -871,13 +901,14 @@ hostapd_set_bss_options() { - } - } - -- json_get_vars iw_enabled iw_internet iw_asra iw_esr iw_uesa iw_access_network_type -+ json_get_vars interworking iw_internet iw_asra iw_esr iw_uesa iw_access_network_type - json_get_vars iw_hessid iw_venue_group iw_venue_type iw_network_auth_type - json_get_vars iw_roaming_consortium iw_domain_name iw_anqp_3gpp_cell_net iw_nai_realm - json_get_vars iw_anqp_elem iw_qos_map_set iw_ipaddr_type_availability iw_gas_address3 -+ json_get_vars iw_venue_name iw_venue_url - -- set_default iw_enabled 0 -- if [ "$iw_enabled" = "1" ]; then -+ set_default interworking 0 -+ if [ "$interworking" = "1" ]; then - append bss_conf "interworking=1" "$N" - set_default iw_internet 1 - set_default iw_asra 0 -@@ -903,6 +934,8 @@ hostapd_set_bss_options() { - json_for_each_item append_iw_roaming_consortium iw_roaming_consortium - json_for_each_item append_iw_anqp_elem iw_anqp_elem - json_for_each_item append_iw_nai_realm iw_nai_realm -+ json_for_each_item append_iw_venue_name iw_venue_name -+ json_for_each_item append_iw_venue_url iw_venue_url - - iw_domain_name_conf= - json_for_each_item append_iw_domain_name iw_domain_name -@@ -917,9 +950,11 @@ hostapd_set_bss_options() { - - - local hs20 disable_dgaf osen anqp_domain_id hs20_deauth_req_timeout \ -- osu_ssid hs20_wan_metrics hs20_operating_class hs20_t_c_filename hs20_t_c_timestamp -+ osu_ssid hs20_wan_metrics hs20_operating_class hs20_t_c_filename hs20_t_c_timestamp \ -+ hs20_t_c_server_url - json_get_vars hs20 disable_dgaf osen anqp_domain_id hs20_deauth_req_timeout \ -- osu_ssid hs20_wan_metrics hs20_operating_class hs20_t_c_filename hs20_t_c_timestamp -+ osu_ssid hs20_wan_metrics hs20_operating_class hs20_t_c_filename hs20_t_c_timestamp \ -+ hs20_t_c_server_url - - set_default hs20 0 - set_default disable_dgaf $hs20 -@@ -929,17 +964,18 @@ hostapd_set_bss_options() { - if [ "$hs20" = "1" ]; then - append bss_conf "hs20=1" "$N" - append_hs20_icons -- append bss_conf "disable_dgaf=$disable_dgaf" "$N" -- append bss_conf "osen=$osen" "$N" -- append bss_conf "anqp_domain_id=$anqp_domain_id" "$N" -- append bss_conf "hs20_deauth_req_timeout=$hs20_deauth_req_timeout" "$N" -+ [ -n "$disable_dgaf"] && append bss_conf "disable_dgaf=$disable_dgaf" "$N" -+ [ -n "$osen"] && append bss_conf "osen=$osen" "$N" -+ [ "$anqp_domain_id" -gt 0 ] && append bss_conf "anqp_domain_id=$anqp_domain_id" "$N" -+ [ -n "$hs20_deauth_req_timeout"] && append bss_conf "hs20_deauth_req_timeout=$hs20_deauth_req_timeout" "$N" - [ -n "$osu_ssid" ] && append bss_conf "osu_ssid=$osu_ssid" "$N" - [ -n "$hs20_wan_metrics" ] && append bss_conf "hs20_wan_metrics=$hs20_wan_metrics" "$N" - [ -n "$hs20_operating_class" ] && append bss_conf "hs20_operating_class=$hs20_operating_class" "$N" - [ -n "$hs20_t_c_filename" ] && append bss_conf "hs20_t_c_filename=$hs20_t_c_filename" "$N" - [ -n "$hs20_t_c_timestamp" ] && append bss_conf "hs20_t_c_timestamp=$hs20_t_c_timestamp" "$N" -- json_for_each_item append_hs20_conn_capab hs20_conn_capab -+ [ -n "$hs20_t_c_server_url" ] && append bss_conf "hs20_t_c_server_url=$hs20_t_c_server_url" "$N" - json_for_each_item append_hs20_oper_friendly_name hs20_oper_friendly_name -+ json_for_each_item append_hs20_conn_capab hs20_conn_capab - json_for_each_item append_osu_provider osu_provider - json_for_each_item append_operator_icon operator_icon - fi --- -2.25.1 - diff --git a/patches/0027-hostapd-fix-civic-location-option.patch b/patches/0027-hostapd-fix-civic-location-option.patch deleted file mode 100644 index 234137df8..000000000 --- a/patches/0027-hostapd-fix-civic-location-option.patch +++ /dev/null @@ -1,26 +0,0 @@ -From f1bb66dbeb148d3da6481a98433cff5b5ee3ef96 Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Tue, 6 Apr 2021 13:24:43 +0200 -Subject: [PATCH] hostapd: fix civic location option - -Signed-off-by: John Crispin ---- - package/network/services/hostapd/files/hostapd.sh | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh -index 05b901fb6b..e391aae13b 100644 ---- a/package/network/services/hostapd/files/hostapd.sh -+++ b/package/network/services/hostapd/files/hostapd.sh -@@ -763,7 +763,7 @@ hostapd_set_bss_options() { - append bss_conf "ftm_responder=1" "$N" - [ "$stationary_ap" -eq "1" ] && append bss_conf "stationary_ap=1" "$N" - [ -n "$lci" ] && append bss_conf "lci=$lci" "$N" -- [ -n "$civic" ] && append bss_conf "lci=$civic" "$N" -+ [ -n "$civic" ] && append bss_conf "civic=$civic" "$N" - } - fi - --- -2.25.1 - diff --git a/patches/0028-hostapd-add-eap_server-support.patch b/patches/0028-hostapd-add-eap_server-support.patch deleted file mode 100644 index 196787e5b..000000000 --- a/patches/0028-hostapd-add-eap_server-support.patch +++ /dev/null @@ -1,77 +0,0 @@ -From 99cffd423352bceb3c2826b4262b575478b0a712 Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Tue, 6 Apr 2021 14:59:41 +0200 -Subject: [PATCH] hostapd: add eap_server support - -Signed-off-by: John Crispin ---- - .../network/services/hostapd/files/hostapd.sh | 25 ++++++++++++++++--- - 1 file changed, 21 insertions(+), 4 deletions(-) - -diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh -index e391aae13b..a3263ed036 100644 ---- a/package/network/services/hostapd/files/hostapd.sh -+++ b/package/network/services/hostapd/files/hostapd.sh -@@ -341,6 +341,9 @@ hostapd_common_add_bss_config() { - config_add_array radius_auth_req_attr - config_add_array radius_acct_req_attr - config_add_int rts_threshold -+ -+ config_add_int eap_server -+ config_add_string eap_user_file ca_cert server_cert private_key private_key_passwd server_id - } - - hostapd_set_vlan_file() { -@@ -507,7 +510,8 @@ hostapd_set_bss_options() { - bss_load_update_period chan_util_avg_period sae_require_mfp \ - multi_ap multi_ap_backhaul_ssid multi_ap_backhaul_key skip_inactivity_poll \ - airtime_bss_weight airtime_bss_limit airtime_sta_weight \ -- multicast_to_unicast per_sta_vif rts_threshold -+ multicast_to_unicast per_sta_vif rts_threshold \ -+ eap_server eap_user_file ca_cert server_cert private_key private_key_passwd server_id - - set_default isolate 0 - set_default maxassoc 0 -@@ -529,6 +533,7 @@ hostapd_set_bss_options() { - set_default airtime_bss_weight 0 - set_default airtime_bss_limit 0 - set_default rts_threshold -1 -+ set_default eap_server 0 - - append bss_conf "ctrl_interface=/var/run/hostapd" - if [ "$isolate" -gt 0 ]; then -@@ -643,9 +648,11 @@ hostapd_set_bss_options() { - set_default dae_port 3799 - set_default request_cui 0 - -- append bss_conf "auth_server_addr=$auth_server" "$N" -- append bss_conf "auth_server_port=$auth_port" "$N" -- append bss_conf "auth_server_shared_secret=$auth_secret" "$N" -+ [ "$eap_server" -eq 0 ] && { -+ append bss_conf "auth_server_addr=$auth_server" "$N" -+ append bss_conf "auth_server_port=$auth_port" "$N" -+ append bss_conf "auth_server_shared_secret=$auth_secret" "$N" -+ } - - [ "$request_cui" -gt 0 ] && append bss_conf "radius_request_cui=$request_cui" "$N" - [ -n "$eap_reauth_period" ] && append bss_conf "eap_reauth_period=$eap_reauth_period" "$N" -@@ -980,6 +987,16 @@ hostapd_set_bss_options() { - json_for_each_item append_operator_icon operator_icon - fi - -+ if [ "$eap_server" = "1" ]; then -+ append bss_conf "eap_server=1" "$N" -+ [ -n "$eap_user_file" ] && append bss_conf "eap_user_file=$eap_user_file" "$N" -+ [ -n "$ca_cert" ] && append bss_conf "ca_cert=$ca_cert" "$N" -+ [ -n "$server_cert" ] && append bss_conf "server_cert=$server_cert" "$N" -+ [ -n "$private_key" ] && append bss_conf "private_key=$private_key" "$N" -+ [ -n "$private_key_passwd" ] && append bss_conf "private_key_passwd=$private_key_passwd" "$N" -+ [ -n "$server_id" ] && append bss_conf "server_id=$server_id" "$N" -+ fi -+ - set_default multicast_to_unicast 0 - if [ "$multicast_to_unicast" -gt 0 ]; then - append bss_conf "multicast_to_unicast=$multicast_to_unicast" "$N" --- -2.25.1 - diff --git a/patches/0032-hostapd-enhance-ubus-interface.patch b/patches/0032-hostapd-enhance-ubus-interface.patch deleted file mode 100644 index a60396149..000000000 --- a/patches/0032-hostapd-enhance-ubus-interface.patch +++ /dev/null @@ -1,299 +0,0 @@ -From 862774f19f666ddf03ce4d51396a7b6f3ac554ef Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Thu, 29 Apr 2021 10:50:06 +0200 -Subject: [PATCH 1/2] hostapd: enhance ubus interface - -* add a notification to the radar detected event -* fix csa on multi bssid interfaces - -Signed-off-by: John Crispin ---- - .../hostapd/patches/600-ubus_support.patch | 103 +++++++++++++----- - .../services/hostapd/src/src/ap/ubus.c | 20 +++- - .../services/hostapd/src/src/ap/ubus.h | 7 ++ - 3 files changed, 98 insertions(+), 32 deletions(-) - -diff --git a/package/network/services/hostapd/patches/600-ubus_support.patch b/package/network/services/hostapd/patches/600-ubus_support.patch -index 938840755a..bd5d13b6ad 100644 ---- a/package/network/services/hostapd/patches/600-ubus_support.patch -+++ b/package/network/services/hostapd/patches/600-ubus_support.patch -@@ -1,5 +1,7 @@ ----- a/hostapd/Makefile --+++ b/hostapd/Makefile -+Index: hostapd-2020-06-08-5a8b3662/hostapd/Makefile -+=================================================================== -+--- hostapd-2020-06-08-5a8b3662.orig/hostapd/Makefile -++++ hostapd-2020-06-08-5a8b3662/hostapd/Makefile - @@ -171,6 +171,11 @@ OBJS += ../src/common/hw_features_common - - OBJS += ../src/eapol_auth/eapol_auth_sm.o -@@ -12,8 +14,10 @@ - - ifdef CONFIG_CODE_COVERAGE - CFLAGS += -O0 -fprofile-arcs -ftest-coverage ----- a/src/ap/hostapd.h --+++ b/src/ap/hostapd.h -+Index: hostapd-2020-06-08-5a8b3662/src/ap/hostapd.h -+=================================================================== -+--- hostapd-2020-06-08-5a8b3662.orig/src/ap/hostapd.h -++++ hostapd-2020-06-08-5a8b3662/src/ap/hostapd.h - @@ -17,6 +17,7 @@ - #include "utils/list.h" - #include "ap_config.h" -@@ -47,8 +51,10 @@ - void hostapd_interface_deinit(struct hostapd_iface *iface); - void hostapd_interface_free(struct hostapd_iface *iface); - struct hostapd_iface * hostapd_alloc_iface(void); ----- a/src/ap/hostapd.c --+++ b/src/ap/hostapd.c -+Index: hostapd-2020-06-08-5a8b3662/src/ap/hostapd.c -+=================================================================== -+--- hostapd-2020-06-08-5a8b3662.orig/src/ap/hostapd.c -++++ hostapd-2020-06-08-5a8b3662/src/ap/hostapd.c - @@ -395,6 +395,7 @@ void hostapd_free_hapd_data(struct hosta - hapd->beacon_set_done = 0; - -@@ -90,8 +96,10 @@ - hostapd_interface_deinit(iface); - wpa_printf(MSG_DEBUG, "%s: driver=%p drv_priv=%p -> hapd_deinit", - __func__, driver, drv_priv); ----- a/src/ap/ieee802_11.c --+++ b/src/ap/ieee802_11.c -+Index: hostapd-2020-06-08-5a8b3662/src/ap/ieee802_11.c -+=================================================================== -+--- hostapd-2020-06-08-5a8b3662.orig/src/ap/ieee802_11.c -++++ hostapd-2020-06-08-5a8b3662/src/ap/ieee802_11.c - @@ -2327,13 +2327,18 @@ static void handle_auth(struct hostapd_d - u16 auth_alg, auth_transaction, status_code; - u16 resp = WLAN_STATUS_SUCCESS; -@@ -179,8 +187,10 @@ - sta = ap_get_sta(hapd, mgmt->sa); - if (sta == NULL) { - wpa_msg(hapd->msg_ctx, MSG_DEBUG, "Station " MACSTR " trying " ----- a/src/ap/beacon.c --+++ b/src/ap/beacon.c -+Index: hostapd-2020-06-08-5a8b3662/src/ap/beacon.c -+=================================================================== -+--- hostapd-2020-06-08-5a8b3662.orig/src/ap/beacon.c -++++ hostapd-2020-06-08-5a8b3662/src/ap/beacon.c - @@ -814,6 +814,12 @@ void handle_probe_req(struct hostapd_dat - u16 csa_offs[2]; - size_t csa_offs_len; -@@ -207,8 +217,10 @@ - /* TODO: verify that supp_rates contains at least one matching rate - * with AP configuration */ - ----- a/src/ap/drv_callbacks.c --+++ b/src/ap/drv_callbacks.c -+Index: hostapd-2020-06-08-5a8b3662/src/ap/drv_callbacks.c -+=================================================================== -+--- hostapd-2020-06-08-5a8b3662.orig/src/ap/drv_callbacks.c -++++ hostapd-2020-06-08-5a8b3662/src/ap/drv_callbacks.c - @@ -119,6 +119,10 @@ int hostapd_notif_assoc(struct hostapd_d - u16 reason = WLAN_REASON_UNSPECIFIED; - int status = WLAN_STATUS_SUCCESS; -@@ -233,8 +245,10 @@ - #ifdef CONFIG_P2P - if (elems.p2p) { - wpabuf_free(sta->p2p_ie); ----- a/src/ap/sta_info.c --+++ b/src/ap/sta_info.c -+Index: hostapd-2020-06-08-5a8b3662/src/ap/sta_info.c -+=================================================================== -+--- hostapd-2020-06-08-5a8b3662.orig/src/ap/sta_info.c -++++ hostapd-2020-06-08-5a8b3662/src/ap/sta_info.c - @@ -424,6 +424,7 @@ void ap_handle_timer(void *eloop_ctx, vo - HOSTAPD_LEVEL_INFO, "deauthenticated due to " - "local deauth request"); -@@ -259,8 +273,10 @@ - - if (hapd->msg_ctx_parent && - hapd->msg_ctx_parent != hapd->msg_ctx) ----- a/src/ap/wpa_auth_glue.c --+++ b/src/ap/wpa_auth_glue.c -+Index: hostapd-2020-06-08-5a8b3662/src/ap/wpa_auth_glue.c -+=================================================================== -+--- hostapd-2020-06-08-5a8b3662.orig/src/ap/wpa_auth_glue.c -++++ hostapd-2020-06-08-5a8b3662/src/ap/wpa_auth_glue.c - @@ -259,6 +259,7 @@ static void hostapd_wpa_auth_psk_failure - struct hostapd_data *hapd = ctx; - wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_POSSIBLE_PSK_MISMATCH MACSTR, -@@ -269,8 +285,10 @@ - } - - ----- a/wpa_supplicant/Makefile --+++ b/wpa_supplicant/Makefile -+Index: hostapd-2020-06-08-5a8b3662/wpa_supplicant/Makefile -+=================================================================== -+--- hostapd-2020-06-08-5a8b3662.orig/wpa_supplicant/Makefile -++++ hostapd-2020-06-08-5a8b3662/wpa_supplicant/Makefile - @@ -190,6 +190,12 @@ ifdef CONFIG_EAPOL_TEST - CFLAGS += -Werror -DEAPOL_TEST - endif -@@ -294,8 +312,10 @@ - endif - - CFLAGS += -DEAP_SERVER -DEAP_SERVER_IDENTITY ----- a/wpa_supplicant/wpa_supplicant.c --+++ b/wpa_supplicant/wpa_supplicant.c -+Index: hostapd-2020-06-08-5a8b3662/wpa_supplicant/wpa_supplicant.c -+=================================================================== -+--- hostapd-2020-06-08-5a8b3662.orig/wpa_supplicant/wpa_supplicant.c -++++ hostapd-2020-06-08-5a8b3662/wpa_supplicant/wpa_supplicant.c - @@ -6794,6 +6794,8 @@ struct wpa_supplicant * wpa_supplicant_a - } - #endif /* CONFIG_P2P */ -@@ -327,8 +347,10 @@ - return 0; - } - ----- a/wpa_supplicant/wpa_supplicant_i.h --+++ b/wpa_supplicant/wpa_supplicant_i.h -+Index: hostapd-2020-06-08-5a8b3662/wpa_supplicant/wpa_supplicant_i.h -+=================================================================== -+--- hostapd-2020-06-08-5a8b3662.orig/wpa_supplicant/wpa_supplicant_i.h -++++ hostapd-2020-06-08-5a8b3662/wpa_supplicant/wpa_supplicant_i.h - @@ -17,6 +17,7 @@ - #include "wps/wps_defs.h" - #include "config_ssid.h" -@@ -354,8 +376,10 @@ - #ifdef CONFIG_MATCH_IFACE - int matched; - #endif /* CONFIG_MATCH_IFACE */ ----- a/wpa_supplicant/wps_supplicant.c --+++ b/wpa_supplicant/wps_supplicant.c -+Index: hostapd-2020-06-08-5a8b3662/wpa_supplicant/wps_supplicant.c -+=================================================================== -+--- hostapd-2020-06-08-5a8b3662.orig/wpa_supplicant/wps_supplicant.c -++++ hostapd-2020-06-08-5a8b3662/wpa_supplicant/wps_supplicant.c - @@ -33,6 +33,7 @@ - #include "p2p/p2p.h" - #include "p2p_supplicant.h" -@@ -373,8 +397,10 @@ - if (wpa_s->conf->wps_cred_processing == 1) - return 0; - ----- a/hostapd/main.c --+++ b/hostapd/main.c -+Index: hostapd-2020-06-08-5a8b3662/hostapd/main.c -+=================================================================== -+--- hostapd-2020-06-08-5a8b3662.orig/hostapd/main.c -++++ hostapd-2020-06-08-5a8b3662/hostapd/main.c - @@ -896,6 +896,7 @@ int main(int argc, char *argv[]) - } - -@@ -391,8 +417,10 @@ - hostapd_global_ctrl_iface_deinit(&interfaces); - /* Deinitialize all interfaces */ - for (i = 0; i < interfaces.count; i++) { ----- a/wpa_supplicant/main.c --+++ b/wpa_supplicant/main.c -+Index: hostapd-2020-06-08-5a8b3662/wpa_supplicant/main.c -+=================================================================== -+--- hostapd-2020-06-08-5a8b3662.orig/wpa_supplicant/main.c -++++ hostapd-2020-06-08-5a8b3662/wpa_supplicant/main.c - @@ -203,7 +203,7 @@ int main(int argc, char *argv[]) - - for (;;) { -@@ -412,8 +440,10 @@ - case 'o': - params.override_driver = optarg; - break; ----- a/src/ap/rrm.c --+++ b/src/ap/rrm.c -+Index: hostapd-2020-06-08-5a8b3662/src/ap/rrm.c -+=================================================================== -+--- hostapd-2020-06-08-5a8b3662.orig/src/ap/rrm.c -++++ hostapd-2020-06-08-5a8b3662/src/ap/rrm.c - @@ -89,6 +89,9 @@ static void hostapd_handle_beacon_report - return; - wpa_msg(hapd->msg_ctx, MSG_INFO, BEACON_RESP_RX MACSTR " %u %02x %s", -@@ -424,3 +454,16 @@ - } - - -+Index: hostapd-2020-06-08-5a8b3662/src/ap/dfs.c -+=================================================================== -+--- hostapd-2020-06-08-5a8b3662.orig/src/ap/dfs.c -++++ hostapd-2020-06-08-5a8b3662/src/ap/dfs.c -+@@ -1179,6 +1179,8 @@ int hostapd_dfs_radar_detected(struct ho -+ "freq=%d ht_enabled=%d chan_offset=%d chan_width=%d cf1=%d cf2=%d", -+ freq, ht_enabled, chan_offset, chan_width, cf1, cf2); -+ -++ hostapd_ubus_notify_radar_detected(iface->bss[0], freq, cf1, cf2); -++ -+ /* Proceed only if DFS is not offloaded to the driver */ -+ if (iface->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD) -+ return 0; -diff --git a/package/network/services/hostapd/src/src/ap/ubus.c b/package/network/services/hostapd/src/src/ap/ubus.c -index d03b848f94..92851077ad 100644 ---- a/package/network/services/hostapd/src/src/ap/ubus.c -+++ b/package/network/services/hostapd/src/src/ap/ubus.c -@@ -728,6 +728,7 @@ hostapd_switch_chan(struct ubus_context *ctx, struct ubus_object *obj, - struct blob_attr *tb[__CSA_MAX]; - struct hostapd_data *hapd = get_hapd_from_object(obj); - struct csa_settings css; -+ int i; - - blobmsg_parse(csa_policy, __CSA_MAX, tb, blob_data(msg), blob_len(msg)); - -@@ -752,9 +753,10 @@ hostapd_switch_chan(struct ubus_context *ctx, struct ubus_object *obj, - SET_CSA_SETTING(CSA_VHT, freq_params.vht_enabled, bool); - SET_CSA_SETTING(CSA_BLOCK_TX, block_tx, bool); - -+ for (i = 0; i < hapd->iface->num_bss; i++) -+ if (hostapd_switch_channel(hapd->iface->bss[i], &css) != 0) -+ return UBUS_STATUS_NOT_SUPPORTED; - -- if (hostapd_switch_channel(hapd, &css) != 0) -- return UBUS_STATUS_NOT_SUPPORTED; - return UBUS_STATUS_OK; - #undef SET_CSA_SETTING - } -@@ -1550,3 +1552,17 @@ void hostapd_ubus_notify_beacon_report( - - ubus_notify(ctx, &hapd->ubus.obj, "beacon-report", b.head, -1); - } -+ -+void hostapd_ubus_notify_radar_detected(struct hostapd_data *hapd, u16 frequency, -+ u16 cf1, u16 cf2) -+{ -+ if (!hapd->ubus.obj.has_subscribers) -+ return; -+ -+ blob_buf_init(&b, 0); -+ blobmsg_add_u16(&b, "frequency", frequency); -+ blobmsg_add_u16(&b, "center1", cf1); -+ blobmsg_add_u16(&b, "center2", cf2); -+ -+ ubus_notify(ctx, &hapd->ubus.obj, "radar-detected", b.head, -1); -+} -diff --git a/package/network/services/hostapd/src/src/ap/ubus.h b/package/network/services/hostapd/src/src/ap/ubus.h -index e16017394f..f84c8a91f5 100644 ---- a/package/network/services/hostapd/src/src/ap/ubus.h -+++ b/package/network/services/hostapd/src/src/ap/ubus.h -@@ -50,6 +50,8 @@ void hostapd_ubus_notify_beacon_report(struct hostapd_data *hapd, - const u8 *addr, u8 token, u8 rep_mode, - struct rrm_measurement_beacon_report *rep, - size_t len); -+void hostapd_ubus_notify_radar_detected(struct hostapd_data *hapd, -+ u16 frequency, u16 cf1, u16 cf2); - - void hostapd_ubus_add(struct hapd_interfaces *interfaces); - void hostapd_ubus_free(struct hapd_interfaces *interfaces); -@@ -91,6 +93,11 @@ static inline void hostapd_ubus_notify_beacon_report(struct hostapd_data *hapd, - { - } - -+static inline void hostapd_ubus_notify_radar_detected(struct hostapd_data *hapd, u16 frequency, -+ u16 cf1, u16 cf2) -+{ -+} -+ - static inline void hostapd_ubus_add(struct hapd_interfaces *interfaces) - { - } --- -2.25.1 - diff --git a/patches/0033-hostapd-add-more-options.patch b/patches/0033-hostapd-add-more-options.patch deleted file mode 100644 index 77365ecd8..000000000 --- a/patches/0033-hostapd-add-more-options.patch +++ /dev/null @@ -1,253 +0,0 @@ -From 1dc0dfaf92236247d6d0535d56687d7b1aa032c1 Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Thu, 29 Apr 2021 10:51:46 +0200 -Subject: [PATCH 2/2] hostapd: add more options - -Signed-off-by: John Crispin ---- - .../network/services/hostapd/files/hostapd.sh | 20 +++- - ..._request-ignore-when-rssi-is-too-low.patch | 65 ++++++++++++ - .../hostapd/patches/803-max-sta-limit.patch | 100 ++++++++++++++++++ - 3 files changed, 184 insertions(+), 1 deletion(-) - create mode 100644 package/network/services/hostapd/patches/802-probe_request-ignore-when-rssi-is-too-low.patch - create mode 100644 package/network/services/hostapd/patches/803-max-sta-limit.patch - -diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh -index eaff318c97..923f57a33d 100644 ---- a/package/network/services/hostapd/files/hostapd.sh -+++ b/package/network/services/hostapd/files/hostapd.sh -@@ -49,6 +49,7 @@ hostapd_append_wpa_key_mgmt() { - eap192) - append wpa_key_mgmt "WPA-EAP-SUITE-B-192" - [ "${ieee80211r:-0}" -gt 0 ] && append wpa_key_mgmt "FT-EAP" -+ [ "${ieee80211w:-0}" -gt 0 ] && append wpa_key_mgmt "WPA-EAP-SHA256" - ;; - eap-eap192) - append wpa_key_mgmt "WPA-EAP-SUITE-B-192" -@@ -344,6 +345,11 @@ hostapd_common_add_bss_config() { - - config_add_int eap_server - config_add_string eap_user_file ca_cert server_cert private_key private_key_passwd server_id -+ -+ config_add_int beacon_rate -+ config_add_int rssi_reject_assoc_rssi -+ config_add_int rssi_ignore_probe_request -+ config_add_boolean multicast_to_unicast proxy_arp - } - - hostapd_set_vlan_file() { -@@ -511,7 +517,9 @@ hostapd_set_bss_options() { - multi_ap multi_ap_backhaul_ssid multi_ap_backhaul_key skip_inactivity_poll \ - airtime_bss_weight airtime_bss_limit airtime_sta_weight \ - multicast_to_unicast per_sta_vif rts_threshold \ -- eap_server eap_user_file ca_cert server_cert private_key private_key_passwd server_id -+ eap_server eap_user_file ca_cert server_cert private_key private_key_passwd server_id \ -+ rssi_reject_assoc_rssi rssi_ignore_probe_request \ -+ beacon_rate proxy_arp multicast_to_unicast - - set_default isolate 0 - set_default maxassoc 0 -@@ -534,6 +542,10 @@ hostapd_set_bss_options() { - set_default airtime_bss_limit 0 - set_default rts_threshold -1 - set_default eap_server 0 -+ set_default proxy_arp 0 -+ set_default multicast_to_unicast 0 -+ set_default rssi_reject_assoc_rssi 0 -+ set_default rssi_ignore_probe_request 0 - - append bss_conf "ctrl_interface=/var/run/hostapd" - if [ "$isolate" -gt 0 ]; then -@@ -562,6 +574,12 @@ hostapd_set_bss_options() { - append bss_conf "multi_ap=$multi_ap" "$N" - append bss_conf "rts_threshold=$rts_threshold" "$N" - -+ [ -n "$rssi_reject_assoc_rssi" ] && append bss_conf "rssi_reject_assoc_rssi=$rssi_reject_assoc_rssi" "$N" -+ [ -n "$rssi_ignore_probe_request" ] && append bss_conf "rssi_ignore_probe_request=$rssi_ignore_probe_request" "$N" -+ [ -n "$beacon_rate" ] && append bss_conf "beacon_rate=$beacon_rate" "$N" -+ [ -n "$proxy_arp" ] && append bss_conf "proxy_arp=$proxy_arp" "$N" -+ [ -n "$multicast_to_unicast" ] && append bss_conf "multicast_to_unicast=$multicast_to_unicast" "$N" -+ - [ "$tdls_prohibit" -gt 0 ] && append bss_conf "tdls_prohibit=$tdls_prohibit" "$N" - - [ "$wpa" -gt 0 ] && { -diff --git a/package/network/services/hostapd/patches/802-probe_request-ignore-when-rssi-is-too-low.patch b/package/network/services/hostapd/patches/802-probe_request-ignore-when-rssi-is-too-low.patch -new file mode 100644 -index 0000000000..eecfdcc388 ---- /dev/null -+++ b/package/network/services/hostapd/patches/802-probe_request-ignore-when-rssi-is-too-low.patch -@@ -0,0 +1,65 @@ -+From e15b04870a7d7517a9b129d8d5cbebe6b8a25cb8 Mon Sep 17 00:00:00 2001 -+From: John Crispin -+Date: Wed, 29 Jul 2020 17:38:15 +0200 -+Subject: [PATCH 1/2] probe_request: ignore when rssi is too low -+ -+Signed-off-by: John Crispin -+--- -+ hostapd/config_file.c | 2 ++ -+ src/ap/ap_config.c | 1 + -+ src/ap/ap_config.h | 1 + -+ src/ap/beacon.c | 4 ++++ -+ 4 files changed, 8 insertions(+) -+ -+Index: hostapd-2020-06-08-5a8b3662/hostapd/config_file.c -+=================================================================== -+--- hostapd-2020-06-08-5a8b3662.orig/hostapd/config_file.c -++++ hostapd-2020-06-08-5a8b3662/hostapd/config_file.c -+@@ -4552,6 +4552,8 @@ static int hostapd_config_fill(struct ho -+ conf->rssi_reject_assoc_rssi = atoi(pos); -+ } else if (os_strcmp(buf, "rssi_reject_assoc_timeout") == 0) { -+ conf->rssi_reject_assoc_timeout = atoi(pos); -++ } else if (os_strcmp(buf, "rssi_ignore_probe_request") == 0) { -++ conf->rssi_ignore_probe_request = atoi(pos); -+ } else if (os_strcmp(buf, "pbss") == 0) { -+ bss->pbss = atoi(pos); -+ } else if (os_strcmp(buf, "transition_disable") == 0) { -+Index: hostapd-2020-06-08-5a8b3662/src/ap/ap_config.c -+=================================================================== -+--- hostapd-2020-06-08-5a8b3662.orig/src/ap/ap_config.c -++++ hostapd-2020-06-08-5a8b3662/src/ap/ap_config.c -+@@ -277,6 +277,7 @@ struct hostapd_config * hostapd_config_d -+ -+ conf->rssi_reject_assoc_rssi = 0; -+ conf->rssi_reject_assoc_timeout = 30; -++ conf->rssi_ignore_probe_request = 0; -+ -+ #ifdef CONFIG_AIRTIME_POLICY -+ conf->airtime_update_interval = AIRTIME_DEFAULT_UPDATE_INTERVAL; -+Index: hostapd-2020-06-08-5a8b3662/src/ap/ap_config.h -+=================================================================== -+--- hostapd-2020-06-08-5a8b3662.orig/src/ap/ap_config.h -++++ hostapd-2020-06-08-5a8b3662/src/ap/ap_config.h -+@@ -1051,6 +1051,7 @@ struct hostapd_config { -+ -+ int rssi_reject_assoc_rssi; -+ int rssi_reject_assoc_timeout; -++ int rssi_ignore_probe_request; -+ -+ #ifdef CONFIG_AIRTIME_POLICY -+ enum { -+Index: hostapd-2020-06-08-5a8b3662/src/ap/beacon.c -+=================================================================== -+--- hostapd-2020-06-08-5a8b3662.orig/src/ap/beacon.c -++++ hostapd-2020-06-08-5a8b3662/src/ap/beacon.c -+@@ -821,6 +821,10 @@ void handle_probe_req(struct hostapd_dat -+ .elems = &elems, -+ }; -+ -++ if (hapd->iconf->rssi_ignore_probe_request && ssi_signal && -++ ssi_signal < hapd->iconf->rssi_ignore_probe_request) -++ return; -++ -+ if (len < IEEE80211_HDRLEN) -+ return; -+ ie = ((const u8 *) mgmt) + IEEE80211_HDRLEN; -diff --git a/package/network/services/hostapd/patches/803-max-sta-limit.patch b/package/network/services/hostapd/patches/803-max-sta-limit.patch -new file mode 100644 -index 0000000000..4c33d7e772 ---- /dev/null -+++ b/package/network/services/hostapd/patches/803-max-sta-limit.patch -@@ -0,0 +1,100 @@ -+Index: hostapd-2020-06-08-5a8b3662/hostapd/config_file.c -+=================================================================== -+--- hostapd-2020-06-08-5a8b3662.orig/hostapd/config_file.c -++++ hostapd-2020-06-08-5a8b3662/hostapd/config_file.c -+@@ -2909,6 +2909,11 @@ static int hostapd_config_fill(struct ho -+ line); -+ return 1; -+ } -++ } else if (os_strcmp(buf, "global_max_num_sta") == 0) { -++ conf->global_max_num_sta = atoi(pos); -++ if (conf->global_max_num_sta < 0 || -++ conf->global_max_num_sta > MAX_STA_COUNT) -++ conf->global_max_num_sta = MAX_STA_COUNT; -+ } else if (os_strcmp(buf, "max_num_sta") == 0) { -+ bss->max_num_sta = atoi(pos); -+ if (bss->max_num_sta < 0 || -+Index: hostapd-2020-06-08-5a8b3662/src/ap/ap_config.c -+=================================================================== -+--- hostapd-2020-06-08-5a8b3662.orig/src/ap/ap_config.c -++++ hostapd-2020-06-08-5a8b3662/src/ap/ap_config.c -+@@ -223,6 +223,8 @@ struct hostapd_config * hostapd_config_d -+ -+ conf->num_bss = 1; -+ -++ conf->global_max_num_sta = 0; -++ -+ conf->beacon_int = 100; -+ conf->rts_threshold = -2; /* use driver default: 2347 */ -+ conf->fragm_threshold = -2; /* user driver default: 2346 */ -+Index: hostapd-2020-06-08-5a8b3662/src/ap/ap_config.h -+=================================================================== -+--- hostapd-2020-06-08-5a8b3662.orig/src/ap/ap_config.h -++++ hostapd-2020-06-08-5a8b3662/src/ap/ap_config.h -+@@ -1067,6 +1067,7 @@ struct hostapd_config { -+ char *config_id; -+ -+ u8 notify_mgmt_frames; -++ int global_max_num_sta; -+ }; -+ -+ -+Index: hostapd-2020-06-08-5a8b3662/src/ap/beacon.c -+=================================================================== -+--- hostapd-2020-06-08-5a8b3662.orig/src/ap/beacon.c -++++ hostapd-2020-06-08-5a8b3662/src/ap/beacon.c -+@@ -1030,7 +1030,8 @@ void handle_probe_req(struct hostapd_dat -+ if (hapd->conf->no_probe_resp_if_max_sta && -+ is_multicast_ether_addr(mgmt->da) && -+ is_multicast_ether_addr(mgmt->bssid) && -+- hapd->num_sta >= hapd->conf->max_num_sta && -++ hapd_check_max_sta(hapd) && -++// hapd->num_sta >= hapd->conf->max_num_sta && -+ !ap_get_sta(hapd, mgmt->sa)) { -+ wpa_printf(MSG_MSGDUMP, "%s: Ignore Probe Request from " MACSTR -+ " since no room for additional STA", -+Index: hostapd-2020-06-08-5a8b3662/src/ap/sta_info.c -+=================================================================== -+--- hostapd-2020-06-08-5a8b3662.orig/src/ap/sta_info.c -++++ hostapd-2020-06-08-5a8b3662/src/ap/sta_info.c -+@@ -682,7 +682,8 @@ struct sta_info * ap_sta_add(struct host -+ return sta; -+ -+ wpa_printf(MSG_DEBUG, " New STA"); -+- if (hapd->num_sta >= hapd->conf->max_num_sta) { -++ if (hapd_check_max_sta(hapd)) { -++// if (hapd->num_sta >= hapd->conf->max_num_sta) { -+ /* FIX: might try to remove some old STAs first? */ -+ wpa_printf(MSG_DEBUG, "no more room for new STAs (%d/%d)", -+ hapd->num_sta, hapd->conf->max_num_sta); -+Index: hostapd-2020-06-08-5a8b3662/src/ap/hostapd.c -+=================================================================== -+--- hostapd-2020-06-08-5a8b3662.orig/src/ap/hostapd.c -++++ hostapd-2020-06-08-5a8b3662/src/ap/hostapd.c -+@@ -3776,3 +3776,15 @@ void hostapd_ocv_check_csa_sa_query(void -+ } -+ } -+ #endif /* CONFIG_OCV */ -++ -++int hapd_check_max_sta(struct hostapd_data *hapd) -++{ -++ int cnt = 0, i; -++ -++ if (!hapd->iconf->global_max_num_sta) -++ return hapd->num_sta >= hapd->conf->max_num_sta; -++ -++ for (i = 0; i < hapd->iface->num_bss; i++) -++ cnt += hapd->iface->bss[i]->num_sta; -++ return cnt >= hapd->iconf->global_max_num_sta; -++} -+Index: hostapd-2020-06-08-5a8b3662/src/ap/hostapd.h -+=================================================================== -+--- hostapd-2020-06-08-5a8b3662.orig/src/ap/hostapd.h -++++ hostapd-2020-06-08-5a8b3662/src/ap/hostapd.h -+@@ -689,4 +689,6 @@ void fst_hostapd_fill_iface_obj(struct h -+ struct fst_wpa_obj *iface_obj); -+ #endif /* CONFIG_FST */ -+ -++int hapd_check_max_sta(struct hostapd_data *hapd); -++ -+ #endif /* HOSTAPD_H */ --- -2.25.1 - diff --git a/patches/0036-certificates-add-ability-to-persistently-store-certi.patch b/patches/0036-certificates-add-ability-to-persistently-store-certi.patch index 3b4484c67..6495b30f5 100644 --- a/patches/0036-certificates-add-ability-to-persistently-store-certi.patch +++ b/patches/0036-certificates-add-ability-to-persistently-store-certi.patch @@ -1,13 +1,15 @@ -From 33334a615a88591e3b1f8954ba5a1122c5a9111d Mon Sep 17 00:00:00 2001 +From 4c0d4870b8b7d2d816346b47e9e7f311366dedfc Mon Sep 17 00:00:00 2001 From: John Crispin Date: Sun, 23 May 2021 09:59:53 +0200 -Subject: [PATCH] certificates: add ability to persistently store certificates +Subject: [PATCH 1/4] certificates: add ability to persistently store + certificates Signed-off-by: John Crispin --- package/base-files/files/lib/upgrade/nand.sh | 9 +++++++++ .../files/arch/arm/boot/dts/qcom-ipq4019-xx8300.dtsi | 3 +-- - 2 files changed, 10 insertions(+), 2 deletions(-) + .../linux/realtek/dts/rtl8392_edgecore_ecs4100-12ph.dts | 8 ++++++-- + 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/package/base-files/files/lib/upgrade/nand.sh b/package/base-files/files/lib/upgrade/nand.sh index ab3db4cdf2..36977244bc 100644 @@ -51,6 +53,28 @@ index 8f971e505c..0f1f083a5b 100644 }; }; }; +diff --git a/target/linux/realtek/dts/rtl8392_edgecore_ecs4100-12ph.dts b/target/linux/realtek/dts/rtl8392_edgecore_ecs4100-12ph.dts +index 303b79ac83..7a228aea86 100644 +--- a/target/linux/realtek/dts/rtl8392_edgecore_ecs4100-12ph.dts ++++ b/target/linux/realtek/dts/rtl8392_edgecore_ecs4100-12ph.dts +@@ -176,11 +176,15 @@ + reg = <0x100000 0x100000>; + read-only; + }; +- partition@b260000 { ++ partition@200000 { + label = "firmware"; +- reg = <0x200000 0xe00000>; ++ reg = <0x200000 0xdf0000>; + compatible = "openwrt,uimage", "denx,uimage"; + }; ++ partition@ff0000 { ++ label = "certificates"; ++ reg = <0xff0000 0x10000>; ++ }; + }; + }; + }; -- 2.25.1 diff --git a/profiles/qcom_hk14.yml b/profiles/qcom_hk14.yml new file mode 100644 index 000000000..a9c33238a --- /dev/null +++ b/profiles/qcom_hk14.yml @@ -0,0 +1,14 @@ +--- +profile: qcom_hk14 +target: ipq807x +subtarget: ipq807x +description: Build image for the Qualcom HK14/6E +image: bin/targets/ipq807x/ipq807x/openwrt-ipq807x-edgecore_eap102-squashfs-sysupgrade.tar +feeds: + - name: ipq807x + path: ../../feeds/ipq807x +include: + - wifi-ax + - ucentral-ap +packages: + - kmod-ath11k-pci diff --git a/profiles/tplink_ex228.yml b/profiles/tplink_ex228.yml new file mode 100644 index 000000000..9bdc13677 --- /dev/null +++ b/profiles/tplink_ex228.yml @@ -0,0 +1,8 @@ +--- +profile: tplink_ex228 +target: ramips +subtarget: mt7621 +description: Build image for the TP-Link EX228 +image: bin/targets/ipq807x/ipq807x/openwrt-ipq807x-tplink_ex227-squashfs-sysupgrade.tar +include: + - ucentral-ap