From 34988a2bb2b87ad58cdec828c6ea8389c3bca331 Mon Sep 17 00:00:00 2001 From: Rudy Andram Date: Sat, 24 Aug 2024 17:37:09 +0100 Subject: [PATCH 01/40] change mt76 to repo supporting mt7996 233 enable hostapd to support 11be --- package/kernel/mt76/Makefile | 8 +-- package/network/services/hostapd/Config.in | 9 ++- package/network/services/hostapd/Makefile | 8 +++ .../803-hostapd-fix-80211be-build.patch | 57 +++++++++++++++++++ .../hostapd/src/src/utils/build_features.h | 4 ++ 5 files changed, 80 insertions(+), 6 deletions(-) create mode 100644 package/network/services/hostapd/patches/803-hostapd-fix-80211be-build.patch diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile index 2501f37d3090b8..2b9225f6f58a36 100644 --- a/package/kernel/mt76/Makefile +++ b/package/kernel/mt76/Makefile @@ -1,15 +1,15 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mt76 -PKG_RELEASE=1 +PKG_RELEASE=2 PKG_LICENSE:=GPLv2 PKG_LICENSE_FILES:= -PKG_SOURCE_URL:=https://github.com/openwrt/mt76 +PKG_SOURCE_URL:=https://github.com/rmandrad/mt76 PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2024-08-21 -PKG_SOURCE_VERSION:=a5e630ef458ce7b91bf522247ef3320ed5845e2a +PKG_SOURCE_DATE:=2024-08-24 +PKG_SOURCE_VERSION:=90e457b04357318cf347562c487881a4833f0d52 PKG_MIRROR_HASH:=a16f647206d68d67f9b2b134935f27ed66b7302a4ca8243842987dcfafbe8317 PKG_MAINTAINER:=Felix Fietkau diff --git a/package/network/services/hostapd/Config.in b/package/network/services/hostapd/Config.in index 1fff4f8acd530b..bd1d94c583a760 100644 --- a/package/network/services/hostapd/Config.in +++ b/package/network/services/hostapd/Config.in @@ -33,11 +33,11 @@ config WPA_WOLFSSL config DRIVER_11AC_SUPPORT bool - default n + default y config DRIVER_11AX_SUPPORT bool - default n + default y select WPA_MBO_SUPPORT config WPA_ENABLE_WEP @@ -59,3 +59,8 @@ config WPA_MBO_SUPPORT that facilitate efficient use of multiple frequency bands. Enabling MBO on an AP using RSN requires 802.11w to be enabled. Hostapd will refuse to start if MBO and RSN are enabled without 11w. + +config DRIVER_11BE_SUPPORT + bool + default y + diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile index b62592b7240fa6..4cfae6d85b4a9f 100644 --- a/package/network/services/hostapd/Makefile +++ b/package/network/services/hostapd/Makefile @@ -27,6 +27,7 @@ PKG_CONFIG_DEPENDS:= \ CONFIG_WPA_RFKILL_SUPPORT \ CONFIG_DRIVER_11AC_SUPPORT \ CONFIG_DRIVER_11AX_SUPPORT \ + CONFIG_DRIVER_11BE_SUPPORT \ CONFIG_WPA_ENABLE_WEP PKG_BUILD_FLAGS:=gc-sections lto @@ -79,6 +80,12 @@ ifneq ($(CONFIG_DRIVER_11AX_SUPPORT),) HOSTAPD_IEEE80211AX:=y endif +ifneq ($(CONFIG_DRIVER_11BE_SUPPORT),) + HOSTAPD_IEEE80211BE:=y +endif + + + CORE_DEPENDS = +ucode +libubus +libucode +ucode-mod-fs +ucode-mod-nl80211 +ucode-mod-rtnl +ucode-mod-ubus +ucode-mod-uloop +libblobmsg-json +libudebug OPENSSL_DEPENDS = +PACKAGE_$(1):libopenssl +PACKAGE_$(1):libopenssl-legacy @@ -86,6 +93,7 @@ DRIVER_MAKEOPTS= \ CONFIG_ACS=y CONFIG_DRIVER_NL80211=y \ CONFIG_IEEE80211AC=$(HOSTAPD_IEEE80211AC) \ CONFIG_IEEE80211AX=$(HOSTAPD_IEEE80211AX) \ + CONFIG_IEEE80211BE=$(HOSTAPD_IEEE80211BE) \ CONFIG_MBO=$(CONFIG_WPA_MBO_SUPPORT) \ CONFIG_UCODE=y CONFIG_APUP=y diff --git a/package/network/services/hostapd/patches/803-hostapd-fix-80211be-build.patch b/package/network/services/hostapd/patches/803-hostapd-fix-80211be-build.patch new file mode 100644 index 00000000000000..7169bcc61e4210 --- /dev/null +++ b/package/network/services/hostapd/patches/803-hostapd-fix-80211be-build.patch @@ -0,0 +1,57 @@ +Index: hostapd-2024.03.09~695277a5/src/ap/sta_info.c +=================================================================== +--- hostapd-2024.03.09~695277a5.orig/src/ap/sta_info.c ++++ hostapd-2024.03.09~695277a5/src/ap/sta_info.c +@@ -1836,3 +1836,22 @@ void ap_sta_free_sta_profile(struct mld_ + } + } + #endif /* CONFIG_IEEE80211BE */ ++ ++bool ap_sta_is_mld(struct hostapd_data *hapd, ++ struct sta_info *sta) ++{ ++#ifdef CONFIG_IEEE80211BE ++ return hapd->conf->mld_ap && sta && sta->mld_info.mld_sta; ++#else /* CONFIG_IEEE80211BE */ ++ return false; ++#endif /* CONFIG_IEEE80211BE */ ++} ++ ++void ap_sta_set_mld(struct sta_info *sta, bool mld) ++{ ++#ifdef CONFIG_IEEE80211BE ++ if (sta) ++ sta->mld_info.mld_sta = mld; ++#endif /* CONFIG_IEEE80211BE */ ++} ++ +Index: hostapd-2024.03.09~695277a5/src/ap/sta_info.h +=================================================================== +--- hostapd-2024.03.09~695277a5.orig/src/ap/sta_info.h ++++ hostapd-2024.03.09~695277a5/src/ap/sta_info.h +@@ -417,23 +417,8 @@ int ap_sta_re_add(struct hostapd_data *h + + void ap_free_sta_pasn(struct hostapd_data *hapd, struct sta_info *sta); + +-static inline bool ap_sta_is_mld(struct hostapd_data *hapd, +- struct sta_info *sta) +-{ +-#ifdef CONFIG_IEEE80211BE +- return hapd->conf->mld_ap && sta && sta->mld_info.mld_sta; +-#else /* CONFIG_IEEE80211BE */ +- return false; +-#endif /* CONFIG_IEEE80211BE */ +-} +- +-static inline void ap_sta_set_mld(struct sta_info *sta, bool mld) +-{ +-#ifdef CONFIG_IEEE80211BE +- if (sta) +- sta->mld_info.mld_sta = mld; +-#endif /* CONFIG_IEEE80211BE */ +-} ++bool ap_sta_is_mld(struct hostapd_data *hapd, struct sta_info *sta); ++void ap_sta_set_mld(struct sta_info *sta, bool mld); + + void ap_sta_free_sta_profile(struct mld_info *info); + diff --git a/package/network/services/hostapd/src/src/utils/build_features.h b/package/network/services/hostapd/src/src/utils/build_features.h index 553769ecebc84c..cc8831535c68da 100644 --- a/package/network/services/hostapd/src/src/utils/build_features.h +++ b/package/network/services/hostapd/src/src/utils/build_features.h @@ -15,6 +15,10 @@ static inline int has_feature(const char *feat) if (!strcmp(feat, "11ax")) return 1; #endif +#ifdef CONFIG_IEEE80211BE + if (!strcmp(feat, "11be")) + return 1; +#endif #ifdef CONFIG_IEEE80211R if (!strcmp(feat, "11r")) return 1; From 1dfe8329cb008d0117808726cb99e0350eae3143 Mon Sep 17 00:00:00 2001 From: Rudy Andram Date: Sat, 31 Aug 2024 06:01:39 +0100 Subject: [PATCH 02/40] bump hostapd to v2.12-devel --- package/kernel/mt76/Makefile | 4 +- package/network/services/hostapd/Makefile | 6 +- .../hostapd/files/hostapd-basic.config | 59 +- .../hostapd/files/hostapd-full.config | 59 +- .../hostapd/files/hostapd-mini.config | 59 +- .../hostapd/files/wpa_supplicant-basic.config | 65 +- .../hostapd/files/wpa_supplicant-full.config | 65 +- .../hostapd/files/wpa_supplicant-mini.config | 67 +- .../hostapd/files/wpa_supplicant-p2p.config | 65 +- ...hannels-to-be-selected-if-dfs-is-ena.patch | 24 +- ...erministic-channel-on-channel-switch.patch | 8 +- ...ix-sta-add-after-previous-connection.patch | 4 +- ...-dl_list_del-before-freeing-ipv6-add.patch | 19 - ...ewrite-neigh-code-to-not-depend-on-l.patch | 275 --- ...ssing-authentication-frames-in-block.patch | 34 - .../patches/050-Fix-OpenWrt-13156.patch | 6 +- ...-extra-ies-only-if-allowed-by-driver.patch | 6 +- ...ull-pointer-check-in-hostapd_free_ha.patch | 2 +- ...crash-when-adding-an-interface-fails.patch | 21 - ...edtls-TLS-crypto-option-initial-port.patch | 22 +- .../patches/120-mbedtls-fips186_2_prf.patch | 2 +- ...efile-make-run-tests-with-CONFIG_TLS.patch | 22 +- ...tapd-update-cfs0-and-cfs1-for-160MHz.patch | 2 +- ...pdate-drv-ifindex-on-removing-the-fi.patch | 18 - ...0211_put_freq_params-call-outside-of.patch | 34 - ...hannel_list_update_timeout-in-hostap.patch | 28 - .../hostapd/patches/200-multicall.patch | 56 +- .../patches/201-lto-jobserver-support.patch | 6 +- ...duplicate-_DIRS-before-calling-mkdir.patch | 23 - ..._AP-functions-dependant-on-CONFIG_AP.patch | 4 +- .../patches/220-indicate-features.patch | 4 +- .../patches/250-hostapd_cli_ifdef.patch | 4 +- .../patches/252-disable_ctrl_iface_mib.patch | 32 +- ...253-qos_map_set_without_interworking.patch | 103 - .../services/hostapd/patches/300-noscan.patch | 6 +- .../hostapd/patches/301-mesh-noscan.patch | 12 +- .../patches/310-rescan_immediately.patch | 2 +- .../patches/330-nl80211_fix_set_freq.patch | 2 +- .../patches/350-nl80211_del_beacon_bss.patch | 26 +- ...dd-new-config-params-to-be-used-with.patch | 4 +- .../patches/463-add-mcast_rate-to-11s.patch | 6 +- .../patches/464-fix-mesh-obss-check.patch | 2 +- ...tapd-config-support-random-BSS-color.patch | 2 +- .../patches/470-survey_data_fallback.patch | 4 +- .../patches/590-rrm-wnm-statistics.patch | 6 +- .../hostapd/patches/600-ubus_support.patch | 74 +- .../hostapd/patches/601-ucode_support.patch | 80 +- .../patches/701-reload_config_inline.patch | 2 +- .../hostapd/patches/710-vlan_no_bridge.patch | 2 +- .../patches/711-wds_bridge_force.patch | 4 +- .../patches/720-iface_max_num_sta.patch | 8 +- .../hostapd/patches/730-ft_iface.patch | 4 +- .../hostapd/patches/740-snoop_iface.patch | 10 +- .../751-qos_map_ignore_when_unsupported.patch | 19 - .../hostapd/patches/760-dynamic_own_ip.patch | 6 +- .../hostapd/patches/761-shared_das_port.patch | 28 +- ...probe-requests-with-invalid-DSSS-par.patch | 7 +- .../hostapd/patches/770-radius_server.patch | 8 +- ...ment-APuP-Access-Point-Micro-Peering.patch | 52 +- ...us-notification-when-a-peer-comes-up.patch | 15 +- ...-ucode-hook-for-when-a-peer-comes-up.patch | 15 +- ...valid-Rejected-Groups-element-length.patch | 43 - ...valid-Rejected-Groups-element-length.patch | 42 - ...id-Rejected-Groups-element-in-the-pa.patch | 6 +- .../services/hostapd/src/src/utils/ap/ubus.c | 2006 +++++++++++++++++ .../services/hostapd/src/src/utils/ap/ubus.h | 157 ++ .../services/hostapd/src/src/utils/ap/ucode.c | 817 +++++++ .../services/hostapd/src/src/utils/ap/ucode.h | 54 + 68 files changed, 3639 insertions(+), 1100 deletions(-) delete mode 100644 package/network/services/hostapd/patches/023-ndisc_snoop-call-dl_list_del-before-freeing-ipv6-add.patch delete mode 100644 package/network/services/hostapd/patches/030-driver_nl80211-rewrite-neigh-code-to-not-depend-on-l.patch delete mode 100644 package/network/services/hostapd/patches/040-mesh-allow-processing-authentication-frames-in-block.patch delete mode 100644 package/network/services/hostapd/patches/060-nl80211-fix-crash-when-adding-an-interface-fails.patch delete mode 100644 package/network/services/hostapd/patches/181-driver_nl80211-update-drv-ifindex-on-removing-the-fi.patch delete mode 100644 package/network/services/hostapd/patches/182-nl80211-move-nl80211_put_freq_params-call-outside-of.patch delete mode 100644 package/network/services/hostapd/patches/183-hostapd-cancel-channel_list_update_timeout-in-hostap.patch delete mode 100644 package/network/services/hostapd/patches/210-build-de-duplicate-_DIRS-before-calling-mkdir.patch delete mode 100644 package/network/services/hostapd/patches/253-qos_map_set_without_interworking.patch delete mode 100644 package/network/services/hostapd/patches/751-qos_map_ignore_when_unsupported.patch delete mode 100644 package/network/services/hostapd/patches/800-SAE-Check-for-invalid-Rejected-Groups-element-length.patch delete mode 100644 package/network/services/hostapd/patches/801-SAE-Check-for-invalid-Rejected-Groups-element-length.patch create mode 100644 package/network/services/hostapd/src/src/utils/ap/ubus.c create mode 100644 package/network/services/hostapd/src/src/utils/ap/ubus.h create mode 100644 package/network/services/hostapd/src/src/utils/ap/ucode.c create mode 100644 package/network/services/hostapd/src/src/utils/ap/ucode.h diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile index d897e3ca13120b..41e108fbb7fdce 100644 --- a/package/kernel/mt76/Makefile +++ b/package/kernel/mt76/Makefile @@ -10,8 +10,8 @@ PKG_SOURCE_URL:=https://github.com/rmandrad/mt76 PKG_SOURCE_PROTO:=git PKG_SOURCE_DATE:=2024-08-27 -PKG_SOURCE_VERSION:=869ebe76c70b6c4c690ca0d26ac3d6df56e02f3c -PKG_MIRROR_HASH:=a16f647206d68d67f9b2b134935f27ed66b7302a4ca8243842987dcfafbe8317 +PKG_SOURCE_VERSION:=86441173c39f5ea147948f2b8703cf46c986463c +PKG_MIRROR_HASH:=025750d2c4269434673085d94c929fd1d82c4ef54e9ab3995e4927ec28922375 PKG_MAINTAINER:=Felix Fietkau PKG_USE_NINJA:=0 diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile index 4cfae6d85b4a9f..942e5aa051778e 100644 --- a/package/network/services/hostapd/Makefile +++ b/package/network/services/hostapd/Makefile @@ -7,11 +7,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=hostapd PKG_RELEASE:=3 -PKG_SOURCE_URL:=https://w1.fi/hostap.git +PKG_SOURCE_URL:=https://github.com/rmandrad/hostapd PKG_SOURCE_PROTO:=git PKG_SOURCE_DATE:=2024-03-09 -PKG_SOURCE_VERSION:=695277a5b3da08b9a8a4e7117b933deb8b4950a7 -PKG_MIRROR_HASH:=57b8e64d24707e37e0df3359cee15dd5184b824b8622568833a5b8a0cae163ae +PKG_SOURCE_VERSION:=fc77a7d6c634d2135a4f3c6a1333026b18d03162 +PKG_MIRROR_HASH:=21a606c3d00ddc3be9f81f264147dc7bbc6edcda57c79a862e251da6297dc10e PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=BSD-3-Clause diff --git a/package/network/services/hostapd/files/hostapd-basic.config b/package/network/services/hostapd/files/hostapd-basic.config index 3d19d8f902f08a..dbd1f9dedef514 100644 --- a/package/network/services/hostapd/files/hostapd-basic.config +++ b/package/network/services/hostapd/files/hostapd-basic.config @@ -44,15 +44,9 @@ CONFIG_DRIVER_NL80211=y # Driver interface for no driver (e.g., RADIUS server only) #CONFIG_DRIVER_NONE=y -# IEEE 802.11F/IAPP -#CONFIG_IAPP=y - # WPA2/IEEE 802.11i RSN pre-authentication CONFIG_RSN_PREAUTH=y -# IEEE 802.11w (management frame protection) -#CONFIG_IEEE80211W=y - # Support Operating Channel Validation CONFIG_OCV=y @@ -154,9 +148,6 @@ CONFIG_IEEE80211R=y # the IEEE 802.11 Management capability (e.g., FreeBSD/net80211) #CONFIG_DRIVER_RADIUS_ACL=y -# IEEE 802.11n (High Throughput) support -CONFIG_IEEE80211N=y - # Wireless Network Management (IEEE Std 802.11v-2011) # Note: This is experimental and not complete implementation. #CONFIG_WNM=y @@ -165,10 +156,20 @@ CONFIG_IEEE80211N=y CONFIG_IEEE80211AC=y # IEEE 802.11ax HE support +#CONFIG_IEEE80211AX=y + +# IEEE 802.11be EHT support +# CONFIG_IEEE80211AX is mandatory for setting CONFIG_IEEE80211BE. # Note: This is experimental and work in progress. The definitions are still # subject to change and this should not be expected to interoperate with the -# final IEEE 802.11ax version. -#CONFIG_IEEE80211AX=y +# final IEEE 802.11be version. +CONFIG_IEEE80211BE=y + +# Simultaneous Authentication of Equals (SAE), WPA3-Personal +#CONFIG_SAE=y + +# SAE Public Key, WPA3-Personal +#CONFIG_SAE_PK=y # Remove debugging code that is printing out debug messages to stdout. # This can be used to reduce the size of the hostapd considerably if debugging @@ -355,12 +356,12 @@ CONFIG_TLS=internal # * ath10k # # For more details refer to: -# http://wireless.kernel.org/en/users/Documentation/acs +# https://wireless.wiki.kernel.org/en/users/documentation/acs # #CONFIG_ACS=y # Multiband Operation support -# These extentions facilitate efficient use of multiple frequency bands +# These extensions facilitate efficient use of multiple frequency bands # available to the AP and the devices that may associate with it. #CONFIG_MBO=y @@ -386,13 +387,39 @@ CONFIG_TLS=internal # Airtime policy support CONFIG_AIRTIME_POLICY=y -# Proxy ARP support -#CONFIG_PROXYARP=y - # Override default value for the wpa_disable_eapol_key_retries configuration # parameter. See that parameter in hostapd.conf for more details. #CFLAGS += -DDEFAULT_WPA_DISABLE_EAPOL_KEY_RETRIES=1 +# Wired equivalent privacy (WEP) +# WEP is an obsolete cryptographic data confidentiality algorithm that is not +# considered secure. It should not be used for anything anymore. The +# functionality needed to use WEP is available in the current hostapd +# release under this optional build parameter. This functionality is subject to +# be completely removed in a future release. +#CONFIG_WEP=y + +# Remove all TKIP functionality +# TKIP is an old cryptographic data confidentiality algorithm that is not +# considered secure. It should not be used anymore. For now, the default hostapd +# build includes this to allow mixed mode WPA+WPA2 networks to be enabled, but +# that functionality is subject to be removed in the future. +#CONFIG_NO_TKIP=y + +# Pre-Association Security Negotiation (PASN) +# Experimental implementation based on IEEE P802.11z/D2.6 and the protocol +# design is still subject to change. As such, this should not yet be enabled in +# production use. +#CONFIG_PASN=y + +# Device Provisioning Protocol (DPP) (also known as Wi-Fi Easy Connect) +#CONFIG_DPP=y +# DPP version 2 support +#CONFIG_DPP2=y +# DPP version 3 support (experimental and still changing; do not enable for +# production use) +#CONFIG_DPP3=y + # uBus IPC/RPC System # Services can connect to the bus and provide methods # that can be called by other services or clients. diff --git a/package/network/services/hostapd/files/hostapd-full.config b/package/network/services/hostapd/files/hostapd-full.config index 9076ebc44f95df..6b17708e52585c 100644 --- a/package/network/services/hostapd/files/hostapd-full.config +++ b/package/network/services/hostapd/files/hostapd-full.config @@ -44,15 +44,9 @@ CONFIG_DRIVER_NL80211=y # Driver interface for no driver (e.g., RADIUS server only) #CONFIG_DRIVER_NONE=y -# IEEE 802.11F/IAPP -CONFIG_IAPP=y - # WPA2/IEEE 802.11i RSN pre-authentication CONFIG_RSN_PREAUTH=y -# IEEE 802.11w (management frame protection) -#CONFIG_IEEE80211W=y - # Support Operating Channel Validation CONFIG_OCV=y @@ -154,9 +148,6 @@ CONFIG_IEEE80211R=y # the IEEE 802.11 Management capability (e.g., FreeBSD/net80211) #CONFIG_DRIVER_RADIUS_ACL=y -# IEEE 802.11n (High Throughput) support -CONFIG_IEEE80211N=y - # Wireless Network Management (IEEE Std 802.11v-2011) # Note: This is experimental and not complete implementation. CONFIG_WNM=y @@ -165,10 +156,20 @@ CONFIG_WNM=y CONFIG_IEEE80211AC=y # IEEE 802.11ax HE support +#CONFIG_IEEE80211AX=y + +# IEEE 802.11be EHT support +# CONFIG_IEEE80211AX is mandatory for setting CONFIG_IEEE80211BE. # Note: This is experimental and work in progress. The definitions are still # subject to change and this should not be expected to interoperate with the -# final IEEE 802.11ax version. -#CONFIG_IEEE80211AX=y +# final IEEE 802.11be version. +CONFIG_IEEE80211BE=y + +# Simultaneous Authentication of Equals (SAE), WPA3-Personal +#CONFIG_SAE=y + +# SAE Public Key, WPA3-Personal +#CONFIG_SAE_PK=y # Remove debugging code that is printing out debug messages to stdout. # This can be used to reduce the size of the hostapd considerably if debugging @@ -355,12 +356,12 @@ CONFIG_HS20=y # * ath10k # # For more details refer to: -# http://wireless.kernel.org/en/users/Documentation/acs +# https://wireless.wiki.kernel.org/en/users/documentation/acs # #CONFIG_ACS=y # Multiband Operation support -# These extentions facilitate efficient use of multiple frequency bands +# These extensions facilitate efficient use of multiple frequency bands # available to the AP and the devices that may associate with it. #CONFIG_MBO=y @@ -386,13 +387,39 @@ CONFIG_TAXONOMY=y # Airtime policy support CONFIG_AIRTIME_POLICY=y -# Proxy ARP support -CONFIG_PROXYARP=y - # Override default value for the wpa_disable_eapol_key_retries configuration # parameter. See that parameter in hostapd.conf for more details. #CFLAGS += -DDEFAULT_WPA_DISABLE_EAPOL_KEY_RETRIES=1 +# Wired equivalent privacy (WEP) +# WEP is an obsolete cryptographic data confidentiality algorithm that is not +# considered secure. It should not be used for anything anymore. The +# functionality needed to use WEP is available in the current hostapd +# release under this optional build parameter. This functionality is subject to +# be completely removed in a future release. +#CONFIG_WEP=y + +# Remove all TKIP functionality +# TKIP is an old cryptographic data confidentiality algorithm that is not +# considered secure. It should not be used anymore. For now, the default hostapd +# build includes this to allow mixed mode WPA+WPA2 networks to be enabled, but +# that functionality is subject to be removed in the future. +#CONFIG_NO_TKIP=y + +# Pre-Association Security Negotiation (PASN) +# Experimental implementation based on IEEE P802.11z/D2.6 and the protocol +# design is still subject to change. As such, this should not yet be enabled in +# production use. +#CONFIG_PASN=y + +# Device Provisioning Protocol (DPP) (also known as Wi-Fi Easy Connect) +#CONFIG_DPP=y +# DPP version 2 support +#CONFIG_DPP2=y +# DPP version 3 support (experimental and still changing; do not enable for +# production use) +#CONFIG_DPP3=y + # uBus IPC/RPC System # Services can connect to the bus and provide methods # that can be called by other services or clients. diff --git a/package/network/services/hostapd/files/hostapd-mini.config b/package/network/services/hostapd/files/hostapd-mini.config index f2ed071ec09623..be0080ffe7a781 100644 --- a/package/network/services/hostapd/files/hostapd-mini.config +++ b/package/network/services/hostapd/files/hostapd-mini.config @@ -44,15 +44,9 @@ CONFIG_DRIVER_NL80211=y # Driver interface for no driver (e.g., RADIUS server only) #CONFIG_DRIVER_NONE=y -# IEEE 802.11F/IAPP -#CONFIG_IAPP=y - # WPA2/IEEE 802.11i RSN pre-authentication CONFIG_RSN_PREAUTH=y -# IEEE 802.11w (management frame protection) -#CONFIG_IEEE80211W=y - # Support Operating Channel Validation #CONFIG_OCV=y @@ -154,9 +148,6 @@ CONFIG_RSN_PREAUTH=y # the IEEE 802.11 Management capability (e.g., FreeBSD/net80211) #CONFIG_DRIVER_RADIUS_ACL=y -# IEEE 802.11n (High Throughput) support -CONFIG_IEEE80211N=y - # Wireless Network Management (IEEE Std 802.11v-2011) # Note: This is experimental and not complete implementation. #CONFIG_WNM=y @@ -165,10 +156,20 @@ CONFIG_IEEE80211N=y CONFIG_IEEE80211AC=y # IEEE 802.11ax HE support +#CONFIG_IEEE80211AX=y + +# IEEE 802.11be EHT support +# CONFIG_IEEE80211AX is mandatory for setting CONFIG_IEEE80211BE. # Note: This is experimental and work in progress. The definitions are still # subject to change and this should not be expected to interoperate with the -# final IEEE 802.11ax version. -#CONFIG_IEEE80211AX=y +# final IEEE 802.11be version. +CONFIG_IEEE80211BE=y + +# Simultaneous Authentication of Equals (SAE), WPA3-Personal +#CONFIG_SAE=y + +# SAE Public Key, WPA3-Personal +#CONFIG_SAE_PK=y # Remove debugging code that is printing out debug messages to stdout. # This can be used to reduce the size of the hostapd considerably if debugging @@ -355,12 +356,12 @@ CONFIG_TLS=internal # * ath10k # # For more details refer to: -# http://wireless.kernel.org/en/users/Documentation/acs +# https://wireless.wiki.kernel.org/en/users/documentation/acs # #CONFIG_ACS=y # Multiband Operation support -# These extentions facilitate efficient use of multiple frequency bands +# These extensions facilitate efficient use of multiple frequency bands # available to the AP and the devices that may associate with it. #CONFIG_MBO=y @@ -386,13 +387,39 @@ CONFIG_TLS=internal # Airtime policy support #CONFIG_AIRTIME_POLICY=y -# Proxy ARP support -#CONFIG_PROXYARP=y - # Override default value for the wpa_disable_eapol_key_retries configuration # parameter. See that parameter in hostapd.conf for more details. #CFLAGS += -DDEFAULT_WPA_DISABLE_EAPOL_KEY_RETRIES=1 +# Wired equivalent privacy (WEP) +# WEP is an obsolete cryptographic data confidentiality algorithm that is not +# considered secure. It should not be used for anything anymore. The +# functionality needed to use WEP is available in the current hostapd +# release under this optional build parameter. This functionality is subject to +# be completely removed in a future release. +#CONFIG_WEP=y + +# Remove all TKIP functionality +# TKIP is an old cryptographic data confidentiality algorithm that is not +# considered secure. It should not be used anymore. For now, the default hostapd +# build includes this to allow mixed mode WPA+WPA2 networks to be enabled, but +# that functionality is subject to be removed in the future. +#CONFIG_NO_TKIP=y + +# Pre-Association Security Negotiation (PASN) +# Experimental implementation based on IEEE P802.11z/D2.6 and the protocol +# design is still subject to change. As such, this should not yet be enabled in +# production use. +#CONFIG_PASN=y + +# Device Provisioning Protocol (DPP) (also known as Wi-Fi Easy Connect) +#CONFIG_DPP=y +# DPP version 2 support +#CONFIG_DPP2=y +# DPP version 3 support (experimental and still changing; do not enable for +# production use) +#CONFIG_DPP3=y + # uBus IPC/RPC System # Services can connect to the bus and provide methods # that can be called by other services or clients. diff --git a/package/network/services/hostapd/files/wpa_supplicant-basic.config b/package/network/services/hostapd/files/wpa_supplicant-basic.config index 944b4d92876002..a78b17dcecbb20 100644 --- a/package/network/services/hostapd/files/wpa_supplicant-basic.config +++ b/package/network/services/hostapd/files/wpa_supplicant-basic.config @@ -101,6 +101,9 @@ CONFIG_DRIVER_WIRED=y # EAP-TLS #CONFIG_EAP_TLS=y +# Enable EAP-TLSv1.3 support by default (currently disabled unless explicitly +# enabled in network configuration) +#CONFIG_EAP_TLSV1_3=y # EAL-PEAP #CONFIG_EAP_PEAP=y @@ -203,6 +206,9 @@ CONFIG_HT_OVERRIDES=y # Support VHT overrides (disable VHT, mask MCS rates, etc.) CONFIG_VHT_OVERRIDES=y +# Support HE overrides +CONFIG_HE_OVERRIDES=y + # Development testing #CONFIG_EAPOL_TEST=y @@ -248,7 +254,10 @@ CONFIG_CTRL_IFACE=y # Simultaneous Authentication of Equals (SAE), WPA3-Personal #CONFIG_SAE=y -# Disable scan result processing (ap_mode=1) to save code size by about 1 kB. +# SAE Public Key, WPA3-Personal +#CONFIG_SAE_PK=y + +# Disable scan result processing (ap_scan=1) to save code size by about 1 kB. # This can be used if ap_scan=1 mode is never enabled. #CONFIG_NO_SCAN_PROCESSING=y @@ -310,10 +319,6 @@ CONFIG_ELOOP_EPOLL=y # bridge interfaces (commit 'bridge: respect RFC2863 operational state')'). CONFIG_NO_LINUX_PACKET_SOCKET_WAR=y -# IEEE 802.11w (management frame protection), also known as PMF -# Driver support is also needed for IEEE 802.11w. -#CONFIG_IEEE80211W=y - # Support Operating Channel Validation CONFIG_OCV=y @@ -366,7 +371,7 @@ CONFIG_TLS=internal #PLATFORMSDKLIB="/opt/Program Files/Microsoft Platform SDK/Lib" # Add support for new DBus control interface -# (fi.w1.hostap.wpa_supplicant1) +# (fi.w1.wpa_supplicant1) #CONFIG_CTRL_IFACE_DBUS_NEW=y # Add introspection support for new DBus control interface @@ -475,13 +480,19 @@ CONFIG_NO_RANDOM_POOL=y # Requires glibc 2.25 to build, falls back to /dev/random if unavailable. CONFIG_GETRANDOM=y -# IEEE 802.11n (High Throughput) support (mainly for AP mode) -#CONFIG_IEEE80211N=y - # IEEE 802.11ac (Very High Throughput) support (mainly for AP mode) -# (depends on CONFIG_IEEE80211N) #CONFIG_IEEE80211AC=y +# IEEE 802.11ax HE support (mainly for AP mode) +#CONFIG_IEEE80211AX=y + +# IEEE 802.11be EHT support (mainly for AP mode) +# CONFIG_IEEE80211AX is mandatory for setting CONFIG_IEEE80211BE. +# Note: This is experimental and work in progress. The definitions are still +# subject to change and this should not be expected to interoperate with the +# final IEEE 802.11be version. +#CONFIG_IEEE80211BE=y + # Wireless Network Management (IEEE Std 802.11v-2011) # Note: This is experimental and not complete implementation. #CONFIG_WNM=y @@ -538,6 +549,8 @@ CONFIG_GETRANDOM=y # # External password backend for testing purposes (developer use) #CONFIG_EXT_PASSWORD_TEST=y +# File-based backend to read passwords from an external file. +#CONFIG_EXT_PASSWORD_FILE=y # Enable Fast Session Transfer (FST) #CONFIG_FST=y @@ -609,10 +622,36 @@ CONFIG_GETRANDOM=y # Experimental implementation of draft-harkins-owe-07.txt #CONFIG_OWE=y -# Device Provisioning Protocol (DPP) -# This requires CONFIG_IEEE80211W=y to be enabled, too. (see -# wpa_supplicant/README-DPP for details) +# Device Provisioning Protocol (DPP) (also known as Wi-Fi Easy Connect) #CONFIG_DPP=y +# DPP version 2 support +#CONFIG_DPP2=y +# DPP version 3 support (experimental and still changing; do not enable for +# production use) +#CONFIG_DPP3=y + +# Wired equivalent privacy (WEP) +# WEP is an obsolete cryptographic data confidentiality algorithm that is not +# considered secure. It should not be used for anything anymore. The +# functionality needed to use WEP is available in the current wpa_supplicant +# release under this optional build parameter. This functionality is subject to +# be completely removed in a future release. +#CONFIG_WEP=y + +# Remove all TKIP functionality +# TKIP is an old cryptographic data confidentiality algorithm that is not +# considered secure. It should not be used anymore for anything else than a +# backwards compatibility option as a group cipher when connecting to APs that +# use WPA+WPA2 mixed mode. For now, the default wpa_supplicant build includes +# support for this by default, but that functionality is subject to be removed +# in the future. +#CONFIG_NO_TKIP=y + +# Pre-Association Security Negotiation (PASN) +# Experimental implementation based on IEEE P802.11z/D2.6 and the protocol +# design is still subject to change. As such, this should not yet be enabled in +# production use. +#CONFIG_PASN=y # uBus IPC/RPC System # Services can connect to the bus and provide methods diff --git a/package/network/services/hostapd/files/wpa_supplicant-full.config b/package/network/services/hostapd/files/wpa_supplicant-full.config index b39dabca0696b5..7a05b88de704d5 100644 --- a/package/network/services/hostapd/files/wpa_supplicant-full.config +++ b/package/network/services/hostapd/files/wpa_supplicant-full.config @@ -101,6 +101,9 @@ CONFIG_EAP_MSCHAPV2=y # EAP-TLS CONFIG_EAP_TLS=y +# Enable EAP-TLSv1.3 support by default (currently disabled unless explicitly +# enabled in network configuration) +#CONFIG_EAP_TLSV1_3=y # EAL-PEAP CONFIG_EAP_PEAP=y @@ -203,6 +206,9 @@ CONFIG_HT_OVERRIDES=y # Support VHT overrides (disable VHT, mask MCS rates, etc.) CONFIG_VHT_OVERRIDES=y +# Support HE overrides +CONFIG_HE_OVERRIDES=y + # Development testing #CONFIG_EAPOL_TEST=y @@ -248,7 +254,10 @@ CONFIG_CTRL_IFACE=y # Simultaneous Authentication of Equals (SAE), WPA3-Personal #CONFIG_SAE=y -# Disable scan result processing (ap_mode=1) to save code size by about 1 kB. +# SAE Public Key, WPA3-Personal +#CONFIG_SAE_PK=y + +# Disable scan result processing (ap_scan=1) to save code size by about 1 kB. # This can be used if ap_scan=1 mode is never enabled. #CONFIG_NO_SCAN_PROCESSING=y @@ -310,10 +319,6 @@ CONFIG_ELOOP_EPOLL=y # bridge interfaces (commit 'bridge: respect RFC2863 operational state')'). CONFIG_NO_LINUX_PACKET_SOCKET_WAR=y -# IEEE 802.11w (management frame protection), also known as PMF -# Driver support is also needed for IEEE 802.11w. -#CONFIG_IEEE80211W=y - # Support Operating Channel Validation CONFIG_OCV=y @@ -366,7 +371,7 @@ CONFIG_INTERNAL_LIBTOMMATH_FAST=y #PLATFORMSDKLIB="/opt/Program Files/Microsoft Platform SDK/Lib" # Add support for new DBus control interface -# (fi.w1.hostap.wpa_supplicant1) +# (fi.w1.wpa_supplicant1) #CONFIG_CTRL_IFACE_DBUS_NEW=y # Add introspection support for new DBus control interface @@ -475,13 +480,19 @@ CONFIG_NO_RANDOM_POOL=y # Requires glibc 2.25 to build, falls back to /dev/random if unavailable. CONFIG_GETRANDOM=y -# IEEE 802.11n (High Throughput) support (mainly for AP mode) -#CONFIG_IEEE80211N=y - # IEEE 802.11ac (Very High Throughput) support (mainly for AP mode) -# (depends on CONFIG_IEEE80211N) #CONFIG_IEEE80211AC=y +# IEEE 802.11ax HE support (mainly for AP mode) +#CONFIG_IEEE80211AX=y + +# IEEE 802.11be EHT support (mainly for AP mode) +# CONFIG_IEEE80211AX is mandatory for setting CONFIG_IEEE80211BE. +# Note: This is experimental and work in progress. The definitions are still +# subject to change and this should not be expected to interoperate with the +# final IEEE 802.11be version. +CONFIG_IEEE80211BE=y + # Wireless Network Management (IEEE Std 802.11v-2011) # Note: This is experimental and not complete implementation. CONFIG_WNM=y @@ -538,6 +549,8 @@ CONFIG_HS20=y # # External password backend for testing purposes (developer use) #CONFIG_EXT_PASSWORD_TEST=y +# File-based backend to read passwords from an external file. +#CONFIG_EXT_PASSWORD_FILE=y # Enable Fast Session Transfer (FST) #CONFIG_FST=y @@ -609,10 +622,36 @@ CONFIG_IBSS_RSN=y # Experimental implementation of draft-harkins-owe-07.txt #CONFIG_OWE=y -# Device Provisioning Protocol (DPP) -# This requires CONFIG_IEEE80211W=y to be enabled, too. (see -# wpa_supplicant/README-DPP for details) +# Device Provisioning Protocol (DPP) (also known as Wi-Fi Easy Connect) #CONFIG_DPP=y +# DPP version 2 support +#CONFIG_DPP2=y +# DPP version 3 support (experimental and still changing; do not enable for +# production use) +#CONFIG_DPP3=y + +# Wired equivalent privacy (WEP) +# WEP is an obsolete cryptographic data confidentiality algorithm that is not +# considered secure. It should not be used for anything anymore. The +# functionality needed to use WEP is available in the current wpa_supplicant +# release under this optional build parameter. This functionality is subject to +# be completely removed in a future release. +#CONFIG_WEP=y + +# Remove all TKIP functionality +# TKIP is an old cryptographic data confidentiality algorithm that is not +# considered secure. It should not be used anymore for anything else than a +# backwards compatibility option as a group cipher when connecting to APs that +# use WPA+WPA2 mixed mode. For now, the default wpa_supplicant build includes +# support for this by default, but that functionality is subject to be removed +# in the future. +#CONFIG_NO_TKIP=y + +# Pre-Association Security Negotiation (PASN) +# Experimental implementation based on IEEE P802.11z/D2.6 and the protocol +# design is still subject to change. As such, this should not yet be enabled in +# production use. +#CONFIG_PASN=y # uBus IPC/RPC System # Services can connect to the bus and provide methods diff --git a/package/network/services/hostapd/files/wpa_supplicant-mini.config b/package/network/services/hostapd/files/wpa_supplicant-mini.config index 2a3f8fb69de337..0b628957f9dce1 100644 --- a/package/network/services/hostapd/files/wpa_supplicant-mini.config +++ b/package/network/services/hostapd/files/wpa_supplicant-mini.config @@ -101,6 +101,9 @@ CONFIG_DRIVER_WIRED=y # EAP-TLS #CONFIG_EAP_TLS=y +# Enable EAP-TLSv1.3 support by default (currently disabled unless explicitly +# enabled in network configuration) +#CONFIG_EAP_TLSV1_3=y # EAL-PEAP #CONFIG_EAP_PEAP=y @@ -203,6 +206,9 @@ CONFIG_HT_OVERRIDES=y # Support VHT overrides (disable VHT, mask MCS rates, etc.) CONFIG_VHT_OVERRIDES=y +# Support HE overrides +CONFIG_HE_OVERRIDES=y + # Development testing #CONFIG_EAPOL_TEST=y @@ -248,7 +254,10 @@ CONFIG_CTRL_IFACE=y # Simultaneous Authentication of Equals (SAE), WPA3-Personal #CONFIG_SAE=y -# Disable scan result processing (ap_mode=1) to save code size by about 1 kB. +# SAE Public Key, WPA3-Personal +#CONFIG_SAE_PK=y + +# Disable scan result processing (ap_scan=1) to save code size by about 1 kB. # This can be used if ap_scan=1 mode is never enabled. #CONFIG_NO_SCAN_PROCESSING=y @@ -310,12 +319,8 @@ CONFIG_ELOOP_EPOLL=y # bridge interfaces (commit 'bridge: respect RFC2863 operational state')'). CONFIG_NO_LINUX_PACKET_SOCKET_WAR=y -# IEEE 802.11w (management frame protection), also known as PMF -# Driver support is also needed for IEEE 802.11w. -#CONFIG_IEEE80211W=y - # Support Operating Channel Validation -#CONFIG_OCV=y +CONFIG_OCV=y # Select TLS implementation # openssl = OpenSSL (default) @@ -366,7 +371,7 @@ CONFIG_TLS=internal #PLATFORMSDKLIB="/opt/Program Files/Microsoft Platform SDK/Lib" # Add support for new DBus control interface -# (fi.w1.hostap.wpa_supplicant1) +# (fi.w1.wpa_supplicant1) #CONFIG_CTRL_IFACE_DBUS_NEW=y # Add introspection support for new DBus control interface @@ -475,13 +480,19 @@ CONFIG_NO_RANDOM_POOL=y # Requires glibc 2.25 to build, falls back to /dev/random if unavailable. CONFIG_GETRANDOM=y -# IEEE 802.11n (High Throughput) support (mainly for AP mode) -#CONFIG_IEEE80211N=y - # IEEE 802.11ac (Very High Throughput) support (mainly for AP mode) -# (depends on CONFIG_IEEE80211N) #CONFIG_IEEE80211AC=y +# IEEE 802.11ax HE support (mainly for AP mode) +#CONFIG_IEEE80211AX=y + +# IEEE 802.11be EHT support (mainly for AP mode) +# CONFIG_IEEE80211AX is mandatory for setting CONFIG_IEEE80211BE. +# Note: This is experimental and work in progress. The definitions are still +# subject to change and this should not be expected to interoperate with the +# final IEEE 802.11be version. +#CONFIG_IEEE80211BE=y + # Wireless Network Management (IEEE Std 802.11v-2011) # Note: This is experimental and not complete implementation. #CONFIG_WNM=y @@ -538,6 +549,8 @@ CONFIG_GETRANDOM=y # # External password backend for testing purposes (developer use) #CONFIG_EXT_PASSWORD_TEST=y +# File-based backend to read passwords from an external file. +#CONFIG_EXT_PASSWORD_FILE=y # Enable Fast Session Transfer (FST) #CONFIG_FST=y @@ -609,10 +622,36 @@ CONFIG_GETRANDOM=y # Experimental implementation of draft-harkins-owe-07.txt #CONFIG_OWE=y -# Device Provisioning Protocol (DPP) -# This requires CONFIG_IEEE80211W=y to be enabled, too. (see -# wpa_supplicant/README-DPP for details) +# Device Provisioning Protocol (DPP) (also known as Wi-Fi Easy Connect) #CONFIG_DPP=y +# DPP version 2 support +#CONFIG_DPP2=y +# DPP version 3 support (experimental and still changing; do not enable for +# production use) +#CONFIG_DPP3=y + +# Wired equivalent privacy (WEP) +# WEP is an obsolete cryptographic data confidentiality algorithm that is not +# considered secure. It should not be used for anything anymore. The +# functionality needed to use WEP is available in the current wpa_supplicant +# release under this optional build parameter. This functionality is subject to +# be completely removed in a future release. +#CONFIG_WEP=y + +# Remove all TKIP functionality +# TKIP is an old cryptographic data confidentiality algorithm that is not +# considered secure. It should not be used anymore for anything else than a +# backwards compatibility option as a group cipher when connecting to APs that +# use WPA+WPA2 mixed mode. For now, the default wpa_supplicant build includes +# support for this by default, but that functionality is subject to be removed +# in the future. +#CONFIG_NO_TKIP=y + +# Pre-Association Security Negotiation (PASN) +# Experimental implementation based on IEEE P802.11z/D2.6 and the protocol +# design is still subject to change. As such, this should not yet be enabled in +# production use. +#CONFIG_PASN=y # uBus IPC/RPC System # Services can connect to the bus and provide methods diff --git a/package/network/services/hostapd/files/wpa_supplicant-p2p.config b/package/network/services/hostapd/files/wpa_supplicant-p2p.config index 7f5140622cc15a..8648b1657b14dd 100644 --- a/package/network/services/hostapd/files/wpa_supplicant-p2p.config +++ b/package/network/services/hostapd/files/wpa_supplicant-p2p.config @@ -101,6 +101,9 @@ CONFIG_EAP_MSCHAPV2=y # EAP-TLS CONFIG_EAP_TLS=y +# Enable EAP-TLSv1.3 support by default (currently disabled unless explicitly +# enabled in network configuration) +#CONFIG_EAP_TLSV1_3=y # EAL-PEAP CONFIG_EAP_PEAP=y @@ -203,6 +206,9 @@ CONFIG_HT_OVERRIDES=y # Support VHT overrides (disable VHT, mask MCS rates, etc.) CONFIG_VHT_OVERRIDES=y +# Support HE overrides +CONFIG_HE_OVERRIDES=y + # Development testing #CONFIG_EAPOL_TEST=y @@ -248,7 +254,10 @@ CONFIG_CTRL_IFACE=y # Simultaneous Authentication of Equals (SAE), WPA3-Personal #CONFIG_SAE=y -# Disable scan result processing (ap_mode=1) to save code size by about 1 kB. +# SAE Public Key, WPA3-Personal +#CONFIG_SAE_PK=y + +# Disable scan result processing (ap_scan=1) to save code size by about 1 kB. # This can be used if ap_scan=1 mode is never enabled. #CONFIG_NO_SCAN_PROCESSING=y @@ -310,10 +319,6 @@ CONFIG_ELOOP_EPOLL=y # bridge interfaces (commit 'bridge: respect RFC2863 operational state')'). CONFIG_NO_LINUX_PACKET_SOCKET_WAR=y -# IEEE 802.11w (management frame protection), also known as PMF -# Driver support is also needed for IEEE 802.11w. -CONFIG_IEEE80211W=y - # Support Operating Channel Validation #CONFIG_OCV=y @@ -366,7 +371,7 @@ CONFIG_INTERNAL_LIBTOMMATH_FAST=y #PLATFORMSDKLIB="/opt/Program Files/Microsoft Platform SDK/Lib" # Add support for new DBus control interface -# (fi.w1.hostap.wpa_supplicant1) +# (fi.w1.wpa_supplicant1) #CONFIG_CTRL_IFACE_DBUS_NEW=y # Add introspection support for new DBus control interface @@ -475,13 +480,19 @@ CONFIG_NO_RANDOM_POOL=y # Requires glibc 2.25 to build, falls back to /dev/random if unavailable. CONFIG_GETRANDOM=y -# IEEE 802.11n (High Throughput) support (mainly for AP mode) -#CONFIG_IEEE80211N=y - # IEEE 802.11ac (Very High Throughput) support (mainly for AP mode) -# (depends on CONFIG_IEEE80211N) #CONFIG_IEEE80211AC=y +# IEEE 802.11ax HE support (mainly for AP mode) +#CONFIG_IEEE80211AX=y + +# IEEE 802.11be EHT support (mainly for AP mode) +# CONFIG_IEEE80211AX is mandatory for setting CONFIG_IEEE80211BE. +# Note: This is experimental and work in progress. The definitions are still +# subject to change and this should not be expected to interoperate with the +# final IEEE 802.11be version. +#CONFIG_IEEE80211BE=y + # Wireless Network Management (IEEE Std 802.11v-2011) # Note: This is experimental and not complete implementation. #CONFIG_WNM=y @@ -538,6 +549,8 @@ CONFIG_P2P=y # # External password backend for testing purposes (developer use) #CONFIG_EXT_PASSWORD_TEST=y +# File-based backend to read passwords from an external file. +#CONFIG_EXT_PASSWORD_FILE=y # Enable Fast Session Transfer (FST) #CONFIG_FST=y @@ -609,10 +622,36 @@ CONFIG_IBSS_RSN=y # Experimental implementation of draft-harkins-owe-07.txt #CONFIG_OWE=y -# Device Provisioning Protocol (DPP) -# This requires CONFIG_IEEE80211W=y to be enabled, too. (see -# wpa_supplicant/README-DPP for details) +# Device Provisioning Protocol (DPP) (also known as Wi-Fi Easy Connect) #CONFIG_DPP=y +# DPP version 2 support +#CONFIG_DPP2=y +# DPP version 3 support (experimental and still changing; do not enable for +# production use) +#CONFIG_DPP3=y + +# Wired equivalent privacy (WEP) +# WEP is an obsolete cryptographic data confidentiality algorithm that is not +# considered secure. It should not be used for anything anymore. The +# functionality needed to use WEP is available in the current wpa_supplicant +# release under this optional build parameter. This functionality is subject to +# be completely removed in a future release. +#CONFIG_WEP=y + +# Remove all TKIP functionality +# TKIP is an old cryptographic data confidentiality algorithm that is not +# considered secure. It should not be used anymore for anything else than a +# backwards compatibility option as a group cipher when connecting to APs that +# use WPA+WPA2 mixed mode. For now, the default wpa_supplicant build includes +# support for this by default, but that functionality is subject to be removed +# in the future. +#CONFIG_NO_TKIP=y + +# Pre-Association Security Negotiation (PASN) +# Experimental implementation based on IEEE P802.11z/D2.6 and the protocol +# design is still subject to change. As such, this should not yet be enabled in +# production use. +#CONFIG_PASN=y # uBus IPC/RPC System # Services can connect to the bus and provide methods 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 4291f015180c53..d20a6d76d44cc8 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 -@@ -2698,7 +2698,7 @@ static int drv_supports_vht(struct wpa_s +@@ -2831,7 +2831,7 @@ static int drv_supports_vht(struct wpa_s } @@ -23,7 +23,7 @@ Signed-off-by: Peter Oh { int i; -@@ -2707,7 +2707,10 @@ static bool ibss_mesh_is_80mhz_avail(int +@@ -2840,7 +2840,10 @@ static bool ibss_mesh_is_80mhz_avail(int chan = hw_get_channel_chan(mode, i, NULL); if (!chan || @@ -35,7 +35,7 @@ Signed-off-by: Peter Oh return false; } -@@ -2834,7 +2837,7 @@ static void ibss_mesh_select_40mhz(struc +@@ -2967,7 +2970,7 @@ static void ibss_mesh_select_40mhz(struc const struct wpa_ssid *ssid, struct hostapd_hw_modes *mode, struct hostapd_freq_params *freq, @@ -44,7 +44,7 @@ Signed-off-by: Peter Oh int chan_idx; struct hostapd_channel_data *pri_chan = NULL, *sec_chan = NULL; int i, res; -@@ -2858,8 +2861,11 @@ static void ibss_mesh_select_40mhz(struc +@@ -2991,8 +2994,11 @@ static void ibss_mesh_select_40mhz(struc return; /* Check primary channel flags */ @@ -57,7 +57,7 @@ Signed-off-by: Peter Oh #ifdef CONFIG_HT_OVERRIDES if (ssid->disable_ht40) -@@ -2885,8 +2891,11 @@ static void ibss_mesh_select_40mhz(struc +@@ -3018,8 +3024,11 @@ static void ibss_mesh_select_40mhz(struc return; /* Check secondary channel flags */ @@ -70,7 +70,7 @@ Signed-off-by: Peter Oh if (ht40 == -1) { if (!(pri_chan->flag & HOSTAPD_CHAN_HT40MINUS)) -@@ -2940,7 +2949,7 @@ static bool ibss_mesh_select_80_160mhz(s +@@ -3074,7 +3083,7 @@ static bool ibss_mesh_select_80_160mhz(s const struct wpa_ssid *ssid, struct hostapd_hw_modes *mode, struct hostapd_freq_params *freq, @@ -79,7 +79,7 @@ Signed-off-by: Peter Oh static const int bw80[] = { 5180, 5260, 5500, 5580, 5660, 5745, 5825, 5955, 6035, 6115, 6195, 6275, 6355, 6435, -@@ -2985,7 +2994,7 @@ static bool ibss_mesh_select_80_160mhz(s +@@ -3119,7 +3128,7 @@ static bool ibss_mesh_select_80_160mhz(s goto skip_80mhz; /* Use 40 MHz if channel not usable */ @@ -88,7 +88,7 @@ Signed-off-by: Peter Oh goto skip_80mhz; chwidth = CONF_OPER_CHWIDTH_80MHZ; -@@ -2999,7 +3008,7 @@ static bool ibss_mesh_select_80_160mhz(s +@@ -3133,7 +3142,7 @@ static bool ibss_mesh_select_80_160mhz(s if ((mode->he_capab[ieee80211_mode].phy_cap[ HE_PHYCAP_CHANNEL_WIDTH_SET_IDX] & HE_PHYCAP_CHANNEL_WIDTH_SET_160MHZ_IN_5G) && is_6ghz && @@ -97,7 +97,7 @@ Signed-off-by: Peter Oh for (j = 0; j < ARRAY_SIZE(bw160); j++) { if (freq->freq == bw160[j]) { chwidth = CONF_OPER_CHWIDTH_160MHZ; -@@ -3027,10 +3036,12 @@ static bool ibss_mesh_select_80_160mhz(s +@@ -3161,10 +3170,12 @@ static bool ibss_mesh_select_80_160mhz(s if (!chan) continue; @@ -113,15 +113,15 @@ Signed-off-by: Peter Oh /* Found a suitable second segment for 80+80 */ chwidth = CONF_OPER_CHWIDTH_80P80MHZ; -@@ -3085,6 +3096,7 @@ void ibss_mesh_setup_freq(struct wpa_sup - int i, obss_scan = 1; +@@ -3219,6 +3230,7 @@ void ibss_mesh_setup_freq(struct wpa_sup + int obss_scan = 1; u8 channel; bool is_6ghz, is_24ghz; + bool dfs_enabled = wpa_s->conf->country[0] && (wpa_s->drv_flags & WPA_DRIVER_FLAGS_RADAR); freq->freq = ssid->frequency; -@@ -3133,9 +3145,9 @@ void ibss_mesh_setup_freq(struct wpa_sup +@@ -3261,9 +3273,9 @@ void ibss_mesh_setup_freq(struct wpa_sup freq->channel = channel; /* Setup higher BW only for 5 GHz */ if (mode->mode == HOSTAPD_MODE_IEEE80211A) { diff --git a/package/network/services/hostapd/patches/011-mesh-use-deterministic-channel-on-channel-switch.patch b/package/network/services/hostapd/patches/011-mesh-use-deterministic-channel-on-channel-switch.patch index a53fcc480c6586..869a659b0503a9 100644 --- a/package/network/services/hostapd/patches/011-mesh-use-deterministic-channel-on-channel-switch.patch +++ b/package/network/services/hostapd/patches/011-mesh-use-deterministic-channel-on-channel-switch.patch @@ -21,7 +21,7 @@ Signed-off-by: Markus Theil --- a/src/ap/dfs.c +++ b/src/ap/dfs.c -@@ -17,6 +17,7 @@ +@@ -18,6 +18,7 @@ #include "ap_drv_ops.h" #include "drivers/driver.h" #include "dfs.h" @@ -29,7 +29,7 @@ Signed-off-by: Markus Theil enum dfs_channel_type { -@@ -526,9 +527,14 @@ dfs_get_valid_channel(struct hostapd_ifa +@@ -534,9 +535,14 @@ dfs_get_valid_channel(struct hostapd_ifa int num_available_chandefs; int chan_idx, chan_idx2; int sec_chan_idx_80p80 = -1; @@ -44,7 +44,7 @@ Signed-off-by: Markus Theil wpa_printf(MSG_DEBUG, "DFS: Selecting random channel"); *secondary_channel = 0; *oper_centr_freq_seg0_idx = 0; -@@ -548,8 +554,20 @@ dfs_get_valid_channel(struct hostapd_ifa +@@ -556,8 +562,20 @@ dfs_get_valid_channel(struct hostapd_ifa if (num_available_chandefs == 0) return NULL; @@ -68,7 +68,7 @@ Signed-off-by: Markus Theil chan_idx, num_available_chandefs); --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -11195,6 +11195,10 @@ static int nl80211_switch_channel(void * +@@ -11463,6 +11463,10 @@ static int nl80211_switch_channel(void * if (ret) goto error; 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 index a4a90933b17d61..2dc44be5899cc9 100644 --- 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 @@ -4,7 +4,7 @@ Subject: [PATCH] fix adding back stations after a missed deauth/disassoc --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c -@@ -4659,6 +4659,13 @@ static int add_associated_sta(struct hos +@@ -4782,6 +4782,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. @@ -18,7 +18,7 @@ Subject: [PATCH] fix adding back stations after a missed deauth/disassoc */ 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)", -@@ -4672,7 +4679,8 @@ static int add_associated_sta(struct hos +@@ -4795,7 +4802,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) && diff --git a/package/network/services/hostapd/patches/023-ndisc_snoop-call-dl_list_del-before-freeing-ipv6-add.patch b/package/network/services/hostapd/patches/023-ndisc_snoop-call-dl_list_del-before-freeing-ipv6-add.patch deleted file mode 100644 index 9ff9b2398de79d..00000000000000 --- a/package/network/services/hostapd/patches/023-ndisc_snoop-call-dl_list_del-before-freeing-ipv6-add.patch +++ /dev/null @@ -1,19 +0,0 @@ -From: Felix Fietkau -Date: Wed, 28 Jul 2021 05:43:29 +0200 -Subject: [PATCH] ndisc_snoop: call dl_list_del before freeing ipv6 addresses - -Fixes a segmentation fault on sta disconnect - -Signed-off-by: Felix Fietkau ---- - ---- a/src/ap/ndisc_snoop.c -+++ b/src/ap/ndisc_snoop.c -@@ -61,6 +61,7 @@ void sta_ip6addr_del(struct hostapd_data - dl_list_for_each_safe(ip6addr, prev, &sta->ip6addr, struct ip6addr, - list) { - hostapd_drv_br_delete_ip_neigh(hapd, 6, (u8 *) &ip6addr->addr); -+ dl_list_del(&ip6addr->list); - os_free(ip6addr); - } - } diff --git a/package/network/services/hostapd/patches/030-driver_nl80211-rewrite-neigh-code-to-not-depend-on-l.patch b/package/network/services/hostapd/patches/030-driver_nl80211-rewrite-neigh-code-to-not-depend-on-l.patch deleted file mode 100644 index c5cf8b1b7985d4..00000000000000 --- a/package/network/services/hostapd/patches/030-driver_nl80211-rewrite-neigh-code-to-not-depend-on-l.patch +++ /dev/null @@ -1,275 +0,0 @@ -From: Felix Fietkau -Date: Wed, 28 Jul 2021 05:49:46 +0200 -Subject: [PATCH] driver_nl80211: rewrite neigh code to not depend on - libnl3-route - -Removes an unnecessary dependency and also makes the code smaller - -Signed-off-by: Felix Fietkau ---- - ---- a/src/drivers/driver_nl80211.c -+++ b/src/drivers/driver_nl80211.c -@@ -18,9 +18,6 @@ - #include - #include - #include --#ifdef CONFIG_LIBNL3_ROUTE --#include --#endif /* CONFIG_LIBNL3_ROUTE */ - #include - #include - #include -@@ -5859,26 +5856,29 @@ fail: - - static void rtnl_neigh_delete_fdb_entry(struct i802_bss *bss, const u8 *addr) - { --#ifdef CONFIG_LIBNL3_ROUTE - struct wpa_driver_nl80211_data *drv = bss->drv; -- struct rtnl_neigh *rn; -- struct nl_addr *nl_addr; -+ struct ndmsg nhdr = { -+ .ndm_state = NUD_PERMANENT, -+ .ndm_ifindex = bss->ifindex, -+ .ndm_family = AF_BRIDGE, -+ }; -+ struct nl_msg *msg; - int err; - -- rn = rtnl_neigh_alloc(); -- if (!rn) -+ msg = nlmsg_alloc_simple(RTM_DELNEIGH, NLM_F_CREATE); -+ if (!msg) - return; - -- rtnl_neigh_set_family(rn, AF_BRIDGE); -- rtnl_neigh_set_ifindex(rn, bss->ifindex); -- nl_addr = nl_addr_build(AF_BRIDGE, (void *) addr, ETH_ALEN); -- if (!nl_addr) { -- rtnl_neigh_put(rn); -- return; -- } -- rtnl_neigh_set_lladdr(rn, nl_addr); -+ if (nlmsg_append(msg, &nhdr, sizeof(nhdr), NLMSG_ALIGNTO) < 0) -+ goto errout; -+ -+ if (nla_put(msg, NDA_LLADDR, ETH_ALEN, (void *)addr)) -+ goto errout; -+ -+ if (nl_send_auto_complete(drv->rtnl_sk, msg) < 0) -+ goto errout; - -- err = rtnl_neigh_delete(drv->rtnl_sk, rn, 0); -+ err = nl_wait_for_ack(drv->rtnl_sk); - if (err < 0) { - wpa_printf(MSG_DEBUG, "nl80211: bridge FDB entry delete for " - MACSTR " ifindex=%d failed: %s", MAC2STR(addr), -@@ -5888,9 +5888,8 @@ static void rtnl_neigh_delete_fdb_entry( - MACSTR, MAC2STR(addr)); - } - -- nl_addr_put(nl_addr); -- rtnl_neigh_put(rn); --#endif /* CONFIG_LIBNL3_ROUTE */ -+errout: -+ nlmsg_free(msg); - } - - -@@ -8615,7 +8614,6 @@ static void *i802_init(struct hostapd_da - (params->num_bridge == 0 || !params->bridge[0])) - add_ifidx(drv, br_ifindex, drv->ifindex); - --#ifdef CONFIG_LIBNL3_ROUTE - if (bss->added_if_into_bridge || bss->already_in_bridge) { - int err; - -@@ -8632,7 +8630,6 @@ static void *i802_init(struct hostapd_da - goto failed; - } - } --#endif /* CONFIG_LIBNL3_ROUTE */ - - if (drv->capa.flags2 & WPA_DRIVER_FLAGS2_CONTROL_PORT_RX) { - wpa_printf(MSG_DEBUG, -@@ -12071,13 +12068,14 @@ static int wpa_driver_br_add_ip_neigh(vo - const u8 *ipaddr, int prefixlen, - const u8 *addr) - { --#ifdef CONFIG_LIBNL3_ROUTE - struct i802_bss *bss = priv; - struct wpa_driver_nl80211_data *drv = bss->drv; -- struct rtnl_neigh *rn; -- struct nl_addr *nl_ipaddr = NULL; -- struct nl_addr *nl_lladdr = NULL; -- int family, addrsize; -+ struct ndmsg nhdr = { -+ .ndm_state = NUD_PERMANENT, -+ .ndm_ifindex = bss->br_ifindex, -+ }; -+ struct nl_msg *msg; -+ int addrsize; - int res; - - if (!ipaddr || prefixlen == 0 || !addr) -@@ -12096,85 +12094,66 @@ static int wpa_driver_br_add_ip_neigh(vo - } - - if (version == 4) { -- family = AF_INET; -+ nhdr.ndm_family = AF_INET; - addrsize = 4; - } else if (version == 6) { -- family = AF_INET6; -+ nhdr.ndm_family = AF_INET6; - addrsize = 16; - } else { - return -EINVAL; - } - -- rn = rtnl_neigh_alloc(); -- if (rn == NULL) -+ msg = nlmsg_alloc_simple(RTM_NEWNEIGH, NLM_F_CREATE); -+ if (!msg) - return -ENOMEM; - -- /* set the destination ip address for neigh */ -- nl_ipaddr = nl_addr_build(family, (void *) ipaddr, addrsize); -- if (nl_ipaddr == NULL) { -- wpa_printf(MSG_DEBUG, "nl80211: nl_ipaddr build failed"); -- res = -ENOMEM; -+ res = -ENOMEM; -+ if (nlmsg_append(msg, &nhdr, sizeof(nhdr), NLMSG_ALIGNTO) < 0) - goto errout; -- } -- nl_addr_set_prefixlen(nl_ipaddr, prefixlen); -- res = rtnl_neigh_set_dst(rn, nl_ipaddr); -- if (res) { -- wpa_printf(MSG_DEBUG, -- "nl80211: neigh set destination addr failed"); -+ -+ if (nla_put(msg, NDA_DST, addrsize, (void *)ipaddr)) - goto errout; -- } - -- /* set the corresponding lladdr for neigh */ -- nl_lladdr = nl_addr_build(AF_BRIDGE, (u8 *) addr, ETH_ALEN); -- if (nl_lladdr == NULL) { -- wpa_printf(MSG_DEBUG, "nl80211: neigh set lladdr failed"); -- res = -ENOMEM; -+ if (nla_put(msg, NDA_LLADDR, ETH_ALEN, (void *)addr)) - goto errout; -- } -- rtnl_neigh_set_lladdr(rn, nl_lladdr); - -- rtnl_neigh_set_ifindex(rn, bss->br_ifindex); -- rtnl_neigh_set_state(rn, NUD_PERMANENT); -+ res = nl_send_auto_complete(drv->rtnl_sk, msg); -+ if (res < 0) -+ goto errout; - -- res = rtnl_neigh_add(drv->rtnl_sk, rn, NLM_F_CREATE); -+ res = nl_wait_for_ack(drv->rtnl_sk); - if (res) { - wpa_printf(MSG_DEBUG, - "nl80211: Adding bridge ip neigh failed: %s", - nl_geterror(res)); - } - errout: -- if (nl_lladdr) -- nl_addr_put(nl_lladdr); -- if (nl_ipaddr) -- nl_addr_put(nl_ipaddr); -- if (rn) -- rtnl_neigh_put(rn); -+ nlmsg_free(msg); - return res; --#else /* CONFIG_LIBNL3_ROUTE */ -- return -1; --#endif /* CONFIG_LIBNL3_ROUTE */ - } - - - static int wpa_driver_br_delete_ip_neigh(void *priv, u8 version, - const u8 *ipaddr) - { --#ifdef CONFIG_LIBNL3_ROUTE - struct i802_bss *bss = priv; - struct wpa_driver_nl80211_data *drv = bss->drv; -- struct rtnl_neigh *rn; -- struct nl_addr *nl_ipaddr; -- int family, addrsize; -+ struct ndmsg nhdr = { -+ .ndm_state = NUD_PERMANENT, -+ .ndm_ifindex = bss->br_ifindex, -+ }; -+ struct nl_msg *msg; -+ int addrsize; - int res; - - if (!ipaddr) - return -EINVAL; - - if (version == 4) { -- family = AF_INET; -+ nhdr.ndm_family = AF_INET; - addrsize = 4; - } else if (version == 6) { -- family = AF_INET6; -+ nhdr.ndm_family = AF_INET6; - addrsize = 16; - } else { - return -EINVAL; -@@ -12192,41 +12171,30 @@ static int wpa_driver_br_delete_ip_neigh - return -1; - } - -- rn = rtnl_neigh_alloc(); -- if (rn == NULL) -+ msg = nlmsg_alloc_simple(RTM_DELNEIGH, NLM_F_CREATE); -+ if (!msg) - return -ENOMEM; - -- /* set the destination ip address for neigh */ -- nl_ipaddr = nl_addr_build(family, (void *) ipaddr, addrsize); -- if (nl_ipaddr == NULL) { -- wpa_printf(MSG_DEBUG, "nl80211: nl_ipaddr build failed"); -- res = -ENOMEM; -+ res = -ENOMEM; -+ if (nlmsg_append(msg, &nhdr, sizeof(nhdr), NLMSG_ALIGNTO) < 0) - goto errout; -- } -- res = rtnl_neigh_set_dst(rn, nl_ipaddr); -- if (res) { -- wpa_printf(MSG_DEBUG, -- "nl80211: neigh set destination addr failed"); -+ -+ if (nla_put(msg, NDA_DST, addrsize, (void *)ipaddr)) - goto errout; -- } - -- rtnl_neigh_set_ifindex(rn, bss->br_ifindex); -+ res = nl_send_auto_complete(drv->rtnl_sk, msg); -+ if (res < 0) -+ goto errout; - -- res = rtnl_neigh_delete(drv->rtnl_sk, rn, 0); -+ res = nl_wait_for_ack(drv->rtnl_sk); - if (res) { - wpa_printf(MSG_DEBUG, - "nl80211: Deleting bridge ip neigh failed: %s", - nl_geterror(res)); - } - errout: -- if (nl_ipaddr) -- nl_addr_put(nl_ipaddr); -- if (rn) -- rtnl_neigh_put(rn); -+ nlmsg_free(msg); - return res; --#else /* CONFIG_LIBNL3_ROUTE */ -- return -1; --#endif /* CONFIG_LIBNL3_ROUTE */ - } - - diff --git a/package/network/services/hostapd/patches/040-mesh-allow-processing-authentication-frames-in-block.patch b/package/network/services/hostapd/patches/040-mesh-allow-processing-authentication-frames-in-block.patch deleted file mode 100644 index 636ec2d9c8b7c7..00000000000000 --- a/package/network/services/hostapd/patches/040-mesh-allow-processing-authentication-frames-in-block.patch +++ /dev/null @@ -1,34 +0,0 @@ -From: Felix Fietkau -Date: Mon, 18 Feb 2019 12:57:11 +0100 -Subject: [PATCH] mesh: allow processing authentication frames in blocked state - -If authentication fails repeatedly e.g. because of a weak signal, the link -can end up in blocked state. If one of the nodes tries to establish a link -again before it is unblocked on the other side, it will block the link to -that other side. The same happens on the other side when it unblocks the -link. In that scenario, the link never recovers on its own. - -To fix this, allow restarting authentication even if the link is in blocked -state, but don't initiate the attempt until the blocked period is over. - -Signed-off-by: Felix Fietkau ---- - ---- a/src/ap/ieee802_11.c -+++ b/src/ap/ieee802_11.c -@@ -3032,15 +3032,6 @@ static void handle_auth(struct hostapd_d - seq_ctrl); - return; - } --#ifdef CONFIG_MESH -- if ((hapd->conf->mesh & MESH_ENABLED) && -- sta->plink_state == PLINK_BLOCKED) { -- wpa_printf(MSG_DEBUG, "Mesh peer " MACSTR -- " is blocked - drop Authentication frame", -- MAC2STR(sa)); -- return; -- } --#endif /* CONFIG_MESH */ - #ifdef CONFIG_PASN - if (auth_alg == WLAN_AUTH_PASN && - (sta->flags & WLAN_STA_ASSOC)) { diff --git a/package/network/services/hostapd/patches/050-Fix-OpenWrt-13156.patch b/package/network/services/hostapd/patches/050-Fix-OpenWrt-13156.patch index a044409d2d813a..0306a81cc10b58 100644 --- a/package/network/services/hostapd/patches/050-Fix-OpenWrt-13156.patch +++ b/package/network/services/hostapd/patches/050-Fix-OpenWrt-13156.patch @@ -20,7 +20,7 @@ Signed-off-by: Stijn Tintel --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c -@@ -3646,6 +3646,8 @@ int hostapd_remove_iface(struct hapd_int +@@ -4017,6 +4017,8 @@ int hostapd_remove_iface(struct hapd_int void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta, int reassoc) { @@ -29,7 +29,7 @@ Signed-off-by: Stijn Tintel if (hapd->tkip_countermeasures) { hostapd_drv_sta_deauth(hapd, sta->addr, WLAN_REASON_MICHAEL_MIC_FAILURE); -@@ -3653,10 +3655,16 @@ void hostapd_new_assoc_sta(struct hostap +@@ -4024,10 +4026,16 @@ void hostapd_new_assoc_sta(struct hostap } #ifdef CONFIG_IEEE80211BE @@ -51,7 +51,7 @@ Signed-off-by: Stijn Tintel sta->post_csa_sa_query = 0; --- a/src/ap/sta_info.c +++ b/src/ap/sta_info.c -@@ -1412,9 +1412,6 @@ bool ap_sta_set_authorized_flag(struct h +@@ -1485,9 +1485,6 @@ bool ap_sta_set_authorized_flag(struct h mld_assoc_link_id = -2; } #endif /* CONFIG_IEEE80211BE */ diff --git a/package/network/services/hostapd/patches/051-nl80211-add-extra-ies-only-if-allowed-by-driver.patch b/package/network/services/hostapd/patches/051-nl80211-add-extra-ies-only-if-allowed-by-driver.patch index de4d4ad3c2461c..0d3fcd574d6eec 100644 --- a/package/network/services/hostapd/patches/051-nl80211-add-extra-ies-only-if-allowed-by-driver.patch +++ b/package/network/services/hostapd/patches/051-nl80211-add-extra-ies-only-if-allowed-by-driver.patch @@ -26,7 +26,7 @@ Signed-off-by: David Bauer --- a/src/drivers/driver.h +++ b/src/drivers/driver.h -@@ -2340,6 +2340,9 @@ struct wpa_driver_capa { +@@ -2384,6 +2384,9 @@ struct wpa_driver_capa { /** Maximum number of iterations in a single scan plan */ u32 max_sched_scan_plan_iterations; @@ -38,7 +38,7 @@ Signed-off-by: David Bauer --- a/src/drivers/driver_nl80211_capa.c +++ b/src/drivers/driver_nl80211_capa.c -@@ -972,6 +972,10 @@ static int wiphy_info_handler(struct nl_ +@@ -976,6 +976,10 @@ static int wiphy_info_handler(struct nl_ nla_get_u32(tb[NL80211_ATTR_MAX_SCAN_PLAN_ITERATIONS]); } @@ -51,7 +51,7 @@ Signed-off-by: David Bauer nla_get_u8(tb[NL80211_ATTR_MAX_MATCH_SETS]); --- a/src/drivers/driver_nl80211_scan.c +++ b/src/drivers/driver_nl80211_scan.c -@@ -221,7 +221,7 @@ nl80211_scan_common(struct i802_bss *bss +@@ -235,7 +235,7 @@ nl80211_scan_common(struct i802_bss *bss wpa_printf(MSG_DEBUG, "nl80211: Passive scan requested"); } diff --git a/package/network/services/hostapd/patches/052-AP-add-missing-null-pointer-check-in-hostapd_free_ha.patch b/package/network/services/hostapd/patches/052-AP-add-missing-null-pointer-check-in-hostapd_free_ha.patch index 85d5127f600d2d..01a0fba600ef68 100644 --- a/package/network/services/hostapd/patches/052-AP-add-missing-null-pointer-check-in-hostapd_free_ha.patch +++ b/package/network/services/hostapd/patches/052-AP-add-missing-null-pointer-check-in-hostapd_free_ha.patch @@ -9,7 +9,7 @@ Signed-off-by: Felix Fietkau --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c -@@ -502,7 +502,7 @@ void hostapd_free_hapd_data(struct hosta +@@ -485,7 +485,7 @@ void hostapd_free_hapd_data(struct hosta struct hapd_interfaces *ifaces = hapd->iface->interfaces; size_t i; diff --git a/package/network/services/hostapd/patches/060-nl80211-fix-crash-when-adding-an-interface-fails.patch b/package/network/services/hostapd/patches/060-nl80211-fix-crash-when-adding-an-interface-fails.patch deleted file mode 100644 index 1df2eff3875f92..00000000000000 --- a/package/network/services/hostapd/patches/060-nl80211-fix-crash-when-adding-an-interface-fails.patch +++ /dev/null @@ -1,21 +0,0 @@ -From: Felix Fietkau -Date: Fri, 14 Jun 2024 14:41:16 +0200 -Subject: [PATCH] nl80211: fix crash when adding an interface fails - -When adding an interface fails early, the bss link is still NULL. -Avoid crashing on deleting beacons. - -Signed-off-by: Felix Fietkau ---- - ---- a/src/drivers/driver_nl80211.c -+++ b/src/drivers/driver_nl80211.c -@@ -3071,7 +3071,7 @@ static int wpa_driver_nl80211_del_beacon - struct wpa_driver_nl80211_data *drv = bss->drv; - struct i802_link *link = nl80211_get_link(bss, link_id); - -- if (!link->beacon_set) -+ if (!link || !link->beacon_set) - return 0; - - wpa_printf(MSG_DEBUG, "nl80211: Remove beacon (ifindex=%d)", diff --git a/package/network/services/hostapd/patches/110-mbedtls-TLS-crypto-option-initial-port.patch b/package/network/services/hostapd/patches/110-mbedtls-TLS-crypto-option-initial-port.patch index b55c0b1f8450a8..ca56b38f68693c 100644 --- a/package/network/services/hostapd/patches/110-mbedtls-TLS-crypto-option-initial-port.patch +++ b/package/network/services/hostapd/patches/110-mbedtls-TLS-crypto-option-initial-port.patch @@ -273,7 +273,7 @@ Signed-off-by: Glenn Strauss ifdef CONFIG_RADIUS_SERVER CFLAGS += -DRADIUS_SERVER -@@ -1341,7 +1426,9 @@ NOBJS += ../src/utils/trace.o +@@ -1342,7 +1427,9 @@ NOBJS += ../src/utils/trace.o endif HOBJS += hlr_auc_gw.o ../src/utils/common.o ../src/utils/wpa_debug.o ../src/utils/os_$(CONFIG_OS).o ../src/utils/wpabuf.o ../src/crypto/milenage.o @@ -283,7 +283,7 @@ Signed-off-by: Glenn Strauss ifdef CONFIG_INTERNAL_AES HOBJS += ../src/crypto/aes-internal.o HOBJS += ../src/crypto/aes-internal-enc.o -@@ -1364,13 +1451,17 @@ SOBJS += ../src/common/sae.o +@@ -1365,13 +1452,17 @@ SOBJS += ../src/common/sae.o SOBJS += ../src/common/sae_pk.o SOBJS += ../src/common/dragonfly.o SOBJS += $(AESOBJS) @@ -7765,7 +7765,7 @@ Signed-off-by: Glenn Strauss CONFIG_SIM_SIMULATOR=y --- a/wpa_supplicant/Makefile +++ b/wpa_supplicant/Makefile -@@ -1229,6 +1229,29 @@ endif +@@ -1230,6 +1230,29 @@ endif CFLAGS += -DTLS_DEFAULT_CIPHERS=\"$(CONFIG_TLS_DEFAULT_CIPHERS)\" endif @@ -7795,7 +7795,7 @@ Signed-off-by: Glenn Strauss ifeq ($(CONFIG_TLS), gnutls) ifndef CONFIG_CRYPTO # default to libgcrypt -@@ -1421,9 +1444,11 @@ endif +@@ -1422,9 +1445,11 @@ endif ifneq ($(CONFIG_TLS), openssl) ifneq ($(CONFIG_TLS), wolfssl) @@ -7807,7 +7807,7 @@ Signed-off-by: Glenn Strauss ifdef CONFIG_OPENSSL_INTERNAL_AES_WRAP # Seems to be needed at least with BoringSSL NEED_INTERNAL_AES_WRAP=y -@@ -1437,9 +1462,11 @@ endif +@@ -1438,9 +1463,11 @@ endif ifdef NEED_INTERNAL_AES_WRAP ifneq ($(CONFIG_TLS), linux) @@ -7819,7 +7819,7 @@ Signed-off-by: Glenn Strauss ifdef NEED_AES_EAX AESOBJS += ../src/crypto/aes-eax.o NEED_AES_CTR=y -@@ -1449,35 +1476,45 @@ AESOBJS += ../src/crypto/aes-siv.o +@@ -1450,35 +1477,45 @@ AESOBJS += ../src/crypto/aes-siv.o NEED_AES_CTR=y endif ifdef NEED_AES_CTR @@ -7865,7 +7865,7 @@ Signed-off-by: Glenn Strauss ifdef NEED_AES_ENC ifdef CONFIG_INTERNAL_AES AESOBJS += ../src/crypto/aes-internal-enc.o -@@ -1492,12 +1529,16 @@ ifneq ($(CONFIG_TLS), openssl) +@@ -1493,12 +1530,16 @@ ifneq ($(CONFIG_TLS), openssl) ifneq ($(CONFIG_TLS), linux) ifneq ($(CONFIG_TLS), gnutls) ifneq ($(CONFIG_TLS), wolfssl) @@ -7882,7 +7882,7 @@ Signed-off-by: Glenn Strauss ifdef CONFIG_INTERNAL_SHA1 SHA1OBJS += ../src/crypto/sha1-internal.o ifdef NEED_FIPS186_2_PRF -@@ -1509,29 +1550,37 @@ CFLAGS += -DCONFIG_NO_PBKDF2 +@@ -1510,29 +1551,37 @@ CFLAGS += -DCONFIG_NO_PBKDF2 else ifneq ($(CONFIG_TLS), openssl) ifneq ($(CONFIG_TLS), wolfssl) @@ -7920,7 +7920,7 @@ Signed-off-by: Glenn Strauss ifdef NEED_MD5 ifdef CONFIG_INTERNAL_MD5 MD5OBJS += ../src/crypto/md5-internal.o -@@ -1586,12 +1635,17 @@ ifneq ($(CONFIG_TLS), openssl) +@@ -1587,12 +1636,17 @@ ifneq ($(CONFIG_TLS), openssl) ifneq ($(CONFIG_TLS), linux) ifneq ($(CONFIG_TLS), gnutls) ifneq ($(CONFIG_TLS), wolfssl) @@ -7938,7 +7938,7 @@ Signed-off-by: Glenn Strauss ifdef CONFIG_INTERNAL_SHA256 SHA256OBJS += ../src/crypto/sha256-internal.o endif -@@ -1604,50 +1658,68 @@ CFLAGS += -DCONFIG_INTERNAL_SHA512 +@@ -1605,50 +1659,68 @@ CFLAGS += -DCONFIG_INTERNAL_SHA512 SHA256OBJS += ../src/crypto/sha512-internal.o endif ifdef NEED_TLS_PRF_SHA256 @@ -8007,7 +8007,7 @@ Signed-off-by: Glenn Strauss ifdef NEED_ASN1 OBJS += ../src/tls/asn1.o -@@ -1822,10 +1894,12 @@ ifdef CONFIG_FIPS +@@ -1823,10 +1895,12 @@ ifdef CONFIG_FIPS CFLAGS += -DCONFIG_FIPS ifneq ($(CONFIG_TLS), openssl) ifneq ($(CONFIG_TLS), wolfssl) diff --git a/package/network/services/hostapd/patches/120-mbedtls-fips186_2_prf.patch b/package/network/services/hostapd/patches/120-mbedtls-fips186_2_prf.patch index c101fbf75ff1c8..ebb7b51be6e563 100644 --- a/package/network/services/hostapd/patches/120-mbedtls-fips186_2_prf.patch +++ b/package/network/services/hostapd/patches/120-mbedtls-fips186_2_prf.patch @@ -101,7 +101,7 @@ Signed-off-by: Glenn Strauss --- a/wpa_supplicant/Makefile +++ b/wpa_supplicant/Makefile -@@ -1240,10 +1240,6 @@ endif +@@ -1241,10 +1241,6 @@ endif OBJS += ../src/crypto/crypto_$(CONFIG_CRYPTO).o OBJS_p += ../src/crypto/crypto_$(CONFIG_CRYPTO).o OBJS_priv += ../src/crypto/crypto_$(CONFIG_CRYPTO).o diff --git a/package/network/services/hostapd/patches/140-tests-Makefile-make-run-tests-with-CONFIG_TLS.patch b/package/network/services/hostapd/patches/140-tests-Makefile-make-run-tests-with-CONFIG_TLS.patch index 32e8ec3a89a034..fd6055d2911c88 100644 --- a/package/network/services/hostapd/patches/140-tests-Makefile-make-run-tests-with-CONFIG_TLS.patch +++ b/package/network/services/hostapd/patches/140-tests-Makefile-make-run-tests-with-CONFIG_TLS.patch @@ -696,7 +696,7 @@ Signed-off-by: Glenn Strauss + if tls.startswith("mbed TLS"): + raise HwsimSkip("TLS v1.3 not supported") ok = ['run=OpenSSL 1.1.1', 'run=OpenSSL 3.0', 'run=OpenSSL 3.1', - 'run=OpenSSL 3.2', 'wolfSSL'] + 'run=OpenSSL 3.2', 'run=OpenSSL 3.3', 'wolfSSL'] for s in ok: @@ -122,11 +161,15 @@ def check_pkcs12_support(dev): # raise HwsimSkip("PKCS#12 not supported with this TLS library: " + tls) @@ -935,7 +935,7 @@ Signed-off-by: Glenn Strauss --- a/tests/hwsim/test_ap_ft.py +++ b/tests/hwsim/test_ap_ft.py -@@ -2486,11 +2486,11 @@ def test_ap_ft_ap_oom5(dev, apdev): +@@ -2494,11 +2494,11 @@ def test_ap_ft_ap_oom5(dev, apdev): # This will fail to roam dev[0].roam(bssid1, check_bssid=False) @@ -1079,7 +1079,7 @@ Signed-off-by: Glenn Strauss dev[0].connect("test-wpa2-eap", key_mgmt="WPA-EAP", eap="TTLS", --- a/tests/hwsim/test_fils.py +++ b/tests/hwsim/test_fils.py -@@ -1472,6 +1472,10 @@ def check_ec_group(dev, group): +@@ -1477,6 +1477,10 @@ def check_ec_group(dev, group): tls = dev.request("GET tls_library") if tls.startswith("wolfSSL"): return @@ -1124,7 +1124,7 @@ Signed-off-by: Glenn Strauss heavy_groups = [14, 15, 16] suitable_groups = [15, 16, 17, 18, 19, 20, 21] groups = [str(g) for g in sae_groups] -@@ -2194,6 +2199,8 @@ def run_sae_pwe_group(dev, apdev, group) +@@ -2232,6 +2237,8 @@ def run_sae_pwe_group(dev, apdev, group) logger.info("Add Brainpool EC groups since OpenSSL is new enough") elif tls.startswith("wolfSSL"): logger.info("Make sure Brainpool EC groups were enabled when compiling wolfSSL") @@ -1154,7 +1154,7 @@ Signed-off-by: Glenn Strauss ca_cert="auth_serv/rsa3072-ca.pem", --- a/tests/hwsim/test_wpas_ctrl.py +++ b/tests/hwsim/test_wpas_ctrl.py -@@ -1842,7 +1842,7 @@ def _test_wpas_ctrl_oom(dev): +@@ -1856,7 +1856,7 @@ def _test_wpas_ctrl_oom(dev): tls = dev[0].request("GET tls_library") if not tls.startswith("internal"): tests.append(('NFC_GET_HANDOVER_SEL NDEF P2P-CR-TAG', 'FAIL', @@ -1294,7 +1294,7 @@ Signed-off-by: Glenn Strauss if (need_more_data) { --- a/wpa_supplicant/Makefile +++ b/wpa_supplicant/Makefile -@@ -1188,6 +1188,7 @@ TLS_FUNCS=y +@@ -1189,6 +1189,7 @@ TLS_FUNCS=y endif ifeq ($(CONFIG_TLS), wolfssl) @@ -1302,7 +1302,7 @@ Signed-off-by: Glenn Strauss ifdef TLS_FUNCS CFLAGS += -DWOLFSSL_DER_LOAD OBJS += ../src/crypto/tls_wolfssl.o -@@ -1203,6 +1204,7 @@ LIBS_p += -lwolfssl -lm +@@ -1204,6 +1205,7 @@ LIBS_p += -lwolfssl -lm endif ifeq ($(CONFIG_TLS), openssl) @@ -1310,7 +1310,7 @@ Signed-off-by: Glenn Strauss CFLAGS += -DCRYPTO_RSA_OAEP_SHA256 ifdef TLS_FUNCS CFLAGS += -DEAP_TLS_OPENSSL -@@ -1230,6 +1232,7 @@ CFLAGS += -DTLS_DEFAULT_CIPHERS=\"$(CONF +@@ -1231,6 +1233,7 @@ CFLAGS += -DTLS_DEFAULT_CIPHERS=\"$(CONF endif ifeq ($(CONFIG_TLS), mbedtls) @@ -1318,7 +1318,7 @@ Signed-off-by: Glenn Strauss ifndef CONFIG_CRYPTO CONFIG_CRYPTO=mbedtls endif -@@ -1249,6 +1252,7 @@ endif +@@ -1250,6 +1253,7 @@ endif endif ifeq ($(CONFIG_TLS), gnutls) @@ -1326,7 +1326,7 @@ Signed-off-by: Glenn Strauss ifndef CONFIG_CRYPTO # default to libgcrypt CONFIG_CRYPTO=gnutls -@@ -1279,6 +1283,7 @@ endif +@@ -1280,6 +1284,7 @@ endif endif ifeq ($(CONFIG_TLS), internal) @@ -1334,7 +1334,7 @@ Signed-off-by: Glenn Strauss ifndef CONFIG_CRYPTO CONFIG_CRYPTO=internal endif -@@ -1359,6 +1364,7 @@ endif +@@ -1360,6 +1365,7 @@ endif endif ifeq ($(CONFIG_TLS), linux) diff --git a/package/network/services/hostapd/patches/170-hostapd-update-cfs0-and-cfs1-for-160MHz.patch b/package/network/services/hostapd/patches/170-hostapd-update-cfs0-and-cfs1-for-160MHz.patch index 96f674a77d516f..e2fe06e4a2b71a 100644 --- a/package/network/services/hostapd/patches/170-hostapd-update-cfs0-and-cfs1-for-160MHz.patch +++ b/package/network/services/hostapd/patches/170-hostapd-update-cfs0-and-cfs1-for-160MHz.patch @@ -130,7 +130,7 @@ Signed-off-by: P Praneesh #undef VHT_CAP_CHECK_MAX --- a/src/common/ieee802_11_defs.h +++ b/src/common/ieee802_11_defs.h -@@ -1397,6 +1397,8 @@ struct ieee80211_ampe_ie { +@@ -1400,6 +1400,8 @@ struct ieee80211_ampe_ie { #define VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB ((u32) BIT(26) | BIT(27)) #define VHT_CAP_RX_ANTENNA_PATTERN ((u32) BIT(28)) #define VHT_CAP_TX_ANTENNA_PATTERN ((u32) BIT(29)) diff --git a/package/network/services/hostapd/patches/181-driver_nl80211-update-drv-ifindex-on-removing-the-fi.patch b/package/network/services/hostapd/patches/181-driver_nl80211-update-drv-ifindex-on-removing-the-fi.patch deleted file mode 100644 index b54abecc4f7768..00000000000000 --- a/package/network/services/hostapd/patches/181-driver_nl80211-update-drv-ifindex-on-removing-the-fi.patch +++ /dev/null @@ -1,18 +0,0 @@ -From: Felix Fietkau -Date: Thu, 14 Sep 2023 11:28:03 +0200 -Subject: [PATCH] driver_nl80211: update drv->ifindex on removing the first - BSS - -Signed-off-by: Felix Fietkau ---- - ---- a/src/drivers/driver_nl80211.c -+++ b/src/drivers/driver_nl80211.c -@@ -8985,6 +8985,7 @@ static int wpa_driver_nl80211_if_remove( - if (drv->first_bss->next) { - drv->first_bss = drv->first_bss->next; - drv->ctx = drv->first_bss->ctx; -+ drv->ifindex = drv->first_bss->ifindex; - os_free(bss); - } else { - wpa_printf(MSG_DEBUG, "nl80211: No second BSS to reassign context to"); diff --git a/package/network/services/hostapd/patches/182-nl80211-move-nl80211_put_freq_params-call-outside-of.patch b/package/network/services/hostapd/patches/182-nl80211-move-nl80211_put_freq_params-call-outside-of.patch deleted file mode 100644 index e875a82aea778d..00000000000000 --- a/package/network/services/hostapd/patches/182-nl80211-move-nl80211_put_freq_params-call-outside-of.patch +++ /dev/null @@ -1,34 +0,0 @@ -From: Felix Fietkau -Date: Mon, 18 Sep 2023 16:47:41 +0200 -Subject: [PATCH] nl80211: move nl80211_put_freq_params call outside of - 802.11ax #ifdef - -The relevance of this call is not specific to 802.11ax, so it should be done -even with CONFIG_IEEE80211AX disabled. - -Fixes: b3921db426ea ("nl80211: Add frequency info in start AP command") -Signed-off-by: Felix Fietkau ---- - ---- a/src/drivers/driver_nl80211.c -+++ b/src/drivers/driver_nl80211.c -@@ -5315,6 +5315,9 @@ static int wpa_driver_nl80211_set_ap(voi - nla_nest_end(msg, ftm); - } - -+ if (params->freq && nl80211_put_freq_params(msg, params->freq) < 0) -+ goto fail; -+ - #ifdef CONFIG_IEEE80211AX - if (params->he_spr_ctrl) { - struct nlattr *spr; -@@ -5349,9 +5352,6 @@ static int wpa_driver_nl80211_set_ap(voi - nla_nest_end(msg, spr); - } - -- if (params->freq && nl80211_put_freq_params(msg, params->freq) < 0) -- goto fail; -- - if (params->freq && params->freq->he_enabled && - nl80211_attr_supported(drv, NL80211_ATTR_HE_BSS_COLOR)) { - struct nlattr *bss_color; diff --git a/package/network/services/hostapd/patches/183-hostapd-cancel-channel_list_update_timeout-in-hostap.patch b/package/network/services/hostapd/patches/183-hostapd-cancel-channel_list_update_timeout-in-hostap.patch deleted file mode 100644 index 4d1af1f5c0c6f5..00000000000000 --- a/package/network/services/hostapd/patches/183-hostapd-cancel-channel_list_update_timeout-in-hostap.patch +++ /dev/null @@ -1,28 +0,0 @@ -From: Felix Fietkau -Date: Wed, 20 Sep 2023 13:41:10 +0200 -Subject: [PATCH] hostapd: cancel channel_list_update_timeout in - hostapd_cleanup_iface_partial - -Fixes a crash when disabling an interface during channel list update - -Signed-off-by: Felix Fietkau ---- - ---- a/src/ap/hostapd.c -+++ b/src/ap/hostapd.c -@@ -656,6 +656,7 @@ static void sta_track_deinit(struct host - void hostapd_cleanup_iface_partial(struct hostapd_iface *iface) - { - wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface); -+ eloop_cancel_timeout(channel_list_update_timeout, iface, NULL); - #ifdef NEED_AP_MLME - hostapd_stop_setup_timers(iface); - #endif /* NEED_AP_MLME */ -@@ -685,7 +686,6 @@ void hostapd_cleanup_iface_partial(struc - static void hostapd_cleanup_iface(struct hostapd_iface *iface) - { - wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface); -- eloop_cancel_timeout(channel_list_update_timeout, iface, NULL); - eloop_cancel_timeout(hostapd_interface_setup_failure_handler, iface, - NULL); - diff --git a/package/network/services/hostapd/patches/200-multicall.patch b/package/network/services/hostapd/patches/200-multicall.patch index 1a193b51bb1e19..753fdb0849078f 100644 --- a/package/network/services/hostapd/patches/200-multicall.patch +++ b/package/network/services/hostapd/patches/200-multicall.patch @@ -15,7 +15,7 @@ This allows building both hostapd and wpa_supplicant as a single binary include ../src/build.rules ifdef LIBS -@@ -199,7 +200,8 @@ endif +@@ -200,7 +201,8 @@ endif ifdef CONFIG_NO_VLAN CFLAGS += -DCONFIG_NO_VLAN @@ -25,7 +25,7 @@ This allows building both hostapd and wpa_supplicant as a single binary OBJS += ../src/ap/vlan_init.o OBJS += ../src/ap/vlan_ifconfig.o OBJS += ../src/ap/vlan.o -@@ -358,10 +360,14 @@ CFLAGS += -DCONFIG_MBO +@@ -359,10 +361,14 @@ CFLAGS += -DCONFIG_MBO OBJS += ../src/ap/mbo_ap.o endif @@ -43,7 +43,7 @@ This allows building both hostapd and wpa_supplicant as a single binary LIBS += $(DRV_AP_LIBS) ifdef CONFIG_L2_PACKET -@@ -1392,6 +1398,12 @@ install: $(addprefix $(DESTDIR)$(BINDIR) +@@ -1393,6 +1399,12 @@ install: $(addprefix $(DESTDIR)$(BINDIR) _OBJS_VAR := OBJS include ../src/objs.mk @@ -56,7 +56,7 @@ This allows building both hostapd and wpa_supplicant as a single binary hostapd: $(OBJS) $(Q)$(CC) $(LDFLAGS) -o hostapd $(OBJS) $(LIBS) @$(E) " LD " $@ -@@ -1472,6 +1484,12 @@ include ../src/objs.mk +@@ -1473,6 +1485,12 @@ include ../src/objs.mk _OBJS_VAR := SOBJS include ../src/objs.mk @@ -71,7 +71,7 @@ This allows building both hostapd and wpa_supplicant as a single binary @$(E) " LD " $@ --- a/hostapd/main.c +++ b/hostapd/main.c -@@ -705,6 +705,11 @@ fail: +@@ -696,6 +696,11 @@ fail: return -1; } @@ -83,7 +83,7 @@ This allows building both hostapd and wpa_supplicant as a single binary #ifdef CONFIG_WPS static int gen_uuid(const char *txt_addr) -@@ -798,6 +803,8 @@ int main(int argc, char *argv[]) +@@ -812,6 +817,8 @@ int main(int argc, char *argv[]) return -1; #endif /* CONFIG_DPP */ @@ -94,8 +94,8 @@ This allows building both hostapd and wpa_supplicant as a single binary if (c < 0) --- a/src/ap/drv_callbacks.c +++ b/src/ap/drv_callbacks.c -@@ -2341,8 +2341,8 @@ err: - #endif /* CONFIG_OWE */ +@@ -2514,8 +2514,8 @@ static void hostapd_mld_iface_disable(st + #endif /* CONFIG_IEEE80211BE */ -void wpa_supplicant_event(void *ctx, enum wpa_event_type event, @@ -105,7 +105,7 @@ This allows building both hostapd and wpa_supplicant as a single binary { struct hostapd_data *hapd = ctx; struct sta_info *sta; -@@ -2674,7 +2674,7 @@ void wpa_supplicant_event(void *ctx, enu +@@ -2873,7 +2873,7 @@ void wpa_supplicant_event(void *ctx, enu } @@ -116,7 +116,7 @@ This allows building both hostapd and wpa_supplicant as a single binary struct hapd_interfaces *interfaces = ctx; --- a/src/drivers/driver.h +++ b/src/drivers/driver.h -@@ -6763,8 +6763,8 @@ union wpa_event_data { +@@ -6897,8 +6897,8 @@ union wpa_event_data { * Driver wrapper code should call this function whenever an event is received * from the driver. */ @@ -127,7 +127,7 @@ This allows building both hostapd and wpa_supplicant as a single binary /** * wpa_supplicant_event_global - Report a driver event for wpa_supplicant -@@ -6776,7 +6776,7 @@ void wpa_supplicant_event(void *ctx, enu +@@ -6910,7 +6910,7 @@ void wpa_supplicant_event(void *ctx, enu * Same as wpa_supplicant_event(), but we search for the interface in * wpa_global. */ @@ -159,7 +159,7 @@ This allows building both hostapd and wpa_supplicant as a single binary include ../src/build.rules ifdef CONFIG_BUILD_PASN_SO -@@ -388,7 +389,9 @@ endif +@@ -389,7 +390,9 @@ endif ifdef CONFIG_IBSS_RSN NEED_RSN_AUTHENTICATOR=y CFLAGS += -DCONFIG_IBSS_RSN @@ -169,7 +169,7 @@ This allows building both hostapd and wpa_supplicant as a single binary OBJS += ibss_rsn.o endif -@@ -980,6 +983,10 @@ ifdef CONFIG_DYNAMIC_EAP_METHODS +@@ -981,6 +984,10 @@ ifdef CONFIG_DYNAMIC_EAP_METHODS CFLAGS += -DCONFIG_DYNAMIC_EAP_METHODS LIBS += -ldl -rdynamic endif @@ -180,7 +180,7 @@ This allows building both hostapd and wpa_supplicant as a single binary endif ifdef CONFIG_AP -@@ -987,9 +994,11 @@ NEED_EAP_COMMON=y +@@ -988,9 +995,11 @@ NEED_EAP_COMMON=y NEED_RSN_AUTHENTICATOR=y CFLAGS += -DCONFIG_AP OBJS += ap.o @@ -192,7 +192,7 @@ This allows building both hostapd and wpa_supplicant as a single binary OBJS += ../src/ap/hostapd.o OBJS += ../src/ap/wpa_auth_glue.o OBJS += ../src/ap/utils.o -@@ -1080,6 +1089,12 @@ endif +@@ -1081,6 +1090,12 @@ endif ifdef CONFIG_HS20 OBJS += ../src/ap/hs20.o endif @@ -205,7 +205,7 @@ This allows building both hostapd and wpa_supplicant as a single binary endif ifdef CONFIG_MBO -@@ -1089,7 +1104,9 @@ NEED_GAS=y +@@ -1090,7 +1105,9 @@ NEED_GAS=y endif ifdef NEED_RSN_AUTHENTICATOR @@ -215,7 +215,7 @@ This allows building both hostapd and wpa_supplicant as a single binary NEED_AES_WRAP=y OBJS += ../src/ap/wpa_auth.o OBJS += ../src/ap/wpa_auth_ie.o -@@ -2079,6 +2096,12 @@ wpa_priv: $(BCHECK) $(OBJS_priv) +@@ -2080,6 +2097,12 @@ wpa_priv: $(BCHECK) $(OBJS_priv) _OBJS_VAR := OBJS include ../src/objs.mk @@ -228,7 +228,7 @@ This allows building both hostapd and wpa_supplicant as a single binary wpa_supplicant: $(BCHECK) $(OBJS) $(EXTRA_progs) $(Q)$(LDO) $(LDFLAGS) -o wpa_supplicant $(OBJS) $(LIBS) $(EXTRALIBS) @$(E) " LD " $@ -@@ -2211,6 +2234,12 @@ eap_gpsk.so: $(SRC_EAP_GPSK) +@@ -2212,6 +2235,12 @@ eap_gpsk.so: $(SRC_EAP_GPSK) $(Q)sed -e 's|\@BINDIR\@|$(BINDIR)|g' $< >$@ @$(E) " sed" $< @@ -256,7 +256,7 @@ This allows building both hostapd and wpa_supplicant as a single binary const struct wpa_driver_ops *const wpa_drivers[] = { NULL }; -@@ -1325,6 +1330,10 @@ static void usage(void) +@@ -1328,6 +1333,10 @@ static void usage(void) "option several times.\n"); } @@ -267,7 +267,7 @@ This allows building both hostapd and wpa_supplicant as a single binary int main(int argc, char *argv[]) { -@@ -1348,6 +1357,8 @@ int main(int argc, char *argv[]) +@@ -1351,6 +1360,8 @@ int main(int argc, char *argv[]) if (os_program_init()) return -1; @@ -278,7 +278,7 @@ This allows building both hostapd and wpa_supplicant as a single binary os_memset(&eapol_test, 0, sizeof(eapol_test)); --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c -@@ -5919,8 +5919,8 @@ static void wpas_link_reconfig(struct wp +@@ -6099,8 +6099,8 @@ static void wpas_link_reconfig(struct wp } @@ -289,7 +289,7 @@ This allows building both hostapd and wpa_supplicant as a single binary { struct wpa_supplicant *wpa_s = ctx; int resched; -@@ -6872,7 +6872,7 @@ void wpa_supplicant_event(void *ctx, enu +@@ -7052,7 +7052,7 @@ void wpa_supplicant_event(void *ctx, enu } @@ -300,7 +300,7 @@ This allows building both hostapd and wpa_supplicant as a single binary struct wpa_supplicant *wpa_s; --- a/wpa_supplicant/wpa_priv.c +++ b/wpa_supplicant/wpa_priv.c -@@ -1039,8 +1039,8 @@ static void wpa_priv_send_ft_response(st +@@ -1042,8 +1042,8 @@ static void wpa_priv_send_ft_response(st } @@ -311,7 +311,7 @@ This allows building both hostapd and wpa_supplicant as a single binary { struct wpa_priv_interface *iface = ctx; -@@ -1103,7 +1103,7 @@ void wpa_supplicant_event(void *ctx, enu +@@ -1106,7 +1106,7 @@ void wpa_supplicant_event(void *ctx, enu } @@ -320,7 +320,7 @@ This allows building both hostapd and wpa_supplicant as a single binary union wpa_event_data *data) { struct wpa_priv_global *global = ctx; -@@ -1217,6 +1217,8 @@ int main(int argc, char *argv[]) +@@ -1220,6 +1220,8 @@ int main(int argc, char *argv[]) if (os_program_init()) return -1; @@ -331,7 +331,7 @@ This allows building both hostapd and wpa_supplicant as a single binary os_memset(&global, 0, sizeof(global)); --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -7583,7 +7583,6 @@ struct wpa_interface * wpa_supplicant_ma +@@ -7787,7 +7787,6 @@ struct wpa_interface * wpa_supplicant_ma return NULL; } @@ -339,7 +339,7 @@ This allows building both hostapd and wpa_supplicant as a single binary /** * wpa_supplicant_match_existing - Match existing interfaces * @global: Pointer to global data from wpa_supplicant_init() -@@ -7618,6 +7617,11 @@ static int wpa_supplicant_match_existing +@@ -7822,6 +7821,11 @@ static int wpa_supplicant_match_existing #endif /* CONFIG_MATCH_IFACE */ @@ -351,7 +351,7 @@ This allows building both hostapd and wpa_supplicant as a single binary /** * wpa_supplicant_add_iface - Add a new network interface -@@ -7874,6 +7878,8 @@ struct wpa_global * wpa_supplicant_init( +@@ -8078,6 +8082,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 */ diff --git a/package/network/services/hostapd/patches/201-lto-jobserver-support.patch b/package/network/services/hostapd/patches/201-lto-jobserver-support.patch index ea0dc290813790..7473cbef968893 100644 --- a/package/network/services/hostapd/patches/201-lto-jobserver-support.patch +++ b/package/network/services/hostapd/patches/201-lto-jobserver-support.patch @@ -5,7 +5,7 @@ Subject: [PATCH] hostapd: build with LTO enabled (using jobserver for parallel --- a/hostapd/Makefile +++ b/hostapd/Makefile -@@ -1405,7 +1405,7 @@ hostapd_multi.a: $(BCHECK) $(OBJS) +@@ -1406,7 +1406,7 @@ hostapd_multi.a: $(BCHECK) $(OBJS) @$(AR) cr $@ hostapd_multi.o $(OBJS) hostapd: $(OBJS) @@ -14,7 +14,7 @@ Subject: [PATCH] hostapd: build with LTO enabled (using jobserver for parallel @$(E) " LD " $@ ifdef CONFIG_WPA_TRACE -@@ -1416,7 +1416,7 @@ _OBJS_VAR := OBJS_c +@@ -1417,7 +1417,7 @@ _OBJS_VAR := OBJS_c include ../src/objs.mk hostapd_cli: $(OBJS_c) @@ -25,7 +25,7 @@ Subject: [PATCH] hostapd: build with LTO enabled (using jobserver for parallel NOBJS = nt_password_hash.o ../src/crypto/ms_funcs.o $(SHA1OBJS) --- a/wpa_supplicant/Makefile +++ b/wpa_supplicant/Makefile -@@ -2103,31 +2103,31 @@ wpa_supplicant_multi.a: .config $(BCHECK +@@ -2104,31 +2104,31 @@ wpa_supplicant_multi.a: .config $(BCHECK @$(AR) cr $@ wpa_supplicant_multi.o $(OBJS) wpa_supplicant: $(BCHECK) $(OBJS) $(EXTRA_progs) diff --git a/package/network/services/hostapd/patches/210-build-de-duplicate-_DIRS-before-calling-mkdir.patch b/package/network/services/hostapd/patches/210-build-de-duplicate-_DIRS-before-calling-mkdir.patch deleted file mode 100644 index 08d4393c906d0e..00000000000000 --- a/package/network/services/hostapd/patches/210-build-de-duplicate-_DIRS-before-calling-mkdir.patch +++ /dev/null @@ -1,23 +0,0 @@ -From: Felix Fietkau -Date: Thu, 4 Apr 2024 12:59:41 +0200 -Subject: [PATCH] build: de-duplicate _DIRS before calling mkdir - -If the build path is long, the contents of the _DIRS variable can be very long, -since it repeats the same directories very often. -In some cases, this has triggered an "Argument list too long" build error. - -Suggested-by: Eneas U de Queiroz -Signed-off-by: Felix Fietkau ---- - ---- a/src/build.rules -+++ b/src/build.rules -@@ -80,7 +80,7 @@ endif - _DIRS := $(BUILDDIR)/$(PROJ) - .PHONY: _make_dirs - _make_dirs: -- @mkdir -p $(_DIRS) -+ @mkdir -p $(sort $(_DIRS)) - - $(BUILDDIR)/$(PROJ)/src/%.o: $(ROOTDIR)src/%.c $(CONFIG_FILE) | _make_dirs - $(Q)$(CC) -c -o $@ $(CFLAGS) $< diff --git a/package/network/services/hostapd/patches/211-ctrl-make-WNM_AP-functions-dependant-on-CONFIG_AP.patch b/package/network/services/hostapd/patches/211-ctrl-make-WNM_AP-functions-dependant-on-CONFIG_AP.patch index 84fdea8c785231..475a50b87e5420 100644 --- a/package/network/services/hostapd/patches/211-ctrl-make-WNM_AP-functions-dependant-on-CONFIG_AP.patch +++ b/package/network/services/hostapd/patches/211-ctrl-make-WNM_AP-functions-dependant-on-CONFIG_AP.patch @@ -13,7 +13,7 @@ Signed-off-by: David Bauer --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c -@@ -13214,7 +13214,7 @@ char * wpa_supplicant_ctrl_iface_process +@@ -13233,7 +13233,7 @@ char * wpa_supplicant_ctrl_iface_process if (wpas_ctrl_iface_coloc_intf_report(wpa_s, buf + 18)) reply_len = -1; #endif /* CONFIG_WNM */ @@ -22,7 +22,7 @@ Signed-off-by: David Bauer } else if (os_strncmp(buf, "DISASSOC_IMMINENT ", 18) == 0) { if (ap_ctrl_iface_disassoc_imminent(wpa_s, buf + 18)) reply_len = -1; -@@ -13224,7 +13224,7 @@ char * wpa_supplicant_ctrl_iface_process +@@ -13243,7 +13243,7 @@ char * wpa_supplicant_ctrl_iface_process } else if (os_strncmp(buf, "BSS_TM_REQ ", 11) == 0) { if (ap_ctrl_iface_bss_tm_req(wpa_s, buf + 11)) reply_len = -1; diff --git a/package/network/services/hostapd/patches/220-indicate-features.patch b/package/network/services/hostapd/patches/220-indicate-features.patch index 006a567c338c9d..064e2dd626bd8b 100644 --- a/package/network/services/hostapd/patches/220-indicate-features.patch +++ b/package/network/services/hostapd/patches/220-indicate-features.patch @@ -15,7 +15,7 @@ Subject: [PATCH] hostapd: support optional argument for the -v switch of struct hapd_global { void **drv_priv; -@@ -806,7 +806,7 @@ int main(int argc, char *argv[]) +@@ -820,7 +820,7 @@ int main(int argc, char *argv[]) wpa_supplicant_event = hostapd_wpa_event; wpa_supplicant_event_global = hostapd_wpa_event_global; for (;;) { @@ -24,7 +24,7 @@ Subject: [PATCH] hostapd: support optional argument for the -v switch of if (c < 0) break; switch (c) { -@@ -843,6 +843,8 @@ int main(int argc, char *argv[]) +@@ -857,6 +857,8 @@ int main(int argc, char *argv[]) break; #endif /* CONFIG_DEBUG_LINUX_TRACING */ case 'v': diff --git a/package/network/services/hostapd/patches/250-hostapd_cli_ifdef.patch b/package/network/services/hostapd/patches/250-hostapd_cli_ifdef.patch index b6421e9d75957e..58143020ce0a17 100644 --- a/package/network/services/hostapd/patches/250-hostapd_cli_ifdef.patch +++ b/package/network/services/hostapd/patches/250-hostapd_cli_ifdef.patch @@ -37,7 +37,7 @@ Subject: [PATCH] hostapd: support wps in hostapd_cli even when built from the static int hostapd_cli_cmd_disassoc_imminent(struct wpa_ctrl *ctrl, int argc, -@@ -1670,13 +1666,10 @@ static const struct hostapd_cli_cmd host +@@ -1686,13 +1682,10 @@ static const struct hostapd_cli_cmd host { "disassociate", hostapd_cli_cmd_disassociate, hostapd_complete_stations, " = disassociate a station" }, @@ -51,7 +51,7 @@ Subject: [PATCH] hostapd: support wps in hostapd_cli even when built from the { "wps_pin", hostapd_cli_cmd_wps_pin, NULL, " [timeout] [addr] = add WPS Enrollee PIN" }, { "wps_check_pin", hostapd_cli_cmd_wps_check_pin, NULL, -@@ -1701,7 +1694,6 @@ static const struct hostapd_cli_cmd host +@@ -1717,7 +1710,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/252-disable_ctrl_iface_mib.patch b/package/network/services/hostapd/patches/252-disable_ctrl_iface_mib.patch index c65b2b181e3461..0110e08d63778f 100644 --- a/package/network/services/hostapd/patches/252-disable_ctrl_iface_mib.patch +++ b/package/network/services/hostapd/patches/252-disable_ctrl_iface_mib.patch @@ -4,7 +4,7 @@ Subject: [PATCH] Remove some unnecessary control interface functionality --- a/hostapd/Makefile +++ b/hostapd/Makefile -@@ -221,6 +221,9 @@ endif +@@ -222,6 +222,9 @@ endif ifdef CONFIG_NO_CTRL_IFACE CFLAGS += -DCONFIG_NO_CTRL_IFACE else @@ -16,7 +16,7 @@ Subject: [PATCH] Remove some unnecessary control interface functionality else --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c -@@ -3897,6 +3897,7 @@ static int hostapd_ctrl_iface_receive_pr +@@ -4045,6 +4045,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); @@ -24,7 +24,7 @@ Subject: [PATCH] Remove some unnecessary control interface functionality } else if (os_strcmp(buf, "MIB") == 0) { reply_len = ieee802_11_get_mib(hapd, reply, reply_size); if (reply_len >= 0) { -@@ -3938,6 +3939,7 @@ static int hostapd_ctrl_iface_receive_pr +@@ -4086,6 +4087,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); @@ -88,7 +88,7 @@ Subject: [PATCH] Remove some unnecessary control interface functionality static int hostapd_ctrl_iface_sta_mib(struct hostapd_data *hapd, struct sta_info *sta, char *buf, size_t buflen) -@@ -539,6 +539,7 @@ int hostapd_ctrl_iface_sta_next(struct h +@@ -562,6 +562,7 @@ int hostapd_ctrl_iface_sta_next(struct h return hostapd_ctrl_iface_sta_mib(hapd, sta->next, buf, buflen); } @@ -96,7 +96,7 @@ Subject: [PATCH] Remove some unnecessary control interface functionality #ifdef CONFIG_P2P_MANAGER static int p2p_manager_disconnect(struct hostapd_data *hapd, u16 stype, -@@ -951,12 +952,12 @@ int hostapd_ctrl_iface_status(struct hos +@@ -1016,12 +1017,12 @@ int hostapd_ctrl_iface_status(struct hos return len; len += ret; } @@ -113,7 +113,7 @@ Subject: [PATCH] Remove some unnecessary control interface functionality if (os_snprintf_error(buflen - len, ret)) --- a/src/ap/ieee802_1x.c +++ b/src/ap/ieee802_1x.c -@@ -2837,6 +2837,7 @@ static const char * bool_txt(bool val) +@@ -2848,6 +2848,7 @@ static const char * bool_txt(bool val) return val ? "TRUE" : "FALSE"; } @@ -121,7 +121,7 @@ Subject: [PATCH] Remove some unnecessary control interface functionality int ieee802_1x_get_mib(struct hostapd_data *hapd, char *buf, size_t buflen) { -@@ -3023,6 +3024,7 @@ int ieee802_1x_get_mib_sta(struct hostap +@@ -3034,6 +3035,7 @@ int ieee802_1x_get_mib_sta(struct hostap return len; } @@ -131,7 +131,7 @@ Subject: [PATCH] Remove some unnecessary control interface functionality 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 -@@ -5583,6 +5583,7 @@ static const char * wpa_bool_txt(int val +@@ -6129,6 +6129,7 @@ static const char * wpa_bool_txt(int val return val ? "TRUE" : "FALSE"; } @@ -139,7 +139,7 @@ Subject: [PATCH] Remove some unnecessary control interface functionality #define RSN_SUITE "%02x-%02x-%02x-%d" #define RSN_SUITE_ARG(s) \ -@@ -5735,7 +5736,7 @@ int wpa_get_mib_sta(struct wpa_state_mac +@@ -6281,7 +6282,7 @@ int wpa_get_mib_sta(struct wpa_state_mac return len; } @@ -150,7 +150,7 @@ Subject: [PATCH] Remove some unnecessary control interface functionality { --- a/src/rsn_supp/wpa.c +++ b/src/rsn_supp/wpa.c -@@ -3943,6 +3943,8 @@ static u32 wpa_key_mgmt_suite(struct wpa +@@ -4155,6 +4155,8 @@ static u32 wpa_key_mgmt_suite(struct wpa } @@ -159,7 +159,7 @@ Subject: [PATCH] Remove some unnecessary control interface functionality #define RSN_SUITE "%02x-%02x-%02x-%d" #define RSN_SUITE_ARG(s) \ ((s) >> 24) & 0xff, ((s) >> 16) & 0xff, ((s) >> 8) & 0xff, (s) & 0xff -@@ -4024,6 +4026,7 @@ int wpa_sm_get_mib(struct wpa_sm *sm, ch +@@ -4236,6 +4238,7 @@ int wpa_sm_get_mib(struct wpa_sm *sm, ch return (int) len; } @@ -169,7 +169,7 @@ Subject: [PATCH] Remove some unnecessary control interface functionality --- a/wpa_supplicant/Makefile +++ b/wpa_supplicant/Makefile -@@ -1038,6 +1038,9 @@ ifdef CONFIG_FILS +@@ -1039,6 +1039,9 @@ ifdef CONFIG_FILS OBJS += ../src/ap/fils_hlp.o endif ifdef CONFIG_CTRL_IFACE @@ -201,7 +201,7 @@ Subject: [PATCH] Remove some unnecessary control interface functionality if (wpa_s->ap_iface) { pos += ap_ctrl_iface_wpa_get_status(wpa_s, pos, end - pos, -@@ -12542,6 +12542,7 @@ char * wpa_supplicant_ctrl_iface_process +@@ -12561,6 +12561,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); @@ -209,7 +209,7 @@ Subject: [PATCH] Remove some unnecessary control interface functionality } else if (os_strcmp(buf, "MIB") == 0) { reply_len = wpa_sm_get_mib(wpa_s->wpa, reply, reply_size); if (reply_len >= 0) { -@@ -12554,6 +12555,7 @@ char * wpa_supplicant_ctrl_iface_process +@@ -12573,6 +12574,7 @@ char * wpa_supplicant_ctrl_iface_process reply_size - reply_len); #endif /* CONFIG_MACSEC */ } @@ -217,7 +217,7 @@ Subject: [PATCH] Remove some unnecessary control interface functionality } else if (os_strncmp(buf, "STATUS", 6) == 0) { reply_len = wpa_supplicant_ctrl_iface_status( wpa_s, buf + 6, reply, reply_size); -@@ -13042,6 +13044,7 @@ char * wpa_supplicant_ctrl_iface_process +@@ -13061,6 +13063,7 @@ char * wpa_supplicant_ctrl_iface_process reply_len = wpa_supplicant_ctrl_iface_bss( wpa_s, buf + 4, reply, reply_size); #ifdef CONFIG_AP @@ -225,7 +225,7 @@ Subject: [PATCH] Remove some unnecessary control interface functionality } 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) { -@@ -13050,12 +13053,15 @@ char * wpa_supplicant_ctrl_iface_process +@@ -13069,12 +13072,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); diff --git a/package/network/services/hostapd/patches/253-qos_map_set_without_interworking.patch b/package/network/services/hostapd/patches/253-qos_map_set_without_interworking.patch deleted file mode 100644 index 4072ff5664567c..00000000000000 --- a/package/network/services/hostapd/patches/253-qos_map_set_without_interworking.patch +++ /dev/null @@ -1,103 +0,0 @@ -From: Felix Fietkau -Date: Thu, 4 Nov 2021 11:45:18 +0100 -Subject: [PATCH] hostapd: support qos_map_set without CONFIG_INTERWORKING - -This feature is useful on its own even without full interworking support - ---- a/hostapd/config_file.c -+++ b/hostapd/config_file.c -@@ -1680,6 +1680,8 @@ static int parse_anqp_elem(struct hostap - return 0; - } - -+#endif /* CONFIG_INTERWORKING */ -+ - - static int parse_qos_map_set(struct hostapd_bss_config *bss, - char *buf, int line) -@@ -1721,8 +1723,6 @@ static int parse_qos_map_set(struct host - return 0; - } - --#endif /* CONFIG_INTERWORKING */ -- - - #ifdef CONFIG_HS20 - static int hs20_parse_conn_capab(struct hostapd_bss_config *bss, char *buf, -@@ -4260,10 +4260,10 @@ static int hostapd_config_fill(struct ho - bss->gas_frag_limit = val; - } else if (os_strcmp(buf, "gas_comeback_delay") == 0) { - bss->gas_comeback_delay = atoi(pos); -+#endif /* CONFIG_INTERWORKING */ - } else if (os_strcmp(buf, "qos_map_set") == 0) { - if (parse_qos_map_set(bss, pos, line) < 0) - return 1; --#endif /* CONFIG_INTERWORKING */ - #ifdef CONFIG_RADIUS_TEST - } else if (os_strcmp(buf, "dump_msk_file") == 0) { - os_free(bss->dump_msk_file); ---- a/src/ap/hostapd.c -+++ b/src/ap/hostapd.c -@@ -1548,6 +1548,7 @@ static int hostapd_setup_bss(struct host - wpa_printf(MSG_ERROR, "GAS server initialization failed"); - return -1; - } -+#endif /* CONFIG_INTERWORKING */ - - if (conf->qos_map_set_len && - hostapd_drv_set_qos_map(hapd, conf->qos_map_set, -@@ -1555,7 +1556,6 @@ static int hostapd_setup_bss(struct host - wpa_printf(MSG_ERROR, "Failed to initialize QoS Map"); - return -1; - } --#endif /* CONFIG_INTERWORKING */ - - if (conf->bss_load_update_period && bss_load_update_init(hapd)) { - wpa_printf(MSG_ERROR, "BSS Load initialization failed"); ---- a/src/ap/ieee802_11_shared.c -+++ b/src/ap/ieee802_11_shared.c -@@ -1138,13 +1138,11 @@ u8 * hostapd_eid_rsnxe(struct hostapd_da - u16 check_ext_capab(struct hostapd_data *hapd, struct sta_info *sta, - const u8 *ext_capab_ie, size_t ext_capab_ie_len) - { --#ifdef CONFIG_INTERWORKING - /* check for QoS Map support */ - if (ext_capab_ie_len >= 5) { - if (ext_capab_ie[4] & 0x01) - sta->qos_map_enabled = 1; - } --#endif /* CONFIG_INTERWORKING */ - - if (ext_capab_ie_len > 0) { - sta->ecsa_supported = !!(ext_capab_ie[0] & BIT(2)); ---- a/wpa_supplicant/events.c -+++ b/wpa_supplicant/events.c -@@ -2935,8 +2935,6 @@ void wnm_bss_keep_alive_deinit(struct wp - } - - --#ifdef CONFIG_INTERWORKING -- - static int wpas_qos_map_set(struct wpa_supplicant *wpa_s, const u8 *qos_map, - size_t len) - { -@@ -2969,8 +2967,6 @@ static void interworking_process_assoc_r - } - } - --#endif /* CONFIG_INTERWORKING */ -- - - static void wpa_supplicant_set_4addr_mode(struct wpa_supplicant *wpa_s) - { -@@ -3350,10 +3346,8 @@ static int wpa_supplicant_event_associnf - wnm_process_assoc_resp(wpa_s, data->assoc_info.resp_ies, - data->assoc_info.resp_ies_len); - #endif /* CONFIG_WNM */ --#ifdef CONFIG_INTERWORKING - interworking_process_assoc_resp(wpa_s, data->assoc_info.resp_ies, - data->assoc_info.resp_ies_len); --#endif /* CONFIG_INTERWORKING */ - if (wpa_s->hw_capab == CAPAB_VHT && - get_ie(data->assoc_info.resp_ies, - data->assoc_info.resp_ies_len, WLAN_EID_VHT_CAP)) diff --git a/package/network/services/hostapd/patches/300-noscan.patch b/package/network/services/hostapd/patches/300-noscan.patch index 9b3f401b035348..f208b2937d02d3 100644 --- a/package/network/services/hostapd/patches/300-noscan.patch +++ b/package/network/services/hostapd/patches/300-noscan.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add noscan, no_ht_coex config options --- a/hostapd/config_file.c +++ b/hostapd/config_file.c -@@ -3656,6 +3656,10 @@ static int hostapd_config_fill(struct ho +@@ -3747,6 +3747,10 @@ static int hostapd_config_fill(struct ho if (bss->ocv && !bss->ieee80211w) bss->ieee80211w = 1; #endif /* CONFIG_OCV */ @@ -18,7 +18,7 @@ Subject: [PATCH] Add noscan, no_ht_coex config options } else if (os_strcmp(buf, "ht_capab") == 0) { --- a/src/ap/ap_config.h +++ b/src/ap/ap_config.h -@@ -1093,6 +1093,8 @@ struct hostapd_config { +@@ -1122,6 +1122,8 @@ struct hostapd_config { int ht_op_mode_fixed; u16 ht_capab; @@ -29,7 +29,7 @@ Subject: [PATCH] Add noscan, no_ht_coex config options int no_pri_sec_switch; --- a/src/ap/hw_features.c +++ b/src/ap/hw_features.c -@@ -544,7 +544,8 @@ static int ieee80211n_check_40mhz(struct +@@ -573,7 +573,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 64a2eed30e522f..e5fd053232705f 100644 --- a/package/network/services/hostapd/patches/301-mesh-noscan.patch +++ b/package/network/services/hostapd/patches/301-mesh-noscan.patch @@ -47,7 +47,7 @@ Subject: [PATCH] Allow HT40 also on 2.4GHz if noscan option is set, which also /* --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -2770,7 +2770,7 @@ static bool ibss_mesh_can_use_vht(struct +@@ -2903,7 +2903,7 @@ static bool ibss_mesh_can_use_vht(struct const struct wpa_ssid *ssid, struct hostapd_hw_modes *mode) { @@ -56,7 +56,7 @@ Subject: [PATCH] Allow HT40 also on 2.4GHz if noscan option is set, which also return false; if (!drv_supports_vht(wpa_s, ssid)) -@@ -2843,7 +2843,7 @@ static void ibss_mesh_select_40mhz(struc +@@ -2976,7 +2976,7 @@ static void ibss_mesh_select_40mhz(struc int i, res; unsigned int j; static const int ht40plus[] = { @@ -65,16 +65,16 @@ Subject: [PATCH] Allow HT40 also on 2.4GHz if noscan option is set, which also 149, 157, 165, 173, 184, 192 }; int ht40 = -1; -@@ -3093,7 +3093,7 @@ void ibss_mesh_setup_freq(struct wpa_sup +@@ -3227,7 +3227,7 @@ 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; -- int i, obss_scan = 1; -+ int i, obss_scan = !(ssid->noscan); +- int obss_scan = 1; ++ int obss_scan = !(ssid->noscan); u8 channel; bool is_6ghz, is_24ghz; bool dfs_enabled = wpa_s->conf->country[0] && (wpa_s->drv_flags & WPA_DRIVER_FLAGS_RADAR); -@@ -3143,6 +3143,8 @@ void ibss_mesh_setup_freq(struct wpa_sup +@@ -3271,6 +3271,8 @@ void ibss_mesh_setup_freq(struct wpa_sup freq->he_enabled = ibss_mesh_can_use_he(wpa_s, ssid, mode, ieee80211_mode); freq->channel = channel; diff --git a/package/network/services/hostapd/patches/310-rescan_immediately.patch b/package/network/services/hostapd/patches/310-rescan_immediately.patch index 57e13dec8bd8c9..038bce9e9d3589 100644 --- a/package/network/services/hostapd/patches/310-rescan_immediately.patch +++ b/package/network/services/hostapd/patches/310-rescan_immediately.patch @@ -5,7 +5,7 @@ Subject: [PATCH] rescan_immediately.patch --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -5870,7 +5870,7 @@ wpa_supplicant_alloc(struct wpa_supplica +@@ -6073,7 +6073,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/330-nl80211_fix_set_freq.patch b/package/network/services/hostapd/patches/330-nl80211_fix_set_freq.patch index 70ec6dc63b0dd2..bcc39ea758646b 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 @@ -5,7 +5,7 @@ Subject: [PATCH] nl80211_fix_set_freq.patch --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -5483,7 +5483,7 @@ static int nl80211_set_channel(struct i8 +@@ -5510,7 +5510,7 @@ static int nl80211_set_channel(struct i8 freq->he_enabled, freq->eht_enabled, freq->bandwidth, freq->center_freq1, freq->center_freq2); 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 5ad4d6387fb633..8b8434773888ea 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 @@ -4,22 +4,7 @@ Subject: [PATCH] nl80211_del_beacon_bss.patch --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -3075,12 +3075,12 @@ static int wpa_driver_nl80211_del_beacon - return 0; - - wpa_printf(MSG_DEBUG, "nl80211: Remove beacon (ifindex=%d)", -- drv->ifindex); -+ bss->ifindex); - link->beacon_set = 0; - link->freq = 0; - - 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); - if (!msg) - return -ENOBUFS; - -@@ -6176,8 +6176,7 @@ static void nl80211_teardown_ap(struct i +@@ -6251,8 +6251,7 @@ static void nl80211_teardown_ap(struct i nl80211_mgmt_unsubscribe(bss, "AP teardown"); nl80211_put_wiphy_data_ap(bss); @@ -29,12 +14,3 @@ Subject: [PATCH] nl80211_del_beacon_bss.patch } -@@ -8977,8 +8976,6 @@ static int wpa_driver_nl80211_if_remove( - } else { - wpa_printf(MSG_DEBUG, "nl80211: First BSS - reassign context"); - nl80211_teardown_ap(bss); -- if (!bss->added_if && !drv->first_bss->next) -- wpa_driver_nl80211_del_beacon_all(bss); - nl80211_destroy_bss(bss); - if (!bss->added_if) - i802_set_iface_flags(bss, 0); 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 ac1c9280b75656..4003793a707a4e 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 @@ -14,7 +14,7 @@ Signed-hostap: Antonio Quartulli --- a/src/drivers/driver.h +++ b/src/drivers/driver.h -@@ -971,6 +971,9 @@ struct wpa_driver_associate_params { +@@ -1000,6 +1000,9 @@ struct wpa_driver_associate_params { * responsible for selecting with which BSS to associate. */ const u8 *bssid; @@ -155,7 +155,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 -@@ -4249,6 +4249,12 @@ static void wpas_start_assoc_cb(struct w +@@ -4435,6 +4435,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/463-add-mcast_rate-to-11s.patch b/package/network/services/hostapd/patches/463-add-mcast_rate-to-11s.patch index c24ca46e969faf..3cd2949e11f3b3 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,7 +19,7 @@ Tested-by: Simon Wunderlich --- a/src/drivers/driver.h +++ b/src/drivers/driver.h -@@ -1876,6 +1876,7 @@ struct wpa_driver_mesh_join_params { +@@ -1916,6 +1916,7 @@ struct wpa_driver_mesh_join_params { #define WPA_DRIVER_MESH_FLAG_AMPE 0x00000008 unsigned int flags; bool handle_dfs; @@ -29,7 +29,7 @@ Tested-by: Simon Wunderlich struct wpa_driver_set_key_params { --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -11850,6 +11850,18 @@ static int nl80211_put_mesh_id(struct nl +@@ -12140,6 +12140,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) { -@@ -11911,6 +11923,7 @@ static int nl80211_join_mesh(struct i802 +@@ -12201,6 +12213,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) || 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 664f27bd63ad64..9d39db5a634eee 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 @@ -5,7 +5,7 @@ Subject: [PATCH] Fix issues with disabling obss scan when using fixed_freq on --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -3100,6 +3100,10 @@ void ibss_mesh_setup_freq(struct wpa_sup +@@ -3234,6 +3234,10 @@ void ibss_mesh_setup_freq(struct wpa_sup freq->freq = ssid->frequency; diff --git a/package/network/services/hostapd/patches/465-hostapd-config-support-random-BSS-color.patch b/package/network/services/hostapd/patches/465-hostapd-config-support-random-BSS-color.patch index 8da7a2948eaca9..16962024456d49 100644 --- a/package/network/services/hostapd/patches/465-hostapd-config-support-random-BSS-color.patch +++ b/package/network/services/hostapd/patches/465-hostapd-config-support-random-BSS-color.patch @@ -13,7 +13,7 @@ Signed-off-by: David Bauer --- a/hostapd/config_file.c +++ b/hostapd/config_file.c -@@ -3708,6 +3708,8 @@ static int hostapd_config_fill(struct ho +@@ -3801,6 +3801,8 @@ static int hostapd_config_fill(struct ho } else if (os_strcmp(buf, "he_bss_color") == 0) { conf->he_op.he_bss_color = atoi(pos) & 0x3f; conf->he_op.he_bss_color_disabled = 0; 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 1ae2c599ebb0a7..43e30b14e9338c 100644 --- a/package/network/services/hostapd/patches/470-survey_data_fallback.patch +++ b/package/network/services/hostapd/patches/470-survey_data_fallback.patch @@ -4,7 +4,7 @@ Subject: [PATCH] hostapd: implement fallback for incomplete survey data --- a/src/ap/acs.c +++ b/src/ap/acs.c -@@ -467,17 +467,17 @@ static int acs_get_bw_center_chan(int fr +@@ -471,17 +471,17 @@ static int acs_get_bw_center_chan(int fr static int acs_survey_is_sufficient(struct freq_survey *survey) { if (!(survey->filled & SURVEY_HAS_NF)) { @@ -24,7 +24,7 @@ Subject: [PATCH] hostapd: implement fallback for incomplete survey data } if (!(survey->filled & SURVEY_HAS_CHAN_TIME_BUSY) && -@@ -485,7 +485,6 @@ static int acs_survey_is_sufficient(stru +@@ -489,7 +489,6 @@ static int acs_survey_is_sufficient(stru wpa_printf(MSG_INFO, "ACS: Survey for freq %d is missing RX and busy time (at least one is required)", survey->freq); diff --git a/package/network/services/hostapd/patches/590-rrm-wnm-statistics.patch b/package/network/services/hostapd/patches/590-rrm-wnm-statistics.patch index e1bb37ea55f109..2f66fb36b302ff 100644 --- a/package/network/services/hostapd/patches/590-rrm-wnm-statistics.patch +++ b/package/network/services/hostapd/patches/590-rrm-wnm-statistics.patch @@ -10,7 +10,7 @@ method. --- a/src/ap/hostapd.h +++ b/src/ap/hostapd.h -@@ -163,6 +163,21 @@ struct hostapd_sae_commit_queue { +@@ -183,6 +183,21 @@ struct mld_link_info { }; /** @@ -32,9 +32,9 @@ method. * struct hostapd_data - hostapd per-BSS data structure */ struct hostapd_data { -@@ -182,6 +197,9 @@ struct hostapd_data { +@@ -196,6 +211,9 @@ struct hostapd_data { - struct hostapd_data *mld_first_bss; + u8 own_addr[ETH_ALEN]; + /* OpenWrt specific statistics */ + struct hostapd_openwrt_stats openwrt_stats; diff --git a/package/network/services/hostapd/patches/600-ubus_support.patch b/package/network/services/hostapd/patches/600-ubus_support.patch index 0457f37f74c982..b864cd9a13aebb 100644 --- a/package/network/services/hostapd/patches/600-ubus_support.patch +++ b/package/network/services/hostapd/patches/600-ubus_support.patch @@ -7,7 +7,7 @@ probe/assoc/auth requests via object subscribe. --- a/hostapd/Makefile +++ b/hostapd/Makefile -@@ -166,6 +166,12 @@ OBJS += ../src/common/hw_features_common +@@ -167,6 +167,12 @@ OBJS += ../src/common/hw_features_common OBJS += ../src/eapol_auth/eapol_auth_sm.o @@ -53,7 +53,7 @@ probe/assoc/auth requests via object subscribe. } --- a/src/ap/beacon.c +++ b/src/ap/beacon.c -@@ -1351,6 +1351,12 @@ void handle_probe_req(struct hostapd_dat +@@ -1418,6 +1418,12 @@ void handle_probe_req(struct hostapd_dat int mld_id; u16 links; #endif /* CONFIG_IEEE80211BE */ @@ -66,7 +66,7 @@ probe/assoc/auth requests via object subscribe. if (hapd->iconf->rssi_ignore_probe_request && ssi_signal && ssi_signal < hapd->iconf->rssi_ignore_probe_request) -@@ -1537,6 +1543,12 @@ void handle_probe_req(struct hostapd_dat +@@ -1604,6 +1610,12 @@ void handle_probe_req(struct hostapd_dat } #endif /* CONFIG_P2P */ @@ -81,7 +81,7 @@ probe/assoc/auth requests via object subscribe. --- a/src/ap/dfs.c +++ b/src/ap/dfs.c -@@ -1225,6 +1225,8 @@ int hostapd_dfs_pre_cac_expired(struct h +@@ -1243,6 +1243,8 @@ int hostapd_dfs_pre_cac_expired(struct h "freq=%d ht_enabled=%d chan_offset=%d chan_width=%d cf1=%d cf2=%d", freq, ht_enabled, chan_offset, chan_width, cf1, cf2); @@ -92,7 +92,7 @@ probe/assoc/auth requests via object subscribe. return 0; --- a/src/ap/drv_callbacks.c +++ b/src/ap/drv_callbacks.c -@@ -268,6 +268,10 @@ int hostapd_notif_assoc(struct hostapd_d +@@ -316,6 +316,10 @@ int hostapd_notif_assoc(struct hostapd_d struct hostapd_iface *iface = hapd->iface; #endif /* CONFIG_OWE */ bool updated = false; @@ -103,7 +103,7 @@ probe/assoc/auth requests via object subscribe. if (addr == NULL) { /* -@@ -412,6 +416,12 @@ int hostapd_notif_assoc(struct hostapd_d +@@ -460,6 +464,12 @@ int hostapd_notif_assoc(struct hostapd_d goto fail; } @@ -118,7 +118,7 @@ probe/assoc/auth requests via object subscribe. wpabuf_free(sta->p2p_ie); --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c -@@ -493,6 +493,7 @@ void hostapd_free_hapd_data(struct hosta +@@ -475,6 +475,7 @@ void hostapd_free_hapd_data(struct hosta hapd->beacon_set_done = 0; wpa_printf(MSG_DEBUG, "%s(%s)", __func__, hapd->conf->iface); @@ -126,7 +126,7 @@ probe/assoc/auth requests via object subscribe. accounting_deinit(hapd); hostapd_deinit_wpa(hapd); vlan_deinit(hapd); -@@ -1274,6 +1275,8 @@ static int hostapd_start_beacon(struct h +@@ -1316,6 +1317,8 @@ static int hostapd_start_beacon(struct h if (hapd->driver && hapd->driver->set_operstate) hapd->driver->set_operstate(hapd->drv_priv, 1); @@ -135,7 +135,7 @@ probe/assoc/auth requests via object subscribe. return 0; } -@@ -2367,6 +2370,7 @@ static int hostapd_setup_interface_compl +@@ -2497,6 +2500,7 @@ static int hostapd_setup_interface_compl if (err) goto fail; @@ -143,7 +143,7 @@ probe/assoc/auth requests via object subscribe. wpa_printf(MSG_DEBUG, "Completing interface initialization"); if (iface->freq) { #ifdef NEED_AP_MLME -@@ -2586,6 +2590,7 @@ dfs_offload: +@@ -2722,6 +2726,7 @@ dfs_offload: fail: wpa_printf(MSG_ERROR, "Interface initialization failed"); @@ -151,7 +151,7 @@ probe/assoc/auth requests via object subscribe. if (iface->is_no_ir) { hostapd_set_state(iface, HAPD_IFACE_NO_IR); -@@ -3076,6 +3081,7 @@ void hostapd_interface_deinit_free(struc +@@ -3440,6 +3445,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; @@ -169,7 +169,7 @@ probe/assoc/auth requests via object subscribe. #define OCE_STA_CFON_ENABLED(hapd) \ ((hapd->conf->oce & OCE_STA_CFON) && \ -@@ -184,6 +185,7 @@ struct hostapd_data { +@@ -204,6 +205,7 @@ struct hostapd_data { struct hostapd_iface *iface; struct hostapd_config *iconf; struct hostapd_bss_config *conf; @@ -177,7 +177,7 @@ probe/assoc/auth requests via object subscribe. int interface_added; /* virtual interface added for this BSS */ unsigned int started:1; unsigned int disabled:1; -@@ -707,6 +709,7 @@ hostapd_alloc_bss_data(struct hostapd_if +@@ -766,6 +768,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); @@ -187,7 +187,7 @@ probe/assoc/auth requests via object subscribe. struct hostapd_iface * hostapd_alloc_iface(void); --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c -@@ -2798,7 +2798,7 @@ static void handle_auth(struct hostapd_d +@@ -2895,7 +2895,7 @@ static void handle_auth(struct hostapd_d u16 auth_alg, auth_transaction, status_code; u16 resp = WLAN_STATUS_SUCCESS; struct sta_info *sta = NULL; @@ -196,10 +196,10 @@ probe/assoc/auth requests via object subscribe. u16 fc; const u8 *challenge = NULL; u8 resp_ies[2 + WLAN_AUTH_CHALLENGE_LEN]; -@@ -2807,6 +2807,11 @@ static void handle_auth(struct hostapd_d - struct radius_sta rad_info; - const u8 *dst, *sa, *bssid; +@@ -2906,6 +2906,11 @@ static void handle_auth(struct hostapd_d + #ifdef CONFIG_IEEE80211BE bool mld_sta = false; + #endif /* CONFIG_IEEE80211BE */ + struct hostapd_ubus_request req = { + .type = HOSTAPD_UBUS_AUTH_REQ, + .mgmt_frame = mgmt, @@ -208,7 +208,7 @@ probe/assoc/auth requests via object subscribe. if (len < IEEE80211_HDRLEN + sizeof(mgmt->u.auth)) { wpa_printf(MSG_INFO, "handle_auth - too short payload (len=%lu)", -@@ -2998,6 +3003,13 @@ static void handle_auth(struct hostapd_d +@@ -3102,6 +3107,13 @@ static void handle_auth(struct hostapd_d resp = WLAN_STATUS_UNSPECIFIED_FAILURE; goto fail; } @@ -222,7 +222,7 @@ probe/assoc/auth requests via object subscribe. if (res == HOSTAPD_ACL_PENDING) return; -@@ -5242,7 +5254,7 @@ static void handle_assoc(struct hostapd_ +@@ -5365,7 +5377,7 @@ static void handle_assoc(struct hostapd_ int resp = WLAN_STATUS_SUCCESS; u16 reply_res = WLAN_STATUS_UNSPECIFIED_FAILURE; const u8 *pos; @@ -231,7 +231,7 @@ probe/assoc/auth requests via object subscribe. struct sta_info *sta; u8 *tmp = NULL; #ifdef CONFIG_FILS -@@ -5484,6 +5496,11 @@ static void handle_assoc(struct hostapd_ +@@ -5607,6 +5619,11 @@ static void handle_assoc(struct hostapd_ left = res; } #endif /* CONFIG_FILS */ @@ -243,9 +243,9 @@ probe/assoc/auth requests via object subscribe. /* followed by SSID and Supported rates; and HT capabilities if 802.11n * is used */ -@@ -5586,6 +5603,13 @@ static void handle_assoc(struct hostapd_ +@@ -5709,6 +5726,13 @@ static void handle_assoc(struct hostapd_ if (set_beacon) - ieee802_11_set_beacons(hapd->iface); + ieee802_11_update_beacons(hapd->iface); + ubus_resp = hostapd_ubus_handle_event(hapd, &req); + if (ubus_resp) { @@ -257,7 +257,7 @@ probe/assoc/auth requests via object subscribe. fail: /* -@@ -5836,6 +5860,7 @@ static void handle_disassoc(struct hosta +@@ -5938,6 +5962,7 @@ static void handle_disassoc(struct hosta (unsigned long) len); return; } @@ -265,7 +265,7 @@ probe/assoc/auth requests via object subscribe. sta = ap_get_sta(hapd, mgmt->sa); if (!sta) { -@@ -5867,6 +5892,8 @@ static void handle_deauth(struct hostapd +@@ -5969,6 +5994,8 @@ static void handle_deauth(struct hostapd /* Clear the PTKSA cache entries for PASN */ ptksa_cache_flush(hapd->ptksa, mgmt->sa, WPA_CIPHER_NONE); @@ -286,7 +286,7 @@ probe/assoc/auth requests via object subscribe. } -@@ -352,6 +355,9 @@ void hostapd_handle_radio_measurement(st +@@ -399,6 +402,9 @@ void hostapd_handle_radio_measurement(st mgmt->u.action.u.rrm.action, MAC2STR(mgmt->sa)); switch (mgmt->u.action.u.rrm.action) { @@ -298,7 +298,7 @@ probe/assoc/auth requests via object subscribe. break; --- a/src/ap/sta_info.c +++ b/src/ap/sta_info.c -@@ -476,6 +476,7 @@ void ap_handle_timer(void *eloop_ctx, vo +@@ -542,6 +542,7 @@ 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"); @@ -306,7 +306,7 @@ probe/assoc/auth requests via object subscribe. ap_free_sta(hapd, sta); return; } -@@ -631,6 +632,7 @@ skip_poll: +@@ -699,6 +700,7 @@ skip_poll: mlme_deauthenticate_indication( hapd, sta, WLAN_REASON_PREV_AUTH_NOT_VALID); @@ -314,7 +314,7 @@ probe/assoc/auth requests via object subscribe. ap_free_sta(hapd, sta); break; } -@@ -1448,15 +1450,28 @@ void ap_sta_set_authorized_event(struct +@@ -1521,15 +1523,28 @@ void ap_sta_set_authorized_event(struct os_snprintf(buf, sizeof(buf), MACSTR, MAC2STR(sta->addr)); if (authorized) { @@ -343,7 +343,7 @@ probe/assoc/auth requests via object subscribe. #ifdef CONFIG_P2P if (wpa_auth_get_ip_addr(sta->wpa_sm, ip_addr_buf) == 0) { os_snprintf(ip_addr, sizeof(ip_addr), -@@ -1467,6 +1482,13 @@ void ap_sta_set_authorized_event(struct +@@ -1540,6 +1555,13 @@ void ap_sta_set_authorized_event(struct } #endif /* CONFIG_P2P */ @@ -357,7 +357,7 @@ probe/assoc/auth requests via object subscribe. keyid = ap_sta_wpa_get_keyid(hapd, sta); if (keyid) { os_snprintf(keyid_buf, sizeof(keyid_buf), -@@ -1485,17 +1507,19 @@ void ap_sta_set_authorized_event(struct +@@ -1558,17 +1580,19 @@ void ap_sta_set_authorized_event(struct dpp_pkhash, SHA256_MAC_LEN); } @@ -383,7 +383,7 @@ probe/assoc/auth requests via object subscribe. hapd->msg_ctx_parent != hapd->msg_ctx) --- a/src/ap/sta_info.h +++ b/src/ap/sta_info.h -@@ -319,6 +319,7 @@ struct sta_info { +@@ -304,6 +304,7 @@ struct sta_info { #endif /* CONFIG_TESTING_OPTIONS */ #ifdef CONFIG_AIRTIME_POLICY unsigned int airtime_weight; @@ -471,7 +471,7 @@ probe/assoc/auth requests via object subscribe. } --- a/src/ap/wpa_auth_glue.c +++ b/src/ap/wpa_auth_glue.c -@@ -275,6 +275,7 @@ static void hostapd_wpa_auth_psk_failure +@@ -328,6 +328,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)); @@ -629,7 +629,7 @@ probe/assoc/auth requests via object subscribe. +} --- a/wpa_supplicant/Makefile +++ b/wpa_supplicant/Makefile -@@ -189,6 +189,13 @@ ifdef CONFIG_EAPOL_TEST +@@ -191,6 +191,13 @@ ifdef CONFIG_EAPOL_TEST CFLAGS += -Werror -DEAPOL_TEST endif @@ -643,7 +643,7 @@ probe/assoc/auth requests via object subscribe. ifdef CONFIG_CODE_COVERAGE CFLAGS += -O0 -fprofile-arcs -ftest-coverage -U_FORTIFY_SOURCE LIBS += -lgcov -@@ -1042,6 +1049,9 @@ ifdef CONFIG_CTRL_IFACE_MIB +@@ -1043,6 +1050,9 @@ ifdef CONFIG_CTRL_IFACE_MIB CFLAGS += -DCONFIG_CTRL_IFACE_MIB endif OBJS += ../src/ap/ctrl_iface_ap.o @@ -676,7 +676,7 @@ probe/assoc/auth requests via object subscribe. break; --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -7716,6 +7716,8 @@ struct wpa_supplicant * wpa_supplicant_a +@@ -7920,6 +7920,8 @@ struct wpa_supplicant * wpa_supplicant_a } #endif /* CONFIG_P2P */ @@ -685,7 +685,7 @@ probe/assoc/auth requests via object subscribe. return wpa_s; } -@@ -7742,6 +7744,8 @@ int wpa_supplicant_remove_iface(struct w +@@ -7946,6 +7948,8 @@ int wpa_supplicant_remove_iface(struct w struct wpa_supplicant *parent = wpa_s->parent; #endif /* CONFIG_MESH */ @@ -694,7 +694,7 @@ probe/assoc/auth requests via object subscribe. /* Remove interface from the global list of interfaces */ prev = global->ifaces; if (prev == wpa_s) { -@@ -8088,8 +8092,12 @@ int wpa_supplicant_run(struct wpa_global +@@ -8292,8 +8296,12 @@ int wpa_supplicant_run(struct wpa_global eloop_register_signal_terminate(wpa_supplicant_terminate, global); eloop_register_signal_reconfig(wpa_supplicant_reconfig, global); diff --git a/package/network/services/hostapd/patches/601-ucode_support.patch b/package/network/services/hostapd/patches/601-ucode_support.patch index b826363248a640..1a824a167b8ab4 100644 --- a/package/network/services/hostapd/patches/601-ucode_support.patch +++ b/package/network/services/hostapd/patches/601-ucode_support.patch @@ -8,7 +8,7 @@ as adding/removing interfaces. --- a/hostapd/Makefile +++ b/hostapd/Makefile -@@ -168,9 +168,21 @@ OBJS += ../src/eapol_auth/eapol_auth_sm. +@@ -169,9 +169,21 @@ OBJS += ../src/eapol_auth/eapol_auth_sm. ifdef CONFIG_UBUS CFLAGS += -DUBUS_SUPPORT @@ -34,7 +34,7 @@ as adding/removing interfaces. ifdef CONFIG_CODE_COVERAGE --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c -@@ -5487,6 +5487,7 @@ try_again: +@@ -5643,6 +5643,7 @@ try_again: return -1; } @@ -42,7 +42,7 @@ as adding/removing interfaces. wpa_msg_register_cb(hostapd_ctrl_iface_msg_cb); return 0; -@@ -5588,6 +5589,7 @@ fail: +@@ -5744,6 +5745,7 @@ fail: os_free(fname); interface->global_ctrl_sock = s; @@ -52,7 +52,7 @@ as adding/removing interfaces. --- a/hostapd/main.c +++ b/hostapd/main.c -@@ -1014,6 +1014,7 @@ int main(int argc, char *argv[]) +@@ -1028,6 +1028,7 @@ int main(int argc, char *argv[]) } hostapd_global_ctrl_iface_init(&interfaces); @@ -60,7 +60,7 @@ as adding/removing interfaces. if (hostapd_global_run(&interfaces, daemonize, pid_file)) { wpa_printf(MSG_ERROR, "Failed to start eloop"); -@@ -1023,6 +1024,7 @@ int main(int argc, char *argv[]) +@@ -1037,6 +1038,7 @@ int main(int argc, char *argv[]) ret = 0; out: @@ -70,7 +70,7 @@ as adding/removing interfaces. for (i = 0; i < interfaces.count; i++) { --- a/src/ap/ap_drv_ops.h +++ b/src/ap/ap_drv_ops.h -@@ -399,6 +399,23 @@ static inline int hostapd_drv_stop_ap(st +@@ -404,6 +404,23 @@ static inline int hostapd_drv_stop_ap(st return hapd->driver->stop_ap(hapd->drv_priv, link_id); } @@ -105,7 +105,7 @@ as adding/removing interfaces. if (iface->config_fname == NULL) { /* Only in-memory config in use - assume it has been updated */ hostapd_clear_old(iface); -@@ -493,6 +495,7 @@ void hostapd_free_hapd_data(struct hosta +@@ -475,6 +477,7 @@ void hostapd_free_hapd_data(struct hosta hapd->beacon_set_done = 0; wpa_printf(MSG_DEBUG, "%s(%s)", __func__, hapd->conf->iface); @@ -113,7 +113,7 @@ as adding/removing interfaces. hostapd_ubus_free_bss(hapd); accounting_deinit(hapd); hostapd_deinit_wpa(hapd); -@@ -687,6 +690,7 @@ void hostapd_cleanup_iface_partial(struc +@@ -729,6 +732,7 @@ void hostapd_cleanup_iface_partial(struc static void hostapd_cleanup_iface(struct hostapd_iface *iface) { wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface); @@ -121,7 +121,7 @@ as adding/removing interfaces. eloop_cancel_timeout(hostapd_interface_setup_failure_handler, iface, NULL); -@@ -1276,6 +1280,7 @@ static int hostapd_start_beacon(struct h +@@ -1318,6 +1322,7 @@ static int hostapd_start_beacon(struct h hapd->driver->set_operstate(hapd->drv_priv, 1); hostapd_ubus_add_bss(hapd); @@ -129,7 +129,7 @@ as adding/removing interfaces. return 0; } -@@ -1298,8 +1303,7 @@ static int hostapd_start_beacon(struct h +@@ -1393,8 +1398,7 @@ static int hostapd_bss_radius_init(struc * initialized. Most of the modules that are initialized here will be * deinitialized in hostapd_cleanup(). */ @@ -139,7 +139,7 @@ as adding/removing interfaces. { struct hostapd_bss_config *conf = hapd->conf; u8 ssid[SSID_MAX_LEN + 1]; -@@ -2790,7 +2794,7 @@ hostapd_alloc_bss_data(struct hostapd_if +@@ -2926,7 +2930,7 @@ hostapd_alloc_bss_data(struct hostapd_if } @@ -148,7 +148,7 @@ as adding/removing interfaces. { if (!hapd) return; -@@ -3608,7 +3612,8 @@ int hostapd_remove_iface(struct hapd_int +@@ -3977,7 +3981,8 @@ int hostapd_remove_iface(struct hapd_int hapd_iface = interfaces->iface[i]; if (hapd_iface == NULL) return -1; @@ -168,7 +168,7 @@ as adding/removing interfaces. #define OCE_STA_CFON_ENABLED(hapd) \ ((hapd->conf->oce & OCE_STA_CFON) && \ -@@ -51,6 +52,10 @@ struct hapd_interfaces { +@@ -52,6 +53,10 @@ struct hapd_interfaces { struct hostapd_config * (*config_read_cb)(const char *config_fname); int (*ctrl_iface_init)(struct hostapd_data *hapd); void (*ctrl_iface_deinit)(struct hostapd_data *hapd); @@ -179,7 +179,7 @@ as adding/removing interfaces. int (*for_each_interface)(struct hapd_interfaces *interfaces, int (*cb)(struct hostapd_iface *iface, void *ctx), void *ctx); -@@ -186,6 +191,7 @@ struct hostapd_data { +@@ -206,6 +211,7 @@ struct hostapd_data { struct hostapd_config *iconf; struct hostapd_bss_config *conf; struct hostapd_ubus_bss ubus; @@ -187,7 +187,7 @@ as adding/removing interfaces. int interface_added; /* virtual interface added for this BSS */ unsigned int started:1; unsigned int disabled:1; -@@ -518,6 +524,7 @@ struct hostapd_sta_info { +@@ -567,6 +573,7 @@ struct hostapd_mld { */ struct hostapd_iface { struct hapd_interfaces *interfaces; @@ -195,7 +195,7 @@ as adding/removing interfaces. void *owner; char *config_fname; struct hostapd_config *conf; -@@ -718,6 +725,8 @@ struct hostapd_iface * hostapd_init(stru +@@ -777,6 +784,8 @@ struct hostapd_iface * hostapd_init(stru struct hostapd_iface * hostapd_interface_init_bss(struct hapd_interfaces *interfaces, const char *phy, const char *config_fname, int debug); @@ -206,7 +206,7 @@ as adding/removing interfaces. void hostapd_interface_deinit_free(struct hostapd_iface *iface); --- a/src/drivers/driver.h +++ b/src/drivers/driver.h -@@ -3856,6 +3856,25 @@ struct wpa_driver_ops { +@@ -3922,6 +3922,25 @@ struct wpa_driver_ops { const char *ifname); /** @@ -232,7 +232,7 @@ as adding/removing interfaces. * set_sta_vlan - Bind a station into a specific interface (AP only) * @priv: Private driver interface data * @ifname: Interface (main or virtual BSS or VLAN) -@@ -6510,6 +6529,7 @@ union wpa_event_data { +@@ -6643,6 +6662,7 @@ union wpa_event_data { /** * struct ch_switch @@ -240,7 +240,7 @@ as adding/removing interfaces. * @freq: Frequency of new channel in MHz * @ht_enabled: Whether this is an HT channel * @ch_offset: Secondary channel offset -@@ -6520,6 +6540,7 @@ union wpa_event_data { +@@ -6653,6 +6673,7 @@ union wpa_event_data { * @punct_bitmap: Puncturing bitmap */ struct ch_switch { @@ -338,7 +338,7 @@ as adding/removing interfaces. nl_cb_set(bss->nl_cb, NL_CB_SEQ_CHECK, NL_CB_CUSTOM, no_seq_check, NULL); nl_cb_set(bss->nl_cb, NL_CB_VALID, NL_CB_CUSTOM, -@@ -8554,6 +8575,7 @@ static void *i802_init(struct hostapd_da +@@ -8702,6 +8723,7 @@ static void *i802_init(struct hostapd_da char master_ifname[IFNAMSIZ]; int ifindex, br_ifindex = 0; int br_added = 0; @@ -346,7 +346,7 @@ as adding/removing interfaces. bss = wpa_driver_nl80211_drv_init(hapd, params->ifname, params->global_priv, 1, -@@ -8613,21 +8635,17 @@ static void *i802_init(struct hostapd_da +@@ -8761,21 +8783,17 @@ static void *i802_init(struct hostapd_da (params->num_bridge == 0 || !params->bridge[0])) add_ifidx(drv, br_ifindex, drv->ifindex); @@ -378,7 +378,7 @@ as adding/removing interfaces. } if (drv->capa.flags2 & WPA_DRIVER_FLAGS2_CONTROL_PORT_RX) { -@@ -8992,6 +9010,50 @@ static int wpa_driver_nl80211_if_remove( +@@ -9144,6 +9162,50 @@ static int wpa_driver_nl80211_if_remove( return 0; } @@ -429,8 +429,8 @@ as adding/removing interfaces. static int cookie_handler(struct nl_msg *msg, void *arg) { -@@ -10688,6 +10750,37 @@ static int driver_nl80211_if_remove(void - } +@@ -10960,6 +11022,37 @@ static bool nl80211_is_drv_shared(void * + #endif /* CONFIG_IEEE80211BE */ +static int driver_nl80211_if_rename(void *priv, enum wpa_driver_if_type type, @@ -467,7 +467,7 @@ as adding/removing interfaces. static int driver_nl80211_send_mlme(void *priv, const u8 *data, size_t data_len, int noack, unsigned int freq, -@@ -13881,6 +13974,8 @@ const struct wpa_driver_ops wpa_driver_n +@@ -14210,6 +14303,8 @@ const struct wpa_driver_ops wpa_driver_n .set_acl = wpa_driver_nl80211_set_acl, .if_add = wpa_driver_nl80211_if_add, .if_remove = driver_nl80211_if_remove, @@ -478,7 +478,7 @@ as adding/removing interfaces. .sta_add = wpa_driver_nl80211_sta_add, --- a/src/drivers/driver_nl80211_event.c +++ b/src/drivers/driver_nl80211_event.c -@@ -1196,6 +1196,7 @@ static void mlme_event_ch_switch(struct +@@ -1197,6 +1197,7 @@ static void mlme_event_ch_switch(struct struct nlattr *bw, struct nlattr *cf1, struct nlattr *cf2, struct nlattr *punct_bitmap, @@ -486,16 +486,16 @@ as adding/removing interfaces. int finished) { struct i802_bss *bss; -@@ -1259,6 +1260,8 @@ static void mlme_event_ch_switch(struct +@@ -1260,6 +1261,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); + if (count) + data.ch_switch.count = nla_get_u32(count); - if (finished) - bss->flink->freq = data.ch_switch.freq; -@@ -3961,6 +3964,7 @@ static void do_process_drv_event(struct + if (link) { + data.ch_switch.link_id = nla_get_u8(link); +@@ -4054,6 +4057,7 @@ static void do_process_drv_event(struct tb[NL80211_ATTR_CENTER_FREQ1], tb[NL80211_ATTR_CENTER_FREQ2], tb[NL80211_ATTR_PUNCT_BITMAP], @@ -503,7 +503,7 @@ as adding/removing interfaces. 0); break; case NL80211_CMD_CH_SWITCH_NOTIFY: -@@ -3973,6 +3977,7 @@ static void do_process_drv_event(struct +@@ -4066,6 +4070,7 @@ static void do_process_drv_event(struct tb[NL80211_ATTR_CENTER_FREQ1], tb[NL80211_ATTR_CENTER_FREQ2], tb[NL80211_ATTR_PUNCT_BITMAP], @@ -562,7 +562,7 @@ as adding/removing interfaces. extern int wpa_debug_timestamp; --- a/wpa_supplicant/Makefile +++ b/wpa_supplicant/Makefile -@@ -192,8 +192,20 @@ endif +@@ -194,8 +194,20 @@ endif ifdef CONFIG_UBUS CFLAGS += -DUBUS_SUPPORT OBJS += ubus.o @@ -584,7 +584,7 @@ as adding/removing interfaces. endif ifdef CONFIG_CODE_COVERAGE -@@ -1052,6 +1064,9 @@ OBJS += ../src/ap/ctrl_iface_ap.o +@@ -1053,6 +1065,9 @@ OBJS += ../src/ap/ctrl_iface_ap.o ifdef CONFIG_UBUS OBJS += ../src/ap/ubus.o endif @@ -596,7 +596,7 @@ as adding/removing interfaces. CFLAGS += -DEAP_SERVER -DEAP_SERVER_IDENTITY --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c -@@ -5949,6 +5949,7 @@ void supplicant_event(void *ctx, enum wp +@@ -6135,6 +6135,7 @@ void supplicant_event(void *ctx, enum wp event_to_string(event), event); #endif /* CONFIG_NO_STDOUT_DEBUG */ @@ -606,7 +606,7 @@ as adding/removing interfaces. #ifdef CONFIG_FST --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -1060,6 +1060,7 @@ void wpa_supplicant_set_state(struct wpa +@@ -1151,6 +1151,7 @@ void wpa_supplicant_set_state(struct wpa sme_sched_obss_scan(wpa_s, 0); } wpa_s->wpa_state = state; @@ -614,7 +614,7 @@ as adding/removing interfaces. #ifdef CONFIG_BGSCAN if (state == WPA_COMPLETED && wpa_s->current_ssid != wpa_s->bgscan_ssid) -@@ -7717,6 +7718,7 @@ struct wpa_supplicant * wpa_supplicant_a +@@ -7921,6 +7922,7 @@ struct wpa_supplicant * wpa_supplicant_a #endif /* CONFIG_P2P */ wpas_ubus_add_bss(wpa_s); @@ -622,7 +622,7 @@ as adding/removing interfaces. return wpa_s; } -@@ -7744,6 +7746,7 @@ int wpa_supplicant_remove_iface(struct w +@@ -7948,6 +7950,7 @@ int wpa_supplicant_remove_iface(struct w struct wpa_supplicant *parent = wpa_s->parent; #endif /* CONFIG_MESH */ @@ -630,7 +630,7 @@ as adding/removing interfaces. wpas_ubus_free_bss(wpa_s); /* Remove interface from the global list of interfaces */ -@@ -8054,6 +8057,7 @@ struct wpa_global * wpa_supplicant_init( +@@ -8258,6 +8261,7 @@ struct wpa_global * wpa_supplicant_init( eloop_register_timeout(WPA_SUPPLICANT_CLEANUP_INTERVAL, 0, wpas_periodic, global, NULL); @@ -638,7 +638,7 @@ as adding/removing interfaces. return global; } -@@ -8092,12 +8096,8 @@ int wpa_supplicant_run(struct wpa_global +@@ -8296,12 +8300,8 @@ int wpa_supplicant_run(struct wpa_global eloop_register_signal_terminate(wpa_supplicant_terminate, global); eloop_register_signal_reconfig(wpa_supplicant_reconfig, global); @@ -651,7 +651,7 @@ as adding/removing interfaces. return 0; } -@@ -8130,6 +8130,8 @@ void wpa_supplicant_deinit(struct wpa_gl +@@ -8334,6 +8334,8 @@ void wpa_supplicant_deinit(struct wpa_gl wpas_notify_supplicant_deinitialized(global); diff --git a/package/network/services/hostapd/patches/701-reload_config_inline.patch b/package/network/services/hostapd/patches/701-reload_config_inline.patch index 260e832ddba7a3..54045476477fe6 100644 --- a/package/network/services/hostapd/patches/701-reload_config_inline.patch +++ b/package/network/services/hostapd/patches/701-reload_config_inline.patch @@ -8,7 +8,7 @@ as adding/removing interfaces. --- a/hostapd/config_file.c +++ b/hostapd/config_file.c -@@ -5065,7 +5065,12 @@ struct hostapd_config * hostapd_config_r +@@ -5207,7 +5207,12 @@ struct hostapd_config * hostapd_config_r int errors = 0; size_t i; diff --git a/package/network/services/hostapd/patches/710-vlan_no_bridge.patch b/package/network/services/hostapd/patches/710-vlan_no_bridge.patch index d3f797ed35abf6..d4c6b1445647e8 100644 --- a/package/network/services/hostapd/patches/710-vlan_no_bridge.patch +++ b/package/network/services/hostapd/patches/710-vlan_no_bridge.patch @@ -8,7 +8,7 @@ was provided by the config --- a/hostapd/config_file.c +++ b/hostapd/config_file.c -@@ -3559,6 +3559,8 @@ static int hostapd_config_fill(struct ho +@@ -3646,6 +3646,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); diff --git a/package/network/services/hostapd/patches/711-wds_bridge_force.patch b/package/network/services/hostapd/patches/711-wds_bridge_force.patch index dbd75658ae4a94..56750352f377c0 100644 --- a/package/network/services/hostapd/patches/711-wds_bridge_force.patch +++ b/package/network/services/hostapd/patches/711-wds_bridge_force.patch @@ -11,7 +11,7 @@ instead rely entirely on netifd handling this properly --- a/hostapd/config_file.c +++ b/hostapd/config_file.c -@@ -2447,6 +2447,8 @@ static int hostapd_config_fill(struct ho +@@ -2472,6 +2472,8 @@ static int hostapd_config_fill(struct ho sizeof(conf->bss[0]->iface)); } else if (os_strcmp(buf, "bridge") == 0) { os_strlcpy(bss->bridge, pos, sizeof(bss->bridge)); @@ -22,7 +22,7 @@ instead rely entirely on netifd handling this properly } else if (os_strcmp(buf, "vlan_bridge") == 0) { --- a/src/ap/ap_drv_ops.c +++ b/src/ap/ap_drv_ops.c -@@ -387,8 +387,6 @@ int hostapd_set_wds_sta(struct hostapd_d +@@ -390,8 +390,6 @@ int hostapd_set_wds_sta(struct hostapd_d return -1; if (hapd->conf->wds_bridge[0]) bridge = hapd->conf->wds_bridge; 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 index fb00313f3d9198..012efa4286be6f 100644 --- a/package/network/services/hostapd/patches/720-iface_max_num_sta.patch +++ b/package/network/services/hostapd/patches/720-iface_max_num_sta.patch @@ -8,7 +8,7 @@ full device, e.g. in order to deal with hardware/driver limitations --- a/hostapd/config_file.c +++ b/hostapd/config_file.c -@@ -3041,6 +3041,14 @@ static int hostapd_config_fill(struct ho +@@ -3090,6 +3090,14 @@ static int hostapd_config_fill(struct ho line, bss->max_num_sta, MAX_STA_COUNT); return 1; } @@ -25,7 +25,7 @@ full device, e.g. in order to deal with hardware/driver limitations } else if (os_strcmp(buf, "extended_key_id") == 0) { --- a/src/ap/ap_config.h +++ b/src/ap/ap_config.h -@@ -1057,6 +1057,8 @@ struct hostapd_config { +@@ -1086,6 +1086,8 @@ struct hostapd_config { unsigned int track_sta_max_num; unsigned int track_sta_max_age; @@ -36,7 +36,7 @@ full device, e.g. in order to deal with hardware/driver limitations * ' ' (ascii 32): all environments --- a/src/ap/beacon.c +++ b/src/ap/beacon.c -@@ -1567,7 +1567,7 @@ void handle_probe_req(struct hostapd_dat +@@ -1634,7 +1634,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) && @@ -79,7 +79,7 @@ full device, e.g. in order to deal with hardware/driver limitations { --- a/src/ap/hostapd.h +++ b/src/ap/hostapd.h -@@ -754,6 +754,7 @@ void hostapd_cleanup_cs_params(struct ho +@@ -815,6 +815,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); diff --git a/package/network/services/hostapd/patches/730-ft_iface.patch b/package/network/services/hostapd/patches/730-ft_iface.patch index 2f47f17d969574..648641e43a7639 100644 --- a/package/network/services/hostapd/patches/730-ft_iface.patch +++ b/package/network/services/hostapd/patches/730-ft_iface.patch @@ -8,7 +8,7 @@ a VLAN interface on top of the bridge, instead of using the bridge directly --- a/hostapd/config_file.c +++ b/hostapd/config_file.c -@@ -3200,6 +3200,8 @@ static int hostapd_config_fill(struct ho +@@ -3287,6 +3287,8 @@ static int hostapd_config_fill(struct ho wpa_printf(MSG_INFO, "Line %d: Obsolete peerkey parameter ignored", line); #ifdef CONFIG_IEEE80211R_AP @@ -29,7 +29,7 @@ a VLAN interface on top of the bridge, instead of using the bridge directly int bridge_hairpin; /* hairpin_mode on bridge members */ --- a/src/ap/wpa_auth_glue.c +++ b/src/ap/wpa_auth_glue.c -@@ -1777,8 +1777,12 @@ int hostapd_setup_wpa(struct hostapd_dat +@@ -1815,8 +1815,12 @@ int hostapd_setup_wpa(struct hostapd_dat wpa_key_mgmt_ft(hapd->conf->wpa_key_mgmt)) { const char *ft_iface; diff --git a/package/network/services/hostapd/patches/740-snoop_iface.patch b/package/network/services/hostapd/patches/740-snoop_iface.patch index f4b3ac33b10369..3aea451c62fac4 100644 --- a/package/network/services/hostapd/patches/740-snoop_iface.patch +++ b/package/network/services/hostapd/patches/740-snoop_iface.patch @@ -8,7 +8,7 @@ untagged DHCP packets --- a/hostapd/config_file.c +++ b/hostapd/config_file.c -@@ -2451,6 +2451,8 @@ static int hostapd_config_fill(struct ho +@@ -2476,6 +2476,8 @@ static int hostapd_config_fill(struct ho os_strlcpy(bss->wds_bridge, pos, sizeof(bss->wds_bridge)); } else if (os_strcmp(buf, "bridge_hairpin") == 0) { bss->bridge_hairpin = atoi(pos); @@ -29,7 +29,7 @@ untagged DHCP packets int bridge_hairpin; /* hairpin_mode on bridge members */ --- a/src/ap/ap_drv_ops.h +++ b/src/ap/ap_drv_ops.h -@@ -366,12 +366,12 @@ static inline int hostapd_drv_br_port_se +@@ -371,12 +371,12 @@ static inline int hostapd_drv_br_port_se static inline int hostapd_drv_br_set_net_param(struct hostapd_data *hapd, enum drv_br_net_param param, @@ -112,7 +112,7 @@ untagged DHCP packets hapd->x_snoop_initialized = false; --- a/src/drivers/driver.h +++ b/src/drivers/driver.h -@@ -4278,7 +4278,7 @@ struct wpa_driver_ops { +@@ -4344,7 +4344,7 @@ struct wpa_driver_ops { * Returns: 0 on success, negative (<0) on failure */ int (*br_set_net_param)(void *priv, enum drv_br_net_param param, @@ -123,7 +123,7 @@ untagged DHCP packets * get_wowlan - Get wake-on-wireless status --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -12376,7 +12376,7 @@ static const char * drv_br_net_param_str +@@ -12660,7 +12660,7 @@ static const char * drv_br_net_param_str static int wpa_driver_br_set_net_param(void *priv, enum drv_br_net_param param, @@ -132,7 +132,7 @@ untagged DHCP packets { struct i802_bss *bss = priv; char path[128]; -@@ -12402,8 +12402,11 @@ static int wpa_driver_br_set_net_param(v +@@ -12686,8 +12686,11 @@ static int wpa_driver_br_set_net_param(v return -EINVAL; } diff --git a/package/network/services/hostapd/patches/751-qos_map_ignore_when_unsupported.patch b/package/network/services/hostapd/patches/751-qos_map_ignore_when_unsupported.patch deleted file mode 100644 index 86394d78a4db5d..00000000000000 --- a/package/network/services/hostapd/patches/751-qos_map_ignore_when_unsupported.patch +++ /dev/null @@ -1,19 +0,0 @@ -From: Felix Fietkau -Date: Thu, 23 Dec 2021 19:18:33 +0100 -Subject: [PATCH] hostapd: only attempt to set qos map if supported by the - driver - -Fixes issues with brcmfmac - ---- a/src/ap/ap_drv_ops.c -+++ b/src/ap/ap_drv_ops.c -@@ -998,7 +998,8 @@ int hostapd_start_dfs_cac(struct hostapd - int hostapd_drv_set_qos_map(struct hostapd_data *hapd, - const u8 *qos_map_set, u8 qos_map_set_len) - { -- if (!hapd->driver || !hapd->driver->set_qos_map || !hapd->drv_priv) -+ if (!hapd->driver || !hapd->driver->set_qos_map || !hapd->drv_priv || -+ !(hapd->iface->drv_flags & WPA_DRIVER_FLAGS_QOS_MAPPING)) - return 0; - return hapd->driver->set_qos_map(hapd->drv_priv, qos_map_set, - qos_map_set_len); diff --git a/package/network/services/hostapd/patches/760-dynamic_own_ip.patch b/package/network/services/hostapd/patches/760-dynamic_own_ip.patch index c4b14d41b00942..5f13b861d31914 100644 --- a/package/network/services/hostapd/patches/760-dynamic_own_ip.patch +++ b/package/network/services/hostapd/patches/760-dynamic_own_ip.patch @@ -7,7 +7,7 @@ Some servers use the NAS-IP-Address attribute as a destination address --- a/hostapd/config_file.c +++ b/hostapd/config_file.c -@@ -2819,6 +2819,8 @@ static int hostapd_config_fill(struct ho +@@ -2865,6 +2865,8 @@ static int hostapd_config_fill(struct ho } else if (os_strcmp(buf, "iapp_interface") == 0) { wpa_printf(MSG_INFO, "DEPRECATED: iapp_interface not used"); #endif /* CONFIG_IAPP */ @@ -25,10 +25,10 @@ Some servers use the NAS-IP-Address attribute as a destination address + int dynamic_own_ip_addr; char *nas_identifier; struct hostapd_radius_servers *radius; - int acct_interim_interval; + int radius_require_message_authenticator; --- a/src/ap/ieee802_1x.c +++ b/src/ap/ieee802_1x.c -@@ -601,6 +601,10 @@ int add_common_radius_attr(struct hostap +@@ -600,6 +600,10 @@ int add_common_radius_attr(struct hostap struct hostapd_radius_attr *attr; int len; diff --git a/package/network/services/hostapd/patches/761-shared_das_port.patch b/package/network/services/hostapd/patches/761-shared_das_port.patch index 5ca10d23bdb664..26aeacac76abf4 100644 --- a/package/network/services/hostapd/patches/761-shared_das_port.patch +++ b/package/network/services/hostapd/patches/761-shared_das_port.patch @@ -7,14 +7,14 @@ Use the NAS identifier to find the right receiver context on incoming messages --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c -@@ -1510,6 +1510,7 @@ int hostapd_setup_bss(struct hostapd_dat +@@ -1379,6 +1379,7 @@ static int hostapd_bss_radius_init(struc - os_memset(&das_conf, 0, sizeof(das_conf)); - das_conf.port = conf->radius_das_port; -+ das_conf.nas_identifier = conf->nas_identifier; - das_conf.shared_secret = conf->radius_das_shared_secret; - das_conf.shared_secret_len = - conf->radius_das_shared_secret_len; + os_memset(&das_conf, 0, sizeof(das_conf)); + das_conf.port = conf->radius_das_port; ++ das_conf.nas_identifier = conf->nas_identifier; + das_conf.shared_secret = conf->radius_das_shared_secret; + das_conf.shared_secret_len = + conf->radius_das_shared_secret_len; --- a/src/radius/radius_das.c +++ b/src/radius/radius_das.c @@ -12,13 +12,26 @@ @@ -45,7 +45,7 @@ Use the NAS identifier to find the right receiver context on incoming messages size_t shared_secret_len; struct hostapd_ip_addr client_addr; unsigned int time_window; -@@ -378,56 +391,17 @@ fail: +@@ -388,56 +401,17 @@ fail: } @@ -108,7 +108,7 @@ Use the NAS identifier to find the right receiver context on incoming messages if (radius_msg_verify_das_req(msg, das->shared_secret, das->shared_secret_len, -@@ -494,9 +468,8 @@ static void radius_das_receive(int sock, +@@ -504,9 +478,8 @@ static void radius_das_receive(int sock, radius_msg_dump(reply); rbuf = radius_msg_get_buf(reply); @@ -120,7 +120,7 @@ Use the NAS identifier to find the right receiver context on incoming messages if (res < 0) { wpa_printf(MSG_ERROR, "DAS: sendto(to %s:%d): %s", abuf, from_port, strerror(errno)); -@@ -508,6 +481,72 @@ fail: +@@ -518,6 +491,72 @@ fail: radius_msg_free(reply); } @@ -193,7 +193,7 @@ Use the NAS identifier to find the right receiver context on incoming messages static int radius_das_open_socket(int port) { -@@ -533,6 +572,49 @@ static int radius_das_open_socket(int po +@@ -543,6 +582,49 @@ static int radius_das_open_socket(int po } @@ -243,7 +243,7 @@ Use the NAS identifier to find the right receiver context on incoming messages struct radius_das_data * radius_das_init(struct radius_das_conf *conf) { -@@ -553,6 +635,8 @@ radius_das_init(struct radius_das_conf * +@@ -563,6 +645,8 @@ radius_das_init(struct radius_das_conf * das->ctx = conf->ctx; das->disconnect = conf->disconnect; das->coa = conf->coa; @@ -252,7 +252,7 @@ Use the NAS identifier to find the right receiver context on incoming messages os_memcpy(&das->client_addr, conf->client_addr, sizeof(das->client_addr)); -@@ -565,19 +649,15 @@ radius_das_init(struct radius_das_conf * +@@ -575,19 +659,15 @@ radius_das_init(struct radius_das_conf * } das->shared_secret_len = conf->shared_secret_len; @@ -275,7 +275,7 @@ Use the NAS identifier to find the right receiver context on incoming messages return das; } -@@ -588,11 +668,14 @@ void radius_das_deinit(struct radius_das +@@ -598,11 +678,14 @@ void radius_das_deinit(struct radius_das if (das == NULL) return; diff --git a/package/network/services/hostapd/patches/762-AP-don-t-ignore-probe-requests-with-invalid-DSSS-par.patch b/package/network/services/hostapd/patches/762-AP-don-t-ignore-probe-requests-with-invalid-DSSS-par.patch index 3cb1abeb583f9e..7beb87118f8385 100644 --- a/package/network/services/hostapd/patches/762-AP-don-t-ignore-probe-requests-with-invalid-DSSS-par.patch +++ b/package/network/services/hostapd/patches/762-AP-don-t-ignore-probe-requests-with-invalid-DSSS-par.patch @@ -26,11 +26,9 @@ Signed-off-by: David Bauer src/ap/beacon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -diff --git a/src/ap/beacon.c b/src/ap/beacon.c -index 8cd1c4170..bb9329085 100644 --- a/src/ap/beacon.c +++ b/src/ap/beacon.c -@@ -905,7 +905,7 @@ void handle_probe_req(struct hostapd_data *hapd, +@@ -1477,7 +1477,7 @@ void handle_probe_req(struct hostapd_dat * is less likely to see them (Probe Request frame sent on a * neighboring, but partially overlapping, channel). */ @@ -39,6 +37,3 @@ index 8cd1c4170..bb9329085 100644 hapd->iface->current_mode && (hapd->iface->current_mode->mode == HOSTAPD_MODE_IEEE80211G || hapd->iface->current_mode->mode == HOSTAPD_MODE_IEEE80211B) && --- -2.43.0 - diff --git a/package/network/services/hostapd/patches/770-radius_server.patch b/package/network/services/hostapd/patches/770-radius_server.patch index 73b2c8643ba2c7..2068caacdcb946 100644 --- a/package/network/services/hostapd/patches/770-radius_server.patch +++ b/package/network/services/hostapd/patches/770-radius_server.patch @@ -29,7 +29,7 @@ handle reload. #ifndef CONFIG_NO_HOSTAPD_LOGGER static void hostapd_logger_cb(void *ctx, const u8 *addr, unsigned int module, -@@ -778,6 +779,11 @@ int main(int argc, char *argv[]) +@@ -792,6 +793,11 @@ int main(int argc, char *argv[]) if (os_program_init()) return -1; @@ -119,7 +119,7 @@ handle reload. sess->macacl = tmp->macacl; eap_user_free(tmp); -@@ -1118,11 +1155,10 @@ radius_server_encapsulate_eap(struct rad +@@ -1123,11 +1160,10 @@ radius_server_encapsulate_eap(struct rad } if (code == RADIUS_CODE_ACCESS_ACCEPT) { @@ -135,7 +135,7 @@ handle reload. wpa_printf(MSG_ERROR, "Could not add RADIUS attribute"); radius_msg_free(msg); return NULL; -@@ -1211,11 +1247,10 @@ radius_server_macacl(struct radius_serve +@@ -1221,11 +1257,10 @@ radius_server_macacl(struct radius_serve } if (code == RADIUS_CODE_ACCESS_ACCEPT) { @@ -151,7 +151,7 @@ handle reload. wpa_printf(MSG_ERROR, "Could not add RADIUS attribute"); radius_msg_free(msg); return NULL; -@@ -2512,7 +2547,7 @@ static int radius_server_get_eap_user(vo +@@ -2527,7 +2562,7 @@ static int radius_server_get_eap_user(vo ret = data->get_eap_user(data->conf_ctx, identity, identity_len, phase2, user); if (ret == 0 && user) { diff --git a/package/network/services/hostapd/patches/780-Implement-APuP-Access-Point-Micro-Peering.patch b/package/network/services/hostapd/patches/780-Implement-APuP-Access-Point-Micro-Peering.patch index b6e4ef9571a1c0..f2727a6feee25c 100644 --- a/package/network/services/hostapd/patches/780-Implement-APuP-Access-Point-Micro-Peering.patch +++ b/package/network/services/hostapd/patches/780-Implement-APuP-Access-Point-Micro-Peering.patch @@ -34,11 +34,9 @@ Signed-off-by: Gioacchino Mazzurco create mode 100644 src/ap/apup.c create mode 100644 src/ap/apup.h -diff --git a/hostapd/Makefile b/hostapd/Makefile -index 73048c1297..c890a7f29c 100644 --- a/hostapd/Makefile +++ b/hostapd/Makefile -@@ -1415,6 +1415,11 @@ ifdef CONFIG_NO_TKIP +@@ -1416,6 +1416,11 @@ ifdef CONFIG_NO_TKIP CFLAGS += -DCONFIG_NO_TKIP endif @@ -50,11 +48,9 @@ index 73048c1297..c890a7f29c 100644 $(DESTDIR)$(BINDIR)/%: % install -D $(<) $(@) -diff --git a/hostapd/config_file.c b/hostapd/config_file.c -index bba5b19164..ef906199ec 100644 --- a/hostapd/config_file.c +++ b/hostapd/config_file.c -@@ -5058,6 +5058,15 @@ static int hostapd_config_fill(struct hostapd_config *conf, +@@ -5200,6 +5200,15 @@ static int hostapd_config_fill(struct ho bss->mld_indicate_disabled = atoi(pos); #endif /* CONFIG_TESTING_OPTIONS */ #endif /* CONFIG_IEEE80211BE */ @@ -70,11 +66,9 @@ index bba5b19164..ef906199ec 100644 } else { wpa_printf(MSG_ERROR, "Line %d: unknown configuration item '%s'", -diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h -index 0e52a9990d..9102db5ed0 100644 --- a/src/ap/ap_config.h +++ b/src/ap/ap_config.h -@@ -970,6 +970,35 @@ struct hostapd_bss_config { +@@ -999,6 +999,35 @@ struct hostapd_bss_config { bool mld_indicate_disabled; #endif /* CONFIG_TESTING_OPTIONS */ #endif /* CONFIG_IEEE80211BE */ @@ -110,11 +104,9 @@ index 0e52a9990d..9102db5ed0 100644 }; /** -diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c -index e7396d9aea..05460e3d73 100644 --- a/src/ap/ap_drv_ops.c +++ b/src/ap/ap_drv_ops.c -@@ -382,9 +382,35 @@ int hostapd_set_wds_sta(struct hostapd_data *hapd, char *ifname_wds, +@@ -385,9 +385,35 @@ int hostapd_set_wds_sta(struct hostapd_d const u8 *addr, int aid, int val) { const char *bridge = NULL; @@ -150,11 +142,9 @@ index e7396d9aea..05460e3d73 100644 if (hapd->conf->wds_bridge[0]) bridge = hapd->conf->wds_bridge; return hapd->driver->set_wds_sta(hapd->drv_priv, addr, aid, val, -diff --git a/src/ap/ap_drv_ops.h b/src/ap/ap_drv_ops.h -index fa89d2398e..ab4dc8eb16 100644 --- a/src/ap/ap_drv_ops.h +++ b/src/ap/ap_drv_ops.h -@@ -33,6 +33,9 @@ int hostapd_set_drv_ieee8021x(struct hostapd_data *hapd, const char *ifname, +@@ -35,6 +35,9 @@ int hostapd_set_drv_ieee8021x(struct hos int enabled); int hostapd_vlan_if_add(struct hostapd_data *hapd, const char *ifname); int hostapd_vlan_if_remove(struct hostapd_data *hapd, const char *ifname); @@ -163,10 +153,7 @@ index fa89d2398e..ab4dc8eb16 100644 + */ int hostapd_set_wds_sta(struct hostapd_data *hapd, char *ifname_wds, const u8 *addr, int aid, int val); - -diff --git a/src/ap/apup.c b/src/ap/apup.c -new file mode 100644 -index 0000000000..3575f1b6c6 + int hostapd_sta_add(struct hostapd_data *hapd, --- /dev/null +++ b/src/ap/apup.c @@ -0,0 +1,152 @@ @@ -322,9 +309,6 @@ index 0000000000..3575f1b6c6 + " capabilities %d", + mIfname, sta_ret->flags, sta_ret->capability); +} -diff --git a/src/ap/apup.h b/src/ap/apup.h -new file mode 100644 -index 0000000000..a14a283bb4 --- /dev/null +++ b/src/ap/apup.h @@ -0,0 +1,24 @@ @@ -352,8 +336,6 @@ index 0000000000..a14a283bb4 +void apup_process_beacon(struct hostapd_data *hapd, + const struct ieee80211_mgmt *mgmt, size_t len, + const struct ieee802_11_elems *elems ); -diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c -index 1c4dd22da1..09254f18f2 100644 --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c @@ -59,6 +59,9 @@ @@ -366,7 +348,7 @@ index 1c4dd22da1..09254f18f2 100644 #ifdef CONFIG_FILS static struct wpabuf * -@@ -3469,8 +3472,8 @@ static u16 check_multi_ap(struct hostapd_data *hapd, struct sta_info *sta, +@@ -3586,8 +3589,8 @@ static u16 check_multi_ap(struct hostapd } @@ -377,7 +359,7 @@ index 1c4dd22da1..09254f18f2 100644 { /* Supported rates not used in IEEE 802.11ad/DMG */ if (hapd->iface->current_mode && -@@ -3855,7 +3858,7 @@ static int __check_assoc_ies(struct hostapd_data *hapd, struct sta_info *sta, +@@ -3974,7 +3977,7 @@ static int __check_assoc_ies(struct host elems->ext_capab_len); if (resp != WLAN_STATUS_SUCCESS) return resp; @@ -386,7 +368,7 @@ index 1c4dd22da1..09254f18f2 100644 if (resp != WLAN_STATUS_SUCCESS) return resp; -@@ -5927,6 +5930,11 @@ static void handle_beacon(struct hostapd_data *hapd, +@@ -6029,6 +6032,11 @@ static void handle_beacon(struct hostapd 0); ap_list_process_beacon(hapd->iface, mgmt, &elems, fi); @@ -398,11 +380,9 @@ index 1c4dd22da1..09254f18f2 100644 } -diff --git a/src/ap/ieee802_11.h b/src/ap/ieee802_11.h -index a35486d464..0861bef82e 100644 --- a/src/ap/ieee802_11.h +++ b/src/ap/ieee802_11.h -@@ -108,6 +108,8 @@ int hostapd_process_ml_assoc_req_addr(struct hostapd_data *hapd, +@@ -108,6 +108,8 @@ int hostapd_process_ml_assoc_req_addr(st const u8 *basic_mle, size_t basic_mle_len, u8 *mld_addr); int hostapd_get_aid(struct hostapd_data *hapd, struct sta_info *sta); @@ -411,11 +391,9 @@ index a35486d464..0861bef82e 100644 u16 copy_sta_ht_capab(struct hostapd_data *hapd, struct sta_info *sta, const u8 *ht_capab); u16 copy_sta_vendor_vht(struct hostapd_data *hapd, struct sta_info *sta, -diff --git a/src/drivers/driver.h b/src/drivers/driver.h -index 1bbb9672cd..8d26561e97 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h -@@ -3976,7 +3976,7 @@ struct wpa_driver_ops { +@@ -4042,7 +4042,7 @@ struct wpa_driver_ops { * Returns: 0 on success, -1 on failure */ int (*set_wds_sta)(void *priv, const u8 *addr, int aid, int val, @@ -424,11 +402,9 @@ index 1bbb9672cd..8d26561e97 100644 /** * send_action - Transmit an Action frame -diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c -index aeb1e6beef..b6e4ddd86d 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -8415,24 +8415,14 @@ static int have_ifidx(struct wpa_driver_nl80211_data *drv, int ifidx, +@@ -8557,25 +8557,15 @@ static int have_ifidx(struct wpa_driver_ static int i802_set_wds_sta(void *priv, const u8 *addr, int aid, int val, @@ -440,6 +416,7 @@ index aeb1e6beef..b6e4ddd86d 100644 - char name[IFNAMSIZ + 1]; + const char *name = ifname_wds; // Kept to reduce changes to the minimum union wpa_event_data event; + bool add_br = false; int ret; - ret = os_snprintf(name, sizeof(name), "%s.sta%d", bss->ifname, aid); @@ -455,6 +432,3 @@ index aeb1e6beef..b6e4ddd86d 100644 wpa_printf(MSG_DEBUG, "nl80211: Set WDS STA addr=" MACSTR " aid=%d val=%d name=%s", MAC2STR(addr), aid, val, name); if (val) { --- -2.44.2 - diff --git a/package/network/services/hostapd/patches/790-APuP-add-ubus-notification-when-a-peer-comes-up.patch b/package/network/services/hostapd/patches/790-APuP-add-ubus-notification-when-a-peer-comes-up.patch index 3746dde00a7f69..b0e2c57b1387c3 100644 --- a/package/network/services/hostapd/patches/790-APuP-add-ubus-notification-when-a-peer-comes-up.patch +++ b/package/network/services/hostapd/patches/790-APuP-add-ubus-notification-when-a-peer-comes-up.patch @@ -13,8 +13,6 @@ Signed-off-by: Gioacchino Mazzurco src/ap/ubus.h | 5 +++++ 3 files changed, 28 insertions(+) -diff --git a/src/ap/apup.c b/src/ap/apup.c -index 3575f1b6c6..3a3991f4d6 100644 --- a/src/ap/apup.c +++ b/src/ap/apup.c @@ -23,6 +23,10 @@ @@ -28,7 +26,7 @@ index 3575f1b6c6..3a3991f4d6 100644 void apup_process_beacon(struct hostapd_data *hapd, const struct ieee80211_mgmt *mgmt, size_t len, const struct ieee802_11_elems *elems ) -@@ -149,4 +153,8 @@ void apup_process_beacon(struct hostapd_data *hapd, +@@ -149,4 +153,8 @@ void apup_process_beacon(struct hostapd_ "apup_process_beacon(...) Added APuP peer at %s with flags: %d," " capabilities %d", mIfname, sta_ret->flags, sta_ret->capability); @@ -37,11 +35,9 @@ index 3575f1b6c6..3a3991f4d6 100644 + hostapd_ubus_notify_apup_newpeer(hapd, mgmt->bssid, mIfname); +#endif } -diff --git a/src/ap/ubus.c b/src/ap/ubus.c -index 8689494bcf..f21516fc3c 100644 --- a/src/ap/ubus.c +++ b/src/ap/ubus.c -@@ -2004,3 +2004,18 @@ int hostapd_ubus_notify_bss_transition_query( +@@ -2004,3 +2004,18 @@ int hostapd_ubus_notify_bss_transition_q return ureq.resp; #endif } @@ -60,11 +56,9 @@ index 8689494bcf..f21516fc3c 100644 + ubus_notify(ctx, &hapd->ubus.obj, "apup-newpeer", b.head, -1); +} +#endif // def CONFIG_APUP -diff --git a/src/ap/ubus.h b/src/ap/ubus.h -index 22767d67ee..1c65e4dcb9 100644 --- a/src/ap/ubus.h +++ b/src/ap/ubus.h -@@ -71,6 +71,11 @@ int hostapd_ubus_notify_bss_transition_query( +@@ -71,6 +71,11 @@ int hostapd_ubus_notify_bss_transition_q void hostapd_ubus_notify_authorized(struct hostapd_data *hapd, struct sta_info *sta, const char *auth_alg); @@ -76,6 +70,3 @@ index 22767d67ee..1c65e4dcb9 100644 #else struct hostapd_ubus_bss {}; --- -2.44.2 - diff --git a/package/network/services/hostapd/patches/800-APuP-add-ucode-hook-for-when-a-peer-comes-up.patch b/package/network/services/hostapd/patches/800-APuP-add-ucode-hook-for-when-a-peer-comes-up.patch index c3e3633060cbae..d5c76994b4f6cc 100644 --- a/package/network/services/hostapd/patches/800-APuP-add-ucode-hook-for-when-a-peer-comes-up.patch +++ b/package/network/services/hostapd/patches/800-APuP-add-ucode-hook-for-when-a-peer-comes-up.patch @@ -10,8 +10,6 @@ Signed-off-by: Gioacchino Mazzurco src/ap/ucode.h | 4 ++++ 3 files changed, 29 insertions(+) -diff --git a/src/ap/apup.c b/src/ap/apup.c -index 3a3991f4d6..f736ddc8e3 100644 --- a/src/ap/apup.c +++ b/src/ap/apup.c @@ -27,6 +27,10 @@ @@ -25,7 +23,7 @@ index 3a3991f4d6..f736ddc8e3 100644 void apup_process_beacon(struct hostapd_data *hapd, const struct ieee80211_mgmt *mgmt, size_t len, const struct ieee802_11_elems *elems ) -@@ -157,4 +161,8 @@ void apup_process_beacon(struct hostapd_data *hapd, +@@ -157,4 +161,8 @@ void apup_process_beacon(struct hostapd_ #ifdef UBUS_SUPPORT hostapd_ubus_notify_apup_newpeer(hapd, mgmt->bssid, mIfname); #endif @@ -34,11 +32,9 @@ index 3a3991f4d6..f736ddc8e3 100644 + hostapd_ucode_apup_newpeer(hapd, mIfname); +#endif } -diff --git a/src/ap/ucode.c b/src/ap/ucode.c -index d344190208..391002feae 100644 --- a/src/ap/ucode.c +++ b/src/ap/ucode.c -@@ -811,3 +811,20 @@ void hostapd_ucode_free_bss(struct hostapd_data *hapd) +@@ -815,3 +815,20 @@ void hostapd_ucode_free_bss(struct hosta ucv_put(wpa_ucode_call(2)); ucv_gc(vm); } @@ -59,11 +55,9 @@ index d344190208..391002feae 100644 + ucv_gc(vm); +} +#endif // def CONFIG_APUP -diff --git a/src/ap/ucode.h b/src/ap/ucode.h -index d00b787169..c9bdde6516 100644 --- a/src/ap/ucode.h +++ b/src/ap/ucode.h -@@ -27,6 +27,10 @@ void hostapd_ucode_add_bss(struct hostapd_data *hapd); +@@ -27,6 +27,10 @@ void hostapd_ucode_add_bss(struct hostap void hostapd_ucode_free_bss(struct hostapd_data *hapd); void hostapd_ucode_reload_bss(struct hostapd_data *hapd); @@ -74,6 +68,3 @@ index d00b787169..c9bdde6516 100644 #else static inline int hostapd_ucode_init(struct hapd_interfaces *ifaces) --- -2.44.2 - diff --git a/package/network/services/hostapd/patches/800-SAE-Check-for-invalid-Rejected-Groups-element-length.patch b/package/network/services/hostapd/patches/800-SAE-Check-for-invalid-Rejected-Groups-element-length.patch deleted file mode 100644 index 97402887bfe618..00000000000000 --- a/package/network/services/hostapd/patches/800-SAE-Check-for-invalid-Rejected-Groups-element-length.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 364c2da8741f0979dae497551e70b94c0e6c8636 Mon Sep 17 00:00:00 2001 -From: Jouni Malinen -Date: Sun, 7 Jul 2024 11:46:49 +0300 -Subject: [PATCH] SAE: Check for invalid Rejected Groups element length - explicitly - -Instead of practically ignoring an odd octet at the end of the element, -check for such invalid case explicitly. This is needed to avoid a -potential group downgrade attack. - -Signed-off-by: Jouni Malinen ---- - src/ap/ieee802_11.c | 12 ++++++++++-- - 1 file changed, 10 insertions(+), 2 deletions(-) - ---- a/src/ap/ieee802_11.c -+++ b/src/ap/ieee802_11.c -@@ -1229,7 +1229,7 @@ static int check_sae_rejected_groups(str - struct sae_data *sae) - { - const struct wpabuf *groups; -- size_t i, count; -+ size_t i, count, len; - const u8 *pos; - - if (!sae->tmp) -@@ -1239,7 +1239,15 @@ static int check_sae_rejected_groups(str - return 0; - - pos = wpabuf_head(groups); -- count = wpabuf_len(groups) / 2; -+ len = wpabuf_len(groups); -+ if (len & 1) { -+ wpa_printf(MSG_DEBUG, -+ "SAE: Invalid length of the Rejected Groups element payload: %zu", -+ len); -+ return 1; -+ } -+ -+ count = len / 2; - for (i = 0; i < count; i++) { - int enabled; - u16 group; diff --git a/package/network/services/hostapd/patches/801-SAE-Check-for-invalid-Rejected-Groups-element-length.patch b/package/network/services/hostapd/patches/801-SAE-Check-for-invalid-Rejected-Groups-element-length.patch deleted file mode 100644 index 8d88a4aa13ac16..00000000000000 --- a/package/network/services/hostapd/patches/801-SAE-Check-for-invalid-Rejected-Groups-element-length.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 593a7c2f8c93edd6b552f2d42e28164464b4e6ff Mon Sep 17 00:00:00 2001 -From: Jouni Malinen -Date: Tue, 9 Jul 2024 23:33:38 +0300 -Subject: [PATCH] SAE: Check for invalid Rejected Groups element length - explicitly on STA - -Instead of practically ignoring an odd octet at the end of the element, -check for such invalid case explicitly. This is needed to avoid a -potential group downgrade attack. - -Fixes: 444d76f74f65 ("SAE: Check that peer's rejected groups are not enabled") -Signed-off-by: Jouni Malinen ---- - wpa_supplicant/sme.c | 11 +++++++++-- - 1 file changed, 9 insertions(+), 2 deletions(-) - ---- a/wpa_supplicant/sme.c -+++ b/wpa_supplicant/sme.c -@@ -1561,14 +1561,21 @@ static int sme_sae_is_group_enabled(stru - static int sme_check_sae_rejected_groups(struct wpa_supplicant *wpa_s, - const struct wpabuf *groups) - { -- size_t i, count; -+ size_t i, count, len; - const u8 *pos; - - if (!groups) - return 0; - - pos = wpabuf_head(groups); -- count = wpabuf_len(groups) / 2; -+ len = wpabuf_len(groups); -+ if (len & 1) { -+ wpa_printf(MSG_DEBUG, -+ "SAE: Invalid length of the Rejected Groups element payload: %zu", -+ len); -+ return 1; -+ } -+ count = len / 2; - for (i = 0; i < count; i++) { - int enabled; - u16 group; diff --git a/package/network/services/hostapd/patches/802-SAE-Reject-invalid-Rejected-Groups-element-in-the-pa.patch b/package/network/services/hostapd/patches/802-SAE-Reject-invalid-Rejected-Groups-element-in-the-pa.patch index 572a3f721f3fda..268f288827cf1b 100644 --- a/package/network/services/hostapd/patches/802-SAE-Reject-invalid-Rejected-Groups-element-in-the-pa.patch +++ b/package/network/services/hostapd/patches/802-SAE-Reject-invalid-Rejected-Groups-element-in-the-pa.patch @@ -15,7 +15,7 @@ Signed-off-by: Jouni Malinen --- a/src/common/sae.c +++ b/src/common/sae.c -@@ -2120,6 +2120,12 @@ static int sae_parse_rejected_groups(str +@@ -2160,6 +2160,12 @@ static int sae_parse_akm_suite_selector( return WLAN_STATUS_UNSPECIFIED_FAILURE; epos++; /* skip ext ID */ len--; @@ -26,5 +26,5 @@ Signed-off-by: Jouni Malinen + return WLAN_STATUS_UNSPECIFIED_FAILURE; + } - wpabuf_free(sae->tmp->peer_rejected_groups); - sae->tmp->peer_rejected_groups = wpabuf_alloc(len); + if (len < RSN_SELECTOR_LEN) + return WLAN_STATUS_UNSPECIFIED_FAILURE; diff --git a/package/network/services/hostapd/src/src/utils/ap/ubus.c b/package/network/services/hostapd/src/src/utils/ap/ubus.c new file mode 100644 index 00000000000000..8689494bcff3e5 --- /dev/null +++ b/package/network/services/hostapd/src/src/utils/ap/ubus.c @@ -0,0 +1,2006 @@ +/* + * hostapd / ubus support + * Copyright (c) 2013, Felix Fietkau + * + * This software may be distributed under the terms of the BSD license. + * See README for more details. + */ + +#include "utils/includes.h" +#include "utils/common.h" +#include "utils/eloop.h" +#include "utils/wpabuf.h" +#include "common/ieee802_11_defs.h" +#include "common/hw_features_common.h" +#include "hostapd.h" +#include "neighbor_db.h" +#include "wps_hostapd.h" +#include "sta_info.h" +#include "ubus.h" +#include "ap_drv_ops.h" +#include "beacon.h" +#include "rrm.h" +#include "wnm_ap.h" +#include "taxonomy.h" +#include "airtime_policy.h" +#include "hw_features.h" + +static struct ubus_context *ctx; +static struct blob_buf b; +static int ctx_ref; + +static inline struct hostapd_data *get_hapd_from_object(struct ubus_object *obj) +{ + return container_of(obj, struct hostapd_data, ubus.obj); +} + +struct ubus_banned_client { + struct avl_node avl; + u8 addr[ETH_ALEN]; +}; + +static void ubus_reconnect_timeout(void *eloop_data, void *user_ctx) +{ + if (ubus_reconnect(ctx, NULL)) { + eloop_register_timeout(1, 0, ubus_reconnect_timeout, ctx, NULL); + return; + } + + ubus_add_uloop(ctx); +} + +static void hostapd_ubus_connection_lost(struct ubus_context *ctx) +{ + uloop_fd_delete(&ctx->sock); + eloop_register_timeout(1, 0, ubus_reconnect_timeout, ctx, NULL); +} + +static bool hostapd_ubus_init(void) +{ + if (ctx) + return true; + + eloop_add_uloop(); + ctx = ubus_connect(NULL); + if (!ctx) + return false; + + ctx->connection_lost = hostapd_ubus_connection_lost; + ubus_add_uloop(ctx); + + return true; +} + +static void hostapd_ubus_ref_inc(void) +{ + ctx_ref++; +} + +static void hostapd_ubus_ref_dec(void) +{ + ctx_ref--; + if (!ctx) + return; + + if (ctx_ref) + return; + + uloop_fd_delete(&ctx->sock); + ubus_free(ctx); + ctx = NULL; +} + +void hostapd_ubus_add_iface(struct hostapd_iface *iface) +{ + if (!hostapd_ubus_init()) + return; +} + +void hostapd_ubus_free_iface(struct hostapd_iface *iface) +{ + if (!ctx) + return; +} + +static void hostapd_notify_ubus(struct ubus_object *obj, char *bssname, char *event) +{ + char *event_type; + + if (!ctx || !obj) + return; + + if (asprintf(&event_type, "bss.%s", event) < 0) + return; + + blob_buf_init(&b, 0); + blobmsg_add_string(&b, "name", bssname); + ubus_notify(ctx, obj, event_type, b.head, -1); + free(event_type); +} + +static void +hostapd_bss_del_ban(void *eloop_data, void *user_ctx) +{ + struct ubus_banned_client *ban = eloop_data; + struct hostapd_data *hapd = user_ctx; + + avl_delete(&hapd->ubus.banned, &ban->avl); + free(ban); +} + +static void +hostapd_bss_ban_client(struct hostapd_data *hapd, u8 *addr, int time) +{ + struct ubus_banned_client *ban; + + if (time < 0) + time = 0; + + ban = avl_find_element(&hapd->ubus.banned, addr, ban, avl); + if (!ban) { + if (!time) + return; + + ban = os_zalloc(sizeof(*ban)); + memcpy(ban->addr, addr, sizeof(ban->addr)); + ban->avl.key = ban->addr; + avl_insert(&hapd->ubus.banned, &ban->avl); + } else { + eloop_cancel_timeout(hostapd_bss_del_ban, ban, hapd); + if (!time) { + hostapd_bss_del_ban(ban, hapd); + return; + } + } + + eloop_register_timeout(0, time * 1000, hostapd_bss_del_ban, ban, hapd); +} + +static int +hostapd_bss_reload(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); + + return hostapd_reload_config(hapd->iface); +} + + +static void +hostapd_parse_vht_map_blobmsg(uint16_t map) +{ + char label[4]; + int16_t val; + int i; + + for (i = 0; i < 8; i++) { + snprintf(label, 4, "%dss", i + 1); + + val = (map & (BIT(1) | BIT(0))) + 7; + blobmsg_add_u16(&b, label, val == 10 ? -1 : val); + map = map >> 2; + } +} + +static void +hostapd_parse_vht_capab_blobmsg(struct ieee80211_vht_capabilities *vhtc) +{ + void *supported_mcs; + void *map; + int i; + + static const struct { + const char *name; + uint32_t flag; + } vht_capas[] = { + { "su_beamformee", VHT_CAP_SU_BEAMFORMEE_CAPABLE }, + { "mu_beamformee", VHT_CAP_MU_BEAMFORMEE_CAPABLE }, + }; + + for (i = 0; i < ARRAY_SIZE(vht_capas); i++) + blobmsg_add_u8(&b, vht_capas[i].name, + !!(vhtc->vht_capabilities_info & vht_capas[i].flag)); + + supported_mcs = blobmsg_open_table(&b, "mcs_map"); + + /* RX map */ + map = blobmsg_open_table(&b, "rx"); + hostapd_parse_vht_map_blobmsg(le_to_host16(vhtc->vht_supported_mcs_set.rx_map)); + blobmsg_close_table(&b, map); + + /* TX map */ + map = blobmsg_open_table(&b, "tx"); + hostapd_parse_vht_map_blobmsg(le_to_host16(vhtc->vht_supported_mcs_set.tx_map)); + blobmsg_close_table(&b, map); + + blobmsg_close_table(&b, supported_mcs); +} + +static void +hostapd_parse_capab_blobmsg(struct sta_info *sta) +{ + void *r, *v; + + v = blobmsg_open_table(&b, "capabilities"); + + if (sta->vht_capabilities) { + r = blobmsg_open_table(&b, "vht"); + hostapd_parse_vht_capab_blobmsg(sta->vht_capabilities); + blobmsg_close_table(&b, r); + } + + /* ToDo: Add HT / HE capability parsing */ + + blobmsg_close_table(&b, v); +} + +static int +hostapd_bss_get_clients(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 hostap_sta_driver_data sta_driver_data; + struct sta_info *sta; + void *list, *c; + char mac_buf[20]; + static const struct { + const char *name; + uint32_t flag; + } sta_flags[] = { + { "auth", WLAN_STA_AUTH }, + { "assoc", WLAN_STA_ASSOC }, + { "authorized", WLAN_STA_AUTHORIZED }, + { "preauth", WLAN_STA_PREAUTH }, + { "wds", WLAN_STA_WDS }, + { "wmm", WLAN_STA_WMM }, + { "ht", WLAN_STA_HT }, + { "vht", WLAN_STA_VHT }, + { "he", WLAN_STA_HE }, + { "wps", WLAN_STA_WPS }, + { "mfp", WLAN_STA_MFP }, + }; + + blob_buf_init(&b, 0); + blobmsg_add_u32(&b, "freq", hapd->iface->freq); + list = blobmsg_open_table(&b, "clients"); + for (sta = hapd->sta_list; sta; sta = sta->next) { + void *r; + int i; + + sprintf(mac_buf, MACSTR, MAC2STR(sta->addr)); + c = blobmsg_open_table(&b, mac_buf); + for (i = 0; i < ARRAY_SIZE(sta_flags); i++) + blobmsg_add_u8(&b, sta_flags[i].name, + !!(sta->flags & sta_flags[i].flag)); + +#ifdef CONFIG_MBO + blobmsg_add_u8(&b, "mbo", !!(sta->cell_capa)); +#endif + + r = blobmsg_open_array(&b, "rrm"); + for (i = 0; i < ARRAY_SIZE(sta->rrm_enabled_capa); i++) + blobmsg_add_u32(&b, "", sta->rrm_enabled_capa[i]); + blobmsg_close_array(&b, r); + + r = blobmsg_open_array(&b, "extended_capabilities"); + /* Check if client advertises extended capabilities */ + if (sta->ext_capability && sta->ext_capability[0] > 0) { + for (i = 0; i < sta->ext_capability[0]; i++) { + blobmsg_add_u32(&b, "", sta->ext_capability[1 + i]); + } + } + blobmsg_close_array(&b, r); + + blobmsg_add_u32(&b, "aid", sta->aid); +#ifdef CONFIG_TAXONOMY + r = blobmsg_alloc_string_buffer(&b, "signature", 1024); + if (retrieve_sta_taxonomy(hapd, sta, r, 1024) > 0) + blobmsg_add_string_buffer(&b); +#endif + + /* Driver information */ + if (hostapd_drv_read_sta_data(hapd, &sta_driver_data, sta->addr) >= 0) { + r = blobmsg_open_table(&b, "bytes"); + blobmsg_add_u64(&b, "rx", sta_driver_data.rx_bytes); + blobmsg_add_u64(&b, "tx", sta_driver_data.tx_bytes); + blobmsg_close_table(&b, r); + r = blobmsg_open_table(&b, "airtime"); + blobmsg_add_u64(&b, "rx", sta_driver_data.rx_airtime); + blobmsg_add_u64(&b, "tx", sta_driver_data.tx_airtime); + blobmsg_close_table(&b, r); + r = blobmsg_open_table(&b, "packets"); + blobmsg_add_u32(&b, "rx", sta_driver_data.rx_packets); + blobmsg_add_u32(&b, "tx", sta_driver_data.tx_packets); + blobmsg_close_table(&b, r); + r = blobmsg_open_table(&b, "rate"); + /* Rate in kbits */ + blobmsg_add_u32(&b, "rx", sta_driver_data.current_rx_rate * 100); + blobmsg_add_u32(&b, "tx", sta_driver_data.current_tx_rate * 100); + blobmsg_close_table(&b, r); + blobmsg_add_u32(&b, "signal", sta_driver_data.signal); + } + + hostapd_parse_capab_blobmsg(sta); + + blobmsg_close_table(&b, c); + } + blobmsg_close_array(&b, list); + ubus_send_reply(ctx, req, b.head); + + return 0; +} + +static int +hostapd_bss_get_features(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); + + blob_buf_init(&b, 0); + blobmsg_add_u8(&b, "ht_supported", ht_supported(hapd->iface->hw_features)); + blobmsg_add_u8(&b, "vht_supported", vht_supported(hapd->iface->hw_features)); + ubus_send_reply(ctx, req, b.head); + + return 0; +} + +static int +hostapd_bss_get_status(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 *airtime_table, *dfs_table, *rrm_table, *wnm_table; + struct os_reltime now; + char ssid[SSID_MAX_LEN + 1]; + char phy_name[17]; + size_t ssid_len = SSID_MAX_LEN; + u8 channel = 0, op_class = 0; + + if (hapd->conf->ssid.ssid_len < SSID_MAX_LEN) + ssid_len = hapd->conf->ssid.ssid_len; + + ieee80211_freq_to_channel_ext(hapd->iface->freq, + hapd->iconf->secondary_channel, + hostapd_get_oper_chwidth(hapd->iconf), + &op_class, &channel); + + blob_buf_init(&b, 0); + blobmsg_add_string(&b, "status", hostapd_state_text(hapd->iface->state)); + blobmsg_printf(&b, "bssid", MACSTR, MAC2STR(hapd->conf->bssid)); + + memset(ssid, 0, SSID_MAX_LEN + 1); + memcpy(ssid, hapd->conf->ssid.ssid, ssid_len); + blobmsg_add_string(&b, "ssid", ssid); + + blobmsg_add_u32(&b, "freq", hapd->iface->freq); + blobmsg_add_u32(&b, "channel", channel); + blobmsg_add_u32(&b, "op_class", op_class); + blobmsg_add_u32(&b, "beacon_interval", hapd->iconf->beacon_int); +#ifdef CONFIG_IEEE80211AX + blobmsg_add_u32(&b, "bss_color", hapd->iface->conf->he_op.he_bss_color_disabled ? -1 : + hapd->iface->conf->he_op.he_bss_color); +#else + blobmsg_add_u32(&b, "bss_color", -1); +#endif + + snprintf(phy_name, 17, "%s", hapd->iface->phy); + blobmsg_add_string(&b, "phy", phy_name); + + /* RRM */ + rrm_table = blobmsg_open_table(&b, "rrm"); + blobmsg_add_u64(&b, "neighbor_report_tx", hapd->openwrt_stats.rrm.neighbor_report_tx); + blobmsg_close_table(&b, rrm_table); + + /* WNM */ + wnm_table = blobmsg_open_table(&b, "wnm"); + blobmsg_add_u64(&b, "bss_transition_query_rx", hapd->openwrt_stats.wnm.bss_transition_query_rx); + blobmsg_add_u64(&b, "bss_transition_request_tx", hapd->openwrt_stats.wnm.bss_transition_request_tx); + blobmsg_add_u64(&b, "bss_transition_response_rx", hapd->openwrt_stats.wnm.bss_transition_response_rx); + blobmsg_close_table(&b, wnm_table); + + /* Airtime */ + airtime_table = blobmsg_open_table(&b, "airtime"); + blobmsg_add_u64(&b, "time", hapd->iface->last_channel_time); + blobmsg_add_u64(&b, "time_busy", hapd->iface->last_channel_time_busy); + blobmsg_add_u16(&b, "utilization", hapd->iface->channel_utilization); + blobmsg_close_table(&b, airtime_table); + + /* DFS */ + dfs_table = blobmsg_open_table(&b, "dfs"); + blobmsg_add_u32(&b, "cac_seconds", hapd->iface->dfs_cac_ms / 1000); + blobmsg_add_u8(&b, "cac_active", !!(hapd->iface->cac_started)); + os_reltime_age(&hapd->iface->dfs_cac_start, &now); + blobmsg_add_u32(&b, "cac_seconds_left", + hapd->iface->cac_started ? hapd->iface->dfs_cac_ms / 1000 - now.sec : 0); + blobmsg_close_table(&b, dfs_table); + + ubus_send_reply(ctx, req, b.head); + + return 0; +} + +enum { + NOTIFY_RESPONSE, + __NOTIFY_MAX +}; + +static const struct blobmsg_policy notify_policy[__NOTIFY_MAX] = { + [NOTIFY_RESPONSE] = { "notify_response", BLOBMSG_TYPE_INT32 }, +}; + +static int +hostapd_notify_response(struct ubus_context *ctx, struct ubus_object *obj, + struct ubus_request_data *req, const char *method, + struct blob_attr *msg) +{ + struct blob_attr *tb[__NOTIFY_MAX]; + struct hostapd_data *hapd = get_hapd_from_object(obj); + struct wpabuf *elems; + const char *pos; + size_t len; + + blobmsg_parse(notify_policy, __NOTIFY_MAX, tb, + blob_data(msg), blob_len(msg)); + + if (!tb[NOTIFY_RESPONSE]) + return UBUS_STATUS_INVALID_ARGUMENT; + + hapd->ubus.notify_response = blobmsg_get_u32(tb[NOTIFY_RESPONSE]); + + return UBUS_STATUS_OK; +} + +enum { + DEL_CLIENT_ADDR, + DEL_CLIENT_REASON, + DEL_CLIENT_DEAUTH, + DEL_CLIENT_BAN_TIME, + __DEL_CLIENT_MAX +}; + +static const struct blobmsg_policy del_policy[__DEL_CLIENT_MAX] = { + [DEL_CLIENT_ADDR] = { "addr", BLOBMSG_TYPE_STRING }, + [DEL_CLIENT_REASON] = { "reason", BLOBMSG_TYPE_INT32 }, + [DEL_CLIENT_DEAUTH] = { "deauth", BLOBMSG_TYPE_INT8 }, + [DEL_CLIENT_BAN_TIME] = { "ban_time", BLOBMSG_TYPE_INT32 }, +}; + +static int +hostapd_bss_del_client(struct ubus_context *ctx, struct ubus_object *obj, + struct ubus_request_data *req, const char *method, + struct blob_attr *msg) +{ + struct blob_attr *tb[__DEL_CLIENT_MAX]; + struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj); + struct sta_info *sta; + bool deauth = false; + int reason; + u8 addr[ETH_ALEN]; + + blobmsg_parse(del_policy, __DEL_CLIENT_MAX, tb, blob_data(msg), blob_len(msg)); + + if (!tb[DEL_CLIENT_ADDR]) + return UBUS_STATUS_INVALID_ARGUMENT; + + if (hwaddr_aton(blobmsg_data(tb[DEL_CLIENT_ADDR]), addr)) + return UBUS_STATUS_INVALID_ARGUMENT; + + if (tb[DEL_CLIENT_REASON]) + reason = blobmsg_get_u32(tb[DEL_CLIENT_REASON]); + + if (tb[DEL_CLIENT_DEAUTH]) + deauth = blobmsg_get_bool(tb[DEL_CLIENT_DEAUTH]); + + sta = ap_get_sta(hapd, addr); + if (sta) { + if (deauth) { + hostapd_drv_sta_deauth(hapd, addr, reason); + ap_sta_deauthenticate(hapd, sta, reason); + } else { + hostapd_drv_sta_disassoc(hapd, addr, reason); + ap_sta_disassociate(hapd, sta, reason); + } + } + + if (tb[DEL_CLIENT_BAN_TIME]) + hostapd_bss_ban_client(hapd, addr, blobmsg_get_u32(tb[DEL_CLIENT_BAN_TIME])); + + return 0; +} + +static void +blobmsg_add_macaddr(struct blob_buf *buf, const char *name, const u8 *addr) +{ + char *s; + + s = blobmsg_alloc_string_buffer(buf, name, 20); + sprintf(s, MACSTR, MAC2STR(addr)); + blobmsg_add_string_buffer(buf); +} + +static int +hostapd_bss_list_bans(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 ubus_banned_client *ban; + void *c; + + blob_buf_init(&b, 0); + c = blobmsg_open_array(&b, "clients"); + avl_for_each_element(&hapd->ubus.banned, ban, avl) + blobmsg_add_macaddr(&b, NULL, ban->addr); + blobmsg_close_array(&b, c); + ubus_send_reply(ctx, req, b.head); + + return 0; +} + +#ifdef CONFIG_WPS +static int +hostapd_bss_wps_start(struct ubus_context *ctx, struct ubus_object *obj, + struct ubus_request_data *req, const char *method, + struct blob_attr *msg) +{ + int rc; + struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj); + + rc = hostapd_wps_button_pushed(hapd, NULL); + + if (rc != 0) + return UBUS_STATUS_NOT_SUPPORTED; + + return 0; +} + + +static const char * pbc_status_enum_str(enum pbc_status status) +{ + switch (status) { + case WPS_PBC_STATUS_DISABLE: + return "Disabled"; + case WPS_PBC_STATUS_ACTIVE: + return "Active"; + case WPS_PBC_STATUS_TIMEOUT: + return "Timed-out"; + case WPS_PBC_STATUS_OVERLAP: + return "Overlap"; + default: + return "Unknown"; + } +} + +static int +hostapd_bss_wps_status(struct ubus_context *ctx, struct ubus_object *obj, + struct ubus_request_data *req, const char *method, + struct blob_attr *msg) +{ + int rc; + struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj); + + blob_buf_init(&b, 0); + + blobmsg_add_string(&b, "pbc_status", pbc_status_enum_str(hapd->wps_stats.pbc_status)); + blobmsg_add_string(&b, "last_wps_result", + (hapd->wps_stats.status == WPS_STATUS_SUCCESS ? + "Success": + (hapd->wps_stats.status == WPS_STATUS_FAILURE ? + "Failed" : "None"))); + + /* If status == Failure - Add possible Reasons */ + if(hapd->wps_stats.status == WPS_STATUS_FAILURE && + hapd->wps_stats.failure_reason > 0) + blobmsg_add_string(&b, "reason", wps_ei_str(hapd->wps_stats.failure_reason)); + + if (hapd->wps_stats.status) + blobmsg_printf(&b, "peer_address", MACSTR, MAC2STR(hapd->wps_stats.peer_addr)); + + ubus_send_reply(ctx, req, b.head); + + return 0; +} + +static int +hostapd_bss_wps_cancel(struct ubus_context *ctx, struct ubus_object *obj, + struct ubus_request_data *req, const char *method, + struct blob_attr *msg) +{ + int rc; + struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj); + + rc = hostapd_wps_cancel(hapd); + + if (rc != 0) + return UBUS_STATUS_NOT_SUPPORTED; + + return 0; +} +#endif /* CONFIG_WPS */ + +static int +hostapd_bss_update_beacon(struct ubus_context *ctx, struct ubus_object *obj, + struct ubus_request_data *req, const char *method, + struct blob_attr *msg) +{ + int rc; + struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj); + + rc = ieee802_11_set_beacon(hapd); + + if (rc != 0) + return UBUS_STATUS_NOT_SUPPORTED; + + return 0; +} + +enum { + CONFIG_IFACE, + CONFIG_FILE, + __CONFIG_MAX +}; + +enum { + CSA_FREQ, + CSA_BCN_COUNT, + CSA_CENTER_FREQ1, + CSA_CENTER_FREQ2, + CSA_BANDWIDTH, + CSA_SEC_CHANNEL_OFFSET, + CSA_HT, + CSA_VHT, + CSA_HE, + CSA_BLOCK_TX, + CSA_FORCE, + __CSA_MAX +}; + +static const struct blobmsg_policy csa_policy[__CSA_MAX] = { + [CSA_FREQ] = { "freq", BLOBMSG_TYPE_INT32 }, + [CSA_BCN_COUNT] = { "bcn_count", BLOBMSG_TYPE_INT32 }, + [CSA_CENTER_FREQ1] = { "center_freq1", BLOBMSG_TYPE_INT32 }, + [CSA_CENTER_FREQ2] = { "center_freq2", BLOBMSG_TYPE_INT32 }, + [CSA_BANDWIDTH] = { "bandwidth", BLOBMSG_TYPE_INT32 }, + [CSA_SEC_CHANNEL_OFFSET] = { "sec_channel_offset", BLOBMSG_TYPE_INT32 }, + [CSA_HT] = { "ht", BLOBMSG_TYPE_BOOL }, + [CSA_VHT] = { "vht", BLOBMSG_TYPE_BOOL }, + [CSA_HE] = { "he", BLOBMSG_TYPE_BOOL }, + [CSA_BLOCK_TX] = { "block_tx", BLOBMSG_TYPE_BOOL }, + [CSA_FORCE] = { "force", BLOBMSG_TYPE_BOOL }, +}; + + +static void switch_chan_fallback_cb(void *eloop_data, void *user_ctx) +{ + struct hostapd_iface *iface = eloop_data; + struct hostapd_freq_params *freq_params = user_ctx; + + hostapd_switch_channel_fallback(iface, freq_params); +} + +#ifdef NEED_AP_MLME +static int +hostapd_switch_chan(struct ubus_context *ctx, struct ubus_object *obj, + struct ubus_request_data *req, const char *method, + struct blob_attr *msg) +{ + struct blob_attr *tb[__CSA_MAX]; + struct hostapd_data *hapd = get_hapd_from_object(obj); + struct hostapd_config *iconf = hapd->iface->conf; + struct hostapd_freq_params *freq_params; + struct hostapd_hw_modes *mode = hapd->iface->current_mode; + struct csa_settings css = { + .freq_params = { + .ht_enabled = iconf->ieee80211n, + .vht_enabled = iconf->ieee80211ac, + .he_enabled = iconf->ieee80211ax, + .sec_channel_offset = iconf->secondary_channel, + } + }; + u8 chwidth = hostapd_get_oper_chwidth(iconf); + u8 seg0 = 0, seg1 = 0; + int ret = UBUS_STATUS_OK; + int i; + + blobmsg_parse(csa_policy, __CSA_MAX, tb, blob_data(msg), blob_len(msg)); + + if (!tb[CSA_FREQ]) + return UBUS_STATUS_INVALID_ARGUMENT; + + switch (iconf->vht_oper_chwidth) { + case CHANWIDTH_USE_HT: + if (iconf->secondary_channel) + css.freq_params.bandwidth = 40; + else + css.freq_params.bandwidth = 20; + break; + case CHANWIDTH_160MHZ: + css.freq_params.bandwidth = 160; + break; + default: + css.freq_params.bandwidth = 80; + break; + } + + css.freq_params.freq = blobmsg_get_u32(tb[CSA_FREQ]); + +#define SET_CSA_SETTING(name, field, type) \ + do { \ + if (tb[name]) \ + css.field = blobmsg_get_ ## type(tb[name]); \ + } while(0) + + SET_CSA_SETTING(CSA_BCN_COUNT, cs_count, u32); + SET_CSA_SETTING(CSA_CENTER_FREQ1, freq_params.center_freq1, u32); + SET_CSA_SETTING(CSA_CENTER_FREQ2, freq_params.center_freq2, u32); + SET_CSA_SETTING(CSA_BANDWIDTH, freq_params.bandwidth, u32); + SET_CSA_SETTING(CSA_SEC_CHANNEL_OFFSET, freq_params.sec_channel_offset, u32); + SET_CSA_SETTING(CSA_HT, freq_params.ht_enabled, bool); + SET_CSA_SETTING(CSA_VHT, freq_params.vht_enabled, bool); + SET_CSA_SETTING(CSA_HE, freq_params.he_enabled, bool); + SET_CSA_SETTING(CSA_BLOCK_TX, block_tx, bool); + + css.freq_params.channel = hostapd_hw_get_channel(hapd, css.freq_params.freq); + if (!css.freq_params.channel) + return UBUS_STATUS_NOT_SUPPORTED; + + switch (css.freq_params.bandwidth) { + case 160: + chwidth = CHANWIDTH_160MHZ; + break; + case 80: + chwidth = css.freq_params.center_freq2 ? CHANWIDTH_80P80MHZ : CHANWIDTH_80MHZ; + break; + default: + chwidth = CHANWIDTH_USE_HT; + break; + } + + hostapd_set_freq_params(&css.freq_params, iconf->hw_mode, + css.freq_params.freq, + css.freq_params.channel, iconf->enable_edmg, + iconf->edmg_channel, + css.freq_params.ht_enabled, + css.freq_params.vht_enabled, + css.freq_params.he_enabled, + css.freq_params.eht_enabled, + css.freq_params.sec_channel_offset, + chwidth, seg0, seg1, + iconf->vht_capab, + mode ? &mode->he_capab[IEEE80211_MODE_AP] : + NULL, + mode ? &mode->eht_capab[IEEE80211_MODE_AP] : + NULL, + hostapd_get_punct_bitmap(hapd)); + + for (i = 0; i < hapd->iface->num_bss; i++) { + struct hostapd_data *bss = hapd->iface->bss[i]; + + if (hostapd_switch_channel(bss, &css) != 0) + ret = UBUS_STATUS_NOT_SUPPORTED; + } + + if (!ret || !tb[CSA_FORCE] || !blobmsg_get_bool(tb[CSA_FORCE])) + return ret; + + freq_params = malloc(sizeof(*freq_params)); + memcpy(freq_params, &css.freq_params, sizeof(*freq_params)); + eloop_register_timeout(0, 1, switch_chan_fallback_cb, + hapd->iface, freq_params); + + return 0; +#undef SET_CSA_SETTING +} +#endif + +enum { + VENDOR_ELEMENTS, + __VENDOR_ELEMENTS_MAX +}; + +static const struct blobmsg_policy ve_policy[__VENDOR_ELEMENTS_MAX] = { + /* vendor elements are provided as hex-string */ + [VENDOR_ELEMENTS] = { "vendor_elements", BLOBMSG_TYPE_STRING }, +}; + +static int +hostapd_vendor_elements(struct ubus_context *ctx, struct ubus_object *obj, + struct ubus_request_data *req, const char *method, + struct blob_attr *msg) +{ + struct blob_attr *tb[__VENDOR_ELEMENTS_MAX]; + struct hostapd_data *hapd = get_hapd_from_object(obj); + struct hostapd_bss_config *bss = hapd->conf; + struct wpabuf *elems; + const char *pos; + size_t len; + + blobmsg_parse(ve_policy, __VENDOR_ELEMENTS_MAX, tb, + blob_data(msg), blob_len(msg)); + + if (!tb[VENDOR_ELEMENTS]) + return UBUS_STATUS_INVALID_ARGUMENT; + + pos = blobmsg_data(tb[VENDOR_ELEMENTS]); + len = os_strlen(pos); + if (len & 0x01) + return UBUS_STATUS_INVALID_ARGUMENT; + + len /= 2; + if (len == 0) { + wpabuf_free(bss->vendor_elements); + bss->vendor_elements = NULL; + return 0; + } + + elems = wpabuf_alloc(len); + if (elems == NULL) + return 1; + + if (hexstr2bin(pos, wpabuf_put(elems, len), len)) { + wpabuf_free(elems); + return UBUS_STATUS_INVALID_ARGUMENT; + } + + wpabuf_free(bss->vendor_elements); + bss->vendor_elements = elems; + + /* update beacons if vendor elements were set successfully */ + if (ieee802_11_update_beacons(hapd->iface) != 0) + return UBUS_STATUS_NOT_SUPPORTED; + return UBUS_STATUS_OK; +} + +static void +hostapd_rrm_print_nr(struct hostapd_neighbor_entry *nr) +{ + const u8 *data; + char *str; + int len; + + blobmsg_printf(&b, "", MACSTR, MAC2STR(nr->bssid)); + + str = blobmsg_alloc_string_buffer(&b, "", nr->ssid.ssid_len + 1); + memcpy(str, nr->ssid.ssid, nr->ssid.ssid_len); + str[nr->ssid.ssid_len] = 0; + blobmsg_add_string_buffer(&b); + + len = wpabuf_len(nr->nr); + str = blobmsg_alloc_string_buffer(&b, "", 2 * len + 1); + wpa_snprintf_hex(str, 2 * len + 1, wpabuf_head_u8(nr->nr), len); + blobmsg_add_string_buffer(&b); +} + +enum { + BSS_MGMT_EN_NEIGHBOR, + BSS_MGMT_EN_BEACON, + BSS_MGMT_EN_LINK_MEASUREMENT, +#ifdef CONFIG_WNM_AP + BSS_MGMT_EN_BSS_TRANSITION, +#endif + __BSS_MGMT_EN_MAX +}; + +static bool +__hostapd_bss_mgmt_enable_f(struct hostapd_data *hapd, int flag) +{ + struct hostapd_bss_config *bss = hapd->conf; + uint32_t flags; + + switch (flag) { + case BSS_MGMT_EN_NEIGHBOR: + if (bss->radio_measurements[0] & + WLAN_RRM_CAPS_NEIGHBOR_REPORT) + return false; + + bss->radio_measurements[0] |= + WLAN_RRM_CAPS_NEIGHBOR_REPORT; + hostapd_neighbor_set_own_report(hapd); + return true; + case BSS_MGMT_EN_BEACON: + flags = WLAN_RRM_CAPS_BEACON_REPORT_PASSIVE | + WLAN_RRM_CAPS_BEACON_REPORT_ACTIVE | + WLAN_RRM_CAPS_BEACON_REPORT_TABLE; + + if (bss->radio_measurements[0] & flags == flags) + return false; + + bss->radio_measurements[0] |= (u8) flags; + return true; + case BSS_MGMT_EN_LINK_MEASUREMENT: + flags = WLAN_RRM_CAPS_LINK_MEASUREMENT; + + if (bss->radio_measurements[0] & flags == flags) + return false; + + bss->radio_measurements[0] |= (u8) flags; + return true; +#ifdef CONFIG_WNM_AP + case BSS_MGMT_EN_BSS_TRANSITION: + if (bss->bss_transition) + return false; + + bss->bss_transition = 1; + return true; +#endif + } +} + +static void +__hostapd_bss_mgmt_enable(struct hostapd_data *hapd, uint32_t flags) +{ + bool update = false; + int i; + + for (i = 0; i < __BSS_MGMT_EN_MAX; i++) { + if (!(flags & (1 << i))) + continue; + + update |= __hostapd_bss_mgmt_enable_f(hapd, i); + } + + if (update) + ieee802_11_update_beacons(hapd->iface); +} + + +static const struct blobmsg_policy bss_mgmt_enable_policy[__BSS_MGMT_EN_MAX] = { + [BSS_MGMT_EN_NEIGHBOR] = { "neighbor_report", BLOBMSG_TYPE_BOOL }, + [BSS_MGMT_EN_BEACON] = { "beacon_report", BLOBMSG_TYPE_BOOL }, + [BSS_MGMT_EN_LINK_MEASUREMENT] = { "link_measurement", BLOBMSG_TYPE_BOOL }, +#ifdef CONFIG_WNM_AP + [BSS_MGMT_EN_BSS_TRANSITION] = { "bss_transition", BLOBMSG_TYPE_BOOL }, +#endif +}; + +static int +hostapd_bss_mgmt_enable(struct ubus_context *ctx, struct ubus_object *obj, + struct ubus_request_data *req, const char *method, + struct blob_attr *msg) + +{ + struct hostapd_data *hapd = get_hapd_from_object(obj); + struct blob_attr *tb[__BSS_MGMT_EN_MAX]; + struct blob_attr *cur; + uint32_t flags = 0; + int i; + bool neigh = false, beacon = false; + + blobmsg_parse(bss_mgmt_enable_policy, __BSS_MGMT_EN_MAX, tb, blob_data(msg), blob_len(msg)); + + for (i = 0; i < ARRAY_SIZE(tb); i++) { + if (!tb[i] || !blobmsg_get_bool(tb[i])) + continue; + + flags |= (1 << i); + } + + __hostapd_bss_mgmt_enable(hapd, flags); + + return 0; +} + + +static void +hostapd_rrm_nr_enable(struct hostapd_data *hapd) +{ + __hostapd_bss_mgmt_enable(hapd, 1 << BSS_MGMT_EN_NEIGHBOR); +} + +static int +hostapd_rrm_nr_get_own(struct ubus_context *ctx, struct ubus_object *obj, + struct ubus_request_data *req, const char *method, + struct blob_attr *msg) +{ + struct hostapd_data *hapd = get_hapd_from_object(obj); + struct hostapd_neighbor_entry *nr; + void *c; + + hostapd_rrm_nr_enable(hapd); + + nr = hostapd_neighbor_get(hapd, hapd->own_addr, NULL); + if (!nr) + return UBUS_STATUS_NOT_FOUND; + + blob_buf_init(&b, 0); + + c = blobmsg_open_array(&b, "value"); + hostapd_rrm_print_nr(nr); + blobmsg_close_array(&b, c); + + ubus_send_reply(ctx, req, b.head); + + return 0; +} + +static int +hostapd_rrm_nr_list(struct ubus_context *ctx, struct ubus_object *obj, + struct ubus_request_data *req, const char *method, + struct blob_attr *msg) +{ + struct hostapd_data *hapd = get_hapd_from_object(obj); + struct hostapd_neighbor_entry *nr; + void *c; + + hostapd_rrm_nr_enable(hapd); + blob_buf_init(&b, 0); + + c = blobmsg_open_array(&b, "list"); + dl_list_for_each(nr, &hapd->nr_db, struct hostapd_neighbor_entry, list) { + void *cur; + + if (!memcmp(nr->bssid, hapd->own_addr, ETH_ALEN)) + continue; + + cur = blobmsg_open_array(&b, NULL); + hostapd_rrm_print_nr(nr); + blobmsg_close_array(&b, cur); + } + blobmsg_close_array(&b, c); + + ubus_send_reply(ctx, req, b.head); + + return 0; +} + +enum { + NR_SET_LIST, + __NR_SET_LIST_MAX +}; + +static const struct blobmsg_policy nr_set_policy[__NR_SET_LIST_MAX] = { + [NR_SET_LIST] = { "list", BLOBMSG_TYPE_ARRAY }, +}; + + +static void +hostapd_rrm_nr_clear(struct hostapd_data *hapd) +{ + struct hostapd_neighbor_entry *nr; + +restart: + dl_list_for_each(nr, &hapd->nr_db, struct hostapd_neighbor_entry, list) { + if (!memcmp(nr->bssid, hapd->own_addr, ETH_ALEN)) + continue; + + hostapd_neighbor_remove(hapd, nr->bssid, &nr->ssid); + goto restart; + } +} + +static int +hostapd_rrm_nr_set(struct ubus_context *ctx, struct ubus_object *obj, + struct ubus_request_data *req, const char *method, + struct blob_attr *msg) +{ + static const struct blobmsg_policy nr_e_policy[] = { + { .type = BLOBMSG_TYPE_STRING }, + { .type = BLOBMSG_TYPE_STRING }, + { .type = BLOBMSG_TYPE_STRING }, + }; + struct hostapd_data *hapd = get_hapd_from_object(obj); + struct blob_attr *tb_l[__NR_SET_LIST_MAX]; + struct blob_attr *tb[ARRAY_SIZE(nr_e_policy)]; + struct blob_attr *cur; + int rem; + + hostapd_rrm_nr_enable(hapd); + + blobmsg_parse(nr_set_policy, __NR_SET_LIST_MAX, tb_l, blob_data(msg), blob_len(msg)); + if (!tb_l[NR_SET_LIST]) + return UBUS_STATUS_INVALID_ARGUMENT; + + hostapd_rrm_nr_clear(hapd); + blobmsg_for_each_attr(cur, tb_l[NR_SET_LIST], rem) { + struct wpa_ssid_value ssid; + struct wpabuf *data; + u8 bssid[ETH_ALEN]; + char *s, *nr_s; + + blobmsg_parse_array(nr_e_policy, ARRAY_SIZE(nr_e_policy), tb, blobmsg_data(cur), blobmsg_data_len(cur)); + if (!tb[0] || !tb[1] || !tb[2]) + goto invalid; + + /* Neighbor Report binary */ + nr_s = blobmsg_get_string(tb[2]); + data = wpabuf_parse_bin(nr_s); + if (!data) + goto invalid; + + /* BSSID */ + s = blobmsg_get_string(tb[0]); + if (strlen(s) == 0) { + /* Copy BSSID from neighbor report */ + if (hwaddr_compact_aton(nr_s, bssid)) + goto invalid; + } else if (hwaddr_aton(s, bssid)) { + goto invalid; + } + + /* SSID */ + s = blobmsg_get_string(tb[1]); + if (strlen(s) == 0) { + /* Copy SSID from hostapd BSS conf */ + memcpy(&ssid, &hapd->conf->ssid, sizeof(ssid)); + } else { + ssid.ssid_len = strlen(s); + if (ssid.ssid_len > sizeof(ssid.ssid)) + goto invalid; + + memcpy(&ssid, s, ssid.ssid_len); + } + + hostapd_neighbor_set(hapd, bssid, &ssid, data, NULL, NULL, 0, 0); + wpabuf_free(data); + continue; + +invalid: + return UBUS_STATUS_INVALID_ARGUMENT; + } + + return 0; +} + +enum { + BEACON_REQ_ADDR, + BEACON_REQ_MODE, + BEACON_REQ_OP_CLASS, + BEACON_REQ_CHANNEL, + BEACON_REQ_DURATION, + BEACON_REQ_BSSID, + BEACON_REQ_SSID, + __BEACON_REQ_MAX, +}; + +static const struct blobmsg_policy beacon_req_policy[__BEACON_REQ_MAX] = { + [BEACON_REQ_ADDR] = { "addr", BLOBMSG_TYPE_STRING }, + [BEACON_REQ_OP_CLASS] { "op_class", BLOBMSG_TYPE_INT32 }, + [BEACON_REQ_CHANNEL] { "channel", BLOBMSG_TYPE_INT32 }, + [BEACON_REQ_DURATION] { "duration", BLOBMSG_TYPE_INT32 }, + [BEACON_REQ_MODE] { "mode", BLOBMSG_TYPE_INT32 }, + [BEACON_REQ_BSSID] { "bssid", BLOBMSG_TYPE_STRING }, + [BEACON_REQ_SSID] { "ssid", BLOBMSG_TYPE_STRING }, +}; + +static int +hostapd_rrm_beacon_req(struct ubus_context *ctx, struct ubus_object *obj, + struct ubus_request_data *ureq, const char *method, + struct blob_attr *msg) +{ + struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj); + struct blob_attr *tb[__BEACON_REQ_MAX]; + struct blob_attr *cur; + struct wpabuf *req; + u8 bssid[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; + u8 addr[ETH_ALEN]; + int mode, rem, ret; + int buf_len = 13; + + blobmsg_parse(beacon_req_policy, __BEACON_REQ_MAX, tb, blob_data(msg), blob_len(msg)); + + if (!tb[BEACON_REQ_ADDR] || !tb[BEACON_REQ_MODE] || !tb[BEACON_REQ_DURATION] || + !tb[BEACON_REQ_OP_CLASS] || !tb[BEACON_REQ_CHANNEL]) + return UBUS_STATUS_INVALID_ARGUMENT; + + if (tb[BEACON_REQ_SSID]) + buf_len += blobmsg_data_len(tb[BEACON_REQ_SSID]) + 2 - 1; + + mode = blobmsg_get_u32(tb[BEACON_REQ_MODE]); + if (hwaddr_aton(blobmsg_data(tb[BEACON_REQ_ADDR]), addr)) + return UBUS_STATUS_INVALID_ARGUMENT; + + if (tb[BEACON_REQ_BSSID] && + hwaddr_aton(blobmsg_data(tb[BEACON_REQ_BSSID]), bssid)) + return UBUS_STATUS_INVALID_ARGUMENT; + + req = wpabuf_alloc(buf_len); + if (!req) + return UBUS_STATUS_UNKNOWN_ERROR; + + /* 1: regulatory class */ + wpabuf_put_u8(req, blobmsg_get_u32(tb[BEACON_REQ_OP_CLASS])); + + /* 2: channel number */ + wpabuf_put_u8(req, blobmsg_get_u32(tb[BEACON_REQ_CHANNEL])); + + /* 3-4: randomization interval */ + wpabuf_put_le16(req, 0); + + /* 5-6: duration */ + wpabuf_put_le16(req, blobmsg_get_u32(tb[BEACON_REQ_DURATION])); + + /* 7: mode */ + wpabuf_put_u8(req, blobmsg_get_u32(tb[BEACON_REQ_MODE])); + + /* 8-13: BSSID */ + wpabuf_put_data(req, bssid, ETH_ALEN); + + if ((cur = tb[BEACON_REQ_SSID]) != NULL) { + wpabuf_put_u8(req, WLAN_EID_SSID); + wpabuf_put_u8(req, blobmsg_data_len(cur) - 1); + wpabuf_put_data(req, blobmsg_data(cur), blobmsg_data_len(cur) - 1); + } + + ret = hostapd_send_beacon_req(hapd, addr, 0, req); + if (ret < 0) + return -ret; + + return 0; +} + +enum { + LM_REQ_ADDR, + LM_REQ_TX_POWER_USED, + LM_REQ_TX_POWER_MAX, + __LM_REQ_MAX, +}; + +static const struct blobmsg_policy lm_req_policy[__LM_REQ_MAX] = { + [LM_REQ_ADDR] = { "addr", BLOBMSG_TYPE_STRING }, + [LM_REQ_TX_POWER_USED] = { "tx-power-used", BLOBMSG_TYPE_INT32 }, + [LM_REQ_TX_POWER_MAX] = { "tx-power-max", BLOBMSG_TYPE_INT32 }, +}; + +static int +hostapd_rrm_lm_req(struct ubus_context *ctx, struct ubus_object *obj, + struct ubus_request_data *ureq, const char *method, + struct blob_attr *msg) +{ + struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj); + struct blob_attr *tb[__LM_REQ_MAX]; + struct wpabuf *buf; + u8 addr[ETH_ALEN]; + int ret; + int8_t txp_used, txp_max; + + txp_used = 0; + txp_max = 0; + + blobmsg_parse(lm_req_policy, __LM_REQ_MAX, tb, blob_data(msg), blob_len(msg)); + + if (!tb[LM_REQ_ADDR]) + return UBUS_STATUS_INVALID_ARGUMENT; + + if (tb[LM_REQ_TX_POWER_USED]) + txp_used = (int8_t) blobmsg_get_u32(tb[LM_REQ_TX_POWER_USED]); + + if (tb[LM_REQ_TX_POWER_MAX]) + txp_max = (int8_t) blobmsg_get_u32(tb[LM_REQ_TX_POWER_MAX]); + + if (hwaddr_aton(blobmsg_data(tb[LM_REQ_ADDR]), addr)) + return UBUS_STATUS_INVALID_ARGUMENT; + + buf = wpabuf_alloc(5); + if (!buf) + return UBUS_STATUS_UNKNOWN_ERROR; + + wpabuf_put_u8(buf, WLAN_ACTION_RADIO_MEASUREMENT); + wpabuf_put_u8(buf, WLAN_RRM_LINK_MEASUREMENT_REQUEST); + wpabuf_put_u8(buf, 1); + /* TX-Power used */ + wpabuf_put_u8(buf, txp_used); + /* Max TX Power */ + wpabuf_put_u8(buf, txp_max); + + ret = hostapd_drv_send_action(hapd, hapd->iface->freq, 0, addr, + wpabuf_head(buf), wpabuf_len(buf)); + + wpabuf_free(buf); + if (ret < 0) + return -ret; + + return 0; +} + + +void hostapd_ubus_handle_link_measurement(struct hostapd_data *hapd, const u8 *data, size_t len) +{ + const struct ieee80211_mgmt *mgmt = (const struct ieee80211_mgmt *) data; + const u8 *pos, *end; + u8 token; + + end = data + len; + token = mgmt->u.action.u.rrm.dialog_token; + pos = mgmt->u.action.u.rrm.variable; + + if (end - pos < 8) + return; + + if (!hapd->ubus.obj.has_subscribers) + return; + + blob_buf_init(&b, 0); + blobmsg_add_macaddr(&b, "address", mgmt->sa); + blobmsg_add_u16(&b, "dialog-token", token); + blobmsg_add_u16(&b, "rx-antenna-id", pos[4]); + blobmsg_add_u16(&b, "tx-antenna-id", pos[5]); + blobmsg_add_u16(&b, "rcpi", pos[6]); + blobmsg_add_u16(&b, "rsni", pos[7]); + + ubus_notify(ctx, &hapd->ubus.obj, "link-measurement-report", b.head, -1); +} + + +#ifdef CONFIG_WNM_AP + +static int +hostapd_bss_tr_send(struct hostapd_data *hapd, u8 *addr, bool disassoc_imminent, bool abridged, + u16 disassoc_timer, u8 validity_period, u8 dialog_token, + struct blob_attr *neighbors, u8 mbo_reason, u8 cell_pref, u8 reassoc_delay) +{ + struct blob_attr *cur; + struct sta_info *sta; + int nr_len = 0; + int rem; + u8 *nr = NULL; + u8 req_mode = 0; + u8 mbo[10]; + size_t mbo_len = 0; + + sta = ap_get_sta(hapd, addr); + if (!sta) + return UBUS_STATUS_NOT_FOUND; + + if (neighbors) { + u8 *nr_cur; + + if (blobmsg_check_array(neighbors, + BLOBMSG_TYPE_STRING) < 0) + return UBUS_STATUS_INVALID_ARGUMENT; + + blobmsg_for_each_attr(cur, neighbors, rem) { + int len = strlen(blobmsg_get_string(cur)); + + if (len % 2) + return UBUS_STATUS_INVALID_ARGUMENT; + + nr_len += (len / 2) + 2; + } + + if (nr_len) { + nr = os_zalloc(nr_len); + if (!nr) + return UBUS_STATUS_UNKNOWN_ERROR; + } + + nr_cur = nr; + blobmsg_for_each_attr(cur, neighbors, rem) { + int len = strlen(blobmsg_get_string(cur)) / 2; + + *nr_cur++ = WLAN_EID_NEIGHBOR_REPORT; + *nr_cur++ = (u8) len; + if (hexstr2bin(blobmsg_data(cur), nr_cur, len)) { + free(nr); + return UBUS_STATUS_INVALID_ARGUMENT; + } + + nr_cur += len; + } + } + + if (nr) + req_mode |= WNM_BSS_TM_REQ_PREF_CAND_LIST_INCLUDED; + + if (abridged) + req_mode |= WNM_BSS_TM_REQ_ABRIDGED; + + if (disassoc_imminent) + req_mode |= WNM_BSS_TM_REQ_DISASSOC_IMMINENT; + +#ifdef CONFIG_MBO + u8 *mbo_pos = mbo; + + if (mbo_reason > MBO_TRANSITION_REASON_PREMIUM_AP) + return UBUS_STATUS_INVALID_ARGUMENT; + + if (cell_pref != 0 && cell_pref != 1 && cell_pref != 255) + return UBUS_STATUS_INVALID_ARGUMENT; + + if (reassoc_delay > 65535 || (reassoc_delay && !disassoc_imminent)) + return UBUS_STATUS_INVALID_ARGUMENT; + + *mbo_pos++ = MBO_ATTR_ID_TRANSITION_REASON; + *mbo_pos++ = 1; + *mbo_pos++ = mbo_reason; + *mbo_pos++ = MBO_ATTR_ID_CELL_DATA_PREF; + *mbo_pos++ = 1; + *mbo_pos++ = cell_pref; + + if (reassoc_delay) { + *mbo_pos++ = MBO_ATTR_ID_ASSOC_RETRY_DELAY; + *mbo_pos++ = 2; + WPA_PUT_LE16(mbo_pos, reassoc_delay); + mbo_pos += 2; + } + + mbo_len = mbo_pos - mbo; +#endif + + if (wnm_send_bss_tm_req(hapd, sta, req_mode, disassoc_timer, validity_period, NULL, + dialog_token, NULL, nr, nr_len, mbo_len ? mbo : NULL, mbo_len)) + return UBUS_STATUS_UNKNOWN_ERROR; + + return 0; +} + +enum { + BSS_TR_ADDR, + BSS_TR_DA_IMMINENT, + BSS_TR_DA_TIMER, + BSS_TR_VALID_PERIOD, + BSS_TR_NEIGHBORS, + BSS_TR_ABRIDGED, + BSS_TR_DIALOG_TOKEN, +#ifdef CONFIG_MBO + BSS_TR_MBO_REASON, + BSS_TR_CELL_PREF, + BSS_TR_REASSOC_DELAY, +#endif + __BSS_TR_DISASSOC_MAX +}; + +static const struct blobmsg_policy bss_tr_policy[__BSS_TR_DISASSOC_MAX] = { + [BSS_TR_ADDR] = { "addr", BLOBMSG_TYPE_STRING }, + [BSS_TR_DA_IMMINENT] = { "disassociation_imminent", BLOBMSG_TYPE_BOOL }, + [BSS_TR_DA_TIMER] = { "disassociation_timer", BLOBMSG_TYPE_INT32 }, + [BSS_TR_VALID_PERIOD] = { "validity_period", BLOBMSG_TYPE_INT32 }, + [BSS_TR_NEIGHBORS] = { "neighbors", BLOBMSG_TYPE_ARRAY }, + [BSS_TR_ABRIDGED] = { "abridged", BLOBMSG_TYPE_BOOL }, + [BSS_TR_DIALOG_TOKEN] = { "dialog_token", BLOBMSG_TYPE_INT32 }, +#ifdef CONFIG_MBO + [BSS_TR_MBO_REASON] = { "mbo_reason", BLOBMSG_TYPE_INT32 }, + [BSS_TR_CELL_PREF] = { "cell_pref", BLOBMSG_TYPE_INT32 }, + [BSS_TR_REASSOC_DELAY] = { "reassoc_delay", BLOBMSG_TYPE_INT32 }, +#endif +}; + +static int +hostapd_bss_transition_request(struct ubus_context *ctx, struct ubus_object *obj, + struct ubus_request_data *ureq, const char *method, + struct blob_attr *msg) +{ + struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj); + struct blob_attr *tb[__BSS_TR_DISASSOC_MAX]; + struct sta_info *sta; + u32 da_timer = 0; + u32 valid_period = 0; + u8 addr[ETH_ALEN]; + u32 dialog_token = 1; + bool abridged; + bool da_imminent; + u8 mbo_reason; + u8 cell_pref; + u8 reassoc_delay; + + blobmsg_parse(bss_tr_policy, __BSS_TR_DISASSOC_MAX, tb, blob_data(msg), blob_len(msg)); + + if (!tb[BSS_TR_ADDR]) + return UBUS_STATUS_INVALID_ARGUMENT; + + if (hwaddr_aton(blobmsg_data(tb[BSS_TR_ADDR]), addr)) + return UBUS_STATUS_INVALID_ARGUMENT; + + if (tb[BSS_TR_DA_TIMER]) + da_timer = blobmsg_get_u32(tb[BSS_TR_DA_TIMER]); + + if (tb[BSS_TR_VALID_PERIOD]) + valid_period = blobmsg_get_u32(tb[BSS_TR_VALID_PERIOD]); + + if (tb[BSS_TR_DIALOG_TOKEN]) + dialog_token = blobmsg_get_u32(tb[BSS_TR_DIALOG_TOKEN]); + + da_imminent = !!(tb[BSS_TR_DA_IMMINENT] && blobmsg_get_bool(tb[BSS_TR_DA_IMMINENT])); + abridged = !!(tb[BSS_TR_ABRIDGED] && blobmsg_get_bool(tb[BSS_TR_ABRIDGED])); + +#ifdef CONFIG_MBO + if (tb[BSS_TR_MBO_REASON]) + mbo_reason = blobmsg_get_u32(tb[BSS_TR_MBO_REASON]); + + if (tb[BSS_TR_CELL_PREF]) + cell_pref = blobmsg_get_u32(tb[BSS_TR_CELL_PREF]); + + if (tb[BSS_TR_REASSOC_DELAY]) + reassoc_delay = blobmsg_get_u32(tb[BSS_TR_REASSOC_DELAY]); +#endif + + return hostapd_bss_tr_send(hapd, addr, da_imminent, abridged, da_timer, valid_period, + dialog_token, tb[BSS_TR_NEIGHBORS], mbo_reason, cell_pref, reassoc_delay); +} +#endif + +#ifdef CONFIG_AIRTIME_POLICY +enum { + UPDATE_AIRTIME_STA, + UPDATE_AIRTIME_WEIGHT, + __UPDATE_AIRTIME_MAX, +}; + + +static const struct blobmsg_policy airtime_policy[__UPDATE_AIRTIME_MAX] = { + [UPDATE_AIRTIME_STA] = { "sta", BLOBMSG_TYPE_STRING }, + [UPDATE_AIRTIME_WEIGHT] = { "weight", BLOBMSG_TYPE_INT32 }, +}; + +static int +hostapd_bss_update_airtime(struct ubus_context *ctx, struct ubus_object *obj, + struct ubus_request_data *ureq, const char *method, + struct blob_attr *msg) +{ + struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj); + struct blob_attr *tb[__UPDATE_AIRTIME_MAX]; + struct sta_info *sta = NULL; + u8 addr[ETH_ALEN]; + int weight; + + blobmsg_parse(airtime_policy, __UPDATE_AIRTIME_MAX, tb, blob_data(msg), blob_len(msg)); + + if (!tb[UPDATE_AIRTIME_WEIGHT]) + return UBUS_STATUS_INVALID_ARGUMENT; + + weight = blobmsg_get_u32(tb[UPDATE_AIRTIME_WEIGHT]); + + if (!tb[UPDATE_AIRTIME_STA]) { + if (!weight) + return UBUS_STATUS_INVALID_ARGUMENT; + + hapd->conf->airtime_weight = weight; + return 0; + } + + if (hwaddr_aton(blobmsg_data(tb[UPDATE_AIRTIME_STA]), addr)) + return UBUS_STATUS_INVALID_ARGUMENT; + + sta = ap_get_sta(hapd, addr); + if (!sta) + return UBUS_STATUS_NOT_FOUND; + + sta->dyn_airtime_weight = weight; + airtime_policy_new_sta(hapd, sta); + + return 0; +} +#endif + +#ifdef CONFIG_TAXONOMY +static const struct blobmsg_policy addr_policy[] = { + { "address", BLOBMSG_TYPE_STRING } +}; + +static bool +hostapd_add_b64_data(const char *name, const struct wpabuf *buf) +{ + char *str; + + if (!buf) + return false; + + str = blobmsg_alloc_string_buffer(&b, name, B64_ENCODE_LEN(wpabuf_len(buf))); + b64_encode(wpabuf_head(buf), wpabuf_len(buf), str, B64_ENCODE_LEN(wpabuf_len(buf))); + blobmsg_add_string_buffer(&b); + + return true; +} + +static int +hostapd_bss_get_sta_ies(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 blob_attr *tb; + struct sta_info *sta; + u8 addr[ETH_ALEN]; + + blobmsg_parse(addr_policy, 1, &tb, blobmsg_data(msg), blobmsg_len(msg)); + + if (!tb || hwaddr_aton(blobmsg_data(tb), addr)) + return UBUS_STATUS_INVALID_ARGUMENT; + + sta = ap_get_sta(hapd, addr); + if (!sta || (!sta->probe_ie_taxonomy && !sta->assoc_ie_taxonomy)) + return UBUS_STATUS_NOT_FOUND; + + blob_buf_init(&b, 0); + hostapd_add_b64_data("probe_ie", sta->probe_ie_taxonomy); + hostapd_add_b64_data("assoc_ie", sta->assoc_ie_taxonomy); + ubus_send_reply(ctx, req, b.head); + + return 0; +} +#endif + + +static const struct ubus_method bss_methods[] = { + UBUS_METHOD_NOARG("reload", hostapd_bss_reload), + UBUS_METHOD_NOARG("get_clients", hostapd_bss_get_clients), +#ifdef CONFIG_TAXONOMY + UBUS_METHOD("get_sta_ies", hostapd_bss_get_sta_ies, addr_policy), +#endif + UBUS_METHOD_NOARG("get_status", hostapd_bss_get_status), + UBUS_METHOD("del_client", hostapd_bss_del_client, del_policy), +#ifdef CONFIG_AIRTIME_POLICY + UBUS_METHOD("update_airtime", hostapd_bss_update_airtime, airtime_policy), +#endif + UBUS_METHOD_NOARG("list_bans", hostapd_bss_list_bans), +#ifdef CONFIG_WPS + UBUS_METHOD_NOARG("wps_start", hostapd_bss_wps_start), + UBUS_METHOD_NOARG("wps_status", hostapd_bss_wps_status), + UBUS_METHOD_NOARG("wps_cancel", hostapd_bss_wps_cancel), +#endif + UBUS_METHOD_NOARG("update_beacon", hostapd_bss_update_beacon), + UBUS_METHOD_NOARG("get_features", hostapd_bss_get_features), +#ifdef NEED_AP_MLME + UBUS_METHOD("switch_chan", hostapd_switch_chan, csa_policy), +#endif + UBUS_METHOD("set_vendor_elements", hostapd_vendor_elements, ve_policy), + UBUS_METHOD("notify_response", hostapd_notify_response, notify_policy), + UBUS_METHOD("bss_mgmt_enable", hostapd_bss_mgmt_enable, bss_mgmt_enable_policy), + UBUS_METHOD_NOARG("rrm_nr_get_own", hostapd_rrm_nr_get_own), + UBUS_METHOD_NOARG("rrm_nr_list", hostapd_rrm_nr_list), + UBUS_METHOD("rrm_nr_set", hostapd_rrm_nr_set, nr_set_policy), + UBUS_METHOD("rrm_beacon_req", hostapd_rrm_beacon_req, beacon_req_policy), + UBUS_METHOD("link_measurement_req", hostapd_rrm_lm_req, lm_req_policy), +#ifdef CONFIG_WNM_AP + UBUS_METHOD("bss_transition_request", hostapd_bss_transition_request, bss_tr_policy), +#endif +}; + +static struct ubus_object_type bss_object_type = + UBUS_OBJECT_TYPE("hostapd_bss", bss_methods); + +static int avl_compare_macaddr(const void *k1, const void *k2, void *ptr) +{ + return memcmp(k1, k2, ETH_ALEN); +} + +void hostapd_ubus_add_bss(struct hostapd_data *hapd) +{ + struct ubus_object *obj = &hapd->ubus.obj; + char *name; + int ret; + +#ifdef CONFIG_MESH + if (hapd->conf->mesh & MESH_ENABLED) + return; +#endif + + if (!hostapd_ubus_init()) + return; + + if (asprintf(&name, "hostapd.%s", hapd->conf->iface) < 0) + return; + + avl_init(&hapd->ubus.banned, avl_compare_macaddr, false, NULL); + obj->name = name; + obj->type = &bss_object_type; + obj->methods = bss_object_type.methods; + obj->n_methods = bss_object_type.n_methods; + ret = ubus_add_object(ctx, obj); + hostapd_ubus_ref_inc(); +} + +void hostapd_ubus_free_bss(struct hostapd_data *hapd) +{ + struct ubus_object *obj = &hapd->ubus.obj; + char *name = (char *) obj->name; + +#ifdef CONFIG_MESH + if (hapd->conf->mesh & MESH_ENABLED) + return; +#endif + + if (!ctx) + return; + + if (obj->id) { + ubus_remove_object(ctx, obj); + hostapd_ubus_ref_dec(); + } + + 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"); +} + +struct ubus_event_req { + struct ubus_notify_request nreq; + int resp; +}; + +static void +ubus_event_cb(struct ubus_notify_request *req, int idx, int ret) +{ + struct ubus_event_req *ureq = container_of(req, struct ubus_event_req, nreq); + + ureq->resp = ret; +} + +int hostapd_ubus_handle_event(struct hostapd_data *hapd, struct hostapd_ubus_request *req) +{ + struct ubus_banned_client *ban; + const char *types[HOSTAPD_UBUS_TYPE_MAX] = { + [HOSTAPD_UBUS_PROBE_REQ] = "probe", + [HOSTAPD_UBUS_AUTH_REQ] = "auth", + [HOSTAPD_UBUS_ASSOC_REQ] = "assoc", + }; + const char *type = "mgmt"; + struct ubus_event_req ureq = {}; + const u8 *addr; + + if (req->mgmt_frame) + addr = req->mgmt_frame->sa; + else + addr = req->addr; + + ban = avl_find_element(&hapd->ubus.banned, addr, ban, avl); + if (ban) + return WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA; + + if (!hapd->ubus.obj.has_subscribers) + return WLAN_STATUS_SUCCESS; + + if (req->type < ARRAY_SIZE(types)) + type = types[req->type]; + + blob_buf_init(&b, 0); + blobmsg_add_macaddr(&b, "address", addr); + if (req->mgmt_frame) + blobmsg_add_macaddr(&b, "target", req->mgmt_frame->da); + if (req->ssi_signal) + blobmsg_add_u32(&b, "signal", req->ssi_signal); + blobmsg_add_u32(&b, "freq", hapd->iface->freq); + + if (req->elems) { + if(req->elems->ht_capabilities) + { + struct ieee80211_ht_capabilities *ht_capabilities; + void *ht_cap, *ht_cap_mcs_set, *mcs_set; + + + ht_capabilities = (struct ieee80211_ht_capabilities*) req->elems->ht_capabilities; + ht_cap = blobmsg_open_table(&b, "ht_capabilities"); + blobmsg_add_u16(&b, "ht_capabilities_info", ht_capabilities->ht_capabilities_info); + ht_cap_mcs_set = blobmsg_open_table(&b, "supported_mcs_set"); + blobmsg_add_u16(&b, "a_mpdu_params", ht_capabilities->a_mpdu_params); + blobmsg_add_u16(&b, "ht_extended_capabilities", ht_capabilities->ht_extended_capabilities); + blobmsg_add_u32(&b, "tx_bf_capability_info", ht_capabilities->tx_bf_capability_info); + blobmsg_add_u16(&b, "asel_capabilities", ht_capabilities->asel_capabilities); + mcs_set = blobmsg_open_array(&b, "supported_mcs_set"); + for (int i = 0; i < 16; i++) { + blobmsg_add_u16(&b, NULL, (u16) ht_capabilities->supported_mcs_set[i]); + } + blobmsg_close_array(&b, mcs_set); + blobmsg_close_table(&b, ht_cap_mcs_set); + blobmsg_close_table(&b, ht_cap); + } + if(req->elems->vht_capabilities) + { + struct ieee80211_vht_capabilities *vht_capabilities; + void *vht_cap, *vht_cap_mcs_set; + + vht_capabilities = (struct ieee80211_vht_capabilities*) req->elems->vht_capabilities; + vht_cap = blobmsg_open_table(&b, "vht_capabilities"); + blobmsg_add_u32(&b, "vht_capabilities_info", vht_capabilities->vht_capabilities_info); + vht_cap_mcs_set = blobmsg_open_table(&b, "vht_supported_mcs_set"); + blobmsg_add_u16(&b, "rx_map", vht_capabilities->vht_supported_mcs_set.rx_map); + blobmsg_add_u16(&b, "rx_highest", vht_capabilities->vht_supported_mcs_set.rx_highest); + blobmsg_add_u16(&b, "tx_map", vht_capabilities->vht_supported_mcs_set.tx_map); + blobmsg_add_u16(&b, "tx_highest", vht_capabilities->vht_supported_mcs_set.tx_highest); + blobmsg_close_table(&b, vht_cap_mcs_set); + blobmsg_close_table(&b, vht_cap); + } + } + + if (!hapd->ubus.notify_response) { + ubus_notify(ctx, &hapd->ubus.obj, type, b.head, -1); + return WLAN_STATUS_SUCCESS; + } + + if (ubus_notify_async(ctx, &hapd->ubus.obj, type, b.head, &ureq.nreq)) + return WLAN_STATUS_SUCCESS; + + ureq.nreq.status_cb = ubus_event_cb; + ubus_complete_request(ctx, &ureq.nreq.req, 100); + + if (ureq.resp) + return ureq.resp; + + return WLAN_STATUS_SUCCESS; +} + +void hostapd_ubus_notify(struct hostapd_data *hapd, const char *type, const u8 *addr) +{ + if (!hapd->ubus.obj.has_subscribers) + return; + + if (!addr) + return; + + blob_buf_init(&b, 0); + blobmsg_add_macaddr(&b, "address", addr); + + ubus_notify(ctx, &hapd->ubus.obj, type, b.head, -1); +} + +void hostapd_ubus_notify_authorized(struct hostapd_data *hapd, struct sta_info *sta, + const char *auth_alg) +{ + if (!hapd->ubus.obj.has_subscribers) + return; + + blob_buf_init(&b, 0); + blobmsg_add_macaddr(&b, "address", sta->addr); + if (auth_alg) + blobmsg_add_string(&b, "auth-alg", auth_alg); + + ubus_notify(ctx, &hapd->ubus.obj, "sta-authorized", b.head, -1); +} + +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) +{ + if (!hapd->ubus.obj.has_subscribers) + return; + + if (!addr || !rep) + return; + + blob_buf_init(&b, 0); + blobmsg_add_macaddr(&b, "address", addr); + blobmsg_add_u16(&b, "op-class", rep->op_class); + blobmsg_add_u16(&b, "channel", rep->channel); + blobmsg_add_u64(&b, "start-time", rep->start_time); + blobmsg_add_u16(&b, "duration", rep->duration); + blobmsg_add_u16(&b, "report-info", rep->report_info); + blobmsg_add_u16(&b, "rcpi", rep->rcpi); + blobmsg_add_u16(&b, "rsni", rep->rsni); + blobmsg_add_macaddr(&b, "bssid", rep->bssid); + blobmsg_add_u16(&b, "antenna-id", rep->antenna_id); + blobmsg_add_u16(&b, "parent-tsf", rep->parent_tsf); + blobmsg_add_u16(&b, "rep-mode", rep_mode); + + 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 (!ctx) + 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); + } +} + +#ifdef CONFIG_WNM_AP +static void hostapd_ubus_notify_bss_transition_add_candidate_list( + const u8 *candidate_list, u16 candidate_list_len) +{ + char *cl_str; + int i; + + if (candidate_list_len == 0) + return; + + cl_str = blobmsg_alloc_string_buffer(&b, "candidate-list", candidate_list_len * 2 + 1); + for (i = 0; i < candidate_list_len; i++) + snprintf(&cl_str[i*2], 3, "%02X", candidate_list[i]); + blobmsg_add_string_buffer(&b); + +} +#endif + +void hostapd_ubus_notify_bss_transition_response( + struct hostapd_data *hapd, const u8 *addr, u8 dialog_token, u8 status_code, + u8 bss_termination_delay, const u8 *target_bssid, + const u8 *candidate_list, u16 candidate_list_len) +{ +#ifdef CONFIG_WNM_AP + u16 i; + + if (!hapd->ubus.obj.has_subscribers) + return; + + if (!addr) + return; + + blob_buf_init(&b, 0); + blobmsg_add_macaddr(&b, "address", addr); + blobmsg_add_u8(&b, "dialog-token", dialog_token); + blobmsg_add_u8(&b, "status-code", status_code); + blobmsg_add_u8(&b, "bss-termination-delay", bss_termination_delay); + if (target_bssid) + blobmsg_add_macaddr(&b, "target-bssid", target_bssid); + + hostapd_ubus_notify_bss_transition_add_candidate_list(candidate_list, candidate_list_len); + + ubus_notify(ctx, &hapd->ubus.obj, "bss-transition-response", b.head, -1); +#endif +} + +int hostapd_ubus_notify_bss_transition_query( + struct hostapd_data *hapd, const u8 *addr, u8 dialog_token, u8 reason, + const u8 *candidate_list, u16 candidate_list_len) +{ +#ifdef CONFIG_WNM_AP + struct ubus_event_req ureq = {}; + char *cl_str; + u16 i; + + if (!hapd->ubus.obj.has_subscribers) + return 0; + + if (!addr) + return 0; + + blob_buf_init(&b, 0); + blobmsg_add_macaddr(&b, "address", addr); + blobmsg_add_u8(&b, "dialog-token", dialog_token); + blobmsg_add_u8(&b, "reason", reason); + hostapd_ubus_notify_bss_transition_add_candidate_list(candidate_list, candidate_list_len); + + if (!hapd->ubus.notify_response) { + ubus_notify(ctx, &hapd->ubus.obj, "bss-transition-query", b.head, -1); + return 0; + } + + if (ubus_notify_async(ctx, &hapd->ubus.obj, "bss-transition-query", b.head, &ureq.nreq)) + return 0; + + ureq.nreq.status_cb = ubus_event_cb; + ubus_complete_request(ctx, &ureq.nreq.req, 100); + + return ureq.resp; +#endif +} diff --git a/package/network/services/hostapd/src/src/utils/ap/ubus.h b/package/network/services/hostapd/src/src/utils/ap/ubus.h new file mode 100644 index 00000000000000..22767d67ee7564 --- /dev/null +++ b/package/network/services/hostapd/src/src/utils/ap/ubus.h @@ -0,0 +1,157 @@ +/* + * hostapd / ubus support + * Copyright (c) 2013, Felix Fietkau + * + * This software may be distributed under the terms of the BSD license. + * See README for more details. + */ +#ifndef __HOSTAPD_UBUS_H +#define __HOSTAPD_UBUS_H + +#include "sta_info.h" + +enum hostapd_ubus_event_type { + HOSTAPD_UBUS_PROBE_REQ, + HOSTAPD_UBUS_AUTH_REQ, + HOSTAPD_UBUS_ASSOC_REQ, + HOSTAPD_UBUS_TYPE_MAX +}; + +struct hostapd_ubus_request { + enum hostapd_ubus_event_type type; + const struct ieee80211_mgmt *mgmt_frame; + const struct ieee802_11_elems *elems; + int ssi_signal; /* dBm */ + const u8 *addr; +}; + +struct hostapd_iface; +struct hostapd_data; +struct hapd_interfaces; +struct rrm_measurement_beacon_report; +struct sta_info; + +#ifdef UBUS_SUPPORT + +#include +#include + +struct hostapd_ubus_bss { + struct ubus_object obj; + struct avl_tree banned; + int notify_response; +}; + +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_handle_link_measurement(struct hostapd_data *hapd, const u8 *data, size_t len); +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, + 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_notify_bss_transition_response( + struct hostapd_data *hapd, const u8 *addr, u8 dialog_token, u8 status_code, + u8 bss_termination_delay, const u8 *target_bssid, + const u8 *candidate_list, u16 candidate_list_len); +void hostapd_ubus_add(struct hapd_interfaces *interfaces); +void hostapd_ubus_free(struct hapd_interfaces *interfaces); +int hostapd_ubus_notify_bss_transition_query( + struct hostapd_data *hapd, const u8 *addr, u8 dialog_token, u8 reason, + const u8 *candidate_list, u16 candidate_list_len); +void hostapd_ubus_notify_authorized(struct hostapd_data *hapd, struct sta_info *sta, + const char *auth_alg); + +#else + +struct hostapd_ubus_bss {}; + +static inline void hostapd_ubus_add_iface(struct hostapd_iface *iface) +{ +} + +static inline void hostapd_ubus_free_iface(struct hostapd_iface *iface) +{ +} + +static inline void hostapd_ubus_add_bss(struct hostapd_data *hapd) +{ +} + +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; +} + +static inline void hostapd_ubus_handle_link_measurement(struct hostapd_data *hapd, const u8 *data, size_t len) +{ +} + +static inline void hostapd_ubus_notify(struct hostapd_data *hapd, const char *type, const u8 *mac) +{ +} + +static inline 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) +{ +} +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_notify_bss_transition_response( + struct hostapd_data *hapd, const u8 *addr, u8 dialog_token, u8 status_code, + u8 bss_termination_delay, const u8 *target_bssid, + const u8 *candidate_list, u16 candidate_list_len) +{ +} + +static inline void hostapd_ubus_add(struct hapd_interfaces *interfaces) +{ +} + +static inline void hostapd_ubus_free(struct hapd_interfaces *interfaces) +{ +} + +static inline int hostapd_ubus_notify_bss_transition_query( + struct hostapd_data *hapd, const u8 *addr, u8 dialog_token, u8 reason, + const u8 *candidate_list, u16 candidate_list_len) +{ + return 0; +} + +static inline void +hostapd_ubus_notify_authorized(struct hostapd_data *hapd, struct sta_info *sta, + const char *auth_alg) +{ +} + +#endif + +#endif diff --git a/package/network/services/hostapd/src/src/utils/ap/ucode.c b/package/network/services/hostapd/src/src/utils/ap/ucode.c new file mode 100644 index 00000000000000..68fb450884e2f3 --- /dev/null +++ b/package/network/services/hostapd/src/src/utils/ap/ucode.c @@ -0,0 +1,817 @@ +#include + +#include "utils/includes.h" +#include "utils/common.h" +#include "utils/ucode.h" +#include "hostapd.h" +#include "beacon.h" +#include "hw_features.h" +#include "ap_drv_ops.h" +#include "dfs.h" +#include "acs.h" +#include + +static uc_resource_type_t *global_type, *bss_type, *iface_type; +static struct hapd_interfaces *interfaces; +static uc_value_t *global, *bss_registry, *iface_registry; +static uc_vm_t *vm; + +static uc_value_t * +hostapd_ucode_bss_get_uval(struct hostapd_data *hapd) +{ + uc_value_t *val; + + if (hapd->ucode.idx) + return wpa_ucode_registry_get(bss_registry, hapd->ucode.idx); + + val = uc_resource_new(bss_type, hapd); + hapd->ucode.idx = wpa_ucode_registry_add(bss_registry, val); + + return val; +} + +static uc_value_t * +hostapd_ucode_iface_get_uval(struct hostapd_iface *hapd) +{ + uc_value_t *val; + + if (hapd->ucode.idx) + return wpa_ucode_registry_get(iface_registry, hapd->ucode.idx); + + val = uc_resource_new(iface_type, hapd); + hapd->ucode.idx = wpa_ucode_registry_add(iface_registry, val); + + return val; +} + +static void +hostapd_ucode_update_bss_list(struct hostapd_iface *iface, uc_value_t *if_bss, uc_value_t *bss) +{ + uc_value_t *list; + int i; + + list = ucv_array_new(vm); + for (i = 0; iface->bss && i < iface->num_bss; i++) { + struct hostapd_data *hapd = iface->bss[i]; + uc_value_t *val = hostapd_ucode_bss_get_uval(hapd); + + ucv_array_set(list, i, ucv_get(ucv_string_new(hapd->conf->iface))); + ucv_object_add(bss, hapd->conf->iface, ucv_get(val)); + } + ucv_object_add(if_bss, iface->phy, ucv_get(list)); +} + +static void +hostapd_ucode_update_interfaces(void) +{ + uc_value_t *ifs = ucv_object_new(vm); + uc_value_t *if_bss = ucv_array_new(vm); + uc_value_t *bss = ucv_object_new(vm); + int i; + + for (i = 0; i < interfaces->count; i++) { + struct hostapd_iface *iface = interfaces->iface[i]; + + ucv_object_add(ifs, iface->phy, ucv_get(hostapd_ucode_iface_get_uval(iface))); + hostapd_ucode_update_bss_list(iface, if_bss, bss); + } + + ucv_object_add(ucv_prototype_get(global), "interfaces", ucv_get(ifs)); + ucv_object_add(ucv_prototype_get(global), "interface_bss", ucv_get(if_bss)); + ucv_object_add(ucv_prototype_get(global), "bss", ucv_get(bss)); + ucv_gc(vm); +} + +static uc_value_t * +uc_hostapd_add_iface(uc_vm_t *vm, size_t nargs) +{ + uc_value_t *iface = uc_fn_arg(0); + char *data; + int ret; + + if (ucv_type(iface) != UC_STRING) + return ucv_int64_new(-1); + + data = strdup(ucv_string_get(iface)); + ret = hostapd_add_iface(interfaces, data); + free(data); + + hostapd_ucode_update_interfaces(); + + return ucv_int64_new(ret); +} + +static uc_value_t * +uc_hostapd_remove_iface(uc_vm_t *vm, size_t nargs) +{ + uc_value_t *iface = uc_fn_arg(0); + + if (ucv_type(iface) != UC_STRING) + return NULL; + + hostapd_remove_iface(interfaces, ucv_string_get(iface)); + hostapd_ucode_update_interfaces(); + + return NULL; +} + +static struct hostapd_vlan * +bss_conf_find_vlan(struct hostapd_bss_config *bss, int id) +{ + struct hostapd_vlan *vlan; + + for (vlan = bss->vlan; vlan; vlan = vlan->next) + if (vlan->vlan_id == id) + return vlan; + + return NULL; +} + +static int +bss_conf_rename_vlan(struct hostapd_data *hapd, struct hostapd_vlan *vlan, + const char *ifname) +{ + if (!strcmp(ifname, vlan->ifname)) + return 0; + + hostapd_drv_if_rename(hapd, WPA_IF_AP_VLAN, vlan->ifname, ifname); + os_strlcpy(vlan->ifname, ifname, sizeof(vlan->ifname)); + + return 0; +} + +static int +bss_reload_vlans(struct hostapd_data *hapd, struct hostapd_bss_config *bss) +{ + struct hostapd_bss_config *old_bss = hapd->conf; + struct hostapd_vlan *vlan, *vlan_new, *wildcard; + char ifname[IFNAMSIZ + 1], vlan_ifname[IFNAMSIZ + 1], *pos; + int ret; + + vlan = bss_conf_find_vlan(old_bss, VLAN_ID_WILDCARD); + wildcard = bss_conf_find_vlan(bss, VLAN_ID_WILDCARD); + if (!!vlan != !!wildcard) + return -1; + + if (vlan && wildcard && strcmp(vlan->ifname, wildcard->ifname) != 0) + strcpy(vlan->ifname, wildcard->ifname); + else + wildcard = NULL; + + for (vlan = bss->vlan; vlan; vlan = vlan->next) { + if (vlan->vlan_id == VLAN_ID_WILDCARD || + vlan->dynamic_vlan > 0) + continue; + + if (!bss_conf_find_vlan(old_bss, vlan->vlan_id)) + return -1; + } + + for (vlan = old_bss->vlan; vlan; vlan = vlan->next) { + if (vlan->vlan_id == VLAN_ID_WILDCARD) + continue; + + if (vlan->dynamic_vlan == 0) { + vlan_new = bss_conf_find_vlan(bss, vlan->vlan_id); + if (!vlan_new) + return -1; + + if (bss_conf_rename_vlan(hapd, vlan, vlan_new->ifname)) + return -1; + + continue; + } + + if (!wildcard) + continue; + + os_strlcpy(ifname, wildcard->ifname, sizeof(ifname)); + pos = os_strchr(ifname, '#'); + if (!pos) + return -1; + + *pos++ = '\0'; + ret = os_snprintf(vlan_ifname, sizeof(vlan_ifname), "%s%d%s", + ifname, vlan->vlan_id, pos); + if (os_snprintf_error(sizeof(vlan_ifname), ret)) + return -1; + + if (bss_conf_rename_vlan(hapd, vlan, vlan_ifname)) + return -1; + } + + return 0; +} + +static uc_value_t * +uc_hostapd_bss_set_config(uc_vm_t *vm, size_t nargs) +{ + struct hostapd_data *hapd = uc_fn_thisval("hostapd.bss"); + struct hostapd_bss_config *old_bss; + struct hostapd_iface *iface; + struct hostapd_config *conf; + uc_value_t *file = uc_fn_arg(0); + uc_value_t *index = uc_fn_arg(1); + uc_value_t *files_only = uc_fn_arg(2); + unsigned int i, idx = 0; + int ret = -1; + + if (!hapd || ucv_type(file) != UC_STRING) + goto out; + + if (ucv_type(index) == UC_INTEGER) + idx = ucv_int64_get(index); + + iface = hapd->iface; + conf = interfaces->config_read_cb(ucv_string_get(file)); + if (!conf) + goto out; + + if (idx > conf->num_bss || !conf->bss[idx]) + goto free; + + if (ucv_boolean_get(files_only)) { + struct hostapd_bss_config *bss = conf->bss[idx]; + struct hostapd_bss_config *old_bss = hapd->conf; + +#define swap_field(name) \ + do { \ + void *ptr = old_bss->name; \ + old_bss->name = bss->name; \ + bss->name = ptr; \ + } while (0) + + swap_field(ssid.wpa_psk_file); + ret = bss_reload_vlans(hapd, bss); + goto done; + } + + hostapd_bss_deinit_no_free(hapd); + hostapd_drv_stop_ap(hapd); + hostapd_free_hapd_data(hapd); + + old_bss = hapd->conf; + for (i = 0; i < iface->conf->num_bss; i++) + if (iface->conf->bss[i] == hapd->conf) + iface->conf->bss[i] = conf->bss[idx]; + hapd->conf = conf->bss[idx]; + conf->bss[idx] = old_bss; + + hostapd_setup_bss(hapd, hapd == iface->bss[0], true); + hostapd_ucode_update_interfaces(); + +done: + ret = 0; +free: + hostapd_config_free(conf); +out: + return ucv_int64_new(ret); +} + +static void +hostapd_remove_iface_bss_conf(struct hostapd_config *iconf, + struct hostapd_bss_config *conf) +{ + int i; + + for (i = 0; i < iconf->num_bss; i++) + if (iconf->bss[i] == conf) + break; + + if (i == iconf->num_bss) + return; + + for (i++; i < iconf->num_bss; i++) + iconf->bss[i - 1] = iconf->bss[i]; + iconf->num_bss--; +} + + +static uc_value_t * +uc_hostapd_bss_delete(uc_vm_t *vm, size_t nargs) +{ + struct hostapd_data *hapd = uc_fn_thisval("hostapd.bss"); + struct hostapd_iface *iface; + int i, idx; + + if (!hapd) + return NULL; + + iface = hapd->iface; + if (iface->num_bss == 1) { + wpa_printf(MSG_ERROR, "trying to delete last bss of an iface: %s\n", hapd->conf->iface); + return NULL; + } + + for (idx = 0; idx < iface->num_bss; idx++) + if (iface->bss[idx] == hapd) + break; + + if (idx == iface->num_bss) + return NULL; + + for (i = idx + 1; i < iface->num_bss; i++) + iface->bss[i - 1] = iface->bss[i]; + + iface->num_bss--; + + iface->bss[0]->interface_added = 0; + hostapd_drv_set_first_bss(iface->bss[0]); + hapd->interface_added = 1; + + hostapd_drv_stop_ap(hapd); + hostapd_bss_deinit(hapd); + hostapd_remove_iface_bss_conf(iface->conf, hapd->conf); + hostapd_config_free_bss(hapd->conf); + os_free(hapd); + + hostapd_ucode_update_interfaces(); + ucv_gc(vm); + + return NULL; +} + +static uc_value_t * +uc_hostapd_iface_add_bss(uc_vm_t *vm, size_t nargs) +{ + struct hostapd_iface *iface = uc_fn_thisval("hostapd.iface"); + struct hostapd_bss_config *bss; + struct hostapd_config *conf; + struct hostapd_data *hapd; + uc_value_t *file = uc_fn_arg(0); + uc_value_t *index = uc_fn_arg(1); + unsigned int idx = 0; + uc_value_t *ret = NULL; + + if (!iface || ucv_type(file) != UC_STRING) + goto out; + + if (ucv_type(index) == UC_INTEGER) + idx = ucv_int64_get(index); + + conf = interfaces->config_read_cb(ucv_string_get(file)); + if (!conf || idx > conf->num_bss || !conf->bss[idx]) + goto out; + + bss = conf->bss[idx]; + hapd = hostapd_alloc_bss_data(iface, iface->conf, bss); + if (!hapd) + goto out; + + hapd->driver = iface->bss[0]->driver; + hapd->drv_priv = iface->bss[0]->drv_priv; + if (interfaces->ctrl_iface_init && + interfaces->ctrl_iface_init(hapd) < 0) + goto free_hapd; + + if (iface->state == HAPD_IFACE_ENABLED && + hostapd_setup_bss(hapd, -1, true)) + goto deinit_ctrl; + + iface->bss = os_realloc_array(iface->bss, iface->num_bss + 1, + sizeof(*iface->bss)); + iface->bss[iface->num_bss++] = hapd; + + iface->conf->bss = os_realloc_array(iface->conf->bss, + iface->conf->num_bss + 1, + sizeof(*iface->conf->bss)); + iface->conf->bss[iface->conf->num_bss] = bss; + conf->bss[idx] = NULL; + ret = hostapd_ucode_bss_get_uval(hapd); + hostapd_ucode_update_interfaces(); + goto out; + +deinit_ctrl: + if (interfaces->ctrl_iface_deinit) + interfaces->ctrl_iface_deinit(hapd); +free_hapd: + hostapd_free_hapd_data(hapd); + os_free(hapd); +out: + hostapd_config_free(conf); + return ret; +} + +static uc_value_t * +uc_hostapd_iface_set_bss_order(uc_vm_t *vm, size_t nargs) +{ + struct hostapd_iface *iface = uc_fn_thisval("hostapd.iface"); + uc_value_t *bss_list = uc_fn_arg(0); + struct hostapd_data **new_bss; + struct hostapd_bss_config **new_conf; + + if (!iface) + return NULL; + + if (ucv_type(bss_list) != UC_ARRAY || + ucv_array_length(bss_list) != iface->num_bss) + return NULL; + + new_bss = calloc(iface->num_bss, sizeof(*new_bss)); + new_conf = calloc(iface->num_bss, sizeof(*new_conf)); + for (size_t i = 0; i < iface->num_bss; i++) { + struct hostapd_data *bss; + + bss = ucv_resource_data(ucv_array_get(bss_list, i), "hostapd.bss"); + if (bss->iface != iface) + goto free; + + for (size_t k = 0; k < i; k++) + if (new_bss[k] == bss) + goto free; + + new_bss[i] = bss; + new_conf[i] = bss->conf; + } + + new_bss[0]->interface_added = 0; + for (size_t i = 1; i < iface->num_bss; i++) + new_bss[i]->interface_added = 1; + + free(iface->bss); + iface->bss = new_bss; + + free(iface->conf->bss); + iface->conf->bss = new_conf; + iface->conf->num_bss = iface->num_bss; + hostapd_drv_set_first_bss(iface->bss[0]); + + return ucv_boolean_new(true); + +free: + free(new_bss); + free(new_conf); + return NULL; +} + +static uc_value_t * +uc_hostapd_bss_ctrl(uc_vm_t *vm, size_t nargs) +{ + struct hostapd_data *hapd = uc_fn_thisval("hostapd.bss"); + uc_value_t *arg = uc_fn_arg(0); + struct sockaddr_storage from = {}; + static char reply[4096]; + int reply_len; + + if (!hapd || !interfaces->ctrl_iface_recv || + ucv_type(arg) != UC_STRING) + return NULL; + + reply_len = interfaces->ctrl_iface_recv(hapd, ucv_string_get(arg), + reply, sizeof(reply), + &from, sizeof(from)); + if (reply_len < 0) + return NULL; + + if (reply_len && reply[reply_len - 1] == '\n') + reply_len--; + + return ucv_string_new_length(reply, reply_len); +} + +static void +uc_hostapd_disable_iface(struct hostapd_iface *iface) +{ + switch (iface->state) { + case HAPD_IFACE_DISABLED: + break; +#ifdef CONFIG_ACS + case HAPD_IFACE_ACS: + acs_cleanup(iface); + iface->scan_cb = NULL; + /* fallthrough */ +#endif + default: + hostapd_disable_iface(iface); + break; + } +} + +static uc_value_t * +uc_hostapd_iface_stop(uc_vm_t *vm, size_t nargs) +{ + struct hostapd_iface *iface = uc_fn_thisval("hostapd.iface"); + int i; + + if (!iface) + return NULL; + + if (iface->state != HAPD_IFACE_ENABLED) + uc_hostapd_disable_iface(iface); + + for (i = 0; i < iface->num_bss; i++) { + struct hostapd_data *hapd = iface->bss[i]; + + hostapd_drv_stop_ap(hapd); + hapd->beacon_set_done = 0; + } + + return NULL; +} + +static uc_value_t * +uc_hostapd_iface_start(uc_vm_t *vm, size_t nargs) +{ + struct hostapd_iface *iface = uc_fn_thisval("hostapd.iface"); + uc_value_t *info = uc_fn_arg(0); + struct hostapd_config *conf; + bool changed = false; + uint64_t intval; + int i; + + if (!iface) + return NULL; + + if (!info) { + iface->freq = 0; + goto out; + } + + if (ucv_type(info) != UC_OBJECT) + return NULL; + +#define UPDATE_VAL(field, name) \ + if ((intval = ucv_int64_get(ucv_object_get(info, name, NULL))) && \ + !errno && intval != conf->field) do { \ + conf->field = intval; \ + changed = true; \ + } while(0) + + conf = iface->conf; + UPDATE_VAL(op_class, "op_class"); + UPDATE_VAL(hw_mode, "hw_mode"); + UPDATE_VAL(channel, "channel"); + UPDATE_VAL(secondary_channel, "sec_channel"); + if (!changed && + (iface->bss[0]->beacon_set_done || + iface->state == HAPD_IFACE_DFS)) + return ucv_boolean_new(true); + + intval = ucv_int64_get(ucv_object_get(info, "center_seg0_idx", NULL)); + if (!errno) + hostapd_set_oper_centr_freq_seg0_idx(conf, intval); + + intval = ucv_int64_get(ucv_object_get(info, "center_seg1_idx", NULL)); + if (!errno) + hostapd_set_oper_centr_freq_seg1_idx(conf, intval); + + intval = ucv_int64_get(ucv_object_get(info, "oper_chwidth", NULL)); + if (!errno) + hostapd_set_oper_chwidth(conf, intval); + + intval = ucv_int64_get(ucv_object_get(info, "frequency", NULL)); + if (!errno) + iface->freq = intval; + else + iface->freq = 0; + conf->acs = 0; + +out: + switch (iface->state) { + case HAPD_IFACE_ENABLED: + if (!hostapd_is_dfs_required(iface) || + hostapd_is_dfs_chan_available(iface)) + break; + wpa_printf(MSG_INFO, "DFS CAC required on new channel, restart interface"); + /* fallthrough */ + default: + uc_hostapd_disable_iface(iface); + break; + } + + if (conf->channel && !iface->freq) + iface->freq = hostapd_hw_get_freq(iface->bss[0], conf->channel); + + if (iface->state != HAPD_IFACE_ENABLED) { + hostapd_enable_iface(iface); + return ucv_boolean_new(true); + } + + for (i = 0; i < iface->num_bss; i++) { + struct hostapd_data *hapd = iface->bss[i]; + int ret; + + hapd->conf->start_disabled = 0; + hostapd_set_freq(hapd, conf->hw_mode, iface->freq, + conf->channel, + conf->enable_edmg, + conf->edmg_channel, + conf->ieee80211n, + conf->ieee80211ac, + conf->ieee80211ax, + conf->ieee80211be, + conf->secondary_channel, + hostapd_get_oper_chwidth(conf), + hostapd_get_oper_centr_freq_seg0_idx(conf), + hostapd_get_oper_centr_freq_seg1_idx(conf)); + + ieee802_11_set_beacon(hapd); + } + + return ucv_boolean_new(true); +} + +static uc_value_t * +uc_hostapd_iface_switch_channel(uc_vm_t *vm, size_t nargs) +{ + struct hostapd_iface *iface = uc_fn_thisval("hostapd.iface"); + uc_value_t *info = uc_fn_arg(0); + struct hostapd_config *conf; + struct csa_settings csa = {}; + uint64_t intval; + int i, ret = 0; + + if (!iface || ucv_type(info) != UC_OBJECT) + return NULL; + + conf = iface->conf; + if ((intval = ucv_int64_get(ucv_object_get(info, "csa_count", NULL))) && !errno) + csa.cs_count = intval; + if ((intval = ucv_int64_get(ucv_object_get(info, "sec_channel", NULL))) && !errno) + csa.freq_params.sec_channel_offset = intval; + + csa.freq_params.ht_enabled = conf->ieee80211n; + csa.freq_params.vht_enabled = conf->ieee80211ac; + csa.freq_params.he_enabled = conf->ieee80211ax; +#ifdef CONFIG_IEEE80211BE + csa.freq_params.eht_enabled = conf->ieee80211be; +#endif + intval = ucv_int64_get(ucv_object_get(info, "oper_chwidth", NULL)); + if (errno) + intval = hostapd_get_oper_chwidth(conf); + if (intval) + csa.freq_params.bandwidth = 40 << intval; + else + csa.freq_params.bandwidth = csa.freq_params.sec_channel_offset ? 40 : 20; + + if ((intval = ucv_int64_get(ucv_object_get(info, "frequency", NULL))) && !errno) + csa.freq_params.freq = intval; + if ((intval = ucv_int64_get(ucv_object_get(info, "center_freq1", NULL))) && !errno) + csa.freq_params.center_freq1 = intval; + if ((intval = ucv_int64_get(ucv_object_get(info, "center_freq2", NULL))) && !errno) + csa.freq_params.center_freq2 = intval; + + for (i = 0; i < iface->num_bss; i++) + ret = hostapd_switch_channel(iface->bss[i], &csa); + + return ucv_boolean_new(!ret); +} + +static uc_value_t * +uc_hostapd_bss_rename(uc_vm_t *vm, size_t nargs) +{ + struct hostapd_data *hapd = uc_fn_thisval("hostapd.bss"); + uc_value_t *ifname_arg = uc_fn_arg(0); + char prev_ifname[IFNAMSIZ + 1]; + struct sta_info *sta; + const char *ifname; + int ret; + + if (!hapd || ucv_type(ifname_arg) != UC_STRING) + return NULL; + + os_strlcpy(prev_ifname, hapd->conf->iface, sizeof(prev_ifname)); + ifname = ucv_string_get(ifname_arg); + + hostapd_ubus_free_bss(hapd); + if (interfaces->ctrl_iface_deinit) + interfaces->ctrl_iface_deinit(hapd); + + ret = hostapd_drv_if_rename(hapd, WPA_IF_AP_BSS, NULL, ifname); + if (ret) + goto out; + + for (sta = hapd->sta_list; sta; sta = sta->next) { + char cur_name[IFNAMSIZ + 1], new_name[IFNAMSIZ + 1]; + + if (!(sta->flags & WLAN_STA_WDS) || sta->pending_wds_enable) + continue; + + snprintf(cur_name, sizeof(cur_name), "%s.sta%d", prev_ifname, sta->aid); + snprintf(new_name, sizeof(new_name), "%s.sta%d", ifname, sta->aid); + hostapd_drv_if_rename(hapd, WPA_IF_AP_VLAN, cur_name, new_name); + } + + if (!strncmp(hapd->conf->ssid.vlan, hapd->conf->iface, sizeof(hapd->conf->ssid.vlan))) + os_strlcpy(hapd->conf->ssid.vlan, ifname, sizeof(hapd->conf->ssid.vlan)); + os_strlcpy(hapd->conf->iface, ifname, sizeof(hapd->conf->iface)); + hostapd_ubus_add_bss(hapd); + + hostapd_ucode_update_interfaces(); +out: + if (interfaces->ctrl_iface_init) + interfaces->ctrl_iface_init(hapd); + + return ret ? NULL : ucv_boolean_new(true); +} + + +int hostapd_ucode_init(struct hapd_interfaces *ifaces) +{ + static const uc_function_list_t global_fns[] = { + { "printf", uc_wpa_printf }, + { "getpid", uc_wpa_getpid }, + { "sha1", uc_wpa_sha1 }, + { "freq_info", uc_wpa_freq_info }, + { "add_iface", uc_hostapd_add_iface }, + { "remove_iface", uc_hostapd_remove_iface }, + { "udebug_set", uc_wpa_udebug_set }, + }; + static const uc_function_list_t bss_fns[] = { + { "ctrl", uc_hostapd_bss_ctrl }, + { "set_config", uc_hostapd_bss_set_config }, + { "rename", uc_hostapd_bss_rename }, + { "delete", uc_hostapd_bss_delete }, + }; + static const uc_function_list_t iface_fns[] = { + { "set_bss_order", uc_hostapd_iface_set_bss_order }, + { "add_bss", uc_hostapd_iface_add_bss }, + { "stop", uc_hostapd_iface_stop }, + { "start", uc_hostapd_iface_start }, + { "switch_channel", uc_hostapd_iface_switch_channel }, + }; + uc_value_t *data, *proto; + + interfaces = ifaces; + vm = wpa_ucode_create_vm(); + + global_type = uc_type_declare(vm, "hostapd.global", global_fns, NULL); + bss_type = uc_type_declare(vm, "hostapd.bss", bss_fns, NULL); + iface_type = uc_type_declare(vm, "hostapd.iface", iface_fns, NULL); + + bss_registry = ucv_array_new(vm); + uc_vm_registry_set(vm, "hostap.bss_registry", bss_registry); + + iface_registry = ucv_array_new(vm); + uc_vm_registry_set(vm, "hostap.iface_registry", iface_registry); + + global = wpa_ucode_global_init("hostapd", global_type); + + if (wpa_ucode_run(HOSTAPD_UC_PATH "hostapd.uc")) + goto free_vm; + ucv_gc(vm); + + return 0; + +free_vm: + wpa_ucode_free_vm(); + return -1; +} + +void hostapd_ucode_free(void) +{ + if (wpa_ucode_call_prepare("shutdown") == 0) + ucv_put(wpa_ucode_call(0)); + wpa_ucode_free_vm(); +} + +void hostapd_ucode_free_iface(struct hostapd_iface *iface) +{ + wpa_ucode_registry_remove(iface_registry, iface->ucode.idx); +} + +void hostapd_ucode_add_bss(struct hostapd_data *hapd) +{ + uc_value_t *val; + + if (wpa_ucode_call_prepare("bss_add")) + return; + + val = hostapd_ucode_bss_get_uval(hapd); + uc_value_push(ucv_get(ucv_string_new(hapd->conf->iface))); + uc_value_push(ucv_get(val)); + ucv_put(wpa_ucode_call(2)); + ucv_gc(vm); +} + +void hostapd_ucode_reload_bss(struct hostapd_data *hapd) +{ + uc_value_t *val; + + if (wpa_ucode_call_prepare("bss_reload")) + return; + + val = hostapd_ucode_bss_get_uval(hapd); + uc_value_push(ucv_get(ucv_string_new(hapd->conf->iface))); + uc_value_push(ucv_get(val)); + ucv_put(wpa_ucode_call(2)); + ucv_gc(vm); +} + +void hostapd_ucode_free_bss(struct hostapd_data *hapd) +{ + uc_value_t *val; + + val = wpa_ucode_registry_remove(bss_registry, hapd->ucode.idx); + if (!val) + return; + + hapd->ucode.idx = 0; + if (wpa_ucode_call_prepare("bss_remove")) + return; + + uc_value_push(ucv_string_new(hapd->conf->iface)); + uc_value_push(ucv_get(val)); + ucv_put(wpa_ucode_call(2)); + ucv_gc(vm); +} diff --git a/package/network/services/hostapd/src/src/utils/ap/ucode.h b/package/network/services/hostapd/src/src/utils/ap/ucode.h new file mode 100644 index 00000000000000..d00b787169d104 --- /dev/null +++ b/package/network/services/hostapd/src/src/utils/ap/ucode.h @@ -0,0 +1,54 @@ +#ifndef __HOSTAPD_AP_UCODE_H +#define __HOSTAPD_AP_UCODE_H + +#include "utils/ucode.h" + +struct hostapd_data; + +struct hostapd_ucode_bss { +#ifdef UCODE_SUPPORT + int idx; +#endif +}; + +struct hostapd_ucode_iface { +#ifdef UCODE_SUPPORT + int idx; +#endif +}; + +#ifdef UCODE_SUPPORT + +int hostapd_ucode_init(struct hapd_interfaces *ifaces); + +void hostapd_ucode_free(void); +void hostapd_ucode_free_iface(struct hostapd_iface *iface); +void hostapd_ucode_add_bss(struct hostapd_data *hapd); +void hostapd_ucode_free_bss(struct hostapd_data *hapd); +void hostapd_ucode_reload_bss(struct hostapd_data *hapd); + +#else + +static inline int hostapd_ucode_init(struct hapd_interfaces *ifaces) +{ + return -EINVAL; +} +static inline void hostapd_ucode_free(void) +{ +} +static inline void hostapd_ucode_free_iface(struct hostapd_iface *iface) +{ +} +static inline void hostapd_ucode_reload_bss(struct hostapd_data *hapd) +{ +} +static inline void hostapd_ucode_add_bss(struct hostapd_data *hapd) +{ +} +static inline void hostapd_ucode_free_bss(struct hostapd_data *hapd) +{ +} + +#endif + +#endif From f8199d6b3d627d512515e5af5fadc7d0bdd798ff Mon Sep 17 00:00:00 2001 From: Rudy Andram Date: Sat, 31 Aug 2024 07:58:04 +0100 Subject: [PATCH 03/40] add 11be to both hostpad-full and wpa_supplicant configs --- .../hostapd/files/hostapd-full.config | 12 +++++------ .../hostapd/files/wpa_supplicant-full.config | 20 +++++++++---------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/package/network/services/hostapd/files/hostapd-full.config b/package/network/services/hostapd/files/hostapd-full.config index 6b17708e52585c..076c2bc6a02254 100644 --- a/package/network/services/hostapd/files/hostapd-full.config +++ b/package/network/services/hostapd/files/hostapd-full.config @@ -10,7 +10,7 @@ # to override previous values of the variables. # Driver interface for Host AP driver -#CONFIG_DRIVER_HOSTAP=y +CONFIG_DRIVER_HOSTAP=y # Driver interface for wired authenticator CONFIG_DRIVER_WIRED=y @@ -166,10 +166,10 @@ CONFIG_IEEE80211AC=y CONFIG_IEEE80211BE=y # Simultaneous Authentication of Equals (SAE), WPA3-Personal -#CONFIG_SAE=y +CONFIG_SAE=y # SAE Public Key, WPA3-Personal -#CONFIG_SAE_PK=y +CONFIG_SAE_PK=y # Remove debugging code that is printing out debug messages to stdout. # This can be used to reduce the size of the hostapd considerably if debugging @@ -289,7 +289,7 @@ CONFIG_TLS=internal # TLS-based EAP methods require at least TLS v1.0. Newer version of TLS (v1.2) # can be enabled to enable use of stronger crypto algorithms. -#CONFIG_TLSV12=y +CONFIG_TLSV12=y # Select which ciphers to use by default with OpenSSL if the user does not # specify them. @@ -323,7 +323,7 @@ CONFIG_HS20=y #CONFIG_SQLITE=y # Enable Fast Session Transfer (FST) -#CONFIG_FST=y +CONFIG_FST=y # Enable CLI commands for FST testing #CONFIG_FST_TEST=y @@ -363,7 +363,7 @@ CONFIG_HS20=y # Multiband Operation support # These extensions facilitate efficient use of multiple frequency bands # available to the AP and the devices that may associate with it. -#CONFIG_MBO=y +CONFIG_MBO=y # Client Taxonomy # Has the AP retain the Probe Request and (Re)Association Request frames from diff --git a/package/network/services/hostapd/files/wpa_supplicant-full.config b/package/network/services/hostapd/files/wpa_supplicant-full.config index 7a05b88de704d5..01c402d9e7c162 100644 --- a/package/network/services/hostapd/files/wpa_supplicant-full.config +++ b/package/network/services/hostapd/files/wpa_supplicant-full.config @@ -252,10 +252,10 @@ CONFIG_CTRL_IFACE=y #CONFIG_NO_WPA_PASSPHRASE=y # Simultaneous Authentication of Equals (SAE), WPA3-Personal -#CONFIG_SAE=y +CONFIG_SAE=y # SAE Public Key, WPA3-Personal -#CONFIG_SAE_PK=y +CONFIG_SAE_PK=y # Disable scan result processing (ap_scan=1) to save code size by about 1 kB. # This can be used if ap_scan=1 mode is never enabled. @@ -517,12 +517,12 @@ CONFIG_HS20=y # should be noted that this is mainly aimed at simple cases like # WPA2-Personal while more complex configurations like WPA2-Enterprise with an # external RADIUS server can be supported with hostapd. -#CONFIG_AP=y +CONFIG_AP=y # P2P (Wi-Fi Direct) # This can be used to enable P2P support in wpa_supplicant. See README-P2P for # more information on P2P operations. -#CONFIG_P2P=y +CONFIG_P2P=y # Enable TDLS support #CONFIG_TDLS=y @@ -530,7 +530,7 @@ CONFIG_HS20=y # Wi-Fi Display # This can be used to enable Wi-Fi Display extensions for P2P using an external # program to control the additional information exchanges in the messages. -#CONFIG_WIFI_DISPLAY=y +CONFIG_WIFI_DISPLAY=y # Autoscan # This can be used to enable automatic scan support in wpa_supplicant. @@ -553,7 +553,7 @@ CONFIG_HS20=y #CONFIG_EXT_PASSWORD_FILE=y # Enable Fast Session Transfer (FST) -#CONFIG_FST=y +CONFIG_FST=y # Enable CLI commands for FST testing #CONFIG_FST_TEST=y @@ -588,7 +588,7 @@ CONFIG_HS20=y #CONFIG_ACS=y # Support Multi Band Operation -#CONFIG_MBO=y +CONFIG_MBO=y # Fast Initial Link Setup (FILS) (IEEE 802.11ai) CONFIG_FILS=y @@ -613,14 +613,14 @@ CONFIG_IBSS_RSN=y # operations for roaming within an ESS (same SSID). See the bgscan parameter in # the wpa_supplicant.conf file for more details. # Periodic background scans based on signal strength -#CONFIG_BGSCAN_SIMPLE=y +CONFIG_BGSCAN_SIMPLE=y # Learn channels used by the network and try to avoid bgscans on other # channels (experimental) -#CONFIG_BGSCAN_LEARN=y +CONFIG_BGSCAN_LEARN=y # Opportunistic Wireless Encryption (OWE) # Experimental implementation of draft-harkins-owe-07.txt -#CONFIG_OWE=y +CONFIG_OWE=y # Device Provisioning Protocol (DPP) (also known as Wi-Fi Easy Connect) #CONFIG_DPP=y From 9ac402585fabdd65fa87c5c4a81814c784d7f79a Mon Sep 17 00:00:00 2001 From: Rudy Andram Date: Tue, 3 Sep 2024 09:51:31 +0100 Subject: [PATCH 04/40] Update mac80211.sh - mac80211 be and eht support --- .../files/lib/netifd/wireless/mac80211.sh | 181 ++++++++++-------- 1 file changed, 105 insertions(+), 76 deletions(-) diff --git a/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh b/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh index 0079c498e765b4..b9f5582146c701 100755 --- a/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh +++ b/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh @@ -159,77 +159,79 @@ mac80211_hostapd_setup_base() { chan_ofs=0 [ "$band" = "6g" ] && chan_ofs=1 - ieee80211n=1 - ht_capab= - case "$htmode" in - VHT20|HT20|HE20) ;; - HT40*|VHT40|VHT80|VHT160|HE40|HE80|HE160) - case "$hwmode" in - a) - case "$(( (($channel / 4) + $chan_ofs) % 2 ))" in - 1) ht_capab="[HT40+]";; - 0) ht_capab="[HT40-]";; - esac - ;; - *) - case "$htmode" in - HT40+) ht_capab="[HT40+]";; - HT40-) ht_capab="[HT40-]";; - *) - if [ "$channel" -lt 7 ]; then - ht_capab="[HT40+]" - else - ht_capab="[HT40-]" - fi - ;; - esac - ;; - esac - [ "$auto_channel" -gt 0 ] && ht_capab="[HT40+]" - ;; - *) ieee80211n= ;; - esac - - [ -n "$ieee80211n" ] && { - append base_cfg "ieee80211n=1" "$N" - - set_default ht_coex 0 - append base_cfg "ht_coex=$ht_coex" "$N" - - json_get_vars \ - ldpc:1 \ - greenfield:0 \ - short_gi_20:1 \ - short_gi_40:1 \ - tx_stbc:1 \ - rx_stbc:3 \ - max_amsdu:1 \ - dsss_cck_40:1 - - ht_cap_mask=0 - for cap in $(iw phy "$phy" info | grep 'Capabilities:' | cut -d: -f2); do - ht_cap_mask="$(($ht_cap_mask | $cap))" - done + if [ "$band" != "6g" ]; then + ieee80211n=1 + ht_capab= + case "$htmode" in + VHT20|HT20|HE20|EHT20) ;; + HT40*|VHT40|VHT80|VHT160|HE40|HE80|HE160|EHT40|EHT80|EHT160) + case "$hwmode" in + a) + case "$(( (($channel / 4) + $chan_ofs) % 2 ))" in + 1) ht_capab="[HT40+]";; + 0) ht_capab="[HT40-]";; + esac + ;; + *) + case "$htmode" in + HT40+) ht_capab="[HT40+]";; + HT40-) ht_capab="[HT40-]";; + *) + if [ "$channel" -lt 7 ]; then + ht_capab="[HT40+]" + else + ht_capab="[HT40-]" + fi + ;; + esac + ;; + esac + [ "$auto_channel" -gt 0 ] && ht_capab="[HT40+]" + ;; + *) ieee80211n= ;; + esac - cap_rx_stbc=$((($ht_cap_mask >> 8) & 3)) - [ "$rx_stbc" -lt "$cap_rx_stbc" ] && cap_rx_stbc="$rx_stbc" - ht_cap_mask="$(( ($ht_cap_mask & ~(0x300)) | ($cap_rx_stbc << 8) ))" - - mac80211_add_capabilities ht_capab_flags $ht_cap_mask \ - LDPC:0x1::$ldpc \ - GF:0x10::$greenfield \ - SHORT-GI-20:0x20::$short_gi_20 \ - SHORT-GI-40:0x40::$short_gi_40 \ - TX-STBC:0x80::$tx_stbc \ - RX-STBC1:0x300:0x100:1 \ - RX-STBC12:0x300:0x200:1 \ - RX-STBC123:0x300:0x300:1 \ - MAX-AMSDU-7935:0x800::$max_amsdu \ - DSSS_CCK-40:0x1000::$dsss_cck_40 - - ht_capab="$ht_capab$ht_capab_flags" - [ -n "$ht_capab" ] && append base_cfg "ht_capab=$ht_capab" "$N" - } + [ -n "$ieee80211n" ] && { + append base_cfg "ieee80211n=1" "$N" + + set_default ht_coex 0 + append base_cfg "ht_coex=$ht_coex" "$N" + + json_get_vars \ + ldpc:1 \ + greenfield:0 \ + short_gi_20:1 \ + short_gi_40:1 \ + tx_stbc:1 \ + rx_stbc:3 \ + max_amsdu:1 \ + dsss_cck_40:1 + + ht_cap_mask=0 + for cap in $(iw phy "$phy" info | grep 'Capabilities:' | cut -d: -f2); do + ht_cap_mask="$(($ht_cap_mask | $cap))" + done + + cap_rx_stbc=$((($ht_cap_mask >> 8) & 3)) + [ "$rx_stbc" -lt "$cap_rx_stbc" ] && cap_rx_stbc="$rx_stbc" + ht_cap_mask="$(( ($ht_cap_mask & ~(0x300)) | ($cap_rx_stbc << 8) ))" + + mac80211_add_capabilities ht_capab_flags $ht_cap_mask \ + LDPC:0x1::$ldpc \ + GF:0x10::$greenfield \ + SHORT-GI-20:0x20::$short_gi_20 \ + SHORT-GI-40:0x40::$short_gi_40 \ + TX-STBC:0x80::$tx_stbc \ + RX-STBC1:0x300:0x100:1 \ + RX-STBC12:0x300:0x200:1 \ + RX-STBC123:0x300:0x300:1 \ + MAX-AMSDU-7935:0x800::$max_amsdu \ + DSSS_CCK-40:0x1000::$dsss_cck_40 + + ht_capab="$ht_capab$ht_capab_flags" + [ -n "$ht_capab" ] && append base_cfg "ht_capab=$ht_capab" "$N" + } + fi # 802.11ac enable_ac=0 @@ -238,8 +240,8 @@ mac80211_hostapd_setup_base() { idx="$channel" case "$htmode" in - VHT20|HE20) enable_ac=1;; - VHT40|HE40) + VHT20|HE20|EHT20) enable_ac=1;; + VHT40|HE40|EHT40) case "$(( (($channel / 4) + $chan_ofs) % 2 ))" in 1) idx=$(($channel + 2));; 0) idx=$(($channel - 2));; @@ -247,7 +249,7 @@ mac80211_hostapd_setup_base() { enable_ac=1 vht_center_seg0=$idx ;; - VHT80|HE80) + VHT80|HE80|EHT80) case "$(( (($channel / 4) + $chan_ofs) % 4 ))" in 1) idx=$(($channel + 6));; 2) idx=$(($channel + 2));; @@ -258,7 +260,7 @@ mac80211_hostapd_setup_base() { vht_oper_chwidth=1 vht_center_seg0=$idx ;; - VHT160|HE160) + VHT160|HE160|EHT160|EHT320) if [ "$band" = "6g" ]; then case "$channel" in 1|5|9|13|17|21|25|29) idx=15;; @@ -286,15 +288,32 @@ mac80211_hostapd_setup_base() { [ "$background_radar" -eq 1 ] && append base_cfg "enable_background_radar=1" "$N" } + + eht_oper_chwidth=$vht_oper_chwidth + eht_center_seg0=$vht_center_seg0 + [ "$band" = "6g" ] && { op_class= case "$htmode" in - HE20) op_class=131;; - HE*) op_class=$((132 + $vht_oper_chwidth)) + HE20|EHT20) op_class=131;; + EHT320) + case "$channel" in + 1|5|9|13|17|21|25|29|33|37|41|45|49|53|57|61) idx=31;; + 65|69|73|77|81|85|89|93|97|101|105|109|113|117|121|125) idx=95;; + 129|133|137|141|145|149|153|157|161|165|169|173|177|181|185|189) idx=159;; + 193|197|201|205|209|213|217|221) idx=191;; + esac + + op_class=137 + eht_center_seg0=$idx + eht_oper_chwidth=9 + ;; + HE*|EHT*) op_class=$((132 + $vht_oper_chwidth)) esac [ -n "$op_class" ] && append base_cfg "op_class=$op_class" "$N" } [ "$hwmode" = "a" ] || enable_ac=0 + [ "$band" = "6g" ] && enable_ac=0 if [ "$enable_ac" != "0" ]; then json_get_vars \ @@ -417,8 +436,10 @@ mac80211_hostapd_setup_base() { # 802.11ax enable_ax=0 + enable_be=0 case "$htmode" in HE*) enable_ax=1 ;; + EHT*) enable_ax=1; enable_be=1 ;; esac if [ "$enable_ax" != "0" ]; then @@ -492,6 +513,14 @@ mac80211_hostapd_setup_base() { append base_cfg "he_mu_edca_ac_vo_timer=255" "$N" fi + if [ "$enable_be" != "0" ]; then + append base_cfg "ieee80211be=1" "$N" + [ "$hwmode" = "a" ] && { + append base_cfg "eht_oper_chwidth=$eht_oper_chwidth" "$N" + append base_cfg "eht_oper_centr_freq_seg0_idx=$eht_center_seg0" "$N" + } + fi + hostapd_prepare_device_config "$hostapd_conf_file" nl80211 cat >> "$hostapd_conf_file" < Date: Wed, 4 Sep 2024 05:17:57 +0100 Subject: [PATCH 05/40] additional changes for 11be support --- .../wifi-scripts/files/lib/netifd/wireless/mac80211.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh b/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh index b9f5582146c701..36cd65b315945d 100755 --- a/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh +++ b/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh @@ -515,10 +515,13 @@ mac80211_hostapd_setup_base() { if [ "$enable_be" != "0" ]; then append base_cfg "ieee80211be=1" "$N" - [ "$hwmode" = "a" ] && { - append base_cfg "eht_oper_chwidth=$eht_oper_chwidth" "$N" + case "$htmode" in + EHT*) + append base_cfg "eht_oper_chwidth=$eht_oper_chwidth" "$N" append base_cfg "eht_oper_centr_freq_seg0_idx=$eht_center_seg0" "$N" - } + append base_cfg "country3=0x49" "$N" + ;; + esac fi hostapd_prepare_device_config "$hostapd_conf_file" nl80211 From 3a42728ff3f4325b6e9963a6305b418687e02d49 Mon Sep 17 00:00:00 2001 From: Rudy Andram Date: Thu, 5 Sep 2024 18:59:00 +0100 Subject: [PATCH 06/40] sync with latest hostapd, MT76 changes; additionally changed governor to ondemand --- feeds.conf.default | 1 + package/kernel/mt76/Makefile | 2 +- package/network/services/hostapd/Makefile | 6 +++--- target/linux/mediatek/filogic/config-6.6 | 10 ++++------ 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/feeds.conf.default b/feeds.conf.default index fc679335e0e47f..f538346e86730f 100644 --- a/feeds.conf.default +++ b/feeds.conf.default @@ -6,3 +6,4 @@ src-git telephony https://git.openwrt.org/feed/telephony.git #src-git targets https://github.com/openwrt/targets.git #src-git oldpackages http://git.openwrt.org/packages.git #src-link custom /usr/src/openwrt/custom-feed +src-git mtk_openwrt_feed https://git01.mediatek.com/openwrt/feeds/mtk-openwrt-feeds diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile index 41e108fbb7fdce..46fbcfbd9a4c41 100644 --- a/package/kernel/mt76/Makefile +++ b/package/kernel/mt76/Makefile @@ -10,7 +10,7 @@ PKG_SOURCE_URL:=https://github.com/rmandrad/mt76 PKG_SOURCE_PROTO:=git PKG_SOURCE_DATE:=2024-08-27 -PKG_SOURCE_VERSION:=86441173c39f5ea147948f2b8703cf46c986463c +PKG_SOURCE_VERSION:=97fdd6d61a55398d891f6ffd87344acc3f92df97 PKG_MIRROR_HASH:=025750d2c4269434673085d94c929fd1d82c4ef54e9ab3995e4927ec28922375 PKG_MAINTAINER:=Felix Fietkau diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile index 942e5aa051778e..afcae0d56a7ec3 100644 --- a/package/network/services/hostapd/Makefile +++ b/package/network/services/hostapd/Makefile @@ -9,9 +9,9 @@ PKG_RELEASE:=3 PKG_SOURCE_URL:=https://github.com/rmandrad/hostapd PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2024-03-09 -PKG_SOURCE_VERSION:=fc77a7d6c634d2135a4f3c6a1333026b18d03162 -PKG_MIRROR_HASH:=21a606c3d00ddc3be9f81f264147dc7bbc6edcda57c79a862e251da6297dc10e +PKG_SOURCE_DATE:=2024-09-04 +PKG_SOURCE_VERSION:=4ba8a41f80929ffcaa81d31ef32a3d1e3a5f37e3 +PKG_MIRROR_HASH:=89b2fa74560b1a99963fc08352088b31ff8696c058cefd570fa5b5eb6308869c PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=BSD-3-Clause diff --git a/target/linux/mediatek/filogic/config-6.6 b/target/linux/mediatek/filogic/config-6.6 index 818bcfa081ea76..b9db5c339a2435 100644 --- a/target/linux/mediatek/filogic/config-6.6 +++ b/target/linux/mediatek/filogic/config-6.6 @@ -32,7 +32,6 @@ CONFIG_ARM64_VA_BITS_39=y CONFIG_ARM_AMBA=y CONFIG_ARM_ARCH_TIMER=y CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y -# CONFIG_ARM_CORESIGHT_PMU_ARCH_SYSTEM_PMU is not set CONFIG_ARM_GIC=y CONFIG_ARM_GIC_V2M=y CONFIG_ARM_GIC_V3=y @@ -42,7 +41,6 @@ CONFIG_ARM_MEDIATEK_CPUFREQ=y CONFIG_ARM_PMU=y CONFIG_ARM_PMUV3=y CONFIG_ARM_PSCI_FW=y -# CONFIG_ARM_SMMU_V3_PMU is not set CONFIG_ATA=y CONFIG_AUDIT_ARCH_COMPAT_GENERIC=y CONFIG_BLK_DEV_LOOP=y @@ -86,8 +84,8 @@ CONFIG_CONSOLE_LOGLEVEL_DEFAULT=15 CONFIG_CONTEXT_TRACKING=y CONFIG_CONTEXT_TRACKING_IDLE=y CONFIG_CPU_FREQ=y +CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y # CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set -CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE=y CONFIG_CPU_FREQ_GOV_ATTR_SET=y CONFIG_CPU_FREQ_GOV_COMMON=y CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y @@ -98,6 +96,7 @@ CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y CONFIG_CPU_FREQ_GOV_USERSPACE=y CONFIG_CPU_FREQ_STAT=y CONFIG_CPU_LITTLE_ENDIAN=y +CONFIG_CPU_MITIGATIONS=y CONFIG_CPU_RMAP=y CONFIG_CPU_THERMAL=y CONFIG_CRC16=y @@ -168,8 +167,7 @@ CONFIG_FUNCTION_ALIGNMENT_4B=y CONFIG_FWNODE_MDIO=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC11_NO_ARRAY_BOUNDS=y -CONFIG_GCC_ASM_GOTO_OUTPUT_WORKAROUND=y +CONFIG_GCC10_NO_ARRAY_BOUNDS=y CONFIG_GCC_SUPPORTS_DYNAMIC_FTRACE_WITH_ARGS=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_ARCH_TOPOLOGY=y @@ -279,6 +277,7 @@ CONFIG_MTK_HSDMA=y CONFIG_MTK_INFRACFG=y CONFIG_MTK_LVTS_THERMAL=y CONFIG_MTK_LVTS_THERMAL_DEBUGFS=y +CONFIG_MTK_NET_PHYLIB=y CONFIG_MTK_PMIC_WRAP=y CONFIG_MTK_REGULATOR_COUPLER=y CONFIG_MTK_SCPSYS=y @@ -331,7 +330,6 @@ CONFIG_PAGE_POOL=y CONFIG_PAGE_POOL_STATS=y CONFIG_PAGE_SIZE_LESS_THAN_256KB=y CONFIG_PAGE_SIZE_LESS_THAN_64KB=y -CONFIG_PAHOLE_HAS_LANG_EXCLUDE=y CONFIG_PARTITION_PERCPU=y CONFIG_PCI=y CONFIG_PCIEAER=y From c6ba1f9e5bcabc02ba14f035235f61e0b4bcc3af Mon Sep 17 00:00:00 2001 From: Rudy Andram Date: Sat, 7 Sep 2024 05:09:38 +0100 Subject: [PATCH 07/40] update to latest hostapd; mt76 and wireless-regdb --- feeds.conf.default | 2 +- .../patches/600-world-regd-6GHz.patch | 25 +++++++++++++++++++ .../patches/700-world-regd-5G_UNII-4.patch | 24 ++++++++++++++++++ .../patches/999-add-country-vv.patch | 18 +++++++++++++ package/kernel/mt76/Makefile | 4 +-- package/network/services/hostapd/Makefile | 4 +-- 6 files changed, 72 insertions(+), 5 deletions(-) create mode 100644 package/firmware/wireless-regdb/patches/600-world-regd-6GHz.patch create mode 100644 package/firmware/wireless-regdb/patches/700-world-regd-5G_UNII-4.patch create mode 100644 package/firmware/wireless-regdb/patches/999-add-country-vv.patch diff --git a/feeds.conf.default b/feeds.conf.default index f538346e86730f..2d1f8ac0e68e47 100644 --- a/feeds.conf.default +++ b/feeds.conf.default @@ -6,4 +6,4 @@ src-git telephony https://git.openwrt.org/feed/telephony.git #src-git targets https://github.com/openwrt/targets.git #src-git oldpackages http://git.openwrt.org/packages.git #src-link custom /usr/src/openwrt/custom-feed -src-git mtk_openwrt_feed https://git01.mediatek.com/openwrt/feeds/mtk-openwrt-feeds +#src-git mtk_openwrt_feed https://git01.mediatek.com/openwrt/feeds/mtk-openwrt-feeds diff --git a/package/firmware/wireless-regdb/patches/600-world-regd-6GHz.patch b/package/firmware/wireless-regdb/patches/600-world-regd-6GHz.patch new file mode 100644 index 00000000000000..34e6369b90b7fa --- /dev/null +++ b/package/firmware/wireless-regdb/patches/600-world-regd-6GHz.patch @@ -0,0 +1,25 @@ +diff --git a/db.txt b/db.txt +index 4f36062..0d7a170 100644 +--- a/db.txt ++++ b/db.txt +@@ -26,6 +26,8 @@ country 00: + (5490 - 5730 @ 160), (20), NO-IR, DFS + # Channel 149 - 165 + (5735 - 5835 @ 80), (20), NO-IR ++ # WiFi 6E ++ (5925 - 7125 @ 320), (12), NO-OUTDOOR + # IEEE 802.11ad (60GHz), channels 1..3 + (57240 - 63720 @ 2160), (0) + +@@ -1727,7 +1729,7 @@ country US: DFS-FCC + (5850 - 5895 @ 40), (27), NO-OUTDOOR, AUTO-BW, NO-IR + # 6g band + # https://www.federalregister.gov/documents/2020/05/26/2020-11236/unlicensed-use-of-the-6ghz-band +- (5925 - 7125 @ 320), (12), NO-OUTDOOR, NO-IR ++ (5925 - 7125 @ 320), (12), NO-OUTDOOR + # 60g band + # reference: section IV-D https://docs.fcc.gov/public/attachments/FCC-16-89A1.pdf + # channels 1-6 EIRP=40dBm(43dBm peak) +-- +2.36.1 + diff --git a/package/firmware/wireless-regdb/patches/700-world-regd-5G_UNII-4.patch b/package/firmware/wireless-regdb/patches/700-world-regd-5G_UNII-4.patch new file mode 100644 index 00000000000000..38660bad1db404 --- /dev/null +++ b/package/firmware/wireless-regdb/patches/700-world-regd-5G_UNII-4.patch @@ -0,0 +1,24 @@ +diff --git a/db.txt b/db.txt +index 949c8d4..f20956b 100644 +--- a/db.txt ++++ b/db.txt +@@ -24,8 +24,8 @@ country 00: + (5250 - 5330 @ 80), (20), NO-IR, DFS, AUTO-BW + # Channel 100 - 144 + (5490 - 5730 @ 160), (20), NO-IR, DFS +- # Channel 149 - 165 +- (5735 - 5835 @ 80), (20), NO-IR ++ # Channel 149 - 177 ++ (5735 - 5895 @ 160), (20), NO-IR + # WiFi 6E + (5925 - 7125 @ 320), (12), NO-OUTDOOR + # IEEE 802.11ad (60GHz), channels 1..3 +@@ -1759,7 +1759,7 @@ country US: DFS-FCC + (5730 - 5850 @ 80), (30), AUTO-BW + # https://www.federalregister.gov/documents/2021/05/03/2021-08802/use-of-the-5850-5925-ghz-band + # max. 33 dBm AP @ 20MHz, 36 dBm AP @ 40Mhz+, 6 dB less for clients +- (5850 - 5895 @ 40), (27), NO-OUTDOOR, AUTO-BW, NO-IR ++ (5850 - 5895 @ 40), (27), NO-OUTDOOR, AUTO-BW + # 6g band + # https://www.federalregister.gov/documents/2020/05/26/2020-11236/unlicensed-use-of-the-6ghz-band + (5925 - 7125 @ 320), (12), NO-OUTDOOR diff --git a/package/firmware/wireless-regdb/patches/999-add-country-vv.patch b/package/firmware/wireless-regdb/patches/999-add-country-vv.patch new file mode 100644 index 00000000000000..467dea7a845867 --- /dev/null +++ b/package/firmware/wireless-regdb/patches/999-add-country-vv.patch @@ -0,0 +1,18 @@ +diff --git a/db.txt b/db.txt +index 3e442ba4..75642b04 100644 +--- a/db.txt ++++ b/db.txt +@@ -1698,3 +1698,13 @@ country ZW: DFS-ETSI + (5250 - 5330 @ 80), (20), DFS, AUTO-BW + (5490 - 5710 @ 160), (27), DFS + ++country VV: ++ # Channel 1 - 14. ++ (2402 - 2494 @ 40), (30) ++ # Channel 184 - 196 ++ (4910 - 4990 @ 80), (30) ++ # Channel 36 - 177 ++ (5150 - 5895 @ 160), (30) ++ (5030 - 5090 @ 20), (30) ++ # WiFi 6E ++ (5925 - 7125 @ 320), (200 mW), NO-OUTDOOR diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile index 46fbcfbd9a4c41..10030398e9e159 100644 --- a/package/kernel/mt76/Makefile +++ b/package/kernel/mt76/Makefile @@ -9,9 +9,9 @@ PKG_LICENSE_FILES:= PKG_SOURCE_URL:=https://github.com/rmandrad/mt76 PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2024-08-27 +PKG_SOURCE_DATE:=2024-09-05 PKG_SOURCE_VERSION:=97fdd6d61a55398d891f6ffd87344acc3f92df97 -PKG_MIRROR_HASH:=025750d2c4269434673085d94c929fd1d82c4ef54e9ab3995e4927ec28922375 +PKG_MIRROR_HASH:=decd9901d7a82d570faa52cc02ea8fa47f252e2e320f04170faa5e19b5bfb21f PKG_MAINTAINER:=Felix Fietkau PKG_USE_NINJA:=0 diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile index afcae0d56a7ec3..232e084b0af982 100644 --- a/package/network/services/hostapd/Makefile +++ b/package/network/services/hostapd/Makefile @@ -10,8 +10,8 @@ PKG_RELEASE:=3 PKG_SOURCE_URL:=https://github.com/rmandrad/hostapd PKG_SOURCE_PROTO:=git PKG_SOURCE_DATE:=2024-09-04 -PKG_SOURCE_VERSION:=4ba8a41f80929ffcaa81d31ef32a3d1e3a5f37e3 -PKG_MIRROR_HASH:=89b2fa74560b1a99963fc08352088b31ff8696c058cefd570fa5b5eb6308869c +PKG_SOURCE_VERSION:=9907c324a0846f3a4899133b9f08ebefb0719ca5 +PKG_MIRROR_HASH:=32deaa53c684be89f9bd69398595d1f539278a1aecb3a3bf605078fe932e2bc3 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=BSD-3-Clause From d292705e801d3b4de1568e37aa1f022fdbff92e4 Mon Sep 17 00:00:00 2001 From: Rudy Andram Date: Sat, 7 Sep 2024 05:27:23 +0100 Subject: [PATCH 08/40] Revert "hostapd: ensure that interface name is not null" This reverts commit d760576132a1c37d0f533597b1742186d8692319. --- package/network/services/hostapd/Makefile | 2 +- ...80-Implement-APuP-Access-Point-Micro-Peering.patch | 11 ++++------- ...P-add-ubus-notification-when-a-peer-comes-up.patch | 2 +- ...APuP-add-ucode-hook-for-when-a-peer-comes-up.patch | 2 +- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile index 8143776a8415d5..232e084b0af982 100644 --- a/package/network/services/hostapd/Makefile +++ b/package/network/services/hostapd/Makefile @@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=hostapd -PKG_RELEASE:=4 +PKG_RELEASE:=3 PKG_SOURCE_URL:=https://github.com/rmandrad/hostapd PKG_SOURCE_PROTO:=git diff --git a/package/network/services/hostapd/patches/780-Implement-APuP-Access-Point-Micro-Peering.patch b/package/network/services/hostapd/patches/780-Implement-APuP-Access-Point-Micro-Peering.patch index 08cacd88fd551b..f2727a6feee25c 100644 --- a/package/network/services/hostapd/patches/780-Implement-APuP-Access-Point-Micro-Peering.patch +++ b/package/network/services/hostapd/patches/780-Implement-APuP-Access-Point-Micro-Peering.patch @@ -1,4 +1,4 @@ -From 806c84ac8e8f60eaec22772b627f85eb5ac13544 Mon Sep 17 00:00:00 2001 +From 40041ecea334c0106c0e840a32aef92b0cbb004b Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Mon, 6 May 2024 13:53:48 +0200 Subject: [PATCH 1/3] Implement APuP Access Point Micro Peering @@ -18,14 +18,11 @@ automatically if wds_bridge is not an empty string), or feeded to a routing daemon. Signed-off-by: Gioacchino Mazzurco -Reviewed-by: Hauke Mehrtens -Reviewed-by: Moritz Warning -Hotfix-by: Sebastian Gottschall https://github.com/mirror/dd-wrt/commit/0c3001a69e8d8300569e416de856c96e903ad130 --- hostapd/Makefile | 5 ++ hostapd/config_file.c | 9 +++ src/ap/ap_config.h | 29 +++++++ - src/ap/ap_drv_ops.c | 28 ++++++- + src/ap/ap_drv_ops.c | 26 ++++++ src/ap/ap_drv_ops.h | 3 + src/ap/apup.c | 152 +++++++++++++++++++++++++++++++++++ src/ap/apup.h | 24 ++++++ @@ -33,7 +30,7 @@ Hotfix-by: Sebastian Gottschall https://github.com/mirror/dd-wrt/commit/0c3001a6 src/ap/ieee802_11.h | 2 + src/drivers/driver.h | 2 +- src/drivers/driver_nl80211.c | 14 +--- - 11 files changed, 265 insertions(+), 17 deletions(-) + 11 files changed, 264 insertions(+), 16 deletions(-) create mode 100644 src/ap/apup.c create mode 100644 src/ap/apup.h @@ -109,7 +106,7 @@ Hotfix-by: Sebastian Gottschall https://github.com/mirror/dd-wrt/commit/0c3001a6 /** --- a/src/ap/ap_drv_ops.c +++ b/src/ap/ap_drv_ops.c -@@ -382,13 +382,39 @@ int hostapd_set_wds_sta(struct hostapd_data *hapd, char *ifname_wds, +@@ -385,9 +385,35 @@ int hostapd_set_wds_sta(struct hostapd_d const u8 *addr, int aid, int val) { const char *bridge = NULL; diff --git a/package/network/services/hostapd/patches/790-APuP-add-ubus-notification-when-a-peer-comes-up.patch b/package/network/services/hostapd/patches/790-APuP-add-ubus-notification-when-a-peer-comes-up.patch index 389b5abbdc27c5..b0e2c57b1387c3 100644 --- a/package/network/services/hostapd/patches/790-APuP-add-ubus-notification-when-a-peer-comes-up.patch +++ b/package/network/services/hostapd/patches/790-APuP-add-ubus-notification-when-a-peer-comes-up.patch @@ -1,4 +1,4 @@ -From 5d139e62c018f2ff1ae8b0fc76cb9c79813c61ce Mon Sep 17 00:00:00 2001 +From 9a265f70b5e4e048c568564aed5f9ac4a4fd76b0 Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Tue, 7 May 2024 10:37:54 +0200 Subject: [PATCH 2/3] APuP add ubus notification when a peer comes up diff --git a/package/network/services/hostapd/patches/800-APuP-add-ucode-hook-for-when-a-peer-comes-up.patch b/package/network/services/hostapd/patches/800-APuP-add-ucode-hook-for-when-a-peer-comes-up.patch index 2f14b21a0cb6be..d5c76994b4f6cc 100644 --- a/package/network/services/hostapd/patches/800-APuP-add-ucode-hook-for-when-a-peer-comes-up.patch +++ b/package/network/services/hostapd/patches/800-APuP-add-ucode-hook-for-when-a-peer-comes-up.patch @@ -1,4 +1,4 @@ -From 484489e41a1ae4b43d9863d057f8afb29f1c41d5 Mon Sep 17 00:00:00 2001 +From aaeb60b39a72774c651187208ec47efd0daeb75b Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Tue, 7 May 2024 11:54:23 +0200 Subject: [PATCH 3/3] APuP add ucode hook for when a peer comes up From 3889cbcb91e477b1b6023973e0fb2e38a6a24fd4 Mon Sep 17 00:00:00 2001 From: Rudy Andram Date: Sun, 8 Sep 2024 08:28:38 +0100 Subject: [PATCH 09/40] add smp-mt76 script; enable a few kernel options related to pktype support ; enable mtk openwrt feeds --- feeds.conf.default | 2 +- .../filogic/base-files/sbin/smp-mt76.sh | 516 ++++++++++++++++++ target/linux/mediatek/filogic/config-6.6 | 83 +++ 3 files changed, 600 insertions(+), 1 deletion(-) create mode 100755 target/linux/mediatek/filogic/base-files/sbin/smp-mt76.sh diff --git a/feeds.conf.default b/feeds.conf.default index 2d1f8ac0e68e47..182088596ef198 100644 --- a/feeds.conf.default +++ b/feeds.conf.default @@ -6,4 +6,4 @@ src-git telephony https://git.openwrt.org/feed/telephony.git #src-git targets https://github.com/openwrt/targets.git #src-git oldpackages http://git.openwrt.org/packages.git #src-link custom /usr/src/openwrt/custom-feed -#src-git mtk_openwrt_feed https://git01.mediatek.com/openwrt/feeds/mtk-openwrt-feeds +src-git mtk_openwrt_feed https://git01.mediatek.com/openwrt/feeds/mtk-openwrt-feeds;master diff --git a/target/linux/mediatek/filogic/base-files/sbin/smp-mt76.sh b/target/linux/mediatek/filogic/base-files/sbin/smp-mt76.sh new file mode 100755 index 00000000000000..b00d665106c04d --- /dev/null +++ b/target/linux/mediatek/filogic/base-files/sbin/smp-mt76.sh @@ -0,0 +1,516 @@ +#!/bin/sh + +OPTIMIZED_FOR="$1" +CPU_LIST=`cat /proc/interrupts | sed -n '1p'` +NUM_OF_CPU=0; for i in $CPU_LIST; do NUM_OF_CPU=`expr $NUM_OF_CPU + 1`; done; +DEFAULT_RPS=0 + +. /lib/functions.sh + +RPS_IF_LIST="" +NUM_WIFI_CARD=0 +WIFI_RADIO1=0 +WIFI_RADIO2=0 +WIFI_RADIO3=0 +WED_ENABLE=0 + +WIFI_MODULE_LIST='mt7915e mt7996e' + +get_if_info() +{ + # try to get all wifi and eth net interface. + dbg2 "try to get all wifi and eth net interface." + NET_IF_LIST=`ls /sys/class/net` + for vif in $NET_IF_LIST; + do + if [[ "$vif" == "eth"* ]] || \ + [[ "$vif" == "lan"* ]] || [[ "$vif" == "wan"* ]] || \ + [[ "$vif" == "wlan"* ]] || [[ "$vif" == "phy"* ]]; then + RPS_IF_LIST="$RPS_IF_LIST $vif" + fi + done; + dbg2 "RPS_IF_LIST = $RPS_IF_LIST" + + # try to get wifi physical card num. + dbg2 "try to get wifi physical card num." + VIRTUAL_RADIO_LIST=`ls -l /sys/class/ieee80211/ | awk -F 'devices' '{print $2}' | awk -F 'phy' '{print $1}' | uniq` + for v in $VIRTUAL_RADIO_LIST; + do + NUM_WIFI_CARD=`expr $NUM_WIFI_CARD + 1` + dbg2 "physical raido $v" + if [[ $v == *"wmac"* ]]; then + WIFI_RADIO1=1 + fi + + if [[ $v == *"wbsys"* ]]; then + WIFI_RADIO1=1 + fi + + if [[ $v == *"pci0000"* ]]; then + WIFI_RADIO2=1 + fi + + if [[ $v == *"pci0001"* ]]; then + WIFI_RADIO3=1 + fi + done; + + + for v in $WIFI_MODULE_LIST; + do + if [[ -f "/sys/module/$v/parameters/wed_enable" ]]; then + WED_ENABLE_LIST=`cat /sys/module/$v/parameters/wed_enable` + dbg2 "wed enable ori info $v $WED_ENABLE_LIST" + if [[ $WED_ENABLE_LIST == "Y" ]]; then + WED_ENABLE=1 + fi + fi + done; + dbg2 "NUM_WIFI_CARD = $NUM_WIFI_CARD" + dbg2 "platform wifi enable = $WIFI_RADIO1" + dbg2 "pcie1 wifi enable = $WIFI_RADIO2" + dbg2 "pcie2 wifi enable = $WIFI_RADIO3" + dbg2 "WED enable = $WED_ENABLE" +} + +# $1: CPU# +# $2: irq list for added. +CPU_AFFINITY_ADD() +{ + eval oval=\$CPU${1}_AFFINITY + eval CPU${1}_AFFINITY=\"\$CPU${1}_AFFINITY $2\" +} + +# $1: CPU# +# $2: Interface name for added. +CPU_RPS_ADD() +{ + eval oval=\$CPU${1}_RPS + eval CPU${1}_RPS=\"\$CPU${1}_RPS $2\" + dbg2 "CPU${1}_RPS=\"\$CPU${1}_RPS $2\"" +} + +MT7988() +{ + num_of_wifi=$1 + DEFAULT_RPS=0 + + #Physical IRQ# setting + #Ethernet RSS feature enables 4 Rx rings + eth_irq_rx0=221 + eth_irq_rx1=222 + eth_irq_rx2=223 + eth_irq_rx3=224 + eth_irq_tx=229 + wifi1_irq_pcie0=524288 + wifi1_irq_pcie1=134742016 + wifi2_irq_pcie0= + wifi2_irq_pcie1= + + if [[ "$WED_ENABLE" -eq "1" ]]; then + dbg2 "WED_ENABLE ON irq/iptable setting" + #TCP Binding + iptables -D FORWARD -p tcp -m conntrack --ctstate RELATED,ESTABLISHED -j FLOWOFFLOAD --hw + iptables -I FORWARD -p tcp -m conntrack --ctstate RELATED,ESTABLISHED -j FLOWOFFLOAD --hw + ip6tables -D FORWARD -p tcp -m conntrack --ctstate RELATED,ESTABLISHED -j FLOWOFFLOAD --hw + ip6tables -I FORWARD -p tcp -m conntrack --ctstate RELATED,ESTABLISHED -j FLOWOFFLOAD --hw + #UDP Binding + iptables -D FORWARD -p udp -j FLOWOFFLOAD --hw + iptables -I FORWARD -p udp -j FLOWOFFLOAD --hw + ip6tables -D FORWARD -p udp -j FLOWOFFLOAD --hw + ip6tables -I FORWARD -p udp -j FLOWOFFLOAD --hw + #Multicast skip Binding + iptables -D FORWARD -m pkttype --pkt-type multicast -j ACCEPT + iptables -I FORWARD -m pkttype --pkt-type multicast -j ACCEPT + ip6tables -D FORWARD -m pkttype --pkt-type multicast -j ACCEPT + ip6tables -I FORWARD -m pkttype --pkt-type multicast -j ACCEPT + + else + dbg2 "WED_ENABLE OFF irq/iptable seting" + fi + + for vif in $NET_IF_LIST; + do + if [[ "$vif" == "wlan"* ]] || [[ "$vif" == "phy"* ]]; then + WIFI_IF_LIST="$WIFI_IF_LIST $vif" + fi + done; + dbg2 "$WIFI_IF_LIST = $WIFI_IF_LIST" + # Please update the CPU binding in each cases. + # CPU#_AFFINITY="add binding irq number here" + # CPU#_RPS="add binding interface name here" + if [ "$num_of_wifi" = "0" ]; then + CPU0_AFFINITY="$eth_irq_rx0 $eth_irq_tx" + CPU1_AFFINITY="$eth_irq_rx1" + CPU2_AFFINITY="$eth_irq_rx2" + CPU3_AFFINITY="$eth_irq_rx3" + + CPU0_RPS="$RPS_IF_LIST" + CPU1_RPS="$RPS_IF_LIST" + CPU2_RPS="$RPS_IF_LIST" + CPU3_RPS="$RPS_IF_LIST" + else + #we bound all wifi card to cpu0 and bound eth to cpu + CPU0_AFFINITY="" + CPU1_AFFINITY="" + CPU2_AFFINITY="$eth_irq_rx0 $eth_irq_rx1 $eth_irq_tx" + CPU3_AFFINITY="$eth_irq_rx2 $eth_irq_rx3" + + CPU0_RPS="$WIFI_IF_LIST" + CPU1_RPS="$WIFI_IF_LIST" + CPU2_RPS="" + CPU3_RPS="" + fi + dbg2 "CPU0_AFFINITY = $CPU0_AFFINITY" + dbg2 "CPU1_AFFINITY = $CPU1_AFFINITY" + dbg2 "CPU2_AFFINITY = $CPU2_AFFINITY" + dbg2 "CPU3_AFFINITY = $CPU3_AFFINITY" +} + +MT7986() +{ + num_of_wifi=$1 + DEFAULT_RPS=0 + + #Physical IRQ# setting + #Ethernet RSS feature enables 4 Rx rings + eth_irq_rx0=221 + eth_irq_rx1=222 + eth_irq_rx2=223 + eth_irq_rx3=224 + eth_irq_tx=229 + wifi1_irq= + wifi2_irq= + wifi3_irq= + + if [[ "$WED_ENABLE" -eq "1" ]]; then + dbg2 "WED_ENABLE ON irq/iptable setting" + #TCP Binding + iptables -D FORWARD -p tcp -m conntrack --ctstate RELATED,ESTABLISHED -j FLOWOFFLOAD --hw + iptables -I FORWARD -p tcp -m conntrack --ctstate RELATED,ESTABLISHED -j FLOWOFFLOAD --hw + ip6tables -D FORWARD -p tcp -m conntrack --ctstate RELATED,ESTABLISHED -j FLOWOFFLOAD --hw + ip6tables -I FORWARD -p tcp -m conntrack --ctstate RELATED,ESTABLISHED -j FLOWOFFLOAD --hw + #UDP Binding + iptables -D FORWARD -p udp -j FLOWOFFLOAD --hw + iptables -I FORWARD -p udp -j FLOWOFFLOAD --hw + ip6tables -D FORWARD -p udp -j FLOWOFFLOAD --hw + ip6tables -I FORWARD -p udp -j FLOWOFFLOAD --hw + #Multicast skip Binding + iptables -D FORWARD -m pkttype --pkt-type multicast -j ACCEPT + iptables -I FORWARD -m pkttype --pkt-type multicast -j ACCEPT + ip6tables -D FORWARD -m pkttype --pkt-type multicast -j ACCEPT + ip6tables -I FORWARD -m pkttype --pkt-type multicast -j ACCEPT + + #AX6000 AX7800 - SOC + if [[ "$WIFI_RADIO1" -eq "1" ]]; then + wifi1_irq=238 + fi + #AX7800 - PCIE0 + if [[ "$WIFI_RADIO2" -eq "1" ]]; then + wifi2_irq=237 + fi + #AX7800 - PCIE1 + #if [[ "$WIFI_RADIO3" -eq "1" ]]; then + # wifi3_irq=239 + #fi + else + dbg2 "WED_ENABLE OFF irq/iptable seting" + #AX6000 AX7800 - SOC + if [[ "$WIFI_RADIO1" -eq "1" ]]; then + wifi1_irq=245 + fi + #AX7800 - PCIE0 + if [[ "$WIFI_RADIO2" -eq "1" ]]; then + wifi2_irq=246 + fi + #AX7800 - PCIE1 + #if [[ "$WIFI_RADIO3" -eq "1" ]]; then + # wifi3_irq=247 + #fi + fi + + for vif in $NET_IF_LIST; + do + if [[ "$vif" == "wlan"* ]] || [[ "$vif" == "phy"* ]]; then + WIFI_IF_LIST="$WIFI_IF_LIST $vif" + fi + done; + dbg2 "$WIFI_IF_LIST = $WIFI_IF_LIST" + # Please update the CPU binding in each cases. + # CPU#_AFFINITY="add binding irq number here" + # CPU#_RPS="add binding interface name here" + if [ "$num_of_wifi" = "0" ]; then + CPU0_AFFINITY="$eth_irq_rx0" + CPU1_AFFINITY="$eth_irq_rx1 $eth_irq_tx" + CPU2_AFFINITY="$eth_irq_rx2" + CPU3_AFFINITY="$eth_irq_rx3" + + CPU0_RPS="" + CPU1_RPS="" + CPU2_RPS="" + CPU3_RPS="" + else + #we bound all wifi card to cpu1 and bound eth to cpu0 + CPU0_AFFINITY="$eth_irq_rx0" + CPU1_AFFINITY="$eth_irq_rx1 $eth_irq_tx" + CPU2_AFFINITY="$eth_irq_rx2 $wifi2_irq $wifi3_irq" + CPU3_AFFINITY="$eth_irq_rx3 $wifi1_irq" + + CPU0_RPS="$WIFI_IF_LIST" + CPU1_RPS="$WIFI_IF_LIST" + CPU2_RPS="$WIFI_IF_LIST" + CPU3_RPS="$WIFI_IF_LIST" + fi + dbg2 "CPU0_AFFINITY = $CPU0_AFFINITY" + dbg2 "CPU1_AFFINITY = $CPU1_AFFINITY" + dbg2 "CPU2_AFFINITY = $CPU2_AFFINITY" + dbg2 "CPU3_AFFINITY = $CPU3_AFFINITY" +} + +MT7981() +{ + num_of_wifi=$1 + DEFAULT_RPS=0 + + #Physical IRQ# setting + eth_irq_rx=221 + eth_irq_tx=229 + wifi1_irq= + wifi2_irq= + wifi3_irq= + + #AX3000 + if [[ "$WED_ENABLE" -eq "1" ]]; then + dbg2 "WED_ENABLE ON irq/iptable setting" + #TCP Binding + iptables -D FORWARD -p tcp -m conntrack --ctstate \ + RELATED,ESTABLISHED -j FLOWOFFLOAD --hw + iptables -I FORWARD -p tcp -m conntrack --ctstate \ + RELATED,ESTABLISHED -j FLOWOFFLOAD --hw + ip6tables -D FORWARD -p tcp -m conntrack --ctstate \ + RELATED,ESTABLISHED -j FLOWOFFLOAD --hw + ip6tables -I FORWARD -p tcp -m conntrack --ctstate \ + RELATED,ESTABLISHED -j FLOWOFFLOAD --hw + #UDP Binding + iptables -D FORWARD -p udp -j FLOWOFFLOAD --hw + iptables -I FORWARD -p udp -j FLOWOFFLOAD --hw + ip6tables -D FORWARD -p udp -j FLOWOFFLOAD --hw + ip6tables -I FORWARD -p udp -j FLOWOFFLOAD --hw + #Multicast skip Binding + iptables -D FORWARD -m pkttype --pkt-type multicast -j ACCEPT + iptables -I FORWARD -m pkttype --pkt-type multicast -j ACCEPT + ip6tables -D FORWARD -m pkttype --pkt-type multicast -j ACCEPT + ip6tables -I FORWARD -m pkttype --pkt-type multicast -j ACCEPT + + if [[ "$WIFI_RADIO1" -eq "1" ]]; then + wifi1_irq=237 + fi + else + if [[ "$WIFI_RADIO1" -eq "1" ]]; then + wifi1_irq=245 + fi + fi + + # Please update the CPU binding in each cases. + # CPU#_AFFINITY="add binding irq number here" + # CPU#_RPS="add binding interface name here" + if [ "$num_of_wifi" = "0" ]; then + CPU0_AFFINITY="$eth_irq_rx" + CPU1_AFFINITY="$eth_irq_tx" + + CPU0_RPS="$RPS_IF_LIST" + CPU1_RPS="$RPS_IF_LIST" + else + #we bound all wifi card to cpu0 and bound eth to cpu1 + CPU0_AFFINITY="$wifi1_irq $wifi2_irq $wifi3_irq" + CPU1_AFFINITY="$eth_irq_rx $eth_irq_tx" + + CPU0_RPS="$RPS_IF_LIST" + CPU1_RPS="$RPS_IF_LIST" + fi + dbg2 "CPU0_AFFINITY = $CPU0_AFFINITY" + dbg2 "CPU1_AFFINITY = $CPU1_AFFINITY" +} + +MT7622() +{ + num_of_wifi=$1 + DEFAULT_RPS=0 + + #Physical IRQ# setting + eth0_irq=224 + eth1_irq=225 + wifi1_irq= + wifi2_irq= + wifi3_irq= + #AX1200 AX3200 + if [[ "$WIFI_RADIO1" -eq "1" ]]; then + wifi1_irq=211 + fi + #AX1800 AX3200 + if [[ "$WIFI_RADIO2" -eq "1" ]]; then + wifi2_irq=214 + fi + #AX3600 + if [[ "$WIFI_RADIO3" -eq "1" ]]; then + wifi3_irq=215 + fi + + # Please update the CPU binding in each cases. + # CPU#_AFFINITY="add binding irq number here" + # CPU#_RPS="add binding interface name here" + if [ "$num_of_wifi" == "0" ]; then + CPU0_AFFINITY="$eth0_irq" + CPU1_AFFINITY="$eth1_irq" + + CPU0_RPS="$RPS_IF_LIST" + CPU1_RPS="$RPS_IF_LIST" + else + #we bound all wifi card to cpu0 and bound eth to cpu1 + CPU0_AFFINITY="$wifi1_irq $wifi2_irq $wifi3_irq" + CPU1_AFFINITY="$eth0_irq $eth1_irq" + + CPU0_RPS="$RPS_IF_LIST" + CPU1_RPS="$RPS_IF_LIST" + fi + + dbg2 "CPU0_AFFINITY = $CPU0_AFFINITY" + dbg2 "CPU1_AFFINITY = $CPU1_AFFINITY" +} + +setup_model() +{ + board=$(board_name) + num_of_wifi=$NUM_WIFI_CARD + + if [[ $board == *"7988"* ]]; then + dbg "setup_model: MT7988 NUM_WIFI_CARD=$num_of_wifi" + MT7988 $num_of_wifi + elif [[ $board == *"7986"* ]]; then + dbg "setup_model: MT7986 NUM_WIFI_CARD=$num_of_wifi" + MT7986 $num_of_wifi + elif [[ $board == *"7981"* ]]; then + dbg "setup_model: MT7981 NUM_WIFI_CARD=$num_of_wifi" + MT7981 $num_of_wifi + elif [[ $board == *"7622"* ]]; then + dbg "setup_model: MT7622 NUM_WIFI_CARD=$num_of_wifi" + MT7622 $num_of_wifi + elif [[ $board == *"bpi-r4"* ]]; then + dbg "setup_model: bpi-r4 NUM_WIFI_CARD=$num_of_wifi" + MT7988 $num_of_wifi + fi +} + +get_virtual_irq() +{ + PHY_POS=`expr $NUM_OF_CPU + 3` #physical irq # position in /proc/interrups may vary with the number of CPU up + target_phy_irq=$1 + cat /proc/interrupts | sed 's/:/ /g'| awk '$1 ~ /^[0-9]+$/' | while read line + do + set -- $line + phy_irq=$(eval "echo \$$PHY_POS") + if [ $phy_irq == $target_phy_irq ]; then + echo $1 + return + fi + done +} + +set_rps_cpu_bitmap() +{ + dbg2 "# Scan binding interfaces of each cpu" + # suppose the value of interface_var is null or hex + num=0 + while [ "$num" -lt "$NUM_OF_CPU" ];do + cpu_bit=$((2 ** $num)) + eval rps_list=\$CPU${num}_RPS + dbg2 "# CPU$num: rps_list=$rps_list" + for i in $rps_list; do + var=${VAR_PREFIX}_${i//-/_} + eval ifval=\$$var + dbg2 "[var val before] \$$var=$ifval" + if [ -z "$ifval" ]; then + eval $var=$cpu_bit + else + eval $var=`expr $ifval + $cpu_bit` + fi + eval ifval=\$$var + dbg2 "[rps val after]$i=$ifval" + done + num=`expr $num + 1` + done +} + +# $1: The default rps value. If rps of the interface is not setup, set $1 to it +set_rps_cpus() +{ + dbg2 "# Setup rps of the interfaces, $RPS_IF_LIST." + for i in $RPS_IF_LIST; do + var=${VAR_PREFIX}_${i//-/_} + eval cpu_map=\$$var + if [ -d /sys/class/net/$i ]; then + if [ ! -z $cpu_map ]; then + cpu_map=`printf '%x' $cpu_map` + dbg "echo $cpu_map > /sys/class/net/$i/queues/rx-0/rps_cpus" + echo $cpu_map > /sys/class/net/$i/queues/rx-0/rps_cpus + elif [ ! -z $1 ]; then + dbg "echo $1 > /sys/class/net/$i/queues/rx-0/rps_cpus" + echo $1 > /sys/class/net/$i/queues/rx-0/rps_cpus + fi + fi + done +} + +set_smp_affinity() +{ + dbg2 "# Setup affinity of each physical irq." + num=0 + while [ "$num" -lt "$NUM_OF_CPU" ];do + eval smp_list=\$CPU${num}_AFFINITY + for i in $smp_list; do + cpu_bit=$((2 ** $num)) + virq=$(get_virtual_irq $i) + #virq=$i + dbg2 "irq p2v $i --> $virq" + if [ ! -z $virq ]; then + dbg "echo $cpu_bit > /proc/irq/$virq/smp_affinity" + echo $cpu_bit > /proc/irq/$virq/smp_affinity + fi + done + num=`expr $num + 1` + done +} + +if [ "$1" = "dbg" ]; then + DBG=1 +elif [ "$1" = "dbg2" ]; then + DBG=2 +else + DBG=0 +fi + +# Usage: dbg "the output string" +dbg() +{ + if [ "$DBG" -ge "1" ]; then + echo -e $1 + fi +} + +# Usage: dbg2 "the output string" +dbg2() +{ + if [ "$DBG" -ge "2" ]; then + echo -e $1 + fi +} + +dbg "# RPS and AFFINITY Setting" +dbg "# NUM_OF_CPU=$NUM_OF_CPU" +VAR_PREFIX="autogen" +get_if_info +setup_model +set_rps_cpu_bitmap +set_rps_cpus $DEFAULT_RPS +set_smp_affinity +#end of file diff --git a/target/linux/mediatek/filogic/config-6.6 b/target/linux/mediatek/filogic/config-6.6 index b9db5c339a2435..d01ffd01429507 100644 --- a/target/linux/mediatek/filogic/config-6.6 +++ b/target/linux/mediatek/filogic/config-6.6 @@ -48,6 +48,7 @@ CONFIG_BLK_DEV_SD=y CONFIG_BLK_MQ_PCI=y CONFIG_BLK_PM=y CONFIG_BLOCK_NOTIFIERS=y +CONFIG_BRIDGE_NETFILTER=m CONFIG_BSD_PROCESS_ACCT=y CONFIG_BSD_PROCESS_ACCT_V3=y CONFIG_BUFFER_HEAD=y @@ -217,6 +218,12 @@ CONFIG_I2C_MT65XX=y CONFIG_ICPLUS_PHY=y CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000 CONFIG_INITRAMFS_SOURCE="" +CONFIG_IP_NF_FILTER=m +CONFIG_IP_NF_IPTABLES=m +CONFIG_IP_NF_MANGLE=m +# CONFIG_IP_NF_NAT is not set +CONFIG_IP_NF_RAW=m +CONFIG_IP_NF_TARGET_REJECT=m CONFIG_IRQCHIP=y CONFIG_IRQ_DOMAIN=y CONFIG_IRQ_DOMAIN_HIERARCHY=y @@ -227,6 +234,7 @@ CONFIG_JBD2=y CONFIG_JUMP_LABEL=y CONFIG_LEDS_PWM=y CONFIG_LEDS_SMARTRG_LED=y +CONFIG_LIBCRC32C=m CONFIG_LIBFDT=y CONFIG_LOCK_DEBUGGING_SUPPORT=y CONFIG_LOCK_SPIN_ON_OWNER=y @@ -290,6 +298,40 @@ CONFIG_MTK_TIMER=y CONFIG_MUTEX_SPIN_ON_OWNER=y CONFIG_NEED_DMA_MAP_STATE=y CONFIG_NEED_SG_DMA_LENGTH=y +CONFIG_NETFILTER=y +CONFIG_NETFILTER_ADVANCED=y +CONFIG_NETFILTER_BPF_LINK=y +CONFIG_NETFILTER_CONNCOUNT=m +CONFIG_NETFILTER_FAMILY_ARP=y +CONFIG_NETFILTER_FAMILY_BRIDGE=y +CONFIG_NETFILTER_NETLINK=m +CONFIG_NETFILTER_NETLINK_LOG=m +CONFIG_NETFILTER_NETLINK_QUEUE=m +CONFIG_NETFILTER_SYNPROXY=m +CONFIG_NETFILTER_XTABLES=y +CONFIG_NETFILTER_XT_CONNMARK=m +CONFIG_NETFILTER_XT_MARK=m +CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m +CONFIG_NETFILTER_XT_MATCH_BPF=m +CONFIG_NETFILTER_XT_MATCH_CONNLABEL=m +CONFIG_NETFILTER_XT_MATCH_CONNMARK=m +CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m +CONFIG_NETFILTER_XT_MATCH_CPU=m +CONFIG_NETFILTER_XT_MATCH_DCCP=m +CONFIG_NETFILTER_XT_MATCH_MARK=m +CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m +CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m +CONFIG_NETFILTER_XT_MATCH_STATE=m +CONFIG_NETFILTER_XT_NAT=y +CONFIG_NETFILTER_XT_TARGET_CONNMARK=m +CONFIG_NETFILTER_XT_TARGET_LOG=m +CONFIG_NETFILTER_XT_TARGET_MARK=m +CONFIG_NETFILTER_XT_TARGET_MASQUERADE=m +CONFIG_NETFILTER_XT_TARGET_NETMAP=m +CONFIG_NETFILTER_XT_TARGET_NFLOG=m +CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m +CONFIG_NETFILTER_XT_TARGET_REDIRECT=m +CONFIG_NETFILTER_XT_TARGET_TCPMSS=m CONFIG_NET_DEVLINK=y CONFIG_NET_DSA=y CONFIG_NET_DSA_MT7530=y @@ -305,6 +347,46 @@ CONFIG_NET_SELFTESTS=y CONFIG_NET_SWITCHDEV=y CONFIG_NET_VENDOR_MEDIATEK=y CONFIG_NET_XGRESS=y +CONFIG_NFT_COMPAT=m +CONFIG_NFT_CONNLIMIT=m +CONFIG_NFT_CT=m +CONFIG_NFT_DUP_IPV4=m +CONFIG_NFT_DUP_NETDEV=m +CONFIG_NFT_FIB=m +CONFIG_NFT_FIB_IPV4=m +CONFIG_NFT_FWD_NETDEV=m +CONFIG_NFT_HASH=m +CONFIG_NFT_LIMIT=m +CONFIG_NFT_LOG=m +CONFIG_NFT_MASQ=m +CONFIG_NFT_NAT=m +CONFIG_NFT_NUMGEN=m +# CONFIG_NFT_QUEUE is not set +CONFIG_NFT_QUOTA=m +CONFIG_NFT_REDIR=m +# CONFIG_NFT_REJECT is not set +CONFIG_NFT_SOCKET=m +CONFIG_NFT_SYNPROXY=m +CONFIG_NFT_TPROXY=m +CONFIG_NFT_TUNNEL=m +CONFIG_NF_CONNTRACK=y +CONFIG_NF_CONNTRACK_BRIDGE=m +CONFIG_NF_CONNTRACK_LABELS=y +CONFIG_NF_CONNTRACK_MARK=y +CONFIG_NF_DEFRAG_IPV4=y +CONFIG_NF_DUP_IPV4=m +CONFIG_NF_DUP_NETDEV=m +CONFIG_NF_LOG_ARP=m +CONFIG_NF_LOG_IPV4=m +CONFIG_NF_LOG_SYSLOG=m +CONFIG_NF_NAT=y +CONFIG_NF_NAT_MASQUERADE=y +CONFIG_NF_NAT_REDIRECT=y +CONFIG_NF_REJECT_IPV4=m +CONFIG_NF_SOCKET_IPV4=m +CONFIG_NF_TABLES=m +CONFIG_NF_TABLES_BRIDGE=m +CONFIG_NF_TPROXY_IPV4=m CONFIG_NLS=y CONFIG_NO_HZ_COMMON=y CONFIG_NO_HZ_IDLE=y @@ -441,6 +523,7 @@ CONFIG_SERIAL_MCTRL_GPIO=y CONFIG_SERIAL_OF_PLATFORM=y CONFIG_SGL_ALLOC=y CONFIG_SG_POOL=y +CONFIG_SKB_EXTENSIONS=y CONFIG_SMP=y CONFIG_SOCK_RX_QUEUE_MAPPING=y CONFIG_SOFTIRQ_ON_OWN_STACK=y From 49c66460e4f83c7929dc6f85707635a5076f8746 Mon Sep 17 00:00:00 2001 From: Rudy Andram Date: Mon, 9 Sep 2024 04:18:24 +0100 Subject: [PATCH 10/40] further changes to enable 11be --- package/kernel/mt76/Makefile | 2 +- .../files/lib/netifd/wireless/mac80211.sh | 2 +- .../803-hostapd-fix-80211be-build.patch | 12 +-- target/linux/mediatek/filogic/config-6.6 | 96 +++---------------- 4 files changed, 21 insertions(+), 91 deletions(-) diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile index 10030398e9e159..20dfbf8f5a208c 100644 --- a/package/kernel/mt76/Makefile +++ b/package/kernel/mt76/Makefile @@ -319,7 +319,7 @@ endef define KernelPackage/mt7996e $(KernelPackage/mt76-default) TITLE:=MediaTek MT7996E wireless driver - DEPENDS+=@PCI_SUPPORT +kmod-mt76-connac +kmod-hwmon-core +@DRIVER_11AX_SUPPORT +@KERNEL_RELAY + DEPENDS+=@PCI_SUPPORT +kmod-mt76-connac +kmod-hwmon-core +@DRIVER_11AX_SUPPORT +@DRIVER_11BE_SUPPORT +@KERNEL_RELAY FILES:= $(PKG_BUILD_DIR)/mt7996/mt7996e.ko AUTOLOAD:=$(call AutoProbe,mt7996e) endef diff --git a/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh b/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh index 36cd65b315945d..d32cdceeb9c46f 100755 --- a/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh +++ b/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh @@ -308,7 +308,7 @@ mac80211_hostapd_setup_base() { eht_center_seg0=$idx eht_oper_chwidth=9 ;; - HE*|EHT*) op_class=$((132 + $vht_oper_chwidth)) + HE*|EHT*) op_class=$((132 + $vht_oper_chwidth));; esac [ -n "$op_class" ] && append base_cfg "op_class=$op_class" "$N" } diff --git a/package/network/services/hostapd/patches/803-hostapd-fix-80211be-build.patch b/package/network/services/hostapd/patches/803-hostapd-fix-80211be-build.patch index 7169bcc61e4210..55c6e635813c9d 100644 --- a/package/network/services/hostapd/patches/803-hostapd-fix-80211be-build.patch +++ b/package/network/services/hostapd/patches/803-hostapd-fix-80211be-build.patch @@ -1,7 +1,5 @@ -Index: hostapd-2024.03.09~695277a5/src/ap/sta_info.c -=================================================================== ---- hostapd-2024.03.09~695277a5.orig/src/ap/sta_info.c -+++ hostapd-2024.03.09~695277a5/src/ap/sta_info.c +--- a/src/ap/sta_info.c ++++ b/src/ap/sta_info.c @@ -1836,3 +1836,22 @@ void ap_sta_free_sta_profile(struct mld_ } } @@ -25,10 +23,8 @@ Index: hostapd-2024.03.09~695277a5/src/ap/sta_info.c +#endif /* CONFIG_IEEE80211BE */ +} + -Index: hostapd-2024.03.09~695277a5/src/ap/sta_info.h -=================================================================== ---- hostapd-2024.03.09~695277a5.orig/src/ap/sta_info.h -+++ hostapd-2024.03.09~695277a5/src/ap/sta_info.h +--- a/src/ap/sta_info.h ++++ b/src/ap/sta_info.h @@ -417,23 +417,8 @@ int ap_sta_re_add(struct hostapd_data *h void ap_free_sta_pasn(struct hostapd_data *hapd, struct sta_info *sta); diff --git a/target/linux/mediatek/filogic/config-6.6 b/target/linux/mediatek/filogic/config-6.6 index d01ffd01429507..7127d41bcebea3 100644 --- a/target/linux/mediatek/filogic/config-6.6 +++ b/target/linux/mediatek/filogic/config-6.6 @@ -48,7 +48,6 @@ CONFIG_BLK_DEV_SD=y CONFIG_BLK_MQ_PCI=y CONFIG_BLK_PM=y CONFIG_BLOCK_NOTIFIERS=y -CONFIG_BRIDGE_NETFILTER=m CONFIG_BSD_PROCESS_ACCT=y CONFIG_BSD_PROCESS_ACCT_V3=y CONFIG_BUFFER_HEAD=y @@ -106,6 +105,8 @@ CONFIG_CRYPTO_AES_ARM64=y CONFIG_CRYPTO_AES_ARM64_CE=y CONFIG_CRYPTO_AES_ARM64_CE_BLK=y CONFIG_CRYPTO_AES_ARM64_CE_CCM=y +CONFIG_CRYPTO_AUTHENC=y +CONFIG_CRYPTO_CBC=y CONFIG_CRYPTO_CMAC=y CONFIG_CRYPTO_CRC32=y CONFIG_CRYPTO_CRC32C=y @@ -117,6 +118,8 @@ CONFIG_CRYPTO_DRBG_MENU=y CONFIG_CRYPTO_ECB=y CONFIG_CRYPTO_ECC=y CONFIG_CRYPTO_ECDH=y +CONFIG_CRYPTO_ECHAINIV=y +CONFIG_CRYPTO_GENIV=y CONFIG_CRYPTO_GHASH_ARM64_CE=y CONFIG_CRYPTO_HASH_INFO=y CONFIG_CRYPTO_HMAC=y @@ -130,6 +133,7 @@ CONFIG_CRYPTO_LZO=y CONFIG_CRYPTO_RNG=y CONFIG_CRYPTO_RNG2=y CONFIG_CRYPTO_RNG_DEFAULT=y +CONFIG_CRYPTO_SEQIV=y CONFIG_CRYPTO_SHA256=y CONFIG_CRYPTO_SHA256_ARM64=y CONFIG_CRYPTO_SHA2_ARM64_CE=y @@ -143,6 +147,7 @@ CONFIG_CRYPTO_ZSTD=y CONFIG_DCACHE_WORD_ACCESS=y CONFIG_DEBUG_INFO=y CONFIG_DEBUG_MISC=y +# CONFIG_DEFAULT_BBR is not set CONFIG_DIMLIB=y CONFIG_DMADEVICES=y CONFIG_DMATEST=y @@ -217,13 +222,12 @@ CONFIG_I2C_CHARDEV=y CONFIG_I2C_MT65XX=y CONFIG_ICPLUS_PHY=y CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000 +CONFIG_INET6_ESP=y +CONFIG_INET6_ESP_OFFLOAD=y +CONFIG_INET_ESP=y +CONFIG_INET_ESP_OFFLOAD=y CONFIG_INITRAMFS_SOURCE="" -CONFIG_IP_NF_FILTER=m -CONFIG_IP_NF_IPTABLES=m -CONFIG_IP_NF_MANGLE=m -# CONFIG_IP_NF_NAT is not set -CONFIG_IP_NF_RAW=m -CONFIG_IP_NF_TARGET_REJECT=m +CONFIG_IPV6=y CONFIG_IRQCHIP=y CONFIG_IRQ_DOMAIN=y CONFIG_IRQ_DOMAIN_HIERARCHY=y @@ -298,40 +302,6 @@ CONFIG_MTK_TIMER=y CONFIG_MUTEX_SPIN_ON_OWNER=y CONFIG_NEED_DMA_MAP_STATE=y CONFIG_NEED_SG_DMA_LENGTH=y -CONFIG_NETFILTER=y -CONFIG_NETFILTER_ADVANCED=y -CONFIG_NETFILTER_BPF_LINK=y -CONFIG_NETFILTER_CONNCOUNT=m -CONFIG_NETFILTER_FAMILY_ARP=y -CONFIG_NETFILTER_FAMILY_BRIDGE=y -CONFIG_NETFILTER_NETLINK=m -CONFIG_NETFILTER_NETLINK_LOG=m -CONFIG_NETFILTER_NETLINK_QUEUE=m -CONFIG_NETFILTER_SYNPROXY=m -CONFIG_NETFILTER_XTABLES=y -CONFIG_NETFILTER_XT_CONNMARK=m -CONFIG_NETFILTER_XT_MARK=m -CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m -CONFIG_NETFILTER_XT_MATCH_BPF=m -CONFIG_NETFILTER_XT_MATCH_CONNLABEL=m -CONFIG_NETFILTER_XT_MATCH_CONNMARK=m -CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m -CONFIG_NETFILTER_XT_MATCH_CPU=m -CONFIG_NETFILTER_XT_MATCH_DCCP=m -CONFIG_NETFILTER_XT_MATCH_MARK=m -CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m -CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m -CONFIG_NETFILTER_XT_MATCH_STATE=m -CONFIG_NETFILTER_XT_NAT=y -CONFIG_NETFILTER_XT_TARGET_CONNMARK=m -CONFIG_NETFILTER_XT_TARGET_LOG=m -CONFIG_NETFILTER_XT_TARGET_MARK=m -CONFIG_NETFILTER_XT_TARGET_MASQUERADE=m -CONFIG_NETFILTER_XT_TARGET_NETMAP=m -CONFIG_NETFILTER_XT_TARGET_NFLOG=m -CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m -CONFIG_NETFILTER_XT_TARGET_REDIRECT=m -CONFIG_NETFILTER_XT_TARGET_TCPMSS=m CONFIG_NET_DEVLINK=y CONFIG_NET_DSA=y CONFIG_NET_DSA_MT7530=y @@ -347,46 +317,6 @@ CONFIG_NET_SELFTESTS=y CONFIG_NET_SWITCHDEV=y CONFIG_NET_VENDOR_MEDIATEK=y CONFIG_NET_XGRESS=y -CONFIG_NFT_COMPAT=m -CONFIG_NFT_CONNLIMIT=m -CONFIG_NFT_CT=m -CONFIG_NFT_DUP_IPV4=m -CONFIG_NFT_DUP_NETDEV=m -CONFIG_NFT_FIB=m -CONFIG_NFT_FIB_IPV4=m -CONFIG_NFT_FWD_NETDEV=m -CONFIG_NFT_HASH=m -CONFIG_NFT_LIMIT=m -CONFIG_NFT_LOG=m -CONFIG_NFT_MASQ=m -CONFIG_NFT_NAT=m -CONFIG_NFT_NUMGEN=m -# CONFIG_NFT_QUEUE is not set -CONFIG_NFT_QUOTA=m -CONFIG_NFT_REDIR=m -# CONFIG_NFT_REJECT is not set -CONFIG_NFT_SOCKET=m -CONFIG_NFT_SYNPROXY=m -CONFIG_NFT_TPROXY=m -CONFIG_NFT_TUNNEL=m -CONFIG_NF_CONNTRACK=y -CONFIG_NF_CONNTRACK_BRIDGE=m -CONFIG_NF_CONNTRACK_LABELS=y -CONFIG_NF_CONNTRACK_MARK=y -CONFIG_NF_DEFRAG_IPV4=y -CONFIG_NF_DUP_IPV4=m -CONFIG_NF_DUP_NETDEV=m -CONFIG_NF_LOG_ARP=m -CONFIG_NF_LOG_IPV4=m -CONFIG_NF_LOG_SYSLOG=m -CONFIG_NF_NAT=y -CONFIG_NF_NAT_MASQUERADE=y -CONFIG_NF_NAT_REDIRECT=y -CONFIG_NF_REJECT_IPV4=m -CONFIG_NF_SOCKET_IPV4=m -CONFIG_NF_TABLES=m -CONFIG_NF_TABLES_BRIDGE=m -CONFIG_NF_TPROXY_IPV4=m CONFIG_NLS=y CONFIG_NO_HZ_COMMON=y CONFIG_NO_HZ_IDLE=y @@ -543,6 +473,7 @@ CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU=y CONFIG_SWIOTLB=y CONFIG_SWPHY=y CONFIG_SYSCTL_EXCEPTION_TRACE=y +CONFIG_TCP_CONG_BBR=y CONFIG_THERMAL=y CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y CONFIG_THERMAL_EMERGENCY_POWEROFF_DELAY_MS=0 @@ -573,6 +504,9 @@ CONFIG_WATCHDOG_PRETIMEOUT_GOV=y CONFIG_WATCHDOG_PRETIMEOUT_GOV_PANIC=y CONFIG_WATCHDOG_PRETIMEOUT_GOV_SEL=m CONFIG_WATCHDOG_SYSFS=y +CONFIG_XFRM_ALGO=y +CONFIG_XFRM_ESP=y +CONFIG_XFRM_OFFLOAD=y CONFIG_XPS=y CONFIG_XXHASH=y CONFIG_ZLIB_DEFLATE=y From 2bf6504fc4e9b7ddcf4d9daf9cd1cc7e673b7703 Mon Sep 17 00:00:00 2001 From: Rudy Andram Date: Wed, 11 Sep 2024 13:44:59 +0100 Subject: [PATCH 11/40] add mac80211, mt76 patches from mtk feeds refresh mt76 repo - includes firmware mt7996 from the mtk-openwrt-feeds repo updated kernel config to support smp scheduler --- ...-mtk-mac80211-add-EHT-BA1024-support.patch | 114 +++++ ...80211-add-rate-duration-for-EHT-rate.patch | 437 ++++++++++++++++++ package/kernel/mt76/Makefile | 10 +- ...-background-radar-cap-check-for-2-3-.patch | 56 +++ .../arch/arm64/boot/dts/mediatek/mt7988a.dtsi | 6 +- target/linux/mediatek/filogic/config-6.6 | 5 + 6 files changed, 620 insertions(+), 8 deletions(-) create mode 100644 package/kernel/mac80211/patches/subsys/0001-mtk-mac80211-add-EHT-BA1024-support.patch create mode 100644 package/kernel/mac80211/patches/subsys/0002-mtk-mac80211-add-rate-duration-for-EHT-rate.patch create mode 100644 package/kernel/mt76/patches/0002-wifi-mt76-mt7996-background-radar-cap-check-for-2-3-.patch diff --git a/package/kernel/mac80211/patches/subsys/0001-mtk-mac80211-add-EHT-BA1024-support.patch b/package/kernel/mac80211/patches/subsys/0001-mtk-mac80211-add-EHT-BA1024-support.patch new file mode 100644 index 00000000000000..97b7a7b6697fff --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/0001-mtk-mac80211-add-EHT-BA1024-support.patch @@ -0,0 +1,114 @@ +From ce225a315119c4a961341653729745e57b1b183b Mon Sep 17 00:00:00 2001 +From: Howard Hsu +Date: Tue, 20 Aug 2024 11:37:46 +0800 +Subject: [PATCH] mtk: mac80211: add EHT BA1024 support +--- + include/linux/ieee80211.h | 2 ++ + net/mac80211/agg-tx.c | 47 +++++++++++++++++++++++++++++++++++++-- + 2 files changed, 47 insertions(+), 2 deletions(-) +diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h +index 4fd9735..8ca8db9 100644 +--- a/include/linux/ieee80211.h ++++ b/include/linux/ieee80211.h +@@ -1393,6 +1393,8 @@ struct ieee80211_mgmt { + __le16 status; + __le16 capab; + __le16 timeout; ++ /* followed by BA Extension */ ++ u8 variable[]; + } __packed addba_resp; + struct{ + u8 action_code; +diff --git a/net/mac80211/agg-tx.c b/net/mac80211/agg-tx.c +index 21d55dc..fefbf17 100644 +--- a/net/mac80211/agg-tx.c ++++ b/net/mac80211/agg-tx.c +@@ -66,9 +66,16 @@ static void ieee80211_send_addba_request(struct ieee80211_sub_if_data *sdata, + struct ieee80211_local *local = sdata->local; + struct sk_buff *skb; + struct ieee80211_mgmt *mgmt; ++ struct ieee80211_addba_ext_ie *addba_ext; ++ u8 *pos; + u16 capab; + +- skb = dev_alloc_skb(sizeof(*mgmt) + local->hw.extra_tx_headroom); ++ if (agg_size >= 1024) ++ skb = dev_alloc_skb(sizeof(*mgmt) + ++ 2 + sizeof(struct ieee80211_addba_ext_ie) + ++ local->hw.extra_tx_headroom); ++ else ++ skb = dev_alloc_skb(sizeof(*mgmt) + local->hw.extra_tx_headroom); + + if (!skb) + return; +@@ -106,6 +113,15 @@ static void ieee80211_send_addba_request(struct ieee80211_sub_if_data *sdata, + mgmt->u.action.u.addba_req.start_seq_num = + cpu_to_le16(start_seq_num << 4); + ++ if (agg_size >= 1024) { ++ pos = skb_put_zero(skb, 2 + sizeof(struct ieee80211_addba_ext_ie)); ++ *pos++ = WLAN_EID_ADDBA_EXT; ++ *pos++ = sizeof(struct ieee80211_addba_ext_ie); ++ addba_ext = (struct ieee80211_addba_ext_ie *)pos; ++ addba_ext->data = u8_encode_bits(agg_size >> IEEE80211_ADDBA_EXT_BUF_SIZE_SHIFT, ++ IEEE80211_ADDBA_EXT_BUF_SIZE_MASK); ++ } ++ + ieee80211_tx_skb_tid(sdata, skb, tid, -1); + } + +@@ -473,8 +489,11 @@ static void ieee80211_send_addba_with_timeout(struct sta_info *sta, + sta->ampdu_mlme.addba_req_num[tid]++; + spin_unlock_bh(&sta->lock); + +- if (sta->sta.deflink.he_cap.has_he) { ++ if (sta->sta.deflink.eht_cap.has_eht) { + buf_size = local->hw.max_tx_aggregation_subframes; ++ } else if (sta->sta.deflink.he_cap.has_he) { ++ buf_size = min_t(u16, local->hw.max_tx_aggregation_subframes, ++ IEEE80211_MAX_AMPDU_BUF_HE); + } else { + /* + * We really should use what the driver told us it will +@@ -972,8 +991,10 @@ void ieee80211_process_addba_resp(struct ieee80211_local *local, + { + struct tid_ampdu_tx *tid_tx; + struct ieee80211_txq *txq; ++ struct ieee802_11_elems *elems; + u16 capab, tid, buf_size; + bool amsdu; ++ int ext_ie_len; + + lockdep_assert_wiphy(sta->local->hw.wiphy); + +@@ -981,6 +1002,28 @@ void ieee80211_process_addba_resp(struct ieee80211_local *local, + amsdu = capab & IEEE80211_ADDBA_PARAM_AMSDU_MASK; + tid = u16_get_bits(capab, IEEE80211_ADDBA_PARAM_TID_MASK); + buf_size = u16_get_bits(capab, IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK); ++ ++ ext_ie_len = len - offsetof(struct ieee80211_mgmt, ++ u.action.u.addba_resp.variable); ++ ++ if (ext_ie_len < 0) ++ goto next; ++ ++ elems = ieee802_11_parse_elems(mgmt->u.action.u.addba_resp.variable, ++ ext_ie_len, true, NULL); ++ ++ if (elems && !elems->parse_error) { ++ if (sta->sta.deflink.eht_cap.has_eht && elems->addba_ext_ie) { ++ u8 buf_size_1k = u8_get_bits(elems->addba_ext_ie->data, ++ IEEE80211_ADDBA_EXT_BUF_SIZE_MASK); ++ buf_size |= buf_size_1k << IEEE80211_ADDBA_EXT_BUF_SIZE_SHIFT; ++ } ++ } ++ ++ if (elems) ++ kfree(elems); ++ ++next: + buf_size = min(buf_size, local->hw.max_tx_aggregation_subframes); + + txq = sta->sta.txq[tid]; +-- +2.45.2 diff --git a/package/kernel/mac80211/patches/subsys/0002-mtk-mac80211-add-rate-duration-for-EHT-rate.patch b/package/kernel/mac80211/patches/subsys/0002-mtk-mac80211-add-rate-duration-for-EHT-rate.patch new file mode 100644 index 00000000000000..5e3d05862bf109 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/0002-mtk-mac80211-add-rate-duration-for-EHT-rate.patch @@ -0,0 +1,437 @@ +From 87774509ec7a9c7dea18a542eddd895dd2158b1a Mon Sep 17 00:00:00 2001 +From: Evelyn Tsai +Date: Wed, 28 Aug 2024 02:17:57 +0800 +mtk: mac80211: add rate duration for EHT rate. +--- + net/mac80211/airtime.c | 349 ++++++++++++++++++++++++++++++++++++++++- + 1 file changed, 346 insertions(+), 3 deletions(-) +diff --git a/net/mac80211/airtime.c b/net/mac80211/airtime.c +index fdf8b65..370477c 100644 +--- a/net/mac80211/airtime.c ++++ b/net/mac80211/airtime.c +@@ -55,10 +55,21 @@ + #define HE_DURATION_S(shift, streams, gi, bps) \ + (HE_DURATION(streams, gi, bps) >> shift) + ++/* Transmit duration for the raw data part of an average sized packet */ ++#define EHT_GI_08 HE_GI_08 ++#define EHT_GI_16 HE_GI_16 ++#define EHT_GI_32 HE_GI_32 ++ ++#define EHT_DURATION(streams, gi, bps) \ ++ HE_DURATION(streams, gi, bps) ++#define EHT_DURATION_S(shift, streams, gi, bps) \ ++ HE_DURATION_S(shift, streams, gi, bps) ++ + #define BW_20 0 + #define BW_40 1 + #define BW_80 2 + #define BW_160 3 ++#define BW_320 4 + + /* + * Define group sort order: HT40 -> SGI -> #streams +@@ -68,17 +79,26 @@ + #define IEEE80211_VHT_STREAM_GROUPS 8 /* BW(=4) * SGI(=2) */ + + #define IEEE80211_HE_MAX_STREAMS 8 ++#define IEEE80211_HE_STREAM_GROUPS 12 /* BW(=4) * GI(=3) */ ++ ++#define IEEE80211_EHT_MAX_STREAMS 16 ++#define IEEE80211_EHT_STREAM_GROUPS 15 /* BW(=5) * GI(=3) */ + + #define IEEE80211_HT_GROUPS_NB (IEEE80211_MAX_STREAMS * \ + IEEE80211_HT_STREAM_GROUPS) + #define IEEE80211_VHT_GROUPS_NB (IEEE80211_MAX_STREAMS * \ + IEEE80211_VHT_STREAM_GROUPS) ++#define IEEE80211_HE_GROUPS_NB (IEEE80211_HE_MAX_STREAMS * \ ++ IEEE80211_HE_STREAM_GROUPS) ++#define IEEE80211_EHT_GROUPS_NB (IEEE80211_EHT_MAX_STREAMS * \ ++ IEEE80211_EHT_STREAM_GROUPS) + + #define IEEE80211_HT_GROUP_0 0 + #define IEEE80211_VHT_GROUP_0 (IEEE80211_HT_GROUP_0 + IEEE80211_HT_GROUPS_NB) + #define IEEE80211_HE_GROUP_0 (IEEE80211_VHT_GROUP_0 + IEEE80211_VHT_GROUPS_NB) ++#define IEEE80211_EHT_GROUP_0 (IEEE80211_HE_GROUP_0 + IEEE80211_HE_GROUPS_NB) + +-#define MCS_GROUP_RATES 12 ++#define MCS_GROUP_RATES 14 + + #define HT_GROUP_IDX(_streams, _sgi, _ht40) \ + IEEE80211_HT_GROUP_0 + \ +@@ -203,6 +223,59 @@ + #define HE_GROUP(_streams, _gi, _bw) \ + __HE_GROUP(_streams, _gi, _bw, \ + HE_GROUP_SHIFT(_streams, _gi, _bw)) ++ ++#define EHT_BW2VBPS(_bw, r5, r4, r3, r2, r1) \ ++ (_bw == BW_320 ? r5 : _bw == BW_160 ? r4 : _bw == BW_80 ? r3 : _bw == BW_40 ? r2 : r1) ++ ++#define EHT_GROUP_IDX(_streams, _gi, _bw) \ ++ (IEEE80211_EHT_GROUP_0 + \ ++ IEEE80211_EHT_MAX_STREAMS * 3 * (_bw) + \ ++ IEEE80211_EHT_MAX_STREAMS * (_gi) + \ ++ (_streams) - 1) ++ ++#define __EHT_GROUP(_streams, _gi, _bw, _s) \ ++ [EHT_GROUP_IDX(_streams, _gi, _bw)] = { \ ++ .shift = _s, \ ++ .duration = { \ ++ EHT_DURATION_S(_s, _streams, _gi, \ ++ EHT_BW2VBPS(_bw, 1960, 979, 489, 230, 115)), \ ++ EHT_DURATION_S(_s, _streams, _gi, \ ++ EHT_BW2VBPS(_bw, 3920, 1958, 979, 475, 230)), \ ++ EHT_DURATION_S(_s, _streams, _gi, \ ++ EHT_BW2VBPS(_bw, 5880, 2937, 1468, 705, 345)), \ ++ EHT_DURATION_S(_s, _streams, _gi, \ ++ EHT_BW2VBPS(_bw, 7840, 3916, 1958, 936, 475)), \ ++ EHT_DURATION_S(_s, _streams, _gi, \ ++ EHT_BW2VBPS(_bw, 11760, 5875, 2937, 1411, 705)), \ ++ EHT_DURATION_S(_s, _streams, _gi, \ ++ EHT_BW2VBPS(_bw, 15680, 7833, 3916, 1872, 936)), \ ++ EHT_DURATION_S(_s, _streams, _gi, \ ++ EHT_BW2VBPS(_bw, 17640, 8827, 4406, 2102, 1051)), \ ++ EHT_DURATION_S(_s, _streams, _gi, \ ++ EHT_BW2VBPS(_bw, 19600, 9806, 4896, 2347, 1166)), \ ++ EHT_DURATION_S(_s, _streams, _gi, \ ++ EHT_BW2VBPS(_bw, 23520, 11764, 5875, 2808, 1411)), \ ++ EHT_DURATION_S(_s, _streams, _gi, \ ++ EHT_BW2VBPS(_bw, 26133, 13060, 6523, 3124, 1555)), \ ++ EHT_DURATION_S(_s, _streams, _gi, \ ++ EHT_BW2VBPS(_bw, 29400, 14702, 7344, 3513, 1756)), \ ++ EHT_DURATION_S(_s, _streams, _gi, \ ++ EHT_BW2VBPS(_bw, 32666, 16329, 8164, 3902, 1944)), \ ++ EHT_DURATION_S(_s, _streams, _gi, \ ++ EHT_BW2VBPS(_bw, 35280, 17640, 8820, 4212, 2106)), \ ++ EHT_DURATION_S(_s, _streams, _gi, \ ++ EHT_BW2VBPS(_bw, 39200, 19600, 9800, 4680, 2340)) \ ++ } \ ++} ++ ++#define EHT_GROUP_SHIFT(_streams, _gi, _bw) \ ++ GROUP_SHIFT(EHT_DURATION(_streams, _gi, \ ++ EHT_BW2VBPS(_bw, 1960, 979, 489, 230, 115))) ++ ++#define EHT_GROUP(_streams, _gi, _bw) \ ++ __EHT_GROUP(_streams, _gi, _bw, \ ++ EHT_GROUP_SHIFT(_streams, _gi, _bw)) ++ + struct mcs_group { + u8 shift; + u16 duration[MCS_GROUP_RATES]; +@@ -376,6 +449,262 @@ static const struct mcs_group airtime_mcs_groups[] = { + HE_GROUP(6, HE_GI_32, BW_160), + HE_GROUP(7, HE_GI_32, BW_160), + HE_GROUP(8, HE_GI_32, BW_160), ++ ++ /* EHT */ ++ EHT_GROUP( 1, EHT_GI_08, BW_20), ++ EHT_GROUP( 2, EHT_GI_08, BW_20), ++ EHT_GROUP( 3, EHT_GI_08, BW_20), ++ EHT_GROUP( 4, EHT_GI_08, BW_20), ++ EHT_GROUP( 5, EHT_GI_08, BW_20), ++ EHT_GROUP( 6, EHT_GI_08, BW_20), ++ EHT_GROUP( 7, EHT_GI_08, BW_20), ++ EHT_GROUP( 8, EHT_GI_08, BW_20), ++ EHT_GROUP( 9, EHT_GI_08, BW_20), ++ EHT_GROUP(10, EHT_GI_08, BW_20), ++ EHT_GROUP(11, EHT_GI_08, BW_20), ++ EHT_GROUP(12, EHT_GI_08, BW_20), ++ EHT_GROUP(13, EHT_GI_08, BW_20), ++ EHT_GROUP(14, EHT_GI_08, BW_20), ++ EHT_GROUP(15, EHT_GI_08, BW_20), ++ EHT_GROUP(16, EHT_GI_08, BW_20), ++ ++ EHT_GROUP( 1, EHT_GI_16, BW_20), ++ EHT_GROUP( 2, EHT_GI_16, BW_20), ++ EHT_GROUP( 3, EHT_GI_16, BW_20), ++ EHT_GROUP( 4, EHT_GI_16, BW_20), ++ EHT_GROUP( 5, EHT_GI_16, BW_20), ++ EHT_GROUP( 6, EHT_GI_16, BW_20), ++ EHT_GROUP( 7, EHT_GI_16, BW_20), ++ EHT_GROUP( 8, EHT_GI_16, BW_20), ++ EHT_GROUP( 9, EHT_GI_16, BW_20), ++ EHT_GROUP(10, EHT_GI_16, BW_20), ++ EHT_GROUP(11, EHT_GI_16, BW_20), ++ EHT_GROUP(12, EHT_GI_16, BW_20), ++ EHT_GROUP(13, EHT_GI_16, BW_20), ++ EHT_GROUP(14, EHT_GI_16, BW_20), ++ EHT_GROUP(15, EHT_GI_16, BW_20), ++ EHT_GROUP(16, EHT_GI_16, BW_20), ++ ++ EHT_GROUP( 1, EHT_GI_32, BW_20), ++ EHT_GROUP( 2, EHT_GI_32, BW_20), ++ EHT_GROUP( 3, EHT_GI_32, BW_20), ++ EHT_GROUP( 4, EHT_GI_32, BW_20), ++ EHT_GROUP( 5, EHT_GI_32, BW_20), ++ EHT_GROUP( 6, EHT_GI_32, BW_20), ++ EHT_GROUP( 7, EHT_GI_32, BW_20), ++ EHT_GROUP( 8, EHT_GI_32, BW_20), ++ EHT_GROUP( 9, EHT_GI_32, BW_20), ++ EHT_GROUP(10, EHT_GI_32, BW_20), ++ EHT_GROUP(11, EHT_GI_32, BW_20), ++ EHT_GROUP(12, EHT_GI_32, BW_20), ++ EHT_GROUP(13, EHT_GI_32, BW_20), ++ EHT_GROUP(14, EHT_GI_32, BW_20), ++ EHT_GROUP(15, EHT_GI_32, BW_20), ++ EHT_GROUP(16, EHT_GI_32, BW_20), ++ ++ EHT_GROUP( 1, EHT_GI_08, BW_40), ++ EHT_GROUP( 2, EHT_GI_08, BW_40), ++ EHT_GROUP( 3, EHT_GI_08, BW_40), ++ EHT_GROUP( 4, EHT_GI_08, BW_40), ++ EHT_GROUP( 5, EHT_GI_08, BW_40), ++ EHT_GROUP( 6, EHT_GI_08, BW_40), ++ EHT_GROUP( 7, EHT_GI_08, BW_40), ++ EHT_GROUP( 8, EHT_GI_08, BW_40), ++ EHT_GROUP( 9, EHT_GI_08, BW_40), ++ EHT_GROUP(10, EHT_GI_08, BW_40), ++ EHT_GROUP(11, EHT_GI_08, BW_40), ++ EHT_GROUP(12, EHT_GI_08, BW_40), ++ EHT_GROUP(13, EHT_GI_08, BW_40), ++ EHT_GROUP(14, EHT_GI_08, BW_40), ++ EHT_GROUP(15, EHT_GI_08, BW_40), ++ EHT_GROUP(16, EHT_GI_08, BW_40), ++ ++ EHT_GROUP( 1, EHT_GI_16, BW_40), ++ EHT_GROUP( 2, EHT_GI_16, BW_40), ++ EHT_GROUP( 3, EHT_GI_16, BW_40), ++ EHT_GROUP( 4, EHT_GI_16, BW_40), ++ EHT_GROUP( 5, EHT_GI_16, BW_40), ++ EHT_GROUP( 6, EHT_GI_16, BW_40), ++ EHT_GROUP( 7, EHT_GI_16, BW_40), ++ EHT_GROUP( 8, EHT_GI_16, BW_40), ++ EHT_GROUP( 9, EHT_GI_16, BW_40), ++ EHT_GROUP(10, EHT_GI_16, BW_40), ++ EHT_GROUP(11, EHT_GI_16, BW_40), ++ EHT_GROUP(12, EHT_GI_16, BW_40), ++ EHT_GROUP(13, EHT_GI_16, BW_40), ++ EHT_GROUP(14, EHT_GI_16, BW_40), ++ EHT_GROUP(15, EHT_GI_16, BW_40), ++ EHT_GROUP(16, EHT_GI_16, BW_40), ++ ++ EHT_GROUP( 1, EHT_GI_32, BW_40), ++ EHT_GROUP( 2, EHT_GI_32, BW_40), ++ EHT_GROUP( 3, EHT_GI_32, BW_40), ++ EHT_GROUP( 4, EHT_GI_32, BW_40), ++ EHT_GROUP( 5, EHT_GI_32, BW_40), ++ EHT_GROUP( 6, EHT_GI_32, BW_40), ++ EHT_GROUP( 7, EHT_GI_32, BW_40), ++ EHT_GROUP( 8, EHT_GI_32, BW_40), ++ EHT_GROUP( 9, EHT_GI_32, BW_40), ++ EHT_GROUP(10, EHT_GI_32, BW_40), ++ EHT_GROUP(11, EHT_GI_32, BW_40), ++ EHT_GROUP(12, EHT_GI_32, BW_40), ++ EHT_GROUP(13, EHT_GI_32, BW_40), ++ EHT_GROUP(14, EHT_GI_32, BW_40), ++ EHT_GROUP(15, EHT_GI_32, BW_40), ++ EHT_GROUP(16, EHT_GI_32, BW_40), ++ ++ EHT_GROUP( 1, EHT_GI_08, BW_80), ++ EHT_GROUP( 2, EHT_GI_08, BW_80), ++ EHT_GROUP( 3, EHT_GI_08, BW_80), ++ EHT_GROUP( 4, EHT_GI_08, BW_80), ++ EHT_GROUP( 5, EHT_GI_08, BW_80), ++ EHT_GROUP( 6, EHT_GI_08, BW_80), ++ EHT_GROUP( 7, EHT_GI_08, BW_80), ++ EHT_GROUP( 8, EHT_GI_08, BW_80), ++ EHT_GROUP( 9, EHT_GI_08, BW_80), ++ EHT_GROUP(10, EHT_GI_08, BW_80), ++ EHT_GROUP(11, EHT_GI_08, BW_80), ++ EHT_GROUP(12, EHT_GI_08, BW_80), ++ EHT_GROUP(13, EHT_GI_08, BW_80), ++ EHT_GROUP(14, EHT_GI_08, BW_80), ++ EHT_GROUP(15, EHT_GI_08, BW_80), ++ EHT_GROUP(16, EHT_GI_08, BW_80), ++ ++ EHT_GROUP( 1, EHT_GI_16, BW_80), ++ EHT_GROUP( 2, EHT_GI_16, BW_80), ++ EHT_GROUP( 3, EHT_GI_16, BW_80), ++ EHT_GROUP( 4, EHT_GI_16, BW_80), ++ EHT_GROUP( 5, EHT_GI_16, BW_80), ++ EHT_GROUP( 6, EHT_GI_16, BW_80), ++ EHT_GROUP( 7, EHT_GI_16, BW_80), ++ EHT_GROUP( 8, EHT_GI_16, BW_80), ++ EHT_GROUP( 9, EHT_GI_16, BW_80), ++ EHT_GROUP(10, EHT_GI_16, BW_80), ++ EHT_GROUP(11, EHT_GI_16, BW_80), ++ EHT_GROUP(12, EHT_GI_16, BW_80), ++ EHT_GROUP(13, EHT_GI_16, BW_80), ++ EHT_GROUP(14, EHT_GI_16, BW_80), ++ EHT_GROUP(15, EHT_GI_16, BW_80), ++ EHT_GROUP(16, EHT_GI_16, BW_80), ++ ++ EHT_GROUP( 1, EHT_GI_32, BW_80), ++ EHT_GROUP( 2, EHT_GI_32, BW_80), ++ EHT_GROUP( 3, EHT_GI_32, BW_80), ++ EHT_GROUP( 4, EHT_GI_32, BW_80), ++ EHT_GROUP( 5, EHT_GI_32, BW_80), ++ EHT_GROUP( 6, EHT_GI_32, BW_80), ++ EHT_GROUP( 7, EHT_GI_32, BW_80), ++ EHT_GROUP( 8, EHT_GI_32, BW_80), ++ EHT_GROUP( 9, EHT_GI_32, BW_80), ++ EHT_GROUP(10, EHT_GI_32, BW_80), ++ EHT_GROUP(11, EHT_GI_32, BW_80), ++ EHT_GROUP(12, EHT_GI_32, BW_80), ++ EHT_GROUP(13, EHT_GI_32, BW_80), ++ EHT_GROUP(14, EHT_GI_32, BW_80), ++ EHT_GROUP(15, EHT_GI_32, BW_80), ++ EHT_GROUP(16, EHT_GI_32, BW_80), ++ ++ EHT_GROUP( 1, EHT_GI_08, BW_160), ++ EHT_GROUP( 2, EHT_GI_08, BW_160), ++ EHT_GROUP( 3, EHT_GI_08, BW_160), ++ EHT_GROUP( 4, EHT_GI_08, BW_160), ++ EHT_GROUP( 5, EHT_GI_08, BW_160), ++ EHT_GROUP( 6, EHT_GI_08, BW_160), ++ EHT_GROUP( 7, EHT_GI_08, BW_160), ++ EHT_GROUP( 8, EHT_GI_08, BW_160), ++ EHT_GROUP( 9, EHT_GI_08, BW_160), ++ EHT_GROUP(10, EHT_GI_08, BW_160), ++ EHT_GROUP(11, EHT_GI_08, BW_160), ++ EHT_GROUP(12, EHT_GI_08, BW_160), ++ EHT_GROUP(13, EHT_GI_08, BW_160), ++ EHT_GROUP(14, EHT_GI_08, BW_160), ++ EHT_GROUP(15, EHT_GI_08, BW_160), ++ EHT_GROUP(16, EHT_GI_08, BW_160), ++ ++ EHT_GROUP( 1, EHT_GI_16, BW_160), ++ EHT_GROUP( 2, EHT_GI_16, BW_160), ++ EHT_GROUP( 3, EHT_GI_16, BW_160), ++ EHT_GROUP( 4, EHT_GI_16, BW_160), ++ EHT_GROUP( 5, EHT_GI_16, BW_160), ++ EHT_GROUP( 6, EHT_GI_16, BW_160), ++ EHT_GROUP( 7, EHT_GI_16, BW_160), ++ EHT_GROUP( 8, EHT_GI_16, BW_160), ++ EHT_GROUP( 9, EHT_GI_16, BW_160), ++ EHT_GROUP(10, EHT_GI_16, BW_160), ++ EHT_GROUP(11, EHT_GI_16, BW_160), ++ EHT_GROUP(12, EHT_GI_16, BW_160), ++ EHT_GROUP(13, EHT_GI_16, BW_160), ++ EHT_GROUP(14, EHT_GI_16, BW_160), ++ EHT_GROUP(15, EHT_GI_16, BW_160), ++ EHT_GROUP(16, EHT_GI_16, BW_160), ++ ++ EHT_GROUP( 1, EHT_GI_32, BW_160), ++ EHT_GROUP( 2, EHT_GI_32, BW_160), ++ EHT_GROUP( 3, EHT_GI_32, BW_160), ++ EHT_GROUP( 4, EHT_GI_32, BW_160), ++ EHT_GROUP( 5, EHT_GI_32, BW_160), ++ EHT_GROUP( 6, EHT_GI_32, BW_160), ++ EHT_GROUP( 7, EHT_GI_32, BW_160), ++ EHT_GROUP( 8, EHT_GI_32, BW_160), ++ EHT_GROUP( 9, EHT_GI_32, BW_160), ++ EHT_GROUP(10, EHT_GI_32, BW_160), ++ EHT_GROUP(11, EHT_GI_32, BW_160), ++ EHT_GROUP(12, EHT_GI_32, BW_160), ++ EHT_GROUP(13, EHT_GI_32, BW_160), ++ EHT_GROUP(14, EHT_GI_32, BW_160), ++ EHT_GROUP(15, EHT_GI_32, BW_160), ++ EHT_GROUP(16, EHT_GI_32, BW_160), ++ ++ EHT_GROUP( 1, EHT_GI_08, BW_320), ++ EHT_GROUP( 2, EHT_GI_08, BW_320), ++ EHT_GROUP( 3, EHT_GI_08, BW_320), ++ EHT_GROUP( 4, EHT_GI_08, BW_320), ++ EHT_GROUP( 5, EHT_GI_08, BW_320), ++ EHT_GROUP( 6, EHT_GI_08, BW_320), ++ EHT_GROUP( 7, EHT_GI_08, BW_320), ++ EHT_GROUP( 8, EHT_GI_08, BW_320), ++ EHT_GROUP( 9, EHT_GI_08, BW_320), ++ EHT_GROUP(10, EHT_GI_08, BW_320), ++ EHT_GROUP(11, EHT_GI_08, BW_320), ++ EHT_GROUP(12, EHT_GI_08, BW_320), ++ EHT_GROUP(13, EHT_GI_08, BW_320), ++ EHT_GROUP(14, EHT_GI_08, BW_320), ++ EHT_GROUP(15, EHT_GI_08, BW_320), ++ EHT_GROUP(16, EHT_GI_08, BW_320), ++ ++ EHT_GROUP( 1, EHT_GI_16, BW_320), ++ EHT_GROUP( 2, EHT_GI_16, BW_320), ++ EHT_GROUP( 3, EHT_GI_16, BW_320), ++ EHT_GROUP( 4, EHT_GI_16, BW_320), ++ EHT_GROUP( 5, EHT_GI_16, BW_320), ++ EHT_GROUP( 6, EHT_GI_16, BW_320), ++ EHT_GROUP( 7, EHT_GI_16, BW_320), ++ EHT_GROUP( 8, EHT_GI_16, BW_320), ++ EHT_GROUP( 9, EHT_GI_16, BW_320), ++ EHT_GROUP(10, EHT_GI_16, BW_320), ++ EHT_GROUP(11, EHT_GI_16, BW_320), ++ EHT_GROUP(12, EHT_GI_16, BW_320), ++ EHT_GROUP(13, EHT_GI_16, BW_320), ++ EHT_GROUP(14, EHT_GI_16, BW_320), ++ EHT_GROUP(15, EHT_GI_16, BW_320), ++ EHT_GROUP(16, EHT_GI_16, BW_320), ++ ++ EHT_GROUP( 1, EHT_GI_32, BW_320), ++ EHT_GROUP( 2, EHT_GI_32, BW_320), ++ EHT_GROUP( 3, EHT_GI_32, BW_320), ++ EHT_GROUP( 4, EHT_GI_32, BW_320), ++ EHT_GROUP( 5, EHT_GI_32, BW_320), ++ EHT_GROUP( 6, EHT_GI_32, BW_320), ++ EHT_GROUP( 7, EHT_GI_32, BW_320), ++ EHT_GROUP( 8, EHT_GI_32, BW_320), ++ EHT_GROUP( 9, EHT_GI_32, BW_320), ++ EHT_GROUP(10, EHT_GI_32, BW_320), ++ EHT_GROUP(11, EHT_GI_32, BW_320), ++ EHT_GROUP(12, EHT_GI_32, BW_320), ++ EHT_GROUP(13, EHT_GI_32, BW_320), ++ EHT_GROUP(14, EHT_GI_32, BW_320), ++ EHT_GROUP(15, EHT_GI_32, BW_320), ++ EHT_GROUP(16, EHT_GI_32, BW_320), + }; + + static u32 +@@ -422,6 +751,9 @@ static u32 ieee80211_get_rate_duration(struct ieee80211_hw *hw, + case RATE_INFO_BW_160: + bw = BW_160; + break; ++ case RATE_INFO_BW_320: ++ bw = BW_320; ++ break; + default: + WARN_ON_ONCE(1); + return 0; +@@ -443,11 +775,20 @@ static u32 ieee80211_get_rate_duration(struct ieee80211_hw *hw, + idx = status->rate_idx; + group = HE_GROUP_IDX(streams, status->he_gi, bw); + break; ++ case RX_ENC_EHT: ++ streams = status->nss; ++ idx = status->rate_idx; ++ group = EHT_GROUP_IDX(streams, status->he_gi, bw); ++ break; + default: + WARN_ON_ONCE(1); + return 0; + } + ++ if (WARN_ON_ONCE((status->encoding != RX_ENC_EHT && streams > 8) || ++ (status->encoding == RX_ENC_EHT && streams > 16))) ++ return 0; ++ + if (WARN_ON_ONCE((status->encoding != RX_ENC_HE && streams > 4) || + (status->encoding == RX_ENC_HE && streams > 8))) + return 0; +@@ -517,7 +858,9 @@ static bool ieee80211_fill_rate_info(struct ieee80211_hw *hw, + stat->nss = ri->nss; + stat->rate_idx = ri->mcs; + +- if (ri->flags & RATE_INFO_FLAGS_HE_MCS) ++ if (ri->flags & RATE_INFO_FLAGS_EHT_MCS) ++ stat->encoding = RX_ENC_EHT; ++ else if (ri->flags & RATE_INFO_FLAGS_HE_MCS) + stat->encoding = RX_ENC_HE; + else if (ri->flags & RATE_INFO_FLAGS_VHT_MCS) + stat->encoding = RX_ENC_VHT; +@@ -529,7 +872,7 @@ static bool ieee80211_fill_rate_info(struct ieee80211_hw *hw, + if (ri->flags & RATE_INFO_FLAGS_SHORT_GI) + stat->enc_flags |= RX_ENC_FLAG_SHORT_GI; + +- stat->he_gi = ri->he_gi; ++ stat->he_gi = (ri->flags & RATE_INFO_FLAGS_EHT_MCS) ? ri->eht_gi : ri->he_gi; + + if (stat->encoding != RX_ENC_LEGACY) + return true; +-- +2.45.2 diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile index 20dfbf8f5a208c..433df59a30f527 100644 --- a/package/kernel/mt76/Makefile +++ b/package/kernel/mt76/Makefile @@ -9,8 +9,8 @@ PKG_LICENSE_FILES:= PKG_SOURCE_URL:=https://github.com/rmandrad/mt76 PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2024-09-05 -PKG_SOURCE_VERSION:=97fdd6d61a55398d891f6ffd87344acc3f92df97 +PKG_SOURCE_DATE:=2024-09-11 +PKG_SOURCE_VERSION:=c12640ee09baf17f8a286c92e9e600426073e30d PKG_MIRROR_HASH:=decd9901d7a82d570faa52cc02ea8fa47f252e2e320f04170faa5e19b5bfb21f PKG_MAINTAINER:=Felix Fietkau @@ -634,11 +634,7 @@ endef define KernelPackage/mt7996-firmware/install $(INSTALL_DIR) $(1)/lib/firmware/mediatek/mt7996 cp \ - $(PKG_BUILD_DIR)/firmware/mt7996/mt7996_dsp.bin \ - $(PKG_BUILD_DIR)/firmware/mt7996/mt7996_eeprom.bin \ - $(PKG_BUILD_DIR)/firmware/mt7996/mt7996_rom_patch.bin \ - $(PKG_BUILD_DIR)/firmware/mt7996/mt7996_wa.bin \ - $(PKG_BUILD_DIR)/firmware/mt7996/mt7996_wm.bin \ + $(PKG_BUILD_DIR)/firmware/mt7996/* \ $(1)/lib/firmware/mediatek/mt7996 endef diff --git a/package/kernel/mt76/patches/0002-wifi-mt76-mt7996-background-radar-cap-check-for-2-3-.patch b/package/kernel/mt76/patches/0002-wifi-mt76-mt7996-background-radar-cap-check-for-2-3-.patch new file mode 100644 index 00000000000000..1ddc1df2542679 --- /dev/null +++ b/package/kernel/mt76/patches/0002-wifi-mt76-mt7996-background-radar-cap-check-for-2-3-.patch @@ -0,0 +1,56 @@ +From c307a3423ced37be475dd18adf65886aa8bb54d8 Mon Sep 17 00:00:00 2001 +From: Shayne Chen +Date: Fri, 30 Aug 2024 19:28:21 +0800 +Subject: [PATCH 2/2] wifi: mt76: mt7996: background radar cap check for 2+3+3 + sku +Change-Id: I75928ec859f8f35692eabf17d1771df7f0da799b +--- + mt7996/init.c | 7 ++++--- + mt7996/mt7996.h | 15 +++++++++++++++ + 2 files changed, 19 insertions(+), 3 deletions(-) +diff --git a/mt7996/init.c b/mt7996/init.c +index ab1a9a8e..03dfe5dc 100644 +--- a/mt7996/init.c ++++ b/mt7996/init.c +@@ -390,9 +390,10 @@ mt7996_init_wiphy(struct ieee80211_hw *hw, struct mtk_wed_device *wed) + wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_CAN_REPLACE_PTK0); + wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_MU_MIMO_AIR_SNIFFER); + +- if (!mdev->dev->of_node || +- !of_property_read_bool(mdev->dev->of_node, +- "mediatek,disable-radar-background")) ++ if (mt7996_get_background_radar_cap(phy->dev) && ++ (!mdev->dev->of_node || ++ !of_property_read_bool(mdev->dev->of_node, ++ "mediatek,disable-radar-background"))) + wiphy_ext_feature_set(wiphy, + NL80211_EXT_FEATURE_RADAR_BACKGROUND); + +diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h +index e9fc6134..e7386a90 100644 +--- a/mt7996/mt7996.h ++++ b/mt7996/mt7996.h +@@ -426,6 +426,21 @@ mt7996_band_valid(struct mt7996_dev *dev, u8 band) + return band == MT_BAND0 || band == MT_BAND2; + } + ++static inline bool ++mt7996_get_background_radar_cap(struct mt7996_dev *dev) ++{ ++ switch (mt76_chip(&dev->mt76)) { ++ case 0x7990: ++ if (dev->var_type == MT7996_VAR_TYPE_233) ++ return false; ++ break; ++ default: ++ break; ++ } ++ ++ return true; ++} ++ + extern const struct ieee80211_ops mt7996_ops; + extern struct pci_driver mt7996_pci_driver; + extern struct pci_driver mt7996_hif_driver; +-- +2.45.2 diff --git a/target/linux/mediatek/files-6.6/arch/arm64/boot/dts/mediatek/mt7988a.dtsi b/target/linux/mediatek/files-6.6/arch/arm64/boot/dts/mediatek/mt7988a.dtsi index 6a15dcff3d708a..7146fc72e8a253 100644 --- a/target/linux/mediatek/files-6.6/arch/arm64/boot/dts/mediatek/mt7988a.dtsi +++ b/target/linux/mediatek/files-6.6/arch/arm64/boot/dts/mediatek/mt7988a.dtsi @@ -1512,7 +1512,11 @@ }; crypto: crypto@15600000 { - compatible = "inside-secure,safexcel-eip197b"; + compatible = "security-ip-197-srv", + "inside-secure,safexcel-eip197b", + "inside-secure,safexcel-eip197d", + "inside-secure,safexcel-eip197", + "inside-secure,safexcel-eip97"; reg = <0 0x15600000 0 0x180000>; interrupts = , , diff --git a/target/linux/mediatek/filogic/config-6.6 b/target/linux/mediatek/filogic/config-6.6 index 7127d41bcebea3..eeffa5814b8170 100644 --- a/target/linux/mediatek/filogic/config-6.6 +++ b/target/linux/mediatek/filogic/config-6.6 @@ -216,6 +216,9 @@ CONFIG_HAS_IOPORT_MAP=y CONFIG_HWMON=y CONFIG_HW_RANDOM=y CONFIG_HW_RANDOM_MTK=y +CONFIG_HZ=1000 +# CONFIG_HZ_100 is not set +CONFIG_HZ_1000=y CONFIG_I2C=y CONFIG_I2C_BOARDINFO=y CONFIG_I2C_CHARDEV=y @@ -439,7 +442,9 @@ CONFIG_RTC_DRV_MT7622=y CONFIG_RTC_I2C_AND_SPI=y # CONFIG_RTL8367S_GSW is not set CONFIG_RWSEM_SPIN_ON_OWNER=y +# CONFIG_SCHED_CORE is not set CONFIG_SCHED_MC=y +CONFIG_SCHED_SMT=y CONFIG_SCSI=y CONFIG_SCSI_COMMON=y # CONFIG_SECTION_MISMATCH_WARN_ONLY is not set From 49a74bfa4f96a0c671e1da2fcd47a26be5cc5cef Mon Sep 17 00:00:00 2001 From: Rudy Andram Date: Wed, 11 Sep 2024 14:04:41 +0100 Subject: [PATCH 12/40] enabled CONFIG_NF_NAT in order to be able to offload --- target/linux/mediatek/filogic/config-6.6 | 30 ++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/target/linux/mediatek/filogic/config-6.6 b/target/linux/mediatek/filogic/config-6.6 index eeffa5814b8170..ee8022f0010a96 100644 --- a/target/linux/mediatek/filogic/config-6.6 +++ b/target/linux/mediatek/filogic/config-6.6 @@ -102,11 +102,16 @@ CONFIG_CPU_THERMAL=y CONFIG_CRC16=y CONFIG_CRC_CCITT=y CONFIG_CRYPTO_AES_ARM64=y +CONFIG_CRYPTO_AES_ARM64_BS=y CONFIG_CRYPTO_AES_ARM64_CE=y CONFIG_CRYPTO_AES_ARM64_CE_BLK=y CONFIG_CRYPTO_AES_ARM64_CE_CCM=y +CONFIG_CRYPTO_AES_ARM64_NEON_BLK=y +CONFIG_CRYPTO_ARCH_HAVE_LIB_CHACHA=y +CONFIG_CRYPTO_ARCH_HAVE_LIB_POLY1305=y CONFIG_CRYPTO_AUTHENC=y CONFIG_CRYPTO_CBC=y +CONFIG_CRYPTO_CHACHA20_NEON=y CONFIG_CRYPTO_CMAC=y CONFIG_CRYPTO_CRC32=y CONFIG_CRYPTO_CRC32C=y @@ -125,24 +130,41 @@ CONFIG_CRYPTO_HASH_INFO=y CONFIG_CRYPTO_HMAC=y CONFIG_CRYPTO_JITTERENTROPY=y CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y +CONFIG_CRYPTO_LIB_CHACHA_GENERIC=y CONFIG_CRYPTO_LIB_GF128MUL=y +CONFIG_CRYPTO_LIB_POLY1305_GENERIC=y CONFIG_CRYPTO_LIB_SHA1=y CONFIG_CRYPTO_LIB_SHA256=y CONFIG_CRYPTO_LIB_UTILS=y CONFIG_CRYPTO_LZO=y +CONFIG_CRYPTO_NHPOLY1305=y +CONFIG_CRYPTO_NHPOLY1305_NEON=y +CONFIG_CRYPTO_POLY1305_NEON=y +CONFIG_CRYPTO_POLYVAL=y +CONFIG_CRYPTO_POLYVAL_ARM64_CE=y CONFIG_CRYPTO_RNG=y CONFIG_CRYPTO_RNG2=y CONFIG_CRYPTO_RNG_DEFAULT=y CONFIG_CRYPTO_SEQIV=y +CONFIG_CRYPTO_SHA1=y +CONFIG_CRYPTO_SHA1_ARM64_CE=y CONFIG_CRYPTO_SHA256=y CONFIG_CRYPTO_SHA256_ARM64=y CONFIG_CRYPTO_SHA2_ARM64_CE=y CONFIG_CRYPTO_SHA3=y +CONFIG_CRYPTO_SHA3_ARM64=y CONFIG_CRYPTO_SHA512=y +CONFIG_CRYPTO_SHA512_ARM64=y +CONFIG_CRYPTO_SHA512_ARM64_CE=y +CONFIG_CRYPTO_SM3=y +CONFIG_CRYPTO_SM3_ARM64_CE=y +CONFIG_CRYPTO_SM3_NEON=y CONFIG_CRYPTO_SM4=y +CONFIG_CRYPTO_SM4_ARM64_CE=y CONFIG_CRYPTO_SM4_ARM64_CE_BLK=y CONFIG_CRYPTO_SM4_ARM64_CE_CCM=y CONFIG_CRYPTO_SM4_ARM64_CE_GCM=y +CONFIG_CRYPTO_SM4_ARM64_NEON_BLK=y CONFIG_CRYPTO_ZSTD=y CONFIG_DCACHE_WORD_ACCESS=y CONFIG_DEBUG_INFO=y @@ -305,6 +327,8 @@ CONFIG_MTK_TIMER=y CONFIG_MUTEX_SPIN_ON_OWNER=y CONFIG_NEED_DMA_MAP_STATE=y CONFIG_NEED_SG_DMA_LENGTH=y +CONFIG_NETFILTER=y +CONFIG_NETFILTER_BPF_LINK=y CONFIG_NET_DEVLINK=y CONFIG_NET_DSA=y CONFIG_NET_DSA_MT7530=y @@ -320,6 +344,12 @@ CONFIG_NET_SELFTESTS=y CONFIG_NET_SWITCHDEV=y CONFIG_NET_VENDOR_MEDIATEK=y CONFIG_NET_XGRESS=y +CONFIG_NF_CONNTRACK=m +CONFIG_NF_DEFRAG_IPV4=m +CONFIG_NF_DEFRAG_IPV6=m +CONFIG_NF_LOG_IPV6=m +CONFIG_NF_LOG_SYSLOG=m +CONFIG_NF_NAT=m CONFIG_NLS=y CONFIG_NO_HZ_COMMON=y CONFIG_NO_HZ_IDLE=y From 27d14ea042b1fa13e5cfb1a27dbb8b6ac6f0ac99 Mon Sep 17 00:00:00 2001 From: Rudy Andram Date: Wed, 11 Sep 2024 14:27:29 +0100 Subject: [PATCH 13/40] further enablement of kernel option to support NF_NAT and hw offloading --- target/linux/mediatek/filogic/config-6.6 | 196 ++++++++++++++++++++++- 1 file changed, 192 insertions(+), 4 deletions(-) diff --git a/target/linux/mediatek/filogic/config-6.6 b/target/linux/mediatek/filogic/config-6.6 index ee8022f0010a96..1feae84377583a 100644 --- a/target/linux/mediatek/filogic/config-6.6 +++ b/target/linux/mediatek/filogic/config-6.6 @@ -48,6 +48,7 @@ CONFIG_BLK_DEV_SD=y CONFIG_BLK_MQ_PCI=y CONFIG_BLK_PM=y CONFIG_BLOCK_NOTIFIERS=y +CONFIG_BRIDGE_NETFILTER=m CONFIG_BSD_PROCESS_ACCT=y CONFIG_BSD_PROCESS_ACCT_V3=y CONFIG_BUFFER_HEAD=y @@ -252,7 +253,47 @@ CONFIG_INET6_ESP_OFFLOAD=y CONFIG_INET_ESP=y CONFIG_INET_ESP_OFFLOAD=y CONFIG_INITRAMFS_SOURCE="" +CONFIG_IP6_NF_FILTER=m +CONFIG_IP6_NF_IPTABLES=m +CONFIG_IP6_NF_MANGLE=m +CONFIG_IP6_NF_MATCH_AH=m +CONFIG_IP6_NF_MATCH_EUI64=m +CONFIG_IP6_NF_MATCH_FRAG=m +CONFIG_IP6_NF_MATCH_HL=m +CONFIG_IP6_NF_MATCH_IPV6HEADER=m +CONFIG_IP6_NF_MATCH_MH=m +CONFIG_IP6_NF_MATCH_OPTS=m +CONFIG_IP6_NF_MATCH_RPFILTER=m +CONFIG_IP6_NF_MATCH_RT=m +CONFIG_IP6_NF_MATCH_SRH=m +CONFIG_IP6_NF_NAT=m +CONFIG_IP6_NF_RAW=m +CONFIG_IP6_NF_TARGET_HL=m +CONFIG_IP6_NF_TARGET_MASQUERADE=m +CONFIG_IP6_NF_TARGET_NPT=m +CONFIG_IP6_NF_TARGET_REJECT=m +CONFIG_IP6_NF_TARGET_SYNPROXY=m CONFIG_IPV6=y +CONFIG_IP_NF_ARPFILTER=m +CONFIG_IP_NF_ARPTABLES=m +CONFIG_IP_NF_ARP_MANGLE=m +CONFIG_IP_NF_FILTER=m +CONFIG_IP_NF_IPTABLES=m +CONFIG_IP_NF_MANGLE=m +CONFIG_IP_NF_MATCH_AH=m +CONFIG_IP_NF_MATCH_ECN=m +CONFIG_IP_NF_MATCH_RPFILTER=m +CONFIG_IP_NF_MATCH_TTL=m +CONFIG_IP_NF_NAT=m +CONFIG_IP_NF_RAW=m +CONFIG_IP_NF_TARGET_ECN=m +CONFIG_IP_NF_TARGET_MASQUERADE=m +CONFIG_IP_NF_TARGET_NETMAP=m +CONFIG_IP_NF_TARGET_REDIRECT=m +CONFIG_IP_NF_TARGET_REJECT=m +CONFIG_IP_NF_TARGET_SYNPROXY=m +CONFIG_IP_NF_TARGET_TTL=m +CONFIG_IP_ROUTE_CLASSID=y CONFIG_IRQCHIP=y CONFIG_IRQ_DOMAIN=y CONFIG_IRQ_DOMAIN_HIERARCHY=y @@ -328,7 +369,91 @@ CONFIG_MUTEX_SPIN_ON_OWNER=y CONFIG_NEED_DMA_MAP_STATE=y CONFIG_NEED_SG_DMA_LENGTH=y CONFIG_NETFILTER=y +CONFIG_NETFILTER_ADVANCED=y CONFIG_NETFILTER_BPF_LINK=y +CONFIG_NETFILTER_CONNCOUNT=m +CONFIG_NETFILTER_EGRESS=y +CONFIG_NETFILTER_FAMILY_ARP=y +CONFIG_NETFILTER_FAMILY_BRIDGE=y +CONFIG_NETFILTER_INGRESS=y +CONFIG_NETFILTER_NETLINK=m +CONFIG_NETFILTER_NETLINK_ACCT=m +CONFIG_NETFILTER_NETLINK_GLUE_CT=y +CONFIG_NETFILTER_NETLINK_LOG=m +CONFIG_NETFILTER_NETLINK_OSF=m +CONFIG_NETFILTER_NETLINK_QUEUE=m +CONFIG_NETFILTER_SYNPROXY=m +CONFIG_NETFILTER_XTABLES=m +CONFIG_NETFILTER_XT_CONNMARK=m +CONFIG_NETFILTER_XT_MARK=m +CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m +CONFIG_NETFILTER_XT_MATCH_BPF=m +CONFIG_NETFILTER_XT_MATCH_CLUSTER=m +CONFIG_NETFILTER_XT_MATCH_COMMENT=m +CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m +CONFIG_NETFILTER_XT_MATCH_CONNLABEL=m +CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=m +CONFIG_NETFILTER_XT_MATCH_CONNMARK=m +CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m +CONFIG_NETFILTER_XT_MATCH_CPU=m +CONFIG_NETFILTER_XT_MATCH_DCCP=m +CONFIG_NETFILTER_XT_MATCH_DEVGROUP=m +CONFIG_NETFILTER_XT_MATCH_DSCP=m +CONFIG_NETFILTER_XT_MATCH_ECN=m +CONFIG_NETFILTER_XT_MATCH_ESP=m +CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m +CONFIG_NETFILTER_XT_MATCH_HELPER=m +CONFIG_NETFILTER_XT_MATCH_HL=m +CONFIG_NETFILTER_XT_MATCH_IPCOMP=m +CONFIG_NETFILTER_XT_MATCH_IPRANGE=m +CONFIG_NETFILTER_XT_MATCH_L2TP=m +CONFIG_NETFILTER_XT_MATCH_LENGTH=m +CONFIG_NETFILTER_XT_MATCH_LIMIT=m +CONFIG_NETFILTER_XT_MATCH_MAC=m +CONFIG_NETFILTER_XT_MATCH_MARK=m +CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m +CONFIG_NETFILTER_XT_MATCH_NFACCT=m +CONFIG_NETFILTER_XT_MATCH_OSF=m +CONFIG_NETFILTER_XT_MATCH_OWNER=m +CONFIG_NETFILTER_XT_MATCH_PHYSDEV=m +CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m +CONFIG_NETFILTER_XT_MATCH_POLICY=m +CONFIG_NETFILTER_XT_MATCH_QUOTA=m +CONFIG_NETFILTER_XT_MATCH_RATEEST=m +CONFIG_NETFILTER_XT_MATCH_REALM=m +CONFIG_NETFILTER_XT_MATCH_RECENT=m +CONFIG_NETFILTER_XT_MATCH_SCTP=m +CONFIG_NETFILTER_XT_MATCH_SOCKET=m +CONFIG_NETFILTER_XT_MATCH_STATE=m +CONFIG_NETFILTER_XT_MATCH_STATISTIC=m +CONFIG_NETFILTER_XT_MATCH_STRING=m +CONFIG_NETFILTER_XT_MATCH_TCPMSS=m +CONFIG_NETFILTER_XT_MATCH_TIME=m +CONFIG_NETFILTER_XT_MATCH_U32=m +CONFIG_NETFILTER_XT_NAT=m +CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m +CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m +CONFIG_NETFILTER_XT_TARGET_CONNMARK=m +CONFIG_NETFILTER_XT_TARGET_CT=m +CONFIG_NETFILTER_XT_TARGET_DSCP=m +CONFIG_NETFILTER_XT_TARGET_FLOWOFFLOAD=m +CONFIG_NETFILTER_XT_TARGET_HL=m +CONFIG_NETFILTER_XT_TARGET_HMARK=m +CONFIG_NETFILTER_XT_TARGET_IDLETIMER=m +CONFIG_NETFILTER_XT_TARGET_LED=m +CONFIG_NETFILTER_XT_TARGET_LOG=m +CONFIG_NETFILTER_XT_TARGET_MARK=m +CONFIG_NETFILTER_XT_TARGET_MASQUERADE=m +CONFIG_NETFILTER_XT_TARGET_NETMAP=m +CONFIG_NETFILTER_XT_TARGET_NFLOG=m +CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m +CONFIG_NETFILTER_XT_TARGET_NOTRACK=m +CONFIG_NETFILTER_XT_TARGET_RATEEST=m +CONFIG_NETFILTER_XT_TARGET_REDIRECT=m +CONFIG_NETFILTER_XT_TARGET_TCPMSS=m +CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m +CONFIG_NETFILTER_XT_TARGET_TEE=m +CONFIG_NETFILTER_XT_TARGET_TRACE=m CONFIG_NET_DEVLINK=y CONFIG_NET_DSA=y CONFIG_NET_DSA_MT7530=y @@ -344,12 +469,72 @@ CONFIG_NET_SELFTESTS=y CONFIG_NET_SWITCHDEV=y CONFIG_NET_VENDOR_MEDIATEK=y CONFIG_NET_XGRESS=y -CONFIG_NF_CONNTRACK=m -CONFIG_NF_DEFRAG_IPV4=m -CONFIG_NF_DEFRAG_IPV6=m +CONFIG_NFT_COMPAT=m +CONFIG_NFT_CONNLIMIT=m +CONFIG_NFT_CT=m +CONFIG_NFT_DUP_IPV4=m +CONFIG_NFT_DUP_IPV6=m +CONFIG_NFT_DUP_NETDEV=m +CONFIG_NFT_FIB=m +# CONFIG_NFT_FIB_INET is not set +CONFIG_NFT_FIB_IPV4=m +CONFIG_NFT_FIB_IPV6=m +CONFIG_NFT_FLOW_OFFLOAD=m +CONFIG_NFT_FWD_NETDEV=m +CONFIG_NFT_HASH=m +CONFIG_NFT_LIMIT=m +CONFIG_NFT_LOG=m +CONFIG_NFT_MASQ=m +CONFIG_NFT_NAT=m +CONFIG_NFT_NUMGEN=m +CONFIG_NFT_OSF=m +CONFIG_NFT_QUEUE=m +CONFIG_NFT_QUOTA=m +CONFIG_NFT_REDIR=m +CONFIG_NFT_REJECT=m +CONFIG_NFT_REJECT_INET=m +CONFIG_NFT_REJECT_IPV4=m +CONFIG_NFT_REJECT_IPV6=m +CONFIG_NFT_REJECT_NETDEV=m +CONFIG_NFT_SOCKET=m +CONFIG_NFT_SYNPROXY=m +CONFIG_NFT_TPROXY=m +CONFIG_NFT_TUNNEL=m +CONFIG_NFT_XFRM=m +CONFIG_NF_CONNTRACK=y +CONFIG_NF_CONNTRACK_BRIDGE=m +CONFIG_NF_CONNTRACK_EVENTS=y +CONFIG_NF_CONNTRACK_LABELS=y +CONFIG_NF_CONNTRACK_MARK=y +CONFIG_NF_CONNTRACK_TIMEOUT=y +CONFIG_NF_CONNTRACK_TIMESTAMP=y +CONFIG_NF_CONNTRACK_ZONES=y +CONFIG_NF_CT_NETLINK=m +CONFIG_NF_CT_NETLINK_HELPER=m +CONFIG_NF_CT_NETLINK_TIMEOUT=m +CONFIG_NF_DEFRAG_IPV4=y +CONFIG_NF_DEFRAG_IPV6=y +CONFIG_NF_DUP_IPV4=m +CONFIG_NF_DUP_IPV6=m +CONFIG_NF_DUP_NETDEV=m +CONFIG_NF_FLOW_TABLE=m +CONFIG_NF_FLOW_TABLE_INET=m +CONFIG_NF_FLOW_TABLE_PROCFS=y +CONFIG_NF_LOG_ARP=m +CONFIG_NF_LOG_IPV4=m CONFIG_NF_LOG_IPV6=m CONFIG_NF_LOG_SYSLOG=m -CONFIG_NF_NAT=m +CONFIG_NF_NAT=y +CONFIG_NF_NAT_MASQUERADE=y +CONFIG_NF_NAT_REDIRECT=y +CONFIG_NF_REJECT_IPV4=m +CONFIG_NF_REJECT_IPV6=m +CONFIG_NF_SOCKET_IPV4=m +CONFIG_NF_SOCKET_IPV6=m +CONFIG_NF_TABLES=m +CONFIG_NF_TABLES_BRIDGE=m +CONFIG_NF_TPROXY_IPV4=m +CONFIG_NF_TPROXY_IPV6=m CONFIG_NLS=y CONFIG_NO_HZ_COMMON=y CONFIG_NO_HZ_IDLE=y @@ -509,6 +694,9 @@ CONFIG_SWIOTLB=y CONFIG_SWPHY=y CONFIG_SYSCTL_EXCEPTION_TRACE=y CONFIG_TCP_CONG_BBR=y +CONFIG_TEXTSEARCH_BM=m +CONFIG_TEXTSEARCH_FSM=m +CONFIG_TEXTSEARCH_KMP=m CONFIG_THERMAL=y CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y CONFIG_THERMAL_EMERGENCY_POWEROFF_DELAY_MS=0 From 920aacef8ea7aaa75046f90c8590df3b419f54ff Mon Sep 17 00:00:00 2001 From: Rudy Andram Date: Thu, 12 Sep 2024 05:51:07 +0100 Subject: [PATCH 14/40] fixed hash for mt76 commit; enlarged sdcard file in order for build not to fail --- package/kernel/mt76/Makefile | 2 +- target/linux/mediatek/image/filogic.mk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile index 433df59a30f527..137d0ec717d2a9 100644 --- a/package/kernel/mt76/Makefile +++ b/package/kernel/mt76/Makefile @@ -11,7 +11,7 @@ PKG_SOURCE_PROTO:=git PKG_SOURCE_DATE:=2024-09-11 PKG_SOURCE_VERSION:=c12640ee09baf17f8a286c92e9e600426073e30d -PKG_MIRROR_HASH:=decd9901d7a82d570faa52cc02ea8fa47f252e2e320f04170faa5e19b5bfb21f +PKG_MIRROR_HASH:=82d781b6d57ac1a76c697115230ac63592430d48594e90de2c6bebb27177acb9 PKG_MAINTAINER:=Felix Fietkau PKG_USE_NINJA:=0 diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index e21794600dada9..5ce12352e4bae7 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -382,7 +382,7 @@ define Device/bananapi_bpi-r4-common pad-to 17k | mt7988-bl2 sdmmc-comb |\ pad-to 6656k | mt7988-bl31-uboot $$(DEVICE_NAME)-sdmmc |\ $(if $(CONFIG_TARGET_ROOTFS_INITRAMFS),\ - pad-to 12M | append-image-stage initramfs-recovery.itb | check-size 44m |\ + pad-to 12M | append-image-stage initramfs-recovery.itb | check-size 512m |\ ) \ pad-to 44M | mt7988-bl2 spim-nand-ubi-comb |\ pad-to 45M | mt7988-bl31-uboot $$(DEVICE_NAME)-snand |\ From 14bb928152b8a405ce4a15852a1cbecefa0268fd Mon Sep 17 00:00:00 2001 From: Rudy Andram Date: Thu, 12 Sep 2024 16:21:59 +0100 Subject: [PATCH 15/40] added 11be support to iwinfo,rpcd and initial support on luci (via feeds.conf) --- feeds.conf.default | 2 +- package/network/utils/iwinfo/Makefile | 8 ++++---- package/system/rpcd/Makefile | 6 +++--- target/linux/mediatek/filogic/config-6.6 | 1 + 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/feeds.conf.default b/feeds.conf.default index 182088596ef198..84eb36477db7fe 100644 --- a/feeds.conf.default +++ b/feeds.conf.default @@ -1,5 +1,5 @@ src-git packages https://git.openwrt.org/feed/packages.git -src-git luci https://git.openwrt.org/project/luci.git +src-git luci https://github.com/rmandrad/luci src-git routing https://git.openwrt.org/feed/routing.git src-git telephony https://git.openwrt.org/feed/telephony.git #src-git video https://github.com/openwrt/video.git diff --git a/package/network/utils/iwinfo/Makefile b/package/network/utils/iwinfo/Makefile index 06005d3c6d4b6d..ca4fcff7c0c7f4 100644 --- a/package/network/utils/iwinfo/Makefile +++ b/package/network/utils/iwinfo/Makefile @@ -7,12 +7,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libiwinfo -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE_PROTO:=git -PKG_SOURCE_URL=$(PROJECT_GIT)/project/iwinfo.git -PKG_SOURCE_DATE:=2024-07-06 -PKG_SOURCE_VERSION:=215820132b943b700d56441ecbd5a4efa09edc7c +PKG_SOURCE_URL=https://github.com/rmandrad/iwinfo +PKG_SOURCE_DATE:=2024-09-12 +PKG_SOURCE_VERSION:=872a657482fb652776121ba25e3adeaeb727b2bc PKG_MIRROR_HASH:=f815ee1e0bde98f80a5de9f2711d5044479f936c07e21fc47d3a7f97955e7883 PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=GPL-2.0 diff --git a/package/system/rpcd/Makefile b/package/system/rpcd/Makefile index 041164ccca959a..b641f8c7d0914f 100644 --- a/package/system/rpcd/Makefile +++ b/package/system/rpcd/Makefile @@ -11,9 +11,9 @@ PKG_NAME:=rpcd PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git -PKG_SOURCE_URL=$(PROJECT_GIT)/project/rpcd.git -PKG_MIRROR_HASH:=4b4c0a15180a4e39a5af5a6b9c7cf663bcef53d40df780e4da6edd6e63966006 -PKG_SOURCE_DATE:=2024-02-22 +PKG_SOURCE_URL=https://github.com/rmandrad/rpcd +PKG_MIRROR_HASH:=48caadbe3979bf90a2fbc56083f946dbbba5bbc2 +PKG_SOURCE_DATE:=2024-09-12 PKG_SOURCE_VERSION:=8ef4c2587ac0041049c67befed281a70cf240769 PKG_MAINTAINER:=Jo-Philipp Wich diff --git a/target/linux/mediatek/filogic/config-6.6 b/target/linux/mediatek/filogic/config-6.6 index 1feae84377583a..4673b275361bc8 100644 --- a/target/linux/mediatek/filogic/config-6.6 +++ b/target/linux/mediatek/filogic/config-6.6 @@ -705,6 +705,7 @@ CONFIG_THERMAL_GOV_FAIR_SHARE=y CONFIG_THERMAL_GOV_STEP_WISE=y CONFIG_THERMAL_GOV_USER_SPACE=y CONFIG_THERMAL_HWMON=y +CONFIG_THERMAL_NETLINK=y CONFIG_THERMAL_OF=y CONFIG_THERMAL_WRITABLE_TRIPS=y CONFIG_THREAD_INFO_IN_TASK=y From 5f8daa5b16905e045d9db967e8d668d34c9a066e Mon Sep 17 00:00:00 2001 From: Rudy Andram Date: Sun, 15 Sep 2024 05:21:22 +0100 Subject: [PATCH 16/40] update iwinfo and rpcd packages - removing debug messages --- package/network/utils/iwinfo/Makefile | 2 +- package/system/rpcd/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package/network/utils/iwinfo/Makefile b/package/network/utils/iwinfo/Makefile index ca4fcff7c0c7f4..15828da4eb9f41 100644 --- a/package/network/utils/iwinfo/Makefile +++ b/package/network/utils/iwinfo/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libiwinfo -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=https://github.com/rmandrad/iwinfo diff --git a/package/system/rpcd/Makefile b/package/system/rpcd/Makefile index b641f8c7d0914f..95d116afc71ec1 100644 --- a/package/system/rpcd/Makefile +++ b/package/system/rpcd/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=rpcd -PKG_RELEASE:=1 +PKG_RELEASE:=3 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=https://github.com/rmandrad/rpcd From d2783ea9f7429d4f44321aedd355e41dc8327bc9 Mon Sep 17 00:00:00 2001 From: Rudy Andram Date: Sun, 15 Sep 2024 05:23:58 +0100 Subject: [PATCH 17/40] switch feeds luci to 11be branch --- feeds.conf.default | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/feeds.conf.default b/feeds.conf.default index 84eb36477db7fe..4ad5c9c515b9b1 100644 --- a/feeds.conf.default +++ b/feeds.conf.default @@ -1,5 +1,5 @@ src-git packages https://git.openwrt.org/feed/packages.git -src-git luci https://github.com/rmandrad/luci +src-git luci https://github.com/rmandrad/luci;11be src-git routing https://git.openwrt.org/feed/routing.git src-git telephony https://git.openwrt.org/feed/telephony.git #src-git video https://github.com/openwrt/video.git From 693d2c8f201fe3c7c8b92c94c032207d578458a6 Mon Sep 17 00:00:00 2001 From: Rudy Andram Date: Mon, 16 Sep 2024 14:25:56 +0100 Subject: [PATCH 18/40] bump hostapd --- package/network/services/hostapd/Config.in | 9 +- package/network/services/hostapd/Makefile | 18 +- .../hostapd/files/hostapd-basic.config | 59 +- .../hostapd/files/hostapd-full.config | 67 +- .../hostapd/files/hostapd-mini.config | 59 +- .../hostapd/files/wpa_supplicant-basic.config | 65 +- .../hostapd/files/wpa_supplicant-full.config | 83 +- .../hostapd/files/wpa_supplicant-mini.config | 67 +- .../hostapd/files/wpa_supplicant-p2p.config | 65 +- ...erministic-channel-on-channel-switch.patch | 2 +- ...ix-sta-add-after-previous-connection.patch | 4 +- .../patches/050-Fix-OpenWrt-13156.patch | 4 +- ...-extra-ies-only-if-allowed-by-driver.patch | 2 +- ...efile-make-run-tests-with-CONFIG_TLS.patch | 6 +- ...hecks-encountered-during-tests-hwsim.patch | 2 +- ...tapd-update-cfs0-and-cfs1-for-160MHz.patch | 10 +- .../hostapd/patches/200-multicall.patch | 16 +- ..._AP-functions-dependant-on-CONFIG_AP.patch | 4 +- .../patches/220-indicate-features.patch | 4 +- .../patches/250-hostapd_cli_ifdef.patch | 12 +- .../patches/252-disable_ctrl_iface_mib.patch | 20 +- .../services/hostapd/patches/300-noscan.patch | 4 +- .../patches/330-nl80211_fix_set_freq.patch | 2 +- .../patches/350-nl80211_del_beacon_bss.patch | 2 +- .../381-hostapd_cli_UNKNOWN-COMMAND.patch | 2 +- ...dd-new-config-params-to-be-used-with.patch | 2 +- .../patches/463-add-mcast_rate-to-11s.patch | 6 +- .../patches/590-rrm-wnm-statistics.patch | 4 +- .../hostapd/patches/600-ubus_support.patch | 45 +- .../hostapd/patches/601-ucode_support.patch | 56 +- .../patches/720-iface_max_num_sta.patch | 2 +- .../hostapd/patches/740-snoop_iface.patch | 8 +- .../hostapd/patches/770-radius_server.patch | 2 +- ...ment-APuP-Access-Point-Micro-Peering.patch | 28 +- ...id-Rejected-Groups-element-in-the-pa.patch | 30 - .../803-hostapd-fix-80211be-build.patch | 53 - .../services/hostapd/src/src/ap/ubus.h | 2 - .../services/hostapd/src/src/ap/ucode.c | 2 +- .../services/hostapd/src/src/utils/ap/ubus.c | 2006 ----------------- .../services/hostapd/src/src/utils/ap/ubus.h | 157 -- .../services/hostapd/src/src/utils/ap/ucode.c | 817 ------- .../services/hostapd/src/src/utils/ap/ucode.h | 54 - .../hostapd/src/src/utils/build_features.h | 4 - 43 files changed, 250 insertions(+), 3616 deletions(-) delete mode 100644 package/network/services/hostapd/patches/802-SAE-Reject-invalid-Rejected-Groups-element-in-the-pa.patch delete mode 100644 package/network/services/hostapd/patches/803-hostapd-fix-80211be-build.patch delete mode 100644 package/network/services/hostapd/src/src/utils/ap/ubus.c delete mode 100644 package/network/services/hostapd/src/src/utils/ap/ubus.h delete mode 100644 package/network/services/hostapd/src/src/utils/ap/ucode.c delete mode 100644 package/network/services/hostapd/src/src/utils/ap/ucode.h diff --git a/package/network/services/hostapd/Config.in b/package/network/services/hostapd/Config.in index bd1d94c583a760..1fff4f8acd530b 100644 --- a/package/network/services/hostapd/Config.in +++ b/package/network/services/hostapd/Config.in @@ -33,11 +33,11 @@ config WPA_WOLFSSL config DRIVER_11AC_SUPPORT bool - default y + default n config DRIVER_11AX_SUPPORT bool - default y + default n select WPA_MBO_SUPPORT config WPA_ENABLE_WEP @@ -59,8 +59,3 @@ config WPA_MBO_SUPPORT that facilitate efficient use of multiple frequency bands. Enabling MBO on an AP using RSN requires 802.11w to be enabled. Hostapd will refuse to start if MBO and RSN are enabled without 11w. - -config DRIVER_11BE_SUPPORT - bool - default y - diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile index 232e084b0af982..1c0b6548662e37 100644 --- a/package/network/services/hostapd/Makefile +++ b/package/network/services/hostapd/Makefile @@ -5,13 +5,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=hostapd -PKG_RELEASE:=3 +PKG_RELEASE:=1 -PKG_SOURCE_URL:=https://github.com/rmandrad/hostapd +PKG_SOURCE_URL:=https://w1.fi/hostap.git PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2024-09-04 -PKG_SOURCE_VERSION:=9907c324a0846f3a4899133b9f08ebefb0719ca5 -PKG_MIRROR_HASH:=32deaa53c684be89f9bd69398595d1f539278a1aecb3a3bf605078fe932e2bc3 +PKG_SOURCE_DATE:=2024-09-15 +PKG_SOURCE_VERSION:=5ace39b0a4cdbe18ddbc4e18f80ee3876233c20b +PKG_MIRROR_HASH:=43187d1ddd923970ef3821a0fe267880c2483f6f1a5acd0dd2d7906661ab1372 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=BSD-3-Clause @@ -27,7 +27,6 @@ PKG_CONFIG_DEPENDS:= \ CONFIG_WPA_RFKILL_SUPPORT \ CONFIG_DRIVER_11AC_SUPPORT \ CONFIG_DRIVER_11AX_SUPPORT \ - CONFIG_DRIVER_11BE_SUPPORT \ CONFIG_WPA_ENABLE_WEP PKG_BUILD_FLAGS:=gc-sections lto @@ -80,12 +79,6 @@ ifneq ($(CONFIG_DRIVER_11AX_SUPPORT),) HOSTAPD_IEEE80211AX:=y endif -ifneq ($(CONFIG_DRIVER_11BE_SUPPORT),) - HOSTAPD_IEEE80211BE:=y -endif - - - CORE_DEPENDS = +ucode +libubus +libucode +ucode-mod-fs +ucode-mod-nl80211 +ucode-mod-rtnl +ucode-mod-ubus +ucode-mod-uloop +libblobmsg-json +libudebug OPENSSL_DEPENDS = +PACKAGE_$(1):libopenssl +PACKAGE_$(1):libopenssl-legacy @@ -93,7 +86,6 @@ DRIVER_MAKEOPTS= \ CONFIG_ACS=y CONFIG_DRIVER_NL80211=y \ CONFIG_IEEE80211AC=$(HOSTAPD_IEEE80211AC) \ CONFIG_IEEE80211AX=$(HOSTAPD_IEEE80211AX) \ - CONFIG_IEEE80211BE=$(HOSTAPD_IEEE80211BE) \ CONFIG_MBO=$(CONFIG_WPA_MBO_SUPPORT) \ CONFIG_UCODE=y CONFIG_APUP=y diff --git a/package/network/services/hostapd/files/hostapd-basic.config b/package/network/services/hostapd/files/hostapd-basic.config index dbd1f9dedef514..3d19d8f902f08a 100644 --- a/package/network/services/hostapd/files/hostapd-basic.config +++ b/package/network/services/hostapd/files/hostapd-basic.config @@ -44,9 +44,15 @@ CONFIG_DRIVER_NL80211=y # Driver interface for no driver (e.g., RADIUS server only) #CONFIG_DRIVER_NONE=y +# IEEE 802.11F/IAPP +#CONFIG_IAPP=y + # WPA2/IEEE 802.11i RSN pre-authentication CONFIG_RSN_PREAUTH=y +# IEEE 802.11w (management frame protection) +#CONFIG_IEEE80211W=y + # Support Operating Channel Validation CONFIG_OCV=y @@ -148,6 +154,9 @@ CONFIG_IEEE80211R=y # the IEEE 802.11 Management capability (e.g., FreeBSD/net80211) #CONFIG_DRIVER_RADIUS_ACL=y +# IEEE 802.11n (High Throughput) support +CONFIG_IEEE80211N=y + # Wireless Network Management (IEEE Std 802.11v-2011) # Note: This is experimental and not complete implementation. #CONFIG_WNM=y @@ -156,20 +165,10 @@ CONFIG_IEEE80211R=y CONFIG_IEEE80211AC=y # IEEE 802.11ax HE support -#CONFIG_IEEE80211AX=y - -# IEEE 802.11be EHT support -# CONFIG_IEEE80211AX is mandatory for setting CONFIG_IEEE80211BE. # Note: This is experimental and work in progress. The definitions are still # subject to change and this should not be expected to interoperate with the -# final IEEE 802.11be version. -CONFIG_IEEE80211BE=y - -# Simultaneous Authentication of Equals (SAE), WPA3-Personal -#CONFIG_SAE=y - -# SAE Public Key, WPA3-Personal -#CONFIG_SAE_PK=y +# final IEEE 802.11ax version. +#CONFIG_IEEE80211AX=y # Remove debugging code that is printing out debug messages to stdout. # This can be used to reduce the size of the hostapd considerably if debugging @@ -356,12 +355,12 @@ CONFIG_TLS=internal # * ath10k # # For more details refer to: -# https://wireless.wiki.kernel.org/en/users/documentation/acs +# http://wireless.kernel.org/en/users/Documentation/acs # #CONFIG_ACS=y # Multiband Operation support -# These extensions facilitate efficient use of multiple frequency bands +# These extentions facilitate efficient use of multiple frequency bands # available to the AP and the devices that may associate with it. #CONFIG_MBO=y @@ -387,39 +386,13 @@ CONFIG_TLS=internal # Airtime policy support CONFIG_AIRTIME_POLICY=y +# Proxy ARP support +#CONFIG_PROXYARP=y + # Override default value for the wpa_disable_eapol_key_retries configuration # parameter. See that parameter in hostapd.conf for more details. #CFLAGS += -DDEFAULT_WPA_DISABLE_EAPOL_KEY_RETRIES=1 -# Wired equivalent privacy (WEP) -# WEP is an obsolete cryptographic data confidentiality algorithm that is not -# considered secure. It should not be used for anything anymore. The -# functionality needed to use WEP is available in the current hostapd -# release under this optional build parameter. This functionality is subject to -# be completely removed in a future release. -#CONFIG_WEP=y - -# Remove all TKIP functionality -# TKIP is an old cryptographic data confidentiality algorithm that is not -# considered secure. It should not be used anymore. For now, the default hostapd -# build includes this to allow mixed mode WPA+WPA2 networks to be enabled, but -# that functionality is subject to be removed in the future. -#CONFIG_NO_TKIP=y - -# Pre-Association Security Negotiation (PASN) -# Experimental implementation based on IEEE P802.11z/D2.6 and the protocol -# design is still subject to change. As such, this should not yet be enabled in -# production use. -#CONFIG_PASN=y - -# Device Provisioning Protocol (DPP) (also known as Wi-Fi Easy Connect) -#CONFIG_DPP=y -# DPP version 2 support -#CONFIG_DPP2=y -# DPP version 3 support (experimental and still changing; do not enable for -# production use) -#CONFIG_DPP3=y - # uBus IPC/RPC System # Services can connect to the bus and provide methods # that can be called by other services or clients. diff --git a/package/network/services/hostapd/files/hostapd-full.config b/package/network/services/hostapd/files/hostapd-full.config index 076c2bc6a02254..9076ebc44f95df 100644 --- a/package/network/services/hostapd/files/hostapd-full.config +++ b/package/network/services/hostapd/files/hostapd-full.config @@ -10,7 +10,7 @@ # to override previous values of the variables. # Driver interface for Host AP driver -CONFIG_DRIVER_HOSTAP=y +#CONFIG_DRIVER_HOSTAP=y # Driver interface for wired authenticator CONFIG_DRIVER_WIRED=y @@ -44,9 +44,15 @@ CONFIG_DRIVER_NL80211=y # Driver interface for no driver (e.g., RADIUS server only) #CONFIG_DRIVER_NONE=y +# IEEE 802.11F/IAPP +CONFIG_IAPP=y + # WPA2/IEEE 802.11i RSN pre-authentication CONFIG_RSN_PREAUTH=y +# IEEE 802.11w (management frame protection) +#CONFIG_IEEE80211W=y + # Support Operating Channel Validation CONFIG_OCV=y @@ -148,6 +154,9 @@ CONFIG_IEEE80211R=y # the IEEE 802.11 Management capability (e.g., FreeBSD/net80211) #CONFIG_DRIVER_RADIUS_ACL=y +# IEEE 802.11n (High Throughput) support +CONFIG_IEEE80211N=y + # Wireless Network Management (IEEE Std 802.11v-2011) # Note: This is experimental and not complete implementation. CONFIG_WNM=y @@ -156,20 +165,10 @@ CONFIG_WNM=y CONFIG_IEEE80211AC=y # IEEE 802.11ax HE support -#CONFIG_IEEE80211AX=y - -# IEEE 802.11be EHT support -# CONFIG_IEEE80211AX is mandatory for setting CONFIG_IEEE80211BE. # Note: This is experimental and work in progress. The definitions are still # subject to change and this should not be expected to interoperate with the -# final IEEE 802.11be version. -CONFIG_IEEE80211BE=y - -# Simultaneous Authentication of Equals (SAE), WPA3-Personal -CONFIG_SAE=y - -# SAE Public Key, WPA3-Personal -CONFIG_SAE_PK=y +# final IEEE 802.11ax version. +#CONFIG_IEEE80211AX=y # Remove debugging code that is printing out debug messages to stdout. # This can be used to reduce the size of the hostapd considerably if debugging @@ -289,7 +288,7 @@ CONFIG_TLS=internal # TLS-based EAP methods require at least TLS v1.0. Newer version of TLS (v1.2) # can be enabled to enable use of stronger crypto algorithms. -CONFIG_TLSV12=y +#CONFIG_TLSV12=y # Select which ciphers to use by default with OpenSSL if the user does not # specify them. @@ -323,7 +322,7 @@ CONFIG_HS20=y #CONFIG_SQLITE=y # Enable Fast Session Transfer (FST) -CONFIG_FST=y +#CONFIG_FST=y # Enable CLI commands for FST testing #CONFIG_FST_TEST=y @@ -356,14 +355,14 @@ CONFIG_FST=y # * ath10k # # For more details refer to: -# https://wireless.wiki.kernel.org/en/users/documentation/acs +# http://wireless.kernel.org/en/users/Documentation/acs # #CONFIG_ACS=y # Multiband Operation support -# These extensions facilitate efficient use of multiple frequency bands +# These extentions facilitate efficient use of multiple frequency bands # available to the AP and the devices that may associate with it. -CONFIG_MBO=y +#CONFIG_MBO=y # Client Taxonomy # Has the AP retain the Probe Request and (Re)Association Request frames from @@ -387,39 +386,13 @@ CONFIG_TAXONOMY=y # Airtime policy support CONFIG_AIRTIME_POLICY=y +# Proxy ARP support +CONFIG_PROXYARP=y + # Override default value for the wpa_disable_eapol_key_retries configuration # parameter. See that parameter in hostapd.conf for more details. #CFLAGS += -DDEFAULT_WPA_DISABLE_EAPOL_KEY_RETRIES=1 -# Wired equivalent privacy (WEP) -# WEP is an obsolete cryptographic data confidentiality algorithm that is not -# considered secure. It should not be used for anything anymore. The -# functionality needed to use WEP is available in the current hostapd -# release under this optional build parameter. This functionality is subject to -# be completely removed in a future release. -#CONFIG_WEP=y - -# Remove all TKIP functionality -# TKIP is an old cryptographic data confidentiality algorithm that is not -# considered secure. It should not be used anymore. For now, the default hostapd -# build includes this to allow mixed mode WPA+WPA2 networks to be enabled, but -# that functionality is subject to be removed in the future. -#CONFIG_NO_TKIP=y - -# Pre-Association Security Negotiation (PASN) -# Experimental implementation based on IEEE P802.11z/D2.6 and the protocol -# design is still subject to change. As such, this should not yet be enabled in -# production use. -#CONFIG_PASN=y - -# Device Provisioning Protocol (DPP) (also known as Wi-Fi Easy Connect) -#CONFIG_DPP=y -# DPP version 2 support -#CONFIG_DPP2=y -# DPP version 3 support (experimental and still changing; do not enable for -# production use) -#CONFIG_DPP3=y - # uBus IPC/RPC System # Services can connect to the bus and provide methods # that can be called by other services or clients. diff --git a/package/network/services/hostapd/files/hostapd-mini.config b/package/network/services/hostapd/files/hostapd-mini.config index be0080ffe7a781..f2ed071ec09623 100644 --- a/package/network/services/hostapd/files/hostapd-mini.config +++ b/package/network/services/hostapd/files/hostapd-mini.config @@ -44,9 +44,15 @@ CONFIG_DRIVER_NL80211=y # Driver interface for no driver (e.g., RADIUS server only) #CONFIG_DRIVER_NONE=y +# IEEE 802.11F/IAPP +#CONFIG_IAPP=y + # WPA2/IEEE 802.11i RSN pre-authentication CONFIG_RSN_PREAUTH=y +# IEEE 802.11w (management frame protection) +#CONFIG_IEEE80211W=y + # Support Operating Channel Validation #CONFIG_OCV=y @@ -148,6 +154,9 @@ CONFIG_RSN_PREAUTH=y # the IEEE 802.11 Management capability (e.g., FreeBSD/net80211) #CONFIG_DRIVER_RADIUS_ACL=y +# IEEE 802.11n (High Throughput) support +CONFIG_IEEE80211N=y + # Wireless Network Management (IEEE Std 802.11v-2011) # Note: This is experimental and not complete implementation. #CONFIG_WNM=y @@ -156,20 +165,10 @@ CONFIG_RSN_PREAUTH=y CONFIG_IEEE80211AC=y # IEEE 802.11ax HE support -#CONFIG_IEEE80211AX=y - -# IEEE 802.11be EHT support -# CONFIG_IEEE80211AX is mandatory for setting CONFIG_IEEE80211BE. # Note: This is experimental and work in progress. The definitions are still # subject to change and this should not be expected to interoperate with the -# final IEEE 802.11be version. -CONFIG_IEEE80211BE=y - -# Simultaneous Authentication of Equals (SAE), WPA3-Personal -#CONFIG_SAE=y - -# SAE Public Key, WPA3-Personal -#CONFIG_SAE_PK=y +# final IEEE 802.11ax version. +#CONFIG_IEEE80211AX=y # Remove debugging code that is printing out debug messages to stdout. # This can be used to reduce the size of the hostapd considerably if debugging @@ -356,12 +355,12 @@ CONFIG_TLS=internal # * ath10k # # For more details refer to: -# https://wireless.wiki.kernel.org/en/users/documentation/acs +# http://wireless.kernel.org/en/users/Documentation/acs # #CONFIG_ACS=y # Multiband Operation support -# These extensions facilitate efficient use of multiple frequency bands +# These extentions facilitate efficient use of multiple frequency bands # available to the AP and the devices that may associate with it. #CONFIG_MBO=y @@ -387,39 +386,13 @@ CONFIG_TLS=internal # Airtime policy support #CONFIG_AIRTIME_POLICY=y +# Proxy ARP support +#CONFIG_PROXYARP=y + # Override default value for the wpa_disable_eapol_key_retries configuration # parameter. See that parameter in hostapd.conf for more details. #CFLAGS += -DDEFAULT_WPA_DISABLE_EAPOL_KEY_RETRIES=1 -# Wired equivalent privacy (WEP) -# WEP is an obsolete cryptographic data confidentiality algorithm that is not -# considered secure. It should not be used for anything anymore. The -# functionality needed to use WEP is available in the current hostapd -# release under this optional build parameter. This functionality is subject to -# be completely removed in a future release. -#CONFIG_WEP=y - -# Remove all TKIP functionality -# TKIP is an old cryptographic data confidentiality algorithm that is not -# considered secure. It should not be used anymore. For now, the default hostapd -# build includes this to allow mixed mode WPA+WPA2 networks to be enabled, but -# that functionality is subject to be removed in the future. -#CONFIG_NO_TKIP=y - -# Pre-Association Security Negotiation (PASN) -# Experimental implementation based on IEEE P802.11z/D2.6 and the protocol -# design is still subject to change. As such, this should not yet be enabled in -# production use. -#CONFIG_PASN=y - -# Device Provisioning Protocol (DPP) (also known as Wi-Fi Easy Connect) -#CONFIG_DPP=y -# DPP version 2 support -#CONFIG_DPP2=y -# DPP version 3 support (experimental and still changing; do not enable for -# production use) -#CONFIG_DPP3=y - # uBus IPC/RPC System # Services can connect to the bus and provide methods # that can be called by other services or clients. diff --git a/package/network/services/hostapd/files/wpa_supplicant-basic.config b/package/network/services/hostapd/files/wpa_supplicant-basic.config index a78b17dcecbb20..944b4d92876002 100644 --- a/package/network/services/hostapd/files/wpa_supplicant-basic.config +++ b/package/network/services/hostapd/files/wpa_supplicant-basic.config @@ -101,9 +101,6 @@ CONFIG_DRIVER_WIRED=y # EAP-TLS #CONFIG_EAP_TLS=y -# Enable EAP-TLSv1.3 support by default (currently disabled unless explicitly -# enabled in network configuration) -#CONFIG_EAP_TLSV1_3=y # EAL-PEAP #CONFIG_EAP_PEAP=y @@ -206,9 +203,6 @@ CONFIG_HT_OVERRIDES=y # Support VHT overrides (disable VHT, mask MCS rates, etc.) CONFIG_VHT_OVERRIDES=y -# Support HE overrides -CONFIG_HE_OVERRIDES=y - # Development testing #CONFIG_EAPOL_TEST=y @@ -254,10 +248,7 @@ CONFIG_CTRL_IFACE=y # Simultaneous Authentication of Equals (SAE), WPA3-Personal #CONFIG_SAE=y -# SAE Public Key, WPA3-Personal -#CONFIG_SAE_PK=y - -# Disable scan result processing (ap_scan=1) to save code size by about 1 kB. +# Disable scan result processing (ap_mode=1) to save code size by about 1 kB. # This can be used if ap_scan=1 mode is never enabled. #CONFIG_NO_SCAN_PROCESSING=y @@ -319,6 +310,10 @@ CONFIG_ELOOP_EPOLL=y # bridge interfaces (commit 'bridge: respect RFC2863 operational state')'). CONFIG_NO_LINUX_PACKET_SOCKET_WAR=y +# IEEE 802.11w (management frame protection), also known as PMF +# Driver support is also needed for IEEE 802.11w. +#CONFIG_IEEE80211W=y + # Support Operating Channel Validation CONFIG_OCV=y @@ -371,7 +366,7 @@ CONFIG_TLS=internal #PLATFORMSDKLIB="/opt/Program Files/Microsoft Platform SDK/Lib" # Add support for new DBus control interface -# (fi.w1.wpa_supplicant1) +# (fi.w1.hostap.wpa_supplicant1) #CONFIG_CTRL_IFACE_DBUS_NEW=y # Add introspection support for new DBus control interface @@ -480,19 +475,13 @@ CONFIG_NO_RANDOM_POOL=y # Requires glibc 2.25 to build, falls back to /dev/random if unavailable. CONFIG_GETRANDOM=y +# IEEE 802.11n (High Throughput) support (mainly for AP mode) +#CONFIG_IEEE80211N=y + # IEEE 802.11ac (Very High Throughput) support (mainly for AP mode) +# (depends on CONFIG_IEEE80211N) #CONFIG_IEEE80211AC=y -# IEEE 802.11ax HE support (mainly for AP mode) -#CONFIG_IEEE80211AX=y - -# IEEE 802.11be EHT support (mainly for AP mode) -# CONFIG_IEEE80211AX is mandatory for setting CONFIG_IEEE80211BE. -# Note: This is experimental and work in progress. The definitions are still -# subject to change and this should not be expected to interoperate with the -# final IEEE 802.11be version. -#CONFIG_IEEE80211BE=y - # Wireless Network Management (IEEE Std 802.11v-2011) # Note: This is experimental and not complete implementation. #CONFIG_WNM=y @@ -549,8 +538,6 @@ CONFIG_GETRANDOM=y # # External password backend for testing purposes (developer use) #CONFIG_EXT_PASSWORD_TEST=y -# File-based backend to read passwords from an external file. -#CONFIG_EXT_PASSWORD_FILE=y # Enable Fast Session Transfer (FST) #CONFIG_FST=y @@ -622,36 +609,10 @@ CONFIG_GETRANDOM=y # Experimental implementation of draft-harkins-owe-07.txt #CONFIG_OWE=y -# Device Provisioning Protocol (DPP) (also known as Wi-Fi Easy Connect) +# Device Provisioning Protocol (DPP) +# This requires CONFIG_IEEE80211W=y to be enabled, too. (see +# wpa_supplicant/README-DPP for details) #CONFIG_DPP=y -# DPP version 2 support -#CONFIG_DPP2=y -# DPP version 3 support (experimental and still changing; do not enable for -# production use) -#CONFIG_DPP3=y - -# Wired equivalent privacy (WEP) -# WEP is an obsolete cryptographic data confidentiality algorithm that is not -# considered secure. It should not be used for anything anymore. The -# functionality needed to use WEP is available in the current wpa_supplicant -# release under this optional build parameter. This functionality is subject to -# be completely removed in a future release. -#CONFIG_WEP=y - -# Remove all TKIP functionality -# TKIP is an old cryptographic data confidentiality algorithm that is not -# considered secure. It should not be used anymore for anything else than a -# backwards compatibility option as a group cipher when connecting to APs that -# use WPA+WPA2 mixed mode. For now, the default wpa_supplicant build includes -# support for this by default, but that functionality is subject to be removed -# in the future. -#CONFIG_NO_TKIP=y - -# Pre-Association Security Negotiation (PASN) -# Experimental implementation based on IEEE P802.11z/D2.6 and the protocol -# design is still subject to change. As such, this should not yet be enabled in -# production use. -#CONFIG_PASN=y # uBus IPC/RPC System # Services can connect to the bus and provide methods diff --git a/package/network/services/hostapd/files/wpa_supplicant-full.config b/package/network/services/hostapd/files/wpa_supplicant-full.config index 01c402d9e7c162..b39dabca0696b5 100644 --- a/package/network/services/hostapd/files/wpa_supplicant-full.config +++ b/package/network/services/hostapd/files/wpa_supplicant-full.config @@ -101,9 +101,6 @@ CONFIG_EAP_MSCHAPV2=y # EAP-TLS CONFIG_EAP_TLS=y -# Enable EAP-TLSv1.3 support by default (currently disabled unless explicitly -# enabled in network configuration) -#CONFIG_EAP_TLSV1_3=y # EAL-PEAP CONFIG_EAP_PEAP=y @@ -206,9 +203,6 @@ CONFIG_HT_OVERRIDES=y # Support VHT overrides (disable VHT, mask MCS rates, etc.) CONFIG_VHT_OVERRIDES=y -# Support HE overrides -CONFIG_HE_OVERRIDES=y - # Development testing #CONFIG_EAPOL_TEST=y @@ -252,12 +246,9 @@ CONFIG_CTRL_IFACE=y #CONFIG_NO_WPA_PASSPHRASE=y # Simultaneous Authentication of Equals (SAE), WPA3-Personal -CONFIG_SAE=y - -# SAE Public Key, WPA3-Personal -CONFIG_SAE_PK=y +#CONFIG_SAE=y -# Disable scan result processing (ap_scan=1) to save code size by about 1 kB. +# Disable scan result processing (ap_mode=1) to save code size by about 1 kB. # This can be used if ap_scan=1 mode is never enabled. #CONFIG_NO_SCAN_PROCESSING=y @@ -319,6 +310,10 @@ CONFIG_ELOOP_EPOLL=y # bridge interfaces (commit 'bridge: respect RFC2863 operational state')'). CONFIG_NO_LINUX_PACKET_SOCKET_WAR=y +# IEEE 802.11w (management frame protection), also known as PMF +# Driver support is also needed for IEEE 802.11w. +#CONFIG_IEEE80211W=y + # Support Operating Channel Validation CONFIG_OCV=y @@ -371,7 +366,7 @@ CONFIG_INTERNAL_LIBTOMMATH_FAST=y #PLATFORMSDKLIB="/opt/Program Files/Microsoft Platform SDK/Lib" # Add support for new DBus control interface -# (fi.w1.wpa_supplicant1) +# (fi.w1.hostap.wpa_supplicant1) #CONFIG_CTRL_IFACE_DBUS_NEW=y # Add introspection support for new DBus control interface @@ -480,19 +475,13 @@ CONFIG_NO_RANDOM_POOL=y # Requires glibc 2.25 to build, falls back to /dev/random if unavailable. CONFIG_GETRANDOM=y +# IEEE 802.11n (High Throughput) support (mainly for AP mode) +#CONFIG_IEEE80211N=y + # IEEE 802.11ac (Very High Throughput) support (mainly for AP mode) +# (depends on CONFIG_IEEE80211N) #CONFIG_IEEE80211AC=y -# IEEE 802.11ax HE support (mainly for AP mode) -#CONFIG_IEEE80211AX=y - -# IEEE 802.11be EHT support (mainly for AP mode) -# CONFIG_IEEE80211AX is mandatory for setting CONFIG_IEEE80211BE. -# Note: This is experimental and work in progress. The definitions are still -# subject to change and this should not be expected to interoperate with the -# final IEEE 802.11be version. -CONFIG_IEEE80211BE=y - # Wireless Network Management (IEEE Std 802.11v-2011) # Note: This is experimental and not complete implementation. CONFIG_WNM=y @@ -517,12 +506,12 @@ CONFIG_HS20=y # should be noted that this is mainly aimed at simple cases like # WPA2-Personal while more complex configurations like WPA2-Enterprise with an # external RADIUS server can be supported with hostapd. -CONFIG_AP=y +#CONFIG_AP=y # P2P (Wi-Fi Direct) # This can be used to enable P2P support in wpa_supplicant. See README-P2P for # more information on P2P operations. -CONFIG_P2P=y +#CONFIG_P2P=y # Enable TDLS support #CONFIG_TDLS=y @@ -530,7 +519,7 @@ CONFIG_P2P=y # Wi-Fi Display # This can be used to enable Wi-Fi Display extensions for P2P using an external # program to control the additional information exchanges in the messages. -CONFIG_WIFI_DISPLAY=y +#CONFIG_WIFI_DISPLAY=y # Autoscan # This can be used to enable automatic scan support in wpa_supplicant. @@ -549,11 +538,9 @@ CONFIG_WIFI_DISPLAY=y # # External password backend for testing purposes (developer use) #CONFIG_EXT_PASSWORD_TEST=y -# File-based backend to read passwords from an external file. -#CONFIG_EXT_PASSWORD_FILE=y # Enable Fast Session Transfer (FST) -CONFIG_FST=y +#CONFIG_FST=y # Enable CLI commands for FST testing #CONFIG_FST_TEST=y @@ -588,7 +575,7 @@ CONFIG_FST=y #CONFIG_ACS=y # Support Multi Band Operation -CONFIG_MBO=y +#CONFIG_MBO=y # Fast Initial Link Setup (FILS) (IEEE 802.11ai) CONFIG_FILS=y @@ -613,45 +600,19 @@ CONFIG_IBSS_RSN=y # operations for roaming within an ESS (same SSID). See the bgscan parameter in # the wpa_supplicant.conf file for more details. # Periodic background scans based on signal strength -CONFIG_BGSCAN_SIMPLE=y +#CONFIG_BGSCAN_SIMPLE=y # Learn channels used by the network and try to avoid bgscans on other # channels (experimental) -CONFIG_BGSCAN_LEARN=y +#CONFIG_BGSCAN_LEARN=y # Opportunistic Wireless Encryption (OWE) # Experimental implementation of draft-harkins-owe-07.txt -CONFIG_OWE=y +#CONFIG_OWE=y -# Device Provisioning Protocol (DPP) (also known as Wi-Fi Easy Connect) +# Device Provisioning Protocol (DPP) +# This requires CONFIG_IEEE80211W=y to be enabled, too. (see +# wpa_supplicant/README-DPP for details) #CONFIG_DPP=y -# DPP version 2 support -#CONFIG_DPP2=y -# DPP version 3 support (experimental and still changing; do not enable for -# production use) -#CONFIG_DPP3=y - -# Wired equivalent privacy (WEP) -# WEP is an obsolete cryptographic data confidentiality algorithm that is not -# considered secure. It should not be used for anything anymore. The -# functionality needed to use WEP is available in the current wpa_supplicant -# release under this optional build parameter. This functionality is subject to -# be completely removed in a future release. -#CONFIG_WEP=y - -# Remove all TKIP functionality -# TKIP is an old cryptographic data confidentiality algorithm that is not -# considered secure. It should not be used anymore for anything else than a -# backwards compatibility option as a group cipher when connecting to APs that -# use WPA+WPA2 mixed mode. For now, the default wpa_supplicant build includes -# support for this by default, but that functionality is subject to be removed -# in the future. -#CONFIG_NO_TKIP=y - -# Pre-Association Security Negotiation (PASN) -# Experimental implementation based on IEEE P802.11z/D2.6 and the protocol -# design is still subject to change. As such, this should not yet be enabled in -# production use. -#CONFIG_PASN=y # uBus IPC/RPC System # Services can connect to the bus and provide methods diff --git a/package/network/services/hostapd/files/wpa_supplicant-mini.config b/package/network/services/hostapd/files/wpa_supplicant-mini.config index 0b628957f9dce1..2a3f8fb69de337 100644 --- a/package/network/services/hostapd/files/wpa_supplicant-mini.config +++ b/package/network/services/hostapd/files/wpa_supplicant-mini.config @@ -101,9 +101,6 @@ CONFIG_DRIVER_WIRED=y # EAP-TLS #CONFIG_EAP_TLS=y -# Enable EAP-TLSv1.3 support by default (currently disabled unless explicitly -# enabled in network configuration) -#CONFIG_EAP_TLSV1_3=y # EAL-PEAP #CONFIG_EAP_PEAP=y @@ -206,9 +203,6 @@ CONFIG_HT_OVERRIDES=y # Support VHT overrides (disable VHT, mask MCS rates, etc.) CONFIG_VHT_OVERRIDES=y -# Support HE overrides -CONFIG_HE_OVERRIDES=y - # Development testing #CONFIG_EAPOL_TEST=y @@ -254,10 +248,7 @@ CONFIG_CTRL_IFACE=y # Simultaneous Authentication of Equals (SAE), WPA3-Personal #CONFIG_SAE=y -# SAE Public Key, WPA3-Personal -#CONFIG_SAE_PK=y - -# Disable scan result processing (ap_scan=1) to save code size by about 1 kB. +# Disable scan result processing (ap_mode=1) to save code size by about 1 kB. # This can be used if ap_scan=1 mode is never enabled. #CONFIG_NO_SCAN_PROCESSING=y @@ -319,8 +310,12 @@ CONFIG_ELOOP_EPOLL=y # bridge interfaces (commit 'bridge: respect RFC2863 operational state')'). CONFIG_NO_LINUX_PACKET_SOCKET_WAR=y +# IEEE 802.11w (management frame protection), also known as PMF +# Driver support is also needed for IEEE 802.11w. +#CONFIG_IEEE80211W=y + # Support Operating Channel Validation -CONFIG_OCV=y +#CONFIG_OCV=y # Select TLS implementation # openssl = OpenSSL (default) @@ -371,7 +366,7 @@ CONFIG_TLS=internal #PLATFORMSDKLIB="/opt/Program Files/Microsoft Platform SDK/Lib" # Add support for new DBus control interface -# (fi.w1.wpa_supplicant1) +# (fi.w1.hostap.wpa_supplicant1) #CONFIG_CTRL_IFACE_DBUS_NEW=y # Add introspection support for new DBus control interface @@ -480,19 +475,13 @@ CONFIG_NO_RANDOM_POOL=y # Requires glibc 2.25 to build, falls back to /dev/random if unavailable. CONFIG_GETRANDOM=y +# IEEE 802.11n (High Throughput) support (mainly for AP mode) +#CONFIG_IEEE80211N=y + # IEEE 802.11ac (Very High Throughput) support (mainly for AP mode) +# (depends on CONFIG_IEEE80211N) #CONFIG_IEEE80211AC=y -# IEEE 802.11ax HE support (mainly for AP mode) -#CONFIG_IEEE80211AX=y - -# IEEE 802.11be EHT support (mainly for AP mode) -# CONFIG_IEEE80211AX is mandatory for setting CONFIG_IEEE80211BE. -# Note: This is experimental and work in progress. The definitions are still -# subject to change and this should not be expected to interoperate with the -# final IEEE 802.11be version. -#CONFIG_IEEE80211BE=y - # Wireless Network Management (IEEE Std 802.11v-2011) # Note: This is experimental and not complete implementation. #CONFIG_WNM=y @@ -549,8 +538,6 @@ CONFIG_GETRANDOM=y # # External password backend for testing purposes (developer use) #CONFIG_EXT_PASSWORD_TEST=y -# File-based backend to read passwords from an external file. -#CONFIG_EXT_PASSWORD_FILE=y # Enable Fast Session Transfer (FST) #CONFIG_FST=y @@ -622,36 +609,10 @@ CONFIG_GETRANDOM=y # Experimental implementation of draft-harkins-owe-07.txt #CONFIG_OWE=y -# Device Provisioning Protocol (DPP) (also known as Wi-Fi Easy Connect) +# Device Provisioning Protocol (DPP) +# This requires CONFIG_IEEE80211W=y to be enabled, too. (see +# wpa_supplicant/README-DPP for details) #CONFIG_DPP=y -# DPP version 2 support -#CONFIG_DPP2=y -# DPP version 3 support (experimental and still changing; do not enable for -# production use) -#CONFIG_DPP3=y - -# Wired equivalent privacy (WEP) -# WEP is an obsolete cryptographic data confidentiality algorithm that is not -# considered secure. It should not be used for anything anymore. The -# functionality needed to use WEP is available in the current wpa_supplicant -# release under this optional build parameter. This functionality is subject to -# be completely removed in a future release. -#CONFIG_WEP=y - -# Remove all TKIP functionality -# TKIP is an old cryptographic data confidentiality algorithm that is not -# considered secure. It should not be used anymore for anything else than a -# backwards compatibility option as a group cipher when connecting to APs that -# use WPA+WPA2 mixed mode. For now, the default wpa_supplicant build includes -# support for this by default, but that functionality is subject to be removed -# in the future. -#CONFIG_NO_TKIP=y - -# Pre-Association Security Negotiation (PASN) -# Experimental implementation based on IEEE P802.11z/D2.6 and the protocol -# design is still subject to change. As such, this should not yet be enabled in -# production use. -#CONFIG_PASN=y # uBus IPC/RPC System # Services can connect to the bus and provide methods diff --git a/package/network/services/hostapd/files/wpa_supplicant-p2p.config b/package/network/services/hostapd/files/wpa_supplicant-p2p.config index 8648b1657b14dd..7f5140622cc15a 100644 --- a/package/network/services/hostapd/files/wpa_supplicant-p2p.config +++ b/package/network/services/hostapd/files/wpa_supplicant-p2p.config @@ -101,9 +101,6 @@ CONFIG_EAP_MSCHAPV2=y # EAP-TLS CONFIG_EAP_TLS=y -# Enable EAP-TLSv1.3 support by default (currently disabled unless explicitly -# enabled in network configuration) -#CONFIG_EAP_TLSV1_3=y # EAL-PEAP CONFIG_EAP_PEAP=y @@ -206,9 +203,6 @@ CONFIG_HT_OVERRIDES=y # Support VHT overrides (disable VHT, mask MCS rates, etc.) CONFIG_VHT_OVERRIDES=y -# Support HE overrides -CONFIG_HE_OVERRIDES=y - # Development testing #CONFIG_EAPOL_TEST=y @@ -254,10 +248,7 @@ CONFIG_CTRL_IFACE=y # Simultaneous Authentication of Equals (SAE), WPA3-Personal #CONFIG_SAE=y -# SAE Public Key, WPA3-Personal -#CONFIG_SAE_PK=y - -# Disable scan result processing (ap_scan=1) to save code size by about 1 kB. +# Disable scan result processing (ap_mode=1) to save code size by about 1 kB. # This can be used if ap_scan=1 mode is never enabled. #CONFIG_NO_SCAN_PROCESSING=y @@ -319,6 +310,10 @@ CONFIG_ELOOP_EPOLL=y # bridge interfaces (commit 'bridge: respect RFC2863 operational state')'). CONFIG_NO_LINUX_PACKET_SOCKET_WAR=y +# IEEE 802.11w (management frame protection), also known as PMF +# Driver support is also needed for IEEE 802.11w. +CONFIG_IEEE80211W=y + # Support Operating Channel Validation #CONFIG_OCV=y @@ -371,7 +366,7 @@ CONFIG_INTERNAL_LIBTOMMATH_FAST=y #PLATFORMSDKLIB="/opt/Program Files/Microsoft Platform SDK/Lib" # Add support for new DBus control interface -# (fi.w1.wpa_supplicant1) +# (fi.w1.hostap.wpa_supplicant1) #CONFIG_CTRL_IFACE_DBUS_NEW=y # Add introspection support for new DBus control interface @@ -480,19 +475,13 @@ CONFIG_NO_RANDOM_POOL=y # Requires glibc 2.25 to build, falls back to /dev/random if unavailable. CONFIG_GETRANDOM=y +# IEEE 802.11n (High Throughput) support (mainly for AP mode) +#CONFIG_IEEE80211N=y + # IEEE 802.11ac (Very High Throughput) support (mainly for AP mode) +# (depends on CONFIG_IEEE80211N) #CONFIG_IEEE80211AC=y -# IEEE 802.11ax HE support (mainly for AP mode) -#CONFIG_IEEE80211AX=y - -# IEEE 802.11be EHT support (mainly for AP mode) -# CONFIG_IEEE80211AX is mandatory for setting CONFIG_IEEE80211BE. -# Note: This is experimental and work in progress. The definitions are still -# subject to change and this should not be expected to interoperate with the -# final IEEE 802.11be version. -#CONFIG_IEEE80211BE=y - # Wireless Network Management (IEEE Std 802.11v-2011) # Note: This is experimental and not complete implementation. #CONFIG_WNM=y @@ -549,8 +538,6 @@ CONFIG_P2P=y # # External password backend for testing purposes (developer use) #CONFIG_EXT_PASSWORD_TEST=y -# File-based backend to read passwords from an external file. -#CONFIG_EXT_PASSWORD_FILE=y # Enable Fast Session Transfer (FST) #CONFIG_FST=y @@ -622,36 +609,10 @@ CONFIG_IBSS_RSN=y # Experimental implementation of draft-harkins-owe-07.txt #CONFIG_OWE=y -# Device Provisioning Protocol (DPP) (also known as Wi-Fi Easy Connect) +# Device Provisioning Protocol (DPP) +# This requires CONFIG_IEEE80211W=y to be enabled, too. (see +# wpa_supplicant/README-DPP for details) #CONFIG_DPP=y -# DPP version 2 support -#CONFIG_DPP2=y -# DPP version 3 support (experimental and still changing; do not enable for -# production use) -#CONFIG_DPP3=y - -# Wired equivalent privacy (WEP) -# WEP is an obsolete cryptographic data confidentiality algorithm that is not -# considered secure. It should not be used for anything anymore. The -# functionality needed to use WEP is available in the current wpa_supplicant -# release under this optional build parameter. This functionality is subject to -# be completely removed in a future release. -#CONFIG_WEP=y - -# Remove all TKIP functionality -# TKIP is an old cryptographic data confidentiality algorithm that is not -# considered secure. It should not be used anymore for anything else than a -# backwards compatibility option as a group cipher when connecting to APs that -# use WPA+WPA2 mixed mode. For now, the default wpa_supplicant build includes -# support for this by default, but that functionality is subject to be removed -# in the future. -#CONFIG_NO_TKIP=y - -# Pre-Association Security Negotiation (PASN) -# Experimental implementation based on IEEE P802.11z/D2.6 and the protocol -# design is still subject to change. As such, this should not yet be enabled in -# production use. -#CONFIG_PASN=y # uBus IPC/RPC System # Services can connect to the bus and provide methods diff --git a/package/network/services/hostapd/patches/011-mesh-use-deterministic-channel-on-channel-switch.patch b/package/network/services/hostapd/patches/011-mesh-use-deterministic-channel-on-channel-switch.patch index 869a659b0503a9..bfc30e2842b528 100644 --- a/package/network/services/hostapd/patches/011-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 chan_idx, num_available_chandefs); --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -11463,6 +11463,10 @@ static int nl80211_switch_channel(void * +@@ -11465,6 +11465,10 @@ static int nl80211_switch_channel(void * if (ret) goto error; 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 index 2dc44be5899cc9..b5551f50e60db0 100644 --- 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 @@ -4,7 +4,7 @@ Subject: [PATCH] fix adding back stations after a missed deauth/disassoc --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c -@@ -4782,6 +4782,13 @@ static int add_associated_sta(struct hos +@@ -4784,6 +4784,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. @@ -18,7 +18,7 @@ Subject: [PATCH] fix adding back stations after a missed deauth/disassoc */ 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)", -@@ -4795,7 +4802,8 @@ static int add_associated_sta(struct hos +@@ -4797,7 +4804,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) && diff --git a/package/network/services/hostapd/patches/050-Fix-OpenWrt-13156.patch b/package/network/services/hostapd/patches/050-Fix-OpenWrt-13156.patch index 0306a81cc10b58..2492e480fb5977 100644 --- a/package/network/services/hostapd/patches/050-Fix-OpenWrt-13156.patch +++ b/package/network/services/hostapd/patches/050-Fix-OpenWrt-13156.patch @@ -20,7 +20,7 @@ Signed-off-by: Stijn Tintel --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c -@@ -4017,6 +4017,8 @@ int hostapd_remove_iface(struct hapd_int +@@ -4055,6 +4055,8 @@ int hostapd_remove_iface(struct hapd_int void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta, int reassoc) { @@ -29,7 +29,7 @@ Signed-off-by: Stijn Tintel if (hapd->tkip_countermeasures) { hostapd_drv_sta_deauth(hapd, sta->addr, WLAN_REASON_MICHAEL_MIC_FAILURE); -@@ -4024,10 +4026,16 @@ void hostapd_new_assoc_sta(struct hostap +@@ -4062,10 +4064,16 @@ void hostapd_new_assoc_sta(struct hostap } #ifdef CONFIG_IEEE80211BE diff --git a/package/network/services/hostapd/patches/051-nl80211-add-extra-ies-only-if-allowed-by-driver.patch b/package/network/services/hostapd/patches/051-nl80211-add-extra-ies-only-if-allowed-by-driver.patch index 0d3fcd574d6eec..46ee6234be6837 100644 --- a/package/network/services/hostapd/patches/051-nl80211-add-extra-ies-only-if-allowed-by-driver.patch +++ b/package/network/services/hostapd/patches/051-nl80211-add-extra-ies-only-if-allowed-by-driver.patch @@ -26,7 +26,7 @@ Signed-off-by: David Bauer --- a/src/drivers/driver.h +++ b/src/drivers/driver.h -@@ -2384,6 +2384,9 @@ struct wpa_driver_capa { +@@ -2390,6 +2390,9 @@ struct wpa_driver_capa { /** Maximum number of iterations in a single scan plan */ u32 max_sched_scan_plan_iterations; diff --git a/package/network/services/hostapd/patches/140-tests-Makefile-make-run-tests-with-CONFIG_TLS.patch b/package/network/services/hostapd/patches/140-tests-Makefile-make-run-tests-with-CONFIG_TLS.patch index fd6055d2911c88..6bc1b78bdadb82 100644 --- a/package/network/services/hostapd/patches/140-tests-Makefile-make-run-tests-with-CONFIG_TLS.patch +++ b/package/network/services/hostapd/patches/140-tests-Makefile-make-run-tests-with-CONFIG_TLS.patch @@ -979,7 +979,7 @@ Signed-off-by: Glenn Strauss raise HwsimSkip("Crypto library does not support Brainpool curves: " + tls) capa = dev.request("GET_CAPABILITY dpp") ver = 1 -@@ -3902,6 +3903,9 @@ def test_dpp_proto_auth_req_no_i_proto_k +@@ -3925,6 +3926,9 @@ def test_dpp_proto_auth_req_no_i_proto_k def test_dpp_proto_auth_req_invalid_i_proto_key(dev, apdev): """DPP protocol testing - invalid I-proto key in Auth Req""" @@ -989,7 +989,7 @@ Signed-off-by: Glenn Strauss run_dpp_proto_auth_req_missing(dev, 66, "Invalid Initiator Protocol Key") def test_dpp_proto_auth_req_no_i_nonce(dev, apdev): -@@ -3997,7 +4001,12 @@ def test_dpp_proto_auth_resp_no_r_proto_ +@@ -4020,7 +4024,12 @@ def test_dpp_proto_auth_resp_no_r_proto_ def test_dpp_proto_auth_resp_invalid_r_proto_key(dev, apdev): """DPP protocol testing - invalid R-Proto Key in Auth Resp""" @@ -1003,7 +1003,7 @@ Signed-off-by: Glenn Strauss def test_dpp_proto_auth_resp_no_r_nonce(dev, apdev): """DPP protocol testing - no R-nonce in Auth Resp""" -@@ -4359,11 +4368,17 @@ def test_dpp_proto_pkex_exchange_resp_in +@@ -4382,11 +4391,17 @@ def test_dpp_proto_pkex_exchange_resp_in def test_dpp_proto_pkex_cr_req_invalid_bootstrap_key(dev, apdev): """DPP protocol testing - invalid Bootstrap Key in PKEX Commit-Reveal Request""" diff --git a/package/network/services/hostapd/patches/150-add-NULL-checks-encountered-during-tests-hwsim.patch b/package/network/services/hostapd/patches/150-add-NULL-checks-encountered-during-tests-hwsim.patch index c8c3ff33f42022..78ed459ee6965e 100644 --- a/package/network/services/hostapd/patches/150-add-NULL-checks-encountered-during-tests-hwsim.patch +++ b/package/network/services/hostapd/patches/150-add-NULL-checks-encountered-during-tests-hwsim.patch @@ -29,7 +29,7 @@ Signed-off-by: Glenn Strauss wpa_printf(MSG_DEBUG, "DPP: Generating a keypair"); --- a/src/common/sae.c +++ b/src/common/sae.c -@@ -1278,6 +1278,13 @@ void sae_deinit_pt(struct sae_pt *pt) +@@ -1279,6 +1279,13 @@ void sae_deinit_pt(struct sae_pt *pt) static int sae_derive_commit_element_ecc(struct sae_data *sae, struct crypto_bignum *mask) { diff --git a/package/network/services/hostapd/patches/170-hostapd-update-cfs0-and-cfs1-for-160MHz.patch b/package/network/services/hostapd/patches/170-hostapd-update-cfs0-and-cfs1-for-160MHz.patch index e2fe06e4a2b71a..0af7a379bcb222 100644 --- a/package/network/services/hostapd/patches/170-hostapd-update-cfs0-and-cfs1-for-160MHz.patch +++ b/package/network/services/hostapd/patches/170-hostapd-update-cfs0-and-cfs1-for-160MHz.patch @@ -40,7 +40,7 @@ Signed-off-by: P Praneesh #endif /* CONFIG_IEEE80211AC */ --- a/src/ap/ieee802_11_ht.c +++ b/src/ap/ieee802_11_ht.c -@@ -82,7 +82,9 @@ u8 * hostapd_eid_ht_capabilities(struct +@@ -127,7 +127,9 @@ no_update: u8 * hostapd_eid_ht_operation(struct hostapd_data *hapd, u8 *eid) { struct ieee80211_ht_operation *oper; @@ -50,9 +50,9 @@ Signed-off-by: P Praneesh if (!hapd->iconf->ieee80211n || hapd->conf->disable_11n || is_6ghz_op_class(hapd->iconf->op_class)) -@@ -103,6 +105,13 @@ u8 * hostapd_eid_ht_operation(struct hos - oper->ht_param |= HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW | - HT_INFO_HT_PARAM_STA_CHNL_WIDTH; +@@ -143,6 +145,13 @@ u8 * hostapd_eid_ht_operation(struct hos + oper->operation_mode = host_to_le16(hapd->iface->ht_op_mode); + set_ht_param(hapd, oper); + vht_capabilities_info = host_to_le32(hapd->iface->current_mode->vht_capab); + chwidth = hostapd_get_oper_chwidth(hapd->iconf); @@ -130,7 +130,7 @@ Signed-off-by: P Praneesh #undef VHT_CAP_CHECK_MAX --- a/src/common/ieee802_11_defs.h +++ b/src/common/ieee802_11_defs.h -@@ -1400,6 +1400,8 @@ struct ieee80211_ampe_ie { +@@ -1401,6 +1401,8 @@ struct ieee80211_ampe_ie { #define VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB ((u32) BIT(26) | BIT(27)) #define VHT_CAP_RX_ANTENNA_PATTERN ((u32) BIT(28)) #define VHT_CAP_TX_ANTENNA_PATTERN ((u32) BIT(29)) diff --git a/package/network/services/hostapd/patches/200-multicall.patch b/package/network/services/hostapd/patches/200-multicall.patch index 753fdb0849078f..80a484e974d25d 100644 --- a/package/network/services/hostapd/patches/200-multicall.patch +++ b/package/network/services/hostapd/patches/200-multicall.patch @@ -83,7 +83,7 @@ This allows building both hostapd and wpa_supplicant as a single binary #ifdef CONFIG_WPS static int gen_uuid(const char *txt_addr) -@@ -812,6 +817,8 @@ int main(int argc, char *argv[]) +@@ -817,6 +822,8 @@ int main(int argc, char *argv[]) return -1; #endif /* CONFIG_DPP */ @@ -94,7 +94,7 @@ This allows building both hostapd and wpa_supplicant as a single binary if (c < 0) --- a/src/ap/drv_callbacks.c +++ b/src/ap/drv_callbacks.c -@@ -2514,8 +2514,8 @@ static void hostapd_mld_iface_disable(st +@@ -2520,8 +2520,8 @@ static void hostapd_mld_iface_disable(st #endif /* CONFIG_IEEE80211BE */ @@ -105,7 +105,7 @@ This allows building both hostapd and wpa_supplicant as a single binary { struct hostapd_data *hapd = ctx; struct sta_info *sta; -@@ -2873,7 +2873,7 @@ void wpa_supplicant_event(void *ctx, enu +@@ -2879,7 +2879,7 @@ void wpa_supplicant_event(void *ctx, enu } @@ -116,7 +116,7 @@ This allows building both hostapd and wpa_supplicant as a single binary struct hapd_interfaces *interfaces = ctx; --- a/src/drivers/driver.h +++ b/src/drivers/driver.h -@@ -6897,8 +6897,8 @@ union wpa_event_data { +@@ -6974,8 +6974,8 @@ union wpa_event_data { * Driver wrapper code should call this function whenever an event is received * from the driver. */ @@ -127,7 +127,7 @@ This allows building both hostapd and wpa_supplicant as a single binary /** * wpa_supplicant_event_global - Report a driver event for wpa_supplicant -@@ -6910,7 +6910,7 @@ void wpa_supplicant_event(void *ctx, enu +@@ -6987,7 +6987,7 @@ void wpa_supplicant_event(void *ctx, enu * Same as wpa_supplicant_event(), but we search for the interface in * wpa_global. */ @@ -278,8 +278,8 @@ This allows building both hostapd and wpa_supplicant as a single binary os_memset(&eapol_test, 0, sizeof(eapol_test)); --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c -@@ -6099,8 +6099,8 @@ static void wpas_link_reconfig(struct wp - } +@@ -6131,8 +6131,8 @@ static int wpas_pasn_auth(struct wpa_sup + #endif /* CONFIG_PASN */ -void wpa_supplicant_event(void *ctx, enum wpa_event_type event, @@ -289,7 +289,7 @@ This allows building both hostapd and wpa_supplicant as a single binary { struct wpa_supplicant *wpa_s = ctx; int resched; -@@ -7052,7 +7052,7 @@ void wpa_supplicant_event(void *ctx, enu +@@ -7084,7 +7084,7 @@ void wpa_supplicant_event(void *ctx, enu } diff --git a/package/network/services/hostapd/patches/211-ctrl-make-WNM_AP-functions-dependant-on-CONFIG_AP.patch b/package/network/services/hostapd/patches/211-ctrl-make-WNM_AP-functions-dependant-on-CONFIG_AP.patch index 475a50b87e5420..38d4d1500a4347 100644 --- a/package/network/services/hostapd/patches/211-ctrl-make-WNM_AP-functions-dependant-on-CONFIG_AP.patch +++ b/package/network/services/hostapd/patches/211-ctrl-make-WNM_AP-functions-dependant-on-CONFIG_AP.patch @@ -13,7 +13,7 @@ Signed-off-by: David Bauer --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c -@@ -13233,7 +13233,7 @@ char * wpa_supplicant_ctrl_iface_process +@@ -13292,7 +13292,7 @@ char * wpa_supplicant_ctrl_iface_process if (wpas_ctrl_iface_coloc_intf_report(wpa_s, buf + 18)) reply_len = -1; #endif /* CONFIG_WNM */ @@ -22,7 +22,7 @@ Signed-off-by: David Bauer } else if (os_strncmp(buf, "DISASSOC_IMMINENT ", 18) == 0) { if (ap_ctrl_iface_disassoc_imminent(wpa_s, buf + 18)) reply_len = -1; -@@ -13243,7 +13243,7 @@ char * wpa_supplicant_ctrl_iface_process +@@ -13302,7 +13302,7 @@ char * wpa_supplicant_ctrl_iface_process } else if (os_strncmp(buf, "BSS_TM_REQ ", 11) == 0) { if (ap_ctrl_iface_bss_tm_req(wpa_s, buf + 11)) reply_len = -1; diff --git a/package/network/services/hostapd/patches/220-indicate-features.patch b/package/network/services/hostapd/patches/220-indicate-features.patch index 064e2dd626bd8b..13a5c38631d041 100644 --- a/package/network/services/hostapd/patches/220-indicate-features.patch +++ b/package/network/services/hostapd/patches/220-indicate-features.patch @@ -15,7 +15,7 @@ Subject: [PATCH] hostapd: support optional argument for the -v switch of struct hapd_global { void **drv_priv; -@@ -820,7 +820,7 @@ int main(int argc, char *argv[]) +@@ -825,7 +825,7 @@ int main(int argc, char *argv[]) wpa_supplicant_event = hostapd_wpa_event; wpa_supplicant_event_global = hostapd_wpa_event_global; for (;;) { @@ -24,7 +24,7 @@ Subject: [PATCH] hostapd: support optional argument for the -v switch of if (c < 0) break; switch (c) { -@@ -857,6 +857,8 @@ int main(int argc, char *argv[]) +@@ -862,6 +862,8 @@ int main(int argc, char *argv[]) break; #endif /* CONFIG_DEBUG_LINUX_TRACING */ case 'v': diff --git a/package/network/services/hostapd/patches/250-hostapd_cli_ifdef.patch b/package/network/services/hostapd/patches/250-hostapd_cli_ifdef.patch index 58143020ce0a17..90737b2ac0e9b6 100644 --- a/package/network/services/hostapd/patches/250-hostapd_cli_ifdef.patch +++ b/package/network/services/hostapd/patches/250-hostapd_cli_ifdef.patch @@ -5,7 +5,7 @@ Subject: [PATCH] hostapd: support wps in hostapd_cli even when built from the --- a/hostapd/hostapd_cli.c +++ b/hostapd/hostapd_cli.c -@@ -401,7 +401,6 @@ static int hostapd_cli_cmd_disassociate( +@@ -409,7 +409,6 @@ static int hostapd_cli_cmd_disassociate( } @@ -13,7 +13,7 @@ Subject: [PATCH] hostapd: support wps in hostapd_cli even when built from the static int hostapd_cli_cmd_signature(struct wpa_ctrl *ctrl, int argc, char *argv[]) { -@@ -414,7 +413,6 @@ static int hostapd_cli_cmd_signature(str +@@ -422,7 +421,6 @@ static int hostapd_cli_cmd_signature(str os_snprintf(buf, sizeof(buf), "SIGNATURE %s", argv[0]); return wpa_ctrl_command(ctrl, buf); } @@ -21,7 +21,7 @@ Subject: [PATCH] hostapd: support wps in hostapd_cli even when built from the static int hostapd_cli_cmd_sa_query(struct wpa_ctrl *ctrl, int argc, -@@ -431,7 +429,6 @@ static int hostapd_cli_cmd_sa_query(stru +@@ -439,7 +437,6 @@ static int hostapd_cli_cmd_sa_query(stru } @@ -29,7 +29,7 @@ Subject: [PATCH] hostapd: support wps in hostapd_cli even when built from the static int hostapd_cli_cmd_wps_pin(struct wpa_ctrl *ctrl, int argc, char *argv[]) { -@@ -657,7 +654,6 @@ static int hostapd_cli_cmd_wps_config(st +@@ -665,7 +662,6 @@ static int hostapd_cli_cmd_wps_config(st ssid_hex, argv[1]); return wpa_ctrl_command(ctrl, buf); } @@ -37,7 +37,7 @@ Subject: [PATCH] hostapd: support wps in hostapd_cli even when built from the static int hostapd_cli_cmd_disassoc_imminent(struct wpa_ctrl *ctrl, int argc, -@@ -1686,13 +1682,10 @@ static const struct hostapd_cli_cmd host +@@ -1694,13 +1690,10 @@ static const struct hostapd_cli_cmd host { "disassociate", hostapd_cli_cmd_disassociate, hostapd_complete_stations, " = disassociate a station" }, @@ -51,7 +51,7 @@ Subject: [PATCH] hostapd: support wps in hostapd_cli even when built from the { "wps_pin", hostapd_cli_cmd_wps_pin, NULL, " [timeout] [addr] = add WPS Enrollee PIN" }, { "wps_check_pin", hostapd_cli_cmd_wps_check_pin, NULL, -@@ -1717,7 +1710,6 @@ static const struct hostapd_cli_cmd host +@@ -1725,7 +1718,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/252-disable_ctrl_iface_mib.patch b/package/network/services/hostapd/patches/252-disable_ctrl_iface_mib.patch index 0110e08d63778f..0801a93bcd6ed7 100644 --- a/package/network/services/hostapd/patches/252-disable_ctrl_iface_mib.patch +++ b/package/network/services/hostapd/patches/252-disable_ctrl_iface_mib.patch @@ -16,7 +16,7 @@ Subject: [PATCH] Remove some unnecessary control interface functionality else --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c -@@ -4045,6 +4045,7 @@ static int hostapd_ctrl_iface_receive_pr +@@ -4057,6 +4057,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); @@ -24,7 +24,7 @@ Subject: [PATCH] Remove some unnecessary control interface functionality } else if (os_strcmp(buf, "MIB") == 0) { reply_len = ieee802_11_get_mib(hapd, reply, reply_size); if (reply_len >= 0) { -@@ -4086,6 +4087,7 @@ static int hostapd_ctrl_iface_receive_pr +@@ -4098,6 +4099,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); @@ -113,7 +113,7 @@ Subject: [PATCH] Remove some unnecessary control interface functionality if (os_snprintf_error(buflen - len, ret)) --- a/src/ap/ieee802_1x.c +++ b/src/ap/ieee802_1x.c -@@ -2848,6 +2848,7 @@ static const char * bool_txt(bool val) +@@ -2869,6 +2869,7 @@ static const char * bool_txt(bool val) return val ? "TRUE" : "FALSE"; } @@ -121,7 +121,7 @@ Subject: [PATCH] Remove some unnecessary control interface functionality int ieee802_1x_get_mib(struct hostapd_data *hapd, char *buf, size_t buflen) { -@@ -3034,6 +3035,7 @@ int ieee802_1x_get_mib_sta(struct hostap +@@ -3055,6 +3056,7 @@ int ieee802_1x_get_mib_sta(struct hostap return len; } @@ -131,7 +131,7 @@ Subject: [PATCH] Remove some unnecessary control interface functionality 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 -@@ -6129,6 +6129,7 @@ static const char * wpa_bool_txt(int val +@@ -6141,6 +6141,7 @@ static const char * wpa_bool_txt(int val return val ? "TRUE" : "FALSE"; } @@ -139,7 +139,7 @@ Subject: [PATCH] Remove some unnecessary control interface functionality #define RSN_SUITE "%02x-%02x-%02x-%d" #define RSN_SUITE_ARG(s) \ -@@ -6281,7 +6282,7 @@ int wpa_get_mib_sta(struct wpa_state_mac +@@ -6293,7 +6294,7 @@ int wpa_get_mib_sta(struct wpa_state_mac return len; } @@ -201,7 +201,7 @@ Subject: [PATCH] Remove some unnecessary control interface functionality if (wpa_s->ap_iface) { pos += ap_ctrl_iface_wpa_get_status(wpa_s, pos, end - pos, -@@ -12561,6 +12561,7 @@ char * wpa_supplicant_ctrl_iface_process +@@ -12620,6 +12620,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); @@ -209,7 +209,7 @@ Subject: [PATCH] Remove some unnecessary control interface functionality } else if (os_strcmp(buf, "MIB") == 0) { reply_len = wpa_sm_get_mib(wpa_s->wpa, reply, reply_size); if (reply_len >= 0) { -@@ -12573,6 +12574,7 @@ char * wpa_supplicant_ctrl_iface_process +@@ -12632,6 +12633,7 @@ char * wpa_supplicant_ctrl_iface_process reply_size - reply_len); #endif /* CONFIG_MACSEC */ } @@ -217,7 +217,7 @@ Subject: [PATCH] Remove some unnecessary control interface functionality } else if (os_strncmp(buf, "STATUS", 6) == 0) { reply_len = wpa_supplicant_ctrl_iface_status( wpa_s, buf + 6, reply, reply_size); -@@ -13061,6 +13063,7 @@ char * wpa_supplicant_ctrl_iface_process +@@ -13120,6 +13122,7 @@ char * wpa_supplicant_ctrl_iface_process reply_len = wpa_supplicant_ctrl_iface_bss( wpa_s, buf + 4, reply, reply_size); #ifdef CONFIG_AP @@ -225,7 +225,7 @@ Subject: [PATCH] Remove some unnecessary control interface functionality } 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) { -@@ -13069,12 +13072,15 @@ char * wpa_supplicant_ctrl_iface_process +@@ -13128,12 +13131,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); diff --git a/package/network/services/hostapd/patches/300-noscan.patch b/package/network/services/hostapd/patches/300-noscan.patch index f208b2937d02d3..6deb2722b37198 100644 --- a/package/network/services/hostapd/patches/300-noscan.patch +++ b/package/network/services/hostapd/patches/300-noscan.patch @@ -41,7 +41,7 @@ Subject: [PATCH] Add noscan, no_ht_coex config options hostapd_set_state(iface, HAPD_IFACE_HT_SCAN); --- a/src/ap/ieee802_11_ht.c +++ b/src/ap/ieee802_11_ht.c -@@ -239,6 +239,9 @@ void hostapd_2040_coex_action(struct hos +@@ -279,6 +279,9 @@ void hostapd_2040_coex_action(struct hos return; } @@ -51,7 +51,7 @@ Subject: [PATCH] Add noscan, no_ht_coex config options if (len < IEEE80211_HDRLEN + 2 + sizeof(*bc_ie)) { wpa_printf(MSG_DEBUG, "Ignore too short 20/40 BSS Coexistence Management frame"); -@@ -399,6 +402,9 @@ void ht40_intolerant_add(struct hostapd_ +@@ -439,6 +442,9 @@ void ht40_intolerant_add(struct hostapd_ if (iface->current_mode->mode != HOSTAPD_MODE_IEEE80211G) return; 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 bcc39ea758646b..e757a6df00527c 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 @@ -5,7 +5,7 @@ Subject: [PATCH] nl80211_fix_set_freq.patch --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -5510,7 +5510,7 @@ static int nl80211_set_channel(struct i8 +@@ -5512,7 +5512,7 @@ static int nl80211_set_channel(struct i8 freq->he_enabled, freq->eht_enabled, freq->bandwidth, freq->center_freq1, freq->center_freq2); 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 8b8434773888ea..c3b3ded908cc82 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 @@ -4,7 +4,7 @@ Subject: [PATCH] nl80211_del_beacon_bss.patch --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -6251,8 +6251,7 @@ static void nl80211_teardown_ap(struct i +@@ -6253,8 +6253,7 @@ static void nl80211_teardown_ap(struct i nl80211_mgmt_unsubscribe(bss, "AP teardown"); nl80211_put_wiphy_data_ap(bss); diff --git a/package/network/services/hostapd/patches/381-hostapd_cli_UNKNOWN-COMMAND.patch b/package/network/services/hostapd/patches/381-hostapd_cli_UNKNOWN-COMMAND.patch index e68edacb44062c..29026ac9d1c0a9 100644 --- a/package/network/services/hostapd/patches/381-hostapd_cli_UNKNOWN-COMMAND.patch +++ b/package/network/services/hostapd/patches/381-hostapd_cli_UNKNOWN-COMMAND.patch @@ -11,7 +11,7 @@ if CONFIG_CTRL_IFACE_MIB is not defined. --- a/hostapd/hostapd_cli.c +++ b/hostapd/hostapd_cli.c -@@ -753,7 +753,7 @@ static int wpa_ctrl_command_sta(struct w +@@ -761,7 +761,7 @@ static int wpa_ctrl_command_sta(struct w } buf[len] = '\0'; 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 4003793a707a4e..cc7b1317872f41 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 @@ -14,7 +14,7 @@ Signed-hostap: Antonio Quartulli --- a/src/drivers/driver.h +++ b/src/drivers/driver.h -@@ -1000,6 +1000,9 @@ struct wpa_driver_associate_params { +@@ -1004,6 +1004,9 @@ struct wpa_driver_associate_params { * responsible for selecting with which BSS to associate. */ const u8 *bssid; 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 3cd2949e11f3b3..80ccb1c2071b46 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,7 +19,7 @@ Tested-by: Simon Wunderlich --- a/src/drivers/driver.h +++ b/src/drivers/driver.h -@@ -1916,6 +1916,7 @@ struct wpa_driver_mesh_join_params { +@@ -1920,6 +1920,7 @@ struct wpa_driver_mesh_join_params { #define WPA_DRIVER_MESH_FLAG_AMPE 0x00000008 unsigned int flags; bool handle_dfs; @@ -29,7 +29,7 @@ Tested-by: Simon Wunderlich struct wpa_driver_set_key_params { --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -12140,6 +12140,18 @@ static int nl80211_put_mesh_id(struct nl +@@ -12142,6 +12142,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) { -@@ -12201,6 +12213,7 @@ static int nl80211_join_mesh(struct i802 +@@ -12203,6 +12215,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) || diff --git a/package/network/services/hostapd/patches/590-rrm-wnm-statistics.patch b/package/network/services/hostapd/patches/590-rrm-wnm-statistics.patch index 2f66fb36b302ff..be09ed319c9663 100644 --- a/package/network/services/hostapd/patches/590-rrm-wnm-statistics.patch +++ b/package/network/services/hostapd/patches/590-rrm-wnm-statistics.patch @@ -10,7 +10,7 @@ method. --- a/src/ap/hostapd.h +++ b/src/ap/hostapd.h -@@ -183,6 +183,21 @@ struct mld_link_info { +@@ -185,6 +185,21 @@ struct mld_link_info { }; /** @@ -32,7 +32,7 @@ method. * struct hostapd_data - hostapd per-BSS data structure */ struct hostapd_data { -@@ -196,6 +211,9 @@ struct hostapd_data { +@@ -198,6 +213,9 @@ struct hostapd_data { u8 own_addr[ETH_ALEN]; diff --git a/package/network/services/hostapd/patches/600-ubus_support.patch b/package/network/services/hostapd/patches/600-ubus_support.patch index b864cd9a13aebb..fb3bfb012030bd 100644 --- a/package/network/services/hostapd/patches/600-ubus_support.patch +++ b/package/network/services/hostapd/patches/600-ubus_support.patch @@ -92,7 +92,7 @@ probe/assoc/auth requests via object subscribe. return 0; --- a/src/ap/drv_callbacks.c +++ b/src/ap/drv_callbacks.c -@@ -316,6 +316,10 @@ int hostapd_notif_assoc(struct hostapd_d +@@ -317,6 +317,10 @@ int hostapd_notif_assoc(struct hostapd_d struct hostapd_iface *iface = hapd->iface; #endif /* CONFIG_OWE */ bool updated = false; @@ -103,7 +103,7 @@ probe/assoc/auth requests via object subscribe. if (addr == NULL) { /* -@@ -460,6 +464,12 @@ int hostapd_notif_assoc(struct hostapd_d +@@ -461,6 +465,12 @@ int hostapd_notif_assoc(struct hostapd_d goto fail; } @@ -135,7 +135,7 @@ probe/assoc/auth requests via object subscribe. return 0; } -@@ -2497,6 +2500,7 @@ static int hostapd_setup_interface_compl +@@ -2525,6 +2528,7 @@ static int hostapd_setup_interface_compl if (err) goto fail; @@ -143,7 +143,7 @@ probe/assoc/auth requests via object subscribe. wpa_printf(MSG_DEBUG, "Completing interface initialization"); if (iface->freq) { #ifdef NEED_AP_MLME -@@ -2722,6 +2726,7 @@ dfs_offload: +@@ -2750,6 +2754,7 @@ dfs_offload: fail: wpa_printf(MSG_ERROR, "Interface initialization failed"); @@ -151,7 +151,7 @@ probe/assoc/auth requests via object subscribe. if (iface->is_no_ir) { hostapd_set_state(iface, HAPD_IFACE_NO_IR); -@@ -3440,6 +3445,7 @@ void hostapd_interface_deinit_free(struc +@@ -3478,6 +3483,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; @@ -169,7 +169,7 @@ probe/assoc/auth requests via object subscribe. #define OCE_STA_CFON_ENABLED(hapd) \ ((hapd->conf->oce & OCE_STA_CFON) && \ -@@ -204,6 +205,7 @@ struct hostapd_data { +@@ -206,6 +207,7 @@ struct hostapd_data { struct hostapd_iface *iface; struct hostapd_config *iconf; struct hostapd_bss_config *conf; @@ -177,7 +177,7 @@ probe/assoc/auth requests via object subscribe. int interface_added; /* virtual interface added for this BSS */ unsigned int started:1; unsigned int disabled:1; -@@ -766,6 +768,7 @@ hostapd_alloc_bss_data(struct hostapd_if +@@ -776,6 +778,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); @@ -187,7 +187,7 @@ probe/assoc/auth requests via object subscribe. struct hostapd_iface * hostapd_alloc_iface(void); --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c -@@ -2895,7 +2895,7 @@ static void handle_auth(struct hostapd_d +@@ -2897,7 +2897,7 @@ static void handle_auth(struct hostapd_d u16 auth_alg, auth_transaction, status_code; u16 resp = WLAN_STATUS_SUCCESS; struct sta_info *sta = NULL; @@ -196,7 +196,7 @@ probe/assoc/auth requests via object subscribe. u16 fc; const u8 *challenge = NULL; u8 resp_ies[2 + WLAN_AUTH_CHALLENGE_LEN]; -@@ -2906,6 +2906,11 @@ static void handle_auth(struct hostapd_d +@@ -2908,6 +2908,11 @@ static void handle_auth(struct hostapd_d #ifdef CONFIG_IEEE80211BE bool mld_sta = false; #endif /* CONFIG_IEEE80211BE */ @@ -208,7 +208,7 @@ probe/assoc/auth requests via object subscribe. if (len < IEEE80211_HDRLEN + sizeof(mgmt->u.auth)) { wpa_printf(MSG_INFO, "handle_auth - too short payload (len=%lu)", -@@ -3102,6 +3107,13 @@ static void handle_auth(struct hostapd_d +@@ -3104,6 +3109,13 @@ static void handle_auth(struct hostapd_d resp = WLAN_STATUS_UNSPECIFIED_FAILURE; goto fail; } @@ -222,7 +222,7 @@ probe/assoc/auth requests via object subscribe. if (res == HOSTAPD_ACL_PENDING) return; -@@ -5365,7 +5377,7 @@ static void handle_assoc(struct hostapd_ +@@ -5367,7 +5379,7 @@ static void handle_assoc(struct hostapd_ int resp = WLAN_STATUS_SUCCESS; u16 reply_res = WLAN_STATUS_UNSPECIFIED_FAILURE; const u8 *pos; @@ -231,7 +231,7 @@ probe/assoc/auth requests via object subscribe. struct sta_info *sta; u8 *tmp = NULL; #ifdef CONFIG_FILS -@@ -5607,6 +5619,11 @@ static void handle_assoc(struct hostapd_ +@@ -5609,6 +5621,11 @@ static void handle_assoc(struct hostapd_ left = res; } #endif /* CONFIG_FILS */ @@ -243,7 +243,7 @@ probe/assoc/auth requests via object subscribe. /* followed by SSID and Supported rates; and HT capabilities if 802.11n * is used */ -@@ -5709,6 +5726,13 @@ static void handle_assoc(struct hostapd_ +@@ -5711,6 +5728,13 @@ static void handle_assoc(struct hostapd_ if (set_beacon) ieee802_11_update_beacons(hapd->iface); @@ -257,7 +257,7 @@ probe/assoc/auth requests via object subscribe. fail: /* -@@ -5938,6 +5962,7 @@ static void handle_disassoc(struct hosta +@@ -5940,6 +5964,7 @@ static void handle_disassoc(struct hosta (unsigned long) len); return; } @@ -265,7 +265,7 @@ probe/assoc/auth requests via object subscribe. sta = ap_get_sta(hapd, mgmt->sa); if (!sta) { -@@ -5969,6 +5994,8 @@ static void handle_deauth(struct hostapd +@@ -5971,6 +5996,8 @@ static void handle_deauth(struct hostapd /* Clear the PTKSA cache entries for PASN */ ptksa_cache_flush(hapd->ptksa, mgmt->sa, WPA_CIPHER_NONE); @@ -286,16 +286,15 @@ probe/assoc/auth requests via object subscribe. } -@@ -399,6 +402,9 @@ void hostapd_handle_radio_measurement(st - mgmt->u.action.u.rrm.action, MAC2STR(mgmt->sa)); - - switch (mgmt->u.action.u.rrm.action) { -+ case WLAN_RRM_LINK_MEASUREMENT_REPORT: +@@ -406,7 +409,7 @@ void hostapd_handle_radio_measurement(st + hostapd_handle_nei_report_req(hapd, buf, len); + break; + case WLAN_RRM_LINK_MEASUREMENT_REPORT: +- hostapd_handle_link_mesr_report(hapd, buf, len); + hostapd_ubus_handle_link_measurement(hapd, buf, len); -+ break; - case WLAN_RRM_RADIO_MEASUREMENT_REPORT: - hostapd_handle_radio_msmt_report(hapd, buf, len); break; + default: + wpa_printf(MSG_DEBUG, "RRM action %u is not supported", --- a/src/ap/sta_info.c +++ b/src/ap/sta_info.c @@ -542,6 +542,7 @@ void ap_handle_timer(void *eloop_ctx, vo diff --git a/package/network/services/hostapd/patches/601-ucode_support.patch b/package/network/services/hostapd/patches/601-ucode_support.patch index 1a824a167b8ab4..737966201491f1 100644 --- a/package/network/services/hostapd/patches/601-ucode_support.patch +++ b/package/network/services/hostapd/patches/601-ucode_support.patch @@ -34,7 +34,7 @@ as adding/removing interfaces. ifdef CONFIG_CODE_COVERAGE --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c -@@ -5643,6 +5643,7 @@ try_again: +@@ -5998,6 +5998,7 @@ try_again: return -1; } @@ -42,7 +42,7 @@ as adding/removing interfaces. wpa_msg_register_cb(hostapd_ctrl_iface_msg_cb); return 0; -@@ -5744,6 +5745,7 @@ fail: +@@ -6099,6 +6100,7 @@ fail: os_free(fname); interface->global_ctrl_sock = s; @@ -52,7 +52,7 @@ as adding/removing interfaces. --- a/hostapd/main.c +++ b/hostapd/main.c -@@ -1028,6 +1028,7 @@ int main(int argc, char *argv[]) +@@ -1033,6 +1033,7 @@ int main(int argc, char *argv[]) } hostapd_global_ctrl_iface_init(&interfaces); @@ -60,7 +60,7 @@ as adding/removing interfaces. if (hostapd_global_run(&interfaces, daemonize, pid_file)) { wpa_printf(MSG_ERROR, "Failed to start eloop"); -@@ -1037,6 +1038,7 @@ int main(int argc, char *argv[]) +@@ -1042,6 +1043,7 @@ int main(int argc, char *argv[]) ret = 0; out: @@ -70,7 +70,7 @@ as adding/removing interfaces. for (i = 0; i < interfaces.count; i++) { --- a/src/ap/ap_drv_ops.h +++ b/src/ap/ap_drv_ops.h -@@ -404,6 +404,23 @@ static inline int hostapd_drv_stop_ap(st +@@ -409,6 +409,23 @@ static inline int hostapd_drv_stop_ap(st return hapd->driver->stop_ap(hapd->drv_priv, link_id); } @@ -139,7 +139,7 @@ as adding/removing interfaces. { struct hostapd_bss_config *conf = hapd->conf; u8 ssid[SSID_MAX_LEN + 1]; -@@ -2926,7 +2930,7 @@ hostapd_alloc_bss_data(struct hostapd_if +@@ -2954,7 +2958,7 @@ hostapd_alloc_bss_data(struct hostapd_if } @@ -148,7 +148,7 @@ as adding/removing interfaces. { if (!hapd) return; -@@ -3977,7 +3981,8 @@ int hostapd_remove_iface(struct hapd_int +@@ -4015,7 +4019,8 @@ int hostapd_remove_iface(struct hapd_int hapd_iface = interfaces->iface[i]; if (hapd_iface == NULL) return -1; @@ -179,7 +179,7 @@ as adding/removing interfaces. int (*for_each_interface)(struct hapd_interfaces *interfaces, int (*cb)(struct hostapd_iface *iface, void *ctx), void *ctx); -@@ -206,6 +211,7 @@ struct hostapd_data { +@@ -208,6 +213,7 @@ struct hostapd_data { struct hostapd_config *iconf; struct hostapd_bss_config *conf; struct hostapd_ubus_bss ubus; @@ -187,7 +187,7 @@ as adding/removing interfaces. int interface_added; /* virtual interface added for this BSS */ unsigned int started:1; unsigned int disabled:1; -@@ -567,6 +573,7 @@ struct hostapd_mld { +@@ -577,6 +583,7 @@ struct hostapd_mld { */ struct hostapd_iface { struct hapd_interfaces *interfaces; @@ -195,7 +195,7 @@ as adding/removing interfaces. void *owner; char *config_fname; struct hostapd_config *conf; -@@ -777,6 +784,8 @@ struct hostapd_iface * hostapd_init(stru +@@ -787,6 +794,8 @@ struct hostapd_iface * hostapd_init(stru struct hostapd_iface * hostapd_interface_init_bss(struct hapd_interfaces *interfaces, const char *phy, const char *config_fname, int debug); @@ -206,7 +206,7 @@ as adding/removing interfaces. void hostapd_interface_deinit_free(struct hostapd_iface *iface); --- a/src/drivers/driver.h +++ b/src/drivers/driver.h -@@ -3922,6 +3922,25 @@ struct wpa_driver_ops { +@@ -3928,6 +3928,25 @@ struct wpa_driver_ops { const char *ifname); /** @@ -232,7 +232,7 @@ as adding/removing interfaces. * set_sta_vlan - Bind a station into a specific interface (AP only) * @priv: Private driver interface data * @ifname: Interface (main or virtual BSS or VLAN) -@@ -6643,6 +6662,7 @@ union wpa_event_data { +@@ -6720,6 +6739,7 @@ union wpa_event_data { /** * struct ch_switch @@ -240,7 +240,7 @@ as adding/removing interfaces. * @freq: Frequency of new channel in MHz * @ht_enabled: Whether this is an HT channel * @ch_offset: Secondary channel offset -@@ -6653,6 +6673,7 @@ union wpa_event_data { +@@ -6730,6 +6750,7 @@ union wpa_event_data { * @punct_bitmap: Puncturing bitmap */ struct ch_switch { @@ -250,7 +250,7 @@ as adding/removing interfaces. int ch_offset; --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -75,6 +75,16 @@ enum nlmsgerr_attrs { +@@ -77,6 +77,16 @@ enum nlmsgerr_attrs { #endif /* ANDROID */ @@ -267,7 +267,7 @@ as adding/removing interfaces. static struct nl_sock * nl_create_handle(struct nl_cb *cb, const char *dbg) { -@@ -429,6 +439,11 @@ static int no_seq_check(struct nl_msg *m +@@ -431,6 +441,11 @@ static int no_seq_check(struct nl_msg *m return NL_OK; } @@ -279,7 +279,7 @@ as adding/removing interfaces. static void nl80211_nlmsg_clear(struct nl_msg *msg) { -@@ -502,6 +517,8 @@ int send_and_recv(struct nl80211_global +@@ -504,6 +519,8 @@ int send_and_recv(struct nl80211_global if (!msg) return -ENOMEM; @@ -288,7 +288,7 @@ as adding/removing interfaces. err.err = -ENOMEM; s_nl_cb = nl_socket_get_cb(nl_handle); -@@ -536,6 +553,7 @@ int send_and_recv(struct nl80211_global +@@ -538,6 +555,7 @@ int send_and_recv(struct nl80211_global err.orig_msg = msg; err.err_info = err_info; @@ -296,7 +296,7 @@ as adding/removing interfaces. nl_cb_err(cb, NL_CB_CUSTOM, error_handler, &err); nl_cb_set(cb, NL_CB_FINISH, NL_CB_CUSTOM, finish_handler, &err.err); if (ack_handler_custom) { -@@ -939,6 +957,7 @@ nl80211_get_wiphy_data_ap(struct i802_bs +@@ -941,6 +959,7 @@ nl80211_get_wiphy_data_ap(struct i802_bs os_free(w); return NULL; } @@ -304,7 +304,7 @@ as adding/removing interfaces. nl_cb_set(w->nl_cb, NL_CB_SEQ_CHECK, NL_CB_CUSTOM, no_seq_check, NULL); nl_cb_set(w->nl_cb, NL_CB_VALID, NL_CB_CUSTOM, -@@ -1353,7 +1372,7 @@ static void wpa_driver_nl80211_event_rtm +@@ -1355,7 +1374,7 @@ static void wpa_driver_nl80211_event_rtm } wpa_printf(MSG_DEBUG, "nl80211: Interface down (%s/%s)", namebuf, ifname); @@ -313,7 +313,7 @@ as adding/removing interfaces. wpa_printf(MSG_DEBUG, "nl80211: Not the main interface (%s) - do not indicate interface down", drv->first_bss->ifname); -@@ -1389,7 +1408,7 @@ static void wpa_driver_nl80211_event_rtm +@@ -1391,7 +1410,7 @@ static void wpa_driver_nl80211_event_rtm } wpa_printf(MSG_DEBUG, "nl80211: Interface up (%s/%s)", namebuf, ifname); @@ -322,7 +322,7 @@ as adding/removing interfaces. wpa_printf(MSG_DEBUG, "nl80211: Not the main interface (%s) - do not indicate interface up", drv->first_bss->ifname); -@@ -2035,6 +2054,7 @@ static int wpa_driver_nl80211_init_nl_gl +@@ -2037,6 +2056,7 @@ static int wpa_driver_nl80211_init_nl_gl genl_family_put(family); nl_cache_free(cache); @@ -330,7 +330,7 @@ as adding/removing interfaces. nl_cb_set(global->nl_cb, NL_CB_SEQ_CHECK, NL_CB_CUSTOM, no_seq_check, NULL); nl_cb_set(global->nl_cb, NL_CB_VALID, NL_CB_CUSTOM, -@@ -2205,6 +2225,7 @@ static int nl80211_init_bss(struct i802_ +@@ -2207,6 +2227,7 @@ static int nl80211_init_bss(struct i802_ if (!bss->nl_cb) return -1; @@ -338,7 +338,7 @@ as adding/removing interfaces. nl_cb_set(bss->nl_cb, NL_CB_SEQ_CHECK, NL_CB_CUSTOM, no_seq_check, NULL); nl_cb_set(bss->nl_cb, NL_CB_VALID, NL_CB_CUSTOM, -@@ -8702,6 +8723,7 @@ static void *i802_init(struct hostapd_da +@@ -8704,6 +8725,7 @@ static void *i802_init(struct hostapd_da char master_ifname[IFNAMSIZ]; int ifindex, br_ifindex = 0; int br_added = 0; @@ -346,7 +346,7 @@ as adding/removing interfaces. bss = wpa_driver_nl80211_drv_init(hapd, params->ifname, params->global_priv, 1, -@@ -8761,21 +8783,17 @@ static void *i802_init(struct hostapd_da +@@ -8763,21 +8785,17 @@ static void *i802_init(struct hostapd_da (params->num_bridge == 0 || !params->bridge[0])) add_ifidx(drv, br_ifindex, drv->ifindex); @@ -378,7 +378,7 @@ as adding/removing interfaces. } if (drv->capa.flags2 & WPA_DRIVER_FLAGS2_CONTROL_PORT_RX) { -@@ -9144,6 +9162,50 @@ static int wpa_driver_nl80211_if_remove( +@@ -9146,6 +9164,50 @@ static int wpa_driver_nl80211_if_remove( return 0; } @@ -429,7 +429,7 @@ as adding/removing interfaces. static int cookie_handler(struct nl_msg *msg, void *arg) { -@@ -10960,6 +11022,37 @@ static bool nl80211_is_drv_shared(void * +@@ -10962,6 +11024,37 @@ static bool nl80211_is_drv_shared(void * #endif /* CONFIG_IEEE80211BE */ @@ -467,7 +467,7 @@ as adding/removing interfaces. static int driver_nl80211_send_mlme(void *priv, const u8 *data, size_t data_len, int noack, unsigned int freq, -@@ -14210,6 +14303,8 @@ const struct wpa_driver_ops wpa_driver_n +@@ -14510,6 +14603,8 @@ const struct wpa_driver_ops wpa_driver_n .set_acl = wpa_driver_nl80211_set_acl, .if_add = wpa_driver_nl80211_if_add, .if_remove = driver_nl80211_if_remove, @@ -596,7 +596,7 @@ as adding/removing interfaces. CFLAGS += -DEAP_SERVER -DEAP_SERVER_IDENTITY --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c -@@ -6135,6 +6135,7 @@ void supplicant_event(void *ctx, enum wp +@@ -6167,6 +6167,7 @@ void supplicant_event(void *ctx, enum wp event_to_string(event), event); #endif /* CONFIG_NO_STDOUT_DEBUG */ 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 index 012efa4286be6f..f0e838bf2f3acc 100644 --- a/package/network/services/hostapd/patches/720-iface_max_num_sta.patch +++ b/package/network/services/hostapd/patches/720-iface_max_num_sta.patch @@ -79,7 +79,7 @@ full device, e.g. in order to deal with hardware/driver limitations { --- a/src/ap/hostapd.h +++ b/src/ap/hostapd.h -@@ -815,6 +815,7 @@ void hostapd_cleanup_cs_params(struct ho +@@ -825,6 +825,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); diff --git a/package/network/services/hostapd/patches/740-snoop_iface.patch b/package/network/services/hostapd/patches/740-snoop_iface.patch index 3aea451c62fac4..3c59865f8472c7 100644 --- a/package/network/services/hostapd/patches/740-snoop_iface.patch +++ b/package/network/services/hostapd/patches/740-snoop_iface.patch @@ -29,7 +29,7 @@ untagged DHCP packets int bridge_hairpin; /* hairpin_mode on bridge members */ --- a/src/ap/ap_drv_ops.h +++ b/src/ap/ap_drv_ops.h -@@ -371,12 +371,12 @@ static inline int hostapd_drv_br_port_se +@@ -376,12 +376,12 @@ static inline int hostapd_drv_br_port_se static inline int hostapd_drv_br_set_net_param(struct hostapd_data *hapd, enum drv_br_net_param param, @@ -112,7 +112,7 @@ untagged DHCP packets hapd->x_snoop_initialized = false; --- a/src/drivers/driver.h +++ b/src/drivers/driver.h -@@ -4344,7 +4344,7 @@ struct wpa_driver_ops { +@@ -4350,7 +4350,7 @@ struct wpa_driver_ops { * Returns: 0 on success, negative (<0) on failure */ int (*br_set_net_param)(void *priv, enum drv_br_net_param param, @@ -123,7 +123,7 @@ untagged DHCP packets * get_wowlan - Get wake-on-wireless status --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -12660,7 +12660,7 @@ static const char * drv_br_net_param_str +@@ -12662,7 +12662,7 @@ static const char * drv_br_net_param_str static int wpa_driver_br_set_net_param(void *priv, enum drv_br_net_param param, @@ -132,7 +132,7 @@ untagged DHCP packets { struct i802_bss *bss = priv; char path[128]; -@@ -12686,8 +12686,11 @@ static int wpa_driver_br_set_net_param(v +@@ -12688,8 +12688,11 @@ static int wpa_driver_br_set_net_param(v return -EINVAL; } diff --git a/package/network/services/hostapd/patches/770-radius_server.patch b/package/network/services/hostapd/patches/770-radius_server.patch index 2068caacdcb946..c110a85e2e73f1 100644 --- a/package/network/services/hostapd/patches/770-radius_server.patch +++ b/package/network/services/hostapd/patches/770-radius_server.patch @@ -29,7 +29,7 @@ handle reload. #ifndef CONFIG_NO_HOSTAPD_LOGGER static void hostapd_logger_cb(void *ctx, const u8 *addr, unsigned int module, -@@ -792,6 +793,11 @@ int main(int argc, char *argv[]) +@@ -793,6 +794,11 @@ int main(int argc, char *argv[]) if (os_program_init()) return -1; diff --git a/package/network/services/hostapd/patches/780-Implement-APuP-Access-Point-Micro-Peering.patch b/package/network/services/hostapd/patches/780-Implement-APuP-Access-Point-Micro-Peering.patch index f2727a6feee25c..22bd7ad2634888 100644 --- a/package/network/services/hostapd/patches/780-Implement-APuP-Access-Point-Micro-Peering.patch +++ b/package/network/services/hostapd/patches/780-Implement-APuP-Access-Point-Micro-Peering.patch @@ -1,4 +1,4 @@ -From 40041ecea334c0106c0e840a32aef92b0cbb004b Mon Sep 17 00:00:00 2001 +From 806c84ac8e8f60eaec22772b627f85eb5ac13544 Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Mon, 6 May 2024 13:53:48 +0200 Subject: [PATCH 1/3] Implement APuP Access Point Micro Peering @@ -18,11 +18,14 @@ automatically if wds_bridge is not an empty string), or feeded to a routing daemon. Signed-off-by: Gioacchino Mazzurco +Reviewed-by: Hauke Mehrtens +Reviewed-by: Moritz Warning +Hotfix-by: Sebastian Gottschall https://github.com/mirror/dd-wrt/commit/0c3001a69e8d8300569e416de856c96e903ad130 --- hostapd/Makefile | 5 ++ hostapd/config_file.c | 9 +++ src/ap/ap_config.h | 29 +++++++ - src/ap/ap_drv_ops.c | 26 ++++++ + src/ap/ap_drv_ops.c | 28 ++++++- src/ap/ap_drv_ops.h | 3 + src/ap/apup.c | 152 +++++++++++++++++++++++++++++++++++ src/ap/apup.h | 24 ++++++ @@ -30,7 +33,7 @@ Signed-off-by: Gioacchino Mazzurco src/ap/ieee802_11.h | 2 + src/drivers/driver.h | 2 +- src/drivers/driver_nl80211.c | 14 +--- - 11 files changed, 264 insertions(+), 16 deletions(-) + 11 files changed, 265 insertions(+), 17 deletions(-) create mode 100644 src/ap/apup.c create mode 100644 src/ap/apup.h @@ -106,7 +109,7 @@ Signed-off-by: Gioacchino Mazzurco /** --- a/src/ap/ap_drv_ops.c +++ b/src/ap/ap_drv_ops.c -@@ -385,9 +385,35 @@ int hostapd_set_wds_sta(struct hostapd_d +@@ -385,13 +385,39 @@ int hostapd_set_wds_sta(struct hostapd_d const u8 *addr, int aid, int val) { const char *bridge = NULL; @@ -142,6 +145,11 @@ Signed-off-by: Gioacchino Mazzurco if (hapd->conf->wds_bridge[0]) bridge = hapd->conf->wds_bridge; return hapd->driver->set_wds_sta(hapd->drv_priv, addr, aid, val, +- bridge, ifname_wds); ++ bridge, ifName); + } + + --- a/src/ap/ap_drv_ops.h +++ b/src/ap/ap_drv_ops.h @@ -35,6 +35,9 @@ int hostapd_set_drv_ieee8021x(struct hos @@ -338,7 +346,7 @@ Signed-off-by: Gioacchino Mazzurco + const struct ieee802_11_elems *elems ); --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c -@@ -59,6 +59,9 @@ +@@ -60,6 +60,9 @@ #include "nan_usd_ap.h" #include "pasn/pasn_common.h" @@ -348,7 +356,7 @@ Signed-off-by: Gioacchino Mazzurco #ifdef CONFIG_FILS static struct wpabuf * -@@ -3586,8 +3589,8 @@ static u16 check_multi_ap(struct hostapd +@@ -3588,8 +3591,8 @@ static u16 check_multi_ap(struct hostapd } @@ -359,7 +367,7 @@ Signed-off-by: Gioacchino Mazzurco { /* Supported rates not used in IEEE 802.11ad/DMG */ if (hapd->iface->current_mode && -@@ -3974,7 +3977,7 @@ static int __check_assoc_ies(struct host +@@ -3976,7 +3979,7 @@ static int __check_assoc_ies(struct host elems->ext_capab_len); if (resp != WLAN_STATUS_SUCCESS) return resp; @@ -368,7 +376,7 @@ Signed-off-by: Gioacchino Mazzurco if (resp != WLAN_STATUS_SUCCESS) return resp; -@@ -6029,6 +6032,11 @@ static void handle_beacon(struct hostapd +@@ -6031,6 +6034,11 @@ static void handle_beacon(struct hostapd 0); ap_list_process_beacon(hapd->iface, mgmt, &elems, fi); @@ -393,7 +401,7 @@ Signed-off-by: Gioacchino Mazzurco u16 copy_sta_vendor_vht(struct hostapd_data *hapd, struct sta_info *sta, --- a/src/drivers/driver.h +++ b/src/drivers/driver.h -@@ -4042,7 +4042,7 @@ struct wpa_driver_ops { +@@ -4048,7 +4048,7 @@ struct wpa_driver_ops { * Returns: 0 on success, -1 on failure */ int (*set_wds_sta)(void *priv, const u8 *addr, int aid, int val, @@ -404,7 +412,7 @@ Signed-off-by: Gioacchino Mazzurco * send_action - Transmit an Action frame --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -8557,25 +8557,15 @@ static int have_ifidx(struct wpa_driver_ +@@ -8559,25 +8559,15 @@ static int have_ifidx(struct wpa_driver_ static int i802_set_wds_sta(void *priv, const u8 *addr, int aid, int val, diff --git a/package/network/services/hostapd/patches/802-SAE-Reject-invalid-Rejected-Groups-element-in-the-pa.patch b/package/network/services/hostapd/patches/802-SAE-Reject-invalid-Rejected-Groups-element-in-the-pa.patch deleted file mode 100644 index 268f288827cf1b..00000000000000 --- a/package/network/services/hostapd/patches/802-SAE-Reject-invalid-Rejected-Groups-element-in-the-pa.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 9716bf1160beb677e965d9e6475d6c9e162e8374 Mon Sep 17 00:00:00 2001 -From: Jouni Malinen -Date: Tue, 9 Jul 2024 23:34:34 +0300 -Subject: [PATCH] SAE: Reject invalid Rejected Groups element in the parser - -There is no need to depend on all uses (i.e., both hostapd and -wpa_supplicant) to verify that the length of the Rejected Groups field -in the Rejected Groups element is valid (i.e., a multiple of two octets) -since the common parser can reject the message when detecting this. - -Signed-off-by: Jouni Malinen ---- - src/common/sae.c | 6 ++++++ - 1 file changed, 6 insertions(+) - ---- a/src/common/sae.c -+++ b/src/common/sae.c -@@ -2160,6 +2160,12 @@ static int sae_parse_akm_suite_selector( - return WLAN_STATUS_UNSPECIFIED_FAILURE; - epos++; /* skip ext ID */ - len--; -+ if (len & 1) { -+ wpa_printf(MSG_DEBUG, -+ "SAE: Invalid length of the Rejected Groups element payload: %u", -+ len); -+ return WLAN_STATUS_UNSPECIFIED_FAILURE; -+ } - - if (len < RSN_SELECTOR_LEN) - return WLAN_STATUS_UNSPECIFIED_FAILURE; diff --git a/package/network/services/hostapd/patches/803-hostapd-fix-80211be-build.patch b/package/network/services/hostapd/patches/803-hostapd-fix-80211be-build.patch deleted file mode 100644 index 55c6e635813c9d..00000000000000 --- a/package/network/services/hostapd/patches/803-hostapd-fix-80211be-build.patch +++ /dev/null @@ -1,53 +0,0 @@ ---- a/src/ap/sta_info.c -+++ b/src/ap/sta_info.c -@@ -1836,3 +1836,22 @@ void ap_sta_free_sta_profile(struct mld_ - } - } - #endif /* CONFIG_IEEE80211BE */ -+ -+bool ap_sta_is_mld(struct hostapd_data *hapd, -+ struct sta_info *sta) -+{ -+#ifdef CONFIG_IEEE80211BE -+ return hapd->conf->mld_ap && sta && sta->mld_info.mld_sta; -+#else /* CONFIG_IEEE80211BE */ -+ return false; -+#endif /* CONFIG_IEEE80211BE */ -+} -+ -+void ap_sta_set_mld(struct sta_info *sta, bool mld) -+{ -+#ifdef CONFIG_IEEE80211BE -+ if (sta) -+ sta->mld_info.mld_sta = mld; -+#endif /* CONFIG_IEEE80211BE */ -+} -+ ---- a/src/ap/sta_info.h -+++ b/src/ap/sta_info.h -@@ -417,23 +417,8 @@ int ap_sta_re_add(struct hostapd_data *h - - void ap_free_sta_pasn(struct hostapd_data *hapd, struct sta_info *sta); - --static inline bool ap_sta_is_mld(struct hostapd_data *hapd, -- struct sta_info *sta) --{ --#ifdef CONFIG_IEEE80211BE -- return hapd->conf->mld_ap && sta && sta->mld_info.mld_sta; --#else /* CONFIG_IEEE80211BE */ -- return false; --#endif /* CONFIG_IEEE80211BE */ --} -- --static inline void ap_sta_set_mld(struct sta_info *sta, bool mld) --{ --#ifdef CONFIG_IEEE80211BE -- if (sta) -- sta->mld_info.mld_sta = mld; --#endif /* CONFIG_IEEE80211BE */ --} -+bool ap_sta_is_mld(struct hostapd_data *hapd, struct sta_info *sta); -+void ap_sta_set_mld(struct sta_info *sta, bool mld); - - void ap_sta_free_sta_profile(struct mld_info *info); - diff --git a/package/network/services/hostapd/src/src/ap/ubus.h b/package/network/services/hostapd/src/src/ap/ubus.h index 22767d67ee7564..5b8938cbd32d7d 100644 --- a/package/network/services/hostapd/src/src/ap/ubus.h +++ b/package/network/services/hostapd/src/src/ap/ubus.h @@ -8,8 +8,6 @@ #ifndef __HOSTAPD_UBUS_H #define __HOSTAPD_UBUS_H -#include "sta_info.h" - enum hostapd_ubus_event_type { HOSTAPD_UBUS_PROBE_REQ, HOSTAPD_UBUS_AUTH_REQ, diff --git a/package/network/services/hostapd/src/src/ap/ucode.c b/package/network/services/hostapd/src/src/ap/ucode.c index 68fb450884e2f3..c54f071ee0f5ea 100644 --- a/package/network/services/hostapd/src/src/ap/ucode.c +++ b/package/network/services/hostapd/src/src/ap/ucode.c @@ -3,7 +3,7 @@ #include "utils/includes.h" #include "utils/common.h" #include "utils/ucode.h" -#include "hostapd.h" +#include "sta_info.h" #include "beacon.h" #include "hw_features.h" #include "ap_drv_ops.h" diff --git a/package/network/services/hostapd/src/src/utils/ap/ubus.c b/package/network/services/hostapd/src/src/utils/ap/ubus.c deleted file mode 100644 index 8689494bcff3e5..00000000000000 --- a/package/network/services/hostapd/src/src/utils/ap/ubus.c +++ /dev/null @@ -1,2006 +0,0 @@ -/* - * hostapd / ubus support - * Copyright (c) 2013, Felix Fietkau - * - * This software may be distributed under the terms of the BSD license. - * See README for more details. - */ - -#include "utils/includes.h" -#include "utils/common.h" -#include "utils/eloop.h" -#include "utils/wpabuf.h" -#include "common/ieee802_11_defs.h" -#include "common/hw_features_common.h" -#include "hostapd.h" -#include "neighbor_db.h" -#include "wps_hostapd.h" -#include "sta_info.h" -#include "ubus.h" -#include "ap_drv_ops.h" -#include "beacon.h" -#include "rrm.h" -#include "wnm_ap.h" -#include "taxonomy.h" -#include "airtime_policy.h" -#include "hw_features.h" - -static struct ubus_context *ctx; -static struct blob_buf b; -static int ctx_ref; - -static inline struct hostapd_data *get_hapd_from_object(struct ubus_object *obj) -{ - return container_of(obj, struct hostapd_data, ubus.obj); -} - -struct ubus_banned_client { - struct avl_node avl; - u8 addr[ETH_ALEN]; -}; - -static void ubus_reconnect_timeout(void *eloop_data, void *user_ctx) -{ - if (ubus_reconnect(ctx, NULL)) { - eloop_register_timeout(1, 0, ubus_reconnect_timeout, ctx, NULL); - return; - } - - ubus_add_uloop(ctx); -} - -static void hostapd_ubus_connection_lost(struct ubus_context *ctx) -{ - uloop_fd_delete(&ctx->sock); - eloop_register_timeout(1, 0, ubus_reconnect_timeout, ctx, NULL); -} - -static bool hostapd_ubus_init(void) -{ - if (ctx) - return true; - - eloop_add_uloop(); - ctx = ubus_connect(NULL); - if (!ctx) - return false; - - ctx->connection_lost = hostapd_ubus_connection_lost; - ubus_add_uloop(ctx); - - return true; -} - -static void hostapd_ubus_ref_inc(void) -{ - ctx_ref++; -} - -static void hostapd_ubus_ref_dec(void) -{ - ctx_ref--; - if (!ctx) - return; - - if (ctx_ref) - return; - - uloop_fd_delete(&ctx->sock); - ubus_free(ctx); - ctx = NULL; -} - -void hostapd_ubus_add_iface(struct hostapd_iface *iface) -{ - if (!hostapd_ubus_init()) - return; -} - -void hostapd_ubus_free_iface(struct hostapd_iface *iface) -{ - if (!ctx) - return; -} - -static void hostapd_notify_ubus(struct ubus_object *obj, char *bssname, char *event) -{ - char *event_type; - - if (!ctx || !obj) - return; - - if (asprintf(&event_type, "bss.%s", event) < 0) - return; - - blob_buf_init(&b, 0); - blobmsg_add_string(&b, "name", bssname); - ubus_notify(ctx, obj, event_type, b.head, -1); - free(event_type); -} - -static void -hostapd_bss_del_ban(void *eloop_data, void *user_ctx) -{ - struct ubus_banned_client *ban = eloop_data; - struct hostapd_data *hapd = user_ctx; - - avl_delete(&hapd->ubus.banned, &ban->avl); - free(ban); -} - -static void -hostapd_bss_ban_client(struct hostapd_data *hapd, u8 *addr, int time) -{ - struct ubus_banned_client *ban; - - if (time < 0) - time = 0; - - ban = avl_find_element(&hapd->ubus.banned, addr, ban, avl); - if (!ban) { - if (!time) - return; - - ban = os_zalloc(sizeof(*ban)); - memcpy(ban->addr, addr, sizeof(ban->addr)); - ban->avl.key = ban->addr; - avl_insert(&hapd->ubus.banned, &ban->avl); - } else { - eloop_cancel_timeout(hostapd_bss_del_ban, ban, hapd); - if (!time) { - hostapd_bss_del_ban(ban, hapd); - return; - } - } - - eloop_register_timeout(0, time * 1000, hostapd_bss_del_ban, ban, hapd); -} - -static int -hostapd_bss_reload(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); - - return hostapd_reload_config(hapd->iface); -} - - -static void -hostapd_parse_vht_map_blobmsg(uint16_t map) -{ - char label[4]; - int16_t val; - int i; - - for (i = 0; i < 8; i++) { - snprintf(label, 4, "%dss", i + 1); - - val = (map & (BIT(1) | BIT(0))) + 7; - blobmsg_add_u16(&b, label, val == 10 ? -1 : val); - map = map >> 2; - } -} - -static void -hostapd_parse_vht_capab_blobmsg(struct ieee80211_vht_capabilities *vhtc) -{ - void *supported_mcs; - void *map; - int i; - - static const struct { - const char *name; - uint32_t flag; - } vht_capas[] = { - { "su_beamformee", VHT_CAP_SU_BEAMFORMEE_CAPABLE }, - { "mu_beamformee", VHT_CAP_MU_BEAMFORMEE_CAPABLE }, - }; - - for (i = 0; i < ARRAY_SIZE(vht_capas); i++) - blobmsg_add_u8(&b, vht_capas[i].name, - !!(vhtc->vht_capabilities_info & vht_capas[i].flag)); - - supported_mcs = blobmsg_open_table(&b, "mcs_map"); - - /* RX map */ - map = blobmsg_open_table(&b, "rx"); - hostapd_parse_vht_map_blobmsg(le_to_host16(vhtc->vht_supported_mcs_set.rx_map)); - blobmsg_close_table(&b, map); - - /* TX map */ - map = blobmsg_open_table(&b, "tx"); - hostapd_parse_vht_map_blobmsg(le_to_host16(vhtc->vht_supported_mcs_set.tx_map)); - blobmsg_close_table(&b, map); - - blobmsg_close_table(&b, supported_mcs); -} - -static void -hostapd_parse_capab_blobmsg(struct sta_info *sta) -{ - void *r, *v; - - v = blobmsg_open_table(&b, "capabilities"); - - if (sta->vht_capabilities) { - r = blobmsg_open_table(&b, "vht"); - hostapd_parse_vht_capab_blobmsg(sta->vht_capabilities); - blobmsg_close_table(&b, r); - } - - /* ToDo: Add HT / HE capability parsing */ - - blobmsg_close_table(&b, v); -} - -static int -hostapd_bss_get_clients(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 hostap_sta_driver_data sta_driver_data; - struct sta_info *sta; - void *list, *c; - char mac_buf[20]; - static const struct { - const char *name; - uint32_t flag; - } sta_flags[] = { - { "auth", WLAN_STA_AUTH }, - { "assoc", WLAN_STA_ASSOC }, - { "authorized", WLAN_STA_AUTHORIZED }, - { "preauth", WLAN_STA_PREAUTH }, - { "wds", WLAN_STA_WDS }, - { "wmm", WLAN_STA_WMM }, - { "ht", WLAN_STA_HT }, - { "vht", WLAN_STA_VHT }, - { "he", WLAN_STA_HE }, - { "wps", WLAN_STA_WPS }, - { "mfp", WLAN_STA_MFP }, - }; - - blob_buf_init(&b, 0); - blobmsg_add_u32(&b, "freq", hapd->iface->freq); - list = blobmsg_open_table(&b, "clients"); - for (sta = hapd->sta_list; sta; sta = sta->next) { - void *r; - int i; - - sprintf(mac_buf, MACSTR, MAC2STR(sta->addr)); - c = blobmsg_open_table(&b, mac_buf); - for (i = 0; i < ARRAY_SIZE(sta_flags); i++) - blobmsg_add_u8(&b, sta_flags[i].name, - !!(sta->flags & sta_flags[i].flag)); - -#ifdef CONFIG_MBO - blobmsg_add_u8(&b, "mbo", !!(sta->cell_capa)); -#endif - - r = blobmsg_open_array(&b, "rrm"); - for (i = 0; i < ARRAY_SIZE(sta->rrm_enabled_capa); i++) - blobmsg_add_u32(&b, "", sta->rrm_enabled_capa[i]); - blobmsg_close_array(&b, r); - - r = blobmsg_open_array(&b, "extended_capabilities"); - /* Check if client advertises extended capabilities */ - if (sta->ext_capability && sta->ext_capability[0] > 0) { - for (i = 0; i < sta->ext_capability[0]; i++) { - blobmsg_add_u32(&b, "", sta->ext_capability[1 + i]); - } - } - blobmsg_close_array(&b, r); - - blobmsg_add_u32(&b, "aid", sta->aid); -#ifdef CONFIG_TAXONOMY - r = blobmsg_alloc_string_buffer(&b, "signature", 1024); - if (retrieve_sta_taxonomy(hapd, sta, r, 1024) > 0) - blobmsg_add_string_buffer(&b); -#endif - - /* Driver information */ - if (hostapd_drv_read_sta_data(hapd, &sta_driver_data, sta->addr) >= 0) { - r = blobmsg_open_table(&b, "bytes"); - blobmsg_add_u64(&b, "rx", sta_driver_data.rx_bytes); - blobmsg_add_u64(&b, "tx", sta_driver_data.tx_bytes); - blobmsg_close_table(&b, r); - r = blobmsg_open_table(&b, "airtime"); - blobmsg_add_u64(&b, "rx", sta_driver_data.rx_airtime); - blobmsg_add_u64(&b, "tx", sta_driver_data.tx_airtime); - blobmsg_close_table(&b, r); - r = blobmsg_open_table(&b, "packets"); - blobmsg_add_u32(&b, "rx", sta_driver_data.rx_packets); - blobmsg_add_u32(&b, "tx", sta_driver_data.tx_packets); - blobmsg_close_table(&b, r); - r = blobmsg_open_table(&b, "rate"); - /* Rate in kbits */ - blobmsg_add_u32(&b, "rx", sta_driver_data.current_rx_rate * 100); - blobmsg_add_u32(&b, "tx", sta_driver_data.current_tx_rate * 100); - blobmsg_close_table(&b, r); - blobmsg_add_u32(&b, "signal", sta_driver_data.signal); - } - - hostapd_parse_capab_blobmsg(sta); - - blobmsg_close_table(&b, c); - } - blobmsg_close_array(&b, list); - ubus_send_reply(ctx, req, b.head); - - return 0; -} - -static int -hostapd_bss_get_features(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); - - blob_buf_init(&b, 0); - blobmsg_add_u8(&b, "ht_supported", ht_supported(hapd->iface->hw_features)); - blobmsg_add_u8(&b, "vht_supported", vht_supported(hapd->iface->hw_features)); - ubus_send_reply(ctx, req, b.head); - - return 0; -} - -static int -hostapd_bss_get_status(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 *airtime_table, *dfs_table, *rrm_table, *wnm_table; - struct os_reltime now; - char ssid[SSID_MAX_LEN + 1]; - char phy_name[17]; - size_t ssid_len = SSID_MAX_LEN; - u8 channel = 0, op_class = 0; - - if (hapd->conf->ssid.ssid_len < SSID_MAX_LEN) - ssid_len = hapd->conf->ssid.ssid_len; - - ieee80211_freq_to_channel_ext(hapd->iface->freq, - hapd->iconf->secondary_channel, - hostapd_get_oper_chwidth(hapd->iconf), - &op_class, &channel); - - blob_buf_init(&b, 0); - blobmsg_add_string(&b, "status", hostapd_state_text(hapd->iface->state)); - blobmsg_printf(&b, "bssid", MACSTR, MAC2STR(hapd->conf->bssid)); - - memset(ssid, 0, SSID_MAX_LEN + 1); - memcpy(ssid, hapd->conf->ssid.ssid, ssid_len); - blobmsg_add_string(&b, "ssid", ssid); - - blobmsg_add_u32(&b, "freq", hapd->iface->freq); - blobmsg_add_u32(&b, "channel", channel); - blobmsg_add_u32(&b, "op_class", op_class); - blobmsg_add_u32(&b, "beacon_interval", hapd->iconf->beacon_int); -#ifdef CONFIG_IEEE80211AX - blobmsg_add_u32(&b, "bss_color", hapd->iface->conf->he_op.he_bss_color_disabled ? -1 : - hapd->iface->conf->he_op.he_bss_color); -#else - blobmsg_add_u32(&b, "bss_color", -1); -#endif - - snprintf(phy_name, 17, "%s", hapd->iface->phy); - blobmsg_add_string(&b, "phy", phy_name); - - /* RRM */ - rrm_table = blobmsg_open_table(&b, "rrm"); - blobmsg_add_u64(&b, "neighbor_report_tx", hapd->openwrt_stats.rrm.neighbor_report_tx); - blobmsg_close_table(&b, rrm_table); - - /* WNM */ - wnm_table = blobmsg_open_table(&b, "wnm"); - blobmsg_add_u64(&b, "bss_transition_query_rx", hapd->openwrt_stats.wnm.bss_transition_query_rx); - blobmsg_add_u64(&b, "bss_transition_request_tx", hapd->openwrt_stats.wnm.bss_transition_request_tx); - blobmsg_add_u64(&b, "bss_transition_response_rx", hapd->openwrt_stats.wnm.bss_transition_response_rx); - blobmsg_close_table(&b, wnm_table); - - /* Airtime */ - airtime_table = blobmsg_open_table(&b, "airtime"); - blobmsg_add_u64(&b, "time", hapd->iface->last_channel_time); - blobmsg_add_u64(&b, "time_busy", hapd->iface->last_channel_time_busy); - blobmsg_add_u16(&b, "utilization", hapd->iface->channel_utilization); - blobmsg_close_table(&b, airtime_table); - - /* DFS */ - dfs_table = blobmsg_open_table(&b, "dfs"); - blobmsg_add_u32(&b, "cac_seconds", hapd->iface->dfs_cac_ms / 1000); - blobmsg_add_u8(&b, "cac_active", !!(hapd->iface->cac_started)); - os_reltime_age(&hapd->iface->dfs_cac_start, &now); - blobmsg_add_u32(&b, "cac_seconds_left", - hapd->iface->cac_started ? hapd->iface->dfs_cac_ms / 1000 - now.sec : 0); - blobmsg_close_table(&b, dfs_table); - - ubus_send_reply(ctx, req, b.head); - - return 0; -} - -enum { - NOTIFY_RESPONSE, - __NOTIFY_MAX -}; - -static const struct blobmsg_policy notify_policy[__NOTIFY_MAX] = { - [NOTIFY_RESPONSE] = { "notify_response", BLOBMSG_TYPE_INT32 }, -}; - -static int -hostapd_notify_response(struct ubus_context *ctx, struct ubus_object *obj, - struct ubus_request_data *req, const char *method, - struct blob_attr *msg) -{ - struct blob_attr *tb[__NOTIFY_MAX]; - struct hostapd_data *hapd = get_hapd_from_object(obj); - struct wpabuf *elems; - const char *pos; - size_t len; - - blobmsg_parse(notify_policy, __NOTIFY_MAX, tb, - blob_data(msg), blob_len(msg)); - - if (!tb[NOTIFY_RESPONSE]) - return UBUS_STATUS_INVALID_ARGUMENT; - - hapd->ubus.notify_response = blobmsg_get_u32(tb[NOTIFY_RESPONSE]); - - return UBUS_STATUS_OK; -} - -enum { - DEL_CLIENT_ADDR, - DEL_CLIENT_REASON, - DEL_CLIENT_DEAUTH, - DEL_CLIENT_BAN_TIME, - __DEL_CLIENT_MAX -}; - -static const struct blobmsg_policy del_policy[__DEL_CLIENT_MAX] = { - [DEL_CLIENT_ADDR] = { "addr", BLOBMSG_TYPE_STRING }, - [DEL_CLIENT_REASON] = { "reason", BLOBMSG_TYPE_INT32 }, - [DEL_CLIENT_DEAUTH] = { "deauth", BLOBMSG_TYPE_INT8 }, - [DEL_CLIENT_BAN_TIME] = { "ban_time", BLOBMSG_TYPE_INT32 }, -}; - -static int -hostapd_bss_del_client(struct ubus_context *ctx, struct ubus_object *obj, - struct ubus_request_data *req, const char *method, - struct blob_attr *msg) -{ - struct blob_attr *tb[__DEL_CLIENT_MAX]; - struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj); - struct sta_info *sta; - bool deauth = false; - int reason; - u8 addr[ETH_ALEN]; - - blobmsg_parse(del_policy, __DEL_CLIENT_MAX, tb, blob_data(msg), blob_len(msg)); - - if (!tb[DEL_CLIENT_ADDR]) - return UBUS_STATUS_INVALID_ARGUMENT; - - if (hwaddr_aton(blobmsg_data(tb[DEL_CLIENT_ADDR]), addr)) - return UBUS_STATUS_INVALID_ARGUMENT; - - if (tb[DEL_CLIENT_REASON]) - reason = blobmsg_get_u32(tb[DEL_CLIENT_REASON]); - - if (tb[DEL_CLIENT_DEAUTH]) - deauth = blobmsg_get_bool(tb[DEL_CLIENT_DEAUTH]); - - sta = ap_get_sta(hapd, addr); - if (sta) { - if (deauth) { - hostapd_drv_sta_deauth(hapd, addr, reason); - ap_sta_deauthenticate(hapd, sta, reason); - } else { - hostapd_drv_sta_disassoc(hapd, addr, reason); - ap_sta_disassociate(hapd, sta, reason); - } - } - - if (tb[DEL_CLIENT_BAN_TIME]) - hostapd_bss_ban_client(hapd, addr, blobmsg_get_u32(tb[DEL_CLIENT_BAN_TIME])); - - return 0; -} - -static void -blobmsg_add_macaddr(struct blob_buf *buf, const char *name, const u8 *addr) -{ - char *s; - - s = blobmsg_alloc_string_buffer(buf, name, 20); - sprintf(s, MACSTR, MAC2STR(addr)); - blobmsg_add_string_buffer(buf); -} - -static int -hostapd_bss_list_bans(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 ubus_banned_client *ban; - void *c; - - blob_buf_init(&b, 0); - c = blobmsg_open_array(&b, "clients"); - avl_for_each_element(&hapd->ubus.banned, ban, avl) - blobmsg_add_macaddr(&b, NULL, ban->addr); - blobmsg_close_array(&b, c); - ubus_send_reply(ctx, req, b.head); - - return 0; -} - -#ifdef CONFIG_WPS -static int -hostapd_bss_wps_start(struct ubus_context *ctx, struct ubus_object *obj, - struct ubus_request_data *req, const char *method, - struct blob_attr *msg) -{ - int rc; - struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj); - - rc = hostapd_wps_button_pushed(hapd, NULL); - - if (rc != 0) - return UBUS_STATUS_NOT_SUPPORTED; - - return 0; -} - - -static const char * pbc_status_enum_str(enum pbc_status status) -{ - switch (status) { - case WPS_PBC_STATUS_DISABLE: - return "Disabled"; - case WPS_PBC_STATUS_ACTIVE: - return "Active"; - case WPS_PBC_STATUS_TIMEOUT: - return "Timed-out"; - case WPS_PBC_STATUS_OVERLAP: - return "Overlap"; - default: - return "Unknown"; - } -} - -static int -hostapd_bss_wps_status(struct ubus_context *ctx, struct ubus_object *obj, - struct ubus_request_data *req, const char *method, - struct blob_attr *msg) -{ - int rc; - struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj); - - blob_buf_init(&b, 0); - - blobmsg_add_string(&b, "pbc_status", pbc_status_enum_str(hapd->wps_stats.pbc_status)); - blobmsg_add_string(&b, "last_wps_result", - (hapd->wps_stats.status == WPS_STATUS_SUCCESS ? - "Success": - (hapd->wps_stats.status == WPS_STATUS_FAILURE ? - "Failed" : "None"))); - - /* If status == Failure - Add possible Reasons */ - if(hapd->wps_stats.status == WPS_STATUS_FAILURE && - hapd->wps_stats.failure_reason > 0) - blobmsg_add_string(&b, "reason", wps_ei_str(hapd->wps_stats.failure_reason)); - - if (hapd->wps_stats.status) - blobmsg_printf(&b, "peer_address", MACSTR, MAC2STR(hapd->wps_stats.peer_addr)); - - ubus_send_reply(ctx, req, b.head); - - return 0; -} - -static int -hostapd_bss_wps_cancel(struct ubus_context *ctx, struct ubus_object *obj, - struct ubus_request_data *req, const char *method, - struct blob_attr *msg) -{ - int rc; - struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj); - - rc = hostapd_wps_cancel(hapd); - - if (rc != 0) - return UBUS_STATUS_NOT_SUPPORTED; - - return 0; -} -#endif /* CONFIG_WPS */ - -static int -hostapd_bss_update_beacon(struct ubus_context *ctx, struct ubus_object *obj, - struct ubus_request_data *req, const char *method, - struct blob_attr *msg) -{ - int rc; - struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj); - - rc = ieee802_11_set_beacon(hapd); - - if (rc != 0) - return UBUS_STATUS_NOT_SUPPORTED; - - return 0; -} - -enum { - CONFIG_IFACE, - CONFIG_FILE, - __CONFIG_MAX -}; - -enum { - CSA_FREQ, - CSA_BCN_COUNT, - CSA_CENTER_FREQ1, - CSA_CENTER_FREQ2, - CSA_BANDWIDTH, - CSA_SEC_CHANNEL_OFFSET, - CSA_HT, - CSA_VHT, - CSA_HE, - CSA_BLOCK_TX, - CSA_FORCE, - __CSA_MAX -}; - -static const struct blobmsg_policy csa_policy[__CSA_MAX] = { - [CSA_FREQ] = { "freq", BLOBMSG_TYPE_INT32 }, - [CSA_BCN_COUNT] = { "bcn_count", BLOBMSG_TYPE_INT32 }, - [CSA_CENTER_FREQ1] = { "center_freq1", BLOBMSG_TYPE_INT32 }, - [CSA_CENTER_FREQ2] = { "center_freq2", BLOBMSG_TYPE_INT32 }, - [CSA_BANDWIDTH] = { "bandwidth", BLOBMSG_TYPE_INT32 }, - [CSA_SEC_CHANNEL_OFFSET] = { "sec_channel_offset", BLOBMSG_TYPE_INT32 }, - [CSA_HT] = { "ht", BLOBMSG_TYPE_BOOL }, - [CSA_VHT] = { "vht", BLOBMSG_TYPE_BOOL }, - [CSA_HE] = { "he", BLOBMSG_TYPE_BOOL }, - [CSA_BLOCK_TX] = { "block_tx", BLOBMSG_TYPE_BOOL }, - [CSA_FORCE] = { "force", BLOBMSG_TYPE_BOOL }, -}; - - -static void switch_chan_fallback_cb(void *eloop_data, void *user_ctx) -{ - struct hostapd_iface *iface = eloop_data; - struct hostapd_freq_params *freq_params = user_ctx; - - hostapd_switch_channel_fallback(iface, freq_params); -} - -#ifdef NEED_AP_MLME -static int -hostapd_switch_chan(struct ubus_context *ctx, struct ubus_object *obj, - struct ubus_request_data *req, const char *method, - struct blob_attr *msg) -{ - struct blob_attr *tb[__CSA_MAX]; - struct hostapd_data *hapd = get_hapd_from_object(obj); - struct hostapd_config *iconf = hapd->iface->conf; - struct hostapd_freq_params *freq_params; - struct hostapd_hw_modes *mode = hapd->iface->current_mode; - struct csa_settings css = { - .freq_params = { - .ht_enabled = iconf->ieee80211n, - .vht_enabled = iconf->ieee80211ac, - .he_enabled = iconf->ieee80211ax, - .sec_channel_offset = iconf->secondary_channel, - } - }; - u8 chwidth = hostapd_get_oper_chwidth(iconf); - u8 seg0 = 0, seg1 = 0; - int ret = UBUS_STATUS_OK; - int i; - - blobmsg_parse(csa_policy, __CSA_MAX, tb, blob_data(msg), blob_len(msg)); - - if (!tb[CSA_FREQ]) - return UBUS_STATUS_INVALID_ARGUMENT; - - switch (iconf->vht_oper_chwidth) { - case CHANWIDTH_USE_HT: - if (iconf->secondary_channel) - css.freq_params.bandwidth = 40; - else - css.freq_params.bandwidth = 20; - break; - case CHANWIDTH_160MHZ: - css.freq_params.bandwidth = 160; - break; - default: - css.freq_params.bandwidth = 80; - break; - } - - css.freq_params.freq = blobmsg_get_u32(tb[CSA_FREQ]); - -#define SET_CSA_SETTING(name, field, type) \ - do { \ - if (tb[name]) \ - css.field = blobmsg_get_ ## type(tb[name]); \ - } while(0) - - SET_CSA_SETTING(CSA_BCN_COUNT, cs_count, u32); - SET_CSA_SETTING(CSA_CENTER_FREQ1, freq_params.center_freq1, u32); - SET_CSA_SETTING(CSA_CENTER_FREQ2, freq_params.center_freq2, u32); - SET_CSA_SETTING(CSA_BANDWIDTH, freq_params.bandwidth, u32); - SET_CSA_SETTING(CSA_SEC_CHANNEL_OFFSET, freq_params.sec_channel_offset, u32); - SET_CSA_SETTING(CSA_HT, freq_params.ht_enabled, bool); - SET_CSA_SETTING(CSA_VHT, freq_params.vht_enabled, bool); - SET_CSA_SETTING(CSA_HE, freq_params.he_enabled, bool); - SET_CSA_SETTING(CSA_BLOCK_TX, block_tx, bool); - - css.freq_params.channel = hostapd_hw_get_channel(hapd, css.freq_params.freq); - if (!css.freq_params.channel) - return UBUS_STATUS_NOT_SUPPORTED; - - switch (css.freq_params.bandwidth) { - case 160: - chwidth = CHANWIDTH_160MHZ; - break; - case 80: - chwidth = css.freq_params.center_freq2 ? CHANWIDTH_80P80MHZ : CHANWIDTH_80MHZ; - break; - default: - chwidth = CHANWIDTH_USE_HT; - break; - } - - hostapd_set_freq_params(&css.freq_params, iconf->hw_mode, - css.freq_params.freq, - css.freq_params.channel, iconf->enable_edmg, - iconf->edmg_channel, - css.freq_params.ht_enabled, - css.freq_params.vht_enabled, - css.freq_params.he_enabled, - css.freq_params.eht_enabled, - css.freq_params.sec_channel_offset, - chwidth, seg0, seg1, - iconf->vht_capab, - mode ? &mode->he_capab[IEEE80211_MODE_AP] : - NULL, - mode ? &mode->eht_capab[IEEE80211_MODE_AP] : - NULL, - hostapd_get_punct_bitmap(hapd)); - - for (i = 0; i < hapd->iface->num_bss; i++) { - struct hostapd_data *bss = hapd->iface->bss[i]; - - if (hostapd_switch_channel(bss, &css) != 0) - ret = UBUS_STATUS_NOT_SUPPORTED; - } - - if (!ret || !tb[CSA_FORCE] || !blobmsg_get_bool(tb[CSA_FORCE])) - return ret; - - freq_params = malloc(sizeof(*freq_params)); - memcpy(freq_params, &css.freq_params, sizeof(*freq_params)); - eloop_register_timeout(0, 1, switch_chan_fallback_cb, - hapd->iface, freq_params); - - return 0; -#undef SET_CSA_SETTING -} -#endif - -enum { - VENDOR_ELEMENTS, - __VENDOR_ELEMENTS_MAX -}; - -static const struct blobmsg_policy ve_policy[__VENDOR_ELEMENTS_MAX] = { - /* vendor elements are provided as hex-string */ - [VENDOR_ELEMENTS] = { "vendor_elements", BLOBMSG_TYPE_STRING }, -}; - -static int -hostapd_vendor_elements(struct ubus_context *ctx, struct ubus_object *obj, - struct ubus_request_data *req, const char *method, - struct blob_attr *msg) -{ - struct blob_attr *tb[__VENDOR_ELEMENTS_MAX]; - struct hostapd_data *hapd = get_hapd_from_object(obj); - struct hostapd_bss_config *bss = hapd->conf; - struct wpabuf *elems; - const char *pos; - size_t len; - - blobmsg_parse(ve_policy, __VENDOR_ELEMENTS_MAX, tb, - blob_data(msg), blob_len(msg)); - - if (!tb[VENDOR_ELEMENTS]) - return UBUS_STATUS_INVALID_ARGUMENT; - - pos = blobmsg_data(tb[VENDOR_ELEMENTS]); - len = os_strlen(pos); - if (len & 0x01) - return UBUS_STATUS_INVALID_ARGUMENT; - - len /= 2; - if (len == 0) { - wpabuf_free(bss->vendor_elements); - bss->vendor_elements = NULL; - return 0; - } - - elems = wpabuf_alloc(len); - if (elems == NULL) - return 1; - - if (hexstr2bin(pos, wpabuf_put(elems, len), len)) { - wpabuf_free(elems); - return UBUS_STATUS_INVALID_ARGUMENT; - } - - wpabuf_free(bss->vendor_elements); - bss->vendor_elements = elems; - - /* update beacons if vendor elements were set successfully */ - if (ieee802_11_update_beacons(hapd->iface) != 0) - return UBUS_STATUS_NOT_SUPPORTED; - return UBUS_STATUS_OK; -} - -static void -hostapd_rrm_print_nr(struct hostapd_neighbor_entry *nr) -{ - const u8 *data; - char *str; - int len; - - blobmsg_printf(&b, "", MACSTR, MAC2STR(nr->bssid)); - - str = blobmsg_alloc_string_buffer(&b, "", nr->ssid.ssid_len + 1); - memcpy(str, nr->ssid.ssid, nr->ssid.ssid_len); - str[nr->ssid.ssid_len] = 0; - blobmsg_add_string_buffer(&b); - - len = wpabuf_len(nr->nr); - str = blobmsg_alloc_string_buffer(&b, "", 2 * len + 1); - wpa_snprintf_hex(str, 2 * len + 1, wpabuf_head_u8(nr->nr), len); - blobmsg_add_string_buffer(&b); -} - -enum { - BSS_MGMT_EN_NEIGHBOR, - BSS_MGMT_EN_BEACON, - BSS_MGMT_EN_LINK_MEASUREMENT, -#ifdef CONFIG_WNM_AP - BSS_MGMT_EN_BSS_TRANSITION, -#endif - __BSS_MGMT_EN_MAX -}; - -static bool -__hostapd_bss_mgmt_enable_f(struct hostapd_data *hapd, int flag) -{ - struct hostapd_bss_config *bss = hapd->conf; - uint32_t flags; - - switch (flag) { - case BSS_MGMT_EN_NEIGHBOR: - if (bss->radio_measurements[0] & - WLAN_RRM_CAPS_NEIGHBOR_REPORT) - return false; - - bss->radio_measurements[0] |= - WLAN_RRM_CAPS_NEIGHBOR_REPORT; - hostapd_neighbor_set_own_report(hapd); - return true; - case BSS_MGMT_EN_BEACON: - flags = WLAN_RRM_CAPS_BEACON_REPORT_PASSIVE | - WLAN_RRM_CAPS_BEACON_REPORT_ACTIVE | - WLAN_RRM_CAPS_BEACON_REPORT_TABLE; - - if (bss->radio_measurements[0] & flags == flags) - return false; - - bss->radio_measurements[0] |= (u8) flags; - return true; - case BSS_MGMT_EN_LINK_MEASUREMENT: - flags = WLAN_RRM_CAPS_LINK_MEASUREMENT; - - if (bss->radio_measurements[0] & flags == flags) - return false; - - bss->radio_measurements[0] |= (u8) flags; - return true; -#ifdef CONFIG_WNM_AP - case BSS_MGMT_EN_BSS_TRANSITION: - if (bss->bss_transition) - return false; - - bss->bss_transition = 1; - return true; -#endif - } -} - -static void -__hostapd_bss_mgmt_enable(struct hostapd_data *hapd, uint32_t flags) -{ - bool update = false; - int i; - - for (i = 0; i < __BSS_MGMT_EN_MAX; i++) { - if (!(flags & (1 << i))) - continue; - - update |= __hostapd_bss_mgmt_enable_f(hapd, i); - } - - if (update) - ieee802_11_update_beacons(hapd->iface); -} - - -static const struct blobmsg_policy bss_mgmt_enable_policy[__BSS_MGMT_EN_MAX] = { - [BSS_MGMT_EN_NEIGHBOR] = { "neighbor_report", BLOBMSG_TYPE_BOOL }, - [BSS_MGMT_EN_BEACON] = { "beacon_report", BLOBMSG_TYPE_BOOL }, - [BSS_MGMT_EN_LINK_MEASUREMENT] = { "link_measurement", BLOBMSG_TYPE_BOOL }, -#ifdef CONFIG_WNM_AP - [BSS_MGMT_EN_BSS_TRANSITION] = { "bss_transition", BLOBMSG_TYPE_BOOL }, -#endif -}; - -static int -hostapd_bss_mgmt_enable(struct ubus_context *ctx, struct ubus_object *obj, - struct ubus_request_data *req, const char *method, - struct blob_attr *msg) - -{ - struct hostapd_data *hapd = get_hapd_from_object(obj); - struct blob_attr *tb[__BSS_MGMT_EN_MAX]; - struct blob_attr *cur; - uint32_t flags = 0; - int i; - bool neigh = false, beacon = false; - - blobmsg_parse(bss_mgmt_enable_policy, __BSS_MGMT_EN_MAX, tb, blob_data(msg), blob_len(msg)); - - for (i = 0; i < ARRAY_SIZE(tb); i++) { - if (!tb[i] || !blobmsg_get_bool(tb[i])) - continue; - - flags |= (1 << i); - } - - __hostapd_bss_mgmt_enable(hapd, flags); - - return 0; -} - - -static void -hostapd_rrm_nr_enable(struct hostapd_data *hapd) -{ - __hostapd_bss_mgmt_enable(hapd, 1 << BSS_MGMT_EN_NEIGHBOR); -} - -static int -hostapd_rrm_nr_get_own(struct ubus_context *ctx, struct ubus_object *obj, - struct ubus_request_data *req, const char *method, - struct blob_attr *msg) -{ - struct hostapd_data *hapd = get_hapd_from_object(obj); - struct hostapd_neighbor_entry *nr; - void *c; - - hostapd_rrm_nr_enable(hapd); - - nr = hostapd_neighbor_get(hapd, hapd->own_addr, NULL); - if (!nr) - return UBUS_STATUS_NOT_FOUND; - - blob_buf_init(&b, 0); - - c = blobmsg_open_array(&b, "value"); - hostapd_rrm_print_nr(nr); - blobmsg_close_array(&b, c); - - ubus_send_reply(ctx, req, b.head); - - return 0; -} - -static int -hostapd_rrm_nr_list(struct ubus_context *ctx, struct ubus_object *obj, - struct ubus_request_data *req, const char *method, - struct blob_attr *msg) -{ - struct hostapd_data *hapd = get_hapd_from_object(obj); - struct hostapd_neighbor_entry *nr; - void *c; - - hostapd_rrm_nr_enable(hapd); - blob_buf_init(&b, 0); - - c = blobmsg_open_array(&b, "list"); - dl_list_for_each(nr, &hapd->nr_db, struct hostapd_neighbor_entry, list) { - void *cur; - - if (!memcmp(nr->bssid, hapd->own_addr, ETH_ALEN)) - continue; - - cur = blobmsg_open_array(&b, NULL); - hostapd_rrm_print_nr(nr); - blobmsg_close_array(&b, cur); - } - blobmsg_close_array(&b, c); - - ubus_send_reply(ctx, req, b.head); - - return 0; -} - -enum { - NR_SET_LIST, - __NR_SET_LIST_MAX -}; - -static const struct blobmsg_policy nr_set_policy[__NR_SET_LIST_MAX] = { - [NR_SET_LIST] = { "list", BLOBMSG_TYPE_ARRAY }, -}; - - -static void -hostapd_rrm_nr_clear(struct hostapd_data *hapd) -{ - struct hostapd_neighbor_entry *nr; - -restart: - dl_list_for_each(nr, &hapd->nr_db, struct hostapd_neighbor_entry, list) { - if (!memcmp(nr->bssid, hapd->own_addr, ETH_ALEN)) - continue; - - hostapd_neighbor_remove(hapd, nr->bssid, &nr->ssid); - goto restart; - } -} - -static int -hostapd_rrm_nr_set(struct ubus_context *ctx, struct ubus_object *obj, - struct ubus_request_data *req, const char *method, - struct blob_attr *msg) -{ - static const struct blobmsg_policy nr_e_policy[] = { - { .type = BLOBMSG_TYPE_STRING }, - { .type = BLOBMSG_TYPE_STRING }, - { .type = BLOBMSG_TYPE_STRING }, - }; - struct hostapd_data *hapd = get_hapd_from_object(obj); - struct blob_attr *tb_l[__NR_SET_LIST_MAX]; - struct blob_attr *tb[ARRAY_SIZE(nr_e_policy)]; - struct blob_attr *cur; - int rem; - - hostapd_rrm_nr_enable(hapd); - - blobmsg_parse(nr_set_policy, __NR_SET_LIST_MAX, tb_l, blob_data(msg), blob_len(msg)); - if (!tb_l[NR_SET_LIST]) - return UBUS_STATUS_INVALID_ARGUMENT; - - hostapd_rrm_nr_clear(hapd); - blobmsg_for_each_attr(cur, tb_l[NR_SET_LIST], rem) { - struct wpa_ssid_value ssid; - struct wpabuf *data; - u8 bssid[ETH_ALEN]; - char *s, *nr_s; - - blobmsg_parse_array(nr_e_policy, ARRAY_SIZE(nr_e_policy), tb, blobmsg_data(cur), blobmsg_data_len(cur)); - if (!tb[0] || !tb[1] || !tb[2]) - goto invalid; - - /* Neighbor Report binary */ - nr_s = blobmsg_get_string(tb[2]); - data = wpabuf_parse_bin(nr_s); - if (!data) - goto invalid; - - /* BSSID */ - s = blobmsg_get_string(tb[0]); - if (strlen(s) == 0) { - /* Copy BSSID from neighbor report */ - if (hwaddr_compact_aton(nr_s, bssid)) - goto invalid; - } else if (hwaddr_aton(s, bssid)) { - goto invalid; - } - - /* SSID */ - s = blobmsg_get_string(tb[1]); - if (strlen(s) == 0) { - /* Copy SSID from hostapd BSS conf */ - memcpy(&ssid, &hapd->conf->ssid, sizeof(ssid)); - } else { - ssid.ssid_len = strlen(s); - if (ssid.ssid_len > sizeof(ssid.ssid)) - goto invalid; - - memcpy(&ssid, s, ssid.ssid_len); - } - - hostapd_neighbor_set(hapd, bssid, &ssid, data, NULL, NULL, 0, 0); - wpabuf_free(data); - continue; - -invalid: - return UBUS_STATUS_INVALID_ARGUMENT; - } - - return 0; -} - -enum { - BEACON_REQ_ADDR, - BEACON_REQ_MODE, - BEACON_REQ_OP_CLASS, - BEACON_REQ_CHANNEL, - BEACON_REQ_DURATION, - BEACON_REQ_BSSID, - BEACON_REQ_SSID, - __BEACON_REQ_MAX, -}; - -static const struct blobmsg_policy beacon_req_policy[__BEACON_REQ_MAX] = { - [BEACON_REQ_ADDR] = { "addr", BLOBMSG_TYPE_STRING }, - [BEACON_REQ_OP_CLASS] { "op_class", BLOBMSG_TYPE_INT32 }, - [BEACON_REQ_CHANNEL] { "channel", BLOBMSG_TYPE_INT32 }, - [BEACON_REQ_DURATION] { "duration", BLOBMSG_TYPE_INT32 }, - [BEACON_REQ_MODE] { "mode", BLOBMSG_TYPE_INT32 }, - [BEACON_REQ_BSSID] { "bssid", BLOBMSG_TYPE_STRING }, - [BEACON_REQ_SSID] { "ssid", BLOBMSG_TYPE_STRING }, -}; - -static int -hostapd_rrm_beacon_req(struct ubus_context *ctx, struct ubus_object *obj, - struct ubus_request_data *ureq, const char *method, - struct blob_attr *msg) -{ - struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj); - struct blob_attr *tb[__BEACON_REQ_MAX]; - struct blob_attr *cur; - struct wpabuf *req; - u8 bssid[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; - u8 addr[ETH_ALEN]; - int mode, rem, ret; - int buf_len = 13; - - blobmsg_parse(beacon_req_policy, __BEACON_REQ_MAX, tb, blob_data(msg), blob_len(msg)); - - if (!tb[BEACON_REQ_ADDR] || !tb[BEACON_REQ_MODE] || !tb[BEACON_REQ_DURATION] || - !tb[BEACON_REQ_OP_CLASS] || !tb[BEACON_REQ_CHANNEL]) - return UBUS_STATUS_INVALID_ARGUMENT; - - if (tb[BEACON_REQ_SSID]) - buf_len += blobmsg_data_len(tb[BEACON_REQ_SSID]) + 2 - 1; - - mode = blobmsg_get_u32(tb[BEACON_REQ_MODE]); - if (hwaddr_aton(blobmsg_data(tb[BEACON_REQ_ADDR]), addr)) - return UBUS_STATUS_INVALID_ARGUMENT; - - if (tb[BEACON_REQ_BSSID] && - hwaddr_aton(blobmsg_data(tb[BEACON_REQ_BSSID]), bssid)) - return UBUS_STATUS_INVALID_ARGUMENT; - - req = wpabuf_alloc(buf_len); - if (!req) - return UBUS_STATUS_UNKNOWN_ERROR; - - /* 1: regulatory class */ - wpabuf_put_u8(req, blobmsg_get_u32(tb[BEACON_REQ_OP_CLASS])); - - /* 2: channel number */ - wpabuf_put_u8(req, blobmsg_get_u32(tb[BEACON_REQ_CHANNEL])); - - /* 3-4: randomization interval */ - wpabuf_put_le16(req, 0); - - /* 5-6: duration */ - wpabuf_put_le16(req, blobmsg_get_u32(tb[BEACON_REQ_DURATION])); - - /* 7: mode */ - wpabuf_put_u8(req, blobmsg_get_u32(tb[BEACON_REQ_MODE])); - - /* 8-13: BSSID */ - wpabuf_put_data(req, bssid, ETH_ALEN); - - if ((cur = tb[BEACON_REQ_SSID]) != NULL) { - wpabuf_put_u8(req, WLAN_EID_SSID); - wpabuf_put_u8(req, blobmsg_data_len(cur) - 1); - wpabuf_put_data(req, blobmsg_data(cur), blobmsg_data_len(cur) - 1); - } - - ret = hostapd_send_beacon_req(hapd, addr, 0, req); - if (ret < 0) - return -ret; - - return 0; -} - -enum { - LM_REQ_ADDR, - LM_REQ_TX_POWER_USED, - LM_REQ_TX_POWER_MAX, - __LM_REQ_MAX, -}; - -static const struct blobmsg_policy lm_req_policy[__LM_REQ_MAX] = { - [LM_REQ_ADDR] = { "addr", BLOBMSG_TYPE_STRING }, - [LM_REQ_TX_POWER_USED] = { "tx-power-used", BLOBMSG_TYPE_INT32 }, - [LM_REQ_TX_POWER_MAX] = { "tx-power-max", BLOBMSG_TYPE_INT32 }, -}; - -static int -hostapd_rrm_lm_req(struct ubus_context *ctx, struct ubus_object *obj, - struct ubus_request_data *ureq, const char *method, - struct blob_attr *msg) -{ - struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj); - struct blob_attr *tb[__LM_REQ_MAX]; - struct wpabuf *buf; - u8 addr[ETH_ALEN]; - int ret; - int8_t txp_used, txp_max; - - txp_used = 0; - txp_max = 0; - - blobmsg_parse(lm_req_policy, __LM_REQ_MAX, tb, blob_data(msg), blob_len(msg)); - - if (!tb[LM_REQ_ADDR]) - return UBUS_STATUS_INVALID_ARGUMENT; - - if (tb[LM_REQ_TX_POWER_USED]) - txp_used = (int8_t) blobmsg_get_u32(tb[LM_REQ_TX_POWER_USED]); - - if (tb[LM_REQ_TX_POWER_MAX]) - txp_max = (int8_t) blobmsg_get_u32(tb[LM_REQ_TX_POWER_MAX]); - - if (hwaddr_aton(blobmsg_data(tb[LM_REQ_ADDR]), addr)) - return UBUS_STATUS_INVALID_ARGUMENT; - - buf = wpabuf_alloc(5); - if (!buf) - return UBUS_STATUS_UNKNOWN_ERROR; - - wpabuf_put_u8(buf, WLAN_ACTION_RADIO_MEASUREMENT); - wpabuf_put_u8(buf, WLAN_RRM_LINK_MEASUREMENT_REQUEST); - wpabuf_put_u8(buf, 1); - /* TX-Power used */ - wpabuf_put_u8(buf, txp_used); - /* Max TX Power */ - wpabuf_put_u8(buf, txp_max); - - ret = hostapd_drv_send_action(hapd, hapd->iface->freq, 0, addr, - wpabuf_head(buf), wpabuf_len(buf)); - - wpabuf_free(buf); - if (ret < 0) - return -ret; - - return 0; -} - - -void hostapd_ubus_handle_link_measurement(struct hostapd_data *hapd, const u8 *data, size_t len) -{ - const struct ieee80211_mgmt *mgmt = (const struct ieee80211_mgmt *) data; - const u8 *pos, *end; - u8 token; - - end = data + len; - token = mgmt->u.action.u.rrm.dialog_token; - pos = mgmt->u.action.u.rrm.variable; - - if (end - pos < 8) - return; - - if (!hapd->ubus.obj.has_subscribers) - return; - - blob_buf_init(&b, 0); - blobmsg_add_macaddr(&b, "address", mgmt->sa); - blobmsg_add_u16(&b, "dialog-token", token); - blobmsg_add_u16(&b, "rx-antenna-id", pos[4]); - blobmsg_add_u16(&b, "tx-antenna-id", pos[5]); - blobmsg_add_u16(&b, "rcpi", pos[6]); - blobmsg_add_u16(&b, "rsni", pos[7]); - - ubus_notify(ctx, &hapd->ubus.obj, "link-measurement-report", b.head, -1); -} - - -#ifdef CONFIG_WNM_AP - -static int -hostapd_bss_tr_send(struct hostapd_data *hapd, u8 *addr, bool disassoc_imminent, bool abridged, - u16 disassoc_timer, u8 validity_period, u8 dialog_token, - struct blob_attr *neighbors, u8 mbo_reason, u8 cell_pref, u8 reassoc_delay) -{ - struct blob_attr *cur; - struct sta_info *sta; - int nr_len = 0; - int rem; - u8 *nr = NULL; - u8 req_mode = 0; - u8 mbo[10]; - size_t mbo_len = 0; - - sta = ap_get_sta(hapd, addr); - if (!sta) - return UBUS_STATUS_NOT_FOUND; - - if (neighbors) { - u8 *nr_cur; - - if (blobmsg_check_array(neighbors, - BLOBMSG_TYPE_STRING) < 0) - return UBUS_STATUS_INVALID_ARGUMENT; - - blobmsg_for_each_attr(cur, neighbors, rem) { - int len = strlen(blobmsg_get_string(cur)); - - if (len % 2) - return UBUS_STATUS_INVALID_ARGUMENT; - - nr_len += (len / 2) + 2; - } - - if (nr_len) { - nr = os_zalloc(nr_len); - if (!nr) - return UBUS_STATUS_UNKNOWN_ERROR; - } - - nr_cur = nr; - blobmsg_for_each_attr(cur, neighbors, rem) { - int len = strlen(blobmsg_get_string(cur)) / 2; - - *nr_cur++ = WLAN_EID_NEIGHBOR_REPORT; - *nr_cur++ = (u8) len; - if (hexstr2bin(blobmsg_data(cur), nr_cur, len)) { - free(nr); - return UBUS_STATUS_INVALID_ARGUMENT; - } - - nr_cur += len; - } - } - - if (nr) - req_mode |= WNM_BSS_TM_REQ_PREF_CAND_LIST_INCLUDED; - - if (abridged) - req_mode |= WNM_BSS_TM_REQ_ABRIDGED; - - if (disassoc_imminent) - req_mode |= WNM_BSS_TM_REQ_DISASSOC_IMMINENT; - -#ifdef CONFIG_MBO - u8 *mbo_pos = mbo; - - if (mbo_reason > MBO_TRANSITION_REASON_PREMIUM_AP) - return UBUS_STATUS_INVALID_ARGUMENT; - - if (cell_pref != 0 && cell_pref != 1 && cell_pref != 255) - return UBUS_STATUS_INVALID_ARGUMENT; - - if (reassoc_delay > 65535 || (reassoc_delay && !disassoc_imminent)) - return UBUS_STATUS_INVALID_ARGUMENT; - - *mbo_pos++ = MBO_ATTR_ID_TRANSITION_REASON; - *mbo_pos++ = 1; - *mbo_pos++ = mbo_reason; - *mbo_pos++ = MBO_ATTR_ID_CELL_DATA_PREF; - *mbo_pos++ = 1; - *mbo_pos++ = cell_pref; - - if (reassoc_delay) { - *mbo_pos++ = MBO_ATTR_ID_ASSOC_RETRY_DELAY; - *mbo_pos++ = 2; - WPA_PUT_LE16(mbo_pos, reassoc_delay); - mbo_pos += 2; - } - - mbo_len = mbo_pos - mbo; -#endif - - if (wnm_send_bss_tm_req(hapd, sta, req_mode, disassoc_timer, validity_period, NULL, - dialog_token, NULL, nr, nr_len, mbo_len ? mbo : NULL, mbo_len)) - return UBUS_STATUS_UNKNOWN_ERROR; - - return 0; -} - -enum { - BSS_TR_ADDR, - BSS_TR_DA_IMMINENT, - BSS_TR_DA_TIMER, - BSS_TR_VALID_PERIOD, - BSS_TR_NEIGHBORS, - BSS_TR_ABRIDGED, - BSS_TR_DIALOG_TOKEN, -#ifdef CONFIG_MBO - BSS_TR_MBO_REASON, - BSS_TR_CELL_PREF, - BSS_TR_REASSOC_DELAY, -#endif - __BSS_TR_DISASSOC_MAX -}; - -static const struct blobmsg_policy bss_tr_policy[__BSS_TR_DISASSOC_MAX] = { - [BSS_TR_ADDR] = { "addr", BLOBMSG_TYPE_STRING }, - [BSS_TR_DA_IMMINENT] = { "disassociation_imminent", BLOBMSG_TYPE_BOOL }, - [BSS_TR_DA_TIMER] = { "disassociation_timer", BLOBMSG_TYPE_INT32 }, - [BSS_TR_VALID_PERIOD] = { "validity_period", BLOBMSG_TYPE_INT32 }, - [BSS_TR_NEIGHBORS] = { "neighbors", BLOBMSG_TYPE_ARRAY }, - [BSS_TR_ABRIDGED] = { "abridged", BLOBMSG_TYPE_BOOL }, - [BSS_TR_DIALOG_TOKEN] = { "dialog_token", BLOBMSG_TYPE_INT32 }, -#ifdef CONFIG_MBO - [BSS_TR_MBO_REASON] = { "mbo_reason", BLOBMSG_TYPE_INT32 }, - [BSS_TR_CELL_PREF] = { "cell_pref", BLOBMSG_TYPE_INT32 }, - [BSS_TR_REASSOC_DELAY] = { "reassoc_delay", BLOBMSG_TYPE_INT32 }, -#endif -}; - -static int -hostapd_bss_transition_request(struct ubus_context *ctx, struct ubus_object *obj, - struct ubus_request_data *ureq, const char *method, - struct blob_attr *msg) -{ - struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj); - struct blob_attr *tb[__BSS_TR_DISASSOC_MAX]; - struct sta_info *sta; - u32 da_timer = 0; - u32 valid_period = 0; - u8 addr[ETH_ALEN]; - u32 dialog_token = 1; - bool abridged; - bool da_imminent; - u8 mbo_reason; - u8 cell_pref; - u8 reassoc_delay; - - blobmsg_parse(bss_tr_policy, __BSS_TR_DISASSOC_MAX, tb, blob_data(msg), blob_len(msg)); - - if (!tb[BSS_TR_ADDR]) - return UBUS_STATUS_INVALID_ARGUMENT; - - if (hwaddr_aton(blobmsg_data(tb[BSS_TR_ADDR]), addr)) - return UBUS_STATUS_INVALID_ARGUMENT; - - if (tb[BSS_TR_DA_TIMER]) - da_timer = blobmsg_get_u32(tb[BSS_TR_DA_TIMER]); - - if (tb[BSS_TR_VALID_PERIOD]) - valid_period = blobmsg_get_u32(tb[BSS_TR_VALID_PERIOD]); - - if (tb[BSS_TR_DIALOG_TOKEN]) - dialog_token = blobmsg_get_u32(tb[BSS_TR_DIALOG_TOKEN]); - - da_imminent = !!(tb[BSS_TR_DA_IMMINENT] && blobmsg_get_bool(tb[BSS_TR_DA_IMMINENT])); - abridged = !!(tb[BSS_TR_ABRIDGED] && blobmsg_get_bool(tb[BSS_TR_ABRIDGED])); - -#ifdef CONFIG_MBO - if (tb[BSS_TR_MBO_REASON]) - mbo_reason = blobmsg_get_u32(tb[BSS_TR_MBO_REASON]); - - if (tb[BSS_TR_CELL_PREF]) - cell_pref = blobmsg_get_u32(tb[BSS_TR_CELL_PREF]); - - if (tb[BSS_TR_REASSOC_DELAY]) - reassoc_delay = blobmsg_get_u32(tb[BSS_TR_REASSOC_DELAY]); -#endif - - return hostapd_bss_tr_send(hapd, addr, da_imminent, abridged, da_timer, valid_period, - dialog_token, tb[BSS_TR_NEIGHBORS], mbo_reason, cell_pref, reassoc_delay); -} -#endif - -#ifdef CONFIG_AIRTIME_POLICY -enum { - UPDATE_AIRTIME_STA, - UPDATE_AIRTIME_WEIGHT, - __UPDATE_AIRTIME_MAX, -}; - - -static const struct blobmsg_policy airtime_policy[__UPDATE_AIRTIME_MAX] = { - [UPDATE_AIRTIME_STA] = { "sta", BLOBMSG_TYPE_STRING }, - [UPDATE_AIRTIME_WEIGHT] = { "weight", BLOBMSG_TYPE_INT32 }, -}; - -static int -hostapd_bss_update_airtime(struct ubus_context *ctx, struct ubus_object *obj, - struct ubus_request_data *ureq, const char *method, - struct blob_attr *msg) -{ - struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj); - struct blob_attr *tb[__UPDATE_AIRTIME_MAX]; - struct sta_info *sta = NULL; - u8 addr[ETH_ALEN]; - int weight; - - blobmsg_parse(airtime_policy, __UPDATE_AIRTIME_MAX, tb, blob_data(msg), blob_len(msg)); - - if (!tb[UPDATE_AIRTIME_WEIGHT]) - return UBUS_STATUS_INVALID_ARGUMENT; - - weight = blobmsg_get_u32(tb[UPDATE_AIRTIME_WEIGHT]); - - if (!tb[UPDATE_AIRTIME_STA]) { - if (!weight) - return UBUS_STATUS_INVALID_ARGUMENT; - - hapd->conf->airtime_weight = weight; - return 0; - } - - if (hwaddr_aton(blobmsg_data(tb[UPDATE_AIRTIME_STA]), addr)) - return UBUS_STATUS_INVALID_ARGUMENT; - - sta = ap_get_sta(hapd, addr); - if (!sta) - return UBUS_STATUS_NOT_FOUND; - - sta->dyn_airtime_weight = weight; - airtime_policy_new_sta(hapd, sta); - - return 0; -} -#endif - -#ifdef CONFIG_TAXONOMY -static const struct blobmsg_policy addr_policy[] = { - { "address", BLOBMSG_TYPE_STRING } -}; - -static bool -hostapd_add_b64_data(const char *name, const struct wpabuf *buf) -{ - char *str; - - if (!buf) - return false; - - str = blobmsg_alloc_string_buffer(&b, name, B64_ENCODE_LEN(wpabuf_len(buf))); - b64_encode(wpabuf_head(buf), wpabuf_len(buf), str, B64_ENCODE_LEN(wpabuf_len(buf))); - blobmsg_add_string_buffer(&b); - - return true; -} - -static int -hostapd_bss_get_sta_ies(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 blob_attr *tb; - struct sta_info *sta; - u8 addr[ETH_ALEN]; - - blobmsg_parse(addr_policy, 1, &tb, blobmsg_data(msg), blobmsg_len(msg)); - - if (!tb || hwaddr_aton(blobmsg_data(tb), addr)) - return UBUS_STATUS_INVALID_ARGUMENT; - - sta = ap_get_sta(hapd, addr); - if (!sta || (!sta->probe_ie_taxonomy && !sta->assoc_ie_taxonomy)) - return UBUS_STATUS_NOT_FOUND; - - blob_buf_init(&b, 0); - hostapd_add_b64_data("probe_ie", sta->probe_ie_taxonomy); - hostapd_add_b64_data("assoc_ie", sta->assoc_ie_taxonomy); - ubus_send_reply(ctx, req, b.head); - - return 0; -} -#endif - - -static const struct ubus_method bss_methods[] = { - UBUS_METHOD_NOARG("reload", hostapd_bss_reload), - UBUS_METHOD_NOARG("get_clients", hostapd_bss_get_clients), -#ifdef CONFIG_TAXONOMY - UBUS_METHOD("get_sta_ies", hostapd_bss_get_sta_ies, addr_policy), -#endif - UBUS_METHOD_NOARG("get_status", hostapd_bss_get_status), - UBUS_METHOD("del_client", hostapd_bss_del_client, del_policy), -#ifdef CONFIG_AIRTIME_POLICY - UBUS_METHOD("update_airtime", hostapd_bss_update_airtime, airtime_policy), -#endif - UBUS_METHOD_NOARG("list_bans", hostapd_bss_list_bans), -#ifdef CONFIG_WPS - UBUS_METHOD_NOARG("wps_start", hostapd_bss_wps_start), - UBUS_METHOD_NOARG("wps_status", hostapd_bss_wps_status), - UBUS_METHOD_NOARG("wps_cancel", hostapd_bss_wps_cancel), -#endif - UBUS_METHOD_NOARG("update_beacon", hostapd_bss_update_beacon), - UBUS_METHOD_NOARG("get_features", hostapd_bss_get_features), -#ifdef NEED_AP_MLME - UBUS_METHOD("switch_chan", hostapd_switch_chan, csa_policy), -#endif - UBUS_METHOD("set_vendor_elements", hostapd_vendor_elements, ve_policy), - UBUS_METHOD("notify_response", hostapd_notify_response, notify_policy), - UBUS_METHOD("bss_mgmt_enable", hostapd_bss_mgmt_enable, bss_mgmt_enable_policy), - UBUS_METHOD_NOARG("rrm_nr_get_own", hostapd_rrm_nr_get_own), - UBUS_METHOD_NOARG("rrm_nr_list", hostapd_rrm_nr_list), - UBUS_METHOD("rrm_nr_set", hostapd_rrm_nr_set, nr_set_policy), - UBUS_METHOD("rrm_beacon_req", hostapd_rrm_beacon_req, beacon_req_policy), - UBUS_METHOD("link_measurement_req", hostapd_rrm_lm_req, lm_req_policy), -#ifdef CONFIG_WNM_AP - UBUS_METHOD("bss_transition_request", hostapd_bss_transition_request, bss_tr_policy), -#endif -}; - -static struct ubus_object_type bss_object_type = - UBUS_OBJECT_TYPE("hostapd_bss", bss_methods); - -static int avl_compare_macaddr(const void *k1, const void *k2, void *ptr) -{ - return memcmp(k1, k2, ETH_ALEN); -} - -void hostapd_ubus_add_bss(struct hostapd_data *hapd) -{ - struct ubus_object *obj = &hapd->ubus.obj; - char *name; - int ret; - -#ifdef CONFIG_MESH - if (hapd->conf->mesh & MESH_ENABLED) - return; -#endif - - if (!hostapd_ubus_init()) - return; - - if (asprintf(&name, "hostapd.%s", hapd->conf->iface) < 0) - return; - - avl_init(&hapd->ubus.banned, avl_compare_macaddr, false, NULL); - obj->name = name; - obj->type = &bss_object_type; - obj->methods = bss_object_type.methods; - obj->n_methods = bss_object_type.n_methods; - ret = ubus_add_object(ctx, obj); - hostapd_ubus_ref_inc(); -} - -void hostapd_ubus_free_bss(struct hostapd_data *hapd) -{ - struct ubus_object *obj = &hapd->ubus.obj; - char *name = (char *) obj->name; - -#ifdef CONFIG_MESH - if (hapd->conf->mesh & MESH_ENABLED) - return; -#endif - - if (!ctx) - return; - - if (obj->id) { - ubus_remove_object(ctx, obj); - hostapd_ubus_ref_dec(); - } - - 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"); -} - -struct ubus_event_req { - struct ubus_notify_request nreq; - int resp; -}; - -static void -ubus_event_cb(struct ubus_notify_request *req, int idx, int ret) -{ - struct ubus_event_req *ureq = container_of(req, struct ubus_event_req, nreq); - - ureq->resp = ret; -} - -int hostapd_ubus_handle_event(struct hostapd_data *hapd, struct hostapd_ubus_request *req) -{ - struct ubus_banned_client *ban; - const char *types[HOSTAPD_UBUS_TYPE_MAX] = { - [HOSTAPD_UBUS_PROBE_REQ] = "probe", - [HOSTAPD_UBUS_AUTH_REQ] = "auth", - [HOSTAPD_UBUS_ASSOC_REQ] = "assoc", - }; - const char *type = "mgmt"; - struct ubus_event_req ureq = {}; - const u8 *addr; - - if (req->mgmt_frame) - addr = req->mgmt_frame->sa; - else - addr = req->addr; - - ban = avl_find_element(&hapd->ubus.banned, addr, ban, avl); - if (ban) - return WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA; - - if (!hapd->ubus.obj.has_subscribers) - return WLAN_STATUS_SUCCESS; - - if (req->type < ARRAY_SIZE(types)) - type = types[req->type]; - - blob_buf_init(&b, 0); - blobmsg_add_macaddr(&b, "address", addr); - if (req->mgmt_frame) - blobmsg_add_macaddr(&b, "target", req->mgmt_frame->da); - if (req->ssi_signal) - blobmsg_add_u32(&b, "signal", req->ssi_signal); - blobmsg_add_u32(&b, "freq", hapd->iface->freq); - - if (req->elems) { - if(req->elems->ht_capabilities) - { - struct ieee80211_ht_capabilities *ht_capabilities; - void *ht_cap, *ht_cap_mcs_set, *mcs_set; - - - ht_capabilities = (struct ieee80211_ht_capabilities*) req->elems->ht_capabilities; - ht_cap = blobmsg_open_table(&b, "ht_capabilities"); - blobmsg_add_u16(&b, "ht_capabilities_info", ht_capabilities->ht_capabilities_info); - ht_cap_mcs_set = blobmsg_open_table(&b, "supported_mcs_set"); - blobmsg_add_u16(&b, "a_mpdu_params", ht_capabilities->a_mpdu_params); - blobmsg_add_u16(&b, "ht_extended_capabilities", ht_capabilities->ht_extended_capabilities); - blobmsg_add_u32(&b, "tx_bf_capability_info", ht_capabilities->tx_bf_capability_info); - blobmsg_add_u16(&b, "asel_capabilities", ht_capabilities->asel_capabilities); - mcs_set = blobmsg_open_array(&b, "supported_mcs_set"); - for (int i = 0; i < 16; i++) { - blobmsg_add_u16(&b, NULL, (u16) ht_capabilities->supported_mcs_set[i]); - } - blobmsg_close_array(&b, mcs_set); - blobmsg_close_table(&b, ht_cap_mcs_set); - blobmsg_close_table(&b, ht_cap); - } - if(req->elems->vht_capabilities) - { - struct ieee80211_vht_capabilities *vht_capabilities; - void *vht_cap, *vht_cap_mcs_set; - - vht_capabilities = (struct ieee80211_vht_capabilities*) req->elems->vht_capabilities; - vht_cap = blobmsg_open_table(&b, "vht_capabilities"); - blobmsg_add_u32(&b, "vht_capabilities_info", vht_capabilities->vht_capabilities_info); - vht_cap_mcs_set = blobmsg_open_table(&b, "vht_supported_mcs_set"); - blobmsg_add_u16(&b, "rx_map", vht_capabilities->vht_supported_mcs_set.rx_map); - blobmsg_add_u16(&b, "rx_highest", vht_capabilities->vht_supported_mcs_set.rx_highest); - blobmsg_add_u16(&b, "tx_map", vht_capabilities->vht_supported_mcs_set.tx_map); - blobmsg_add_u16(&b, "tx_highest", vht_capabilities->vht_supported_mcs_set.tx_highest); - blobmsg_close_table(&b, vht_cap_mcs_set); - blobmsg_close_table(&b, vht_cap); - } - } - - if (!hapd->ubus.notify_response) { - ubus_notify(ctx, &hapd->ubus.obj, type, b.head, -1); - return WLAN_STATUS_SUCCESS; - } - - if (ubus_notify_async(ctx, &hapd->ubus.obj, type, b.head, &ureq.nreq)) - return WLAN_STATUS_SUCCESS; - - ureq.nreq.status_cb = ubus_event_cb; - ubus_complete_request(ctx, &ureq.nreq.req, 100); - - if (ureq.resp) - return ureq.resp; - - return WLAN_STATUS_SUCCESS; -} - -void hostapd_ubus_notify(struct hostapd_data *hapd, const char *type, const u8 *addr) -{ - if (!hapd->ubus.obj.has_subscribers) - return; - - if (!addr) - return; - - blob_buf_init(&b, 0); - blobmsg_add_macaddr(&b, "address", addr); - - ubus_notify(ctx, &hapd->ubus.obj, type, b.head, -1); -} - -void hostapd_ubus_notify_authorized(struct hostapd_data *hapd, struct sta_info *sta, - const char *auth_alg) -{ - if (!hapd->ubus.obj.has_subscribers) - return; - - blob_buf_init(&b, 0); - blobmsg_add_macaddr(&b, "address", sta->addr); - if (auth_alg) - blobmsg_add_string(&b, "auth-alg", auth_alg); - - ubus_notify(ctx, &hapd->ubus.obj, "sta-authorized", b.head, -1); -} - -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) -{ - if (!hapd->ubus.obj.has_subscribers) - return; - - if (!addr || !rep) - return; - - blob_buf_init(&b, 0); - blobmsg_add_macaddr(&b, "address", addr); - blobmsg_add_u16(&b, "op-class", rep->op_class); - blobmsg_add_u16(&b, "channel", rep->channel); - blobmsg_add_u64(&b, "start-time", rep->start_time); - blobmsg_add_u16(&b, "duration", rep->duration); - blobmsg_add_u16(&b, "report-info", rep->report_info); - blobmsg_add_u16(&b, "rcpi", rep->rcpi); - blobmsg_add_u16(&b, "rsni", rep->rsni); - blobmsg_add_macaddr(&b, "bssid", rep->bssid); - blobmsg_add_u16(&b, "antenna-id", rep->antenna_id); - blobmsg_add_u16(&b, "parent-tsf", rep->parent_tsf); - blobmsg_add_u16(&b, "rep-mode", rep_mode); - - 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 (!ctx) - 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); - } -} - -#ifdef CONFIG_WNM_AP -static void hostapd_ubus_notify_bss_transition_add_candidate_list( - const u8 *candidate_list, u16 candidate_list_len) -{ - char *cl_str; - int i; - - if (candidate_list_len == 0) - return; - - cl_str = blobmsg_alloc_string_buffer(&b, "candidate-list", candidate_list_len * 2 + 1); - for (i = 0; i < candidate_list_len; i++) - snprintf(&cl_str[i*2], 3, "%02X", candidate_list[i]); - blobmsg_add_string_buffer(&b); - -} -#endif - -void hostapd_ubus_notify_bss_transition_response( - struct hostapd_data *hapd, const u8 *addr, u8 dialog_token, u8 status_code, - u8 bss_termination_delay, const u8 *target_bssid, - const u8 *candidate_list, u16 candidate_list_len) -{ -#ifdef CONFIG_WNM_AP - u16 i; - - if (!hapd->ubus.obj.has_subscribers) - return; - - if (!addr) - return; - - blob_buf_init(&b, 0); - blobmsg_add_macaddr(&b, "address", addr); - blobmsg_add_u8(&b, "dialog-token", dialog_token); - blobmsg_add_u8(&b, "status-code", status_code); - blobmsg_add_u8(&b, "bss-termination-delay", bss_termination_delay); - if (target_bssid) - blobmsg_add_macaddr(&b, "target-bssid", target_bssid); - - hostapd_ubus_notify_bss_transition_add_candidate_list(candidate_list, candidate_list_len); - - ubus_notify(ctx, &hapd->ubus.obj, "bss-transition-response", b.head, -1); -#endif -} - -int hostapd_ubus_notify_bss_transition_query( - struct hostapd_data *hapd, const u8 *addr, u8 dialog_token, u8 reason, - const u8 *candidate_list, u16 candidate_list_len) -{ -#ifdef CONFIG_WNM_AP - struct ubus_event_req ureq = {}; - char *cl_str; - u16 i; - - if (!hapd->ubus.obj.has_subscribers) - return 0; - - if (!addr) - return 0; - - blob_buf_init(&b, 0); - blobmsg_add_macaddr(&b, "address", addr); - blobmsg_add_u8(&b, "dialog-token", dialog_token); - blobmsg_add_u8(&b, "reason", reason); - hostapd_ubus_notify_bss_transition_add_candidate_list(candidate_list, candidate_list_len); - - if (!hapd->ubus.notify_response) { - ubus_notify(ctx, &hapd->ubus.obj, "bss-transition-query", b.head, -1); - return 0; - } - - if (ubus_notify_async(ctx, &hapd->ubus.obj, "bss-transition-query", b.head, &ureq.nreq)) - return 0; - - ureq.nreq.status_cb = ubus_event_cb; - ubus_complete_request(ctx, &ureq.nreq.req, 100); - - return ureq.resp; -#endif -} diff --git a/package/network/services/hostapd/src/src/utils/ap/ubus.h b/package/network/services/hostapd/src/src/utils/ap/ubus.h deleted file mode 100644 index 22767d67ee7564..00000000000000 --- a/package/network/services/hostapd/src/src/utils/ap/ubus.h +++ /dev/null @@ -1,157 +0,0 @@ -/* - * hostapd / ubus support - * Copyright (c) 2013, Felix Fietkau - * - * This software may be distributed under the terms of the BSD license. - * See README for more details. - */ -#ifndef __HOSTAPD_UBUS_H -#define __HOSTAPD_UBUS_H - -#include "sta_info.h" - -enum hostapd_ubus_event_type { - HOSTAPD_UBUS_PROBE_REQ, - HOSTAPD_UBUS_AUTH_REQ, - HOSTAPD_UBUS_ASSOC_REQ, - HOSTAPD_UBUS_TYPE_MAX -}; - -struct hostapd_ubus_request { - enum hostapd_ubus_event_type type; - const struct ieee80211_mgmt *mgmt_frame; - const struct ieee802_11_elems *elems; - int ssi_signal; /* dBm */ - const u8 *addr; -}; - -struct hostapd_iface; -struct hostapd_data; -struct hapd_interfaces; -struct rrm_measurement_beacon_report; -struct sta_info; - -#ifdef UBUS_SUPPORT - -#include -#include - -struct hostapd_ubus_bss { - struct ubus_object obj; - struct avl_tree banned; - int notify_response; -}; - -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_handle_link_measurement(struct hostapd_data *hapd, const u8 *data, size_t len); -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, - 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_notify_bss_transition_response( - struct hostapd_data *hapd, const u8 *addr, u8 dialog_token, u8 status_code, - u8 bss_termination_delay, const u8 *target_bssid, - const u8 *candidate_list, u16 candidate_list_len); -void hostapd_ubus_add(struct hapd_interfaces *interfaces); -void hostapd_ubus_free(struct hapd_interfaces *interfaces); -int hostapd_ubus_notify_bss_transition_query( - struct hostapd_data *hapd, const u8 *addr, u8 dialog_token, u8 reason, - const u8 *candidate_list, u16 candidate_list_len); -void hostapd_ubus_notify_authorized(struct hostapd_data *hapd, struct sta_info *sta, - const char *auth_alg); - -#else - -struct hostapd_ubus_bss {}; - -static inline void hostapd_ubus_add_iface(struct hostapd_iface *iface) -{ -} - -static inline void hostapd_ubus_free_iface(struct hostapd_iface *iface) -{ -} - -static inline void hostapd_ubus_add_bss(struct hostapd_data *hapd) -{ -} - -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; -} - -static inline void hostapd_ubus_handle_link_measurement(struct hostapd_data *hapd, const u8 *data, size_t len) -{ -} - -static inline void hostapd_ubus_notify(struct hostapd_data *hapd, const char *type, const u8 *mac) -{ -} - -static inline 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) -{ -} -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_notify_bss_transition_response( - struct hostapd_data *hapd, const u8 *addr, u8 dialog_token, u8 status_code, - u8 bss_termination_delay, const u8 *target_bssid, - const u8 *candidate_list, u16 candidate_list_len) -{ -} - -static inline void hostapd_ubus_add(struct hapd_interfaces *interfaces) -{ -} - -static inline void hostapd_ubus_free(struct hapd_interfaces *interfaces) -{ -} - -static inline int hostapd_ubus_notify_bss_transition_query( - struct hostapd_data *hapd, const u8 *addr, u8 dialog_token, u8 reason, - const u8 *candidate_list, u16 candidate_list_len) -{ - return 0; -} - -static inline void -hostapd_ubus_notify_authorized(struct hostapd_data *hapd, struct sta_info *sta, - const char *auth_alg) -{ -} - -#endif - -#endif diff --git a/package/network/services/hostapd/src/src/utils/ap/ucode.c b/package/network/services/hostapd/src/src/utils/ap/ucode.c deleted file mode 100644 index 68fb450884e2f3..00000000000000 --- a/package/network/services/hostapd/src/src/utils/ap/ucode.c +++ /dev/null @@ -1,817 +0,0 @@ -#include - -#include "utils/includes.h" -#include "utils/common.h" -#include "utils/ucode.h" -#include "hostapd.h" -#include "beacon.h" -#include "hw_features.h" -#include "ap_drv_ops.h" -#include "dfs.h" -#include "acs.h" -#include - -static uc_resource_type_t *global_type, *bss_type, *iface_type; -static struct hapd_interfaces *interfaces; -static uc_value_t *global, *bss_registry, *iface_registry; -static uc_vm_t *vm; - -static uc_value_t * -hostapd_ucode_bss_get_uval(struct hostapd_data *hapd) -{ - uc_value_t *val; - - if (hapd->ucode.idx) - return wpa_ucode_registry_get(bss_registry, hapd->ucode.idx); - - val = uc_resource_new(bss_type, hapd); - hapd->ucode.idx = wpa_ucode_registry_add(bss_registry, val); - - return val; -} - -static uc_value_t * -hostapd_ucode_iface_get_uval(struct hostapd_iface *hapd) -{ - uc_value_t *val; - - if (hapd->ucode.idx) - return wpa_ucode_registry_get(iface_registry, hapd->ucode.idx); - - val = uc_resource_new(iface_type, hapd); - hapd->ucode.idx = wpa_ucode_registry_add(iface_registry, val); - - return val; -} - -static void -hostapd_ucode_update_bss_list(struct hostapd_iface *iface, uc_value_t *if_bss, uc_value_t *bss) -{ - uc_value_t *list; - int i; - - list = ucv_array_new(vm); - for (i = 0; iface->bss && i < iface->num_bss; i++) { - struct hostapd_data *hapd = iface->bss[i]; - uc_value_t *val = hostapd_ucode_bss_get_uval(hapd); - - ucv_array_set(list, i, ucv_get(ucv_string_new(hapd->conf->iface))); - ucv_object_add(bss, hapd->conf->iface, ucv_get(val)); - } - ucv_object_add(if_bss, iface->phy, ucv_get(list)); -} - -static void -hostapd_ucode_update_interfaces(void) -{ - uc_value_t *ifs = ucv_object_new(vm); - uc_value_t *if_bss = ucv_array_new(vm); - uc_value_t *bss = ucv_object_new(vm); - int i; - - for (i = 0; i < interfaces->count; i++) { - struct hostapd_iface *iface = interfaces->iface[i]; - - ucv_object_add(ifs, iface->phy, ucv_get(hostapd_ucode_iface_get_uval(iface))); - hostapd_ucode_update_bss_list(iface, if_bss, bss); - } - - ucv_object_add(ucv_prototype_get(global), "interfaces", ucv_get(ifs)); - ucv_object_add(ucv_prototype_get(global), "interface_bss", ucv_get(if_bss)); - ucv_object_add(ucv_prototype_get(global), "bss", ucv_get(bss)); - ucv_gc(vm); -} - -static uc_value_t * -uc_hostapd_add_iface(uc_vm_t *vm, size_t nargs) -{ - uc_value_t *iface = uc_fn_arg(0); - char *data; - int ret; - - if (ucv_type(iface) != UC_STRING) - return ucv_int64_new(-1); - - data = strdup(ucv_string_get(iface)); - ret = hostapd_add_iface(interfaces, data); - free(data); - - hostapd_ucode_update_interfaces(); - - return ucv_int64_new(ret); -} - -static uc_value_t * -uc_hostapd_remove_iface(uc_vm_t *vm, size_t nargs) -{ - uc_value_t *iface = uc_fn_arg(0); - - if (ucv_type(iface) != UC_STRING) - return NULL; - - hostapd_remove_iface(interfaces, ucv_string_get(iface)); - hostapd_ucode_update_interfaces(); - - return NULL; -} - -static struct hostapd_vlan * -bss_conf_find_vlan(struct hostapd_bss_config *bss, int id) -{ - struct hostapd_vlan *vlan; - - for (vlan = bss->vlan; vlan; vlan = vlan->next) - if (vlan->vlan_id == id) - return vlan; - - return NULL; -} - -static int -bss_conf_rename_vlan(struct hostapd_data *hapd, struct hostapd_vlan *vlan, - const char *ifname) -{ - if (!strcmp(ifname, vlan->ifname)) - return 0; - - hostapd_drv_if_rename(hapd, WPA_IF_AP_VLAN, vlan->ifname, ifname); - os_strlcpy(vlan->ifname, ifname, sizeof(vlan->ifname)); - - return 0; -} - -static int -bss_reload_vlans(struct hostapd_data *hapd, struct hostapd_bss_config *bss) -{ - struct hostapd_bss_config *old_bss = hapd->conf; - struct hostapd_vlan *vlan, *vlan_new, *wildcard; - char ifname[IFNAMSIZ + 1], vlan_ifname[IFNAMSIZ + 1], *pos; - int ret; - - vlan = bss_conf_find_vlan(old_bss, VLAN_ID_WILDCARD); - wildcard = bss_conf_find_vlan(bss, VLAN_ID_WILDCARD); - if (!!vlan != !!wildcard) - return -1; - - if (vlan && wildcard && strcmp(vlan->ifname, wildcard->ifname) != 0) - strcpy(vlan->ifname, wildcard->ifname); - else - wildcard = NULL; - - for (vlan = bss->vlan; vlan; vlan = vlan->next) { - if (vlan->vlan_id == VLAN_ID_WILDCARD || - vlan->dynamic_vlan > 0) - continue; - - if (!bss_conf_find_vlan(old_bss, vlan->vlan_id)) - return -1; - } - - for (vlan = old_bss->vlan; vlan; vlan = vlan->next) { - if (vlan->vlan_id == VLAN_ID_WILDCARD) - continue; - - if (vlan->dynamic_vlan == 0) { - vlan_new = bss_conf_find_vlan(bss, vlan->vlan_id); - if (!vlan_new) - return -1; - - if (bss_conf_rename_vlan(hapd, vlan, vlan_new->ifname)) - return -1; - - continue; - } - - if (!wildcard) - continue; - - os_strlcpy(ifname, wildcard->ifname, sizeof(ifname)); - pos = os_strchr(ifname, '#'); - if (!pos) - return -1; - - *pos++ = '\0'; - ret = os_snprintf(vlan_ifname, sizeof(vlan_ifname), "%s%d%s", - ifname, vlan->vlan_id, pos); - if (os_snprintf_error(sizeof(vlan_ifname), ret)) - return -1; - - if (bss_conf_rename_vlan(hapd, vlan, vlan_ifname)) - return -1; - } - - return 0; -} - -static uc_value_t * -uc_hostapd_bss_set_config(uc_vm_t *vm, size_t nargs) -{ - struct hostapd_data *hapd = uc_fn_thisval("hostapd.bss"); - struct hostapd_bss_config *old_bss; - struct hostapd_iface *iface; - struct hostapd_config *conf; - uc_value_t *file = uc_fn_arg(0); - uc_value_t *index = uc_fn_arg(1); - uc_value_t *files_only = uc_fn_arg(2); - unsigned int i, idx = 0; - int ret = -1; - - if (!hapd || ucv_type(file) != UC_STRING) - goto out; - - if (ucv_type(index) == UC_INTEGER) - idx = ucv_int64_get(index); - - iface = hapd->iface; - conf = interfaces->config_read_cb(ucv_string_get(file)); - if (!conf) - goto out; - - if (idx > conf->num_bss || !conf->bss[idx]) - goto free; - - if (ucv_boolean_get(files_only)) { - struct hostapd_bss_config *bss = conf->bss[idx]; - struct hostapd_bss_config *old_bss = hapd->conf; - -#define swap_field(name) \ - do { \ - void *ptr = old_bss->name; \ - old_bss->name = bss->name; \ - bss->name = ptr; \ - } while (0) - - swap_field(ssid.wpa_psk_file); - ret = bss_reload_vlans(hapd, bss); - goto done; - } - - hostapd_bss_deinit_no_free(hapd); - hostapd_drv_stop_ap(hapd); - hostapd_free_hapd_data(hapd); - - old_bss = hapd->conf; - for (i = 0; i < iface->conf->num_bss; i++) - if (iface->conf->bss[i] == hapd->conf) - iface->conf->bss[i] = conf->bss[idx]; - hapd->conf = conf->bss[idx]; - conf->bss[idx] = old_bss; - - hostapd_setup_bss(hapd, hapd == iface->bss[0], true); - hostapd_ucode_update_interfaces(); - -done: - ret = 0; -free: - hostapd_config_free(conf); -out: - return ucv_int64_new(ret); -} - -static void -hostapd_remove_iface_bss_conf(struct hostapd_config *iconf, - struct hostapd_bss_config *conf) -{ - int i; - - for (i = 0; i < iconf->num_bss; i++) - if (iconf->bss[i] == conf) - break; - - if (i == iconf->num_bss) - return; - - for (i++; i < iconf->num_bss; i++) - iconf->bss[i - 1] = iconf->bss[i]; - iconf->num_bss--; -} - - -static uc_value_t * -uc_hostapd_bss_delete(uc_vm_t *vm, size_t nargs) -{ - struct hostapd_data *hapd = uc_fn_thisval("hostapd.bss"); - struct hostapd_iface *iface; - int i, idx; - - if (!hapd) - return NULL; - - iface = hapd->iface; - if (iface->num_bss == 1) { - wpa_printf(MSG_ERROR, "trying to delete last bss of an iface: %s\n", hapd->conf->iface); - return NULL; - } - - for (idx = 0; idx < iface->num_bss; idx++) - if (iface->bss[idx] == hapd) - break; - - if (idx == iface->num_bss) - return NULL; - - for (i = idx + 1; i < iface->num_bss; i++) - iface->bss[i - 1] = iface->bss[i]; - - iface->num_bss--; - - iface->bss[0]->interface_added = 0; - hostapd_drv_set_first_bss(iface->bss[0]); - hapd->interface_added = 1; - - hostapd_drv_stop_ap(hapd); - hostapd_bss_deinit(hapd); - hostapd_remove_iface_bss_conf(iface->conf, hapd->conf); - hostapd_config_free_bss(hapd->conf); - os_free(hapd); - - hostapd_ucode_update_interfaces(); - ucv_gc(vm); - - return NULL; -} - -static uc_value_t * -uc_hostapd_iface_add_bss(uc_vm_t *vm, size_t nargs) -{ - struct hostapd_iface *iface = uc_fn_thisval("hostapd.iface"); - struct hostapd_bss_config *bss; - struct hostapd_config *conf; - struct hostapd_data *hapd; - uc_value_t *file = uc_fn_arg(0); - uc_value_t *index = uc_fn_arg(1); - unsigned int idx = 0; - uc_value_t *ret = NULL; - - if (!iface || ucv_type(file) != UC_STRING) - goto out; - - if (ucv_type(index) == UC_INTEGER) - idx = ucv_int64_get(index); - - conf = interfaces->config_read_cb(ucv_string_get(file)); - if (!conf || idx > conf->num_bss || !conf->bss[idx]) - goto out; - - bss = conf->bss[idx]; - hapd = hostapd_alloc_bss_data(iface, iface->conf, bss); - if (!hapd) - goto out; - - hapd->driver = iface->bss[0]->driver; - hapd->drv_priv = iface->bss[0]->drv_priv; - if (interfaces->ctrl_iface_init && - interfaces->ctrl_iface_init(hapd) < 0) - goto free_hapd; - - if (iface->state == HAPD_IFACE_ENABLED && - hostapd_setup_bss(hapd, -1, true)) - goto deinit_ctrl; - - iface->bss = os_realloc_array(iface->bss, iface->num_bss + 1, - sizeof(*iface->bss)); - iface->bss[iface->num_bss++] = hapd; - - iface->conf->bss = os_realloc_array(iface->conf->bss, - iface->conf->num_bss + 1, - sizeof(*iface->conf->bss)); - iface->conf->bss[iface->conf->num_bss] = bss; - conf->bss[idx] = NULL; - ret = hostapd_ucode_bss_get_uval(hapd); - hostapd_ucode_update_interfaces(); - goto out; - -deinit_ctrl: - if (interfaces->ctrl_iface_deinit) - interfaces->ctrl_iface_deinit(hapd); -free_hapd: - hostapd_free_hapd_data(hapd); - os_free(hapd); -out: - hostapd_config_free(conf); - return ret; -} - -static uc_value_t * -uc_hostapd_iface_set_bss_order(uc_vm_t *vm, size_t nargs) -{ - struct hostapd_iface *iface = uc_fn_thisval("hostapd.iface"); - uc_value_t *bss_list = uc_fn_arg(0); - struct hostapd_data **new_bss; - struct hostapd_bss_config **new_conf; - - if (!iface) - return NULL; - - if (ucv_type(bss_list) != UC_ARRAY || - ucv_array_length(bss_list) != iface->num_bss) - return NULL; - - new_bss = calloc(iface->num_bss, sizeof(*new_bss)); - new_conf = calloc(iface->num_bss, sizeof(*new_conf)); - for (size_t i = 0; i < iface->num_bss; i++) { - struct hostapd_data *bss; - - bss = ucv_resource_data(ucv_array_get(bss_list, i), "hostapd.bss"); - if (bss->iface != iface) - goto free; - - for (size_t k = 0; k < i; k++) - if (new_bss[k] == bss) - goto free; - - new_bss[i] = bss; - new_conf[i] = bss->conf; - } - - new_bss[0]->interface_added = 0; - for (size_t i = 1; i < iface->num_bss; i++) - new_bss[i]->interface_added = 1; - - free(iface->bss); - iface->bss = new_bss; - - free(iface->conf->bss); - iface->conf->bss = new_conf; - iface->conf->num_bss = iface->num_bss; - hostapd_drv_set_first_bss(iface->bss[0]); - - return ucv_boolean_new(true); - -free: - free(new_bss); - free(new_conf); - return NULL; -} - -static uc_value_t * -uc_hostapd_bss_ctrl(uc_vm_t *vm, size_t nargs) -{ - struct hostapd_data *hapd = uc_fn_thisval("hostapd.bss"); - uc_value_t *arg = uc_fn_arg(0); - struct sockaddr_storage from = {}; - static char reply[4096]; - int reply_len; - - if (!hapd || !interfaces->ctrl_iface_recv || - ucv_type(arg) != UC_STRING) - return NULL; - - reply_len = interfaces->ctrl_iface_recv(hapd, ucv_string_get(arg), - reply, sizeof(reply), - &from, sizeof(from)); - if (reply_len < 0) - return NULL; - - if (reply_len && reply[reply_len - 1] == '\n') - reply_len--; - - return ucv_string_new_length(reply, reply_len); -} - -static void -uc_hostapd_disable_iface(struct hostapd_iface *iface) -{ - switch (iface->state) { - case HAPD_IFACE_DISABLED: - break; -#ifdef CONFIG_ACS - case HAPD_IFACE_ACS: - acs_cleanup(iface); - iface->scan_cb = NULL; - /* fallthrough */ -#endif - default: - hostapd_disable_iface(iface); - break; - } -} - -static uc_value_t * -uc_hostapd_iface_stop(uc_vm_t *vm, size_t nargs) -{ - struct hostapd_iface *iface = uc_fn_thisval("hostapd.iface"); - int i; - - if (!iface) - return NULL; - - if (iface->state != HAPD_IFACE_ENABLED) - uc_hostapd_disable_iface(iface); - - for (i = 0; i < iface->num_bss; i++) { - struct hostapd_data *hapd = iface->bss[i]; - - hostapd_drv_stop_ap(hapd); - hapd->beacon_set_done = 0; - } - - return NULL; -} - -static uc_value_t * -uc_hostapd_iface_start(uc_vm_t *vm, size_t nargs) -{ - struct hostapd_iface *iface = uc_fn_thisval("hostapd.iface"); - uc_value_t *info = uc_fn_arg(0); - struct hostapd_config *conf; - bool changed = false; - uint64_t intval; - int i; - - if (!iface) - return NULL; - - if (!info) { - iface->freq = 0; - goto out; - } - - if (ucv_type(info) != UC_OBJECT) - return NULL; - -#define UPDATE_VAL(field, name) \ - if ((intval = ucv_int64_get(ucv_object_get(info, name, NULL))) && \ - !errno && intval != conf->field) do { \ - conf->field = intval; \ - changed = true; \ - } while(0) - - conf = iface->conf; - UPDATE_VAL(op_class, "op_class"); - UPDATE_VAL(hw_mode, "hw_mode"); - UPDATE_VAL(channel, "channel"); - UPDATE_VAL(secondary_channel, "sec_channel"); - if (!changed && - (iface->bss[0]->beacon_set_done || - iface->state == HAPD_IFACE_DFS)) - return ucv_boolean_new(true); - - intval = ucv_int64_get(ucv_object_get(info, "center_seg0_idx", NULL)); - if (!errno) - hostapd_set_oper_centr_freq_seg0_idx(conf, intval); - - intval = ucv_int64_get(ucv_object_get(info, "center_seg1_idx", NULL)); - if (!errno) - hostapd_set_oper_centr_freq_seg1_idx(conf, intval); - - intval = ucv_int64_get(ucv_object_get(info, "oper_chwidth", NULL)); - if (!errno) - hostapd_set_oper_chwidth(conf, intval); - - intval = ucv_int64_get(ucv_object_get(info, "frequency", NULL)); - if (!errno) - iface->freq = intval; - else - iface->freq = 0; - conf->acs = 0; - -out: - switch (iface->state) { - case HAPD_IFACE_ENABLED: - if (!hostapd_is_dfs_required(iface) || - hostapd_is_dfs_chan_available(iface)) - break; - wpa_printf(MSG_INFO, "DFS CAC required on new channel, restart interface"); - /* fallthrough */ - default: - uc_hostapd_disable_iface(iface); - break; - } - - if (conf->channel && !iface->freq) - iface->freq = hostapd_hw_get_freq(iface->bss[0], conf->channel); - - if (iface->state != HAPD_IFACE_ENABLED) { - hostapd_enable_iface(iface); - return ucv_boolean_new(true); - } - - for (i = 0; i < iface->num_bss; i++) { - struct hostapd_data *hapd = iface->bss[i]; - int ret; - - hapd->conf->start_disabled = 0; - hostapd_set_freq(hapd, conf->hw_mode, iface->freq, - conf->channel, - conf->enable_edmg, - conf->edmg_channel, - conf->ieee80211n, - conf->ieee80211ac, - conf->ieee80211ax, - conf->ieee80211be, - conf->secondary_channel, - hostapd_get_oper_chwidth(conf), - hostapd_get_oper_centr_freq_seg0_idx(conf), - hostapd_get_oper_centr_freq_seg1_idx(conf)); - - ieee802_11_set_beacon(hapd); - } - - return ucv_boolean_new(true); -} - -static uc_value_t * -uc_hostapd_iface_switch_channel(uc_vm_t *vm, size_t nargs) -{ - struct hostapd_iface *iface = uc_fn_thisval("hostapd.iface"); - uc_value_t *info = uc_fn_arg(0); - struct hostapd_config *conf; - struct csa_settings csa = {}; - uint64_t intval; - int i, ret = 0; - - if (!iface || ucv_type(info) != UC_OBJECT) - return NULL; - - conf = iface->conf; - if ((intval = ucv_int64_get(ucv_object_get(info, "csa_count", NULL))) && !errno) - csa.cs_count = intval; - if ((intval = ucv_int64_get(ucv_object_get(info, "sec_channel", NULL))) && !errno) - csa.freq_params.sec_channel_offset = intval; - - csa.freq_params.ht_enabled = conf->ieee80211n; - csa.freq_params.vht_enabled = conf->ieee80211ac; - csa.freq_params.he_enabled = conf->ieee80211ax; -#ifdef CONFIG_IEEE80211BE - csa.freq_params.eht_enabled = conf->ieee80211be; -#endif - intval = ucv_int64_get(ucv_object_get(info, "oper_chwidth", NULL)); - if (errno) - intval = hostapd_get_oper_chwidth(conf); - if (intval) - csa.freq_params.bandwidth = 40 << intval; - else - csa.freq_params.bandwidth = csa.freq_params.sec_channel_offset ? 40 : 20; - - if ((intval = ucv_int64_get(ucv_object_get(info, "frequency", NULL))) && !errno) - csa.freq_params.freq = intval; - if ((intval = ucv_int64_get(ucv_object_get(info, "center_freq1", NULL))) && !errno) - csa.freq_params.center_freq1 = intval; - if ((intval = ucv_int64_get(ucv_object_get(info, "center_freq2", NULL))) && !errno) - csa.freq_params.center_freq2 = intval; - - for (i = 0; i < iface->num_bss; i++) - ret = hostapd_switch_channel(iface->bss[i], &csa); - - return ucv_boolean_new(!ret); -} - -static uc_value_t * -uc_hostapd_bss_rename(uc_vm_t *vm, size_t nargs) -{ - struct hostapd_data *hapd = uc_fn_thisval("hostapd.bss"); - uc_value_t *ifname_arg = uc_fn_arg(0); - char prev_ifname[IFNAMSIZ + 1]; - struct sta_info *sta; - const char *ifname; - int ret; - - if (!hapd || ucv_type(ifname_arg) != UC_STRING) - return NULL; - - os_strlcpy(prev_ifname, hapd->conf->iface, sizeof(prev_ifname)); - ifname = ucv_string_get(ifname_arg); - - hostapd_ubus_free_bss(hapd); - if (interfaces->ctrl_iface_deinit) - interfaces->ctrl_iface_deinit(hapd); - - ret = hostapd_drv_if_rename(hapd, WPA_IF_AP_BSS, NULL, ifname); - if (ret) - goto out; - - for (sta = hapd->sta_list; sta; sta = sta->next) { - char cur_name[IFNAMSIZ + 1], new_name[IFNAMSIZ + 1]; - - if (!(sta->flags & WLAN_STA_WDS) || sta->pending_wds_enable) - continue; - - snprintf(cur_name, sizeof(cur_name), "%s.sta%d", prev_ifname, sta->aid); - snprintf(new_name, sizeof(new_name), "%s.sta%d", ifname, sta->aid); - hostapd_drv_if_rename(hapd, WPA_IF_AP_VLAN, cur_name, new_name); - } - - if (!strncmp(hapd->conf->ssid.vlan, hapd->conf->iface, sizeof(hapd->conf->ssid.vlan))) - os_strlcpy(hapd->conf->ssid.vlan, ifname, sizeof(hapd->conf->ssid.vlan)); - os_strlcpy(hapd->conf->iface, ifname, sizeof(hapd->conf->iface)); - hostapd_ubus_add_bss(hapd); - - hostapd_ucode_update_interfaces(); -out: - if (interfaces->ctrl_iface_init) - interfaces->ctrl_iface_init(hapd); - - return ret ? NULL : ucv_boolean_new(true); -} - - -int hostapd_ucode_init(struct hapd_interfaces *ifaces) -{ - static const uc_function_list_t global_fns[] = { - { "printf", uc_wpa_printf }, - { "getpid", uc_wpa_getpid }, - { "sha1", uc_wpa_sha1 }, - { "freq_info", uc_wpa_freq_info }, - { "add_iface", uc_hostapd_add_iface }, - { "remove_iface", uc_hostapd_remove_iface }, - { "udebug_set", uc_wpa_udebug_set }, - }; - static const uc_function_list_t bss_fns[] = { - { "ctrl", uc_hostapd_bss_ctrl }, - { "set_config", uc_hostapd_bss_set_config }, - { "rename", uc_hostapd_bss_rename }, - { "delete", uc_hostapd_bss_delete }, - }; - static const uc_function_list_t iface_fns[] = { - { "set_bss_order", uc_hostapd_iface_set_bss_order }, - { "add_bss", uc_hostapd_iface_add_bss }, - { "stop", uc_hostapd_iface_stop }, - { "start", uc_hostapd_iface_start }, - { "switch_channel", uc_hostapd_iface_switch_channel }, - }; - uc_value_t *data, *proto; - - interfaces = ifaces; - vm = wpa_ucode_create_vm(); - - global_type = uc_type_declare(vm, "hostapd.global", global_fns, NULL); - bss_type = uc_type_declare(vm, "hostapd.bss", bss_fns, NULL); - iface_type = uc_type_declare(vm, "hostapd.iface", iface_fns, NULL); - - bss_registry = ucv_array_new(vm); - uc_vm_registry_set(vm, "hostap.bss_registry", bss_registry); - - iface_registry = ucv_array_new(vm); - uc_vm_registry_set(vm, "hostap.iface_registry", iface_registry); - - global = wpa_ucode_global_init("hostapd", global_type); - - if (wpa_ucode_run(HOSTAPD_UC_PATH "hostapd.uc")) - goto free_vm; - ucv_gc(vm); - - return 0; - -free_vm: - wpa_ucode_free_vm(); - return -1; -} - -void hostapd_ucode_free(void) -{ - if (wpa_ucode_call_prepare("shutdown") == 0) - ucv_put(wpa_ucode_call(0)); - wpa_ucode_free_vm(); -} - -void hostapd_ucode_free_iface(struct hostapd_iface *iface) -{ - wpa_ucode_registry_remove(iface_registry, iface->ucode.idx); -} - -void hostapd_ucode_add_bss(struct hostapd_data *hapd) -{ - uc_value_t *val; - - if (wpa_ucode_call_prepare("bss_add")) - return; - - val = hostapd_ucode_bss_get_uval(hapd); - uc_value_push(ucv_get(ucv_string_new(hapd->conf->iface))); - uc_value_push(ucv_get(val)); - ucv_put(wpa_ucode_call(2)); - ucv_gc(vm); -} - -void hostapd_ucode_reload_bss(struct hostapd_data *hapd) -{ - uc_value_t *val; - - if (wpa_ucode_call_prepare("bss_reload")) - return; - - val = hostapd_ucode_bss_get_uval(hapd); - uc_value_push(ucv_get(ucv_string_new(hapd->conf->iface))); - uc_value_push(ucv_get(val)); - ucv_put(wpa_ucode_call(2)); - ucv_gc(vm); -} - -void hostapd_ucode_free_bss(struct hostapd_data *hapd) -{ - uc_value_t *val; - - val = wpa_ucode_registry_remove(bss_registry, hapd->ucode.idx); - if (!val) - return; - - hapd->ucode.idx = 0; - if (wpa_ucode_call_prepare("bss_remove")) - return; - - uc_value_push(ucv_string_new(hapd->conf->iface)); - uc_value_push(ucv_get(val)); - ucv_put(wpa_ucode_call(2)); - ucv_gc(vm); -} diff --git a/package/network/services/hostapd/src/src/utils/ap/ucode.h b/package/network/services/hostapd/src/src/utils/ap/ucode.h deleted file mode 100644 index d00b787169d104..00000000000000 --- a/package/network/services/hostapd/src/src/utils/ap/ucode.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef __HOSTAPD_AP_UCODE_H -#define __HOSTAPD_AP_UCODE_H - -#include "utils/ucode.h" - -struct hostapd_data; - -struct hostapd_ucode_bss { -#ifdef UCODE_SUPPORT - int idx; -#endif -}; - -struct hostapd_ucode_iface { -#ifdef UCODE_SUPPORT - int idx; -#endif -}; - -#ifdef UCODE_SUPPORT - -int hostapd_ucode_init(struct hapd_interfaces *ifaces); - -void hostapd_ucode_free(void); -void hostapd_ucode_free_iface(struct hostapd_iface *iface); -void hostapd_ucode_add_bss(struct hostapd_data *hapd); -void hostapd_ucode_free_bss(struct hostapd_data *hapd); -void hostapd_ucode_reload_bss(struct hostapd_data *hapd); - -#else - -static inline int hostapd_ucode_init(struct hapd_interfaces *ifaces) -{ - return -EINVAL; -} -static inline void hostapd_ucode_free(void) -{ -} -static inline void hostapd_ucode_free_iface(struct hostapd_iface *iface) -{ -} -static inline void hostapd_ucode_reload_bss(struct hostapd_data *hapd) -{ -} -static inline void hostapd_ucode_add_bss(struct hostapd_data *hapd) -{ -} -static inline void hostapd_ucode_free_bss(struct hostapd_data *hapd) -{ -} - -#endif - -#endif diff --git a/package/network/services/hostapd/src/src/utils/build_features.h b/package/network/services/hostapd/src/src/utils/build_features.h index cc8831535c68da..553769ecebc84c 100644 --- a/package/network/services/hostapd/src/src/utils/build_features.h +++ b/package/network/services/hostapd/src/src/utils/build_features.h @@ -15,10 +15,6 @@ static inline int has_feature(const char *feat) if (!strcmp(feat, "11ax")) return 1; #endif -#ifdef CONFIG_IEEE80211BE - if (!strcmp(feat, "11be")) - return 1; -#endif #ifdef CONFIG_IEEE80211R if (!strcmp(feat, "11r")) return 1; From 12a8924cb8e7db81b5977eba0de32acc34abac27 Mon Sep 17 00:00:00 2001 From: Rudy Andram Date: Tue, 17 Sep 2024 05:06:01 +0100 Subject: [PATCH 19/40] Revert "bump hostapd" This reverts commit 693d2c8f201fe3c7c8b92c94c032207d578458a6. --- package/network/services/hostapd/Config.in | 9 +- package/network/services/hostapd/Makefile | 18 +- .../hostapd/files/hostapd-basic.config | 59 +- .../hostapd/files/hostapd-full.config | 67 +- .../hostapd/files/hostapd-mini.config | 59 +- .../hostapd/files/wpa_supplicant-basic.config | 65 +- .../hostapd/files/wpa_supplicant-full.config | 83 +- .../hostapd/files/wpa_supplicant-mini.config | 67 +- .../hostapd/files/wpa_supplicant-p2p.config | 65 +- ...erministic-channel-on-channel-switch.patch | 2 +- ...ix-sta-add-after-previous-connection.patch | 4 +- .../patches/050-Fix-OpenWrt-13156.patch | 4 +- ...-extra-ies-only-if-allowed-by-driver.patch | 2 +- ...efile-make-run-tests-with-CONFIG_TLS.patch | 6 +- ...hecks-encountered-during-tests-hwsim.patch | 2 +- ...tapd-update-cfs0-and-cfs1-for-160MHz.patch | 10 +- .../hostapd/patches/200-multicall.patch | 16 +- ..._AP-functions-dependant-on-CONFIG_AP.patch | 4 +- .../patches/220-indicate-features.patch | 4 +- .../patches/250-hostapd_cli_ifdef.patch | 12 +- .../patches/252-disable_ctrl_iface_mib.patch | 20 +- .../services/hostapd/patches/300-noscan.patch | 4 +- .../patches/330-nl80211_fix_set_freq.patch | 2 +- .../patches/350-nl80211_del_beacon_bss.patch | 2 +- .../381-hostapd_cli_UNKNOWN-COMMAND.patch | 2 +- ...dd-new-config-params-to-be-used-with.patch | 2 +- .../patches/463-add-mcast_rate-to-11s.patch | 6 +- .../patches/590-rrm-wnm-statistics.patch | 4 +- .../hostapd/patches/600-ubus_support.patch | 45 +- .../hostapd/patches/601-ucode_support.patch | 56 +- .../patches/720-iface_max_num_sta.patch | 2 +- .../hostapd/patches/740-snoop_iface.patch | 8 +- .../hostapd/patches/770-radius_server.patch | 2 +- ...ment-APuP-Access-Point-Micro-Peering.patch | 28 +- ...id-Rejected-Groups-element-in-the-pa.patch | 30 + .../803-hostapd-fix-80211be-build.patch | 53 + .../services/hostapd/src/src/ap/ubus.h | 2 + .../services/hostapd/src/src/ap/ucode.c | 2 +- .../services/hostapd/src/src/utils/ap/ubus.c | 2006 +++++++++++++++++ .../services/hostapd/src/src/utils/ap/ubus.h | 157 ++ .../services/hostapd/src/src/utils/ap/ucode.c | 817 +++++++ .../services/hostapd/src/src/utils/ap/ucode.h | 54 + .../hostapd/src/src/utils/build_features.h | 4 + 43 files changed, 3616 insertions(+), 250 deletions(-) create mode 100644 package/network/services/hostapd/patches/802-SAE-Reject-invalid-Rejected-Groups-element-in-the-pa.patch create mode 100644 package/network/services/hostapd/patches/803-hostapd-fix-80211be-build.patch create mode 100644 package/network/services/hostapd/src/src/utils/ap/ubus.c create mode 100644 package/network/services/hostapd/src/src/utils/ap/ubus.h create mode 100644 package/network/services/hostapd/src/src/utils/ap/ucode.c create mode 100644 package/network/services/hostapd/src/src/utils/ap/ucode.h diff --git a/package/network/services/hostapd/Config.in b/package/network/services/hostapd/Config.in index 1fff4f8acd530b..bd1d94c583a760 100644 --- a/package/network/services/hostapd/Config.in +++ b/package/network/services/hostapd/Config.in @@ -33,11 +33,11 @@ config WPA_WOLFSSL config DRIVER_11AC_SUPPORT bool - default n + default y config DRIVER_11AX_SUPPORT bool - default n + default y select WPA_MBO_SUPPORT config WPA_ENABLE_WEP @@ -59,3 +59,8 @@ config WPA_MBO_SUPPORT that facilitate efficient use of multiple frequency bands. Enabling MBO on an AP using RSN requires 802.11w to be enabled. Hostapd will refuse to start if MBO and RSN are enabled without 11w. + +config DRIVER_11BE_SUPPORT + bool + default y + diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile index 1c0b6548662e37..232e084b0af982 100644 --- a/package/network/services/hostapd/Makefile +++ b/package/network/services/hostapd/Makefile @@ -5,13 +5,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=hostapd -PKG_RELEASE:=1 +PKG_RELEASE:=3 -PKG_SOURCE_URL:=https://w1.fi/hostap.git +PKG_SOURCE_URL:=https://github.com/rmandrad/hostapd PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2024-09-15 -PKG_SOURCE_VERSION:=5ace39b0a4cdbe18ddbc4e18f80ee3876233c20b -PKG_MIRROR_HASH:=43187d1ddd923970ef3821a0fe267880c2483f6f1a5acd0dd2d7906661ab1372 +PKG_SOURCE_DATE:=2024-09-04 +PKG_SOURCE_VERSION:=9907c324a0846f3a4899133b9f08ebefb0719ca5 +PKG_MIRROR_HASH:=32deaa53c684be89f9bd69398595d1f539278a1aecb3a3bf605078fe932e2bc3 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=BSD-3-Clause @@ -27,6 +27,7 @@ PKG_CONFIG_DEPENDS:= \ CONFIG_WPA_RFKILL_SUPPORT \ CONFIG_DRIVER_11AC_SUPPORT \ CONFIG_DRIVER_11AX_SUPPORT \ + CONFIG_DRIVER_11BE_SUPPORT \ CONFIG_WPA_ENABLE_WEP PKG_BUILD_FLAGS:=gc-sections lto @@ -79,6 +80,12 @@ ifneq ($(CONFIG_DRIVER_11AX_SUPPORT),) HOSTAPD_IEEE80211AX:=y endif +ifneq ($(CONFIG_DRIVER_11BE_SUPPORT),) + HOSTAPD_IEEE80211BE:=y +endif + + + CORE_DEPENDS = +ucode +libubus +libucode +ucode-mod-fs +ucode-mod-nl80211 +ucode-mod-rtnl +ucode-mod-ubus +ucode-mod-uloop +libblobmsg-json +libudebug OPENSSL_DEPENDS = +PACKAGE_$(1):libopenssl +PACKAGE_$(1):libopenssl-legacy @@ -86,6 +93,7 @@ DRIVER_MAKEOPTS= \ CONFIG_ACS=y CONFIG_DRIVER_NL80211=y \ CONFIG_IEEE80211AC=$(HOSTAPD_IEEE80211AC) \ CONFIG_IEEE80211AX=$(HOSTAPD_IEEE80211AX) \ + CONFIG_IEEE80211BE=$(HOSTAPD_IEEE80211BE) \ CONFIG_MBO=$(CONFIG_WPA_MBO_SUPPORT) \ CONFIG_UCODE=y CONFIG_APUP=y diff --git a/package/network/services/hostapd/files/hostapd-basic.config b/package/network/services/hostapd/files/hostapd-basic.config index 3d19d8f902f08a..dbd1f9dedef514 100644 --- a/package/network/services/hostapd/files/hostapd-basic.config +++ b/package/network/services/hostapd/files/hostapd-basic.config @@ -44,15 +44,9 @@ CONFIG_DRIVER_NL80211=y # Driver interface for no driver (e.g., RADIUS server only) #CONFIG_DRIVER_NONE=y -# IEEE 802.11F/IAPP -#CONFIG_IAPP=y - # WPA2/IEEE 802.11i RSN pre-authentication CONFIG_RSN_PREAUTH=y -# IEEE 802.11w (management frame protection) -#CONFIG_IEEE80211W=y - # Support Operating Channel Validation CONFIG_OCV=y @@ -154,9 +148,6 @@ CONFIG_IEEE80211R=y # the IEEE 802.11 Management capability (e.g., FreeBSD/net80211) #CONFIG_DRIVER_RADIUS_ACL=y -# IEEE 802.11n (High Throughput) support -CONFIG_IEEE80211N=y - # Wireless Network Management (IEEE Std 802.11v-2011) # Note: This is experimental and not complete implementation. #CONFIG_WNM=y @@ -165,10 +156,20 @@ CONFIG_IEEE80211N=y CONFIG_IEEE80211AC=y # IEEE 802.11ax HE support +#CONFIG_IEEE80211AX=y + +# IEEE 802.11be EHT support +# CONFIG_IEEE80211AX is mandatory for setting CONFIG_IEEE80211BE. # Note: This is experimental and work in progress. The definitions are still # subject to change and this should not be expected to interoperate with the -# final IEEE 802.11ax version. -#CONFIG_IEEE80211AX=y +# final IEEE 802.11be version. +CONFIG_IEEE80211BE=y + +# Simultaneous Authentication of Equals (SAE), WPA3-Personal +#CONFIG_SAE=y + +# SAE Public Key, WPA3-Personal +#CONFIG_SAE_PK=y # Remove debugging code that is printing out debug messages to stdout. # This can be used to reduce the size of the hostapd considerably if debugging @@ -355,12 +356,12 @@ CONFIG_TLS=internal # * ath10k # # For more details refer to: -# http://wireless.kernel.org/en/users/Documentation/acs +# https://wireless.wiki.kernel.org/en/users/documentation/acs # #CONFIG_ACS=y # Multiband Operation support -# These extentions facilitate efficient use of multiple frequency bands +# These extensions facilitate efficient use of multiple frequency bands # available to the AP and the devices that may associate with it. #CONFIG_MBO=y @@ -386,13 +387,39 @@ CONFIG_TLS=internal # Airtime policy support CONFIG_AIRTIME_POLICY=y -# Proxy ARP support -#CONFIG_PROXYARP=y - # Override default value for the wpa_disable_eapol_key_retries configuration # parameter. See that parameter in hostapd.conf for more details. #CFLAGS += -DDEFAULT_WPA_DISABLE_EAPOL_KEY_RETRIES=1 +# Wired equivalent privacy (WEP) +# WEP is an obsolete cryptographic data confidentiality algorithm that is not +# considered secure. It should not be used for anything anymore. The +# functionality needed to use WEP is available in the current hostapd +# release under this optional build parameter. This functionality is subject to +# be completely removed in a future release. +#CONFIG_WEP=y + +# Remove all TKIP functionality +# TKIP is an old cryptographic data confidentiality algorithm that is not +# considered secure. It should not be used anymore. For now, the default hostapd +# build includes this to allow mixed mode WPA+WPA2 networks to be enabled, but +# that functionality is subject to be removed in the future. +#CONFIG_NO_TKIP=y + +# Pre-Association Security Negotiation (PASN) +# Experimental implementation based on IEEE P802.11z/D2.6 and the protocol +# design is still subject to change. As such, this should not yet be enabled in +# production use. +#CONFIG_PASN=y + +# Device Provisioning Protocol (DPP) (also known as Wi-Fi Easy Connect) +#CONFIG_DPP=y +# DPP version 2 support +#CONFIG_DPP2=y +# DPP version 3 support (experimental and still changing; do not enable for +# production use) +#CONFIG_DPP3=y + # uBus IPC/RPC System # Services can connect to the bus and provide methods # that can be called by other services or clients. diff --git a/package/network/services/hostapd/files/hostapd-full.config b/package/network/services/hostapd/files/hostapd-full.config index 9076ebc44f95df..076c2bc6a02254 100644 --- a/package/network/services/hostapd/files/hostapd-full.config +++ b/package/network/services/hostapd/files/hostapd-full.config @@ -10,7 +10,7 @@ # to override previous values of the variables. # Driver interface for Host AP driver -#CONFIG_DRIVER_HOSTAP=y +CONFIG_DRIVER_HOSTAP=y # Driver interface for wired authenticator CONFIG_DRIVER_WIRED=y @@ -44,15 +44,9 @@ CONFIG_DRIVER_NL80211=y # Driver interface for no driver (e.g., RADIUS server only) #CONFIG_DRIVER_NONE=y -# IEEE 802.11F/IAPP -CONFIG_IAPP=y - # WPA2/IEEE 802.11i RSN pre-authentication CONFIG_RSN_PREAUTH=y -# IEEE 802.11w (management frame protection) -#CONFIG_IEEE80211W=y - # Support Operating Channel Validation CONFIG_OCV=y @@ -154,9 +148,6 @@ CONFIG_IEEE80211R=y # the IEEE 802.11 Management capability (e.g., FreeBSD/net80211) #CONFIG_DRIVER_RADIUS_ACL=y -# IEEE 802.11n (High Throughput) support -CONFIG_IEEE80211N=y - # Wireless Network Management (IEEE Std 802.11v-2011) # Note: This is experimental and not complete implementation. CONFIG_WNM=y @@ -165,10 +156,20 @@ CONFIG_WNM=y CONFIG_IEEE80211AC=y # IEEE 802.11ax HE support +#CONFIG_IEEE80211AX=y + +# IEEE 802.11be EHT support +# CONFIG_IEEE80211AX is mandatory for setting CONFIG_IEEE80211BE. # Note: This is experimental and work in progress. The definitions are still # subject to change and this should not be expected to interoperate with the -# final IEEE 802.11ax version. -#CONFIG_IEEE80211AX=y +# final IEEE 802.11be version. +CONFIG_IEEE80211BE=y + +# Simultaneous Authentication of Equals (SAE), WPA3-Personal +CONFIG_SAE=y + +# SAE Public Key, WPA3-Personal +CONFIG_SAE_PK=y # Remove debugging code that is printing out debug messages to stdout. # This can be used to reduce the size of the hostapd considerably if debugging @@ -288,7 +289,7 @@ CONFIG_TLS=internal # TLS-based EAP methods require at least TLS v1.0. Newer version of TLS (v1.2) # can be enabled to enable use of stronger crypto algorithms. -#CONFIG_TLSV12=y +CONFIG_TLSV12=y # Select which ciphers to use by default with OpenSSL if the user does not # specify them. @@ -322,7 +323,7 @@ CONFIG_HS20=y #CONFIG_SQLITE=y # Enable Fast Session Transfer (FST) -#CONFIG_FST=y +CONFIG_FST=y # Enable CLI commands for FST testing #CONFIG_FST_TEST=y @@ -355,14 +356,14 @@ CONFIG_HS20=y # * ath10k # # For more details refer to: -# http://wireless.kernel.org/en/users/Documentation/acs +# https://wireless.wiki.kernel.org/en/users/documentation/acs # #CONFIG_ACS=y # Multiband Operation support -# These extentions facilitate efficient use of multiple frequency bands +# These extensions facilitate efficient use of multiple frequency bands # available to the AP and the devices that may associate with it. -#CONFIG_MBO=y +CONFIG_MBO=y # Client Taxonomy # Has the AP retain the Probe Request and (Re)Association Request frames from @@ -386,13 +387,39 @@ CONFIG_TAXONOMY=y # Airtime policy support CONFIG_AIRTIME_POLICY=y -# Proxy ARP support -CONFIG_PROXYARP=y - # Override default value for the wpa_disable_eapol_key_retries configuration # parameter. See that parameter in hostapd.conf for more details. #CFLAGS += -DDEFAULT_WPA_DISABLE_EAPOL_KEY_RETRIES=1 +# Wired equivalent privacy (WEP) +# WEP is an obsolete cryptographic data confidentiality algorithm that is not +# considered secure. It should not be used for anything anymore. The +# functionality needed to use WEP is available in the current hostapd +# release under this optional build parameter. This functionality is subject to +# be completely removed in a future release. +#CONFIG_WEP=y + +# Remove all TKIP functionality +# TKIP is an old cryptographic data confidentiality algorithm that is not +# considered secure. It should not be used anymore. For now, the default hostapd +# build includes this to allow mixed mode WPA+WPA2 networks to be enabled, but +# that functionality is subject to be removed in the future. +#CONFIG_NO_TKIP=y + +# Pre-Association Security Negotiation (PASN) +# Experimental implementation based on IEEE P802.11z/D2.6 and the protocol +# design is still subject to change. As such, this should not yet be enabled in +# production use. +#CONFIG_PASN=y + +# Device Provisioning Protocol (DPP) (also known as Wi-Fi Easy Connect) +#CONFIG_DPP=y +# DPP version 2 support +#CONFIG_DPP2=y +# DPP version 3 support (experimental and still changing; do not enable for +# production use) +#CONFIG_DPP3=y + # uBus IPC/RPC System # Services can connect to the bus and provide methods # that can be called by other services or clients. diff --git a/package/network/services/hostapd/files/hostapd-mini.config b/package/network/services/hostapd/files/hostapd-mini.config index f2ed071ec09623..be0080ffe7a781 100644 --- a/package/network/services/hostapd/files/hostapd-mini.config +++ b/package/network/services/hostapd/files/hostapd-mini.config @@ -44,15 +44,9 @@ CONFIG_DRIVER_NL80211=y # Driver interface for no driver (e.g., RADIUS server only) #CONFIG_DRIVER_NONE=y -# IEEE 802.11F/IAPP -#CONFIG_IAPP=y - # WPA2/IEEE 802.11i RSN pre-authentication CONFIG_RSN_PREAUTH=y -# IEEE 802.11w (management frame protection) -#CONFIG_IEEE80211W=y - # Support Operating Channel Validation #CONFIG_OCV=y @@ -154,9 +148,6 @@ CONFIG_RSN_PREAUTH=y # the IEEE 802.11 Management capability (e.g., FreeBSD/net80211) #CONFIG_DRIVER_RADIUS_ACL=y -# IEEE 802.11n (High Throughput) support -CONFIG_IEEE80211N=y - # Wireless Network Management (IEEE Std 802.11v-2011) # Note: This is experimental and not complete implementation. #CONFIG_WNM=y @@ -165,10 +156,20 @@ CONFIG_IEEE80211N=y CONFIG_IEEE80211AC=y # IEEE 802.11ax HE support +#CONFIG_IEEE80211AX=y + +# IEEE 802.11be EHT support +# CONFIG_IEEE80211AX is mandatory for setting CONFIG_IEEE80211BE. # Note: This is experimental and work in progress. The definitions are still # subject to change and this should not be expected to interoperate with the -# final IEEE 802.11ax version. -#CONFIG_IEEE80211AX=y +# final IEEE 802.11be version. +CONFIG_IEEE80211BE=y + +# Simultaneous Authentication of Equals (SAE), WPA3-Personal +#CONFIG_SAE=y + +# SAE Public Key, WPA3-Personal +#CONFIG_SAE_PK=y # Remove debugging code that is printing out debug messages to stdout. # This can be used to reduce the size of the hostapd considerably if debugging @@ -355,12 +356,12 @@ CONFIG_TLS=internal # * ath10k # # For more details refer to: -# http://wireless.kernel.org/en/users/Documentation/acs +# https://wireless.wiki.kernel.org/en/users/documentation/acs # #CONFIG_ACS=y # Multiband Operation support -# These extentions facilitate efficient use of multiple frequency bands +# These extensions facilitate efficient use of multiple frequency bands # available to the AP and the devices that may associate with it. #CONFIG_MBO=y @@ -386,13 +387,39 @@ CONFIG_TLS=internal # Airtime policy support #CONFIG_AIRTIME_POLICY=y -# Proxy ARP support -#CONFIG_PROXYARP=y - # Override default value for the wpa_disable_eapol_key_retries configuration # parameter. See that parameter in hostapd.conf for more details. #CFLAGS += -DDEFAULT_WPA_DISABLE_EAPOL_KEY_RETRIES=1 +# Wired equivalent privacy (WEP) +# WEP is an obsolete cryptographic data confidentiality algorithm that is not +# considered secure. It should not be used for anything anymore. The +# functionality needed to use WEP is available in the current hostapd +# release under this optional build parameter. This functionality is subject to +# be completely removed in a future release. +#CONFIG_WEP=y + +# Remove all TKIP functionality +# TKIP is an old cryptographic data confidentiality algorithm that is not +# considered secure. It should not be used anymore. For now, the default hostapd +# build includes this to allow mixed mode WPA+WPA2 networks to be enabled, but +# that functionality is subject to be removed in the future. +#CONFIG_NO_TKIP=y + +# Pre-Association Security Negotiation (PASN) +# Experimental implementation based on IEEE P802.11z/D2.6 and the protocol +# design is still subject to change. As such, this should not yet be enabled in +# production use. +#CONFIG_PASN=y + +# Device Provisioning Protocol (DPP) (also known as Wi-Fi Easy Connect) +#CONFIG_DPP=y +# DPP version 2 support +#CONFIG_DPP2=y +# DPP version 3 support (experimental and still changing; do not enable for +# production use) +#CONFIG_DPP3=y + # uBus IPC/RPC System # Services can connect to the bus and provide methods # that can be called by other services or clients. diff --git a/package/network/services/hostapd/files/wpa_supplicant-basic.config b/package/network/services/hostapd/files/wpa_supplicant-basic.config index 944b4d92876002..a78b17dcecbb20 100644 --- a/package/network/services/hostapd/files/wpa_supplicant-basic.config +++ b/package/network/services/hostapd/files/wpa_supplicant-basic.config @@ -101,6 +101,9 @@ CONFIG_DRIVER_WIRED=y # EAP-TLS #CONFIG_EAP_TLS=y +# Enable EAP-TLSv1.3 support by default (currently disabled unless explicitly +# enabled in network configuration) +#CONFIG_EAP_TLSV1_3=y # EAL-PEAP #CONFIG_EAP_PEAP=y @@ -203,6 +206,9 @@ CONFIG_HT_OVERRIDES=y # Support VHT overrides (disable VHT, mask MCS rates, etc.) CONFIG_VHT_OVERRIDES=y +# Support HE overrides +CONFIG_HE_OVERRIDES=y + # Development testing #CONFIG_EAPOL_TEST=y @@ -248,7 +254,10 @@ CONFIG_CTRL_IFACE=y # Simultaneous Authentication of Equals (SAE), WPA3-Personal #CONFIG_SAE=y -# Disable scan result processing (ap_mode=1) to save code size by about 1 kB. +# SAE Public Key, WPA3-Personal +#CONFIG_SAE_PK=y + +# Disable scan result processing (ap_scan=1) to save code size by about 1 kB. # This can be used if ap_scan=1 mode is never enabled. #CONFIG_NO_SCAN_PROCESSING=y @@ -310,10 +319,6 @@ CONFIG_ELOOP_EPOLL=y # bridge interfaces (commit 'bridge: respect RFC2863 operational state')'). CONFIG_NO_LINUX_PACKET_SOCKET_WAR=y -# IEEE 802.11w (management frame protection), also known as PMF -# Driver support is also needed for IEEE 802.11w. -#CONFIG_IEEE80211W=y - # Support Operating Channel Validation CONFIG_OCV=y @@ -366,7 +371,7 @@ CONFIG_TLS=internal #PLATFORMSDKLIB="/opt/Program Files/Microsoft Platform SDK/Lib" # Add support for new DBus control interface -# (fi.w1.hostap.wpa_supplicant1) +# (fi.w1.wpa_supplicant1) #CONFIG_CTRL_IFACE_DBUS_NEW=y # Add introspection support for new DBus control interface @@ -475,13 +480,19 @@ CONFIG_NO_RANDOM_POOL=y # Requires glibc 2.25 to build, falls back to /dev/random if unavailable. CONFIG_GETRANDOM=y -# IEEE 802.11n (High Throughput) support (mainly for AP mode) -#CONFIG_IEEE80211N=y - # IEEE 802.11ac (Very High Throughput) support (mainly for AP mode) -# (depends on CONFIG_IEEE80211N) #CONFIG_IEEE80211AC=y +# IEEE 802.11ax HE support (mainly for AP mode) +#CONFIG_IEEE80211AX=y + +# IEEE 802.11be EHT support (mainly for AP mode) +# CONFIG_IEEE80211AX is mandatory for setting CONFIG_IEEE80211BE. +# Note: This is experimental and work in progress. The definitions are still +# subject to change and this should not be expected to interoperate with the +# final IEEE 802.11be version. +#CONFIG_IEEE80211BE=y + # Wireless Network Management (IEEE Std 802.11v-2011) # Note: This is experimental and not complete implementation. #CONFIG_WNM=y @@ -538,6 +549,8 @@ CONFIG_GETRANDOM=y # # External password backend for testing purposes (developer use) #CONFIG_EXT_PASSWORD_TEST=y +# File-based backend to read passwords from an external file. +#CONFIG_EXT_PASSWORD_FILE=y # Enable Fast Session Transfer (FST) #CONFIG_FST=y @@ -609,10 +622,36 @@ CONFIG_GETRANDOM=y # Experimental implementation of draft-harkins-owe-07.txt #CONFIG_OWE=y -# Device Provisioning Protocol (DPP) -# This requires CONFIG_IEEE80211W=y to be enabled, too. (see -# wpa_supplicant/README-DPP for details) +# Device Provisioning Protocol (DPP) (also known as Wi-Fi Easy Connect) #CONFIG_DPP=y +# DPP version 2 support +#CONFIG_DPP2=y +# DPP version 3 support (experimental and still changing; do not enable for +# production use) +#CONFIG_DPP3=y + +# Wired equivalent privacy (WEP) +# WEP is an obsolete cryptographic data confidentiality algorithm that is not +# considered secure. It should not be used for anything anymore. The +# functionality needed to use WEP is available in the current wpa_supplicant +# release under this optional build parameter. This functionality is subject to +# be completely removed in a future release. +#CONFIG_WEP=y + +# Remove all TKIP functionality +# TKIP is an old cryptographic data confidentiality algorithm that is not +# considered secure. It should not be used anymore for anything else than a +# backwards compatibility option as a group cipher when connecting to APs that +# use WPA+WPA2 mixed mode. For now, the default wpa_supplicant build includes +# support for this by default, but that functionality is subject to be removed +# in the future. +#CONFIG_NO_TKIP=y + +# Pre-Association Security Negotiation (PASN) +# Experimental implementation based on IEEE P802.11z/D2.6 and the protocol +# design is still subject to change. As such, this should not yet be enabled in +# production use. +#CONFIG_PASN=y # uBus IPC/RPC System # Services can connect to the bus and provide methods diff --git a/package/network/services/hostapd/files/wpa_supplicant-full.config b/package/network/services/hostapd/files/wpa_supplicant-full.config index b39dabca0696b5..01c402d9e7c162 100644 --- a/package/network/services/hostapd/files/wpa_supplicant-full.config +++ b/package/network/services/hostapd/files/wpa_supplicant-full.config @@ -101,6 +101,9 @@ CONFIG_EAP_MSCHAPV2=y # EAP-TLS CONFIG_EAP_TLS=y +# Enable EAP-TLSv1.3 support by default (currently disabled unless explicitly +# enabled in network configuration) +#CONFIG_EAP_TLSV1_3=y # EAL-PEAP CONFIG_EAP_PEAP=y @@ -203,6 +206,9 @@ CONFIG_HT_OVERRIDES=y # Support VHT overrides (disable VHT, mask MCS rates, etc.) CONFIG_VHT_OVERRIDES=y +# Support HE overrides +CONFIG_HE_OVERRIDES=y + # Development testing #CONFIG_EAPOL_TEST=y @@ -246,9 +252,12 @@ CONFIG_CTRL_IFACE=y #CONFIG_NO_WPA_PASSPHRASE=y # Simultaneous Authentication of Equals (SAE), WPA3-Personal -#CONFIG_SAE=y +CONFIG_SAE=y + +# SAE Public Key, WPA3-Personal +CONFIG_SAE_PK=y -# Disable scan result processing (ap_mode=1) to save code size by about 1 kB. +# Disable scan result processing (ap_scan=1) to save code size by about 1 kB. # This can be used if ap_scan=1 mode is never enabled. #CONFIG_NO_SCAN_PROCESSING=y @@ -310,10 +319,6 @@ CONFIG_ELOOP_EPOLL=y # bridge interfaces (commit 'bridge: respect RFC2863 operational state')'). CONFIG_NO_LINUX_PACKET_SOCKET_WAR=y -# IEEE 802.11w (management frame protection), also known as PMF -# Driver support is also needed for IEEE 802.11w. -#CONFIG_IEEE80211W=y - # Support Operating Channel Validation CONFIG_OCV=y @@ -366,7 +371,7 @@ CONFIG_INTERNAL_LIBTOMMATH_FAST=y #PLATFORMSDKLIB="/opt/Program Files/Microsoft Platform SDK/Lib" # Add support for new DBus control interface -# (fi.w1.hostap.wpa_supplicant1) +# (fi.w1.wpa_supplicant1) #CONFIG_CTRL_IFACE_DBUS_NEW=y # Add introspection support for new DBus control interface @@ -475,13 +480,19 @@ CONFIG_NO_RANDOM_POOL=y # Requires glibc 2.25 to build, falls back to /dev/random if unavailable. CONFIG_GETRANDOM=y -# IEEE 802.11n (High Throughput) support (mainly for AP mode) -#CONFIG_IEEE80211N=y - # IEEE 802.11ac (Very High Throughput) support (mainly for AP mode) -# (depends on CONFIG_IEEE80211N) #CONFIG_IEEE80211AC=y +# IEEE 802.11ax HE support (mainly for AP mode) +#CONFIG_IEEE80211AX=y + +# IEEE 802.11be EHT support (mainly for AP mode) +# CONFIG_IEEE80211AX is mandatory for setting CONFIG_IEEE80211BE. +# Note: This is experimental and work in progress. The definitions are still +# subject to change and this should not be expected to interoperate with the +# final IEEE 802.11be version. +CONFIG_IEEE80211BE=y + # Wireless Network Management (IEEE Std 802.11v-2011) # Note: This is experimental and not complete implementation. CONFIG_WNM=y @@ -506,12 +517,12 @@ CONFIG_HS20=y # should be noted that this is mainly aimed at simple cases like # WPA2-Personal while more complex configurations like WPA2-Enterprise with an # external RADIUS server can be supported with hostapd. -#CONFIG_AP=y +CONFIG_AP=y # P2P (Wi-Fi Direct) # This can be used to enable P2P support in wpa_supplicant. See README-P2P for # more information on P2P operations. -#CONFIG_P2P=y +CONFIG_P2P=y # Enable TDLS support #CONFIG_TDLS=y @@ -519,7 +530,7 @@ CONFIG_HS20=y # Wi-Fi Display # This can be used to enable Wi-Fi Display extensions for P2P using an external # program to control the additional information exchanges in the messages. -#CONFIG_WIFI_DISPLAY=y +CONFIG_WIFI_DISPLAY=y # Autoscan # This can be used to enable automatic scan support in wpa_supplicant. @@ -538,9 +549,11 @@ CONFIG_HS20=y # # External password backend for testing purposes (developer use) #CONFIG_EXT_PASSWORD_TEST=y +# File-based backend to read passwords from an external file. +#CONFIG_EXT_PASSWORD_FILE=y # Enable Fast Session Transfer (FST) -#CONFIG_FST=y +CONFIG_FST=y # Enable CLI commands for FST testing #CONFIG_FST_TEST=y @@ -575,7 +588,7 @@ CONFIG_HS20=y #CONFIG_ACS=y # Support Multi Band Operation -#CONFIG_MBO=y +CONFIG_MBO=y # Fast Initial Link Setup (FILS) (IEEE 802.11ai) CONFIG_FILS=y @@ -600,19 +613,45 @@ CONFIG_IBSS_RSN=y # operations for roaming within an ESS (same SSID). See the bgscan parameter in # the wpa_supplicant.conf file for more details. # Periodic background scans based on signal strength -#CONFIG_BGSCAN_SIMPLE=y +CONFIG_BGSCAN_SIMPLE=y # Learn channels used by the network and try to avoid bgscans on other # channels (experimental) -#CONFIG_BGSCAN_LEARN=y +CONFIG_BGSCAN_LEARN=y # Opportunistic Wireless Encryption (OWE) # Experimental implementation of draft-harkins-owe-07.txt -#CONFIG_OWE=y +CONFIG_OWE=y -# Device Provisioning Protocol (DPP) -# This requires CONFIG_IEEE80211W=y to be enabled, too. (see -# wpa_supplicant/README-DPP for details) +# Device Provisioning Protocol (DPP) (also known as Wi-Fi Easy Connect) #CONFIG_DPP=y +# DPP version 2 support +#CONFIG_DPP2=y +# DPP version 3 support (experimental and still changing; do not enable for +# production use) +#CONFIG_DPP3=y + +# Wired equivalent privacy (WEP) +# WEP is an obsolete cryptographic data confidentiality algorithm that is not +# considered secure. It should not be used for anything anymore. The +# functionality needed to use WEP is available in the current wpa_supplicant +# release under this optional build parameter. This functionality is subject to +# be completely removed in a future release. +#CONFIG_WEP=y + +# Remove all TKIP functionality +# TKIP is an old cryptographic data confidentiality algorithm that is not +# considered secure. It should not be used anymore for anything else than a +# backwards compatibility option as a group cipher when connecting to APs that +# use WPA+WPA2 mixed mode. For now, the default wpa_supplicant build includes +# support for this by default, but that functionality is subject to be removed +# in the future. +#CONFIG_NO_TKIP=y + +# Pre-Association Security Negotiation (PASN) +# Experimental implementation based on IEEE P802.11z/D2.6 and the protocol +# design is still subject to change. As such, this should not yet be enabled in +# production use. +#CONFIG_PASN=y # uBus IPC/RPC System # Services can connect to the bus and provide methods diff --git a/package/network/services/hostapd/files/wpa_supplicant-mini.config b/package/network/services/hostapd/files/wpa_supplicant-mini.config index 2a3f8fb69de337..0b628957f9dce1 100644 --- a/package/network/services/hostapd/files/wpa_supplicant-mini.config +++ b/package/network/services/hostapd/files/wpa_supplicant-mini.config @@ -101,6 +101,9 @@ CONFIG_DRIVER_WIRED=y # EAP-TLS #CONFIG_EAP_TLS=y +# Enable EAP-TLSv1.3 support by default (currently disabled unless explicitly +# enabled in network configuration) +#CONFIG_EAP_TLSV1_3=y # EAL-PEAP #CONFIG_EAP_PEAP=y @@ -203,6 +206,9 @@ CONFIG_HT_OVERRIDES=y # Support VHT overrides (disable VHT, mask MCS rates, etc.) CONFIG_VHT_OVERRIDES=y +# Support HE overrides +CONFIG_HE_OVERRIDES=y + # Development testing #CONFIG_EAPOL_TEST=y @@ -248,7 +254,10 @@ CONFIG_CTRL_IFACE=y # Simultaneous Authentication of Equals (SAE), WPA3-Personal #CONFIG_SAE=y -# Disable scan result processing (ap_mode=1) to save code size by about 1 kB. +# SAE Public Key, WPA3-Personal +#CONFIG_SAE_PK=y + +# Disable scan result processing (ap_scan=1) to save code size by about 1 kB. # This can be used if ap_scan=1 mode is never enabled. #CONFIG_NO_SCAN_PROCESSING=y @@ -310,12 +319,8 @@ CONFIG_ELOOP_EPOLL=y # bridge interfaces (commit 'bridge: respect RFC2863 operational state')'). CONFIG_NO_LINUX_PACKET_SOCKET_WAR=y -# IEEE 802.11w (management frame protection), also known as PMF -# Driver support is also needed for IEEE 802.11w. -#CONFIG_IEEE80211W=y - # Support Operating Channel Validation -#CONFIG_OCV=y +CONFIG_OCV=y # Select TLS implementation # openssl = OpenSSL (default) @@ -366,7 +371,7 @@ CONFIG_TLS=internal #PLATFORMSDKLIB="/opt/Program Files/Microsoft Platform SDK/Lib" # Add support for new DBus control interface -# (fi.w1.hostap.wpa_supplicant1) +# (fi.w1.wpa_supplicant1) #CONFIG_CTRL_IFACE_DBUS_NEW=y # Add introspection support for new DBus control interface @@ -475,13 +480,19 @@ CONFIG_NO_RANDOM_POOL=y # Requires glibc 2.25 to build, falls back to /dev/random if unavailable. CONFIG_GETRANDOM=y -# IEEE 802.11n (High Throughput) support (mainly for AP mode) -#CONFIG_IEEE80211N=y - # IEEE 802.11ac (Very High Throughput) support (mainly for AP mode) -# (depends on CONFIG_IEEE80211N) #CONFIG_IEEE80211AC=y +# IEEE 802.11ax HE support (mainly for AP mode) +#CONFIG_IEEE80211AX=y + +# IEEE 802.11be EHT support (mainly for AP mode) +# CONFIG_IEEE80211AX is mandatory for setting CONFIG_IEEE80211BE. +# Note: This is experimental and work in progress. The definitions are still +# subject to change and this should not be expected to interoperate with the +# final IEEE 802.11be version. +#CONFIG_IEEE80211BE=y + # Wireless Network Management (IEEE Std 802.11v-2011) # Note: This is experimental and not complete implementation. #CONFIG_WNM=y @@ -538,6 +549,8 @@ CONFIG_GETRANDOM=y # # External password backend for testing purposes (developer use) #CONFIG_EXT_PASSWORD_TEST=y +# File-based backend to read passwords from an external file. +#CONFIG_EXT_PASSWORD_FILE=y # Enable Fast Session Transfer (FST) #CONFIG_FST=y @@ -609,10 +622,36 @@ CONFIG_GETRANDOM=y # Experimental implementation of draft-harkins-owe-07.txt #CONFIG_OWE=y -# Device Provisioning Protocol (DPP) -# This requires CONFIG_IEEE80211W=y to be enabled, too. (see -# wpa_supplicant/README-DPP for details) +# Device Provisioning Protocol (DPP) (also known as Wi-Fi Easy Connect) #CONFIG_DPP=y +# DPP version 2 support +#CONFIG_DPP2=y +# DPP version 3 support (experimental and still changing; do not enable for +# production use) +#CONFIG_DPP3=y + +# Wired equivalent privacy (WEP) +# WEP is an obsolete cryptographic data confidentiality algorithm that is not +# considered secure. It should not be used for anything anymore. The +# functionality needed to use WEP is available in the current wpa_supplicant +# release under this optional build parameter. This functionality is subject to +# be completely removed in a future release. +#CONFIG_WEP=y + +# Remove all TKIP functionality +# TKIP is an old cryptographic data confidentiality algorithm that is not +# considered secure. It should not be used anymore for anything else than a +# backwards compatibility option as a group cipher when connecting to APs that +# use WPA+WPA2 mixed mode. For now, the default wpa_supplicant build includes +# support for this by default, but that functionality is subject to be removed +# in the future. +#CONFIG_NO_TKIP=y + +# Pre-Association Security Negotiation (PASN) +# Experimental implementation based on IEEE P802.11z/D2.6 and the protocol +# design is still subject to change. As such, this should not yet be enabled in +# production use. +#CONFIG_PASN=y # uBus IPC/RPC System # Services can connect to the bus and provide methods diff --git a/package/network/services/hostapd/files/wpa_supplicant-p2p.config b/package/network/services/hostapd/files/wpa_supplicant-p2p.config index 7f5140622cc15a..8648b1657b14dd 100644 --- a/package/network/services/hostapd/files/wpa_supplicant-p2p.config +++ b/package/network/services/hostapd/files/wpa_supplicant-p2p.config @@ -101,6 +101,9 @@ CONFIG_EAP_MSCHAPV2=y # EAP-TLS CONFIG_EAP_TLS=y +# Enable EAP-TLSv1.3 support by default (currently disabled unless explicitly +# enabled in network configuration) +#CONFIG_EAP_TLSV1_3=y # EAL-PEAP CONFIG_EAP_PEAP=y @@ -203,6 +206,9 @@ CONFIG_HT_OVERRIDES=y # Support VHT overrides (disable VHT, mask MCS rates, etc.) CONFIG_VHT_OVERRIDES=y +# Support HE overrides +CONFIG_HE_OVERRIDES=y + # Development testing #CONFIG_EAPOL_TEST=y @@ -248,7 +254,10 @@ CONFIG_CTRL_IFACE=y # Simultaneous Authentication of Equals (SAE), WPA3-Personal #CONFIG_SAE=y -# Disable scan result processing (ap_mode=1) to save code size by about 1 kB. +# SAE Public Key, WPA3-Personal +#CONFIG_SAE_PK=y + +# Disable scan result processing (ap_scan=1) to save code size by about 1 kB. # This can be used if ap_scan=1 mode is never enabled. #CONFIG_NO_SCAN_PROCESSING=y @@ -310,10 +319,6 @@ CONFIG_ELOOP_EPOLL=y # bridge interfaces (commit 'bridge: respect RFC2863 operational state')'). CONFIG_NO_LINUX_PACKET_SOCKET_WAR=y -# IEEE 802.11w (management frame protection), also known as PMF -# Driver support is also needed for IEEE 802.11w. -CONFIG_IEEE80211W=y - # Support Operating Channel Validation #CONFIG_OCV=y @@ -366,7 +371,7 @@ CONFIG_INTERNAL_LIBTOMMATH_FAST=y #PLATFORMSDKLIB="/opt/Program Files/Microsoft Platform SDK/Lib" # Add support for new DBus control interface -# (fi.w1.hostap.wpa_supplicant1) +# (fi.w1.wpa_supplicant1) #CONFIG_CTRL_IFACE_DBUS_NEW=y # Add introspection support for new DBus control interface @@ -475,13 +480,19 @@ CONFIG_NO_RANDOM_POOL=y # Requires glibc 2.25 to build, falls back to /dev/random if unavailable. CONFIG_GETRANDOM=y -# IEEE 802.11n (High Throughput) support (mainly for AP mode) -#CONFIG_IEEE80211N=y - # IEEE 802.11ac (Very High Throughput) support (mainly for AP mode) -# (depends on CONFIG_IEEE80211N) #CONFIG_IEEE80211AC=y +# IEEE 802.11ax HE support (mainly for AP mode) +#CONFIG_IEEE80211AX=y + +# IEEE 802.11be EHT support (mainly for AP mode) +# CONFIG_IEEE80211AX is mandatory for setting CONFIG_IEEE80211BE. +# Note: This is experimental and work in progress. The definitions are still +# subject to change and this should not be expected to interoperate with the +# final IEEE 802.11be version. +#CONFIG_IEEE80211BE=y + # Wireless Network Management (IEEE Std 802.11v-2011) # Note: This is experimental and not complete implementation. #CONFIG_WNM=y @@ -538,6 +549,8 @@ CONFIG_P2P=y # # External password backend for testing purposes (developer use) #CONFIG_EXT_PASSWORD_TEST=y +# File-based backend to read passwords from an external file. +#CONFIG_EXT_PASSWORD_FILE=y # Enable Fast Session Transfer (FST) #CONFIG_FST=y @@ -609,10 +622,36 @@ CONFIG_IBSS_RSN=y # Experimental implementation of draft-harkins-owe-07.txt #CONFIG_OWE=y -# Device Provisioning Protocol (DPP) -# This requires CONFIG_IEEE80211W=y to be enabled, too. (see -# wpa_supplicant/README-DPP for details) +# Device Provisioning Protocol (DPP) (also known as Wi-Fi Easy Connect) #CONFIG_DPP=y +# DPP version 2 support +#CONFIG_DPP2=y +# DPP version 3 support (experimental and still changing; do not enable for +# production use) +#CONFIG_DPP3=y + +# Wired equivalent privacy (WEP) +# WEP is an obsolete cryptographic data confidentiality algorithm that is not +# considered secure. It should not be used for anything anymore. The +# functionality needed to use WEP is available in the current wpa_supplicant +# release under this optional build parameter. This functionality is subject to +# be completely removed in a future release. +#CONFIG_WEP=y + +# Remove all TKIP functionality +# TKIP is an old cryptographic data confidentiality algorithm that is not +# considered secure. It should not be used anymore for anything else than a +# backwards compatibility option as a group cipher when connecting to APs that +# use WPA+WPA2 mixed mode. For now, the default wpa_supplicant build includes +# support for this by default, but that functionality is subject to be removed +# in the future. +#CONFIG_NO_TKIP=y + +# Pre-Association Security Negotiation (PASN) +# Experimental implementation based on IEEE P802.11z/D2.6 and the protocol +# design is still subject to change. As such, this should not yet be enabled in +# production use. +#CONFIG_PASN=y # uBus IPC/RPC System # Services can connect to the bus and provide methods diff --git a/package/network/services/hostapd/patches/011-mesh-use-deterministic-channel-on-channel-switch.patch b/package/network/services/hostapd/patches/011-mesh-use-deterministic-channel-on-channel-switch.patch index bfc30e2842b528..869a659b0503a9 100644 --- a/package/network/services/hostapd/patches/011-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 chan_idx, num_available_chandefs); --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -11465,6 +11465,10 @@ static int nl80211_switch_channel(void * +@@ -11463,6 +11463,10 @@ static int nl80211_switch_channel(void * if (ret) goto error; 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 index b5551f50e60db0..2dc44be5899cc9 100644 --- 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 @@ -4,7 +4,7 @@ Subject: [PATCH] fix adding back stations after a missed deauth/disassoc --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c -@@ -4784,6 +4784,13 @@ static int add_associated_sta(struct hos +@@ -4782,6 +4782,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. @@ -18,7 +18,7 @@ Subject: [PATCH] fix adding back stations after a missed deauth/disassoc */ 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)", -@@ -4797,7 +4804,8 @@ static int add_associated_sta(struct hos +@@ -4795,7 +4802,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) && diff --git a/package/network/services/hostapd/patches/050-Fix-OpenWrt-13156.patch b/package/network/services/hostapd/patches/050-Fix-OpenWrt-13156.patch index 2492e480fb5977..0306a81cc10b58 100644 --- a/package/network/services/hostapd/patches/050-Fix-OpenWrt-13156.patch +++ b/package/network/services/hostapd/patches/050-Fix-OpenWrt-13156.patch @@ -20,7 +20,7 @@ Signed-off-by: Stijn Tintel --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c -@@ -4055,6 +4055,8 @@ int hostapd_remove_iface(struct hapd_int +@@ -4017,6 +4017,8 @@ int hostapd_remove_iface(struct hapd_int void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta, int reassoc) { @@ -29,7 +29,7 @@ Signed-off-by: Stijn Tintel if (hapd->tkip_countermeasures) { hostapd_drv_sta_deauth(hapd, sta->addr, WLAN_REASON_MICHAEL_MIC_FAILURE); -@@ -4062,10 +4064,16 @@ void hostapd_new_assoc_sta(struct hostap +@@ -4024,10 +4026,16 @@ void hostapd_new_assoc_sta(struct hostap } #ifdef CONFIG_IEEE80211BE diff --git a/package/network/services/hostapd/patches/051-nl80211-add-extra-ies-only-if-allowed-by-driver.patch b/package/network/services/hostapd/patches/051-nl80211-add-extra-ies-only-if-allowed-by-driver.patch index 46ee6234be6837..0d3fcd574d6eec 100644 --- a/package/network/services/hostapd/patches/051-nl80211-add-extra-ies-only-if-allowed-by-driver.patch +++ b/package/network/services/hostapd/patches/051-nl80211-add-extra-ies-only-if-allowed-by-driver.patch @@ -26,7 +26,7 @@ Signed-off-by: David Bauer --- a/src/drivers/driver.h +++ b/src/drivers/driver.h -@@ -2390,6 +2390,9 @@ struct wpa_driver_capa { +@@ -2384,6 +2384,9 @@ struct wpa_driver_capa { /** Maximum number of iterations in a single scan plan */ u32 max_sched_scan_plan_iterations; diff --git a/package/network/services/hostapd/patches/140-tests-Makefile-make-run-tests-with-CONFIG_TLS.patch b/package/network/services/hostapd/patches/140-tests-Makefile-make-run-tests-with-CONFIG_TLS.patch index 6bc1b78bdadb82..fd6055d2911c88 100644 --- a/package/network/services/hostapd/patches/140-tests-Makefile-make-run-tests-with-CONFIG_TLS.patch +++ b/package/network/services/hostapd/patches/140-tests-Makefile-make-run-tests-with-CONFIG_TLS.patch @@ -979,7 +979,7 @@ Signed-off-by: Glenn Strauss raise HwsimSkip("Crypto library does not support Brainpool curves: " + tls) capa = dev.request("GET_CAPABILITY dpp") ver = 1 -@@ -3925,6 +3926,9 @@ def test_dpp_proto_auth_req_no_i_proto_k +@@ -3902,6 +3903,9 @@ def test_dpp_proto_auth_req_no_i_proto_k def test_dpp_proto_auth_req_invalid_i_proto_key(dev, apdev): """DPP protocol testing - invalid I-proto key in Auth Req""" @@ -989,7 +989,7 @@ Signed-off-by: Glenn Strauss run_dpp_proto_auth_req_missing(dev, 66, "Invalid Initiator Protocol Key") def test_dpp_proto_auth_req_no_i_nonce(dev, apdev): -@@ -4020,7 +4024,12 @@ def test_dpp_proto_auth_resp_no_r_proto_ +@@ -3997,7 +4001,12 @@ def test_dpp_proto_auth_resp_no_r_proto_ def test_dpp_proto_auth_resp_invalid_r_proto_key(dev, apdev): """DPP protocol testing - invalid R-Proto Key in Auth Resp""" @@ -1003,7 +1003,7 @@ Signed-off-by: Glenn Strauss def test_dpp_proto_auth_resp_no_r_nonce(dev, apdev): """DPP protocol testing - no R-nonce in Auth Resp""" -@@ -4382,11 +4391,17 @@ def test_dpp_proto_pkex_exchange_resp_in +@@ -4359,11 +4368,17 @@ def test_dpp_proto_pkex_exchange_resp_in def test_dpp_proto_pkex_cr_req_invalid_bootstrap_key(dev, apdev): """DPP protocol testing - invalid Bootstrap Key in PKEX Commit-Reveal Request""" diff --git a/package/network/services/hostapd/patches/150-add-NULL-checks-encountered-during-tests-hwsim.patch b/package/network/services/hostapd/patches/150-add-NULL-checks-encountered-during-tests-hwsim.patch index 78ed459ee6965e..c8c3ff33f42022 100644 --- a/package/network/services/hostapd/patches/150-add-NULL-checks-encountered-during-tests-hwsim.patch +++ b/package/network/services/hostapd/patches/150-add-NULL-checks-encountered-during-tests-hwsim.patch @@ -29,7 +29,7 @@ Signed-off-by: Glenn Strauss wpa_printf(MSG_DEBUG, "DPP: Generating a keypair"); --- a/src/common/sae.c +++ b/src/common/sae.c -@@ -1279,6 +1279,13 @@ void sae_deinit_pt(struct sae_pt *pt) +@@ -1278,6 +1278,13 @@ void sae_deinit_pt(struct sae_pt *pt) static int sae_derive_commit_element_ecc(struct sae_data *sae, struct crypto_bignum *mask) { diff --git a/package/network/services/hostapd/patches/170-hostapd-update-cfs0-and-cfs1-for-160MHz.patch b/package/network/services/hostapd/patches/170-hostapd-update-cfs0-and-cfs1-for-160MHz.patch index 0af7a379bcb222..e2fe06e4a2b71a 100644 --- a/package/network/services/hostapd/patches/170-hostapd-update-cfs0-and-cfs1-for-160MHz.patch +++ b/package/network/services/hostapd/patches/170-hostapd-update-cfs0-and-cfs1-for-160MHz.patch @@ -40,7 +40,7 @@ Signed-off-by: P Praneesh #endif /* CONFIG_IEEE80211AC */ --- a/src/ap/ieee802_11_ht.c +++ b/src/ap/ieee802_11_ht.c -@@ -127,7 +127,9 @@ no_update: +@@ -82,7 +82,9 @@ u8 * hostapd_eid_ht_capabilities(struct u8 * hostapd_eid_ht_operation(struct hostapd_data *hapd, u8 *eid) { struct ieee80211_ht_operation *oper; @@ -50,9 +50,9 @@ Signed-off-by: P Praneesh if (!hapd->iconf->ieee80211n || hapd->conf->disable_11n || is_6ghz_op_class(hapd->iconf->op_class)) -@@ -143,6 +145,13 @@ u8 * hostapd_eid_ht_operation(struct hos - oper->operation_mode = host_to_le16(hapd->iface->ht_op_mode); - set_ht_param(hapd, oper); +@@ -103,6 +105,13 @@ u8 * hostapd_eid_ht_operation(struct hos + oper->ht_param |= HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW | + HT_INFO_HT_PARAM_STA_CHNL_WIDTH; + vht_capabilities_info = host_to_le32(hapd->iface->current_mode->vht_capab); + chwidth = hostapd_get_oper_chwidth(hapd->iconf); @@ -130,7 +130,7 @@ Signed-off-by: P Praneesh #undef VHT_CAP_CHECK_MAX --- a/src/common/ieee802_11_defs.h +++ b/src/common/ieee802_11_defs.h -@@ -1401,6 +1401,8 @@ struct ieee80211_ampe_ie { +@@ -1400,6 +1400,8 @@ struct ieee80211_ampe_ie { #define VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB ((u32) BIT(26) | BIT(27)) #define VHT_CAP_RX_ANTENNA_PATTERN ((u32) BIT(28)) #define VHT_CAP_TX_ANTENNA_PATTERN ((u32) BIT(29)) diff --git a/package/network/services/hostapd/patches/200-multicall.patch b/package/network/services/hostapd/patches/200-multicall.patch index 80a484e974d25d..753fdb0849078f 100644 --- a/package/network/services/hostapd/patches/200-multicall.patch +++ b/package/network/services/hostapd/patches/200-multicall.patch @@ -83,7 +83,7 @@ This allows building both hostapd and wpa_supplicant as a single binary #ifdef CONFIG_WPS static int gen_uuid(const char *txt_addr) -@@ -817,6 +822,8 @@ int main(int argc, char *argv[]) +@@ -812,6 +817,8 @@ int main(int argc, char *argv[]) return -1; #endif /* CONFIG_DPP */ @@ -94,7 +94,7 @@ This allows building both hostapd and wpa_supplicant as a single binary if (c < 0) --- a/src/ap/drv_callbacks.c +++ b/src/ap/drv_callbacks.c -@@ -2520,8 +2520,8 @@ static void hostapd_mld_iface_disable(st +@@ -2514,8 +2514,8 @@ static void hostapd_mld_iface_disable(st #endif /* CONFIG_IEEE80211BE */ @@ -105,7 +105,7 @@ This allows building both hostapd and wpa_supplicant as a single binary { struct hostapd_data *hapd = ctx; struct sta_info *sta; -@@ -2879,7 +2879,7 @@ void wpa_supplicant_event(void *ctx, enu +@@ -2873,7 +2873,7 @@ void wpa_supplicant_event(void *ctx, enu } @@ -116,7 +116,7 @@ This allows building both hostapd and wpa_supplicant as a single binary struct hapd_interfaces *interfaces = ctx; --- a/src/drivers/driver.h +++ b/src/drivers/driver.h -@@ -6974,8 +6974,8 @@ union wpa_event_data { +@@ -6897,8 +6897,8 @@ union wpa_event_data { * Driver wrapper code should call this function whenever an event is received * from the driver. */ @@ -127,7 +127,7 @@ This allows building both hostapd and wpa_supplicant as a single binary /** * wpa_supplicant_event_global - Report a driver event for wpa_supplicant -@@ -6987,7 +6987,7 @@ void wpa_supplicant_event(void *ctx, enu +@@ -6910,7 +6910,7 @@ void wpa_supplicant_event(void *ctx, enu * Same as wpa_supplicant_event(), but we search for the interface in * wpa_global. */ @@ -278,8 +278,8 @@ This allows building both hostapd and wpa_supplicant as a single binary os_memset(&eapol_test, 0, sizeof(eapol_test)); --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c -@@ -6131,8 +6131,8 @@ static int wpas_pasn_auth(struct wpa_sup - #endif /* CONFIG_PASN */ +@@ -6099,8 +6099,8 @@ static void wpas_link_reconfig(struct wp + } -void wpa_supplicant_event(void *ctx, enum wpa_event_type event, @@ -289,7 +289,7 @@ This allows building both hostapd and wpa_supplicant as a single binary { struct wpa_supplicant *wpa_s = ctx; int resched; -@@ -7084,7 +7084,7 @@ void wpa_supplicant_event(void *ctx, enu +@@ -7052,7 +7052,7 @@ void wpa_supplicant_event(void *ctx, enu } diff --git a/package/network/services/hostapd/patches/211-ctrl-make-WNM_AP-functions-dependant-on-CONFIG_AP.patch b/package/network/services/hostapd/patches/211-ctrl-make-WNM_AP-functions-dependant-on-CONFIG_AP.patch index 38d4d1500a4347..475a50b87e5420 100644 --- a/package/network/services/hostapd/patches/211-ctrl-make-WNM_AP-functions-dependant-on-CONFIG_AP.patch +++ b/package/network/services/hostapd/patches/211-ctrl-make-WNM_AP-functions-dependant-on-CONFIG_AP.patch @@ -13,7 +13,7 @@ Signed-off-by: David Bauer --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c -@@ -13292,7 +13292,7 @@ char * wpa_supplicant_ctrl_iface_process +@@ -13233,7 +13233,7 @@ char * wpa_supplicant_ctrl_iface_process if (wpas_ctrl_iface_coloc_intf_report(wpa_s, buf + 18)) reply_len = -1; #endif /* CONFIG_WNM */ @@ -22,7 +22,7 @@ Signed-off-by: David Bauer } else if (os_strncmp(buf, "DISASSOC_IMMINENT ", 18) == 0) { if (ap_ctrl_iface_disassoc_imminent(wpa_s, buf + 18)) reply_len = -1; -@@ -13302,7 +13302,7 @@ char * wpa_supplicant_ctrl_iface_process +@@ -13243,7 +13243,7 @@ char * wpa_supplicant_ctrl_iface_process } else if (os_strncmp(buf, "BSS_TM_REQ ", 11) == 0) { if (ap_ctrl_iface_bss_tm_req(wpa_s, buf + 11)) reply_len = -1; diff --git a/package/network/services/hostapd/patches/220-indicate-features.patch b/package/network/services/hostapd/patches/220-indicate-features.patch index 13a5c38631d041..064e2dd626bd8b 100644 --- a/package/network/services/hostapd/patches/220-indicate-features.patch +++ b/package/network/services/hostapd/patches/220-indicate-features.patch @@ -15,7 +15,7 @@ Subject: [PATCH] hostapd: support optional argument for the -v switch of struct hapd_global { void **drv_priv; -@@ -825,7 +825,7 @@ int main(int argc, char *argv[]) +@@ -820,7 +820,7 @@ int main(int argc, char *argv[]) wpa_supplicant_event = hostapd_wpa_event; wpa_supplicant_event_global = hostapd_wpa_event_global; for (;;) { @@ -24,7 +24,7 @@ Subject: [PATCH] hostapd: support optional argument for the -v switch of if (c < 0) break; switch (c) { -@@ -862,6 +862,8 @@ int main(int argc, char *argv[]) +@@ -857,6 +857,8 @@ int main(int argc, char *argv[]) break; #endif /* CONFIG_DEBUG_LINUX_TRACING */ case 'v': diff --git a/package/network/services/hostapd/patches/250-hostapd_cli_ifdef.patch b/package/network/services/hostapd/patches/250-hostapd_cli_ifdef.patch index 90737b2ac0e9b6..58143020ce0a17 100644 --- a/package/network/services/hostapd/patches/250-hostapd_cli_ifdef.patch +++ b/package/network/services/hostapd/patches/250-hostapd_cli_ifdef.patch @@ -5,7 +5,7 @@ Subject: [PATCH] hostapd: support wps in hostapd_cli even when built from the --- a/hostapd/hostapd_cli.c +++ b/hostapd/hostapd_cli.c -@@ -409,7 +409,6 @@ static int hostapd_cli_cmd_disassociate( +@@ -401,7 +401,6 @@ static int hostapd_cli_cmd_disassociate( } @@ -13,7 +13,7 @@ Subject: [PATCH] hostapd: support wps in hostapd_cli even when built from the static int hostapd_cli_cmd_signature(struct wpa_ctrl *ctrl, int argc, char *argv[]) { -@@ -422,7 +421,6 @@ static int hostapd_cli_cmd_signature(str +@@ -414,7 +413,6 @@ static int hostapd_cli_cmd_signature(str os_snprintf(buf, sizeof(buf), "SIGNATURE %s", argv[0]); return wpa_ctrl_command(ctrl, buf); } @@ -21,7 +21,7 @@ Subject: [PATCH] hostapd: support wps in hostapd_cli even when built from the static int hostapd_cli_cmd_sa_query(struct wpa_ctrl *ctrl, int argc, -@@ -439,7 +437,6 @@ static int hostapd_cli_cmd_sa_query(stru +@@ -431,7 +429,6 @@ static int hostapd_cli_cmd_sa_query(stru } @@ -29,7 +29,7 @@ Subject: [PATCH] hostapd: support wps in hostapd_cli even when built from the static int hostapd_cli_cmd_wps_pin(struct wpa_ctrl *ctrl, int argc, char *argv[]) { -@@ -665,7 +662,6 @@ static int hostapd_cli_cmd_wps_config(st +@@ -657,7 +654,6 @@ static int hostapd_cli_cmd_wps_config(st ssid_hex, argv[1]); return wpa_ctrl_command(ctrl, buf); } @@ -37,7 +37,7 @@ Subject: [PATCH] hostapd: support wps in hostapd_cli even when built from the static int hostapd_cli_cmd_disassoc_imminent(struct wpa_ctrl *ctrl, int argc, -@@ -1694,13 +1690,10 @@ static const struct hostapd_cli_cmd host +@@ -1686,13 +1682,10 @@ static const struct hostapd_cli_cmd host { "disassociate", hostapd_cli_cmd_disassociate, hostapd_complete_stations, " = disassociate a station" }, @@ -51,7 +51,7 @@ Subject: [PATCH] hostapd: support wps in hostapd_cli even when built from the { "wps_pin", hostapd_cli_cmd_wps_pin, NULL, " [timeout] [addr] = add WPS Enrollee PIN" }, { "wps_check_pin", hostapd_cli_cmd_wps_check_pin, NULL, -@@ -1725,7 +1718,6 @@ static const struct hostapd_cli_cmd host +@@ -1717,7 +1710,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/252-disable_ctrl_iface_mib.patch b/package/network/services/hostapd/patches/252-disable_ctrl_iface_mib.patch index 0801a93bcd6ed7..0110e08d63778f 100644 --- a/package/network/services/hostapd/patches/252-disable_ctrl_iface_mib.patch +++ b/package/network/services/hostapd/patches/252-disable_ctrl_iface_mib.patch @@ -16,7 +16,7 @@ Subject: [PATCH] Remove some unnecessary control interface functionality else --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c -@@ -4057,6 +4057,7 @@ static int hostapd_ctrl_iface_receive_pr +@@ -4045,6 +4045,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); @@ -24,7 +24,7 @@ Subject: [PATCH] Remove some unnecessary control interface functionality } else if (os_strcmp(buf, "MIB") == 0) { reply_len = ieee802_11_get_mib(hapd, reply, reply_size); if (reply_len >= 0) { -@@ -4098,6 +4099,7 @@ static int hostapd_ctrl_iface_receive_pr +@@ -4086,6 +4087,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); @@ -113,7 +113,7 @@ Subject: [PATCH] Remove some unnecessary control interface functionality if (os_snprintf_error(buflen - len, ret)) --- a/src/ap/ieee802_1x.c +++ b/src/ap/ieee802_1x.c -@@ -2869,6 +2869,7 @@ static const char * bool_txt(bool val) +@@ -2848,6 +2848,7 @@ static const char * bool_txt(bool val) return val ? "TRUE" : "FALSE"; } @@ -121,7 +121,7 @@ Subject: [PATCH] Remove some unnecessary control interface functionality int ieee802_1x_get_mib(struct hostapd_data *hapd, char *buf, size_t buflen) { -@@ -3055,6 +3056,7 @@ int ieee802_1x_get_mib_sta(struct hostap +@@ -3034,6 +3035,7 @@ int ieee802_1x_get_mib_sta(struct hostap return len; } @@ -131,7 +131,7 @@ Subject: [PATCH] Remove some unnecessary control interface functionality 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 -@@ -6141,6 +6141,7 @@ static const char * wpa_bool_txt(int val +@@ -6129,6 +6129,7 @@ static const char * wpa_bool_txt(int val return val ? "TRUE" : "FALSE"; } @@ -139,7 +139,7 @@ Subject: [PATCH] Remove some unnecessary control interface functionality #define RSN_SUITE "%02x-%02x-%02x-%d" #define RSN_SUITE_ARG(s) \ -@@ -6293,7 +6294,7 @@ int wpa_get_mib_sta(struct wpa_state_mac +@@ -6281,7 +6282,7 @@ int wpa_get_mib_sta(struct wpa_state_mac return len; } @@ -201,7 +201,7 @@ Subject: [PATCH] Remove some unnecessary control interface functionality if (wpa_s->ap_iface) { pos += ap_ctrl_iface_wpa_get_status(wpa_s, pos, end - pos, -@@ -12620,6 +12620,7 @@ char * wpa_supplicant_ctrl_iface_process +@@ -12561,6 +12561,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); @@ -209,7 +209,7 @@ Subject: [PATCH] Remove some unnecessary control interface functionality } else if (os_strcmp(buf, "MIB") == 0) { reply_len = wpa_sm_get_mib(wpa_s->wpa, reply, reply_size); if (reply_len >= 0) { -@@ -12632,6 +12633,7 @@ char * wpa_supplicant_ctrl_iface_process +@@ -12573,6 +12574,7 @@ char * wpa_supplicant_ctrl_iface_process reply_size - reply_len); #endif /* CONFIG_MACSEC */ } @@ -217,7 +217,7 @@ Subject: [PATCH] Remove some unnecessary control interface functionality } else if (os_strncmp(buf, "STATUS", 6) == 0) { reply_len = wpa_supplicant_ctrl_iface_status( wpa_s, buf + 6, reply, reply_size); -@@ -13120,6 +13122,7 @@ char * wpa_supplicant_ctrl_iface_process +@@ -13061,6 +13063,7 @@ char * wpa_supplicant_ctrl_iface_process reply_len = wpa_supplicant_ctrl_iface_bss( wpa_s, buf + 4, reply, reply_size); #ifdef CONFIG_AP @@ -225,7 +225,7 @@ Subject: [PATCH] Remove some unnecessary control interface functionality } 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) { -@@ -13128,12 +13131,15 @@ char * wpa_supplicant_ctrl_iface_process +@@ -13069,12 +13072,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); diff --git a/package/network/services/hostapd/patches/300-noscan.patch b/package/network/services/hostapd/patches/300-noscan.patch index 6deb2722b37198..f208b2937d02d3 100644 --- a/package/network/services/hostapd/patches/300-noscan.patch +++ b/package/network/services/hostapd/patches/300-noscan.patch @@ -41,7 +41,7 @@ Subject: [PATCH] Add noscan, no_ht_coex config options hostapd_set_state(iface, HAPD_IFACE_HT_SCAN); --- a/src/ap/ieee802_11_ht.c +++ b/src/ap/ieee802_11_ht.c -@@ -279,6 +279,9 @@ void hostapd_2040_coex_action(struct hos +@@ -239,6 +239,9 @@ void hostapd_2040_coex_action(struct hos return; } @@ -51,7 +51,7 @@ Subject: [PATCH] Add noscan, no_ht_coex config options if (len < IEEE80211_HDRLEN + 2 + sizeof(*bc_ie)) { wpa_printf(MSG_DEBUG, "Ignore too short 20/40 BSS Coexistence Management frame"); -@@ -439,6 +442,9 @@ void ht40_intolerant_add(struct hostapd_ +@@ -399,6 +402,9 @@ void ht40_intolerant_add(struct hostapd_ if (iface->current_mode->mode != HOSTAPD_MODE_IEEE80211G) return; 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 e757a6df00527c..bcc39ea758646b 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 @@ -5,7 +5,7 @@ Subject: [PATCH] nl80211_fix_set_freq.patch --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -5512,7 +5512,7 @@ static int nl80211_set_channel(struct i8 +@@ -5510,7 +5510,7 @@ static int nl80211_set_channel(struct i8 freq->he_enabled, freq->eht_enabled, freq->bandwidth, freq->center_freq1, freq->center_freq2); 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 c3b3ded908cc82..8b8434773888ea 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 @@ -4,7 +4,7 @@ Subject: [PATCH] nl80211_del_beacon_bss.patch --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -6253,8 +6253,7 @@ static void nl80211_teardown_ap(struct i +@@ -6251,8 +6251,7 @@ static void nl80211_teardown_ap(struct i nl80211_mgmt_unsubscribe(bss, "AP teardown"); nl80211_put_wiphy_data_ap(bss); diff --git a/package/network/services/hostapd/patches/381-hostapd_cli_UNKNOWN-COMMAND.patch b/package/network/services/hostapd/patches/381-hostapd_cli_UNKNOWN-COMMAND.patch index 29026ac9d1c0a9..e68edacb44062c 100644 --- a/package/network/services/hostapd/patches/381-hostapd_cli_UNKNOWN-COMMAND.patch +++ b/package/network/services/hostapd/patches/381-hostapd_cli_UNKNOWN-COMMAND.patch @@ -11,7 +11,7 @@ if CONFIG_CTRL_IFACE_MIB is not defined. --- a/hostapd/hostapd_cli.c +++ b/hostapd/hostapd_cli.c -@@ -761,7 +761,7 @@ static int wpa_ctrl_command_sta(struct w +@@ -753,7 +753,7 @@ static int wpa_ctrl_command_sta(struct w } buf[len] = '\0'; 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 cc7b1317872f41..4003793a707a4e 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 @@ -14,7 +14,7 @@ Signed-hostap: Antonio Quartulli --- a/src/drivers/driver.h +++ b/src/drivers/driver.h -@@ -1004,6 +1004,9 @@ struct wpa_driver_associate_params { +@@ -1000,6 +1000,9 @@ struct wpa_driver_associate_params { * responsible for selecting with which BSS to associate. */ const u8 *bssid; 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 80ccb1c2071b46..3cd2949e11f3b3 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,7 +19,7 @@ Tested-by: Simon Wunderlich --- a/src/drivers/driver.h +++ b/src/drivers/driver.h -@@ -1920,6 +1920,7 @@ struct wpa_driver_mesh_join_params { +@@ -1916,6 +1916,7 @@ struct wpa_driver_mesh_join_params { #define WPA_DRIVER_MESH_FLAG_AMPE 0x00000008 unsigned int flags; bool handle_dfs; @@ -29,7 +29,7 @@ Tested-by: Simon Wunderlich struct wpa_driver_set_key_params { --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -12142,6 +12142,18 @@ static int nl80211_put_mesh_id(struct nl +@@ -12140,6 +12140,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) { -@@ -12203,6 +12215,7 @@ static int nl80211_join_mesh(struct i802 +@@ -12201,6 +12213,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) || diff --git a/package/network/services/hostapd/patches/590-rrm-wnm-statistics.patch b/package/network/services/hostapd/patches/590-rrm-wnm-statistics.patch index be09ed319c9663..2f66fb36b302ff 100644 --- a/package/network/services/hostapd/patches/590-rrm-wnm-statistics.patch +++ b/package/network/services/hostapd/patches/590-rrm-wnm-statistics.patch @@ -10,7 +10,7 @@ method. --- a/src/ap/hostapd.h +++ b/src/ap/hostapd.h -@@ -185,6 +185,21 @@ struct mld_link_info { +@@ -183,6 +183,21 @@ struct mld_link_info { }; /** @@ -32,7 +32,7 @@ method. * struct hostapd_data - hostapd per-BSS data structure */ struct hostapd_data { -@@ -198,6 +213,9 @@ struct hostapd_data { +@@ -196,6 +211,9 @@ struct hostapd_data { u8 own_addr[ETH_ALEN]; diff --git a/package/network/services/hostapd/patches/600-ubus_support.patch b/package/network/services/hostapd/patches/600-ubus_support.patch index fb3bfb012030bd..b864cd9a13aebb 100644 --- a/package/network/services/hostapd/patches/600-ubus_support.patch +++ b/package/network/services/hostapd/patches/600-ubus_support.patch @@ -92,7 +92,7 @@ probe/assoc/auth requests via object subscribe. return 0; --- a/src/ap/drv_callbacks.c +++ b/src/ap/drv_callbacks.c -@@ -317,6 +317,10 @@ int hostapd_notif_assoc(struct hostapd_d +@@ -316,6 +316,10 @@ int hostapd_notif_assoc(struct hostapd_d struct hostapd_iface *iface = hapd->iface; #endif /* CONFIG_OWE */ bool updated = false; @@ -103,7 +103,7 @@ probe/assoc/auth requests via object subscribe. if (addr == NULL) { /* -@@ -461,6 +465,12 @@ int hostapd_notif_assoc(struct hostapd_d +@@ -460,6 +464,12 @@ int hostapd_notif_assoc(struct hostapd_d goto fail; } @@ -135,7 +135,7 @@ probe/assoc/auth requests via object subscribe. return 0; } -@@ -2525,6 +2528,7 @@ static int hostapd_setup_interface_compl +@@ -2497,6 +2500,7 @@ static int hostapd_setup_interface_compl if (err) goto fail; @@ -143,7 +143,7 @@ probe/assoc/auth requests via object subscribe. wpa_printf(MSG_DEBUG, "Completing interface initialization"); if (iface->freq) { #ifdef NEED_AP_MLME -@@ -2750,6 +2754,7 @@ dfs_offload: +@@ -2722,6 +2726,7 @@ dfs_offload: fail: wpa_printf(MSG_ERROR, "Interface initialization failed"); @@ -151,7 +151,7 @@ probe/assoc/auth requests via object subscribe. if (iface->is_no_ir) { hostapd_set_state(iface, HAPD_IFACE_NO_IR); -@@ -3478,6 +3483,7 @@ void hostapd_interface_deinit_free(struc +@@ -3440,6 +3445,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; @@ -169,7 +169,7 @@ probe/assoc/auth requests via object subscribe. #define OCE_STA_CFON_ENABLED(hapd) \ ((hapd->conf->oce & OCE_STA_CFON) && \ -@@ -206,6 +207,7 @@ struct hostapd_data { +@@ -204,6 +205,7 @@ struct hostapd_data { struct hostapd_iface *iface; struct hostapd_config *iconf; struct hostapd_bss_config *conf; @@ -177,7 +177,7 @@ probe/assoc/auth requests via object subscribe. int interface_added; /* virtual interface added for this BSS */ unsigned int started:1; unsigned int disabled:1; -@@ -776,6 +778,7 @@ hostapd_alloc_bss_data(struct hostapd_if +@@ -766,6 +768,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); @@ -187,7 +187,7 @@ probe/assoc/auth requests via object subscribe. struct hostapd_iface * hostapd_alloc_iface(void); --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c -@@ -2897,7 +2897,7 @@ static void handle_auth(struct hostapd_d +@@ -2895,7 +2895,7 @@ static void handle_auth(struct hostapd_d u16 auth_alg, auth_transaction, status_code; u16 resp = WLAN_STATUS_SUCCESS; struct sta_info *sta = NULL; @@ -196,7 +196,7 @@ probe/assoc/auth requests via object subscribe. u16 fc; const u8 *challenge = NULL; u8 resp_ies[2 + WLAN_AUTH_CHALLENGE_LEN]; -@@ -2908,6 +2908,11 @@ static void handle_auth(struct hostapd_d +@@ -2906,6 +2906,11 @@ static void handle_auth(struct hostapd_d #ifdef CONFIG_IEEE80211BE bool mld_sta = false; #endif /* CONFIG_IEEE80211BE */ @@ -208,7 +208,7 @@ probe/assoc/auth requests via object subscribe. if (len < IEEE80211_HDRLEN + sizeof(mgmt->u.auth)) { wpa_printf(MSG_INFO, "handle_auth - too short payload (len=%lu)", -@@ -3104,6 +3109,13 @@ static void handle_auth(struct hostapd_d +@@ -3102,6 +3107,13 @@ static void handle_auth(struct hostapd_d resp = WLAN_STATUS_UNSPECIFIED_FAILURE; goto fail; } @@ -222,7 +222,7 @@ probe/assoc/auth requests via object subscribe. if (res == HOSTAPD_ACL_PENDING) return; -@@ -5367,7 +5379,7 @@ static void handle_assoc(struct hostapd_ +@@ -5365,7 +5377,7 @@ static void handle_assoc(struct hostapd_ int resp = WLAN_STATUS_SUCCESS; u16 reply_res = WLAN_STATUS_UNSPECIFIED_FAILURE; const u8 *pos; @@ -231,7 +231,7 @@ probe/assoc/auth requests via object subscribe. struct sta_info *sta; u8 *tmp = NULL; #ifdef CONFIG_FILS -@@ -5609,6 +5621,11 @@ static void handle_assoc(struct hostapd_ +@@ -5607,6 +5619,11 @@ static void handle_assoc(struct hostapd_ left = res; } #endif /* CONFIG_FILS */ @@ -243,7 +243,7 @@ probe/assoc/auth requests via object subscribe. /* followed by SSID and Supported rates; and HT capabilities if 802.11n * is used */ -@@ -5711,6 +5728,13 @@ static void handle_assoc(struct hostapd_ +@@ -5709,6 +5726,13 @@ static void handle_assoc(struct hostapd_ if (set_beacon) ieee802_11_update_beacons(hapd->iface); @@ -257,7 +257,7 @@ probe/assoc/auth requests via object subscribe. fail: /* -@@ -5940,6 +5964,7 @@ static void handle_disassoc(struct hosta +@@ -5938,6 +5962,7 @@ static void handle_disassoc(struct hosta (unsigned long) len); return; } @@ -265,7 +265,7 @@ probe/assoc/auth requests via object subscribe. sta = ap_get_sta(hapd, mgmt->sa); if (!sta) { -@@ -5971,6 +5996,8 @@ static void handle_deauth(struct hostapd +@@ -5969,6 +5994,8 @@ static void handle_deauth(struct hostapd /* Clear the PTKSA cache entries for PASN */ ptksa_cache_flush(hapd->ptksa, mgmt->sa, WPA_CIPHER_NONE); @@ -286,15 +286,16 @@ probe/assoc/auth requests via object subscribe. } -@@ -406,7 +409,7 @@ void hostapd_handle_radio_measurement(st - hostapd_handle_nei_report_req(hapd, buf, len); - break; - case WLAN_RRM_LINK_MEASUREMENT_REPORT: -- hostapd_handle_link_mesr_report(hapd, buf, len); +@@ -399,6 +402,9 @@ void hostapd_handle_radio_measurement(st + mgmt->u.action.u.rrm.action, MAC2STR(mgmt->sa)); + + switch (mgmt->u.action.u.rrm.action) { ++ case WLAN_RRM_LINK_MEASUREMENT_REPORT: + hostapd_ubus_handle_link_measurement(hapd, buf, len); ++ break; + case WLAN_RRM_RADIO_MEASUREMENT_REPORT: + hostapd_handle_radio_msmt_report(hapd, buf, len); break; - default: - wpa_printf(MSG_DEBUG, "RRM action %u is not supported", --- a/src/ap/sta_info.c +++ b/src/ap/sta_info.c @@ -542,6 +542,7 @@ void ap_handle_timer(void *eloop_ctx, vo diff --git a/package/network/services/hostapd/patches/601-ucode_support.patch b/package/network/services/hostapd/patches/601-ucode_support.patch index 737966201491f1..1a824a167b8ab4 100644 --- a/package/network/services/hostapd/patches/601-ucode_support.patch +++ b/package/network/services/hostapd/patches/601-ucode_support.patch @@ -34,7 +34,7 @@ as adding/removing interfaces. ifdef CONFIG_CODE_COVERAGE --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c -@@ -5998,6 +5998,7 @@ try_again: +@@ -5643,6 +5643,7 @@ try_again: return -1; } @@ -42,7 +42,7 @@ as adding/removing interfaces. wpa_msg_register_cb(hostapd_ctrl_iface_msg_cb); return 0; -@@ -6099,6 +6100,7 @@ fail: +@@ -5744,6 +5745,7 @@ fail: os_free(fname); interface->global_ctrl_sock = s; @@ -52,7 +52,7 @@ as adding/removing interfaces. --- a/hostapd/main.c +++ b/hostapd/main.c -@@ -1033,6 +1033,7 @@ int main(int argc, char *argv[]) +@@ -1028,6 +1028,7 @@ int main(int argc, char *argv[]) } hostapd_global_ctrl_iface_init(&interfaces); @@ -60,7 +60,7 @@ as adding/removing interfaces. if (hostapd_global_run(&interfaces, daemonize, pid_file)) { wpa_printf(MSG_ERROR, "Failed to start eloop"); -@@ -1042,6 +1043,7 @@ int main(int argc, char *argv[]) +@@ -1037,6 +1038,7 @@ int main(int argc, char *argv[]) ret = 0; out: @@ -70,7 +70,7 @@ as adding/removing interfaces. for (i = 0; i < interfaces.count; i++) { --- a/src/ap/ap_drv_ops.h +++ b/src/ap/ap_drv_ops.h -@@ -409,6 +409,23 @@ static inline int hostapd_drv_stop_ap(st +@@ -404,6 +404,23 @@ static inline int hostapd_drv_stop_ap(st return hapd->driver->stop_ap(hapd->drv_priv, link_id); } @@ -139,7 +139,7 @@ as adding/removing interfaces. { struct hostapd_bss_config *conf = hapd->conf; u8 ssid[SSID_MAX_LEN + 1]; -@@ -2954,7 +2958,7 @@ hostapd_alloc_bss_data(struct hostapd_if +@@ -2926,7 +2930,7 @@ hostapd_alloc_bss_data(struct hostapd_if } @@ -148,7 +148,7 @@ as adding/removing interfaces. { if (!hapd) return; -@@ -4015,7 +4019,8 @@ int hostapd_remove_iface(struct hapd_int +@@ -3977,7 +3981,8 @@ int hostapd_remove_iface(struct hapd_int hapd_iface = interfaces->iface[i]; if (hapd_iface == NULL) return -1; @@ -179,7 +179,7 @@ as adding/removing interfaces. int (*for_each_interface)(struct hapd_interfaces *interfaces, int (*cb)(struct hostapd_iface *iface, void *ctx), void *ctx); -@@ -208,6 +213,7 @@ struct hostapd_data { +@@ -206,6 +211,7 @@ struct hostapd_data { struct hostapd_config *iconf; struct hostapd_bss_config *conf; struct hostapd_ubus_bss ubus; @@ -187,7 +187,7 @@ as adding/removing interfaces. int interface_added; /* virtual interface added for this BSS */ unsigned int started:1; unsigned int disabled:1; -@@ -577,6 +583,7 @@ struct hostapd_mld { +@@ -567,6 +573,7 @@ struct hostapd_mld { */ struct hostapd_iface { struct hapd_interfaces *interfaces; @@ -195,7 +195,7 @@ as adding/removing interfaces. void *owner; char *config_fname; struct hostapd_config *conf; -@@ -787,6 +794,8 @@ struct hostapd_iface * hostapd_init(stru +@@ -777,6 +784,8 @@ struct hostapd_iface * hostapd_init(stru struct hostapd_iface * hostapd_interface_init_bss(struct hapd_interfaces *interfaces, const char *phy, const char *config_fname, int debug); @@ -206,7 +206,7 @@ as adding/removing interfaces. void hostapd_interface_deinit_free(struct hostapd_iface *iface); --- a/src/drivers/driver.h +++ b/src/drivers/driver.h -@@ -3928,6 +3928,25 @@ struct wpa_driver_ops { +@@ -3922,6 +3922,25 @@ struct wpa_driver_ops { const char *ifname); /** @@ -232,7 +232,7 @@ as adding/removing interfaces. * set_sta_vlan - Bind a station into a specific interface (AP only) * @priv: Private driver interface data * @ifname: Interface (main or virtual BSS or VLAN) -@@ -6720,6 +6739,7 @@ union wpa_event_data { +@@ -6643,6 +6662,7 @@ union wpa_event_data { /** * struct ch_switch @@ -240,7 +240,7 @@ as adding/removing interfaces. * @freq: Frequency of new channel in MHz * @ht_enabled: Whether this is an HT channel * @ch_offset: Secondary channel offset -@@ -6730,6 +6750,7 @@ union wpa_event_data { +@@ -6653,6 +6673,7 @@ union wpa_event_data { * @punct_bitmap: Puncturing bitmap */ struct ch_switch { @@ -250,7 +250,7 @@ as adding/removing interfaces. int ch_offset; --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -77,6 +77,16 @@ enum nlmsgerr_attrs { +@@ -75,6 +75,16 @@ enum nlmsgerr_attrs { #endif /* ANDROID */ @@ -267,7 +267,7 @@ as adding/removing interfaces. static struct nl_sock * nl_create_handle(struct nl_cb *cb, const char *dbg) { -@@ -431,6 +441,11 @@ static int no_seq_check(struct nl_msg *m +@@ -429,6 +439,11 @@ static int no_seq_check(struct nl_msg *m return NL_OK; } @@ -279,7 +279,7 @@ as adding/removing interfaces. static void nl80211_nlmsg_clear(struct nl_msg *msg) { -@@ -504,6 +519,8 @@ int send_and_recv(struct nl80211_global +@@ -502,6 +517,8 @@ int send_and_recv(struct nl80211_global if (!msg) return -ENOMEM; @@ -288,7 +288,7 @@ as adding/removing interfaces. err.err = -ENOMEM; s_nl_cb = nl_socket_get_cb(nl_handle); -@@ -538,6 +555,7 @@ int send_and_recv(struct nl80211_global +@@ -536,6 +553,7 @@ int send_and_recv(struct nl80211_global err.orig_msg = msg; err.err_info = err_info; @@ -296,7 +296,7 @@ as adding/removing interfaces. nl_cb_err(cb, NL_CB_CUSTOM, error_handler, &err); nl_cb_set(cb, NL_CB_FINISH, NL_CB_CUSTOM, finish_handler, &err.err); if (ack_handler_custom) { -@@ -941,6 +959,7 @@ nl80211_get_wiphy_data_ap(struct i802_bs +@@ -939,6 +957,7 @@ nl80211_get_wiphy_data_ap(struct i802_bs os_free(w); return NULL; } @@ -304,7 +304,7 @@ as adding/removing interfaces. nl_cb_set(w->nl_cb, NL_CB_SEQ_CHECK, NL_CB_CUSTOM, no_seq_check, NULL); nl_cb_set(w->nl_cb, NL_CB_VALID, NL_CB_CUSTOM, -@@ -1355,7 +1374,7 @@ static void wpa_driver_nl80211_event_rtm +@@ -1353,7 +1372,7 @@ static void wpa_driver_nl80211_event_rtm } wpa_printf(MSG_DEBUG, "nl80211: Interface down (%s/%s)", namebuf, ifname); @@ -313,7 +313,7 @@ as adding/removing interfaces. wpa_printf(MSG_DEBUG, "nl80211: Not the main interface (%s) - do not indicate interface down", drv->first_bss->ifname); -@@ -1391,7 +1410,7 @@ static void wpa_driver_nl80211_event_rtm +@@ -1389,7 +1408,7 @@ static void wpa_driver_nl80211_event_rtm } wpa_printf(MSG_DEBUG, "nl80211: Interface up (%s/%s)", namebuf, ifname); @@ -322,7 +322,7 @@ as adding/removing interfaces. wpa_printf(MSG_DEBUG, "nl80211: Not the main interface (%s) - do not indicate interface up", drv->first_bss->ifname); -@@ -2037,6 +2056,7 @@ static int wpa_driver_nl80211_init_nl_gl +@@ -2035,6 +2054,7 @@ static int wpa_driver_nl80211_init_nl_gl genl_family_put(family); nl_cache_free(cache); @@ -330,7 +330,7 @@ as adding/removing interfaces. nl_cb_set(global->nl_cb, NL_CB_SEQ_CHECK, NL_CB_CUSTOM, no_seq_check, NULL); nl_cb_set(global->nl_cb, NL_CB_VALID, NL_CB_CUSTOM, -@@ -2207,6 +2227,7 @@ static int nl80211_init_bss(struct i802_ +@@ -2205,6 +2225,7 @@ static int nl80211_init_bss(struct i802_ if (!bss->nl_cb) return -1; @@ -338,7 +338,7 @@ as adding/removing interfaces. nl_cb_set(bss->nl_cb, NL_CB_SEQ_CHECK, NL_CB_CUSTOM, no_seq_check, NULL); nl_cb_set(bss->nl_cb, NL_CB_VALID, NL_CB_CUSTOM, -@@ -8704,6 +8725,7 @@ static void *i802_init(struct hostapd_da +@@ -8702,6 +8723,7 @@ static void *i802_init(struct hostapd_da char master_ifname[IFNAMSIZ]; int ifindex, br_ifindex = 0; int br_added = 0; @@ -346,7 +346,7 @@ as adding/removing interfaces. bss = wpa_driver_nl80211_drv_init(hapd, params->ifname, params->global_priv, 1, -@@ -8763,21 +8785,17 @@ static void *i802_init(struct hostapd_da +@@ -8761,21 +8783,17 @@ static void *i802_init(struct hostapd_da (params->num_bridge == 0 || !params->bridge[0])) add_ifidx(drv, br_ifindex, drv->ifindex); @@ -378,7 +378,7 @@ as adding/removing interfaces. } if (drv->capa.flags2 & WPA_DRIVER_FLAGS2_CONTROL_PORT_RX) { -@@ -9146,6 +9164,50 @@ static int wpa_driver_nl80211_if_remove( +@@ -9144,6 +9162,50 @@ static int wpa_driver_nl80211_if_remove( return 0; } @@ -429,7 +429,7 @@ as adding/removing interfaces. static int cookie_handler(struct nl_msg *msg, void *arg) { -@@ -10962,6 +11024,37 @@ static bool nl80211_is_drv_shared(void * +@@ -10960,6 +11022,37 @@ static bool nl80211_is_drv_shared(void * #endif /* CONFIG_IEEE80211BE */ @@ -467,7 +467,7 @@ as adding/removing interfaces. static int driver_nl80211_send_mlme(void *priv, const u8 *data, size_t data_len, int noack, unsigned int freq, -@@ -14510,6 +14603,8 @@ const struct wpa_driver_ops wpa_driver_n +@@ -14210,6 +14303,8 @@ const struct wpa_driver_ops wpa_driver_n .set_acl = wpa_driver_nl80211_set_acl, .if_add = wpa_driver_nl80211_if_add, .if_remove = driver_nl80211_if_remove, @@ -596,7 +596,7 @@ as adding/removing interfaces. CFLAGS += -DEAP_SERVER -DEAP_SERVER_IDENTITY --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c -@@ -6167,6 +6167,7 @@ void supplicant_event(void *ctx, enum wp +@@ -6135,6 +6135,7 @@ void supplicant_event(void *ctx, enum wp event_to_string(event), event); #endif /* CONFIG_NO_STDOUT_DEBUG */ 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 index f0e838bf2f3acc..012efa4286be6f 100644 --- a/package/network/services/hostapd/patches/720-iface_max_num_sta.patch +++ b/package/network/services/hostapd/patches/720-iface_max_num_sta.patch @@ -79,7 +79,7 @@ full device, e.g. in order to deal with hardware/driver limitations { --- a/src/ap/hostapd.h +++ b/src/ap/hostapd.h -@@ -825,6 +825,7 @@ void hostapd_cleanup_cs_params(struct ho +@@ -815,6 +815,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); diff --git a/package/network/services/hostapd/patches/740-snoop_iface.patch b/package/network/services/hostapd/patches/740-snoop_iface.patch index 3c59865f8472c7..3aea451c62fac4 100644 --- a/package/network/services/hostapd/patches/740-snoop_iface.patch +++ b/package/network/services/hostapd/patches/740-snoop_iface.patch @@ -29,7 +29,7 @@ untagged DHCP packets int bridge_hairpin; /* hairpin_mode on bridge members */ --- a/src/ap/ap_drv_ops.h +++ b/src/ap/ap_drv_ops.h -@@ -376,12 +376,12 @@ static inline int hostapd_drv_br_port_se +@@ -371,12 +371,12 @@ static inline int hostapd_drv_br_port_se static inline int hostapd_drv_br_set_net_param(struct hostapd_data *hapd, enum drv_br_net_param param, @@ -112,7 +112,7 @@ untagged DHCP packets hapd->x_snoop_initialized = false; --- a/src/drivers/driver.h +++ b/src/drivers/driver.h -@@ -4350,7 +4350,7 @@ struct wpa_driver_ops { +@@ -4344,7 +4344,7 @@ struct wpa_driver_ops { * Returns: 0 on success, negative (<0) on failure */ int (*br_set_net_param)(void *priv, enum drv_br_net_param param, @@ -123,7 +123,7 @@ untagged DHCP packets * get_wowlan - Get wake-on-wireless status --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -12662,7 +12662,7 @@ static const char * drv_br_net_param_str +@@ -12660,7 +12660,7 @@ static const char * drv_br_net_param_str static int wpa_driver_br_set_net_param(void *priv, enum drv_br_net_param param, @@ -132,7 +132,7 @@ untagged DHCP packets { struct i802_bss *bss = priv; char path[128]; -@@ -12688,8 +12688,11 @@ static int wpa_driver_br_set_net_param(v +@@ -12686,8 +12686,11 @@ static int wpa_driver_br_set_net_param(v return -EINVAL; } diff --git a/package/network/services/hostapd/patches/770-radius_server.patch b/package/network/services/hostapd/patches/770-radius_server.patch index c110a85e2e73f1..2068caacdcb946 100644 --- a/package/network/services/hostapd/patches/770-radius_server.patch +++ b/package/network/services/hostapd/patches/770-radius_server.patch @@ -29,7 +29,7 @@ handle reload. #ifndef CONFIG_NO_HOSTAPD_LOGGER static void hostapd_logger_cb(void *ctx, const u8 *addr, unsigned int module, -@@ -793,6 +794,11 @@ int main(int argc, char *argv[]) +@@ -792,6 +793,11 @@ int main(int argc, char *argv[]) if (os_program_init()) return -1; diff --git a/package/network/services/hostapd/patches/780-Implement-APuP-Access-Point-Micro-Peering.patch b/package/network/services/hostapd/patches/780-Implement-APuP-Access-Point-Micro-Peering.patch index 22bd7ad2634888..f2727a6feee25c 100644 --- a/package/network/services/hostapd/patches/780-Implement-APuP-Access-Point-Micro-Peering.patch +++ b/package/network/services/hostapd/patches/780-Implement-APuP-Access-Point-Micro-Peering.patch @@ -1,4 +1,4 @@ -From 806c84ac8e8f60eaec22772b627f85eb5ac13544 Mon Sep 17 00:00:00 2001 +From 40041ecea334c0106c0e840a32aef92b0cbb004b Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Mon, 6 May 2024 13:53:48 +0200 Subject: [PATCH 1/3] Implement APuP Access Point Micro Peering @@ -18,14 +18,11 @@ automatically if wds_bridge is not an empty string), or feeded to a routing daemon. Signed-off-by: Gioacchino Mazzurco -Reviewed-by: Hauke Mehrtens -Reviewed-by: Moritz Warning -Hotfix-by: Sebastian Gottschall https://github.com/mirror/dd-wrt/commit/0c3001a69e8d8300569e416de856c96e903ad130 --- hostapd/Makefile | 5 ++ hostapd/config_file.c | 9 +++ src/ap/ap_config.h | 29 +++++++ - src/ap/ap_drv_ops.c | 28 ++++++- + src/ap/ap_drv_ops.c | 26 ++++++ src/ap/ap_drv_ops.h | 3 + src/ap/apup.c | 152 +++++++++++++++++++++++++++++++++++ src/ap/apup.h | 24 ++++++ @@ -33,7 +30,7 @@ Hotfix-by: Sebastian Gottschall https://github.com/mirror/dd-wrt/commit/0c3001a6 src/ap/ieee802_11.h | 2 + src/drivers/driver.h | 2 +- src/drivers/driver_nl80211.c | 14 +--- - 11 files changed, 265 insertions(+), 17 deletions(-) + 11 files changed, 264 insertions(+), 16 deletions(-) create mode 100644 src/ap/apup.c create mode 100644 src/ap/apup.h @@ -109,7 +106,7 @@ Hotfix-by: Sebastian Gottschall https://github.com/mirror/dd-wrt/commit/0c3001a6 /** --- a/src/ap/ap_drv_ops.c +++ b/src/ap/ap_drv_ops.c -@@ -385,13 +385,39 @@ int hostapd_set_wds_sta(struct hostapd_d +@@ -385,9 +385,35 @@ int hostapd_set_wds_sta(struct hostapd_d const u8 *addr, int aid, int val) { const char *bridge = NULL; @@ -145,11 +142,6 @@ Hotfix-by: Sebastian Gottschall https://github.com/mirror/dd-wrt/commit/0c3001a6 if (hapd->conf->wds_bridge[0]) bridge = hapd->conf->wds_bridge; return hapd->driver->set_wds_sta(hapd->drv_priv, addr, aid, val, -- bridge, ifname_wds); -+ bridge, ifName); - } - - --- a/src/ap/ap_drv_ops.h +++ b/src/ap/ap_drv_ops.h @@ -35,6 +35,9 @@ int hostapd_set_drv_ieee8021x(struct hos @@ -346,7 +338,7 @@ Hotfix-by: Sebastian Gottschall https://github.com/mirror/dd-wrt/commit/0c3001a6 + const struct ieee802_11_elems *elems ); --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c -@@ -60,6 +60,9 @@ +@@ -59,6 +59,9 @@ #include "nan_usd_ap.h" #include "pasn/pasn_common.h" @@ -356,7 +348,7 @@ Hotfix-by: Sebastian Gottschall https://github.com/mirror/dd-wrt/commit/0c3001a6 #ifdef CONFIG_FILS static struct wpabuf * -@@ -3588,8 +3591,8 @@ static u16 check_multi_ap(struct hostapd +@@ -3586,8 +3589,8 @@ static u16 check_multi_ap(struct hostapd } @@ -367,7 +359,7 @@ Hotfix-by: Sebastian Gottschall https://github.com/mirror/dd-wrt/commit/0c3001a6 { /* Supported rates not used in IEEE 802.11ad/DMG */ if (hapd->iface->current_mode && -@@ -3976,7 +3979,7 @@ static int __check_assoc_ies(struct host +@@ -3974,7 +3977,7 @@ static int __check_assoc_ies(struct host elems->ext_capab_len); if (resp != WLAN_STATUS_SUCCESS) return resp; @@ -376,7 +368,7 @@ Hotfix-by: Sebastian Gottschall https://github.com/mirror/dd-wrt/commit/0c3001a6 if (resp != WLAN_STATUS_SUCCESS) return resp; -@@ -6031,6 +6034,11 @@ static void handle_beacon(struct hostapd +@@ -6029,6 +6032,11 @@ static void handle_beacon(struct hostapd 0); ap_list_process_beacon(hapd->iface, mgmt, &elems, fi); @@ -401,7 +393,7 @@ Hotfix-by: Sebastian Gottschall https://github.com/mirror/dd-wrt/commit/0c3001a6 u16 copy_sta_vendor_vht(struct hostapd_data *hapd, struct sta_info *sta, --- a/src/drivers/driver.h +++ b/src/drivers/driver.h -@@ -4048,7 +4048,7 @@ struct wpa_driver_ops { +@@ -4042,7 +4042,7 @@ struct wpa_driver_ops { * Returns: 0 on success, -1 on failure */ int (*set_wds_sta)(void *priv, const u8 *addr, int aid, int val, @@ -412,7 +404,7 @@ Hotfix-by: Sebastian Gottschall https://github.com/mirror/dd-wrt/commit/0c3001a6 * send_action - Transmit an Action frame --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -8559,25 +8559,15 @@ static int have_ifidx(struct wpa_driver_ +@@ -8557,25 +8557,15 @@ static int have_ifidx(struct wpa_driver_ static int i802_set_wds_sta(void *priv, const u8 *addr, int aid, int val, diff --git a/package/network/services/hostapd/patches/802-SAE-Reject-invalid-Rejected-Groups-element-in-the-pa.patch b/package/network/services/hostapd/patches/802-SAE-Reject-invalid-Rejected-Groups-element-in-the-pa.patch new file mode 100644 index 00000000000000..268f288827cf1b --- /dev/null +++ b/package/network/services/hostapd/patches/802-SAE-Reject-invalid-Rejected-Groups-element-in-the-pa.patch @@ -0,0 +1,30 @@ +From 9716bf1160beb677e965d9e6475d6c9e162e8374 Mon Sep 17 00:00:00 2001 +From: Jouni Malinen +Date: Tue, 9 Jul 2024 23:34:34 +0300 +Subject: [PATCH] SAE: Reject invalid Rejected Groups element in the parser + +There is no need to depend on all uses (i.e., both hostapd and +wpa_supplicant) to verify that the length of the Rejected Groups field +in the Rejected Groups element is valid (i.e., a multiple of two octets) +since the common parser can reject the message when detecting this. + +Signed-off-by: Jouni Malinen +--- + src/common/sae.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/src/common/sae.c ++++ b/src/common/sae.c +@@ -2160,6 +2160,12 @@ static int sae_parse_akm_suite_selector( + return WLAN_STATUS_UNSPECIFIED_FAILURE; + epos++; /* skip ext ID */ + len--; ++ if (len & 1) { ++ wpa_printf(MSG_DEBUG, ++ "SAE: Invalid length of the Rejected Groups element payload: %u", ++ len); ++ return WLAN_STATUS_UNSPECIFIED_FAILURE; ++ } + + if (len < RSN_SELECTOR_LEN) + return WLAN_STATUS_UNSPECIFIED_FAILURE; diff --git a/package/network/services/hostapd/patches/803-hostapd-fix-80211be-build.patch b/package/network/services/hostapd/patches/803-hostapd-fix-80211be-build.patch new file mode 100644 index 00000000000000..55c6e635813c9d --- /dev/null +++ b/package/network/services/hostapd/patches/803-hostapd-fix-80211be-build.patch @@ -0,0 +1,53 @@ +--- a/src/ap/sta_info.c ++++ b/src/ap/sta_info.c +@@ -1836,3 +1836,22 @@ void ap_sta_free_sta_profile(struct mld_ + } + } + #endif /* CONFIG_IEEE80211BE */ ++ ++bool ap_sta_is_mld(struct hostapd_data *hapd, ++ struct sta_info *sta) ++{ ++#ifdef CONFIG_IEEE80211BE ++ return hapd->conf->mld_ap && sta && sta->mld_info.mld_sta; ++#else /* CONFIG_IEEE80211BE */ ++ return false; ++#endif /* CONFIG_IEEE80211BE */ ++} ++ ++void ap_sta_set_mld(struct sta_info *sta, bool mld) ++{ ++#ifdef CONFIG_IEEE80211BE ++ if (sta) ++ sta->mld_info.mld_sta = mld; ++#endif /* CONFIG_IEEE80211BE */ ++} ++ +--- a/src/ap/sta_info.h ++++ b/src/ap/sta_info.h +@@ -417,23 +417,8 @@ int ap_sta_re_add(struct hostapd_data *h + + void ap_free_sta_pasn(struct hostapd_data *hapd, struct sta_info *sta); + +-static inline bool ap_sta_is_mld(struct hostapd_data *hapd, +- struct sta_info *sta) +-{ +-#ifdef CONFIG_IEEE80211BE +- return hapd->conf->mld_ap && sta && sta->mld_info.mld_sta; +-#else /* CONFIG_IEEE80211BE */ +- return false; +-#endif /* CONFIG_IEEE80211BE */ +-} +- +-static inline void ap_sta_set_mld(struct sta_info *sta, bool mld) +-{ +-#ifdef CONFIG_IEEE80211BE +- if (sta) +- sta->mld_info.mld_sta = mld; +-#endif /* CONFIG_IEEE80211BE */ +-} ++bool ap_sta_is_mld(struct hostapd_data *hapd, struct sta_info *sta); ++void ap_sta_set_mld(struct sta_info *sta, bool mld); + + void ap_sta_free_sta_profile(struct mld_info *info); + diff --git a/package/network/services/hostapd/src/src/ap/ubus.h b/package/network/services/hostapd/src/src/ap/ubus.h index 5b8938cbd32d7d..22767d67ee7564 100644 --- a/package/network/services/hostapd/src/src/ap/ubus.h +++ b/package/network/services/hostapd/src/src/ap/ubus.h @@ -8,6 +8,8 @@ #ifndef __HOSTAPD_UBUS_H #define __HOSTAPD_UBUS_H +#include "sta_info.h" + enum hostapd_ubus_event_type { HOSTAPD_UBUS_PROBE_REQ, HOSTAPD_UBUS_AUTH_REQ, diff --git a/package/network/services/hostapd/src/src/ap/ucode.c b/package/network/services/hostapd/src/src/ap/ucode.c index c54f071ee0f5ea..68fb450884e2f3 100644 --- a/package/network/services/hostapd/src/src/ap/ucode.c +++ b/package/network/services/hostapd/src/src/ap/ucode.c @@ -3,7 +3,7 @@ #include "utils/includes.h" #include "utils/common.h" #include "utils/ucode.h" -#include "sta_info.h" +#include "hostapd.h" #include "beacon.h" #include "hw_features.h" #include "ap_drv_ops.h" diff --git a/package/network/services/hostapd/src/src/utils/ap/ubus.c b/package/network/services/hostapd/src/src/utils/ap/ubus.c new file mode 100644 index 00000000000000..8689494bcff3e5 --- /dev/null +++ b/package/network/services/hostapd/src/src/utils/ap/ubus.c @@ -0,0 +1,2006 @@ +/* + * hostapd / ubus support + * Copyright (c) 2013, Felix Fietkau + * + * This software may be distributed under the terms of the BSD license. + * See README for more details. + */ + +#include "utils/includes.h" +#include "utils/common.h" +#include "utils/eloop.h" +#include "utils/wpabuf.h" +#include "common/ieee802_11_defs.h" +#include "common/hw_features_common.h" +#include "hostapd.h" +#include "neighbor_db.h" +#include "wps_hostapd.h" +#include "sta_info.h" +#include "ubus.h" +#include "ap_drv_ops.h" +#include "beacon.h" +#include "rrm.h" +#include "wnm_ap.h" +#include "taxonomy.h" +#include "airtime_policy.h" +#include "hw_features.h" + +static struct ubus_context *ctx; +static struct blob_buf b; +static int ctx_ref; + +static inline struct hostapd_data *get_hapd_from_object(struct ubus_object *obj) +{ + return container_of(obj, struct hostapd_data, ubus.obj); +} + +struct ubus_banned_client { + struct avl_node avl; + u8 addr[ETH_ALEN]; +}; + +static void ubus_reconnect_timeout(void *eloop_data, void *user_ctx) +{ + if (ubus_reconnect(ctx, NULL)) { + eloop_register_timeout(1, 0, ubus_reconnect_timeout, ctx, NULL); + return; + } + + ubus_add_uloop(ctx); +} + +static void hostapd_ubus_connection_lost(struct ubus_context *ctx) +{ + uloop_fd_delete(&ctx->sock); + eloop_register_timeout(1, 0, ubus_reconnect_timeout, ctx, NULL); +} + +static bool hostapd_ubus_init(void) +{ + if (ctx) + return true; + + eloop_add_uloop(); + ctx = ubus_connect(NULL); + if (!ctx) + return false; + + ctx->connection_lost = hostapd_ubus_connection_lost; + ubus_add_uloop(ctx); + + return true; +} + +static void hostapd_ubus_ref_inc(void) +{ + ctx_ref++; +} + +static void hostapd_ubus_ref_dec(void) +{ + ctx_ref--; + if (!ctx) + return; + + if (ctx_ref) + return; + + uloop_fd_delete(&ctx->sock); + ubus_free(ctx); + ctx = NULL; +} + +void hostapd_ubus_add_iface(struct hostapd_iface *iface) +{ + if (!hostapd_ubus_init()) + return; +} + +void hostapd_ubus_free_iface(struct hostapd_iface *iface) +{ + if (!ctx) + return; +} + +static void hostapd_notify_ubus(struct ubus_object *obj, char *bssname, char *event) +{ + char *event_type; + + if (!ctx || !obj) + return; + + if (asprintf(&event_type, "bss.%s", event) < 0) + return; + + blob_buf_init(&b, 0); + blobmsg_add_string(&b, "name", bssname); + ubus_notify(ctx, obj, event_type, b.head, -1); + free(event_type); +} + +static void +hostapd_bss_del_ban(void *eloop_data, void *user_ctx) +{ + struct ubus_banned_client *ban = eloop_data; + struct hostapd_data *hapd = user_ctx; + + avl_delete(&hapd->ubus.banned, &ban->avl); + free(ban); +} + +static void +hostapd_bss_ban_client(struct hostapd_data *hapd, u8 *addr, int time) +{ + struct ubus_banned_client *ban; + + if (time < 0) + time = 0; + + ban = avl_find_element(&hapd->ubus.banned, addr, ban, avl); + if (!ban) { + if (!time) + return; + + ban = os_zalloc(sizeof(*ban)); + memcpy(ban->addr, addr, sizeof(ban->addr)); + ban->avl.key = ban->addr; + avl_insert(&hapd->ubus.banned, &ban->avl); + } else { + eloop_cancel_timeout(hostapd_bss_del_ban, ban, hapd); + if (!time) { + hostapd_bss_del_ban(ban, hapd); + return; + } + } + + eloop_register_timeout(0, time * 1000, hostapd_bss_del_ban, ban, hapd); +} + +static int +hostapd_bss_reload(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); + + return hostapd_reload_config(hapd->iface); +} + + +static void +hostapd_parse_vht_map_blobmsg(uint16_t map) +{ + char label[4]; + int16_t val; + int i; + + for (i = 0; i < 8; i++) { + snprintf(label, 4, "%dss", i + 1); + + val = (map & (BIT(1) | BIT(0))) + 7; + blobmsg_add_u16(&b, label, val == 10 ? -1 : val); + map = map >> 2; + } +} + +static void +hostapd_parse_vht_capab_blobmsg(struct ieee80211_vht_capabilities *vhtc) +{ + void *supported_mcs; + void *map; + int i; + + static const struct { + const char *name; + uint32_t flag; + } vht_capas[] = { + { "su_beamformee", VHT_CAP_SU_BEAMFORMEE_CAPABLE }, + { "mu_beamformee", VHT_CAP_MU_BEAMFORMEE_CAPABLE }, + }; + + for (i = 0; i < ARRAY_SIZE(vht_capas); i++) + blobmsg_add_u8(&b, vht_capas[i].name, + !!(vhtc->vht_capabilities_info & vht_capas[i].flag)); + + supported_mcs = blobmsg_open_table(&b, "mcs_map"); + + /* RX map */ + map = blobmsg_open_table(&b, "rx"); + hostapd_parse_vht_map_blobmsg(le_to_host16(vhtc->vht_supported_mcs_set.rx_map)); + blobmsg_close_table(&b, map); + + /* TX map */ + map = blobmsg_open_table(&b, "tx"); + hostapd_parse_vht_map_blobmsg(le_to_host16(vhtc->vht_supported_mcs_set.tx_map)); + blobmsg_close_table(&b, map); + + blobmsg_close_table(&b, supported_mcs); +} + +static void +hostapd_parse_capab_blobmsg(struct sta_info *sta) +{ + void *r, *v; + + v = blobmsg_open_table(&b, "capabilities"); + + if (sta->vht_capabilities) { + r = blobmsg_open_table(&b, "vht"); + hostapd_parse_vht_capab_blobmsg(sta->vht_capabilities); + blobmsg_close_table(&b, r); + } + + /* ToDo: Add HT / HE capability parsing */ + + blobmsg_close_table(&b, v); +} + +static int +hostapd_bss_get_clients(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 hostap_sta_driver_data sta_driver_data; + struct sta_info *sta; + void *list, *c; + char mac_buf[20]; + static const struct { + const char *name; + uint32_t flag; + } sta_flags[] = { + { "auth", WLAN_STA_AUTH }, + { "assoc", WLAN_STA_ASSOC }, + { "authorized", WLAN_STA_AUTHORIZED }, + { "preauth", WLAN_STA_PREAUTH }, + { "wds", WLAN_STA_WDS }, + { "wmm", WLAN_STA_WMM }, + { "ht", WLAN_STA_HT }, + { "vht", WLAN_STA_VHT }, + { "he", WLAN_STA_HE }, + { "wps", WLAN_STA_WPS }, + { "mfp", WLAN_STA_MFP }, + }; + + blob_buf_init(&b, 0); + blobmsg_add_u32(&b, "freq", hapd->iface->freq); + list = blobmsg_open_table(&b, "clients"); + for (sta = hapd->sta_list; sta; sta = sta->next) { + void *r; + int i; + + sprintf(mac_buf, MACSTR, MAC2STR(sta->addr)); + c = blobmsg_open_table(&b, mac_buf); + for (i = 0; i < ARRAY_SIZE(sta_flags); i++) + blobmsg_add_u8(&b, sta_flags[i].name, + !!(sta->flags & sta_flags[i].flag)); + +#ifdef CONFIG_MBO + blobmsg_add_u8(&b, "mbo", !!(sta->cell_capa)); +#endif + + r = blobmsg_open_array(&b, "rrm"); + for (i = 0; i < ARRAY_SIZE(sta->rrm_enabled_capa); i++) + blobmsg_add_u32(&b, "", sta->rrm_enabled_capa[i]); + blobmsg_close_array(&b, r); + + r = blobmsg_open_array(&b, "extended_capabilities"); + /* Check if client advertises extended capabilities */ + if (sta->ext_capability && sta->ext_capability[0] > 0) { + for (i = 0; i < sta->ext_capability[0]; i++) { + blobmsg_add_u32(&b, "", sta->ext_capability[1 + i]); + } + } + blobmsg_close_array(&b, r); + + blobmsg_add_u32(&b, "aid", sta->aid); +#ifdef CONFIG_TAXONOMY + r = blobmsg_alloc_string_buffer(&b, "signature", 1024); + if (retrieve_sta_taxonomy(hapd, sta, r, 1024) > 0) + blobmsg_add_string_buffer(&b); +#endif + + /* Driver information */ + if (hostapd_drv_read_sta_data(hapd, &sta_driver_data, sta->addr) >= 0) { + r = blobmsg_open_table(&b, "bytes"); + blobmsg_add_u64(&b, "rx", sta_driver_data.rx_bytes); + blobmsg_add_u64(&b, "tx", sta_driver_data.tx_bytes); + blobmsg_close_table(&b, r); + r = blobmsg_open_table(&b, "airtime"); + blobmsg_add_u64(&b, "rx", sta_driver_data.rx_airtime); + blobmsg_add_u64(&b, "tx", sta_driver_data.tx_airtime); + blobmsg_close_table(&b, r); + r = blobmsg_open_table(&b, "packets"); + blobmsg_add_u32(&b, "rx", sta_driver_data.rx_packets); + blobmsg_add_u32(&b, "tx", sta_driver_data.tx_packets); + blobmsg_close_table(&b, r); + r = blobmsg_open_table(&b, "rate"); + /* Rate in kbits */ + blobmsg_add_u32(&b, "rx", sta_driver_data.current_rx_rate * 100); + blobmsg_add_u32(&b, "tx", sta_driver_data.current_tx_rate * 100); + blobmsg_close_table(&b, r); + blobmsg_add_u32(&b, "signal", sta_driver_data.signal); + } + + hostapd_parse_capab_blobmsg(sta); + + blobmsg_close_table(&b, c); + } + blobmsg_close_array(&b, list); + ubus_send_reply(ctx, req, b.head); + + return 0; +} + +static int +hostapd_bss_get_features(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); + + blob_buf_init(&b, 0); + blobmsg_add_u8(&b, "ht_supported", ht_supported(hapd->iface->hw_features)); + blobmsg_add_u8(&b, "vht_supported", vht_supported(hapd->iface->hw_features)); + ubus_send_reply(ctx, req, b.head); + + return 0; +} + +static int +hostapd_bss_get_status(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 *airtime_table, *dfs_table, *rrm_table, *wnm_table; + struct os_reltime now; + char ssid[SSID_MAX_LEN + 1]; + char phy_name[17]; + size_t ssid_len = SSID_MAX_LEN; + u8 channel = 0, op_class = 0; + + if (hapd->conf->ssid.ssid_len < SSID_MAX_LEN) + ssid_len = hapd->conf->ssid.ssid_len; + + ieee80211_freq_to_channel_ext(hapd->iface->freq, + hapd->iconf->secondary_channel, + hostapd_get_oper_chwidth(hapd->iconf), + &op_class, &channel); + + blob_buf_init(&b, 0); + blobmsg_add_string(&b, "status", hostapd_state_text(hapd->iface->state)); + blobmsg_printf(&b, "bssid", MACSTR, MAC2STR(hapd->conf->bssid)); + + memset(ssid, 0, SSID_MAX_LEN + 1); + memcpy(ssid, hapd->conf->ssid.ssid, ssid_len); + blobmsg_add_string(&b, "ssid", ssid); + + blobmsg_add_u32(&b, "freq", hapd->iface->freq); + blobmsg_add_u32(&b, "channel", channel); + blobmsg_add_u32(&b, "op_class", op_class); + blobmsg_add_u32(&b, "beacon_interval", hapd->iconf->beacon_int); +#ifdef CONFIG_IEEE80211AX + blobmsg_add_u32(&b, "bss_color", hapd->iface->conf->he_op.he_bss_color_disabled ? -1 : + hapd->iface->conf->he_op.he_bss_color); +#else + blobmsg_add_u32(&b, "bss_color", -1); +#endif + + snprintf(phy_name, 17, "%s", hapd->iface->phy); + blobmsg_add_string(&b, "phy", phy_name); + + /* RRM */ + rrm_table = blobmsg_open_table(&b, "rrm"); + blobmsg_add_u64(&b, "neighbor_report_tx", hapd->openwrt_stats.rrm.neighbor_report_tx); + blobmsg_close_table(&b, rrm_table); + + /* WNM */ + wnm_table = blobmsg_open_table(&b, "wnm"); + blobmsg_add_u64(&b, "bss_transition_query_rx", hapd->openwrt_stats.wnm.bss_transition_query_rx); + blobmsg_add_u64(&b, "bss_transition_request_tx", hapd->openwrt_stats.wnm.bss_transition_request_tx); + blobmsg_add_u64(&b, "bss_transition_response_rx", hapd->openwrt_stats.wnm.bss_transition_response_rx); + blobmsg_close_table(&b, wnm_table); + + /* Airtime */ + airtime_table = blobmsg_open_table(&b, "airtime"); + blobmsg_add_u64(&b, "time", hapd->iface->last_channel_time); + blobmsg_add_u64(&b, "time_busy", hapd->iface->last_channel_time_busy); + blobmsg_add_u16(&b, "utilization", hapd->iface->channel_utilization); + blobmsg_close_table(&b, airtime_table); + + /* DFS */ + dfs_table = blobmsg_open_table(&b, "dfs"); + blobmsg_add_u32(&b, "cac_seconds", hapd->iface->dfs_cac_ms / 1000); + blobmsg_add_u8(&b, "cac_active", !!(hapd->iface->cac_started)); + os_reltime_age(&hapd->iface->dfs_cac_start, &now); + blobmsg_add_u32(&b, "cac_seconds_left", + hapd->iface->cac_started ? hapd->iface->dfs_cac_ms / 1000 - now.sec : 0); + blobmsg_close_table(&b, dfs_table); + + ubus_send_reply(ctx, req, b.head); + + return 0; +} + +enum { + NOTIFY_RESPONSE, + __NOTIFY_MAX +}; + +static const struct blobmsg_policy notify_policy[__NOTIFY_MAX] = { + [NOTIFY_RESPONSE] = { "notify_response", BLOBMSG_TYPE_INT32 }, +}; + +static int +hostapd_notify_response(struct ubus_context *ctx, struct ubus_object *obj, + struct ubus_request_data *req, const char *method, + struct blob_attr *msg) +{ + struct blob_attr *tb[__NOTIFY_MAX]; + struct hostapd_data *hapd = get_hapd_from_object(obj); + struct wpabuf *elems; + const char *pos; + size_t len; + + blobmsg_parse(notify_policy, __NOTIFY_MAX, tb, + blob_data(msg), blob_len(msg)); + + if (!tb[NOTIFY_RESPONSE]) + return UBUS_STATUS_INVALID_ARGUMENT; + + hapd->ubus.notify_response = blobmsg_get_u32(tb[NOTIFY_RESPONSE]); + + return UBUS_STATUS_OK; +} + +enum { + DEL_CLIENT_ADDR, + DEL_CLIENT_REASON, + DEL_CLIENT_DEAUTH, + DEL_CLIENT_BAN_TIME, + __DEL_CLIENT_MAX +}; + +static const struct blobmsg_policy del_policy[__DEL_CLIENT_MAX] = { + [DEL_CLIENT_ADDR] = { "addr", BLOBMSG_TYPE_STRING }, + [DEL_CLIENT_REASON] = { "reason", BLOBMSG_TYPE_INT32 }, + [DEL_CLIENT_DEAUTH] = { "deauth", BLOBMSG_TYPE_INT8 }, + [DEL_CLIENT_BAN_TIME] = { "ban_time", BLOBMSG_TYPE_INT32 }, +}; + +static int +hostapd_bss_del_client(struct ubus_context *ctx, struct ubus_object *obj, + struct ubus_request_data *req, const char *method, + struct blob_attr *msg) +{ + struct blob_attr *tb[__DEL_CLIENT_MAX]; + struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj); + struct sta_info *sta; + bool deauth = false; + int reason; + u8 addr[ETH_ALEN]; + + blobmsg_parse(del_policy, __DEL_CLIENT_MAX, tb, blob_data(msg), blob_len(msg)); + + if (!tb[DEL_CLIENT_ADDR]) + return UBUS_STATUS_INVALID_ARGUMENT; + + if (hwaddr_aton(blobmsg_data(tb[DEL_CLIENT_ADDR]), addr)) + return UBUS_STATUS_INVALID_ARGUMENT; + + if (tb[DEL_CLIENT_REASON]) + reason = blobmsg_get_u32(tb[DEL_CLIENT_REASON]); + + if (tb[DEL_CLIENT_DEAUTH]) + deauth = blobmsg_get_bool(tb[DEL_CLIENT_DEAUTH]); + + sta = ap_get_sta(hapd, addr); + if (sta) { + if (deauth) { + hostapd_drv_sta_deauth(hapd, addr, reason); + ap_sta_deauthenticate(hapd, sta, reason); + } else { + hostapd_drv_sta_disassoc(hapd, addr, reason); + ap_sta_disassociate(hapd, sta, reason); + } + } + + if (tb[DEL_CLIENT_BAN_TIME]) + hostapd_bss_ban_client(hapd, addr, blobmsg_get_u32(tb[DEL_CLIENT_BAN_TIME])); + + return 0; +} + +static void +blobmsg_add_macaddr(struct blob_buf *buf, const char *name, const u8 *addr) +{ + char *s; + + s = blobmsg_alloc_string_buffer(buf, name, 20); + sprintf(s, MACSTR, MAC2STR(addr)); + blobmsg_add_string_buffer(buf); +} + +static int +hostapd_bss_list_bans(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 ubus_banned_client *ban; + void *c; + + blob_buf_init(&b, 0); + c = blobmsg_open_array(&b, "clients"); + avl_for_each_element(&hapd->ubus.banned, ban, avl) + blobmsg_add_macaddr(&b, NULL, ban->addr); + blobmsg_close_array(&b, c); + ubus_send_reply(ctx, req, b.head); + + return 0; +} + +#ifdef CONFIG_WPS +static int +hostapd_bss_wps_start(struct ubus_context *ctx, struct ubus_object *obj, + struct ubus_request_data *req, const char *method, + struct blob_attr *msg) +{ + int rc; + struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj); + + rc = hostapd_wps_button_pushed(hapd, NULL); + + if (rc != 0) + return UBUS_STATUS_NOT_SUPPORTED; + + return 0; +} + + +static const char * pbc_status_enum_str(enum pbc_status status) +{ + switch (status) { + case WPS_PBC_STATUS_DISABLE: + return "Disabled"; + case WPS_PBC_STATUS_ACTIVE: + return "Active"; + case WPS_PBC_STATUS_TIMEOUT: + return "Timed-out"; + case WPS_PBC_STATUS_OVERLAP: + return "Overlap"; + default: + return "Unknown"; + } +} + +static int +hostapd_bss_wps_status(struct ubus_context *ctx, struct ubus_object *obj, + struct ubus_request_data *req, const char *method, + struct blob_attr *msg) +{ + int rc; + struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj); + + blob_buf_init(&b, 0); + + blobmsg_add_string(&b, "pbc_status", pbc_status_enum_str(hapd->wps_stats.pbc_status)); + blobmsg_add_string(&b, "last_wps_result", + (hapd->wps_stats.status == WPS_STATUS_SUCCESS ? + "Success": + (hapd->wps_stats.status == WPS_STATUS_FAILURE ? + "Failed" : "None"))); + + /* If status == Failure - Add possible Reasons */ + if(hapd->wps_stats.status == WPS_STATUS_FAILURE && + hapd->wps_stats.failure_reason > 0) + blobmsg_add_string(&b, "reason", wps_ei_str(hapd->wps_stats.failure_reason)); + + if (hapd->wps_stats.status) + blobmsg_printf(&b, "peer_address", MACSTR, MAC2STR(hapd->wps_stats.peer_addr)); + + ubus_send_reply(ctx, req, b.head); + + return 0; +} + +static int +hostapd_bss_wps_cancel(struct ubus_context *ctx, struct ubus_object *obj, + struct ubus_request_data *req, const char *method, + struct blob_attr *msg) +{ + int rc; + struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj); + + rc = hostapd_wps_cancel(hapd); + + if (rc != 0) + return UBUS_STATUS_NOT_SUPPORTED; + + return 0; +} +#endif /* CONFIG_WPS */ + +static int +hostapd_bss_update_beacon(struct ubus_context *ctx, struct ubus_object *obj, + struct ubus_request_data *req, const char *method, + struct blob_attr *msg) +{ + int rc; + struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj); + + rc = ieee802_11_set_beacon(hapd); + + if (rc != 0) + return UBUS_STATUS_NOT_SUPPORTED; + + return 0; +} + +enum { + CONFIG_IFACE, + CONFIG_FILE, + __CONFIG_MAX +}; + +enum { + CSA_FREQ, + CSA_BCN_COUNT, + CSA_CENTER_FREQ1, + CSA_CENTER_FREQ2, + CSA_BANDWIDTH, + CSA_SEC_CHANNEL_OFFSET, + CSA_HT, + CSA_VHT, + CSA_HE, + CSA_BLOCK_TX, + CSA_FORCE, + __CSA_MAX +}; + +static const struct blobmsg_policy csa_policy[__CSA_MAX] = { + [CSA_FREQ] = { "freq", BLOBMSG_TYPE_INT32 }, + [CSA_BCN_COUNT] = { "bcn_count", BLOBMSG_TYPE_INT32 }, + [CSA_CENTER_FREQ1] = { "center_freq1", BLOBMSG_TYPE_INT32 }, + [CSA_CENTER_FREQ2] = { "center_freq2", BLOBMSG_TYPE_INT32 }, + [CSA_BANDWIDTH] = { "bandwidth", BLOBMSG_TYPE_INT32 }, + [CSA_SEC_CHANNEL_OFFSET] = { "sec_channel_offset", BLOBMSG_TYPE_INT32 }, + [CSA_HT] = { "ht", BLOBMSG_TYPE_BOOL }, + [CSA_VHT] = { "vht", BLOBMSG_TYPE_BOOL }, + [CSA_HE] = { "he", BLOBMSG_TYPE_BOOL }, + [CSA_BLOCK_TX] = { "block_tx", BLOBMSG_TYPE_BOOL }, + [CSA_FORCE] = { "force", BLOBMSG_TYPE_BOOL }, +}; + + +static void switch_chan_fallback_cb(void *eloop_data, void *user_ctx) +{ + struct hostapd_iface *iface = eloop_data; + struct hostapd_freq_params *freq_params = user_ctx; + + hostapd_switch_channel_fallback(iface, freq_params); +} + +#ifdef NEED_AP_MLME +static int +hostapd_switch_chan(struct ubus_context *ctx, struct ubus_object *obj, + struct ubus_request_data *req, const char *method, + struct blob_attr *msg) +{ + struct blob_attr *tb[__CSA_MAX]; + struct hostapd_data *hapd = get_hapd_from_object(obj); + struct hostapd_config *iconf = hapd->iface->conf; + struct hostapd_freq_params *freq_params; + struct hostapd_hw_modes *mode = hapd->iface->current_mode; + struct csa_settings css = { + .freq_params = { + .ht_enabled = iconf->ieee80211n, + .vht_enabled = iconf->ieee80211ac, + .he_enabled = iconf->ieee80211ax, + .sec_channel_offset = iconf->secondary_channel, + } + }; + u8 chwidth = hostapd_get_oper_chwidth(iconf); + u8 seg0 = 0, seg1 = 0; + int ret = UBUS_STATUS_OK; + int i; + + blobmsg_parse(csa_policy, __CSA_MAX, tb, blob_data(msg), blob_len(msg)); + + if (!tb[CSA_FREQ]) + return UBUS_STATUS_INVALID_ARGUMENT; + + switch (iconf->vht_oper_chwidth) { + case CHANWIDTH_USE_HT: + if (iconf->secondary_channel) + css.freq_params.bandwidth = 40; + else + css.freq_params.bandwidth = 20; + break; + case CHANWIDTH_160MHZ: + css.freq_params.bandwidth = 160; + break; + default: + css.freq_params.bandwidth = 80; + break; + } + + css.freq_params.freq = blobmsg_get_u32(tb[CSA_FREQ]); + +#define SET_CSA_SETTING(name, field, type) \ + do { \ + if (tb[name]) \ + css.field = blobmsg_get_ ## type(tb[name]); \ + } while(0) + + SET_CSA_SETTING(CSA_BCN_COUNT, cs_count, u32); + SET_CSA_SETTING(CSA_CENTER_FREQ1, freq_params.center_freq1, u32); + SET_CSA_SETTING(CSA_CENTER_FREQ2, freq_params.center_freq2, u32); + SET_CSA_SETTING(CSA_BANDWIDTH, freq_params.bandwidth, u32); + SET_CSA_SETTING(CSA_SEC_CHANNEL_OFFSET, freq_params.sec_channel_offset, u32); + SET_CSA_SETTING(CSA_HT, freq_params.ht_enabled, bool); + SET_CSA_SETTING(CSA_VHT, freq_params.vht_enabled, bool); + SET_CSA_SETTING(CSA_HE, freq_params.he_enabled, bool); + SET_CSA_SETTING(CSA_BLOCK_TX, block_tx, bool); + + css.freq_params.channel = hostapd_hw_get_channel(hapd, css.freq_params.freq); + if (!css.freq_params.channel) + return UBUS_STATUS_NOT_SUPPORTED; + + switch (css.freq_params.bandwidth) { + case 160: + chwidth = CHANWIDTH_160MHZ; + break; + case 80: + chwidth = css.freq_params.center_freq2 ? CHANWIDTH_80P80MHZ : CHANWIDTH_80MHZ; + break; + default: + chwidth = CHANWIDTH_USE_HT; + break; + } + + hostapd_set_freq_params(&css.freq_params, iconf->hw_mode, + css.freq_params.freq, + css.freq_params.channel, iconf->enable_edmg, + iconf->edmg_channel, + css.freq_params.ht_enabled, + css.freq_params.vht_enabled, + css.freq_params.he_enabled, + css.freq_params.eht_enabled, + css.freq_params.sec_channel_offset, + chwidth, seg0, seg1, + iconf->vht_capab, + mode ? &mode->he_capab[IEEE80211_MODE_AP] : + NULL, + mode ? &mode->eht_capab[IEEE80211_MODE_AP] : + NULL, + hostapd_get_punct_bitmap(hapd)); + + for (i = 0; i < hapd->iface->num_bss; i++) { + struct hostapd_data *bss = hapd->iface->bss[i]; + + if (hostapd_switch_channel(bss, &css) != 0) + ret = UBUS_STATUS_NOT_SUPPORTED; + } + + if (!ret || !tb[CSA_FORCE] || !blobmsg_get_bool(tb[CSA_FORCE])) + return ret; + + freq_params = malloc(sizeof(*freq_params)); + memcpy(freq_params, &css.freq_params, sizeof(*freq_params)); + eloop_register_timeout(0, 1, switch_chan_fallback_cb, + hapd->iface, freq_params); + + return 0; +#undef SET_CSA_SETTING +} +#endif + +enum { + VENDOR_ELEMENTS, + __VENDOR_ELEMENTS_MAX +}; + +static const struct blobmsg_policy ve_policy[__VENDOR_ELEMENTS_MAX] = { + /* vendor elements are provided as hex-string */ + [VENDOR_ELEMENTS] = { "vendor_elements", BLOBMSG_TYPE_STRING }, +}; + +static int +hostapd_vendor_elements(struct ubus_context *ctx, struct ubus_object *obj, + struct ubus_request_data *req, const char *method, + struct blob_attr *msg) +{ + struct blob_attr *tb[__VENDOR_ELEMENTS_MAX]; + struct hostapd_data *hapd = get_hapd_from_object(obj); + struct hostapd_bss_config *bss = hapd->conf; + struct wpabuf *elems; + const char *pos; + size_t len; + + blobmsg_parse(ve_policy, __VENDOR_ELEMENTS_MAX, tb, + blob_data(msg), blob_len(msg)); + + if (!tb[VENDOR_ELEMENTS]) + return UBUS_STATUS_INVALID_ARGUMENT; + + pos = blobmsg_data(tb[VENDOR_ELEMENTS]); + len = os_strlen(pos); + if (len & 0x01) + return UBUS_STATUS_INVALID_ARGUMENT; + + len /= 2; + if (len == 0) { + wpabuf_free(bss->vendor_elements); + bss->vendor_elements = NULL; + return 0; + } + + elems = wpabuf_alloc(len); + if (elems == NULL) + return 1; + + if (hexstr2bin(pos, wpabuf_put(elems, len), len)) { + wpabuf_free(elems); + return UBUS_STATUS_INVALID_ARGUMENT; + } + + wpabuf_free(bss->vendor_elements); + bss->vendor_elements = elems; + + /* update beacons if vendor elements were set successfully */ + if (ieee802_11_update_beacons(hapd->iface) != 0) + return UBUS_STATUS_NOT_SUPPORTED; + return UBUS_STATUS_OK; +} + +static void +hostapd_rrm_print_nr(struct hostapd_neighbor_entry *nr) +{ + const u8 *data; + char *str; + int len; + + blobmsg_printf(&b, "", MACSTR, MAC2STR(nr->bssid)); + + str = blobmsg_alloc_string_buffer(&b, "", nr->ssid.ssid_len + 1); + memcpy(str, nr->ssid.ssid, nr->ssid.ssid_len); + str[nr->ssid.ssid_len] = 0; + blobmsg_add_string_buffer(&b); + + len = wpabuf_len(nr->nr); + str = blobmsg_alloc_string_buffer(&b, "", 2 * len + 1); + wpa_snprintf_hex(str, 2 * len + 1, wpabuf_head_u8(nr->nr), len); + blobmsg_add_string_buffer(&b); +} + +enum { + BSS_MGMT_EN_NEIGHBOR, + BSS_MGMT_EN_BEACON, + BSS_MGMT_EN_LINK_MEASUREMENT, +#ifdef CONFIG_WNM_AP + BSS_MGMT_EN_BSS_TRANSITION, +#endif + __BSS_MGMT_EN_MAX +}; + +static bool +__hostapd_bss_mgmt_enable_f(struct hostapd_data *hapd, int flag) +{ + struct hostapd_bss_config *bss = hapd->conf; + uint32_t flags; + + switch (flag) { + case BSS_MGMT_EN_NEIGHBOR: + if (bss->radio_measurements[0] & + WLAN_RRM_CAPS_NEIGHBOR_REPORT) + return false; + + bss->radio_measurements[0] |= + WLAN_RRM_CAPS_NEIGHBOR_REPORT; + hostapd_neighbor_set_own_report(hapd); + return true; + case BSS_MGMT_EN_BEACON: + flags = WLAN_RRM_CAPS_BEACON_REPORT_PASSIVE | + WLAN_RRM_CAPS_BEACON_REPORT_ACTIVE | + WLAN_RRM_CAPS_BEACON_REPORT_TABLE; + + if (bss->radio_measurements[0] & flags == flags) + return false; + + bss->radio_measurements[0] |= (u8) flags; + return true; + case BSS_MGMT_EN_LINK_MEASUREMENT: + flags = WLAN_RRM_CAPS_LINK_MEASUREMENT; + + if (bss->radio_measurements[0] & flags == flags) + return false; + + bss->radio_measurements[0] |= (u8) flags; + return true; +#ifdef CONFIG_WNM_AP + case BSS_MGMT_EN_BSS_TRANSITION: + if (bss->bss_transition) + return false; + + bss->bss_transition = 1; + return true; +#endif + } +} + +static void +__hostapd_bss_mgmt_enable(struct hostapd_data *hapd, uint32_t flags) +{ + bool update = false; + int i; + + for (i = 0; i < __BSS_MGMT_EN_MAX; i++) { + if (!(flags & (1 << i))) + continue; + + update |= __hostapd_bss_mgmt_enable_f(hapd, i); + } + + if (update) + ieee802_11_update_beacons(hapd->iface); +} + + +static const struct blobmsg_policy bss_mgmt_enable_policy[__BSS_MGMT_EN_MAX] = { + [BSS_MGMT_EN_NEIGHBOR] = { "neighbor_report", BLOBMSG_TYPE_BOOL }, + [BSS_MGMT_EN_BEACON] = { "beacon_report", BLOBMSG_TYPE_BOOL }, + [BSS_MGMT_EN_LINK_MEASUREMENT] = { "link_measurement", BLOBMSG_TYPE_BOOL }, +#ifdef CONFIG_WNM_AP + [BSS_MGMT_EN_BSS_TRANSITION] = { "bss_transition", BLOBMSG_TYPE_BOOL }, +#endif +}; + +static int +hostapd_bss_mgmt_enable(struct ubus_context *ctx, struct ubus_object *obj, + struct ubus_request_data *req, const char *method, + struct blob_attr *msg) + +{ + struct hostapd_data *hapd = get_hapd_from_object(obj); + struct blob_attr *tb[__BSS_MGMT_EN_MAX]; + struct blob_attr *cur; + uint32_t flags = 0; + int i; + bool neigh = false, beacon = false; + + blobmsg_parse(bss_mgmt_enable_policy, __BSS_MGMT_EN_MAX, tb, blob_data(msg), blob_len(msg)); + + for (i = 0; i < ARRAY_SIZE(tb); i++) { + if (!tb[i] || !blobmsg_get_bool(tb[i])) + continue; + + flags |= (1 << i); + } + + __hostapd_bss_mgmt_enable(hapd, flags); + + return 0; +} + + +static void +hostapd_rrm_nr_enable(struct hostapd_data *hapd) +{ + __hostapd_bss_mgmt_enable(hapd, 1 << BSS_MGMT_EN_NEIGHBOR); +} + +static int +hostapd_rrm_nr_get_own(struct ubus_context *ctx, struct ubus_object *obj, + struct ubus_request_data *req, const char *method, + struct blob_attr *msg) +{ + struct hostapd_data *hapd = get_hapd_from_object(obj); + struct hostapd_neighbor_entry *nr; + void *c; + + hostapd_rrm_nr_enable(hapd); + + nr = hostapd_neighbor_get(hapd, hapd->own_addr, NULL); + if (!nr) + return UBUS_STATUS_NOT_FOUND; + + blob_buf_init(&b, 0); + + c = blobmsg_open_array(&b, "value"); + hostapd_rrm_print_nr(nr); + blobmsg_close_array(&b, c); + + ubus_send_reply(ctx, req, b.head); + + return 0; +} + +static int +hostapd_rrm_nr_list(struct ubus_context *ctx, struct ubus_object *obj, + struct ubus_request_data *req, const char *method, + struct blob_attr *msg) +{ + struct hostapd_data *hapd = get_hapd_from_object(obj); + struct hostapd_neighbor_entry *nr; + void *c; + + hostapd_rrm_nr_enable(hapd); + blob_buf_init(&b, 0); + + c = blobmsg_open_array(&b, "list"); + dl_list_for_each(nr, &hapd->nr_db, struct hostapd_neighbor_entry, list) { + void *cur; + + if (!memcmp(nr->bssid, hapd->own_addr, ETH_ALEN)) + continue; + + cur = blobmsg_open_array(&b, NULL); + hostapd_rrm_print_nr(nr); + blobmsg_close_array(&b, cur); + } + blobmsg_close_array(&b, c); + + ubus_send_reply(ctx, req, b.head); + + return 0; +} + +enum { + NR_SET_LIST, + __NR_SET_LIST_MAX +}; + +static const struct blobmsg_policy nr_set_policy[__NR_SET_LIST_MAX] = { + [NR_SET_LIST] = { "list", BLOBMSG_TYPE_ARRAY }, +}; + + +static void +hostapd_rrm_nr_clear(struct hostapd_data *hapd) +{ + struct hostapd_neighbor_entry *nr; + +restart: + dl_list_for_each(nr, &hapd->nr_db, struct hostapd_neighbor_entry, list) { + if (!memcmp(nr->bssid, hapd->own_addr, ETH_ALEN)) + continue; + + hostapd_neighbor_remove(hapd, nr->bssid, &nr->ssid); + goto restart; + } +} + +static int +hostapd_rrm_nr_set(struct ubus_context *ctx, struct ubus_object *obj, + struct ubus_request_data *req, const char *method, + struct blob_attr *msg) +{ + static const struct blobmsg_policy nr_e_policy[] = { + { .type = BLOBMSG_TYPE_STRING }, + { .type = BLOBMSG_TYPE_STRING }, + { .type = BLOBMSG_TYPE_STRING }, + }; + struct hostapd_data *hapd = get_hapd_from_object(obj); + struct blob_attr *tb_l[__NR_SET_LIST_MAX]; + struct blob_attr *tb[ARRAY_SIZE(nr_e_policy)]; + struct blob_attr *cur; + int rem; + + hostapd_rrm_nr_enable(hapd); + + blobmsg_parse(nr_set_policy, __NR_SET_LIST_MAX, tb_l, blob_data(msg), blob_len(msg)); + if (!tb_l[NR_SET_LIST]) + return UBUS_STATUS_INVALID_ARGUMENT; + + hostapd_rrm_nr_clear(hapd); + blobmsg_for_each_attr(cur, tb_l[NR_SET_LIST], rem) { + struct wpa_ssid_value ssid; + struct wpabuf *data; + u8 bssid[ETH_ALEN]; + char *s, *nr_s; + + blobmsg_parse_array(nr_e_policy, ARRAY_SIZE(nr_e_policy), tb, blobmsg_data(cur), blobmsg_data_len(cur)); + if (!tb[0] || !tb[1] || !tb[2]) + goto invalid; + + /* Neighbor Report binary */ + nr_s = blobmsg_get_string(tb[2]); + data = wpabuf_parse_bin(nr_s); + if (!data) + goto invalid; + + /* BSSID */ + s = blobmsg_get_string(tb[0]); + if (strlen(s) == 0) { + /* Copy BSSID from neighbor report */ + if (hwaddr_compact_aton(nr_s, bssid)) + goto invalid; + } else if (hwaddr_aton(s, bssid)) { + goto invalid; + } + + /* SSID */ + s = blobmsg_get_string(tb[1]); + if (strlen(s) == 0) { + /* Copy SSID from hostapd BSS conf */ + memcpy(&ssid, &hapd->conf->ssid, sizeof(ssid)); + } else { + ssid.ssid_len = strlen(s); + if (ssid.ssid_len > sizeof(ssid.ssid)) + goto invalid; + + memcpy(&ssid, s, ssid.ssid_len); + } + + hostapd_neighbor_set(hapd, bssid, &ssid, data, NULL, NULL, 0, 0); + wpabuf_free(data); + continue; + +invalid: + return UBUS_STATUS_INVALID_ARGUMENT; + } + + return 0; +} + +enum { + BEACON_REQ_ADDR, + BEACON_REQ_MODE, + BEACON_REQ_OP_CLASS, + BEACON_REQ_CHANNEL, + BEACON_REQ_DURATION, + BEACON_REQ_BSSID, + BEACON_REQ_SSID, + __BEACON_REQ_MAX, +}; + +static const struct blobmsg_policy beacon_req_policy[__BEACON_REQ_MAX] = { + [BEACON_REQ_ADDR] = { "addr", BLOBMSG_TYPE_STRING }, + [BEACON_REQ_OP_CLASS] { "op_class", BLOBMSG_TYPE_INT32 }, + [BEACON_REQ_CHANNEL] { "channel", BLOBMSG_TYPE_INT32 }, + [BEACON_REQ_DURATION] { "duration", BLOBMSG_TYPE_INT32 }, + [BEACON_REQ_MODE] { "mode", BLOBMSG_TYPE_INT32 }, + [BEACON_REQ_BSSID] { "bssid", BLOBMSG_TYPE_STRING }, + [BEACON_REQ_SSID] { "ssid", BLOBMSG_TYPE_STRING }, +}; + +static int +hostapd_rrm_beacon_req(struct ubus_context *ctx, struct ubus_object *obj, + struct ubus_request_data *ureq, const char *method, + struct blob_attr *msg) +{ + struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj); + struct blob_attr *tb[__BEACON_REQ_MAX]; + struct blob_attr *cur; + struct wpabuf *req; + u8 bssid[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; + u8 addr[ETH_ALEN]; + int mode, rem, ret; + int buf_len = 13; + + blobmsg_parse(beacon_req_policy, __BEACON_REQ_MAX, tb, blob_data(msg), blob_len(msg)); + + if (!tb[BEACON_REQ_ADDR] || !tb[BEACON_REQ_MODE] || !tb[BEACON_REQ_DURATION] || + !tb[BEACON_REQ_OP_CLASS] || !tb[BEACON_REQ_CHANNEL]) + return UBUS_STATUS_INVALID_ARGUMENT; + + if (tb[BEACON_REQ_SSID]) + buf_len += blobmsg_data_len(tb[BEACON_REQ_SSID]) + 2 - 1; + + mode = blobmsg_get_u32(tb[BEACON_REQ_MODE]); + if (hwaddr_aton(blobmsg_data(tb[BEACON_REQ_ADDR]), addr)) + return UBUS_STATUS_INVALID_ARGUMENT; + + if (tb[BEACON_REQ_BSSID] && + hwaddr_aton(blobmsg_data(tb[BEACON_REQ_BSSID]), bssid)) + return UBUS_STATUS_INVALID_ARGUMENT; + + req = wpabuf_alloc(buf_len); + if (!req) + return UBUS_STATUS_UNKNOWN_ERROR; + + /* 1: regulatory class */ + wpabuf_put_u8(req, blobmsg_get_u32(tb[BEACON_REQ_OP_CLASS])); + + /* 2: channel number */ + wpabuf_put_u8(req, blobmsg_get_u32(tb[BEACON_REQ_CHANNEL])); + + /* 3-4: randomization interval */ + wpabuf_put_le16(req, 0); + + /* 5-6: duration */ + wpabuf_put_le16(req, blobmsg_get_u32(tb[BEACON_REQ_DURATION])); + + /* 7: mode */ + wpabuf_put_u8(req, blobmsg_get_u32(tb[BEACON_REQ_MODE])); + + /* 8-13: BSSID */ + wpabuf_put_data(req, bssid, ETH_ALEN); + + if ((cur = tb[BEACON_REQ_SSID]) != NULL) { + wpabuf_put_u8(req, WLAN_EID_SSID); + wpabuf_put_u8(req, blobmsg_data_len(cur) - 1); + wpabuf_put_data(req, blobmsg_data(cur), blobmsg_data_len(cur) - 1); + } + + ret = hostapd_send_beacon_req(hapd, addr, 0, req); + if (ret < 0) + return -ret; + + return 0; +} + +enum { + LM_REQ_ADDR, + LM_REQ_TX_POWER_USED, + LM_REQ_TX_POWER_MAX, + __LM_REQ_MAX, +}; + +static const struct blobmsg_policy lm_req_policy[__LM_REQ_MAX] = { + [LM_REQ_ADDR] = { "addr", BLOBMSG_TYPE_STRING }, + [LM_REQ_TX_POWER_USED] = { "tx-power-used", BLOBMSG_TYPE_INT32 }, + [LM_REQ_TX_POWER_MAX] = { "tx-power-max", BLOBMSG_TYPE_INT32 }, +}; + +static int +hostapd_rrm_lm_req(struct ubus_context *ctx, struct ubus_object *obj, + struct ubus_request_data *ureq, const char *method, + struct blob_attr *msg) +{ + struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj); + struct blob_attr *tb[__LM_REQ_MAX]; + struct wpabuf *buf; + u8 addr[ETH_ALEN]; + int ret; + int8_t txp_used, txp_max; + + txp_used = 0; + txp_max = 0; + + blobmsg_parse(lm_req_policy, __LM_REQ_MAX, tb, blob_data(msg), blob_len(msg)); + + if (!tb[LM_REQ_ADDR]) + return UBUS_STATUS_INVALID_ARGUMENT; + + if (tb[LM_REQ_TX_POWER_USED]) + txp_used = (int8_t) blobmsg_get_u32(tb[LM_REQ_TX_POWER_USED]); + + if (tb[LM_REQ_TX_POWER_MAX]) + txp_max = (int8_t) blobmsg_get_u32(tb[LM_REQ_TX_POWER_MAX]); + + if (hwaddr_aton(blobmsg_data(tb[LM_REQ_ADDR]), addr)) + return UBUS_STATUS_INVALID_ARGUMENT; + + buf = wpabuf_alloc(5); + if (!buf) + return UBUS_STATUS_UNKNOWN_ERROR; + + wpabuf_put_u8(buf, WLAN_ACTION_RADIO_MEASUREMENT); + wpabuf_put_u8(buf, WLAN_RRM_LINK_MEASUREMENT_REQUEST); + wpabuf_put_u8(buf, 1); + /* TX-Power used */ + wpabuf_put_u8(buf, txp_used); + /* Max TX Power */ + wpabuf_put_u8(buf, txp_max); + + ret = hostapd_drv_send_action(hapd, hapd->iface->freq, 0, addr, + wpabuf_head(buf), wpabuf_len(buf)); + + wpabuf_free(buf); + if (ret < 0) + return -ret; + + return 0; +} + + +void hostapd_ubus_handle_link_measurement(struct hostapd_data *hapd, const u8 *data, size_t len) +{ + const struct ieee80211_mgmt *mgmt = (const struct ieee80211_mgmt *) data; + const u8 *pos, *end; + u8 token; + + end = data + len; + token = mgmt->u.action.u.rrm.dialog_token; + pos = mgmt->u.action.u.rrm.variable; + + if (end - pos < 8) + return; + + if (!hapd->ubus.obj.has_subscribers) + return; + + blob_buf_init(&b, 0); + blobmsg_add_macaddr(&b, "address", mgmt->sa); + blobmsg_add_u16(&b, "dialog-token", token); + blobmsg_add_u16(&b, "rx-antenna-id", pos[4]); + blobmsg_add_u16(&b, "tx-antenna-id", pos[5]); + blobmsg_add_u16(&b, "rcpi", pos[6]); + blobmsg_add_u16(&b, "rsni", pos[7]); + + ubus_notify(ctx, &hapd->ubus.obj, "link-measurement-report", b.head, -1); +} + + +#ifdef CONFIG_WNM_AP + +static int +hostapd_bss_tr_send(struct hostapd_data *hapd, u8 *addr, bool disassoc_imminent, bool abridged, + u16 disassoc_timer, u8 validity_period, u8 dialog_token, + struct blob_attr *neighbors, u8 mbo_reason, u8 cell_pref, u8 reassoc_delay) +{ + struct blob_attr *cur; + struct sta_info *sta; + int nr_len = 0; + int rem; + u8 *nr = NULL; + u8 req_mode = 0; + u8 mbo[10]; + size_t mbo_len = 0; + + sta = ap_get_sta(hapd, addr); + if (!sta) + return UBUS_STATUS_NOT_FOUND; + + if (neighbors) { + u8 *nr_cur; + + if (blobmsg_check_array(neighbors, + BLOBMSG_TYPE_STRING) < 0) + return UBUS_STATUS_INVALID_ARGUMENT; + + blobmsg_for_each_attr(cur, neighbors, rem) { + int len = strlen(blobmsg_get_string(cur)); + + if (len % 2) + return UBUS_STATUS_INVALID_ARGUMENT; + + nr_len += (len / 2) + 2; + } + + if (nr_len) { + nr = os_zalloc(nr_len); + if (!nr) + return UBUS_STATUS_UNKNOWN_ERROR; + } + + nr_cur = nr; + blobmsg_for_each_attr(cur, neighbors, rem) { + int len = strlen(blobmsg_get_string(cur)) / 2; + + *nr_cur++ = WLAN_EID_NEIGHBOR_REPORT; + *nr_cur++ = (u8) len; + if (hexstr2bin(blobmsg_data(cur), nr_cur, len)) { + free(nr); + return UBUS_STATUS_INVALID_ARGUMENT; + } + + nr_cur += len; + } + } + + if (nr) + req_mode |= WNM_BSS_TM_REQ_PREF_CAND_LIST_INCLUDED; + + if (abridged) + req_mode |= WNM_BSS_TM_REQ_ABRIDGED; + + if (disassoc_imminent) + req_mode |= WNM_BSS_TM_REQ_DISASSOC_IMMINENT; + +#ifdef CONFIG_MBO + u8 *mbo_pos = mbo; + + if (mbo_reason > MBO_TRANSITION_REASON_PREMIUM_AP) + return UBUS_STATUS_INVALID_ARGUMENT; + + if (cell_pref != 0 && cell_pref != 1 && cell_pref != 255) + return UBUS_STATUS_INVALID_ARGUMENT; + + if (reassoc_delay > 65535 || (reassoc_delay && !disassoc_imminent)) + return UBUS_STATUS_INVALID_ARGUMENT; + + *mbo_pos++ = MBO_ATTR_ID_TRANSITION_REASON; + *mbo_pos++ = 1; + *mbo_pos++ = mbo_reason; + *mbo_pos++ = MBO_ATTR_ID_CELL_DATA_PREF; + *mbo_pos++ = 1; + *mbo_pos++ = cell_pref; + + if (reassoc_delay) { + *mbo_pos++ = MBO_ATTR_ID_ASSOC_RETRY_DELAY; + *mbo_pos++ = 2; + WPA_PUT_LE16(mbo_pos, reassoc_delay); + mbo_pos += 2; + } + + mbo_len = mbo_pos - mbo; +#endif + + if (wnm_send_bss_tm_req(hapd, sta, req_mode, disassoc_timer, validity_period, NULL, + dialog_token, NULL, nr, nr_len, mbo_len ? mbo : NULL, mbo_len)) + return UBUS_STATUS_UNKNOWN_ERROR; + + return 0; +} + +enum { + BSS_TR_ADDR, + BSS_TR_DA_IMMINENT, + BSS_TR_DA_TIMER, + BSS_TR_VALID_PERIOD, + BSS_TR_NEIGHBORS, + BSS_TR_ABRIDGED, + BSS_TR_DIALOG_TOKEN, +#ifdef CONFIG_MBO + BSS_TR_MBO_REASON, + BSS_TR_CELL_PREF, + BSS_TR_REASSOC_DELAY, +#endif + __BSS_TR_DISASSOC_MAX +}; + +static const struct blobmsg_policy bss_tr_policy[__BSS_TR_DISASSOC_MAX] = { + [BSS_TR_ADDR] = { "addr", BLOBMSG_TYPE_STRING }, + [BSS_TR_DA_IMMINENT] = { "disassociation_imminent", BLOBMSG_TYPE_BOOL }, + [BSS_TR_DA_TIMER] = { "disassociation_timer", BLOBMSG_TYPE_INT32 }, + [BSS_TR_VALID_PERIOD] = { "validity_period", BLOBMSG_TYPE_INT32 }, + [BSS_TR_NEIGHBORS] = { "neighbors", BLOBMSG_TYPE_ARRAY }, + [BSS_TR_ABRIDGED] = { "abridged", BLOBMSG_TYPE_BOOL }, + [BSS_TR_DIALOG_TOKEN] = { "dialog_token", BLOBMSG_TYPE_INT32 }, +#ifdef CONFIG_MBO + [BSS_TR_MBO_REASON] = { "mbo_reason", BLOBMSG_TYPE_INT32 }, + [BSS_TR_CELL_PREF] = { "cell_pref", BLOBMSG_TYPE_INT32 }, + [BSS_TR_REASSOC_DELAY] = { "reassoc_delay", BLOBMSG_TYPE_INT32 }, +#endif +}; + +static int +hostapd_bss_transition_request(struct ubus_context *ctx, struct ubus_object *obj, + struct ubus_request_data *ureq, const char *method, + struct blob_attr *msg) +{ + struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj); + struct blob_attr *tb[__BSS_TR_DISASSOC_MAX]; + struct sta_info *sta; + u32 da_timer = 0; + u32 valid_period = 0; + u8 addr[ETH_ALEN]; + u32 dialog_token = 1; + bool abridged; + bool da_imminent; + u8 mbo_reason; + u8 cell_pref; + u8 reassoc_delay; + + blobmsg_parse(bss_tr_policy, __BSS_TR_DISASSOC_MAX, tb, blob_data(msg), blob_len(msg)); + + if (!tb[BSS_TR_ADDR]) + return UBUS_STATUS_INVALID_ARGUMENT; + + if (hwaddr_aton(blobmsg_data(tb[BSS_TR_ADDR]), addr)) + return UBUS_STATUS_INVALID_ARGUMENT; + + if (tb[BSS_TR_DA_TIMER]) + da_timer = blobmsg_get_u32(tb[BSS_TR_DA_TIMER]); + + if (tb[BSS_TR_VALID_PERIOD]) + valid_period = blobmsg_get_u32(tb[BSS_TR_VALID_PERIOD]); + + if (tb[BSS_TR_DIALOG_TOKEN]) + dialog_token = blobmsg_get_u32(tb[BSS_TR_DIALOG_TOKEN]); + + da_imminent = !!(tb[BSS_TR_DA_IMMINENT] && blobmsg_get_bool(tb[BSS_TR_DA_IMMINENT])); + abridged = !!(tb[BSS_TR_ABRIDGED] && blobmsg_get_bool(tb[BSS_TR_ABRIDGED])); + +#ifdef CONFIG_MBO + if (tb[BSS_TR_MBO_REASON]) + mbo_reason = blobmsg_get_u32(tb[BSS_TR_MBO_REASON]); + + if (tb[BSS_TR_CELL_PREF]) + cell_pref = blobmsg_get_u32(tb[BSS_TR_CELL_PREF]); + + if (tb[BSS_TR_REASSOC_DELAY]) + reassoc_delay = blobmsg_get_u32(tb[BSS_TR_REASSOC_DELAY]); +#endif + + return hostapd_bss_tr_send(hapd, addr, da_imminent, abridged, da_timer, valid_period, + dialog_token, tb[BSS_TR_NEIGHBORS], mbo_reason, cell_pref, reassoc_delay); +} +#endif + +#ifdef CONFIG_AIRTIME_POLICY +enum { + UPDATE_AIRTIME_STA, + UPDATE_AIRTIME_WEIGHT, + __UPDATE_AIRTIME_MAX, +}; + + +static const struct blobmsg_policy airtime_policy[__UPDATE_AIRTIME_MAX] = { + [UPDATE_AIRTIME_STA] = { "sta", BLOBMSG_TYPE_STRING }, + [UPDATE_AIRTIME_WEIGHT] = { "weight", BLOBMSG_TYPE_INT32 }, +}; + +static int +hostapd_bss_update_airtime(struct ubus_context *ctx, struct ubus_object *obj, + struct ubus_request_data *ureq, const char *method, + struct blob_attr *msg) +{ + struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj); + struct blob_attr *tb[__UPDATE_AIRTIME_MAX]; + struct sta_info *sta = NULL; + u8 addr[ETH_ALEN]; + int weight; + + blobmsg_parse(airtime_policy, __UPDATE_AIRTIME_MAX, tb, blob_data(msg), blob_len(msg)); + + if (!tb[UPDATE_AIRTIME_WEIGHT]) + return UBUS_STATUS_INVALID_ARGUMENT; + + weight = blobmsg_get_u32(tb[UPDATE_AIRTIME_WEIGHT]); + + if (!tb[UPDATE_AIRTIME_STA]) { + if (!weight) + return UBUS_STATUS_INVALID_ARGUMENT; + + hapd->conf->airtime_weight = weight; + return 0; + } + + if (hwaddr_aton(blobmsg_data(tb[UPDATE_AIRTIME_STA]), addr)) + return UBUS_STATUS_INVALID_ARGUMENT; + + sta = ap_get_sta(hapd, addr); + if (!sta) + return UBUS_STATUS_NOT_FOUND; + + sta->dyn_airtime_weight = weight; + airtime_policy_new_sta(hapd, sta); + + return 0; +} +#endif + +#ifdef CONFIG_TAXONOMY +static const struct blobmsg_policy addr_policy[] = { + { "address", BLOBMSG_TYPE_STRING } +}; + +static bool +hostapd_add_b64_data(const char *name, const struct wpabuf *buf) +{ + char *str; + + if (!buf) + return false; + + str = blobmsg_alloc_string_buffer(&b, name, B64_ENCODE_LEN(wpabuf_len(buf))); + b64_encode(wpabuf_head(buf), wpabuf_len(buf), str, B64_ENCODE_LEN(wpabuf_len(buf))); + blobmsg_add_string_buffer(&b); + + return true; +} + +static int +hostapd_bss_get_sta_ies(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 blob_attr *tb; + struct sta_info *sta; + u8 addr[ETH_ALEN]; + + blobmsg_parse(addr_policy, 1, &tb, blobmsg_data(msg), blobmsg_len(msg)); + + if (!tb || hwaddr_aton(blobmsg_data(tb), addr)) + return UBUS_STATUS_INVALID_ARGUMENT; + + sta = ap_get_sta(hapd, addr); + if (!sta || (!sta->probe_ie_taxonomy && !sta->assoc_ie_taxonomy)) + return UBUS_STATUS_NOT_FOUND; + + blob_buf_init(&b, 0); + hostapd_add_b64_data("probe_ie", sta->probe_ie_taxonomy); + hostapd_add_b64_data("assoc_ie", sta->assoc_ie_taxonomy); + ubus_send_reply(ctx, req, b.head); + + return 0; +} +#endif + + +static const struct ubus_method bss_methods[] = { + UBUS_METHOD_NOARG("reload", hostapd_bss_reload), + UBUS_METHOD_NOARG("get_clients", hostapd_bss_get_clients), +#ifdef CONFIG_TAXONOMY + UBUS_METHOD("get_sta_ies", hostapd_bss_get_sta_ies, addr_policy), +#endif + UBUS_METHOD_NOARG("get_status", hostapd_bss_get_status), + UBUS_METHOD("del_client", hostapd_bss_del_client, del_policy), +#ifdef CONFIG_AIRTIME_POLICY + UBUS_METHOD("update_airtime", hostapd_bss_update_airtime, airtime_policy), +#endif + UBUS_METHOD_NOARG("list_bans", hostapd_bss_list_bans), +#ifdef CONFIG_WPS + UBUS_METHOD_NOARG("wps_start", hostapd_bss_wps_start), + UBUS_METHOD_NOARG("wps_status", hostapd_bss_wps_status), + UBUS_METHOD_NOARG("wps_cancel", hostapd_bss_wps_cancel), +#endif + UBUS_METHOD_NOARG("update_beacon", hostapd_bss_update_beacon), + UBUS_METHOD_NOARG("get_features", hostapd_bss_get_features), +#ifdef NEED_AP_MLME + UBUS_METHOD("switch_chan", hostapd_switch_chan, csa_policy), +#endif + UBUS_METHOD("set_vendor_elements", hostapd_vendor_elements, ve_policy), + UBUS_METHOD("notify_response", hostapd_notify_response, notify_policy), + UBUS_METHOD("bss_mgmt_enable", hostapd_bss_mgmt_enable, bss_mgmt_enable_policy), + UBUS_METHOD_NOARG("rrm_nr_get_own", hostapd_rrm_nr_get_own), + UBUS_METHOD_NOARG("rrm_nr_list", hostapd_rrm_nr_list), + UBUS_METHOD("rrm_nr_set", hostapd_rrm_nr_set, nr_set_policy), + UBUS_METHOD("rrm_beacon_req", hostapd_rrm_beacon_req, beacon_req_policy), + UBUS_METHOD("link_measurement_req", hostapd_rrm_lm_req, lm_req_policy), +#ifdef CONFIG_WNM_AP + UBUS_METHOD("bss_transition_request", hostapd_bss_transition_request, bss_tr_policy), +#endif +}; + +static struct ubus_object_type bss_object_type = + UBUS_OBJECT_TYPE("hostapd_bss", bss_methods); + +static int avl_compare_macaddr(const void *k1, const void *k2, void *ptr) +{ + return memcmp(k1, k2, ETH_ALEN); +} + +void hostapd_ubus_add_bss(struct hostapd_data *hapd) +{ + struct ubus_object *obj = &hapd->ubus.obj; + char *name; + int ret; + +#ifdef CONFIG_MESH + if (hapd->conf->mesh & MESH_ENABLED) + return; +#endif + + if (!hostapd_ubus_init()) + return; + + if (asprintf(&name, "hostapd.%s", hapd->conf->iface) < 0) + return; + + avl_init(&hapd->ubus.banned, avl_compare_macaddr, false, NULL); + obj->name = name; + obj->type = &bss_object_type; + obj->methods = bss_object_type.methods; + obj->n_methods = bss_object_type.n_methods; + ret = ubus_add_object(ctx, obj); + hostapd_ubus_ref_inc(); +} + +void hostapd_ubus_free_bss(struct hostapd_data *hapd) +{ + struct ubus_object *obj = &hapd->ubus.obj; + char *name = (char *) obj->name; + +#ifdef CONFIG_MESH + if (hapd->conf->mesh & MESH_ENABLED) + return; +#endif + + if (!ctx) + return; + + if (obj->id) { + ubus_remove_object(ctx, obj); + hostapd_ubus_ref_dec(); + } + + 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"); +} + +struct ubus_event_req { + struct ubus_notify_request nreq; + int resp; +}; + +static void +ubus_event_cb(struct ubus_notify_request *req, int idx, int ret) +{ + struct ubus_event_req *ureq = container_of(req, struct ubus_event_req, nreq); + + ureq->resp = ret; +} + +int hostapd_ubus_handle_event(struct hostapd_data *hapd, struct hostapd_ubus_request *req) +{ + struct ubus_banned_client *ban; + const char *types[HOSTAPD_UBUS_TYPE_MAX] = { + [HOSTAPD_UBUS_PROBE_REQ] = "probe", + [HOSTAPD_UBUS_AUTH_REQ] = "auth", + [HOSTAPD_UBUS_ASSOC_REQ] = "assoc", + }; + const char *type = "mgmt"; + struct ubus_event_req ureq = {}; + const u8 *addr; + + if (req->mgmt_frame) + addr = req->mgmt_frame->sa; + else + addr = req->addr; + + ban = avl_find_element(&hapd->ubus.banned, addr, ban, avl); + if (ban) + return WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA; + + if (!hapd->ubus.obj.has_subscribers) + return WLAN_STATUS_SUCCESS; + + if (req->type < ARRAY_SIZE(types)) + type = types[req->type]; + + blob_buf_init(&b, 0); + blobmsg_add_macaddr(&b, "address", addr); + if (req->mgmt_frame) + blobmsg_add_macaddr(&b, "target", req->mgmt_frame->da); + if (req->ssi_signal) + blobmsg_add_u32(&b, "signal", req->ssi_signal); + blobmsg_add_u32(&b, "freq", hapd->iface->freq); + + if (req->elems) { + if(req->elems->ht_capabilities) + { + struct ieee80211_ht_capabilities *ht_capabilities; + void *ht_cap, *ht_cap_mcs_set, *mcs_set; + + + ht_capabilities = (struct ieee80211_ht_capabilities*) req->elems->ht_capabilities; + ht_cap = blobmsg_open_table(&b, "ht_capabilities"); + blobmsg_add_u16(&b, "ht_capabilities_info", ht_capabilities->ht_capabilities_info); + ht_cap_mcs_set = blobmsg_open_table(&b, "supported_mcs_set"); + blobmsg_add_u16(&b, "a_mpdu_params", ht_capabilities->a_mpdu_params); + blobmsg_add_u16(&b, "ht_extended_capabilities", ht_capabilities->ht_extended_capabilities); + blobmsg_add_u32(&b, "tx_bf_capability_info", ht_capabilities->tx_bf_capability_info); + blobmsg_add_u16(&b, "asel_capabilities", ht_capabilities->asel_capabilities); + mcs_set = blobmsg_open_array(&b, "supported_mcs_set"); + for (int i = 0; i < 16; i++) { + blobmsg_add_u16(&b, NULL, (u16) ht_capabilities->supported_mcs_set[i]); + } + blobmsg_close_array(&b, mcs_set); + blobmsg_close_table(&b, ht_cap_mcs_set); + blobmsg_close_table(&b, ht_cap); + } + if(req->elems->vht_capabilities) + { + struct ieee80211_vht_capabilities *vht_capabilities; + void *vht_cap, *vht_cap_mcs_set; + + vht_capabilities = (struct ieee80211_vht_capabilities*) req->elems->vht_capabilities; + vht_cap = blobmsg_open_table(&b, "vht_capabilities"); + blobmsg_add_u32(&b, "vht_capabilities_info", vht_capabilities->vht_capabilities_info); + vht_cap_mcs_set = blobmsg_open_table(&b, "vht_supported_mcs_set"); + blobmsg_add_u16(&b, "rx_map", vht_capabilities->vht_supported_mcs_set.rx_map); + blobmsg_add_u16(&b, "rx_highest", vht_capabilities->vht_supported_mcs_set.rx_highest); + blobmsg_add_u16(&b, "tx_map", vht_capabilities->vht_supported_mcs_set.tx_map); + blobmsg_add_u16(&b, "tx_highest", vht_capabilities->vht_supported_mcs_set.tx_highest); + blobmsg_close_table(&b, vht_cap_mcs_set); + blobmsg_close_table(&b, vht_cap); + } + } + + if (!hapd->ubus.notify_response) { + ubus_notify(ctx, &hapd->ubus.obj, type, b.head, -1); + return WLAN_STATUS_SUCCESS; + } + + if (ubus_notify_async(ctx, &hapd->ubus.obj, type, b.head, &ureq.nreq)) + return WLAN_STATUS_SUCCESS; + + ureq.nreq.status_cb = ubus_event_cb; + ubus_complete_request(ctx, &ureq.nreq.req, 100); + + if (ureq.resp) + return ureq.resp; + + return WLAN_STATUS_SUCCESS; +} + +void hostapd_ubus_notify(struct hostapd_data *hapd, const char *type, const u8 *addr) +{ + if (!hapd->ubus.obj.has_subscribers) + return; + + if (!addr) + return; + + blob_buf_init(&b, 0); + blobmsg_add_macaddr(&b, "address", addr); + + ubus_notify(ctx, &hapd->ubus.obj, type, b.head, -1); +} + +void hostapd_ubus_notify_authorized(struct hostapd_data *hapd, struct sta_info *sta, + const char *auth_alg) +{ + if (!hapd->ubus.obj.has_subscribers) + return; + + blob_buf_init(&b, 0); + blobmsg_add_macaddr(&b, "address", sta->addr); + if (auth_alg) + blobmsg_add_string(&b, "auth-alg", auth_alg); + + ubus_notify(ctx, &hapd->ubus.obj, "sta-authorized", b.head, -1); +} + +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) +{ + if (!hapd->ubus.obj.has_subscribers) + return; + + if (!addr || !rep) + return; + + blob_buf_init(&b, 0); + blobmsg_add_macaddr(&b, "address", addr); + blobmsg_add_u16(&b, "op-class", rep->op_class); + blobmsg_add_u16(&b, "channel", rep->channel); + blobmsg_add_u64(&b, "start-time", rep->start_time); + blobmsg_add_u16(&b, "duration", rep->duration); + blobmsg_add_u16(&b, "report-info", rep->report_info); + blobmsg_add_u16(&b, "rcpi", rep->rcpi); + blobmsg_add_u16(&b, "rsni", rep->rsni); + blobmsg_add_macaddr(&b, "bssid", rep->bssid); + blobmsg_add_u16(&b, "antenna-id", rep->antenna_id); + blobmsg_add_u16(&b, "parent-tsf", rep->parent_tsf); + blobmsg_add_u16(&b, "rep-mode", rep_mode); + + 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 (!ctx) + 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); + } +} + +#ifdef CONFIG_WNM_AP +static void hostapd_ubus_notify_bss_transition_add_candidate_list( + const u8 *candidate_list, u16 candidate_list_len) +{ + char *cl_str; + int i; + + if (candidate_list_len == 0) + return; + + cl_str = blobmsg_alloc_string_buffer(&b, "candidate-list", candidate_list_len * 2 + 1); + for (i = 0; i < candidate_list_len; i++) + snprintf(&cl_str[i*2], 3, "%02X", candidate_list[i]); + blobmsg_add_string_buffer(&b); + +} +#endif + +void hostapd_ubus_notify_bss_transition_response( + struct hostapd_data *hapd, const u8 *addr, u8 dialog_token, u8 status_code, + u8 bss_termination_delay, const u8 *target_bssid, + const u8 *candidate_list, u16 candidate_list_len) +{ +#ifdef CONFIG_WNM_AP + u16 i; + + if (!hapd->ubus.obj.has_subscribers) + return; + + if (!addr) + return; + + blob_buf_init(&b, 0); + blobmsg_add_macaddr(&b, "address", addr); + blobmsg_add_u8(&b, "dialog-token", dialog_token); + blobmsg_add_u8(&b, "status-code", status_code); + blobmsg_add_u8(&b, "bss-termination-delay", bss_termination_delay); + if (target_bssid) + blobmsg_add_macaddr(&b, "target-bssid", target_bssid); + + hostapd_ubus_notify_bss_transition_add_candidate_list(candidate_list, candidate_list_len); + + ubus_notify(ctx, &hapd->ubus.obj, "bss-transition-response", b.head, -1); +#endif +} + +int hostapd_ubus_notify_bss_transition_query( + struct hostapd_data *hapd, const u8 *addr, u8 dialog_token, u8 reason, + const u8 *candidate_list, u16 candidate_list_len) +{ +#ifdef CONFIG_WNM_AP + struct ubus_event_req ureq = {}; + char *cl_str; + u16 i; + + if (!hapd->ubus.obj.has_subscribers) + return 0; + + if (!addr) + return 0; + + blob_buf_init(&b, 0); + blobmsg_add_macaddr(&b, "address", addr); + blobmsg_add_u8(&b, "dialog-token", dialog_token); + blobmsg_add_u8(&b, "reason", reason); + hostapd_ubus_notify_bss_transition_add_candidate_list(candidate_list, candidate_list_len); + + if (!hapd->ubus.notify_response) { + ubus_notify(ctx, &hapd->ubus.obj, "bss-transition-query", b.head, -1); + return 0; + } + + if (ubus_notify_async(ctx, &hapd->ubus.obj, "bss-transition-query", b.head, &ureq.nreq)) + return 0; + + ureq.nreq.status_cb = ubus_event_cb; + ubus_complete_request(ctx, &ureq.nreq.req, 100); + + return ureq.resp; +#endif +} diff --git a/package/network/services/hostapd/src/src/utils/ap/ubus.h b/package/network/services/hostapd/src/src/utils/ap/ubus.h new file mode 100644 index 00000000000000..22767d67ee7564 --- /dev/null +++ b/package/network/services/hostapd/src/src/utils/ap/ubus.h @@ -0,0 +1,157 @@ +/* + * hostapd / ubus support + * Copyright (c) 2013, Felix Fietkau + * + * This software may be distributed under the terms of the BSD license. + * See README for more details. + */ +#ifndef __HOSTAPD_UBUS_H +#define __HOSTAPD_UBUS_H + +#include "sta_info.h" + +enum hostapd_ubus_event_type { + HOSTAPD_UBUS_PROBE_REQ, + HOSTAPD_UBUS_AUTH_REQ, + HOSTAPD_UBUS_ASSOC_REQ, + HOSTAPD_UBUS_TYPE_MAX +}; + +struct hostapd_ubus_request { + enum hostapd_ubus_event_type type; + const struct ieee80211_mgmt *mgmt_frame; + const struct ieee802_11_elems *elems; + int ssi_signal; /* dBm */ + const u8 *addr; +}; + +struct hostapd_iface; +struct hostapd_data; +struct hapd_interfaces; +struct rrm_measurement_beacon_report; +struct sta_info; + +#ifdef UBUS_SUPPORT + +#include +#include + +struct hostapd_ubus_bss { + struct ubus_object obj; + struct avl_tree banned; + int notify_response; +}; + +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_handle_link_measurement(struct hostapd_data *hapd, const u8 *data, size_t len); +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, + 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_notify_bss_transition_response( + struct hostapd_data *hapd, const u8 *addr, u8 dialog_token, u8 status_code, + u8 bss_termination_delay, const u8 *target_bssid, + const u8 *candidate_list, u16 candidate_list_len); +void hostapd_ubus_add(struct hapd_interfaces *interfaces); +void hostapd_ubus_free(struct hapd_interfaces *interfaces); +int hostapd_ubus_notify_bss_transition_query( + struct hostapd_data *hapd, const u8 *addr, u8 dialog_token, u8 reason, + const u8 *candidate_list, u16 candidate_list_len); +void hostapd_ubus_notify_authorized(struct hostapd_data *hapd, struct sta_info *sta, + const char *auth_alg); + +#else + +struct hostapd_ubus_bss {}; + +static inline void hostapd_ubus_add_iface(struct hostapd_iface *iface) +{ +} + +static inline void hostapd_ubus_free_iface(struct hostapd_iface *iface) +{ +} + +static inline void hostapd_ubus_add_bss(struct hostapd_data *hapd) +{ +} + +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; +} + +static inline void hostapd_ubus_handle_link_measurement(struct hostapd_data *hapd, const u8 *data, size_t len) +{ +} + +static inline void hostapd_ubus_notify(struct hostapd_data *hapd, const char *type, const u8 *mac) +{ +} + +static inline 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) +{ +} +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_notify_bss_transition_response( + struct hostapd_data *hapd, const u8 *addr, u8 dialog_token, u8 status_code, + u8 bss_termination_delay, const u8 *target_bssid, + const u8 *candidate_list, u16 candidate_list_len) +{ +} + +static inline void hostapd_ubus_add(struct hapd_interfaces *interfaces) +{ +} + +static inline void hostapd_ubus_free(struct hapd_interfaces *interfaces) +{ +} + +static inline int hostapd_ubus_notify_bss_transition_query( + struct hostapd_data *hapd, const u8 *addr, u8 dialog_token, u8 reason, + const u8 *candidate_list, u16 candidate_list_len) +{ + return 0; +} + +static inline void +hostapd_ubus_notify_authorized(struct hostapd_data *hapd, struct sta_info *sta, + const char *auth_alg) +{ +} + +#endif + +#endif diff --git a/package/network/services/hostapd/src/src/utils/ap/ucode.c b/package/network/services/hostapd/src/src/utils/ap/ucode.c new file mode 100644 index 00000000000000..68fb450884e2f3 --- /dev/null +++ b/package/network/services/hostapd/src/src/utils/ap/ucode.c @@ -0,0 +1,817 @@ +#include + +#include "utils/includes.h" +#include "utils/common.h" +#include "utils/ucode.h" +#include "hostapd.h" +#include "beacon.h" +#include "hw_features.h" +#include "ap_drv_ops.h" +#include "dfs.h" +#include "acs.h" +#include + +static uc_resource_type_t *global_type, *bss_type, *iface_type; +static struct hapd_interfaces *interfaces; +static uc_value_t *global, *bss_registry, *iface_registry; +static uc_vm_t *vm; + +static uc_value_t * +hostapd_ucode_bss_get_uval(struct hostapd_data *hapd) +{ + uc_value_t *val; + + if (hapd->ucode.idx) + return wpa_ucode_registry_get(bss_registry, hapd->ucode.idx); + + val = uc_resource_new(bss_type, hapd); + hapd->ucode.idx = wpa_ucode_registry_add(bss_registry, val); + + return val; +} + +static uc_value_t * +hostapd_ucode_iface_get_uval(struct hostapd_iface *hapd) +{ + uc_value_t *val; + + if (hapd->ucode.idx) + return wpa_ucode_registry_get(iface_registry, hapd->ucode.idx); + + val = uc_resource_new(iface_type, hapd); + hapd->ucode.idx = wpa_ucode_registry_add(iface_registry, val); + + return val; +} + +static void +hostapd_ucode_update_bss_list(struct hostapd_iface *iface, uc_value_t *if_bss, uc_value_t *bss) +{ + uc_value_t *list; + int i; + + list = ucv_array_new(vm); + for (i = 0; iface->bss && i < iface->num_bss; i++) { + struct hostapd_data *hapd = iface->bss[i]; + uc_value_t *val = hostapd_ucode_bss_get_uval(hapd); + + ucv_array_set(list, i, ucv_get(ucv_string_new(hapd->conf->iface))); + ucv_object_add(bss, hapd->conf->iface, ucv_get(val)); + } + ucv_object_add(if_bss, iface->phy, ucv_get(list)); +} + +static void +hostapd_ucode_update_interfaces(void) +{ + uc_value_t *ifs = ucv_object_new(vm); + uc_value_t *if_bss = ucv_array_new(vm); + uc_value_t *bss = ucv_object_new(vm); + int i; + + for (i = 0; i < interfaces->count; i++) { + struct hostapd_iface *iface = interfaces->iface[i]; + + ucv_object_add(ifs, iface->phy, ucv_get(hostapd_ucode_iface_get_uval(iface))); + hostapd_ucode_update_bss_list(iface, if_bss, bss); + } + + ucv_object_add(ucv_prototype_get(global), "interfaces", ucv_get(ifs)); + ucv_object_add(ucv_prototype_get(global), "interface_bss", ucv_get(if_bss)); + ucv_object_add(ucv_prototype_get(global), "bss", ucv_get(bss)); + ucv_gc(vm); +} + +static uc_value_t * +uc_hostapd_add_iface(uc_vm_t *vm, size_t nargs) +{ + uc_value_t *iface = uc_fn_arg(0); + char *data; + int ret; + + if (ucv_type(iface) != UC_STRING) + return ucv_int64_new(-1); + + data = strdup(ucv_string_get(iface)); + ret = hostapd_add_iface(interfaces, data); + free(data); + + hostapd_ucode_update_interfaces(); + + return ucv_int64_new(ret); +} + +static uc_value_t * +uc_hostapd_remove_iface(uc_vm_t *vm, size_t nargs) +{ + uc_value_t *iface = uc_fn_arg(0); + + if (ucv_type(iface) != UC_STRING) + return NULL; + + hostapd_remove_iface(interfaces, ucv_string_get(iface)); + hostapd_ucode_update_interfaces(); + + return NULL; +} + +static struct hostapd_vlan * +bss_conf_find_vlan(struct hostapd_bss_config *bss, int id) +{ + struct hostapd_vlan *vlan; + + for (vlan = bss->vlan; vlan; vlan = vlan->next) + if (vlan->vlan_id == id) + return vlan; + + return NULL; +} + +static int +bss_conf_rename_vlan(struct hostapd_data *hapd, struct hostapd_vlan *vlan, + const char *ifname) +{ + if (!strcmp(ifname, vlan->ifname)) + return 0; + + hostapd_drv_if_rename(hapd, WPA_IF_AP_VLAN, vlan->ifname, ifname); + os_strlcpy(vlan->ifname, ifname, sizeof(vlan->ifname)); + + return 0; +} + +static int +bss_reload_vlans(struct hostapd_data *hapd, struct hostapd_bss_config *bss) +{ + struct hostapd_bss_config *old_bss = hapd->conf; + struct hostapd_vlan *vlan, *vlan_new, *wildcard; + char ifname[IFNAMSIZ + 1], vlan_ifname[IFNAMSIZ + 1], *pos; + int ret; + + vlan = bss_conf_find_vlan(old_bss, VLAN_ID_WILDCARD); + wildcard = bss_conf_find_vlan(bss, VLAN_ID_WILDCARD); + if (!!vlan != !!wildcard) + return -1; + + if (vlan && wildcard && strcmp(vlan->ifname, wildcard->ifname) != 0) + strcpy(vlan->ifname, wildcard->ifname); + else + wildcard = NULL; + + for (vlan = bss->vlan; vlan; vlan = vlan->next) { + if (vlan->vlan_id == VLAN_ID_WILDCARD || + vlan->dynamic_vlan > 0) + continue; + + if (!bss_conf_find_vlan(old_bss, vlan->vlan_id)) + return -1; + } + + for (vlan = old_bss->vlan; vlan; vlan = vlan->next) { + if (vlan->vlan_id == VLAN_ID_WILDCARD) + continue; + + if (vlan->dynamic_vlan == 0) { + vlan_new = bss_conf_find_vlan(bss, vlan->vlan_id); + if (!vlan_new) + return -1; + + if (bss_conf_rename_vlan(hapd, vlan, vlan_new->ifname)) + return -1; + + continue; + } + + if (!wildcard) + continue; + + os_strlcpy(ifname, wildcard->ifname, sizeof(ifname)); + pos = os_strchr(ifname, '#'); + if (!pos) + return -1; + + *pos++ = '\0'; + ret = os_snprintf(vlan_ifname, sizeof(vlan_ifname), "%s%d%s", + ifname, vlan->vlan_id, pos); + if (os_snprintf_error(sizeof(vlan_ifname), ret)) + return -1; + + if (bss_conf_rename_vlan(hapd, vlan, vlan_ifname)) + return -1; + } + + return 0; +} + +static uc_value_t * +uc_hostapd_bss_set_config(uc_vm_t *vm, size_t nargs) +{ + struct hostapd_data *hapd = uc_fn_thisval("hostapd.bss"); + struct hostapd_bss_config *old_bss; + struct hostapd_iface *iface; + struct hostapd_config *conf; + uc_value_t *file = uc_fn_arg(0); + uc_value_t *index = uc_fn_arg(1); + uc_value_t *files_only = uc_fn_arg(2); + unsigned int i, idx = 0; + int ret = -1; + + if (!hapd || ucv_type(file) != UC_STRING) + goto out; + + if (ucv_type(index) == UC_INTEGER) + idx = ucv_int64_get(index); + + iface = hapd->iface; + conf = interfaces->config_read_cb(ucv_string_get(file)); + if (!conf) + goto out; + + if (idx > conf->num_bss || !conf->bss[idx]) + goto free; + + if (ucv_boolean_get(files_only)) { + struct hostapd_bss_config *bss = conf->bss[idx]; + struct hostapd_bss_config *old_bss = hapd->conf; + +#define swap_field(name) \ + do { \ + void *ptr = old_bss->name; \ + old_bss->name = bss->name; \ + bss->name = ptr; \ + } while (0) + + swap_field(ssid.wpa_psk_file); + ret = bss_reload_vlans(hapd, bss); + goto done; + } + + hostapd_bss_deinit_no_free(hapd); + hostapd_drv_stop_ap(hapd); + hostapd_free_hapd_data(hapd); + + old_bss = hapd->conf; + for (i = 0; i < iface->conf->num_bss; i++) + if (iface->conf->bss[i] == hapd->conf) + iface->conf->bss[i] = conf->bss[idx]; + hapd->conf = conf->bss[idx]; + conf->bss[idx] = old_bss; + + hostapd_setup_bss(hapd, hapd == iface->bss[0], true); + hostapd_ucode_update_interfaces(); + +done: + ret = 0; +free: + hostapd_config_free(conf); +out: + return ucv_int64_new(ret); +} + +static void +hostapd_remove_iface_bss_conf(struct hostapd_config *iconf, + struct hostapd_bss_config *conf) +{ + int i; + + for (i = 0; i < iconf->num_bss; i++) + if (iconf->bss[i] == conf) + break; + + if (i == iconf->num_bss) + return; + + for (i++; i < iconf->num_bss; i++) + iconf->bss[i - 1] = iconf->bss[i]; + iconf->num_bss--; +} + + +static uc_value_t * +uc_hostapd_bss_delete(uc_vm_t *vm, size_t nargs) +{ + struct hostapd_data *hapd = uc_fn_thisval("hostapd.bss"); + struct hostapd_iface *iface; + int i, idx; + + if (!hapd) + return NULL; + + iface = hapd->iface; + if (iface->num_bss == 1) { + wpa_printf(MSG_ERROR, "trying to delete last bss of an iface: %s\n", hapd->conf->iface); + return NULL; + } + + for (idx = 0; idx < iface->num_bss; idx++) + if (iface->bss[idx] == hapd) + break; + + if (idx == iface->num_bss) + return NULL; + + for (i = idx + 1; i < iface->num_bss; i++) + iface->bss[i - 1] = iface->bss[i]; + + iface->num_bss--; + + iface->bss[0]->interface_added = 0; + hostapd_drv_set_first_bss(iface->bss[0]); + hapd->interface_added = 1; + + hostapd_drv_stop_ap(hapd); + hostapd_bss_deinit(hapd); + hostapd_remove_iface_bss_conf(iface->conf, hapd->conf); + hostapd_config_free_bss(hapd->conf); + os_free(hapd); + + hostapd_ucode_update_interfaces(); + ucv_gc(vm); + + return NULL; +} + +static uc_value_t * +uc_hostapd_iface_add_bss(uc_vm_t *vm, size_t nargs) +{ + struct hostapd_iface *iface = uc_fn_thisval("hostapd.iface"); + struct hostapd_bss_config *bss; + struct hostapd_config *conf; + struct hostapd_data *hapd; + uc_value_t *file = uc_fn_arg(0); + uc_value_t *index = uc_fn_arg(1); + unsigned int idx = 0; + uc_value_t *ret = NULL; + + if (!iface || ucv_type(file) != UC_STRING) + goto out; + + if (ucv_type(index) == UC_INTEGER) + idx = ucv_int64_get(index); + + conf = interfaces->config_read_cb(ucv_string_get(file)); + if (!conf || idx > conf->num_bss || !conf->bss[idx]) + goto out; + + bss = conf->bss[idx]; + hapd = hostapd_alloc_bss_data(iface, iface->conf, bss); + if (!hapd) + goto out; + + hapd->driver = iface->bss[0]->driver; + hapd->drv_priv = iface->bss[0]->drv_priv; + if (interfaces->ctrl_iface_init && + interfaces->ctrl_iface_init(hapd) < 0) + goto free_hapd; + + if (iface->state == HAPD_IFACE_ENABLED && + hostapd_setup_bss(hapd, -1, true)) + goto deinit_ctrl; + + iface->bss = os_realloc_array(iface->bss, iface->num_bss + 1, + sizeof(*iface->bss)); + iface->bss[iface->num_bss++] = hapd; + + iface->conf->bss = os_realloc_array(iface->conf->bss, + iface->conf->num_bss + 1, + sizeof(*iface->conf->bss)); + iface->conf->bss[iface->conf->num_bss] = bss; + conf->bss[idx] = NULL; + ret = hostapd_ucode_bss_get_uval(hapd); + hostapd_ucode_update_interfaces(); + goto out; + +deinit_ctrl: + if (interfaces->ctrl_iface_deinit) + interfaces->ctrl_iface_deinit(hapd); +free_hapd: + hostapd_free_hapd_data(hapd); + os_free(hapd); +out: + hostapd_config_free(conf); + return ret; +} + +static uc_value_t * +uc_hostapd_iface_set_bss_order(uc_vm_t *vm, size_t nargs) +{ + struct hostapd_iface *iface = uc_fn_thisval("hostapd.iface"); + uc_value_t *bss_list = uc_fn_arg(0); + struct hostapd_data **new_bss; + struct hostapd_bss_config **new_conf; + + if (!iface) + return NULL; + + if (ucv_type(bss_list) != UC_ARRAY || + ucv_array_length(bss_list) != iface->num_bss) + return NULL; + + new_bss = calloc(iface->num_bss, sizeof(*new_bss)); + new_conf = calloc(iface->num_bss, sizeof(*new_conf)); + for (size_t i = 0; i < iface->num_bss; i++) { + struct hostapd_data *bss; + + bss = ucv_resource_data(ucv_array_get(bss_list, i), "hostapd.bss"); + if (bss->iface != iface) + goto free; + + for (size_t k = 0; k < i; k++) + if (new_bss[k] == bss) + goto free; + + new_bss[i] = bss; + new_conf[i] = bss->conf; + } + + new_bss[0]->interface_added = 0; + for (size_t i = 1; i < iface->num_bss; i++) + new_bss[i]->interface_added = 1; + + free(iface->bss); + iface->bss = new_bss; + + free(iface->conf->bss); + iface->conf->bss = new_conf; + iface->conf->num_bss = iface->num_bss; + hostapd_drv_set_first_bss(iface->bss[0]); + + return ucv_boolean_new(true); + +free: + free(new_bss); + free(new_conf); + return NULL; +} + +static uc_value_t * +uc_hostapd_bss_ctrl(uc_vm_t *vm, size_t nargs) +{ + struct hostapd_data *hapd = uc_fn_thisval("hostapd.bss"); + uc_value_t *arg = uc_fn_arg(0); + struct sockaddr_storage from = {}; + static char reply[4096]; + int reply_len; + + if (!hapd || !interfaces->ctrl_iface_recv || + ucv_type(arg) != UC_STRING) + return NULL; + + reply_len = interfaces->ctrl_iface_recv(hapd, ucv_string_get(arg), + reply, sizeof(reply), + &from, sizeof(from)); + if (reply_len < 0) + return NULL; + + if (reply_len && reply[reply_len - 1] == '\n') + reply_len--; + + return ucv_string_new_length(reply, reply_len); +} + +static void +uc_hostapd_disable_iface(struct hostapd_iface *iface) +{ + switch (iface->state) { + case HAPD_IFACE_DISABLED: + break; +#ifdef CONFIG_ACS + case HAPD_IFACE_ACS: + acs_cleanup(iface); + iface->scan_cb = NULL; + /* fallthrough */ +#endif + default: + hostapd_disable_iface(iface); + break; + } +} + +static uc_value_t * +uc_hostapd_iface_stop(uc_vm_t *vm, size_t nargs) +{ + struct hostapd_iface *iface = uc_fn_thisval("hostapd.iface"); + int i; + + if (!iface) + return NULL; + + if (iface->state != HAPD_IFACE_ENABLED) + uc_hostapd_disable_iface(iface); + + for (i = 0; i < iface->num_bss; i++) { + struct hostapd_data *hapd = iface->bss[i]; + + hostapd_drv_stop_ap(hapd); + hapd->beacon_set_done = 0; + } + + return NULL; +} + +static uc_value_t * +uc_hostapd_iface_start(uc_vm_t *vm, size_t nargs) +{ + struct hostapd_iface *iface = uc_fn_thisval("hostapd.iface"); + uc_value_t *info = uc_fn_arg(0); + struct hostapd_config *conf; + bool changed = false; + uint64_t intval; + int i; + + if (!iface) + return NULL; + + if (!info) { + iface->freq = 0; + goto out; + } + + if (ucv_type(info) != UC_OBJECT) + return NULL; + +#define UPDATE_VAL(field, name) \ + if ((intval = ucv_int64_get(ucv_object_get(info, name, NULL))) && \ + !errno && intval != conf->field) do { \ + conf->field = intval; \ + changed = true; \ + } while(0) + + conf = iface->conf; + UPDATE_VAL(op_class, "op_class"); + UPDATE_VAL(hw_mode, "hw_mode"); + UPDATE_VAL(channel, "channel"); + UPDATE_VAL(secondary_channel, "sec_channel"); + if (!changed && + (iface->bss[0]->beacon_set_done || + iface->state == HAPD_IFACE_DFS)) + return ucv_boolean_new(true); + + intval = ucv_int64_get(ucv_object_get(info, "center_seg0_idx", NULL)); + if (!errno) + hostapd_set_oper_centr_freq_seg0_idx(conf, intval); + + intval = ucv_int64_get(ucv_object_get(info, "center_seg1_idx", NULL)); + if (!errno) + hostapd_set_oper_centr_freq_seg1_idx(conf, intval); + + intval = ucv_int64_get(ucv_object_get(info, "oper_chwidth", NULL)); + if (!errno) + hostapd_set_oper_chwidth(conf, intval); + + intval = ucv_int64_get(ucv_object_get(info, "frequency", NULL)); + if (!errno) + iface->freq = intval; + else + iface->freq = 0; + conf->acs = 0; + +out: + switch (iface->state) { + case HAPD_IFACE_ENABLED: + if (!hostapd_is_dfs_required(iface) || + hostapd_is_dfs_chan_available(iface)) + break; + wpa_printf(MSG_INFO, "DFS CAC required on new channel, restart interface"); + /* fallthrough */ + default: + uc_hostapd_disable_iface(iface); + break; + } + + if (conf->channel && !iface->freq) + iface->freq = hostapd_hw_get_freq(iface->bss[0], conf->channel); + + if (iface->state != HAPD_IFACE_ENABLED) { + hostapd_enable_iface(iface); + return ucv_boolean_new(true); + } + + for (i = 0; i < iface->num_bss; i++) { + struct hostapd_data *hapd = iface->bss[i]; + int ret; + + hapd->conf->start_disabled = 0; + hostapd_set_freq(hapd, conf->hw_mode, iface->freq, + conf->channel, + conf->enable_edmg, + conf->edmg_channel, + conf->ieee80211n, + conf->ieee80211ac, + conf->ieee80211ax, + conf->ieee80211be, + conf->secondary_channel, + hostapd_get_oper_chwidth(conf), + hostapd_get_oper_centr_freq_seg0_idx(conf), + hostapd_get_oper_centr_freq_seg1_idx(conf)); + + ieee802_11_set_beacon(hapd); + } + + return ucv_boolean_new(true); +} + +static uc_value_t * +uc_hostapd_iface_switch_channel(uc_vm_t *vm, size_t nargs) +{ + struct hostapd_iface *iface = uc_fn_thisval("hostapd.iface"); + uc_value_t *info = uc_fn_arg(0); + struct hostapd_config *conf; + struct csa_settings csa = {}; + uint64_t intval; + int i, ret = 0; + + if (!iface || ucv_type(info) != UC_OBJECT) + return NULL; + + conf = iface->conf; + if ((intval = ucv_int64_get(ucv_object_get(info, "csa_count", NULL))) && !errno) + csa.cs_count = intval; + if ((intval = ucv_int64_get(ucv_object_get(info, "sec_channel", NULL))) && !errno) + csa.freq_params.sec_channel_offset = intval; + + csa.freq_params.ht_enabled = conf->ieee80211n; + csa.freq_params.vht_enabled = conf->ieee80211ac; + csa.freq_params.he_enabled = conf->ieee80211ax; +#ifdef CONFIG_IEEE80211BE + csa.freq_params.eht_enabled = conf->ieee80211be; +#endif + intval = ucv_int64_get(ucv_object_get(info, "oper_chwidth", NULL)); + if (errno) + intval = hostapd_get_oper_chwidth(conf); + if (intval) + csa.freq_params.bandwidth = 40 << intval; + else + csa.freq_params.bandwidth = csa.freq_params.sec_channel_offset ? 40 : 20; + + if ((intval = ucv_int64_get(ucv_object_get(info, "frequency", NULL))) && !errno) + csa.freq_params.freq = intval; + if ((intval = ucv_int64_get(ucv_object_get(info, "center_freq1", NULL))) && !errno) + csa.freq_params.center_freq1 = intval; + if ((intval = ucv_int64_get(ucv_object_get(info, "center_freq2", NULL))) && !errno) + csa.freq_params.center_freq2 = intval; + + for (i = 0; i < iface->num_bss; i++) + ret = hostapd_switch_channel(iface->bss[i], &csa); + + return ucv_boolean_new(!ret); +} + +static uc_value_t * +uc_hostapd_bss_rename(uc_vm_t *vm, size_t nargs) +{ + struct hostapd_data *hapd = uc_fn_thisval("hostapd.bss"); + uc_value_t *ifname_arg = uc_fn_arg(0); + char prev_ifname[IFNAMSIZ + 1]; + struct sta_info *sta; + const char *ifname; + int ret; + + if (!hapd || ucv_type(ifname_arg) != UC_STRING) + return NULL; + + os_strlcpy(prev_ifname, hapd->conf->iface, sizeof(prev_ifname)); + ifname = ucv_string_get(ifname_arg); + + hostapd_ubus_free_bss(hapd); + if (interfaces->ctrl_iface_deinit) + interfaces->ctrl_iface_deinit(hapd); + + ret = hostapd_drv_if_rename(hapd, WPA_IF_AP_BSS, NULL, ifname); + if (ret) + goto out; + + for (sta = hapd->sta_list; sta; sta = sta->next) { + char cur_name[IFNAMSIZ + 1], new_name[IFNAMSIZ + 1]; + + if (!(sta->flags & WLAN_STA_WDS) || sta->pending_wds_enable) + continue; + + snprintf(cur_name, sizeof(cur_name), "%s.sta%d", prev_ifname, sta->aid); + snprintf(new_name, sizeof(new_name), "%s.sta%d", ifname, sta->aid); + hostapd_drv_if_rename(hapd, WPA_IF_AP_VLAN, cur_name, new_name); + } + + if (!strncmp(hapd->conf->ssid.vlan, hapd->conf->iface, sizeof(hapd->conf->ssid.vlan))) + os_strlcpy(hapd->conf->ssid.vlan, ifname, sizeof(hapd->conf->ssid.vlan)); + os_strlcpy(hapd->conf->iface, ifname, sizeof(hapd->conf->iface)); + hostapd_ubus_add_bss(hapd); + + hostapd_ucode_update_interfaces(); +out: + if (interfaces->ctrl_iface_init) + interfaces->ctrl_iface_init(hapd); + + return ret ? NULL : ucv_boolean_new(true); +} + + +int hostapd_ucode_init(struct hapd_interfaces *ifaces) +{ + static const uc_function_list_t global_fns[] = { + { "printf", uc_wpa_printf }, + { "getpid", uc_wpa_getpid }, + { "sha1", uc_wpa_sha1 }, + { "freq_info", uc_wpa_freq_info }, + { "add_iface", uc_hostapd_add_iface }, + { "remove_iface", uc_hostapd_remove_iface }, + { "udebug_set", uc_wpa_udebug_set }, + }; + static const uc_function_list_t bss_fns[] = { + { "ctrl", uc_hostapd_bss_ctrl }, + { "set_config", uc_hostapd_bss_set_config }, + { "rename", uc_hostapd_bss_rename }, + { "delete", uc_hostapd_bss_delete }, + }; + static const uc_function_list_t iface_fns[] = { + { "set_bss_order", uc_hostapd_iface_set_bss_order }, + { "add_bss", uc_hostapd_iface_add_bss }, + { "stop", uc_hostapd_iface_stop }, + { "start", uc_hostapd_iface_start }, + { "switch_channel", uc_hostapd_iface_switch_channel }, + }; + uc_value_t *data, *proto; + + interfaces = ifaces; + vm = wpa_ucode_create_vm(); + + global_type = uc_type_declare(vm, "hostapd.global", global_fns, NULL); + bss_type = uc_type_declare(vm, "hostapd.bss", bss_fns, NULL); + iface_type = uc_type_declare(vm, "hostapd.iface", iface_fns, NULL); + + bss_registry = ucv_array_new(vm); + uc_vm_registry_set(vm, "hostap.bss_registry", bss_registry); + + iface_registry = ucv_array_new(vm); + uc_vm_registry_set(vm, "hostap.iface_registry", iface_registry); + + global = wpa_ucode_global_init("hostapd", global_type); + + if (wpa_ucode_run(HOSTAPD_UC_PATH "hostapd.uc")) + goto free_vm; + ucv_gc(vm); + + return 0; + +free_vm: + wpa_ucode_free_vm(); + return -1; +} + +void hostapd_ucode_free(void) +{ + if (wpa_ucode_call_prepare("shutdown") == 0) + ucv_put(wpa_ucode_call(0)); + wpa_ucode_free_vm(); +} + +void hostapd_ucode_free_iface(struct hostapd_iface *iface) +{ + wpa_ucode_registry_remove(iface_registry, iface->ucode.idx); +} + +void hostapd_ucode_add_bss(struct hostapd_data *hapd) +{ + uc_value_t *val; + + if (wpa_ucode_call_prepare("bss_add")) + return; + + val = hostapd_ucode_bss_get_uval(hapd); + uc_value_push(ucv_get(ucv_string_new(hapd->conf->iface))); + uc_value_push(ucv_get(val)); + ucv_put(wpa_ucode_call(2)); + ucv_gc(vm); +} + +void hostapd_ucode_reload_bss(struct hostapd_data *hapd) +{ + uc_value_t *val; + + if (wpa_ucode_call_prepare("bss_reload")) + return; + + val = hostapd_ucode_bss_get_uval(hapd); + uc_value_push(ucv_get(ucv_string_new(hapd->conf->iface))); + uc_value_push(ucv_get(val)); + ucv_put(wpa_ucode_call(2)); + ucv_gc(vm); +} + +void hostapd_ucode_free_bss(struct hostapd_data *hapd) +{ + uc_value_t *val; + + val = wpa_ucode_registry_remove(bss_registry, hapd->ucode.idx); + if (!val) + return; + + hapd->ucode.idx = 0; + if (wpa_ucode_call_prepare("bss_remove")) + return; + + uc_value_push(ucv_string_new(hapd->conf->iface)); + uc_value_push(ucv_get(val)); + ucv_put(wpa_ucode_call(2)); + ucv_gc(vm); +} diff --git a/package/network/services/hostapd/src/src/utils/ap/ucode.h b/package/network/services/hostapd/src/src/utils/ap/ucode.h new file mode 100644 index 00000000000000..d00b787169d104 --- /dev/null +++ b/package/network/services/hostapd/src/src/utils/ap/ucode.h @@ -0,0 +1,54 @@ +#ifndef __HOSTAPD_AP_UCODE_H +#define __HOSTAPD_AP_UCODE_H + +#include "utils/ucode.h" + +struct hostapd_data; + +struct hostapd_ucode_bss { +#ifdef UCODE_SUPPORT + int idx; +#endif +}; + +struct hostapd_ucode_iface { +#ifdef UCODE_SUPPORT + int idx; +#endif +}; + +#ifdef UCODE_SUPPORT + +int hostapd_ucode_init(struct hapd_interfaces *ifaces); + +void hostapd_ucode_free(void); +void hostapd_ucode_free_iface(struct hostapd_iface *iface); +void hostapd_ucode_add_bss(struct hostapd_data *hapd); +void hostapd_ucode_free_bss(struct hostapd_data *hapd); +void hostapd_ucode_reload_bss(struct hostapd_data *hapd); + +#else + +static inline int hostapd_ucode_init(struct hapd_interfaces *ifaces) +{ + return -EINVAL; +} +static inline void hostapd_ucode_free(void) +{ +} +static inline void hostapd_ucode_free_iface(struct hostapd_iface *iface) +{ +} +static inline void hostapd_ucode_reload_bss(struct hostapd_data *hapd) +{ +} +static inline void hostapd_ucode_add_bss(struct hostapd_data *hapd) +{ +} +static inline void hostapd_ucode_free_bss(struct hostapd_data *hapd) +{ +} + +#endif + +#endif diff --git a/package/network/services/hostapd/src/src/utils/build_features.h b/package/network/services/hostapd/src/src/utils/build_features.h index 553769ecebc84c..cc8831535c68da 100644 --- a/package/network/services/hostapd/src/src/utils/build_features.h +++ b/package/network/services/hostapd/src/src/utils/build_features.h @@ -15,6 +15,10 @@ static inline int has_feature(const char *feat) if (!strcmp(feat, "11ax")) return 1; #endif +#ifdef CONFIG_IEEE80211BE + if (!strcmp(feat, "11be")) + return 1; +#endif #ifdef CONFIG_IEEE80211R if (!strcmp(feat, "11r")) return 1; From a9efa44923a63d43fbf74aa86438a8c875ec440f Mon Sep 17 00:00:00 2001 From: Rudy Andram Date: Tue, 17 Sep 2024 07:44:03 +0100 Subject: [PATCH 20/40] hostapd - reintroduce 11be config --- package/network/services/hostapd/Config.in | 13 +- package/network/services/hostapd/Makefile | 14 +- .../hostapd/files/hostapd-basic.config | 59 +- .../hostapd/files/hostapd-full.config | 67 +- .../hostapd/files/hostapd-mini.config | 59 +- .../hostapd/files/wpa_supplicant-basic.config | 65 +- .../hostapd/files/wpa_supplicant-full.config | 83 +- .../hostapd/files/wpa_supplicant-mini.config | 67 +- .../hostapd/files/wpa_supplicant-p2p.config | 65 +- ...erministic-channel-on-channel-switch.patch | 2 +- ...ix-sta-add-after-previous-connection.patch | 4 +- .../patches/050-Fix-OpenWrt-13156.patch | 4 +- ...-extra-ies-only-if-allowed-by-driver.patch | 2 +- ...efile-make-run-tests-with-CONFIG_TLS.patch | 6 +- ...hecks-encountered-during-tests-hwsim.patch | 2 +- ...tapd-update-cfs0-and-cfs1-for-160MHz.patch | 10 +- .../hostapd/patches/200-multicall.patch | 16 +- ..._AP-functions-dependant-on-CONFIG_AP.patch | 4 +- .../patches/220-indicate-features.patch | 4 +- .../patches/250-hostapd_cli_ifdef.patch | 12 +- .../patches/252-disable_ctrl_iface_mib.patch | 20 +- .../services/hostapd/patches/300-noscan.patch | 4 +- .../patches/330-nl80211_fix_set_freq.patch | 2 +- .../patches/350-nl80211_del_beacon_bss.patch | 2 +- .../381-hostapd_cli_UNKNOWN-COMMAND.patch | 2 +- ...dd-new-config-params-to-be-used-with.patch | 2 +- .../patches/463-add-mcast_rate-to-11s.patch | 6 +- .../patches/590-rrm-wnm-statistics.patch | 4 +- .../hostapd/patches/600-ubus_support.patch | 45 +- .../hostapd/patches/601-ucode_support.patch | 56 +- .../patches/720-iface_max_num_sta.patch | 2 +- .../hostapd/patches/740-snoop_iface.patch | 8 +- .../hostapd/patches/770-radius_server.patch | 2 +- ...ment-APuP-Access-Point-Micro-Peering.patch | 28 +- ...id-Rejected-Groups-element-in-the-pa.patch | 30 - .../803-hostapd-fix-80211be-build.patch | 53 - .../services/hostapd/src/src/ap/ubus.h | 2 - .../services/hostapd/src/src/ap/ucode.c | 2 +- .../services/hostapd/src/src/utils/ap/ubus.c | 2006 ----------------- .../services/hostapd/src/src/utils/ap/ubus.h | 157 -- .../services/hostapd/src/src/utils/ap/ucode.c | 817 ------- .../services/hostapd/src/src/utils/ap/ucode.h | 54 - 42 files changed, 258 insertions(+), 3604 deletions(-) delete mode 100644 package/network/services/hostapd/patches/802-SAE-Reject-invalid-Rejected-Groups-element-in-the-pa.patch delete mode 100644 package/network/services/hostapd/patches/803-hostapd-fix-80211be-build.patch delete mode 100644 package/network/services/hostapd/src/src/utils/ap/ubus.c delete mode 100644 package/network/services/hostapd/src/src/utils/ap/ubus.h delete mode 100644 package/network/services/hostapd/src/src/utils/ap/ucode.c delete mode 100644 package/network/services/hostapd/src/src/utils/ap/ucode.h diff --git a/package/network/services/hostapd/Config.in b/package/network/services/hostapd/Config.in index bd1d94c583a760..742cd78a14627b 100644 --- a/package/network/services/hostapd/Config.in +++ b/package/network/services/hostapd/Config.in @@ -33,13 +33,17 @@ config WPA_WOLFSSL config DRIVER_11AC_SUPPORT bool - default y + default n config DRIVER_11AX_SUPPORT bool - default y + default n select WPA_MBO_SUPPORT +config DRIVER_11BE_SUPPORT + bool + default n + config WPA_ENABLE_WEP bool "Enable support for unsecure and obsolete WEP" depends on PACKAGE_hostapd-common @@ -59,8 +63,3 @@ config WPA_MBO_SUPPORT that facilitate efficient use of multiple frequency bands. Enabling MBO on an AP using RSN requires 802.11w to be enabled. Hostapd will refuse to start if MBO and RSN are enabled without 11w. - -config DRIVER_11BE_SUPPORT - bool - default y - diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile index 232e084b0af982..6a1868d47351a3 100644 --- a/package/network/services/hostapd/Makefile +++ b/package/network/services/hostapd/Makefile @@ -5,13 +5,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=hostapd -PKG_RELEASE:=3 +PKG_RELEASE:=1 -PKG_SOURCE_URL:=https://github.com/rmandrad/hostapd +PKG_SOURCE_URL:=https://w1.fi/hostap.git PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2024-09-04 -PKG_SOURCE_VERSION:=9907c324a0846f3a4899133b9f08ebefb0719ca5 -PKG_MIRROR_HASH:=32deaa53c684be89f9bd69398595d1f539278a1aecb3a3bf605078fe932e2bc3 +PKG_SOURCE_DATE:=2024-09-15 +PKG_SOURCE_VERSION:=5ace39b0a4cdbe18ddbc4e18f80ee3876233c20b +PKG_MIRROR_HASH:=43187d1ddd923970ef3821a0fe267880c2483f6f1a5acd0dd2d7906661ab1372 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=BSD-3-Clause @@ -27,7 +27,7 @@ PKG_CONFIG_DEPENDS:= \ CONFIG_WPA_RFKILL_SUPPORT \ CONFIG_DRIVER_11AC_SUPPORT \ CONFIG_DRIVER_11AX_SUPPORT \ - CONFIG_DRIVER_11BE_SUPPORT \ + CONFIG_DRIVER_11BE_SUPPORT \ CONFIG_WPA_ENABLE_WEP PKG_BUILD_FLAGS:=gc-sections lto @@ -84,8 +84,6 @@ ifneq ($(CONFIG_DRIVER_11BE_SUPPORT),) HOSTAPD_IEEE80211BE:=y endif - - CORE_DEPENDS = +ucode +libubus +libucode +ucode-mod-fs +ucode-mod-nl80211 +ucode-mod-rtnl +ucode-mod-ubus +ucode-mod-uloop +libblobmsg-json +libudebug OPENSSL_DEPENDS = +PACKAGE_$(1):libopenssl +PACKAGE_$(1):libopenssl-legacy diff --git a/package/network/services/hostapd/files/hostapd-basic.config b/package/network/services/hostapd/files/hostapd-basic.config index dbd1f9dedef514..fa06a95043f3a4 100644 --- a/package/network/services/hostapd/files/hostapd-basic.config +++ b/package/network/services/hostapd/files/hostapd-basic.config @@ -44,9 +44,15 @@ CONFIG_DRIVER_NL80211=y # Driver interface for no driver (e.g., RADIUS server only) #CONFIG_DRIVER_NONE=y +# IEEE 802.11F/IAPP +#CONFIG_IAPP=y + # WPA2/IEEE 802.11i RSN pre-authentication CONFIG_RSN_PREAUTH=y +# IEEE 802.11w (management frame protection) +#CONFIG_IEEE80211W=y + # Support Operating Channel Validation CONFIG_OCV=y @@ -148,6 +154,9 @@ CONFIG_IEEE80211R=y # the IEEE 802.11 Management capability (e.g., FreeBSD/net80211) #CONFIG_DRIVER_RADIUS_ACL=y +# IEEE 802.11n (High Throughput) support +CONFIG_IEEE80211N=y + # Wireless Network Management (IEEE Std 802.11v-2011) # Note: This is experimental and not complete implementation. #CONFIG_WNM=y @@ -156,20 +165,12 @@ CONFIG_IEEE80211R=y CONFIG_IEEE80211AC=y # IEEE 802.11ax HE support -#CONFIG_IEEE80211AX=y - -# IEEE 802.11be EHT support -# CONFIG_IEEE80211AX is mandatory for setting CONFIG_IEEE80211BE. # Note: This is experimental and work in progress. The definitions are still # subject to change and this should not be expected to interoperate with the -# final IEEE 802.11be version. -CONFIG_IEEE80211BE=y - -# Simultaneous Authentication of Equals (SAE), WPA3-Personal -#CONFIG_SAE=y +# final IEEE 802.11ax version. +#CONFIG_IEEE80211AX=y -# SAE Public Key, WPA3-Personal -#CONFIG_SAE_PK=y +#CONFIG_IEEE80211BE=y # Remove debugging code that is printing out debug messages to stdout. # This can be used to reduce the size of the hostapd considerably if debugging @@ -356,12 +357,12 @@ CONFIG_TLS=internal # * ath10k # # For more details refer to: -# https://wireless.wiki.kernel.org/en/users/documentation/acs +# http://wireless.kernel.org/en/users/Documentation/acs # #CONFIG_ACS=y # Multiband Operation support -# These extensions facilitate efficient use of multiple frequency bands +# These extentions facilitate efficient use of multiple frequency bands # available to the AP and the devices that may associate with it. #CONFIG_MBO=y @@ -387,39 +388,13 @@ CONFIG_TLS=internal # Airtime policy support CONFIG_AIRTIME_POLICY=y +# Proxy ARP support +#CONFIG_PROXYARP=y + # Override default value for the wpa_disable_eapol_key_retries configuration # parameter. See that parameter in hostapd.conf for more details. #CFLAGS += -DDEFAULT_WPA_DISABLE_EAPOL_KEY_RETRIES=1 -# Wired equivalent privacy (WEP) -# WEP is an obsolete cryptographic data confidentiality algorithm that is not -# considered secure. It should not be used for anything anymore. The -# functionality needed to use WEP is available in the current hostapd -# release under this optional build parameter. This functionality is subject to -# be completely removed in a future release. -#CONFIG_WEP=y - -# Remove all TKIP functionality -# TKIP is an old cryptographic data confidentiality algorithm that is not -# considered secure. It should not be used anymore. For now, the default hostapd -# build includes this to allow mixed mode WPA+WPA2 networks to be enabled, but -# that functionality is subject to be removed in the future. -#CONFIG_NO_TKIP=y - -# Pre-Association Security Negotiation (PASN) -# Experimental implementation based on IEEE P802.11z/D2.6 and the protocol -# design is still subject to change. As such, this should not yet be enabled in -# production use. -#CONFIG_PASN=y - -# Device Provisioning Protocol (DPP) (also known as Wi-Fi Easy Connect) -#CONFIG_DPP=y -# DPP version 2 support -#CONFIG_DPP2=y -# DPP version 3 support (experimental and still changing; do not enable for -# production use) -#CONFIG_DPP3=y - # uBus IPC/RPC System # Services can connect to the bus and provide methods # that can be called by other services or clients. diff --git a/package/network/services/hostapd/files/hostapd-full.config b/package/network/services/hostapd/files/hostapd-full.config index 076c2bc6a02254..e2561e6424ca12 100644 --- a/package/network/services/hostapd/files/hostapd-full.config +++ b/package/network/services/hostapd/files/hostapd-full.config @@ -10,7 +10,7 @@ # to override previous values of the variables. # Driver interface for Host AP driver -CONFIG_DRIVER_HOSTAP=y +#CONFIG_DRIVER_HOSTAP=y # Driver interface for wired authenticator CONFIG_DRIVER_WIRED=y @@ -44,9 +44,15 @@ CONFIG_DRIVER_NL80211=y # Driver interface for no driver (e.g., RADIUS server only) #CONFIG_DRIVER_NONE=y +# IEEE 802.11F/IAPP +CONFIG_IAPP=y + # WPA2/IEEE 802.11i RSN pre-authentication CONFIG_RSN_PREAUTH=y +# IEEE 802.11w (management frame protection) +#CONFIG_IEEE80211W=y + # Support Operating Channel Validation CONFIG_OCV=y @@ -148,6 +154,9 @@ CONFIG_IEEE80211R=y # the IEEE 802.11 Management capability (e.g., FreeBSD/net80211) #CONFIG_DRIVER_RADIUS_ACL=y +# IEEE 802.11n (High Throughput) support +CONFIG_IEEE80211N=y + # Wireless Network Management (IEEE Std 802.11v-2011) # Note: This is experimental and not complete implementation. CONFIG_WNM=y @@ -156,20 +165,12 @@ CONFIG_WNM=y CONFIG_IEEE80211AC=y # IEEE 802.11ax HE support -#CONFIG_IEEE80211AX=y - -# IEEE 802.11be EHT support -# CONFIG_IEEE80211AX is mandatory for setting CONFIG_IEEE80211BE. # Note: This is experimental and work in progress. The definitions are still # subject to change and this should not be expected to interoperate with the -# final IEEE 802.11be version. -CONFIG_IEEE80211BE=y - -# Simultaneous Authentication of Equals (SAE), WPA3-Personal -CONFIG_SAE=y +# final IEEE 802.11ax version. +#CONFIG_IEEE80211AX=y -# SAE Public Key, WPA3-Personal -CONFIG_SAE_PK=y +#CONFIG_IEEE80211BE=y # Remove debugging code that is printing out debug messages to stdout. # This can be used to reduce the size of the hostapd considerably if debugging @@ -289,7 +290,7 @@ CONFIG_TLS=internal # TLS-based EAP methods require at least TLS v1.0. Newer version of TLS (v1.2) # can be enabled to enable use of stronger crypto algorithms. -CONFIG_TLSV12=y +#CONFIG_TLSV12=y # Select which ciphers to use by default with OpenSSL if the user does not # specify them. @@ -323,7 +324,7 @@ CONFIG_HS20=y #CONFIG_SQLITE=y # Enable Fast Session Transfer (FST) -CONFIG_FST=y +#CONFIG_FST=y # Enable CLI commands for FST testing #CONFIG_FST_TEST=y @@ -356,14 +357,14 @@ CONFIG_FST=y # * ath10k # # For more details refer to: -# https://wireless.wiki.kernel.org/en/users/documentation/acs +# http://wireless.kernel.org/en/users/Documentation/acs # #CONFIG_ACS=y # Multiband Operation support -# These extensions facilitate efficient use of multiple frequency bands +# These extentions facilitate efficient use of multiple frequency bands # available to the AP and the devices that may associate with it. -CONFIG_MBO=y +#CONFIG_MBO=y # Client Taxonomy # Has the AP retain the Probe Request and (Re)Association Request frames from @@ -387,39 +388,13 @@ CONFIG_TAXONOMY=y # Airtime policy support CONFIG_AIRTIME_POLICY=y +# Proxy ARP support +CONFIG_PROXYARP=y + # Override default value for the wpa_disable_eapol_key_retries configuration # parameter. See that parameter in hostapd.conf for more details. #CFLAGS += -DDEFAULT_WPA_DISABLE_EAPOL_KEY_RETRIES=1 -# Wired equivalent privacy (WEP) -# WEP is an obsolete cryptographic data confidentiality algorithm that is not -# considered secure. It should not be used for anything anymore. The -# functionality needed to use WEP is available in the current hostapd -# release under this optional build parameter. This functionality is subject to -# be completely removed in a future release. -#CONFIG_WEP=y - -# Remove all TKIP functionality -# TKIP is an old cryptographic data confidentiality algorithm that is not -# considered secure. It should not be used anymore. For now, the default hostapd -# build includes this to allow mixed mode WPA+WPA2 networks to be enabled, but -# that functionality is subject to be removed in the future. -#CONFIG_NO_TKIP=y - -# Pre-Association Security Negotiation (PASN) -# Experimental implementation based on IEEE P802.11z/D2.6 and the protocol -# design is still subject to change. As such, this should not yet be enabled in -# production use. -#CONFIG_PASN=y - -# Device Provisioning Protocol (DPP) (also known as Wi-Fi Easy Connect) -#CONFIG_DPP=y -# DPP version 2 support -#CONFIG_DPP2=y -# DPP version 3 support (experimental and still changing; do not enable for -# production use) -#CONFIG_DPP3=y - # uBus IPC/RPC System # Services can connect to the bus and provide methods # that can be called by other services or clients. diff --git a/package/network/services/hostapd/files/hostapd-mini.config b/package/network/services/hostapd/files/hostapd-mini.config index be0080ffe7a781..5d38b777636b62 100644 --- a/package/network/services/hostapd/files/hostapd-mini.config +++ b/package/network/services/hostapd/files/hostapd-mini.config @@ -44,9 +44,15 @@ CONFIG_DRIVER_NL80211=y # Driver interface for no driver (e.g., RADIUS server only) #CONFIG_DRIVER_NONE=y +# IEEE 802.11F/IAPP +#CONFIG_IAPP=y + # WPA2/IEEE 802.11i RSN pre-authentication CONFIG_RSN_PREAUTH=y +# IEEE 802.11w (management frame protection) +#CONFIG_IEEE80211W=y + # Support Operating Channel Validation #CONFIG_OCV=y @@ -148,6 +154,9 @@ CONFIG_RSN_PREAUTH=y # the IEEE 802.11 Management capability (e.g., FreeBSD/net80211) #CONFIG_DRIVER_RADIUS_ACL=y +# IEEE 802.11n (High Throughput) support +CONFIG_IEEE80211N=y + # Wireless Network Management (IEEE Std 802.11v-2011) # Note: This is experimental and not complete implementation. #CONFIG_WNM=y @@ -156,20 +165,12 @@ CONFIG_RSN_PREAUTH=y CONFIG_IEEE80211AC=y # IEEE 802.11ax HE support -#CONFIG_IEEE80211AX=y - -# IEEE 802.11be EHT support -# CONFIG_IEEE80211AX is mandatory for setting CONFIG_IEEE80211BE. # Note: This is experimental and work in progress. The definitions are still # subject to change and this should not be expected to interoperate with the -# final IEEE 802.11be version. -CONFIG_IEEE80211BE=y - -# Simultaneous Authentication of Equals (SAE), WPA3-Personal -#CONFIG_SAE=y +# final IEEE 802.11ax version. +#CONFIG_IEEE80211AX=y -# SAE Public Key, WPA3-Personal -#CONFIG_SAE_PK=y +#CONFIG_IEEE80211BE=y # Remove debugging code that is printing out debug messages to stdout. # This can be used to reduce the size of the hostapd considerably if debugging @@ -356,12 +357,12 @@ CONFIG_TLS=internal # * ath10k # # For more details refer to: -# https://wireless.wiki.kernel.org/en/users/documentation/acs +# http://wireless.kernel.org/en/users/Documentation/acs # #CONFIG_ACS=y # Multiband Operation support -# These extensions facilitate efficient use of multiple frequency bands +# These extentions facilitate efficient use of multiple frequency bands # available to the AP and the devices that may associate with it. #CONFIG_MBO=y @@ -387,39 +388,13 @@ CONFIG_TLS=internal # Airtime policy support #CONFIG_AIRTIME_POLICY=y +# Proxy ARP support +#CONFIG_PROXYARP=y + # Override default value for the wpa_disable_eapol_key_retries configuration # parameter. See that parameter in hostapd.conf for more details. #CFLAGS += -DDEFAULT_WPA_DISABLE_EAPOL_KEY_RETRIES=1 -# Wired equivalent privacy (WEP) -# WEP is an obsolete cryptographic data confidentiality algorithm that is not -# considered secure. It should not be used for anything anymore. The -# functionality needed to use WEP is available in the current hostapd -# release under this optional build parameter. This functionality is subject to -# be completely removed in a future release. -#CONFIG_WEP=y - -# Remove all TKIP functionality -# TKIP is an old cryptographic data confidentiality algorithm that is not -# considered secure. It should not be used anymore. For now, the default hostapd -# build includes this to allow mixed mode WPA+WPA2 networks to be enabled, but -# that functionality is subject to be removed in the future. -#CONFIG_NO_TKIP=y - -# Pre-Association Security Negotiation (PASN) -# Experimental implementation based on IEEE P802.11z/D2.6 and the protocol -# design is still subject to change. As such, this should not yet be enabled in -# production use. -#CONFIG_PASN=y - -# Device Provisioning Protocol (DPP) (also known as Wi-Fi Easy Connect) -#CONFIG_DPP=y -# DPP version 2 support -#CONFIG_DPP2=y -# DPP version 3 support (experimental and still changing; do not enable for -# production use) -#CONFIG_DPP3=y - # uBus IPC/RPC System # Services can connect to the bus and provide methods # that can be called by other services or clients. diff --git a/package/network/services/hostapd/files/wpa_supplicant-basic.config b/package/network/services/hostapd/files/wpa_supplicant-basic.config index a78b17dcecbb20..944b4d92876002 100644 --- a/package/network/services/hostapd/files/wpa_supplicant-basic.config +++ b/package/network/services/hostapd/files/wpa_supplicant-basic.config @@ -101,9 +101,6 @@ CONFIG_DRIVER_WIRED=y # EAP-TLS #CONFIG_EAP_TLS=y -# Enable EAP-TLSv1.3 support by default (currently disabled unless explicitly -# enabled in network configuration) -#CONFIG_EAP_TLSV1_3=y # EAL-PEAP #CONFIG_EAP_PEAP=y @@ -206,9 +203,6 @@ CONFIG_HT_OVERRIDES=y # Support VHT overrides (disable VHT, mask MCS rates, etc.) CONFIG_VHT_OVERRIDES=y -# Support HE overrides -CONFIG_HE_OVERRIDES=y - # Development testing #CONFIG_EAPOL_TEST=y @@ -254,10 +248,7 @@ CONFIG_CTRL_IFACE=y # Simultaneous Authentication of Equals (SAE), WPA3-Personal #CONFIG_SAE=y -# SAE Public Key, WPA3-Personal -#CONFIG_SAE_PK=y - -# Disable scan result processing (ap_scan=1) to save code size by about 1 kB. +# Disable scan result processing (ap_mode=1) to save code size by about 1 kB. # This can be used if ap_scan=1 mode is never enabled. #CONFIG_NO_SCAN_PROCESSING=y @@ -319,6 +310,10 @@ CONFIG_ELOOP_EPOLL=y # bridge interfaces (commit 'bridge: respect RFC2863 operational state')'). CONFIG_NO_LINUX_PACKET_SOCKET_WAR=y +# IEEE 802.11w (management frame protection), also known as PMF +# Driver support is also needed for IEEE 802.11w. +#CONFIG_IEEE80211W=y + # Support Operating Channel Validation CONFIG_OCV=y @@ -371,7 +366,7 @@ CONFIG_TLS=internal #PLATFORMSDKLIB="/opt/Program Files/Microsoft Platform SDK/Lib" # Add support for new DBus control interface -# (fi.w1.wpa_supplicant1) +# (fi.w1.hostap.wpa_supplicant1) #CONFIG_CTRL_IFACE_DBUS_NEW=y # Add introspection support for new DBus control interface @@ -480,19 +475,13 @@ CONFIG_NO_RANDOM_POOL=y # Requires glibc 2.25 to build, falls back to /dev/random if unavailable. CONFIG_GETRANDOM=y +# IEEE 802.11n (High Throughput) support (mainly for AP mode) +#CONFIG_IEEE80211N=y + # IEEE 802.11ac (Very High Throughput) support (mainly for AP mode) +# (depends on CONFIG_IEEE80211N) #CONFIG_IEEE80211AC=y -# IEEE 802.11ax HE support (mainly for AP mode) -#CONFIG_IEEE80211AX=y - -# IEEE 802.11be EHT support (mainly for AP mode) -# CONFIG_IEEE80211AX is mandatory for setting CONFIG_IEEE80211BE. -# Note: This is experimental and work in progress. The definitions are still -# subject to change and this should not be expected to interoperate with the -# final IEEE 802.11be version. -#CONFIG_IEEE80211BE=y - # Wireless Network Management (IEEE Std 802.11v-2011) # Note: This is experimental and not complete implementation. #CONFIG_WNM=y @@ -549,8 +538,6 @@ CONFIG_GETRANDOM=y # # External password backend for testing purposes (developer use) #CONFIG_EXT_PASSWORD_TEST=y -# File-based backend to read passwords from an external file. -#CONFIG_EXT_PASSWORD_FILE=y # Enable Fast Session Transfer (FST) #CONFIG_FST=y @@ -622,36 +609,10 @@ CONFIG_GETRANDOM=y # Experimental implementation of draft-harkins-owe-07.txt #CONFIG_OWE=y -# Device Provisioning Protocol (DPP) (also known as Wi-Fi Easy Connect) +# Device Provisioning Protocol (DPP) +# This requires CONFIG_IEEE80211W=y to be enabled, too. (see +# wpa_supplicant/README-DPP for details) #CONFIG_DPP=y -# DPP version 2 support -#CONFIG_DPP2=y -# DPP version 3 support (experimental and still changing; do not enable for -# production use) -#CONFIG_DPP3=y - -# Wired equivalent privacy (WEP) -# WEP is an obsolete cryptographic data confidentiality algorithm that is not -# considered secure. It should not be used for anything anymore. The -# functionality needed to use WEP is available in the current wpa_supplicant -# release under this optional build parameter. This functionality is subject to -# be completely removed in a future release. -#CONFIG_WEP=y - -# Remove all TKIP functionality -# TKIP is an old cryptographic data confidentiality algorithm that is not -# considered secure. It should not be used anymore for anything else than a -# backwards compatibility option as a group cipher when connecting to APs that -# use WPA+WPA2 mixed mode. For now, the default wpa_supplicant build includes -# support for this by default, but that functionality is subject to be removed -# in the future. -#CONFIG_NO_TKIP=y - -# Pre-Association Security Negotiation (PASN) -# Experimental implementation based on IEEE P802.11z/D2.6 and the protocol -# design is still subject to change. As such, this should not yet be enabled in -# production use. -#CONFIG_PASN=y # uBus IPC/RPC System # Services can connect to the bus and provide methods diff --git a/package/network/services/hostapd/files/wpa_supplicant-full.config b/package/network/services/hostapd/files/wpa_supplicant-full.config index 01c402d9e7c162..b39dabca0696b5 100644 --- a/package/network/services/hostapd/files/wpa_supplicant-full.config +++ b/package/network/services/hostapd/files/wpa_supplicant-full.config @@ -101,9 +101,6 @@ CONFIG_EAP_MSCHAPV2=y # EAP-TLS CONFIG_EAP_TLS=y -# Enable EAP-TLSv1.3 support by default (currently disabled unless explicitly -# enabled in network configuration) -#CONFIG_EAP_TLSV1_3=y # EAL-PEAP CONFIG_EAP_PEAP=y @@ -206,9 +203,6 @@ CONFIG_HT_OVERRIDES=y # Support VHT overrides (disable VHT, mask MCS rates, etc.) CONFIG_VHT_OVERRIDES=y -# Support HE overrides -CONFIG_HE_OVERRIDES=y - # Development testing #CONFIG_EAPOL_TEST=y @@ -252,12 +246,9 @@ CONFIG_CTRL_IFACE=y #CONFIG_NO_WPA_PASSPHRASE=y # Simultaneous Authentication of Equals (SAE), WPA3-Personal -CONFIG_SAE=y - -# SAE Public Key, WPA3-Personal -CONFIG_SAE_PK=y +#CONFIG_SAE=y -# Disable scan result processing (ap_scan=1) to save code size by about 1 kB. +# Disable scan result processing (ap_mode=1) to save code size by about 1 kB. # This can be used if ap_scan=1 mode is never enabled. #CONFIG_NO_SCAN_PROCESSING=y @@ -319,6 +310,10 @@ CONFIG_ELOOP_EPOLL=y # bridge interfaces (commit 'bridge: respect RFC2863 operational state')'). CONFIG_NO_LINUX_PACKET_SOCKET_WAR=y +# IEEE 802.11w (management frame protection), also known as PMF +# Driver support is also needed for IEEE 802.11w. +#CONFIG_IEEE80211W=y + # Support Operating Channel Validation CONFIG_OCV=y @@ -371,7 +366,7 @@ CONFIG_INTERNAL_LIBTOMMATH_FAST=y #PLATFORMSDKLIB="/opt/Program Files/Microsoft Platform SDK/Lib" # Add support for new DBus control interface -# (fi.w1.wpa_supplicant1) +# (fi.w1.hostap.wpa_supplicant1) #CONFIG_CTRL_IFACE_DBUS_NEW=y # Add introspection support for new DBus control interface @@ -480,19 +475,13 @@ CONFIG_NO_RANDOM_POOL=y # Requires glibc 2.25 to build, falls back to /dev/random if unavailable. CONFIG_GETRANDOM=y +# IEEE 802.11n (High Throughput) support (mainly for AP mode) +#CONFIG_IEEE80211N=y + # IEEE 802.11ac (Very High Throughput) support (mainly for AP mode) +# (depends on CONFIG_IEEE80211N) #CONFIG_IEEE80211AC=y -# IEEE 802.11ax HE support (mainly for AP mode) -#CONFIG_IEEE80211AX=y - -# IEEE 802.11be EHT support (mainly for AP mode) -# CONFIG_IEEE80211AX is mandatory for setting CONFIG_IEEE80211BE. -# Note: This is experimental and work in progress. The definitions are still -# subject to change and this should not be expected to interoperate with the -# final IEEE 802.11be version. -CONFIG_IEEE80211BE=y - # Wireless Network Management (IEEE Std 802.11v-2011) # Note: This is experimental and not complete implementation. CONFIG_WNM=y @@ -517,12 +506,12 @@ CONFIG_HS20=y # should be noted that this is mainly aimed at simple cases like # WPA2-Personal while more complex configurations like WPA2-Enterprise with an # external RADIUS server can be supported with hostapd. -CONFIG_AP=y +#CONFIG_AP=y # P2P (Wi-Fi Direct) # This can be used to enable P2P support in wpa_supplicant. See README-P2P for # more information on P2P operations. -CONFIG_P2P=y +#CONFIG_P2P=y # Enable TDLS support #CONFIG_TDLS=y @@ -530,7 +519,7 @@ CONFIG_P2P=y # Wi-Fi Display # This can be used to enable Wi-Fi Display extensions for P2P using an external # program to control the additional information exchanges in the messages. -CONFIG_WIFI_DISPLAY=y +#CONFIG_WIFI_DISPLAY=y # Autoscan # This can be used to enable automatic scan support in wpa_supplicant. @@ -549,11 +538,9 @@ CONFIG_WIFI_DISPLAY=y # # External password backend for testing purposes (developer use) #CONFIG_EXT_PASSWORD_TEST=y -# File-based backend to read passwords from an external file. -#CONFIG_EXT_PASSWORD_FILE=y # Enable Fast Session Transfer (FST) -CONFIG_FST=y +#CONFIG_FST=y # Enable CLI commands for FST testing #CONFIG_FST_TEST=y @@ -588,7 +575,7 @@ CONFIG_FST=y #CONFIG_ACS=y # Support Multi Band Operation -CONFIG_MBO=y +#CONFIG_MBO=y # Fast Initial Link Setup (FILS) (IEEE 802.11ai) CONFIG_FILS=y @@ -613,45 +600,19 @@ CONFIG_IBSS_RSN=y # operations for roaming within an ESS (same SSID). See the bgscan parameter in # the wpa_supplicant.conf file for more details. # Periodic background scans based on signal strength -CONFIG_BGSCAN_SIMPLE=y +#CONFIG_BGSCAN_SIMPLE=y # Learn channels used by the network and try to avoid bgscans on other # channels (experimental) -CONFIG_BGSCAN_LEARN=y +#CONFIG_BGSCAN_LEARN=y # Opportunistic Wireless Encryption (OWE) # Experimental implementation of draft-harkins-owe-07.txt -CONFIG_OWE=y +#CONFIG_OWE=y -# Device Provisioning Protocol (DPP) (also known as Wi-Fi Easy Connect) +# Device Provisioning Protocol (DPP) +# This requires CONFIG_IEEE80211W=y to be enabled, too. (see +# wpa_supplicant/README-DPP for details) #CONFIG_DPP=y -# DPP version 2 support -#CONFIG_DPP2=y -# DPP version 3 support (experimental and still changing; do not enable for -# production use) -#CONFIG_DPP3=y - -# Wired equivalent privacy (WEP) -# WEP is an obsolete cryptographic data confidentiality algorithm that is not -# considered secure. It should not be used for anything anymore. The -# functionality needed to use WEP is available in the current wpa_supplicant -# release under this optional build parameter. This functionality is subject to -# be completely removed in a future release. -#CONFIG_WEP=y - -# Remove all TKIP functionality -# TKIP is an old cryptographic data confidentiality algorithm that is not -# considered secure. It should not be used anymore for anything else than a -# backwards compatibility option as a group cipher when connecting to APs that -# use WPA+WPA2 mixed mode. For now, the default wpa_supplicant build includes -# support for this by default, but that functionality is subject to be removed -# in the future. -#CONFIG_NO_TKIP=y - -# Pre-Association Security Negotiation (PASN) -# Experimental implementation based on IEEE P802.11z/D2.6 and the protocol -# design is still subject to change. As such, this should not yet be enabled in -# production use. -#CONFIG_PASN=y # uBus IPC/RPC System # Services can connect to the bus and provide methods diff --git a/package/network/services/hostapd/files/wpa_supplicant-mini.config b/package/network/services/hostapd/files/wpa_supplicant-mini.config index 0b628957f9dce1..2a3f8fb69de337 100644 --- a/package/network/services/hostapd/files/wpa_supplicant-mini.config +++ b/package/network/services/hostapd/files/wpa_supplicant-mini.config @@ -101,9 +101,6 @@ CONFIG_DRIVER_WIRED=y # EAP-TLS #CONFIG_EAP_TLS=y -# Enable EAP-TLSv1.3 support by default (currently disabled unless explicitly -# enabled in network configuration) -#CONFIG_EAP_TLSV1_3=y # EAL-PEAP #CONFIG_EAP_PEAP=y @@ -206,9 +203,6 @@ CONFIG_HT_OVERRIDES=y # Support VHT overrides (disable VHT, mask MCS rates, etc.) CONFIG_VHT_OVERRIDES=y -# Support HE overrides -CONFIG_HE_OVERRIDES=y - # Development testing #CONFIG_EAPOL_TEST=y @@ -254,10 +248,7 @@ CONFIG_CTRL_IFACE=y # Simultaneous Authentication of Equals (SAE), WPA3-Personal #CONFIG_SAE=y -# SAE Public Key, WPA3-Personal -#CONFIG_SAE_PK=y - -# Disable scan result processing (ap_scan=1) to save code size by about 1 kB. +# Disable scan result processing (ap_mode=1) to save code size by about 1 kB. # This can be used if ap_scan=1 mode is never enabled. #CONFIG_NO_SCAN_PROCESSING=y @@ -319,8 +310,12 @@ CONFIG_ELOOP_EPOLL=y # bridge interfaces (commit 'bridge: respect RFC2863 operational state')'). CONFIG_NO_LINUX_PACKET_SOCKET_WAR=y +# IEEE 802.11w (management frame protection), also known as PMF +# Driver support is also needed for IEEE 802.11w. +#CONFIG_IEEE80211W=y + # Support Operating Channel Validation -CONFIG_OCV=y +#CONFIG_OCV=y # Select TLS implementation # openssl = OpenSSL (default) @@ -371,7 +366,7 @@ CONFIG_TLS=internal #PLATFORMSDKLIB="/opt/Program Files/Microsoft Platform SDK/Lib" # Add support for new DBus control interface -# (fi.w1.wpa_supplicant1) +# (fi.w1.hostap.wpa_supplicant1) #CONFIG_CTRL_IFACE_DBUS_NEW=y # Add introspection support for new DBus control interface @@ -480,19 +475,13 @@ CONFIG_NO_RANDOM_POOL=y # Requires glibc 2.25 to build, falls back to /dev/random if unavailable. CONFIG_GETRANDOM=y +# IEEE 802.11n (High Throughput) support (mainly for AP mode) +#CONFIG_IEEE80211N=y + # IEEE 802.11ac (Very High Throughput) support (mainly for AP mode) +# (depends on CONFIG_IEEE80211N) #CONFIG_IEEE80211AC=y -# IEEE 802.11ax HE support (mainly for AP mode) -#CONFIG_IEEE80211AX=y - -# IEEE 802.11be EHT support (mainly for AP mode) -# CONFIG_IEEE80211AX is mandatory for setting CONFIG_IEEE80211BE. -# Note: This is experimental and work in progress. The definitions are still -# subject to change and this should not be expected to interoperate with the -# final IEEE 802.11be version. -#CONFIG_IEEE80211BE=y - # Wireless Network Management (IEEE Std 802.11v-2011) # Note: This is experimental and not complete implementation. #CONFIG_WNM=y @@ -549,8 +538,6 @@ CONFIG_GETRANDOM=y # # External password backend for testing purposes (developer use) #CONFIG_EXT_PASSWORD_TEST=y -# File-based backend to read passwords from an external file. -#CONFIG_EXT_PASSWORD_FILE=y # Enable Fast Session Transfer (FST) #CONFIG_FST=y @@ -622,36 +609,10 @@ CONFIG_GETRANDOM=y # Experimental implementation of draft-harkins-owe-07.txt #CONFIG_OWE=y -# Device Provisioning Protocol (DPP) (also known as Wi-Fi Easy Connect) +# Device Provisioning Protocol (DPP) +# This requires CONFIG_IEEE80211W=y to be enabled, too. (see +# wpa_supplicant/README-DPP for details) #CONFIG_DPP=y -# DPP version 2 support -#CONFIG_DPP2=y -# DPP version 3 support (experimental and still changing; do not enable for -# production use) -#CONFIG_DPP3=y - -# Wired equivalent privacy (WEP) -# WEP is an obsolete cryptographic data confidentiality algorithm that is not -# considered secure. It should not be used for anything anymore. The -# functionality needed to use WEP is available in the current wpa_supplicant -# release under this optional build parameter. This functionality is subject to -# be completely removed in a future release. -#CONFIG_WEP=y - -# Remove all TKIP functionality -# TKIP is an old cryptographic data confidentiality algorithm that is not -# considered secure. It should not be used anymore for anything else than a -# backwards compatibility option as a group cipher when connecting to APs that -# use WPA+WPA2 mixed mode. For now, the default wpa_supplicant build includes -# support for this by default, but that functionality is subject to be removed -# in the future. -#CONFIG_NO_TKIP=y - -# Pre-Association Security Negotiation (PASN) -# Experimental implementation based on IEEE P802.11z/D2.6 and the protocol -# design is still subject to change. As such, this should not yet be enabled in -# production use. -#CONFIG_PASN=y # uBus IPC/RPC System # Services can connect to the bus and provide methods diff --git a/package/network/services/hostapd/files/wpa_supplicant-p2p.config b/package/network/services/hostapd/files/wpa_supplicant-p2p.config index 8648b1657b14dd..7f5140622cc15a 100644 --- a/package/network/services/hostapd/files/wpa_supplicant-p2p.config +++ b/package/network/services/hostapd/files/wpa_supplicant-p2p.config @@ -101,9 +101,6 @@ CONFIG_EAP_MSCHAPV2=y # EAP-TLS CONFIG_EAP_TLS=y -# Enable EAP-TLSv1.3 support by default (currently disabled unless explicitly -# enabled in network configuration) -#CONFIG_EAP_TLSV1_3=y # EAL-PEAP CONFIG_EAP_PEAP=y @@ -206,9 +203,6 @@ CONFIG_HT_OVERRIDES=y # Support VHT overrides (disable VHT, mask MCS rates, etc.) CONFIG_VHT_OVERRIDES=y -# Support HE overrides -CONFIG_HE_OVERRIDES=y - # Development testing #CONFIG_EAPOL_TEST=y @@ -254,10 +248,7 @@ CONFIG_CTRL_IFACE=y # Simultaneous Authentication of Equals (SAE), WPA3-Personal #CONFIG_SAE=y -# SAE Public Key, WPA3-Personal -#CONFIG_SAE_PK=y - -# Disable scan result processing (ap_scan=1) to save code size by about 1 kB. +# Disable scan result processing (ap_mode=1) to save code size by about 1 kB. # This can be used if ap_scan=1 mode is never enabled. #CONFIG_NO_SCAN_PROCESSING=y @@ -319,6 +310,10 @@ CONFIG_ELOOP_EPOLL=y # bridge interfaces (commit 'bridge: respect RFC2863 operational state')'). CONFIG_NO_LINUX_PACKET_SOCKET_WAR=y +# IEEE 802.11w (management frame protection), also known as PMF +# Driver support is also needed for IEEE 802.11w. +CONFIG_IEEE80211W=y + # Support Operating Channel Validation #CONFIG_OCV=y @@ -371,7 +366,7 @@ CONFIG_INTERNAL_LIBTOMMATH_FAST=y #PLATFORMSDKLIB="/opt/Program Files/Microsoft Platform SDK/Lib" # Add support for new DBus control interface -# (fi.w1.wpa_supplicant1) +# (fi.w1.hostap.wpa_supplicant1) #CONFIG_CTRL_IFACE_DBUS_NEW=y # Add introspection support for new DBus control interface @@ -480,19 +475,13 @@ CONFIG_NO_RANDOM_POOL=y # Requires glibc 2.25 to build, falls back to /dev/random if unavailable. CONFIG_GETRANDOM=y +# IEEE 802.11n (High Throughput) support (mainly for AP mode) +#CONFIG_IEEE80211N=y + # IEEE 802.11ac (Very High Throughput) support (mainly for AP mode) +# (depends on CONFIG_IEEE80211N) #CONFIG_IEEE80211AC=y -# IEEE 802.11ax HE support (mainly for AP mode) -#CONFIG_IEEE80211AX=y - -# IEEE 802.11be EHT support (mainly for AP mode) -# CONFIG_IEEE80211AX is mandatory for setting CONFIG_IEEE80211BE. -# Note: This is experimental and work in progress. The definitions are still -# subject to change and this should not be expected to interoperate with the -# final IEEE 802.11be version. -#CONFIG_IEEE80211BE=y - # Wireless Network Management (IEEE Std 802.11v-2011) # Note: This is experimental and not complete implementation. #CONFIG_WNM=y @@ -549,8 +538,6 @@ CONFIG_P2P=y # # External password backend for testing purposes (developer use) #CONFIG_EXT_PASSWORD_TEST=y -# File-based backend to read passwords from an external file. -#CONFIG_EXT_PASSWORD_FILE=y # Enable Fast Session Transfer (FST) #CONFIG_FST=y @@ -622,36 +609,10 @@ CONFIG_IBSS_RSN=y # Experimental implementation of draft-harkins-owe-07.txt #CONFIG_OWE=y -# Device Provisioning Protocol (DPP) (also known as Wi-Fi Easy Connect) +# Device Provisioning Protocol (DPP) +# This requires CONFIG_IEEE80211W=y to be enabled, too. (see +# wpa_supplicant/README-DPP for details) #CONFIG_DPP=y -# DPP version 2 support -#CONFIG_DPP2=y -# DPP version 3 support (experimental and still changing; do not enable for -# production use) -#CONFIG_DPP3=y - -# Wired equivalent privacy (WEP) -# WEP is an obsolete cryptographic data confidentiality algorithm that is not -# considered secure. It should not be used for anything anymore. The -# functionality needed to use WEP is available in the current wpa_supplicant -# release under this optional build parameter. This functionality is subject to -# be completely removed in a future release. -#CONFIG_WEP=y - -# Remove all TKIP functionality -# TKIP is an old cryptographic data confidentiality algorithm that is not -# considered secure. It should not be used anymore for anything else than a -# backwards compatibility option as a group cipher when connecting to APs that -# use WPA+WPA2 mixed mode. For now, the default wpa_supplicant build includes -# support for this by default, but that functionality is subject to be removed -# in the future. -#CONFIG_NO_TKIP=y - -# Pre-Association Security Negotiation (PASN) -# Experimental implementation based on IEEE P802.11z/D2.6 and the protocol -# design is still subject to change. As such, this should not yet be enabled in -# production use. -#CONFIG_PASN=y # uBus IPC/RPC System # Services can connect to the bus and provide methods diff --git a/package/network/services/hostapd/patches/011-mesh-use-deterministic-channel-on-channel-switch.patch b/package/network/services/hostapd/patches/011-mesh-use-deterministic-channel-on-channel-switch.patch index 869a659b0503a9..bfc30e2842b528 100644 --- a/package/network/services/hostapd/patches/011-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 chan_idx, num_available_chandefs); --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -11463,6 +11463,10 @@ static int nl80211_switch_channel(void * +@@ -11465,6 +11465,10 @@ static int nl80211_switch_channel(void * if (ret) goto error; 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 index 2dc44be5899cc9..b5551f50e60db0 100644 --- 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 @@ -4,7 +4,7 @@ Subject: [PATCH] fix adding back stations after a missed deauth/disassoc --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c -@@ -4782,6 +4782,13 @@ static int add_associated_sta(struct hos +@@ -4784,6 +4784,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. @@ -18,7 +18,7 @@ Subject: [PATCH] fix adding back stations after a missed deauth/disassoc */ 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)", -@@ -4795,7 +4802,8 @@ static int add_associated_sta(struct hos +@@ -4797,7 +4804,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) && diff --git a/package/network/services/hostapd/patches/050-Fix-OpenWrt-13156.patch b/package/network/services/hostapd/patches/050-Fix-OpenWrt-13156.patch index 0306a81cc10b58..2492e480fb5977 100644 --- a/package/network/services/hostapd/patches/050-Fix-OpenWrt-13156.patch +++ b/package/network/services/hostapd/patches/050-Fix-OpenWrt-13156.patch @@ -20,7 +20,7 @@ Signed-off-by: Stijn Tintel --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c -@@ -4017,6 +4017,8 @@ int hostapd_remove_iface(struct hapd_int +@@ -4055,6 +4055,8 @@ int hostapd_remove_iface(struct hapd_int void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta, int reassoc) { @@ -29,7 +29,7 @@ Signed-off-by: Stijn Tintel if (hapd->tkip_countermeasures) { hostapd_drv_sta_deauth(hapd, sta->addr, WLAN_REASON_MICHAEL_MIC_FAILURE); -@@ -4024,10 +4026,16 @@ void hostapd_new_assoc_sta(struct hostap +@@ -4062,10 +4064,16 @@ void hostapd_new_assoc_sta(struct hostap } #ifdef CONFIG_IEEE80211BE diff --git a/package/network/services/hostapd/patches/051-nl80211-add-extra-ies-only-if-allowed-by-driver.patch b/package/network/services/hostapd/patches/051-nl80211-add-extra-ies-only-if-allowed-by-driver.patch index 0d3fcd574d6eec..46ee6234be6837 100644 --- a/package/network/services/hostapd/patches/051-nl80211-add-extra-ies-only-if-allowed-by-driver.patch +++ b/package/network/services/hostapd/patches/051-nl80211-add-extra-ies-only-if-allowed-by-driver.patch @@ -26,7 +26,7 @@ Signed-off-by: David Bauer --- a/src/drivers/driver.h +++ b/src/drivers/driver.h -@@ -2384,6 +2384,9 @@ struct wpa_driver_capa { +@@ -2390,6 +2390,9 @@ struct wpa_driver_capa { /** Maximum number of iterations in a single scan plan */ u32 max_sched_scan_plan_iterations; diff --git a/package/network/services/hostapd/patches/140-tests-Makefile-make-run-tests-with-CONFIG_TLS.patch b/package/network/services/hostapd/patches/140-tests-Makefile-make-run-tests-with-CONFIG_TLS.patch index fd6055d2911c88..6bc1b78bdadb82 100644 --- a/package/network/services/hostapd/patches/140-tests-Makefile-make-run-tests-with-CONFIG_TLS.patch +++ b/package/network/services/hostapd/patches/140-tests-Makefile-make-run-tests-with-CONFIG_TLS.patch @@ -979,7 +979,7 @@ Signed-off-by: Glenn Strauss raise HwsimSkip("Crypto library does not support Brainpool curves: " + tls) capa = dev.request("GET_CAPABILITY dpp") ver = 1 -@@ -3902,6 +3903,9 @@ def test_dpp_proto_auth_req_no_i_proto_k +@@ -3925,6 +3926,9 @@ def test_dpp_proto_auth_req_no_i_proto_k def test_dpp_proto_auth_req_invalid_i_proto_key(dev, apdev): """DPP protocol testing - invalid I-proto key in Auth Req""" @@ -989,7 +989,7 @@ Signed-off-by: Glenn Strauss run_dpp_proto_auth_req_missing(dev, 66, "Invalid Initiator Protocol Key") def test_dpp_proto_auth_req_no_i_nonce(dev, apdev): -@@ -3997,7 +4001,12 @@ def test_dpp_proto_auth_resp_no_r_proto_ +@@ -4020,7 +4024,12 @@ def test_dpp_proto_auth_resp_no_r_proto_ def test_dpp_proto_auth_resp_invalid_r_proto_key(dev, apdev): """DPP protocol testing - invalid R-Proto Key in Auth Resp""" @@ -1003,7 +1003,7 @@ Signed-off-by: Glenn Strauss def test_dpp_proto_auth_resp_no_r_nonce(dev, apdev): """DPP protocol testing - no R-nonce in Auth Resp""" -@@ -4359,11 +4368,17 @@ def test_dpp_proto_pkex_exchange_resp_in +@@ -4382,11 +4391,17 @@ def test_dpp_proto_pkex_exchange_resp_in def test_dpp_proto_pkex_cr_req_invalid_bootstrap_key(dev, apdev): """DPP protocol testing - invalid Bootstrap Key in PKEX Commit-Reveal Request""" diff --git a/package/network/services/hostapd/patches/150-add-NULL-checks-encountered-during-tests-hwsim.patch b/package/network/services/hostapd/patches/150-add-NULL-checks-encountered-during-tests-hwsim.patch index c8c3ff33f42022..78ed459ee6965e 100644 --- a/package/network/services/hostapd/patches/150-add-NULL-checks-encountered-during-tests-hwsim.patch +++ b/package/network/services/hostapd/patches/150-add-NULL-checks-encountered-during-tests-hwsim.patch @@ -29,7 +29,7 @@ Signed-off-by: Glenn Strauss wpa_printf(MSG_DEBUG, "DPP: Generating a keypair"); --- a/src/common/sae.c +++ b/src/common/sae.c -@@ -1278,6 +1278,13 @@ void sae_deinit_pt(struct sae_pt *pt) +@@ -1279,6 +1279,13 @@ void sae_deinit_pt(struct sae_pt *pt) static int sae_derive_commit_element_ecc(struct sae_data *sae, struct crypto_bignum *mask) { diff --git a/package/network/services/hostapd/patches/170-hostapd-update-cfs0-and-cfs1-for-160MHz.patch b/package/network/services/hostapd/patches/170-hostapd-update-cfs0-and-cfs1-for-160MHz.patch index e2fe06e4a2b71a..0af7a379bcb222 100644 --- a/package/network/services/hostapd/patches/170-hostapd-update-cfs0-and-cfs1-for-160MHz.patch +++ b/package/network/services/hostapd/patches/170-hostapd-update-cfs0-and-cfs1-for-160MHz.patch @@ -40,7 +40,7 @@ Signed-off-by: P Praneesh #endif /* CONFIG_IEEE80211AC */ --- a/src/ap/ieee802_11_ht.c +++ b/src/ap/ieee802_11_ht.c -@@ -82,7 +82,9 @@ u8 * hostapd_eid_ht_capabilities(struct +@@ -127,7 +127,9 @@ no_update: u8 * hostapd_eid_ht_operation(struct hostapd_data *hapd, u8 *eid) { struct ieee80211_ht_operation *oper; @@ -50,9 +50,9 @@ Signed-off-by: P Praneesh if (!hapd->iconf->ieee80211n || hapd->conf->disable_11n || is_6ghz_op_class(hapd->iconf->op_class)) -@@ -103,6 +105,13 @@ u8 * hostapd_eid_ht_operation(struct hos - oper->ht_param |= HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW | - HT_INFO_HT_PARAM_STA_CHNL_WIDTH; +@@ -143,6 +145,13 @@ u8 * hostapd_eid_ht_operation(struct hos + oper->operation_mode = host_to_le16(hapd->iface->ht_op_mode); + set_ht_param(hapd, oper); + vht_capabilities_info = host_to_le32(hapd->iface->current_mode->vht_capab); + chwidth = hostapd_get_oper_chwidth(hapd->iconf); @@ -130,7 +130,7 @@ Signed-off-by: P Praneesh #undef VHT_CAP_CHECK_MAX --- a/src/common/ieee802_11_defs.h +++ b/src/common/ieee802_11_defs.h -@@ -1400,6 +1400,8 @@ struct ieee80211_ampe_ie { +@@ -1401,6 +1401,8 @@ struct ieee80211_ampe_ie { #define VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB ((u32) BIT(26) | BIT(27)) #define VHT_CAP_RX_ANTENNA_PATTERN ((u32) BIT(28)) #define VHT_CAP_TX_ANTENNA_PATTERN ((u32) BIT(29)) diff --git a/package/network/services/hostapd/patches/200-multicall.patch b/package/network/services/hostapd/patches/200-multicall.patch index 753fdb0849078f..80a484e974d25d 100644 --- a/package/network/services/hostapd/patches/200-multicall.patch +++ b/package/network/services/hostapd/patches/200-multicall.patch @@ -83,7 +83,7 @@ This allows building both hostapd and wpa_supplicant as a single binary #ifdef CONFIG_WPS static int gen_uuid(const char *txt_addr) -@@ -812,6 +817,8 @@ int main(int argc, char *argv[]) +@@ -817,6 +822,8 @@ int main(int argc, char *argv[]) return -1; #endif /* CONFIG_DPP */ @@ -94,7 +94,7 @@ This allows building both hostapd and wpa_supplicant as a single binary if (c < 0) --- a/src/ap/drv_callbacks.c +++ b/src/ap/drv_callbacks.c -@@ -2514,8 +2514,8 @@ static void hostapd_mld_iface_disable(st +@@ -2520,8 +2520,8 @@ static void hostapd_mld_iface_disable(st #endif /* CONFIG_IEEE80211BE */ @@ -105,7 +105,7 @@ This allows building both hostapd and wpa_supplicant as a single binary { struct hostapd_data *hapd = ctx; struct sta_info *sta; -@@ -2873,7 +2873,7 @@ void wpa_supplicant_event(void *ctx, enu +@@ -2879,7 +2879,7 @@ void wpa_supplicant_event(void *ctx, enu } @@ -116,7 +116,7 @@ This allows building both hostapd and wpa_supplicant as a single binary struct hapd_interfaces *interfaces = ctx; --- a/src/drivers/driver.h +++ b/src/drivers/driver.h -@@ -6897,8 +6897,8 @@ union wpa_event_data { +@@ -6974,8 +6974,8 @@ union wpa_event_data { * Driver wrapper code should call this function whenever an event is received * from the driver. */ @@ -127,7 +127,7 @@ This allows building both hostapd and wpa_supplicant as a single binary /** * wpa_supplicant_event_global - Report a driver event for wpa_supplicant -@@ -6910,7 +6910,7 @@ void wpa_supplicant_event(void *ctx, enu +@@ -6987,7 +6987,7 @@ void wpa_supplicant_event(void *ctx, enu * Same as wpa_supplicant_event(), but we search for the interface in * wpa_global. */ @@ -278,8 +278,8 @@ This allows building both hostapd and wpa_supplicant as a single binary os_memset(&eapol_test, 0, sizeof(eapol_test)); --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c -@@ -6099,8 +6099,8 @@ static void wpas_link_reconfig(struct wp - } +@@ -6131,8 +6131,8 @@ static int wpas_pasn_auth(struct wpa_sup + #endif /* CONFIG_PASN */ -void wpa_supplicant_event(void *ctx, enum wpa_event_type event, @@ -289,7 +289,7 @@ This allows building both hostapd and wpa_supplicant as a single binary { struct wpa_supplicant *wpa_s = ctx; int resched; -@@ -7052,7 +7052,7 @@ void wpa_supplicant_event(void *ctx, enu +@@ -7084,7 +7084,7 @@ void wpa_supplicant_event(void *ctx, enu } diff --git a/package/network/services/hostapd/patches/211-ctrl-make-WNM_AP-functions-dependant-on-CONFIG_AP.patch b/package/network/services/hostapd/patches/211-ctrl-make-WNM_AP-functions-dependant-on-CONFIG_AP.patch index 475a50b87e5420..38d4d1500a4347 100644 --- a/package/network/services/hostapd/patches/211-ctrl-make-WNM_AP-functions-dependant-on-CONFIG_AP.patch +++ b/package/network/services/hostapd/patches/211-ctrl-make-WNM_AP-functions-dependant-on-CONFIG_AP.patch @@ -13,7 +13,7 @@ Signed-off-by: David Bauer --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c -@@ -13233,7 +13233,7 @@ char * wpa_supplicant_ctrl_iface_process +@@ -13292,7 +13292,7 @@ char * wpa_supplicant_ctrl_iface_process if (wpas_ctrl_iface_coloc_intf_report(wpa_s, buf + 18)) reply_len = -1; #endif /* CONFIG_WNM */ @@ -22,7 +22,7 @@ Signed-off-by: David Bauer } else if (os_strncmp(buf, "DISASSOC_IMMINENT ", 18) == 0) { if (ap_ctrl_iface_disassoc_imminent(wpa_s, buf + 18)) reply_len = -1; -@@ -13243,7 +13243,7 @@ char * wpa_supplicant_ctrl_iface_process +@@ -13302,7 +13302,7 @@ char * wpa_supplicant_ctrl_iface_process } else if (os_strncmp(buf, "BSS_TM_REQ ", 11) == 0) { if (ap_ctrl_iface_bss_tm_req(wpa_s, buf + 11)) reply_len = -1; diff --git a/package/network/services/hostapd/patches/220-indicate-features.patch b/package/network/services/hostapd/patches/220-indicate-features.patch index 064e2dd626bd8b..13a5c38631d041 100644 --- a/package/network/services/hostapd/patches/220-indicate-features.patch +++ b/package/network/services/hostapd/patches/220-indicate-features.patch @@ -15,7 +15,7 @@ Subject: [PATCH] hostapd: support optional argument for the -v switch of struct hapd_global { void **drv_priv; -@@ -820,7 +820,7 @@ int main(int argc, char *argv[]) +@@ -825,7 +825,7 @@ int main(int argc, char *argv[]) wpa_supplicant_event = hostapd_wpa_event; wpa_supplicant_event_global = hostapd_wpa_event_global; for (;;) { @@ -24,7 +24,7 @@ Subject: [PATCH] hostapd: support optional argument for the -v switch of if (c < 0) break; switch (c) { -@@ -857,6 +857,8 @@ int main(int argc, char *argv[]) +@@ -862,6 +862,8 @@ int main(int argc, char *argv[]) break; #endif /* CONFIG_DEBUG_LINUX_TRACING */ case 'v': diff --git a/package/network/services/hostapd/patches/250-hostapd_cli_ifdef.patch b/package/network/services/hostapd/patches/250-hostapd_cli_ifdef.patch index 58143020ce0a17..90737b2ac0e9b6 100644 --- a/package/network/services/hostapd/patches/250-hostapd_cli_ifdef.patch +++ b/package/network/services/hostapd/patches/250-hostapd_cli_ifdef.patch @@ -5,7 +5,7 @@ Subject: [PATCH] hostapd: support wps in hostapd_cli even when built from the --- a/hostapd/hostapd_cli.c +++ b/hostapd/hostapd_cli.c -@@ -401,7 +401,6 @@ static int hostapd_cli_cmd_disassociate( +@@ -409,7 +409,6 @@ static int hostapd_cli_cmd_disassociate( } @@ -13,7 +13,7 @@ Subject: [PATCH] hostapd: support wps in hostapd_cli even when built from the static int hostapd_cli_cmd_signature(struct wpa_ctrl *ctrl, int argc, char *argv[]) { -@@ -414,7 +413,6 @@ static int hostapd_cli_cmd_signature(str +@@ -422,7 +421,6 @@ static int hostapd_cli_cmd_signature(str os_snprintf(buf, sizeof(buf), "SIGNATURE %s", argv[0]); return wpa_ctrl_command(ctrl, buf); } @@ -21,7 +21,7 @@ Subject: [PATCH] hostapd: support wps in hostapd_cli even when built from the static int hostapd_cli_cmd_sa_query(struct wpa_ctrl *ctrl, int argc, -@@ -431,7 +429,6 @@ static int hostapd_cli_cmd_sa_query(stru +@@ -439,7 +437,6 @@ static int hostapd_cli_cmd_sa_query(stru } @@ -29,7 +29,7 @@ Subject: [PATCH] hostapd: support wps in hostapd_cli even when built from the static int hostapd_cli_cmd_wps_pin(struct wpa_ctrl *ctrl, int argc, char *argv[]) { -@@ -657,7 +654,6 @@ static int hostapd_cli_cmd_wps_config(st +@@ -665,7 +662,6 @@ static int hostapd_cli_cmd_wps_config(st ssid_hex, argv[1]); return wpa_ctrl_command(ctrl, buf); } @@ -37,7 +37,7 @@ Subject: [PATCH] hostapd: support wps in hostapd_cli even when built from the static int hostapd_cli_cmd_disassoc_imminent(struct wpa_ctrl *ctrl, int argc, -@@ -1686,13 +1682,10 @@ static const struct hostapd_cli_cmd host +@@ -1694,13 +1690,10 @@ static const struct hostapd_cli_cmd host { "disassociate", hostapd_cli_cmd_disassociate, hostapd_complete_stations, " = disassociate a station" }, @@ -51,7 +51,7 @@ Subject: [PATCH] hostapd: support wps in hostapd_cli even when built from the { "wps_pin", hostapd_cli_cmd_wps_pin, NULL, " [timeout] [addr] = add WPS Enrollee PIN" }, { "wps_check_pin", hostapd_cli_cmd_wps_check_pin, NULL, -@@ -1717,7 +1710,6 @@ static const struct hostapd_cli_cmd host +@@ -1725,7 +1718,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/252-disable_ctrl_iface_mib.patch b/package/network/services/hostapd/patches/252-disable_ctrl_iface_mib.patch index 0110e08d63778f..0801a93bcd6ed7 100644 --- a/package/network/services/hostapd/patches/252-disable_ctrl_iface_mib.patch +++ b/package/network/services/hostapd/patches/252-disable_ctrl_iface_mib.patch @@ -16,7 +16,7 @@ Subject: [PATCH] Remove some unnecessary control interface functionality else --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c -@@ -4045,6 +4045,7 @@ static int hostapd_ctrl_iface_receive_pr +@@ -4057,6 +4057,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); @@ -24,7 +24,7 @@ Subject: [PATCH] Remove some unnecessary control interface functionality } else if (os_strcmp(buf, "MIB") == 0) { reply_len = ieee802_11_get_mib(hapd, reply, reply_size); if (reply_len >= 0) { -@@ -4086,6 +4087,7 @@ static int hostapd_ctrl_iface_receive_pr +@@ -4098,6 +4099,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); @@ -113,7 +113,7 @@ Subject: [PATCH] Remove some unnecessary control interface functionality if (os_snprintf_error(buflen - len, ret)) --- a/src/ap/ieee802_1x.c +++ b/src/ap/ieee802_1x.c -@@ -2848,6 +2848,7 @@ static const char * bool_txt(bool val) +@@ -2869,6 +2869,7 @@ static const char * bool_txt(bool val) return val ? "TRUE" : "FALSE"; } @@ -121,7 +121,7 @@ Subject: [PATCH] Remove some unnecessary control interface functionality int ieee802_1x_get_mib(struct hostapd_data *hapd, char *buf, size_t buflen) { -@@ -3034,6 +3035,7 @@ int ieee802_1x_get_mib_sta(struct hostap +@@ -3055,6 +3056,7 @@ int ieee802_1x_get_mib_sta(struct hostap return len; } @@ -131,7 +131,7 @@ Subject: [PATCH] Remove some unnecessary control interface functionality 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 -@@ -6129,6 +6129,7 @@ static const char * wpa_bool_txt(int val +@@ -6141,6 +6141,7 @@ static const char * wpa_bool_txt(int val return val ? "TRUE" : "FALSE"; } @@ -139,7 +139,7 @@ Subject: [PATCH] Remove some unnecessary control interface functionality #define RSN_SUITE "%02x-%02x-%02x-%d" #define RSN_SUITE_ARG(s) \ -@@ -6281,7 +6282,7 @@ int wpa_get_mib_sta(struct wpa_state_mac +@@ -6293,7 +6294,7 @@ int wpa_get_mib_sta(struct wpa_state_mac return len; } @@ -201,7 +201,7 @@ Subject: [PATCH] Remove some unnecessary control interface functionality if (wpa_s->ap_iface) { pos += ap_ctrl_iface_wpa_get_status(wpa_s, pos, end - pos, -@@ -12561,6 +12561,7 @@ char * wpa_supplicant_ctrl_iface_process +@@ -12620,6 +12620,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); @@ -209,7 +209,7 @@ Subject: [PATCH] Remove some unnecessary control interface functionality } else if (os_strcmp(buf, "MIB") == 0) { reply_len = wpa_sm_get_mib(wpa_s->wpa, reply, reply_size); if (reply_len >= 0) { -@@ -12573,6 +12574,7 @@ char * wpa_supplicant_ctrl_iface_process +@@ -12632,6 +12633,7 @@ char * wpa_supplicant_ctrl_iface_process reply_size - reply_len); #endif /* CONFIG_MACSEC */ } @@ -217,7 +217,7 @@ Subject: [PATCH] Remove some unnecessary control interface functionality } else if (os_strncmp(buf, "STATUS", 6) == 0) { reply_len = wpa_supplicant_ctrl_iface_status( wpa_s, buf + 6, reply, reply_size); -@@ -13061,6 +13063,7 @@ char * wpa_supplicant_ctrl_iface_process +@@ -13120,6 +13122,7 @@ char * wpa_supplicant_ctrl_iface_process reply_len = wpa_supplicant_ctrl_iface_bss( wpa_s, buf + 4, reply, reply_size); #ifdef CONFIG_AP @@ -225,7 +225,7 @@ Subject: [PATCH] Remove some unnecessary control interface functionality } 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) { -@@ -13069,12 +13072,15 @@ char * wpa_supplicant_ctrl_iface_process +@@ -13128,12 +13131,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); diff --git a/package/network/services/hostapd/patches/300-noscan.patch b/package/network/services/hostapd/patches/300-noscan.patch index f208b2937d02d3..6deb2722b37198 100644 --- a/package/network/services/hostapd/patches/300-noscan.patch +++ b/package/network/services/hostapd/patches/300-noscan.patch @@ -41,7 +41,7 @@ Subject: [PATCH] Add noscan, no_ht_coex config options hostapd_set_state(iface, HAPD_IFACE_HT_SCAN); --- a/src/ap/ieee802_11_ht.c +++ b/src/ap/ieee802_11_ht.c -@@ -239,6 +239,9 @@ void hostapd_2040_coex_action(struct hos +@@ -279,6 +279,9 @@ void hostapd_2040_coex_action(struct hos return; } @@ -51,7 +51,7 @@ Subject: [PATCH] Add noscan, no_ht_coex config options if (len < IEEE80211_HDRLEN + 2 + sizeof(*bc_ie)) { wpa_printf(MSG_DEBUG, "Ignore too short 20/40 BSS Coexistence Management frame"); -@@ -399,6 +402,9 @@ void ht40_intolerant_add(struct hostapd_ +@@ -439,6 +442,9 @@ void ht40_intolerant_add(struct hostapd_ if (iface->current_mode->mode != HOSTAPD_MODE_IEEE80211G) return; 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 bcc39ea758646b..e757a6df00527c 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 @@ -5,7 +5,7 @@ Subject: [PATCH] nl80211_fix_set_freq.patch --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -5510,7 +5510,7 @@ static int nl80211_set_channel(struct i8 +@@ -5512,7 +5512,7 @@ static int nl80211_set_channel(struct i8 freq->he_enabled, freq->eht_enabled, freq->bandwidth, freq->center_freq1, freq->center_freq2); 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 8b8434773888ea..c3b3ded908cc82 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 @@ -4,7 +4,7 @@ Subject: [PATCH] nl80211_del_beacon_bss.patch --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -6251,8 +6251,7 @@ static void nl80211_teardown_ap(struct i +@@ -6253,8 +6253,7 @@ static void nl80211_teardown_ap(struct i nl80211_mgmt_unsubscribe(bss, "AP teardown"); nl80211_put_wiphy_data_ap(bss); diff --git a/package/network/services/hostapd/patches/381-hostapd_cli_UNKNOWN-COMMAND.patch b/package/network/services/hostapd/patches/381-hostapd_cli_UNKNOWN-COMMAND.patch index e68edacb44062c..29026ac9d1c0a9 100644 --- a/package/network/services/hostapd/patches/381-hostapd_cli_UNKNOWN-COMMAND.patch +++ b/package/network/services/hostapd/patches/381-hostapd_cli_UNKNOWN-COMMAND.patch @@ -11,7 +11,7 @@ if CONFIG_CTRL_IFACE_MIB is not defined. --- a/hostapd/hostapd_cli.c +++ b/hostapd/hostapd_cli.c -@@ -753,7 +753,7 @@ static int wpa_ctrl_command_sta(struct w +@@ -761,7 +761,7 @@ static int wpa_ctrl_command_sta(struct w } buf[len] = '\0'; 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 4003793a707a4e..cc7b1317872f41 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 @@ -14,7 +14,7 @@ Signed-hostap: Antonio Quartulli --- a/src/drivers/driver.h +++ b/src/drivers/driver.h -@@ -1000,6 +1000,9 @@ struct wpa_driver_associate_params { +@@ -1004,6 +1004,9 @@ struct wpa_driver_associate_params { * responsible for selecting with which BSS to associate. */ const u8 *bssid; 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 3cd2949e11f3b3..80ccb1c2071b46 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,7 +19,7 @@ Tested-by: Simon Wunderlich --- a/src/drivers/driver.h +++ b/src/drivers/driver.h -@@ -1916,6 +1916,7 @@ struct wpa_driver_mesh_join_params { +@@ -1920,6 +1920,7 @@ struct wpa_driver_mesh_join_params { #define WPA_DRIVER_MESH_FLAG_AMPE 0x00000008 unsigned int flags; bool handle_dfs; @@ -29,7 +29,7 @@ Tested-by: Simon Wunderlich struct wpa_driver_set_key_params { --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -12140,6 +12140,18 @@ static int nl80211_put_mesh_id(struct nl +@@ -12142,6 +12142,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) { -@@ -12201,6 +12213,7 @@ static int nl80211_join_mesh(struct i802 +@@ -12203,6 +12215,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) || diff --git a/package/network/services/hostapd/patches/590-rrm-wnm-statistics.patch b/package/network/services/hostapd/patches/590-rrm-wnm-statistics.patch index 2f66fb36b302ff..be09ed319c9663 100644 --- a/package/network/services/hostapd/patches/590-rrm-wnm-statistics.patch +++ b/package/network/services/hostapd/patches/590-rrm-wnm-statistics.patch @@ -10,7 +10,7 @@ method. --- a/src/ap/hostapd.h +++ b/src/ap/hostapd.h -@@ -183,6 +183,21 @@ struct mld_link_info { +@@ -185,6 +185,21 @@ struct mld_link_info { }; /** @@ -32,7 +32,7 @@ method. * struct hostapd_data - hostapd per-BSS data structure */ struct hostapd_data { -@@ -196,6 +211,9 @@ struct hostapd_data { +@@ -198,6 +213,9 @@ struct hostapd_data { u8 own_addr[ETH_ALEN]; diff --git a/package/network/services/hostapd/patches/600-ubus_support.patch b/package/network/services/hostapd/patches/600-ubus_support.patch index b864cd9a13aebb..fb3bfb012030bd 100644 --- a/package/network/services/hostapd/patches/600-ubus_support.patch +++ b/package/network/services/hostapd/patches/600-ubus_support.patch @@ -92,7 +92,7 @@ probe/assoc/auth requests via object subscribe. return 0; --- a/src/ap/drv_callbacks.c +++ b/src/ap/drv_callbacks.c -@@ -316,6 +316,10 @@ int hostapd_notif_assoc(struct hostapd_d +@@ -317,6 +317,10 @@ int hostapd_notif_assoc(struct hostapd_d struct hostapd_iface *iface = hapd->iface; #endif /* CONFIG_OWE */ bool updated = false; @@ -103,7 +103,7 @@ probe/assoc/auth requests via object subscribe. if (addr == NULL) { /* -@@ -460,6 +464,12 @@ int hostapd_notif_assoc(struct hostapd_d +@@ -461,6 +465,12 @@ int hostapd_notif_assoc(struct hostapd_d goto fail; } @@ -135,7 +135,7 @@ probe/assoc/auth requests via object subscribe. return 0; } -@@ -2497,6 +2500,7 @@ static int hostapd_setup_interface_compl +@@ -2525,6 +2528,7 @@ static int hostapd_setup_interface_compl if (err) goto fail; @@ -143,7 +143,7 @@ probe/assoc/auth requests via object subscribe. wpa_printf(MSG_DEBUG, "Completing interface initialization"); if (iface->freq) { #ifdef NEED_AP_MLME -@@ -2722,6 +2726,7 @@ dfs_offload: +@@ -2750,6 +2754,7 @@ dfs_offload: fail: wpa_printf(MSG_ERROR, "Interface initialization failed"); @@ -151,7 +151,7 @@ probe/assoc/auth requests via object subscribe. if (iface->is_no_ir) { hostapd_set_state(iface, HAPD_IFACE_NO_IR); -@@ -3440,6 +3445,7 @@ void hostapd_interface_deinit_free(struc +@@ -3478,6 +3483,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; @@ -169,7 +169,7 @@ probe/assoc/auth requests via object subscribe. #define OCE_STA_CFON_ENABLED(hapd) \ ((hapd->conf->oce & OCE_STA_CFON) && \ -@@ -204,6 +205,7 @@ struct hostapd_data { +@@ -206,6 +207,7 @@ struct hostapd_data { struct hostapd_iface *iface; struct hostapd_config *iconf; struct hostapd_bss_config *conf; @@ -177,7 +177,7 @@ probe/assoc/auth requests via object subscribe. int interface_added; /* virtual interface added for this BSS */ unsigned int started:1; unsigned int disabled:1; -@@ -766,6 +768,7 @@ hostapd_alloc_bss_data(struct hostapd_if +@@ -776,6 +778,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); @@ -187,7 +187,7 @@ probe/assoc/auth requests via object subscribe. struct hostapd_iface * hostapd_alloc_iface(void); --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c -@@ -2895,7 +2895,7 @@ static void handle_auth(struct hostapd_d +@@ -2897,7 +2897,7 @@ static void handle_auth(struct hostapd_d u16 auth_alg, auth_transaction, status_code; u16 resp = WLAN_STATUS_SUCCESS; struct sta_info *sta = NULL; @@ -196,7 +196,7 @@ probe/assoc/auth requests via object subscribe. u16 fc; const u8 *challenge = NULL; u8 resp_ies[2 + WLAN_AUTH_CHALLENGE_LEN]; -@@ -2906,6 +2906,11 @@ static void handle_auth(struct hostapd_d +@@ -2908,6 +2908,11 @@ static void handle_auth(struct hostapd_d #ifdef CONFIG_IEEE80211BE bool mld_sta = false; #endif /* CONFIG_IEEE80211BE */ @@ -208,7 +208,7 @@ probe/assoc/auth requests via object subscribe. if (len < IEEE80211_HDRLEN + sizeof(mgmt->u.auth)) { wpa_printf(MSG_INFO, "handle_auth - too short payload (len=%lu)", -@@ -3102,6 +3107,13 @@ static void handle_auth(struct hostapd_d +@@ -3104,6 +3109,13 @@ static void handle_auth(struct hostapd_d resp = WLAN_STATUS_UNSPECIFIED_FAILURE; goto fail; } @@ -222,7 +222,7 @@ probe/assoc/auth requests via object subscribe. if (res == HOSTAPD_ACL_PENDING) return; -@@ -5365,7 +5377,7 @@ static void handle_assoc(struct hostapd_ +@@ -5367,7 +5379,7 @@ static void handle_assoc(struct hostapd_ int resp = WLAN_STATUS_SUCCESS; u16 reply_res = WLAN_STATUS_UNSPECIFIED_FAILURE; const u8 *pos; @@ -231,7 +231,7 @@ probe/assoc/auth requests via object subscribe. struct sta_info *sta; u8 *tmp = NULL; #ifdef CONFIG_FILS -@@ -5607,6 +5619,11 @@ static void handle_assoc(struct hostapd_ +@@ -5609,6 +5621,11 @@ static void handle_assoc(struct hostapd_ left = res; } #endif /* CONFIG_FILS */ @@ -243,7 +243,7 @@ probe/assoc/auth requests via object subscribe. /* followed by SSID and Supported rates; and HT capabilities if 802.11n * is used */ -@@ -5709,6 +5726,13 @@ static void handle_assoc(struct hostapd_ +@@ -5711,6 +5728,13 @@ static void handle_assoc(struct hostapd_ if (set_beacon) ieee802_11_update_beacons(hapd->iface); @@ -257,7 +257,7 @@ probe/assoc/auth requests via object subscribe. fail: /* -@@ -5938,6 +5962,7 @@ static void handle_disassoc(struct hosta +@@ -5940,6 +5964,7 @@ static void handle_disassoc(struct hosta (unsigned long) len); return; } @@ -265,7 +265,7 @@ probe/assoc/auth requests via object subscribe. sta = ap_get_sta(hapd, mgmt->sa); if (!sta) { -@@ -5969,6 +5994,8 @@ static void handle_deauth(struct hostapd +@@ -5971,6 +5996,8 @@ static void handle_deauth(struct hostapd /* Clear the PTKSA cache entries for PASN */ ptksa_cache_flush(hapd->ptksa, mgmt->sa, WPA_CIPHER_NONE); @@ -286,16 +286,15 @@ probe/assoc/auth requests via object subscribe. } -@@ -399,6 +402,9 @@ void hostapd_handle_radio_measurement(st - mgmt->u.action.u.rrm.action, MAC2STR(mgmt->sa)); - - switch (mgmt->u.action.u.rrm.action) { -+ case WLAN_RRM_LINK_MEASUREMENT_REPORT: +@@ -406,7 +409,7 @@ void hostapd_handle_radio_measurement(st + hostapd_handle_nei_report_req(hapd, buf, len); + break; + case WLAN_RRM_LINK_MEASUREMENT_REPORT: +- hostapd_handle_link_mesr_report(hapd, buf, len); + hostapd_ubus_handle_link_measurement(hapd, buf, len); -+ break; - case WLAN_RRM_RADIO_MEASUREMENT_REPORT: - hostapd_handle_radio_msmt_report(hapd, buf, len); break; + default: + wpa_printf(MSG_DEBUG, "RRM action %u is not supported", --- a/src/ap/sta_info.c +++ b/src/ap/sta_info.c @@ -542,6 +542,7 @@ void ap_handle_timer(void *eloop_ctx, vo diff --git a/package/network/services/hostapd/patches/601-ucode_support.patch b/package/network/services/hostapd/patches/601-ucode_support.patch index 1a824a167b8ab4..737966201491f1 100644 --- a/package/network/services/hostapd/patches/601-ucode_support.patch +++ b/package/network/services/hostapd/patches/601-ucode_support.patch @@ -34,7 +34,7 @@ as adding/removing interfaces. ifdef CONFIG_CODE_COVERAGE --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c -@@ -5643,6 +5643,7 @@ try_again: +@@ -5998,6 +5998,7 @@ try_again: return -1; } @@ -42,7 +42,7 @@ as adding/removing interfaces. wpa_msg_register_cb(hostapd_ctrl_iface_msg_cb); return 0; -@@ -5744,6 +5745,7 @@ fail: +@@ -6099,6 +6100,7 @@ fail: os_free(fname); interface->global_ctrl_sock = s; @@ -52,7 +52,7 @@ as adding/removing interfaces. --- a/hostapd/main.c +++ b/hostapd/main.c -@@ -1028,6 +1028,7 @@ int main(int argc, char *argv[]) +@@ -1033,6 +1033,7 @@ int main(int argc, char *argv[]) } hostapd_global_ctrl_iface_init(&interfaces); @@ -60,7 +60,7 @@ as adding/removing interfaces. if (hostapd_global_run(&interfaces, daemonize, pid_file)) { wpa_printf(MSG_ERROR, "Failed to start eloop"); -@@ -1037,6 +1038,7 @@ int main(int argc, char *argv[]) +@@ -1042,6 +1043,7 @@ int main(int argc, char *argv[]) ret = 0; out: @@ -70,7 +70,7 @@ as adding/removing interfaces. for (i = 0; i < interfaces.count; i++) { --- a/src/ap/ap_drv_ops.h +++ b/src/ap/ap_drv_ops.h -@@ -404,6 +404,23 @@ static inline int hostapd_drv_stop_ap(st +@@ -409,6 +409,23 @@ static inline int hostapd_drv_stop_ap(st return hapd->driver->stop_ap(hapd->drv_priv, link_id); } @@ -139,7 +139,7 @@ as adding/removing interfaces. { struct hostapd_bss_config *conf = hapd->conf; u8 ssid[SSID_MAX_LEN + 1]; -@@ -2926,7 +2930,7 @@ hostapd_alloc_bss_data(struct hostapd_if +@@ -2954,7 +2958,7 @@ hostapd_alloc_bss_data(struct hostapd_if } @@ -148,7 +148,7 @@ as adding/removing interfaces. { if (!hapd) return; -@@ -3977,7 +3981,8 @@ int hostapd_remove_iface(struct hapd_int +@@ -4015,7 +4019,8 @@ int hostapd_remove_iface(struct hapd_int hapd_iface = interfaces->iface[i]; if (hapd_iface == NULL) return -1; @@ -179,7 +179,7 @@ as adding/removing interfaces. int (*for_each_interface)(struct hapd_interfaces *interfaces, int (*cb)(struct hostapd_iface *iface, void *ctx), void *ctx); -@@ -206,6 +211,7 @@ struct hostapd_data { +@@ -208,6 +213,7 @@ struct hostapd_data { struct hostapd_config *iconf; struct hostapd_bss_config *conf; struct hostapd_ubus_bss ubus; @@ -187,7 +187,7 @@ as adding/removing interfaces. int interface_added; /* virtual interface added for this BSS */ unsigned int started:1; unsigned int disabled:1; -@@ -567,6 +573,7 @@ struct hostapd_mld { +@@ -577,6 +583,7 @@ struct hostapd_mld { */ struct hostapd_iface { struct hapd_interfaces *interfaces; @@ -195,7 +195,7 @@ as adding/removing interfaces. void *owner; char *config_fname; struct hostapd_config *conf; -@@ -777,6 +784,8 @@ struct hostapd_iface * hostapd_init(stru +@@ -787,6 +794,8 @@ struct hostapd_iface * hostapd_init(stru struct hostapd_iface * hostapd_interface_init_bss(struct hapd_interfaces *interfaces, const char *phy, const char *config_fname, int debug); @@ -206,7 +206,7 @@ as adding/removing interfaces. void hostapd_interface_deinit_free(struct hostapd_iface *iface); --- a/src/drivers/driver.h +++ b/src/drivers/driver.h -@@ -3922,6 +3922,25 @@ struct wpa_driver_ops { +@@ -3928,6 +3928,25 @@ struct wpa_driver_ops { const char *ifname); /** @@ -232,7 +232,7 @@ as adding/removing interfaces. * set_sta_vlan - Bind a station into a specific interface (AP only) * @priv: Private driver interface data * @ifname: Interface (main or virtual BSS or VLAN) -@@ -6643,6 +6662,7 @@ union wpa_event_data { +@@ -6720,6 +6739,7 @@ union wpa_event_data { /** * struct ch_switch @@ -240,7 +240,7 @@ as adding/removing interfaces. * @freq: Frequency of new channel in MHz * @ht_enabled: Whether this is an HT channel * @ch_offset: Secondary channel offset -@@ -6653,6 +6673,7 @@ union wpa_event_data { +@@ -6730,6 +6750,7 @@ union wpa_event_data { * @punct_bitmap: Puncturing bitmap */ struct ch_switch { @@ -250,7 +250,7 @@ as adding/removing interfaces. int ch_offset; --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -75,6 +75,16 @@ enum nlmsgerr_attrs { +@@ -77,6 +77,16 @@ enum nlmsgerr_attrs { #endif /* ANDROID */ @@ -267,7 +267,7 @@ as adding/removing interfaces. static struct nl_sock * nl_create_handle(struct nl_cb *cb, const char *dbg) { -@@ -429,6 +439,11 @@ static int no_seq_check(struct nl_msg *m +@@ -431,6 +441,11 @@ static int no_seq_check(struct nl_msg *m return NL_OK; } @@ -279,7 +279,7 @@ as adding/removing interfaces. static void nl80211_nlmsg_clear(struct nl_msg *msg) { -@@ -502,6 +517,8 @@ int send_and_recv(struct nl80211_global +@@ -504,6 +519,8 @@ int send_and_recv(struct nl80211_global if (!msg) return -ENOMEM; @@ -288,7 +288,7 @@ as adding/removing interfaces. err.err = -ENOMEM; s_nl_cb = nl_socket_get_cb(nl_handle); -@@ -536,6 +553,7 @@ int send_and_recv(struct nl80211_global +@@ -538,6 +555,7 @@ int send_and_recv(struct nl80211_global err.orig_msg = msg; err.err_info = err_info; @@ -296,7 +296,7 @@ as adding/removing interfaces. nl_cb_err(cb, NL_CB_CUSTOM, error_handler, &err); nl_cb_set(cb, NL_CB_FINISH, NL_CB_CUSTOM, finish_handler, &err.err); if (ack_handler_custom) { -@@ -939,6 +957,7 @@ nl80211_get_wiphy_data_ap(struct i802_bs +@@ -941,6 +959,7 @@ nl80211_get_wiphy_data_ap(struct i802_bs os_free(w); return NULL; } @@ -304,7 +304,7 @@ as adding/removing interfaces. nl_cb_set(w->nl_cb, NL_CB_SEQ_CHECK, NL_CB_CUSTOM, no_seq_check, NULL); nl_cb_set(w->nl_cb, NL_CB_VALID, NL_CB_CUSTOM, -@@ -1353,7 +1372,7 @@ static void wpa_driver_nl80211_event_rtm +@@ -1355,7 +1374,7 @@ static void wpa_driver_nl80211_event_rtm } wpa_printf(MSG_DEBUG, "nl80211: Interface down (%s/%s)", namebuf, ifname); @@ -313,7 +313,7 @@ as adding/removing interfaces. wpa_printf(MSG_DEBUG, "nl80211: Not the main interface (%s) - do not indicate interface down", drv->first_bss->ifname); -@@ -1389,7 +1408,7 @@ static void wpa_driver_nl80211_event_rtm +@@ -1391,7 +1410,7 @@ static void wpa_driver_nl80211_event_rtm } wpa_printf(MSG_DEBUG, "nl80211: Interface up (%s/%s)", namebuf, ifname); @@ -322,7 +322,7 @@ as adding/removing interfaces. wpa_printf(MSG_DEBUG, "nl80211: Not the main interface (%s) - do not indicate interface up", drv->first_bss->ifname); -@@ -2035,6 +2054,7 @@ static int wpa_driver_nl80211_init_nl_gl +@@ -2037,6 +2056,7 @@ static int wpa_driver_nl80211_init_nl_gl genl_family_put(family); nl_cache_free(cache); @@ -330,7 +330,7 @@ as adding/removing interfaces. nl_cb_set(global->nl_cb, NL_CB_SEQ_CHECK, NL_CB_CUSTOM, no_seq_check, NULL); nl_cb_set(global->nl_cb, NL_CB_VALID, NL_CB_CUSTOM, -@@ -2205,6 +2225,7 @@ static int nl80211_init_bss(struct i802_ +@@ -2207,6 +2227,7 @@ static int nl80211_init_bss(struct i802_ if (!bss->nl_cb) return -1; @@ -338,7 +338,7 @@ as adding/removing interfaces. nl_cb_set(bss->nl_cb, NL_CB_SEQ_CHECK, NL_CB_CUSTOM, no_seq_check, NULL); nl_cb_set(bss->nl_cb, NL_CB_VALID, NL_CB_CUSTOM, -@@ -8702,6 +8723,7 @@ static void *i802_init(struct hostapd_da +@@ -8704,6 +8725,7 @@ static void *i802_init(struct hostapd_da char master_ifname[IFNAMSIZ]; int ifindex, br_ifindex = 0; int br_added = 0; @@ -346,7 +346,7 @@ as adding/removing interfaces. bss = wpa_driver_nl80211_drv_init(hapd, params->ifname, params->global_priv, 1, -@@ -8761,21 +8783,17 @@ static void *i802_init(struct hostapd_da +@@ -8763,21 +8785,17 @@ static void *i802_init(struct hostapd_da (params->num_bridge == 0 || !params->bridge[0])) add_ifidx(drv, br_ifindex, drv->ifindex); @@ -378,7 +378,7 @@ as adding/removing interfaces. } if (drv->capa.flags2 & WPA_DRIVER_FLAGS2_CONTROL_PORT_RX) { -@@ -9144,6 +9162,50 @@ static int wpa_driver_nl80211_if_remove( +@@ -9146,6 +9164,50 @@ static int wpa_driver_nl80211_if_remove( return 0; } @@ -429,7 +429,7 @@ as adding/removing interfaces. static int cookie_handler(struct nl_msg *msg, void *arg) { -@@ -10960,6 +11022,37 @@ static bool nl80211_is_drv_shared(void * +@@ -10962,6 +11024,37 @@ static bool nl80211_is_drv_shared(void * #endif /* CONFIG_IEEE80211BE */ @@ -467,7 +467,7 @@ as adding/removing interfaces. static int driver_nl80211_send_mlme(void *priv, const u8 *data, size_t data_len, int noack, unsigned int freq, -@@ -14210,6 +14303,8 @@ const struct wpa_driver_ops wpa_driver_n +@@ -14510,6 +14603,8 @@ const struct wpa_driver_ops wpa_driver_n .set_acl = wpa_driver_nl80211_set_acl, .if_add = wpa_driver_nl80211_if_add, .if_remove = driver_nl80211_if_remove, @@ -596,7 +596,7 @@ as adding/removing interfaces. CFLAGS += -DEAP_SERVER -DEAP_SERVER_IDENTITY --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c -@@ -6135,6 +6135,7 @@ void supplicant_event(void *ctx, enum wp +@@ -6167,6 +6167,7 @@ void supplicant_event(void *ctx, enum wp event_to_string(event), event); #endif /* CONFIG_NO_STDOUT_DEBUG */ 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 index 012efa4286be6f..f0e838bf2f3acc 100644 --- a/package/network/services/hostapd/patches/720-iface_max_num_sta.patch +++ b/package/network/services/hostapd/patches/720-iface_max_num_sta.patch @@ -79,7 +79,7 @@ full device, e.g. in order to deal with hardware/driver limitations { --- a/src/ap/hostapd.h +++ b/src/ap/hostapd.h -@@ -815,6 +815,7 @@ void hostapd_cleanup_cs_params(struct ho +@@ -825,6 +825,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); diff --git a/package/network/services/hostapd/patches/740-snoop_iface.patch b/package/network/services/hostapd/patches/740-snoop_iface.patch index 3aea451c62fac4..3c59865f8472c7 100644 --- a/package/network/services/hostapd/patches/740-snoop_iface.patch +++ b/package/network/services/hostapd/patches/740-snoop_iface.patch @@ -29,7 +29,7 @@ untagged DHCP packets int bridge_hairpin; /* hairpin_mode on bridge members */ --- a/src/ap/ap_drv_ops.h +++ b/src/ap/ap_drv_ops.h -@@ -371,12 +371,12 @@ static inline int hostapd_drv_br_port_se +@@ -376,12 +376,12 @@ static inline int hostapd_drv_br_port_se static inline int hostapd_drv_br_set_net_param(struct hostapd_data *hapd, enum drv_br_net_param param, @@ -112,7 +112,7 @@ untagged DHCP packets hapd->x_snoop_initialized = false; --- a/src/drivers/driver.h +++ b/src/drivers/driver.h -@@ -4344,7 +4344,7 @@ struct wpa_driver_ops { +@@ -4350,7 +4350,7 @@ struct wpa_driver_ops { * Returns: 0 on success, negative (<0) on failure */ int (*br_set_net_param)(void *priv, enum drv_br_net_param param, @@ -123,7 +123,7 @@ untagged DHCP packets * get_wowlan - Get wake-on-wireless status --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -12660,7 +12660,7 @@ static const char * drv_br_net_param_str +@@ -12662,7 +12662,7 @@ static const char * drv_br_net_param_str static int wpa_driver_br_set_net_param(void *priv, enum drv_br_net_param param, @@ -132,7 +132,7 @@ untagged DHCP packets { struct i802_bss *bss = priv; char path[128]; -@@ -12686,8 +12686,11 @@ static int wpa_driver_br_set_net_param(v +@@ -12688,8 +12688,11 @@ static int wpa_driver_br_set_net_param(v return -EINVAL; } diff --git a/package/network/services/hostapd/patches/770-radius_server.patch b/package/network/services/hostapd/patches/770-radius_server.patch index 2068caacdcb946..c110a85e2e73f1 100644 --- a/package/network/services/hostapd/patches/770-radius_server.patch +++ b/package/network/services/hostapd/patches/770-radius_server.patch @@ -29,7 +29,7 @@ handle reload. #ifndef CONFIG_NO_HOSTAPD_LOGGER static void hostapd_logger_cb(void *ctx, const u8 *addr, unsigned int module, -@@ -792,6 +793,11 @@ int main(int argc, char *argv[]) +@@ -793,6 +794,11 @@ int main(int argc, char *argv[]) if (os_program_init()) return -1; diff --git a/package/network/services/hostapd/patches/780-Implement-APuP-Access-Point-Micro-Peering.patch b/package/network/services/hostapd/patches/780-Implement-APuP-Access-Point-Micro-Peering.patch index f2727a6feee25c..22bd7ad2634888 100644 --- a/package/network/services/hostapd/patches/780-Implement-APuP-Access-Point-Micro-Peering.patch +++ b/package/network/services/hostapd/patches/780-Implement-APuP-Access-Point-Micro-Peering.patch @@ -1,4 +1,4 @@ -From 40041ecea334c0106c0e840a32aef92b0cbb004b Mon Sep 17 00:00:00 2001 +From 806c84ac8e8f60eaec22772b627f85eb5ac13544 Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Mon, 6 May 2024 13:53:48 +0200 Subject: [PATCH 1/3] Implement APuP Access Point Micro Peering @@ -18,11 +18,14 @@ automatically if wds_bridge is not an empty string), or feeded to a routing daemon. Signed-off-by: Gioacchino Mazzurco +Reviewed-by: Hauke Mehrtens +Reviewed-by: Moritz Warning +Hotfix-by: Sebastian Gottschall https://github.com/mirror/dd-wrt/commit/0c3001a69e8d8300569e416de856c96e903ad130 --- hostapd/Makefile | 5 ++ hostapd/config_file.c | 9 +++ src/ap/ap_config.h | 29 +++++++ - src/ap/ap_drv_ops.c | 26 ++++++ + src/ap/ap_drv_ops.c | 28 ++++++- src/ap/ap_drv_ops.h | 3 + src/ap/apup.c | 152 +++++++++++++++++++++++++++++++++++ src/ap/apup.h | 24 ++++++ @@ -30,7 +33,7 @@ Signed-off-by: Gioacchino Mazzurco src/ap/ieee802_11.h | 2 + src/drivers/driver.h | 2 +- src/drivers/driver_nl80211.c | 14 +--- - 11 files changed, 264 insertions(+), 16 deletions(-) + 11 files changed, 265 insertions(+), 17 deletions(-) create mode 100644 src/ap/apup.c create mode 100644 src/ap/apup.h @@ -106,7 +109,7 @@ Signed-off-by: Gioacchino Mazzurco /** --- a/src/ap/ap_drv_ops.c +++ b/src/ap/ap_drv_ops.c -@@ -385,9 +385,35 @@ int hostapd_set_wds_sta(struct hostapd_d +@@ -385,13 +385,39 @@ int hostapd_set_wds_sta(struct hostapd_d const u8 *addr, int aid, int val) { const char *bridge = NULL; @@ -142,6 +145,11 @@ Signed-off-by: Gioacchino Mazzurco if (hapd->conf->wds_bridge[0]) bridge = hapd->conf->wds_bridge; return hapd->driver->set_wds_sta(hapd->drv_priv, addr, aid, val, +- bridge, ifname_wds); ++ bridge, ifName); + } + + --- a/src/ap/ap_drv_ops.h +++ b/src/ap/ap_drv_ops.h @@ -35,6 +35,9 @@ int hostapd_set_drv_ieee8021x(struct hos @@ -338,7 +346,7 @@ Signed-off-by: Gioacchino Mazzurco + const struct ieee802_11_elems *elems ); --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c -@@ -59,6 +59,9 @@ +@@ -60,6 +60,9 @@ #include "nan_usd_ap.h" #include "pasn/pasn_common.h" @@ -348,7 +356,7 @@ Signed-off-by: Gioacchino Mazzurco #ifdef CONFIG_FILS static struct wpabuf * -@@ -3586,8 +3589,8 @@ static u16 check_multi_ap(struct hostapd +@@ -3588,8 +3591,8 @@ static u16 check_multi_ap(struct hostapd } @@ -359,7 +367,7 @@ Signed-off-by: Gioacchino Mazzurco { /* Supported rates not used in IEEE 802.11ad/DMG */ if (hapd->iface->current_mode && -@@ -3974,7 +3977,7 @@ static int __check_assoc_ies(struct host +@@ -3976,7 +3979,7 @@ static int __check_assoc_ies(struct host elems->ext_capab_len); if (resp != WLAN_STATUS_SUCCESS) return resp; @@ -368,7 +376,7 @@ Signed-off-by: Gioacchino Mazzurco if (resp != WLAN_STATUS_SUCCESS) return resp; -@@ -6029,6 +6032,11 @@ static void handle_beacon(struct hostapd +@@ -6031,6 +6034,11 @@ static void handle_beacon(struct hostapd 0); ap_list_process_beacon(hapd->iface, mgmt, &elems, fi); @@ -393,7 +401,7 @@ Signed-off-by: Gioacchino Mazzurco u16 copy_sta_vendor_vht(struct hostapd_data *hapd, struct sta_info *sta, --- a/src/drivers/driver.h +++ b/src/drivers/driver.h -@@ -4042,7 +4042,7 @@ struct wpa_driver_ops { +@@ -4048,7 +4048,7 @@ struct wpa_driver_ops { * Returns: 0 on success, -1 on failure */ int (*set_wds_sta)(void *priv, const u8 *addr, int aid, int val, @@ -404,7 +412,7 @@ Signed-off-by: Gioacchino Mazzurco * send_action - Transmit an Action frame --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -8557,25 +8557,15 @@ static int have_ifidx(struct wpa_driver_ +@@ -8559,25 +8559,15 @@ static int have_ifidx(struct wpa_driver_ static int i802_set_wds_sta(void *priv, const u8 *addr, int aid, int val, diff --git a/package/network/services/hostapd/patches/802-SAE-Reject-invalid-Rejected-Groups-element-in-the-pa.patch b/package/network/services/hostapd/patches/802-SAE-Reject-invalid-Rejected-Groups-element-in-the-pa.patch deleted file mode 100644 index 268f288827cf1b..00000000000000 --- a/package/network/services/hostapd/patches/802-SAE-Reject-invalid-Rejected-Groups-element-in-the-pa.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 9716bf1160beb677e965d9e6475d6c9e162e8374 Mon Sep 17 00:00:00 2001 -From: Jouni Malinen -Date: Tue, 9 Jul 2024 23:34:34 +0300 -Subject: [PATCH] SAE: Reject invalid Rejected Groups element in the parser - -There is no need to depend on all uses (i.e., both hostapd and -wpa_supplicant) to verify that the length of the Rejected Groups field -in the Rejected Groups element is valid (i.e., a multiple of two octets) -since the common parser can reject the message when detecting this. - -Signed-off-by: Jouni Malinen ---- - src/common/sae.c | 6 ++++++ - 1 file changed, 6 insertions(+) - ---- a/src/common/sae.c -+++ b/src/common/sae.c -@@ -2160,6 +2160,12 @@ static int sae_parse_akm_suite_selector( - return WLAN_STATUS_UNSPECIFIED_FAILURE; - epos++; /* skip ext ID */ - len--; -+ if (len & 1) { -+ wpa_printf(MSG_DEBUG, -+ "SAE: Invalid length of the Rejected Groups element payload: %u", -+ len); -+ return WLAN_STATUS_UNSPECIFIED_FAILURE; -+ } - - if (len < RSN_SELECTOR_LEN) - return WLAN_STATUS_UNSPECIFIED_FAILURE; diff --git a/package/network/services/hostapd/patches/803-hostapd-fix-80211be-build.patch b/package/network/services/hostapd/patches/803-hostapd-fix-80211be-build.patch deleted file mode 100644 index 55c6e635813c9d..00000000000000 --- a/package/network/services/hostapd/patches/803-hostapd-fix-80211be-build.patch +++ /dev/null @@ -1,53 +0,0 @@ ---- a/src/ap/sta_info.c -+++ b/src/ap/sta_info.c -@@ -1836,3 +1836,22 @@ void ap_sta_free_sta_profile(struct mld_ - } - } - #endif /* CONFIG_IEEE80211BE */ -+ -+bool ap_sta_is_mld(struct hostapd_data *hapd, -+ struct sta_info *sta) -+{ -+#ifdef CONFIG_IEEE80211BE -+ return hapd->conf->mld_ap && sta && sta->mld_info.mld_sta; -+#else /* CONFIG_IEEE80211BE */ -+ return false; -+#endif /* CONFIG_IEEE80211BE */ -+} -+ -+void ap_sta_set_mld(struct sta_info *sta, bool mld) -+{ -+#ifdef CONFIG_IEEE80211BE -+ if (sta) -+ sta->mld_info.mld_sta = mld; -+#endif /* CONFIG_IEEE80211BE */ -+} -+ ---- a/src/ap/sta_info.h -+++ b/src/ap/sta_info.h -@@ -417,23 +417,8 @@ int ap_sta_re_add(struct hostapd_data *h - - void ap_free_sta_pasn(struct hostapd_data *hapd, struct sta_info *sta); - --static inline bool ap_sta_is_mld(struct hostapd_data *hapd, -- struct sta_info *sta) --{ --#ifdef CONFIG_IEEE80211BE -- return hapd->conf->mld_ap && sta && sta->mld_info.mld_sta; --#else /* CONFIG_IEEE80211BE */ -- return false; --#endif /* CONFIG_IEEE80211BE */ --} -- --static inline void ap_sta_set_mld(struct sta_info *sta, bool mld) --{ --#ifdef CONFIG_IEEE80211BE -- if (sta) -- sta->mld_info.mld_sta = mld; --#endif /* CONFIG_IEEE80211BE */ --} -+bool ap_sta_is_mld(struct hostapd_data *hapd, struct sta_info *sta); -+void ap_sta_set_mld(struct sta_info *sta, bool mld); - - void ap_sta_free_sta_profile(struct mld_info *info); - diff --git a/package/network/services/hostapd/src/src/ap/ubus.h b/package/network/services/hostapd/src/src/ap/ubus.h index 22767d67ee7564..5b8938cbd32d7d 100644 --- a/package/network/services/hostapd/src/src/ap/ubus.h +++ b/package/network/services/hostapd/src/src/ap/ubus.h @@ -8,8 +8,6 @@ #ifndef __HOSTAPD_UBUS_H #define __HOSTAPD_UBUS_H -#include "sta_info.h" - enum hostapd_ubus_event_type { HOSTAPD_UBUS_PROBE_REQ, HOSTAPD_UBUS_AUTH_REQ, diff --git a/package/network/services/hostapd/src/src/ap/ucode.c b/package/network/services/hostapd/src/src/ap/ucode.c index 68fb450884e2f3..c54f071ee0f5ea 100644 --- a/package/network/services/hostapd/src/src/ap/ucode.c +++ b/package/network/services/hostapd/src/src/ap/ucode.c @@ -3,7 +3,7 @@ #include "utils/includes.h" #include "utils/common.h" #include "utils/ucode.h" -#include "hostapd.h" +#include "sta_info.h" #include "beacon.h" #include "hw_features.h" #include "ap_drv_ops.h" diff --git a/package/network/services/hostapd/src/src/utils/ap/ubus.c b/package/network/services/hostapd/src/src/utils/ap/ubus.c deleted file mode 100644 index 8689494bcff3e5..00000000000000 --- a/package/network/services/hostapd/src/src/utils/ap/ubus.c +++ /dev/null @@ -1,2006 +0,0 @@ -/* - * hostapd / ubus support - * Copyright (c) 2013, Felix Fietkau - * - * This software may be distributed under the terms of the BSD license. - * See README for more details. - */ - -#include "utils/includes.h" -#include "utils/common.h" -#include "utils/eloop.h" -#include "utils/wpabuf.h" -#include "common/ieee802_11_defs.h" -#include "common/hw_features_common.h" -#include "hostapd.h" -#include "neighbor_db.h" -#include "wps_hostapd.h" -#include "sta_info.h" -#include "ubus.h" -#include "ap_drv_ops.h" -#include "beacon.h" -#include "rrm.h" -#include "wnm_ap.h" -#include "taxonomy.h" -#include "airtime_policy.h" -#include "hw_features.h" - -static struct ubus_context *ctx; -static struct blob_buf b; -static int ctx_ref; - -static inline struct hostapd_data *get_hapd_from_object(struct ubus_object *obj) -{ - return container_of(obj, struct hostapd_data, ubus.obj); -} - -struct ubus_banned_client { - struct avl_node avl; - u8 addr[ETH_ALEN]; -}; - -static void ubus_reconnect_timeout(void *eloop_data, void *user_ctx) -{ - if (ubus_reconnect(ctx, NULL)) { - eloop_register_timeout(1, 0, ubus_reconnect_timeout, ctx, NULL); - return; - } - - ubus_add_uloop(ctx); -} - -static void hostapd_ubus_connection_lost(struct ubus_context *ctx) -{ - uloop_fd_delete(&ctx->sock); - eloop_register_timeout(1, 0, ubus_reconnect_timeout, ctx, NULL); -} - -static bool hostapd_ubus_init(void) -{ - if (ctx) - return true; - - eloop_add_uloop(); - ctx = ubus_connect(NULL); - if (!ctx) - return false; - - ctx->connection_lost = hostapd_ubus_connection_lost; - ubus_add_uloop(ctx); - - return true; -} - -static void hostapd_ubus_ref_inc(void) -{ - ctx_ref++; -} - -static void hostapd_ubus_ref_dec(void) -{ - ctx_ref--; - if (!ctx) - return; - - if (ctx_ref) - return; - - uloop_fd_delete(&ctx->sock); - ubus_free(ctx); - ctx = NULL; -} - -void hostapd_ubus_add_iface(struct hostapd_iface *iface) -{ - if (!hostapd_ubus_init()) - return; -} - -void hostapd_ubus_free_iface(struct hostapd_iface *iface) -{ - if (!ctx) - return; -} - -static void hostapd_notify_ubus(struct ubus_object *obj, char *bssname, char *event) -{ - char *event_type; - - if (!ctx || !obj) - return; - - if (asprintf(&event_type, "bss.%s", event) < 0) - return; - - blob_buf_init(&b, 0); - blobmsg_add_string(&b, "name", bssname); - ubus_notify(ctx, obj, event_type, b.head, -1); - free(event_type); -} - -static void -hostapd_bss_del_ban(void *eloop_data, void *user_ctx) -{ - struct ubus_banned_client *ban = eloop_data; - struct hostapd_data *hapd = user_ctx; - - avl_delete(&hapd->ubus.banned, &ban->avl); - free(ban); -} - -static void -hostapd_bss_ban_client(struct hostapd_data *hapd, u8 *addr, int time) -{ - struct ubus_banned_client *ban; - - if (time < 0) - time = 0; - - ban = avl_find_element(&hapd->ubus.banned, addr, ban, avl); - if (!ban) { - if (!time) - return; - - ban = os_zalloc(sizeof(*ban)); - memcpy(ban->addr, addr, sizeof(ban->addr)); - ban->avl.key = ban->addr; - avl_insert(&hapd->ubus.banned, &ban->avl); - } else { - eloop_cancel_timeout(hostapd_bss_del_ban, ban, hapd); - if (!time) { - hostapd_bss_del_ban(ban, hapd); - return; - } - } - - eloop_register_timeout(0, time * 1000, hostapd_bss_del_ban, ban, hapd); -} - -static int -hostapd_bss_reload(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); - - return hostapd_reload_config(hapd->iface); -} - - -static void -hostapd_parse_vht_map_blobmsg(uint16_t map) -{ - char label[4]; - int16_t val; - int i; - - for (i = 0; i < 8; i++) { - snprintf(label, 4, "%dss", i + 1); - - val = (map & (BIT(1) | BIT(0))) + 7; - blobmsg_add_u16(&b, label, val == 10 ? -1 : val); - map = map >> 2; - } -} - -static void -hostapd_parse_vht_capab_blobmsg(struct ieee80211_vht_capabilities *vhtc) -{ - void *supported_mcs; - void *map; - int i; - - static const struct { - const char *name; - uint32_t flag; - } vht_capas[] = { - { "su_beamformee", VHT_CAP_SU_BEAMFORMEE_CAPABLE }, - { "mu_beamformee", VHT_CAP_MU_BEAMFORMEE_CAPABLE }, - }; - - for (i = 0; i < ARRAY_SIZE(vht_capas); i++) - blobmsg_add_u8(&b, vht_capas[i].name, - !!(vhtc->vht_capabilities_info & vht_capas[i].flag)); - - supported_mcs = blobmsg_open_table(&b, "mcs_map"); - - /* RX map */ - map = blobmsg_open_table(&b, "rx"); - hostapd_parse_vht_map_blobmsg(le_to_host16(vhtc->vht_supported_mcs_set.rx_map)); - blobmsg_close_table(&b, map); - - /* TX map */ - map = blobmsg_open_table(&b, "tx"); - hostapd_parse_vht_map_blobmsg(le_to_host16(vhtc->vht_supported_mcs_set.tx_map)); - blobmsg_close_table(&b, map); - - blobmsg_close_table(&b, supported_mcs); -} - -static void -hostapd_parse_capab_blobmsg(struct sta_info *sta) -{ - void *r, *v; - - v = blobmsg_open_table(&b, "capabilities"); - - if (sta->vht_capabilities) { - r = blobmsg_open_table(&b, "vht"); - hostapd_parse_vht_capab_blobmsg(sta->vht_capabilities); - blobmsg_close_table(&b, r); - } - - /* ToDo: Add HT / HE capability parsing */ - - blobmsg_close_table(&b, v); -} - -static int -hostapd_bss_get_clients(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 hostap_sta_driver_data sta_driver_data; - struct sta_info *sta; - void *list, *c; - char mac_buf[20]; - static const struct { - const char *name; - uint32_t flag; - } sta_flags[] = { - { "auth", WLAN_STA_AUTH }, - { "assoc", WLAN_STA_ASSOC }, - { "authorized", WLAN_STA_AUTHORIZED }, - { "preauth", WLAN_STA_PREAUTH }, - { "wds", WLAN_STA_WDS }, - { "wmm", WLAN_STA_WMM }, - { "ht", WLAN_STA_HT }, - { "vht", WLAN_STA_VHT }, - { "he", WLAN_STA_HE }, - { "wps", WLAN_STA_WPS }, - { "mfp", WLAN_STA_MFP }, - }; - - blob_buf_init(&b, 0); - blobmsg_add_u32(&b, "freq", hapd->iface->freq); - list = blobmsg_open_table(&b, "clients"); - for (sta = hapd->sta_list; sta; sta = sta->next) { - void *r; - int i; - - sprintf(mac_buf, MACSTR, MAC2STR(sta->addr)); - c = blobmsg_open_table(&b, mac_buf); - for (i = 0; i < ARRAY_SIZE(sta_flags); i++) - blobmsg_add_u8(&b, sta_flags[i].name, - !!(sta->flags & sta_flags[i].flag)); - -#ifdef CONFIG_MBO - blobmsg_add_u8(&b, "mbo", !!(sta->cell_capa)); -#endif - - r = blobmsg_open_array(&b, "rrm"); - for (i = 0; i < ARRAY_SIZE(sta->rrm_enabled_capa); i++) - blobmsg_add_u32(&b, "", sta->rrm_enabled_capa[i]); - blobmsg_close_array(&b, r); - - r = blobmsg_open_array(&b, "extended_capabilities"); - /* Check if client advertises extended capabilities */ - if (sta->ext_capability && sta->ext_capability[0] > 0) { - for (i = 0; i < sta->ext_capability[0]; i++) { - blobmsg_add_u32(&b, "", sta->ext_capability[1 + i]); - } - } - blobmsg_close_array(&b, r); - - blobmsg_add_u32(&b, "aid", sta->aid); -#ifdef CONFIG_TAXONOMY - r = blobmsg_alloc_string_buffer(&b, "signature", 1024); - if (retrieve_sta_taxonomy(hapd, sta, r, 1024) > 0) - blobmsg_add_string_buffer(&b); -#endif - - /* Driver information */ - if (hostapd_drv_read_sta_data(hapd, &sta_driver_data, sta->addr) >= 0) { - r = blobmsg_open_table(&b, "bytes"); - blobmsg_add_u64(&b, "rx", sta_driver_data.rx_bytes); - blobmsg_add_u64(&b, "tx", sta_driver_data.tx_bytes); - blobmsg_close_table(&b, r); - r = blobmsg_open_table(&b, "airtime"); - blobmsg_add_u64(&b, "rx", sta_driver_data.rx_airtime); - blobmsg_add_u64(&b, "tx", sta_driver_data.tx_airtime); - blobmsg_close_table(&b, r); - r = blobmsg_open_table(&b, "packets"); - blobmsg_add_u32(&b, "rx", sta_driver_data.rx_packets); - blobmsg_add_u32(&b, "tx", sta_driver_data.tx_packets); - blobmsg_close_table(&b, r); - r = blobmsg_open_table(&b, "rate"); - /* Rate in kbits */ - blobmsg_add_u32(&b, "rx", sta_driver_data.current_rx_rate * 100); - blobmsg_add_u32(&b, "tx", sta_driver_data.current_tx_rate * 100); - blobmsg_close_table(&b, r); - blobmsg_add_u32(&b, "signal", sta_driver_data.signal); - } - - hostapd_parse_capab_blobmsg(sta); - - blobmsg_close_table(&b, c); - } - blobmsg_close_array(&b, list); - ubus_send_reply(ctx, req, b.head); - - return 0; -} - -static int -hostapd_bss_get_features(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); - - blob_buf_init(&b, 0); - blobmsg_add_u8(&b, "ht_supported", ht_supported(hapd->iface->hw_features)); - blobmsg_add_u8(&b, "vht_supported", vht_supported(hapd->iface->hw_features)); - ubus_send_reply(ctx, req, b.head); - - return 0; -} - -static int -hostapd_bss_get_status(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 *airtime_table, *dfs_table, *rrm_table, *wnm_table; - struct os_reltime now; - char ssid[SSID_MAX_LEN + 1]; - char phy_name[17]; - size_t ssid_len = SSID_MAX_LEN; - u8 channel = 0, op_class = 0; - - if (hapd->conf->ssid.ssid_len < SSID_MAX_LEN) - ssid_len = hapd->conf->ssid.ssid_len; - - ieee80211_freq_to_channel_ext(hapd->iface->freq, - hapd->iconf->secondary_channel, - hostapd_get_oper_chwidth(hapd->iconf), - &op_class, &channel); - - blob_buf_init(&b, 0); - blobmsg_add_string(&b, "status", hostapd_state_text(hapd->iface->state)); - blobmsg_printf(&b, "bssid", MACSTR, MAC2STR(hapd->conf->bssid)); - - memset(ssid, 0, SSID_MAX_LEN + 1); - memcpy(ssid, hapd->conf->ssid.ssid, ssid_len); - blobmsg_add_string(&b, "ssid", ssid); - - blobmsg_add_u32(&b, "freq", hapd->iface->freq); - blobmsg_add_u32(&b, "channel", channel); - blobmsg_add_u32(&b, "op_class", op_class); - blobmsg_add_u32(&b, "beacon_interval", hapd->iconf->beacon_int); -#ifdef CONFIG_IEEE80211AX - blobmsg_add_u32(&b, "bss_color", hapd->iface->conf->he_op.he_bss_color_disabled ? -1 : - hapd->iface->conf->he_op.he_bss_color); -#else - blobmsg_add_u32(&b, "bss_color", -1); -#endif - - snprintf(phy_name, 17, "%s", hapd->iface->phy); - blobmsg_add_string(&b, "phy", phy_name); - - /* RRM */ - rrm_table = blobmsg_open_table(&b, "rrm"); - blobmsg_add_u64(&b, "neighbor_report_tx", hapd->openwrt_stats.rrm.neighbor_report_tx); - blobmsg_close_table(&b, rrm_table); - - /* WNM */ - wnm_table = blobmsg_open_table(&b, "wnm"); - blobmsg_add_u64(&b, "bss_transition_query_rx", hapd->openwrt_stats.wnm.bss_transition_query_rx); - blobmsg_add_u64(&b, "bss_transition_request_tx", hapd->openwrt_stats.wnm.bss_transition_request_tx); - blobmsg_add_u64(&b, "bss_transition_response_rx", hapd->openwrt_stats.wnm.bss_transition_response_rx); - blobmsg_close_table(&b, wnm_table); - - /* Airtime */ - airtime_table = blobmsg_open_table(&b, "airtime"); - blobmsg_add_u64(&b, "time", hapd->iface->last_channel_time); - blobmsg_add_u64(&b, "time_busy", hapd->iface->last_channel_time_busy); - blobmsg_add_u16(&b, "utilization", hapd->iface->channel_utilization); - blobmsg_close_table(&b, airtime_table); - - /* DFS */ - dfs_table = blobmsg_open_table(&b, "dfs"); - blobmsg_add_u32(&b, "cac_seconds", hapd->iface->dfs_cac_ms / 1000); - blobmsg_add_u8(&b, "cac_active", !!(hapd->iface->cac_started)); - os_reltime_age(&hapd->iface->dfs_cac_start, &now); - blobmsg_add_u32(&b, "cac_seconds_left", - hapd->iface->cac_started ? hapd->iface->dfs_cac_ms / 1000 - now.sec : 0); - blobmsg_close_table(&b, dfs_table); - - ubus_send_reply(ctx, req, b.head); - - return 0; -} - -enum { - NOTIFY_RESPONSE, - __NOTIFY_MAX -}; - -static const struct blobmsg_policy notify_policy[__NOTIFY_MAX] = { - [NOTIFY_RESPONSE] = { "notify_response", BLOBMSG_TYPE_INT32 }, -}; - -static int -hostapd_notify_response(struct ubus_context *ctx, struct ubus_object *obj, - struct ubus_request_data *req, const char *method, - struct blob_attr *msg) -{ - struct blob_attr *tb[__NOTIFY_MAX]; - struct hostapd_data *hapd = get_hapd_from_object(obj); - struct wpabuf *elems; - const char *pos; - size_t len; - - blobmsg_parse(notify_policy, __NOTIFY_MAX, tb, - blob_data(msg), blob_len(msg)); - - if (!tb[NOTIFY_RESPONSE]) - return UBUS_STATUS_INVALID_ARGUMENT; - - hapd->ubus.notify_response = blobmsg_get_u32(tb[NOTIFY_RESPONSE]); - - return UBUS_STATUS_OK; -} - -enum { - DEL_CLIENT_ADDR, - DEL_CLIENT_REASON, - DEL_CLIENT_DEAUTH, - DEL_CLIENT_BAN_TIME, - __DEL_CLIENT_MAX -}; - -static const struct blobmsg_policy del_policy[__DEL_CLIENT_MAX] = { - [DEL_CLIENT_ADDR] = { "addr", BLOBMSG_TYPE_STRING }, - [DEL_CLIENT_REASON] = { "reason", BLOBMSG_TYPE_INT32 }, - [DEL_CLIENT_DEAUTH] = { "deauth", BLOBMSG_TYPE_INT8 }, - [DEL_CLIENT_BAN_TIME] = { "ban_time", BLOBMSG_TYPE_INT32 }, -}; - -static int -hostapd_bss_del_client(struct ubus_context *ctx, struct ubus_object *obj, - struct ubus_request_data *req, const char *method, - struct blob_attr *msg) -{ - struct blob_attr *tb[__DEL_CLIENT_MAX]; - struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj); - struct sta_info *sta; - bool deauth = false; - int reason; - u8 addr[ETH_ALEN]; - - blobmsg_parse(del_policy, __DEL_CLIENT_MAX, tb, blob_data(msg), blob_len(msg)); - - if (!tb[DEL_CLIENT_ADDR]) - return UBUS_STATUS_INVALID_ARGUMENT; - - if (hwaddr_aton(blobmsg_data(tb[DEL_CLIENT_ADDR]), addr)) - return UBUS_STATUS_INVALID_ARGUMENT; - - if (tb[DEL_CLIENT_REASON]) - reason = blobmsg_get_u32(tb[DEL_CLIENT_REASON]); - - if (tb[DEL_CLIENT_DEAUTH]) - deauth = blobmsg_get_bool(tb[DEL_CLIENT_DEAUTH]); - - sta = ap_get_sta(hapd, addr); - if (sta) { - if (deauth) { - hostapd_drv_sta_deauth(hapd, addr, reason); - ap_sta_deauthenticate(hapd, sta, reason); - } else { - hostapd_drv_sta_disassoc(hapd, addr, reason); - ap_sta_disassociate(hapd, sta, reason); - } - } - - if (tb[DEL_CLIENT_BAN_TIME]) - hostapd_bss_ban_client(hapd, addr, blobmsg_get_u32(tb[DEL_CLIENT_BAN_TIME])); - - return 0; -} - -static void -blobmsg_add_macaddr(struct blob_buf *buf, const char *name, const u8 *addr) -{ - char *s; - - s = blobmsg_alloc_string_buffer(buf, name, 20); - sprintf(s, MACSTR, MAC2STR(addr)); - blobmsg_add_string_buffer(buf); -} - -static int -hostapd_bss_list_bans(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 ubus_banned_client *ban; - void *c; - - blob_buf_init(&b, 0); - c = blobmsg_open_array(&b, "clients"); - avl_for_each_element(&hapd->ubus.banned, ban, avl) - blobmsg_add_macaddr(&b, NULL, ban->addr); - blobmsg_close_array(&b, c); - ubus_send_reply(ctx, req, b.head); - - return 0; -} - -#ifdef CONFIG_WPS -static int -hostapd_bss_wps_start(struct ubus_context *ctx, struct ubus_object *obj, - struct ubus_request_data *req, const char *method, - struct blob_attr *msg) -{ - int rc; - struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj); - - rc = hostapd_wps_button_pushed(hapd, NULL); - - if (rc != 0) - return UBUS_STATUS_NOT_SUPPORTED; - - return 0; -} - - -static const char * pbc_status_enum_str(enum pbc_status status) -{ - switch (status) { - case WPS_PBC_STATUS_DISABLE: - return "Disabled"; - case WPS_PBC_STATUS_ACTIVE: - return "Active"; - case WPS_PBC_STATUS_TIMEOUT: - return "Timed-out"; - case WPS_PBC_STATUS_OVERLAP: - return "Overlap"; - default: - return "Unknown"; - } -} - -static int -hostapd_bss_wps_status(struct ubus_context *ctx, struct ubus_object *obj, - struct ubus_request_data *req, const char *method, - struct blob_attr *msg) -{ - int rc; - struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj); - - blob_buf_init(&b, 0); - - blobmsg_add_string(&b, "pbc_status", pbc_status_enum_str(hapd->wps_stats.pbc_status)); - blobmsg_add_string(&b, "last_wps_result", - (hapd->wps_stats.status == WPS_STATUS_SUCCESS ? - "Success": - (hapd->wps_stats.status == WPS_STATUS_FAILURE ? - "Failed" : "None"))); - - /* If status == Failure - Add possible Reasons */ - if(hapd->wps_stats.status == WPS_STATUS_FAILURE && - hapd->wps_stats.failure_reason > 0) - blobmsg_add_string(&b, "reason", wps_ei_str(hapd->wps_stats.failure_reason)); - - if (hapd->wps_stats.status) - blobmsg_printf(&b, "peer_address", MACSTR, MAC2STR(hapd->wps_stats.peer_addr)); - - ubus_send_reply(ctx, req, b.head); - - return 0; -} - -static int -hostapd_bss_wps_cancel(struct ubus_context *ctx, struct ubus_object *obj, - struct ubus_request_data *req, const char *method, - struct blob_attr *msg) -{ - int rc; - struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj); - - rc = hostapd_wps_cancel(hapd); - - if (rc != 0) - return UBUS_STATUS_NOT_SUPPORTED; - - return 0; -} -#endif /* CONFIG_WPS */ - -static int -hostapd_bss_update_beacon(struct ubus_context *ctx, struct ubus_object *obj, - struct ubus_request_data *req, const char *method, - struct blob_attr *msg) -{ - int rc; - struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj); - - rc = ieee802_11_set_beacon(hapd); - - if (rc != 0) - return UBUS_STATUS_NOT_SUPPORTED; - - return 0; -} - -enum { - CONFIG_IFACE, - CONFIG_FILE, - __CONFIG_MAX -}; - -enum { - CSA_FREQ, - CSA_BCN_COUNT, - CSA_CENTER_FREQ1, - CSA_CENTER_FREQ2, - CSA_BANDWIDTH, - CSA_SEC_CHANNEL_OFFSET, - CSA_HT, - CSA_VHT, - CSA_HE, - CSA_BLOCK_TX, - CSA_FORCE, - __CSA_MAX -}; - -static const struct blobmsg_policy csa_policy[__CSA_MAX] = { - [CSA_FREQ] = { "freq", BLOBMSG_TYPE_INT32 }, - [CSA_BCN_COUNT] = { "bcn_count", BLOBMSG_TYPE_INT32 }, - [CSA_CENTER_FREQ1] = { "center_freq1", BLOBMSG_TYPE_INT32 }, - [CSA_CENTER_FREQ2] = { "center_freq2", BLOBMSG_TYPE_INT32 }, - [CSA_BANDWIDTH] = { "bandwidth", BLOBMSG_TYPE_INT32 }, - [CSA_SEC_CHANNEL_OFFSET] = { "sec_channel_offset", BLOBMSG_TYPE_INT32 }, - [CSA_HT] = { "ht", BLOBMSG_TYPE_BOOL }, - [CSA_VHT] = { "vht", BLOBMSG_TYPE_BOOL }, - [CSA_HE] = { "he", BLOBMSG_TYPE_BOOL }, - [CSA_BLOCK_TX] = { "block_tx", BLOBMSG_TYPE_BOOL }, - [CSA_FORCE] = { "force", BLOBMSG_TYPE_BOOL }, -}; - - -static void switch_chan_fallback_cb(void *eloop_data, void *user_ctx) -{ - struct hostapd_iface *iface = eloop_data; - struct hostapd_freq_params *freq_params = user_ctx; - - hostapd_switch_channel_fallback(iface, freq_params); -} - -#ifdef NEED_AP_MLME -static int -hostapd_switch_chan(struct ubus_context *ctx, struct ubus_object *obj, - struct ubus_request_data *req, const char *method, - struct blob_attr *msg) -{ - struct blob_attr *tb[__CSA_MAX]; - struct hostapd_data *hapd = get_hapd_from_object(obj); - struct hostapd_config *iconf = hapd->iface->conf; - struct hostapd_freq_params *freq_params; - struct hostapd_hw_modes *mode = hapd->iface->current_mode; - struct csa_settings css = { - .freq_params = { - .ht_enabled = iconf->ieee80211n, - .vht_enabled = iconf->ieee80211ac, - .he_enabled = iconf->ieee80211ax, - .sec_channel_offset = iconf->secondary_channel, - } - }; - u8 chwidth = hostapd_get_oper_chwidth(iconf); - u8 seg0 = 0, seg1 = 0; - int ret = UBUS_STATUS_OK; - int i; - - blobmsg_parse(csa_policy, __CSA_MAX, tb, blob_data(msg), blob_len(msg)); - - if (!tb[CSA_FREQ]) - return UBUS_STATUS_INVALID_ARGUMENT; - - switch (iconf->vht_oper_chwidth) { - case CHANWIDTH_USE_HT: - if (iconf->secondary_channel) - css.freq_params.bandwidth = 40; - else - css.freq_params.bandwidth = 20; - break; - case CHANWIDTH_160MHZ: - css.freq_params.bandwidth = 160; - break; - default: - css.freq_params.bandwidth = 80; - break; - } - - css.freq_params.freq = blobmsg_get_u32(tb[CSA_FREQ]); - -#define SET_CSA_SETTING(name, field, type) \ - do { \ - if (tb[name]) \ - css.field = blobmsg_get_ ## type(tb[name]); \ - } while(0) - - SET_CSA_SETTING(CSA_BCN_COUNT, cs_count, u32); - SET_CSA_SETTING(CSA_CENTER_FREQ1, freq_params.center_freq1, u32); - SET_CSA_SETTING(CSA_CENTER_FREQ2, freq_params.center_freq2, u32); - SET_CSA_SETTING(CSA_BANDWIDTH, freq_params.bandwidth, u32); - SET_CSA_SETTING(CSA_SEC_CHANNEL_OFFSET, freq_params.sec_channel_offset, u32); - SET_CSA_SETTING(CSA_HT, freq_params.ht_enabled, bool); - SET_CSA_SETTING(CSA_VHT, freq_params.vht_enabled, bool); - SET_CSA_SETTING(CSA_HE, freq_params.he_enabled, bool); - SET_CSA_SETTING(CSA_BLOCK_TX, block_tx, bool); - - css.freq_params.channel = hostapd_hw_get_channel(hapd, css.freq_params.freq); - if (!css.freq_params.channel) - return UBUS_STATUS_NOT_SUPPORTED; - - switch (css.freq_params.bandwidth) { - case 160: - chwidth = CHANWIDTH_160MHZ; - break; - case 80: - chwidth = css.freq_params.center_freq2 ? CHANWIDTH_80P80MHZ : CHANWIDTH_80MHZ; - break; - default: - chwidth = CHANWIDTH_USE_HT; - break; - } - - hostapd_set_freq_params(&css.freq_params, iconf->hw_mode, - css.freq_params.freq, - css.freq_params.channel, iconf->enable_edmg, - iconf->edmg_channel, - css.freq_params.ht_enabled, - css.freq_params.vht_enabled, - css.freq_params.he_enabled, - css.freq_params.eht_enabled, - css.freq_params.sec_channel_offset, - chwidth, seg0, seg1, - iconf->vht_capab, - mode ? &mode->he_capab[IEEE80211_MODE_AP] : - NULL, - mode ? &mode->eht_capab[IEEE80211_MODE_AP] : - NULL, - hostapd_get_punct_bitmap(hapd)); - - for (i = 0; i < hapd->iface->num_bss; i++) { - struct hostapd_data *bss = hapd->iface->bss[i]; - - if (hostapd_switch_channel(bss, &css) != 0) - ret = UBUS_STATUS_NOT_SUPPORTED; - } - - if (!ret || !tb[CSA_FORCE] || !blobmsg_get_bool(tb[CSA_FORCE])) - return ret; - - freq_params = malloc(sizeof(*freq_params)); - memcpy(freq_params, &css.freq_params, sizeof(*freq_params)); - eloop_register_timeout(0, 1, switch_chan_fallback_cb, - hapd->iface, freq_params); - - return 0; -#undef SET_CSA_SETTING -} -#endif - -enum { - VENDOR_ELEMENTS, - __VENDOR_ELEMENTS_MAX -}; - -static const struct blobmsg_policy ve_policy[__VENDOR_ELEMENTS_MAX] = { - /* vendor elements are provided as hex-string */ - [VENDOR_ELEMENTS] = { "vendor_elements", BLOBMSG_TYPE_STRING }, -}; - -static int -hostapd_vendor_elements(struct ubus_context *ctx, struct ubus_object *obj, - struct ubus_request_data *req, const char *method, - struct blob_attr *msg) -{ - struct blob_attr *tb[__VENDOR_ELEMENTS_MAX]; - struct hostapd_data *hapd = get_hapd_from_object(obj); - struct hostapd_bss_config *bss = hapd->conf; - struct wpabuf *elems; - const char *pos; - size_t len; - - blobmsg_parse(ve_policy, __VENDOR_ELEMENTS_MAX, tb, - blob_data(msg), blob_len(msg)); - - if (!tb[VENDOR_ELEMENTS]) - return UBUS_STATUS_INVALID_ARGUMENT; - - pos = blobmsg_data(tb[VENDOR_ELEMENTS]); - len = os_strlen(pos); - if (len & 0x01) - return UBUS_STATUS_INVALID_ARGUMENT; - - len /= 2; - if (len == 0) { - wpabuf_free(bss->vendor_elements); - bss->vendor_elements = NULL; - return 0; - } - - elems = wpabuf_alloc(len); - if (elems == NULL) - return 1; - - if (hexstr2bin(pos, wpabuf_put(elems, len), len)) { - wpabuf_free(elems); - return UBUS_STATUS_INVALID_ARGUMENT; - } - - wpabuf_free(bss->vendor_elements); - bss->vendor_elements = elems; - - /* update beacons if vendor elements were set successfully */ - if (ieee802_11_update_beacons(hapd->iface) != 0) - return UBUS_STATUS_NOT_SUPPORTED; - return UBUS_STATUS_OK; -} - -static void -hostapd_rrm_print_nr(struct hostapd_neighbor_entry *nr) -{ - const u8 *data; - char *str; - int len; - - blobmsg_printf(&b, "", MACSTR, MAC2STR(nr->bssid)); - - str = blobmsg_alloc_string_buffer(&b, "", nr->ssid.ssid_len + 1); - memcpy(str, nr->ssid.ssid, nr->ssid.ssid_len); - str[nr->ssid.ssid_len] = 0; - blobmsg_add_string_buffer(&b); - - len = wpabuf_len(nr->nr); - str = blobmsg_alloc_string_buffer(&b, "", 2 * len + 1); - wpa_snprintf_hex(str, 2 * len + 1, wpabuf_head_u8(nr->nr), len); - blobmsg_add_string_buffer(&b); -} - -enum { - BSS_MGMT_EN_NEIGHBOR, - BSS_MGMT_EN_BEACON, - BSS_MGMT_EN_LINK_MEASUREMENT, -#ifdef CONFIG_WNM_AP - BSS_MGMT_EN_BSS_TRANSITION, -#endif - __BSS_MGMT_EN_MAX -}; - -static bool -__hostapd_bss_mgmt_enable_f(struct hostapd_data *hapd, int flag) -{ - struct hostapd_bss_config *bss = hapd->conf; - uint32_t flags; - - switch (flag) { - case BSS_MGMT_EN_NEIGHBOR: - if (bss->radio_measurements[0] & - WLAN_RRM_CAPS_NEIGHBOR_REPORT) - return false; - - bss->radio_measurements[0] |= - WLAN_RRM_CAPS_NEIGHBOR_REPORT; - hostapd_neighbor_set_own_report(hapd); - return true; - case BSS_MGMT_EN_BEACON: - flags = WLAN_RRM_CAPS_BEACON_REPORT_PASSIVE | - WLAN_RRM_CAPS_BEACON_REPORT_ACTIVE | - WLAN_RRM_CAPS_BEACON_REPORT_TABLE; - - if (bss->radio_measurements[0] & flags == flags) - return false; - - bss->radio_measurements[0] |= (u8) flags; - return true; - case BSS_MGMT_EN_LINK_MEASUREMENT: - flags = WLAN_RRM_CAPS_LINK_MEASUREMENT; - - if (bss->radio_measurements[0] & flags == flags) - return false; - - bss->radio_measurements[0] |= (u8) flags; - return true; -#ifdef CONFIG_WNM_AP - case BSS_MGMT_EN_BSS_TRANSITION: - if (bss->bss_transition) - return false; - - bss->bss_transition = 1; - return true; -#endif - } -} - -static void -__hostapd_bss_mgmt_enable(struct hostapd_data *hapd, uint32_t flags) -{ - bool update = false; - int i; - - for (i = 0; i < __BSS_MGMT_EN_MAX; i++) { - if (!(flags & (1 << i))) - continue; - - update |= __hostapd_bss_mgmt_enable_f(hapd, i); - } - - if (update) - ieee802_11_update_beacons(hapd->iface); -} - - -static const struct blobmsg_policy bss_mgmt_enable_policy[__BSS_MGMT_EN_MAX] = { - [BSS_MGMT_EN_NEIGHBOR] = { "neighbor_report", BLOBMSG_TYPE_BOOL }, - [BSS_MGMT_EN_BEACON] = { "beacon_report", BLOBMSG_TYPE_BOOL }, - [BSS_MGMT_EN_LINK_MEASUREMENT] = { "link_measurement", BLOBMSG_TYPE_BOOL }, -#ifdef CONFIG_WNM_AP - [BSS_MGMT_EN_BSS_TRANSITION] = { "bss_transition", BLOBMSG_TYPE_BOOL }, -#endif -}; - -static int -hostapd_bss_mgmt_enable(struct ubus_context *ctx, struct ubus_object *obj, - struct ubus_request_data *req, const char *method, - struct blob_attr *msg) - -{ - struct hostapd_data *hapd = get_hapd_from_object(obj); - struct blob_attr *tb[__BSS_MGMT_EN_MAX]; - struct blob_attr *cur; - uint32_t flags = 0; - int i; - bool neigh = false, beacon = false; - - blobmsg_parse(bss_mgmt_enable_policy, __BSS_MGMT_EN_MAX, tb, blob_data(msg), blob_len(msg)); - - for (i = 0; i < ARRAY_SIZE(tb); i++) { - if (!tb[i] || !blobmsg_get_bool(tb[i])) - continue; - - flags |= (1 << i); - } - - __hostapd_bss_mgmt_enable(hapd, flags); - - return 0; -} - - -static void -hostapd_rrm_nr_enable(struct hostapd_data *hapd) -{ - __hostapd_bss_mgmt_enable(hapd, 1 << BSS_MGMT_EN_NEIGHBOR); -} - -static int -hostapd_rrm_nr_get_own(struct ubus_context *ctx, struct ubus_object *obj, - struct ubus_request_data *req, const char *method, - struct blob_attr *msg) -{ - struct hostapd_data *hapd = get_hapd_from_object(obj); - struct hostapd_neighbor_entry *nr; - void *c; - - hostapd_rrm_nr_enable(hapd); - - nr = hostapd_neighbor_get(hapd, hapd->own_addr, NULL); - if (!nr) - return UBUS_STATUS_NOT_FOUND; - - blob_buf_init(&b, 0); - - c = blobmsg_open_array(&b, "value"); - hostapd_rrm_print_nr(nr); - blobmsg_close_array(&b, c); - - ubus_send_reply(ctx, req, b.head); - - return 0; -} - -static int -hostapd_rrm_nr_list(struct ubus_context *ctx, struct ubus_object *obj, - struct ubus_request_data *req, const char *method, - struct blob_attr *msg) -{ - struct hostapd_data *hapd = get_hapd_from_object(obj); - struct hostapd_neighbor_entry *nr; - void *c; - - hostapd_rrm_nr_enable(hapd); - blob_buf_init(&b, 0); - - c = blobmsg_open_array(&b, "list"); - dl_list_for_each(nr, &hapd->nr_db, struct hostapd_neighbor_entry, list) { - void *cur; - - if (!memcmp(nr->bssid, hapd->own_addr, ETH_ALEN)) - continue; - - cur = blobmsg_open_array(&b, NULL); - hostapd_rrm_print_nr(nr); - blobmsg_close_array(&b, cur); - } - blobmsg_close_array(&b, c); - - ubus_send_reply(ctx, req, b.head); - - return 0; -} - -enum { - NR_SET_LIST, - __NR_SET_LIST_MAX -}; - -static const struct blobmsg_policy nr_set_policy[__NR_SET_LIST_MAX] = { - [NR_SET_LIST] = { "list", BLOBMSG_TYPE_ARRAY }, -}; - - -static void -hostapd_rrm_nr_clear(struct hostapd_data *hapd) -{ - struct hostapd_neighbor_entry *nr; - -restart: - dl_list_for_each(nr, &hapd->nr_db, struct hostapd_neighbor_entry, list) { - if (!memcmp(nr->bssid, hapd->own_addr, ETH_ALEN)) - continue; - - hostapd_neighbor_remove(hapd, nr->bssid, &nr->ssid); - goto restart; - } -} - -static int -hostapd_rrm_nr_set(struct ubus_context *ctx, struct ubus_object *obj, - struct ubus_request_data *req, const char *method, - struct blob_attr *msg) -{ - static const struct blobmsg_policy nr_e_policy[] = { - { .type = BLOBMSG_TYPE_STRING }, - { .type = BLOBMSG_TYPE_STRING }, - { .type = BLOBMSG_TYPE_STRING }, - }; - struct hostapd_data *hapd = get_hapd_from_object(obj); - struct blob_attr *tb_l[__NR_SET_LIST_MAX]; - struct blob_attr *tb[ARRAY_SIZE(nr_e_policy)]; - struct blob_attr *cur; - int rem; - - hostapd_rrm_nr_enable(hapd); - - blobmsg_parse(nr_set_policy, __NR_SET_LIST_MAX, tb_l, blob_data(msg), blob_len(msg)); - if (!tb_l[NR_SET_LIST]) - return UBUS_STATUS_INVALID_ARGUMENT; - - hostapd_rrm_nr_clear(hapd); - blobmsg_for_each_attr(cur, tb_l[NR_SET_LIST], rem) { - struct wpa_ssid_value ssid; - struct wpabuf *data; - u8 bssid[ETH_ALEN]; - char *s, *nr_s; - - blobmsg_parse_array(nr_e_policy, ARRAY_SIZE(nr_e_policy), tb, blobmsg_data(cur), blobmsg_data_len(cur)); - if (!tb[0] || !tb[1] || !tb[2]) - goto invalid; - - /* Neighbor Report binary */ - nr_s = blobmsg_get_string(tb[2]); - data = wpabuf_parse_bin(nr_s); - if (!data) - goto invalid; - - /* BSSID */ - s = blobmsg_get_string(tb[0]); - if (strlen(s) == 0) { - /* Copy BSSID from neighbor report */ - if (hwaddr_compact_aton(nr_s, bssid)) - goto invalid; - } else if (hwaddr_aton(s, bssid)) { - goto invalid; - } - - /* SSID */ - s = blobmsg_get_string(tb[1]); - if (strlen(s) == 0) { - /* Copy SSID from hostapd BSS conf */ - memcpy(&ssid, &hapd->conf->ssid, sizeof(ssid)); - } else { - ssid.ssid_len = strlen(s); - if (ssid.ssid_len > sizeof(ssid.ssid)) - goto invalid; - - memcpy(&ssid, s, ssid.ssid_len); - } - - hostapd_neighbor_set(hapd, bssid, &ssid, data, NULL, NULL, 0, 0); - wpabuf_free(data); - continue; - -invalid: - return UBUS_STATUS_INVALID_ARGUMENT; - } - - return 0; -} - -enum { - BEACON_REQ_ADDR, - BEACON_REQ_MODE, - BEACON_REQ_OP_CLASS, - BEACON_REQ_CHANNEL, - BEACON_REQ_DURATION, - BEACON_REQ_BSSID, - BEACON_REQ_SSID, - __BEACON_REQ_MAX, -}; - -static const struct blobmsg_policy beacon_req_policy[__BEACON_REQ_MAX] = { - [BEACON_REQ_ADDR] = { "addr", BLOBMSG_TYPE_STRING }, - [BEACON_REQ_OP_CLASS] { "op_class", BLOBMSG_TYPE_INT32 }, - [BEACON_REQ_CHANNEL] { "channel", BLOBMSG_TYPE_INT32 }, - [BEACON_REQ_DURATION] { "duration", BLOBMSG_TYPE_INT32 }, - [BEACON_REQ_MODE] { "mode", BLOBMSG_TYPE_INT32 }, - [BEACON_REQ_BSSID] { "bssid", BLOBMSG_TYPE_STRING }, - [BEACON_REQ_SSID] { "ssid", BLOBMSG_TYPE_STRING }, -}; - -static int -hostapd_rrm_beacon_req(struct ubus_context *ctx, struct ubus_object *obj, - struct ubus_request_data *ureq, const char *method, - struct blob_attr *msg) -{ - struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj); - struct blob_attr *tb[__BEACON_REQ_MAX]; - struct blob_attr *cur; - struct wpabuf *req; - u8 bssid[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; - u8 addr[ETH_ALEN]; - int mode, rem, ret; - int buf_len = 13; - - blobmsg_parse(beacon_req_policy, __BEACON_REQ_MAX, tb, blob_data(msg), blob_len(msg)); - - if (!tb[BEACON_REQ_ADDR] || !tb[BEACON_REQ_MODE] || !tb[BEACON_REQ_DURATION] || - !tb[BEACON_REQ_OP_CLASS] || !tb[BEACON_REQ_CHANNEL]) - return UBUS_STATUS_INVALID_ARGUMENT; - - if (tb[BEACON_REQ_SSID]) - buf_len += blobmsg_data_len(tb[BEACON_REQ_SSID]) + 2 - 1; - - mode = blobmsg_get_u32(tb[BEACON_REQ_MODE]); - if (hwaddr_aton(blobmsg_data(tb[BEACON_REQ_ADDR]), addr)) - return UBUS_STATUS_INVALID_ARGUMENT; - - if (tb[BEACON_REQ_BSSID] && - hwaddr_aton(blobmsg_data(tb[BEACON_REQ_BSSID]), bssid)) - return UBUS_STATUS_INVALID_ARGUMENT; - - req = wpabuf_alloc(buf_len); - if (!req) - return UBUS_STATUS_UNKNOWN_ERROR; - - /* 1: regulatory class */ - wpabuf_put_u8(req, blobmsg_get_u32(tb[BEACON_REQ_OP_CLASS])); - - /* 2: channel number */ - wpabuf_put_u8(req, blobmsg_get_u32(tb[BEACON_REQ_CHANNEL])); - - /* 3-4: randomization interval */ - wpabuf_put_le16(req, 0); - - /* 5-6: duration */ - wpabuf_put_le16(req, blobmsg_get_u32(tb[BEACON_REQ_DURATION])); - - /* 7: mode */ - wpabuf_put_u8(req, blobmsg_get_u32(tb[BEACON_REQ_MODE])); - - /* 8-13: BSSID */ - wpabuf_put_data(req, bssid, ETH_ALEN); - - if ((cur = tb[BEACON_REQ_SSID]) != NULL) { - wpabuf_put_u8(req, WLAN_EID_SSID); - wpabuf_put_u8(req, blobmsg_data_len(cur) - 1); - wpabuf_put_data(req, blobmsg_data(cur), blobmsg_data_len(cur) - 1); - } - - ret = hostapd_send_beacon_req(hapd, addr, 0, req); - if (ret < 0) - return -ret; - - return 0; -} - -enum { - LM_REQ_ADDR, - LM_REQ_TX_POWER_USED, - LM_REQ_TX_POWER_MAX, - __LM_REQ_MAX, -}; - -static const struct blobmsg_policy lm_req_policy[__LM_REQ_MAX] = { - [LM_REQ_ADDR] = { "addr", BLOBMSG_TYPE_STRING }, - [LM_REQ_TX_POWER_USED] = { "tx-power-used", BLOBMSG_TYPE_INT32 }, - [LM_REQ_TX_POWER_MAX] = { "tx-power-max", BLOBMSG_TYPE_INT32 }, -}; - -static int -hostapd_rrm_lm_req(struct ubus_context *ctx, struct ubus_object *obj, - struct ubus_request_data *ureq, const char *method, - struct blob_attr *msg) -{ - struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj); - struct blob_attr *tb[__LM_REQ_MAX]; - struct wpabuf *buf; - u8 addr[ETH_ALEN]; - int ret; - int8_t txp_used, txp_max; - - txp_used = 0; - txp_max = 0; - - blobmsg_parse(lm_req_policy, __LM_REQ_MAX, tb, blob_data(msg), blob_len(msg)); - - if (!tb[LM_REQ_ADDR]) - return UBUS_STATUS_INVALID_ARGUMENT; - - if (tb[LM_REQ_TX_POWER_USED]) - txp_used = (int8_t) blobmsg_get_u32(tb[LM_REQ_TX_POWER_USED]); - - if (tb[LM_REQ_TX_POWER_MAX]) - txp_max = (int8_t) blobmsg_get_u32(tb[LM_REQ_TX_POWER_MAX]); - - if (hwaddr_aton(blobmsg_data(tb[LM_REQ_ADDR]), addr)) - return UBUS_STATUS_INVALID_ARGUMENT; - - buf = wpabuf_alloc(5); - if (!buf) - return UBUS_STATUS_UNKNOWN_ERROR; - - wpabuf_put_u8(buf, WLAN_ACTION_RADIO_MEASUREMENT); - wpabuf_put_u8(buf, WLAN_RRM_LINK_MEASUREMENT_REQUEST); - wpabuf_put_u8(buf, 1); - /* TX-Power used */ - wpabuf_put_u8(buf, txp_used); - /* Max TX Power */ - wpabuf_put_u8(buf, txp_max); - - ret = hostapd_drv_send_action(hapd, hapd->iface->freq, 0, addr, - wpabuf_head(buf), wpabuf_len(buf)); - - wpabuf_free(buf); - if (ret < 0) - return -ret; - - return 0; -} - - -void hostapd_ubus_handle_link_measurement(struct hostapd_data *hapd, const u8 *data, size_t len) -{ - const struct ieee80211_mgmt *mgmt = (const struct ieee80211_mgmt *) data; - const u8 *pos, *end; - u8 token; - - end = data + len; - token = mgmt->u.action.u.rrm.dialog_token; - pos = mgmt->u.action.u.rrm.variable; - - if (end - pos < 8) - return; - - if (!hapd->ubus.obj.has_subscribers) - return; - - blob_buf_init(&b, 0); - blobmsg_add_macaddr(&b, "address", mgmt->sa); - blobmsg_add_u16(&b, "dialog-token", token); - blobmsg_add_u16(&b, "rx-antenna-id", pos[4]); - blobmsg_add_u16(&b, "tx-antenna-id", pos[5]); - blobmsg_add_u16(&b, "rcpi", pos[6]); - blobmsg_add_u16(&b, "rsni", pos[7]); - - ubus_notify(ctx, &hapd->ubus.obj, "link-measurement-report", b.head, -1); -} - - -#ifdef CONFIG_WNM_AP - -static int -hostapd_bss_tr_send(struct hostapd_data *hapd, u8 *addr, bool disassoc_imminent, bool abridged, - u16 disassoc_timer, u8 validity_period, u8 dialog_token, - struct blob_attr *neighbors, u8 mbo_reason, u8 cell_pref, u8 reassoc_delay) -{ - struct blob_attr *cur; - struct sta_info *sta; - int nr_len = 0; - int rem; - u8 *nr = NULL; - u8 req_mode = 0; - u8 mbo[10]; - size_t mbo_len = 0; - - sta = ap_get_sta(hapd, addr); - if (!sta) - return UBUS_STATUS_NOT_FOUND; - - if (neighbors) { - u8 *nr_cur; - - if (blobmsg_check_array(neighbors, - BLOBMSG_TYPE_STRING) < 0) - return UBUS_STATUS_INVALID_ARGUMENT; - - blobmsg_for_each_attr(cur, neighbors, rem) { - int len = strlen(blobmsg_get_string(cur)); - - if (len % 2) - return UBUS_STATUS_INVALID_ARGUMENT; - - nr_len += (len / 2) + 2; - } - - if (nr_len) { - nr = os_zalloc(nr_len); - if (!nr) - return UBUS_STATUS_UNKNOWN_ERROR; - } - - nr_cur = nr; - blobmsg_for_each_attr(cur, neighbors, rem) { - int len = strlen(blobmsg_get_string(cur)) / 2; - - *nr_cur++ = WLAN_EID_NEIGHBOR_REPORT; - *nr_cur++ = (u8) len; - if (hexstr2bin(blobmsg_data(cur), nr_cur, len)) { - free(nr); - return UBUS_STATUS_INVALID_ARGUMENT; - } - - nr_cur += len; - } - } - - if (nr) - req_mode |= WNM_BSS_TM_REQ_PREF_CAND_LIST_INCLUDED; - - if (abridged) - req_mode |= WNM_BSS_TM_REQ_ABRIDGED; - - if (disassoc_imminent) - req_mode |= WNM_BSS_TM_REQ_DISASSOC_IMMINENT; - -#ifdef CONFIG_MBO - u8 *mbo_pos = mbo; - - if (mbo_reason > MBO_TRANSITION_REASON_PREMIUM_AP) - return UBUS_STATUS_INVALID_ARGUMENT; - - if (cell_pref != 0 && cell_pref != 1 && cell_pref != 255) - return UBUS_STATUS_INVALID_ARGUMENT; - - if (reassoc_delay > 65535 || (reassoc_delay && !disassoc_imminent)) - return UBUS_STATUS_INVALID_ARGUMENT; - - *mbo_pos++ = MBO_ATTR_ID_TRANSITION_REASON; - *mbo_pos++ = 1; - *mbo_pos++ = mbo_reason; - *mbo_pos++ = MBO_ATTR_ID_CELL_DATA_PREF; - *mbo_pos++ = 1; - *mbo_pos++ = cell_pref; - - if (reassoc_delay) { - *mbo_pos++ = MBO_ATTR_ID_ASSOC_RETRY_DELAY; - *mbo_pos++ = 2; - WPA_PUT_LE16(mbo_pos, reassoc_delay); - mbo_pos += 2; - } - - mbo_len = mbo_pos - mbo; -#endif - - if (wnm_send_bss_tm_req(hapd, sta, req_mode, disassoc_timer, validity_period, NULL, - dialog_token, NULL, nr, nr_len, mbo_len ? mbo : NULL, mbo_len)) - return UBUS_STATUS_UNKNOWN_ERROR; - - return 0; -} - -enum { - BSS_TR_ADDR, - BSS_TR_DA_IMMINENT, - BSS_TR_DA_TIMER, - BSS_TR_VALID_PERIOD, - BSS_TR_NEIGHBORS, - BSS_TR_ABRIDGED, - BSS_TR_DIALOG_TOKEN, -#ifdef CONFIG_MBO - BSS_TR_MBO_REASON, - BSS_TR_CELL_PREF, - BSS_TR_REASSOC_DELAY, -#endif - __BSS_TR_DISASSOC_MAX -}; - -static const struct blobmsg_policy bss_tr_policy[__BSS_TR_DISASSOC_MAX] = { - [BSS_TR_ADDR] = { "addr", BLOBMSG_TYPE_STRING }, - [BSS_TR_DA_IMMINENT] = { "disassociation_imminent", BLOBMSG_TYPE_BOOL }, - [BSS_TR_DA_TIMER] = { "disassociation_timer", BLOBMSG_TYPE_INT32 }, - [BSS_TR_VALID_PERIOD] = { "validity_period", BLOBMSG_TYPE_INT32 }, - [BSS_TR_NEIGHBORS] = { "neighbors", BLOBMSG_TYPE_ARRAY }, - [BSS_TR_ABRIDGED] = { "abridged", BLOBMSG_TYPE_BOOL }, - [BSS_TR_DIALOG_TOKEN] = { "dialog_token", BLOBMSG_TYPE_INT32 }, -#ifdef CONFIG_MBO - [BSS_TR_MBO_REASON] = { "mbo_reason", BLOBMSG_TYPE_INT32 }, - [BSS_TR_CELL_PREF] = { "cell_pref", BLOBMSG_TYPE_INT32 }, - [BSS_TR_REASSOC_DELAY] = { "reassoc_delay", BLOBMSG_TYPE_INT32 }, -#endif -}; - -static int -hostapd_bss_transition_request(struct ubus_context *ctx, struct ubus_object *obj, - struct ubus_request_data *ureq, const char *method, - struct blob_attr *msg) -{ - struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj); - struct blob_attr *tb[__BSS_TR_DISASSOC_MAX]; - struct sta_info *sta; - u32 da_timer = 0; - u32 valid_period = 0; - u8 addr[ETH_ALEN]; - u32 dialog_token = 1; - bool abridged; - bool da_imminent; - u8 mbo_reason; - u8 cell_pref; - u8 reassoc_delay; - - blobmsg_parse(bss_tr_policy, __BSS_TR_DISASSOC_MAX, tb, blob_data(msg), blob_len(msg)); - - if (!tb[BSS_TR_ADDR]) - return UBUS_STATUS_INVALID_ARGUMENT; - - if (hwaddr_aton(blobmsg_data(tb[BSS_TR_ADDR]), addr)) - return UBUS_STATUS_INVALID_ARGUMENT; - - if (tb[BSS_TR_DA_TIMER]) - da_timer = blobmsg_get_u32(tb[BSS_TR_DA_TIMER]); - - if (tb[BSS_TR_VALID_PERIOD]) - valid_period = blobmsg_get_u32(tb[BSS_TR_VALID_PERIOD]); - - if (tb[BSS_TR_DIALOG_TOKEN]) - dialog_token = blobmsg_get_u32(tb[BSS_TR_DIALOG_TOKEN]); - - da_imminent = !!(tb[BSS_TR_DA_IMMINENT] && blobmsg_get_bool(tb[BSS_TR_DA_IMMINENT])); - abridged = !!(tb[BSS_TR_ABRIDGED] && blobmsg_get_bool(tb[BSS_TR_ABRIDGED])); - -#ifdef CONFIG_MBO - if (tb[BSS_TR_MBO_REASON]) - mbo_reason = blobmsg_get_u32(tb[BSS_TR_MBO_REASON]); - - if (tb[BSS_TR_CELL_PREF]) - cell_pref = blobmsg_get_u32(tb[BSS_TR_CELL_PREF]); - - if (tb[BSS_TR_REASSOC_DELAY]) - reassoc_delay = blobmsg_get_u32(tb[BSS_TR_REASSOC_DELAY]); -#endif - - return hostapd_bss_tr_send(hapd, addr, da_imminent, abridged, da_timer, valid_period, - dialog_token, tb[BSS_TR_NEIGHBORS], mbo_reason, cell_pref, reassoc_delay); -} -#endif - -#ifdef CONFIG_AIRTIME_POLICY -enum { - UPDATE_AIRTIME_STA, - UPDATE_AIRTIME_WEIGHT, - __UPDATE_AIRTIME_MAX, -}; - - -static const struct blobmsg_policy airtime_policy[__UPDATE_AIRTIME_MAX] = { - [UPDATE_AIRTIME_STA] = { "sta", BLOBMSG_TYPE_STRING }, - [UPDATE_AIRTIME_WEIGHT] = { "weight", BLOBMSG_TYPE_INT32 }, -}; - -static int -hostapd_bss_update_airtime(struct ubus_context *ctx, struct ubus_object *obj, - struct ubus_request_data *ureq, const char *method, - struct blob_attr *msg) -{ - struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj); - struct blob_attr *tb[__UPDATE_AIRTIME_MAX]; - struct sta_info *sta = NULL; - u8 addr[ETH_ALEN]; - int weight; - - blobmsg_parse(airtime_policy, __UPDATE_AIRTIME_MAX, tb, blob_data(msg), blob_len(msg)); - - if (!tb[UPDATE_AIRTIME_WEIGHT]) - return UBUS_STATUS_INVALID_ARGUMENT; - - weight = blobmsg_get_u32(tb[UPDATE_AIRTIME_WEIGHT]); - - if (!tb[UPDATE_AIRTIME_STA]) { - if (!weight) - return UBUS_STATUS_INVALID_ARGUMENT; - - hapd->conf->airtime_weight = weight; - return 0; - } - - if (hwaddr_aton(blobmsg_data(tb[UPDATE_AIRTIME_STA]), addr)) - return UBUS_STATUS_INVALID_ARGUMENT; - - sta = ap_get_sta(hapd, addr); - if (!sta) - return UBUS_STATUS_NOT_FOUND; - - sta->dyn_airtime_weight = weight; - airtime_policy_new_sta(hapd, sta); - - return 0; -} -#endif - -#ifdef CONFIG_TAXONOMY -static const struct blobmsg_policy addr_policy[] = { - { "address", BLOBMSG_TYPE_STRING } -}; - -static bool -hostapd_add_b64_data(const char *name, const struct wpabuf *buf) -{ - char *str; - - if (!buf) - return false; - - str = blobmsg_alloc_string_buffer(&b, name, B64_ENCODE_LEN(wpabuf_len(buf))); - b64_encode(wpabuf_head(buf), wpabuf_len(buf), str, B64_ENCODE_LEN(wpabuf_len(buf))); - blobmsg_add_string_buffer(&b); - - return true; -} - -static int -hostapd_bss_get_sta_ies(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 blob_attr *tb; - struct sta_info *sta; - u8 addr[ETH_ALEN]; - - blobmsg_parse(addr_policy, 1, &tb, blobmsg_data(msg), blobmsg_len(msg)); - - if (!tb || hwaddr_aton(blobmsg_data(tb), addr)) - return UBUS_STATUS_INVALID_ARGUMENT; - - sta = ap_get_sta(hapd, addr); - if (!sta || (!sta->probe_ie_taxonomy && !sta->assoc_ie_taxonomy)) - return UBUS_STATUS_NOT_FOUND; - - blob_buf_init(&b, 0); - hostapd_add_b64_data("probe_ie", sta->probe_ie_taxonomy); - hostapd_add_b64_data("assoc_ie", sta->assoc_ie_taxonomy); - ubus_send_reply(ctx, req, b.head); - - return 0; -} -#endif - - -static const struct ubus_method bss_methods[] = { - UBUS_METHOD_NOARG("reload", hostapd_bss_reload), - UBUS_METHOD_NOARG("get_clients", hostapd_bss_get_clients), -#ifdef CONFIG_TAXONOMY - UBUS_METHOD("get_sta_ies", hostapd_bss_get_sta_ies, addr_policy), -#endif - UBUS_METHOD_NOARG("get_status", hostapd_bss_get_status), - UBUS_METHOD("del_client", hostapd_bss_del_client, del_policy), -#ifdef CONFIG_AIRTIME_POLICY - UBUS_METHOD("update_airtime", hostapd_bss_update_airtime, airtime_policy), -#endif - UBUS_METHOD_NOARG("list_bans", hostapd_bss_list_bans), -#ifdef CONFIG_WPS - UBUS_METHOD_NOARG("wps_start", hostapd_bss_wps_start), - UBUS_METHOD_NOARG("wps_status", hostapd_bss_wps_status), - UBUS_METHOD_NOARG("wps_cancel", hostapd_bss_wps_cancel), -#endif - UBUS_METHOD_NOARG("update_beacon", hostapd_bss_update_beacon), - UBUS_METHOD_NOARG("get_features", hostapd_bss_get_features), -#ifdef NEED_AP_MLME - UBUS_METHOD("switch_chan", hostapd_switch_chan, csa_policy), -#endif - UBUS_METHOD("set_vendor_elements", hostapd_vendor_elements, ve_policy), - UBUS_METHOD("notify_response", hostapd_notify_response, notify_policy), - UBUS_METHOD("bss_mgmt_enable", hostapd_bss_mgmt_enable, bss_mgmt_enable_policy), - UBUS_METHOD_NOARG("rrm_nr_get_own", hostapd_rrm_nr_get_own), - UBUS_METHOD_NOARG("rrm_nr_list", hostapd_rrm_nr_list), - UBUS_METHOD("rrm_nr_set", hostapd_rrm_nr_set, nr_set_policy), - UBUS_METHOD("rrm_beacon_req", hostapd_rrm_beacon_req, beacon_req_policy), - UBUS_METHOD("link_measurement_req", hostapd_rrm_lm_req, lm_req_policy), -#ifdef CONFIG_WNM_AP - UBUS_METHOD("bss_transition_request", hostapd_bss_transition_request, bss_tr_policy), -#endif -}; - -static struct ubus_object_type bss_object_type = - UBUS_OBJECT_TYPE("hostapd_bss", bss_methods); - -static int avl_compare_macaddr(const void *k1, const void *k2, void *ptr) -{ - return memcmp(k1, k2, ETH_ALEN); -} - -void hostapd_ubus_add_bss(struct hostapd_data *hapd) -{ - struct ubus_object *obj = &hapd->ubus.obj; - char *name; - int ret; - -#ifdef CONFIG_MESH - if (hapd->conf->mesh & MESH_ENABLED) - return; -#endif - - if (!hostapd_ubus_init()) - return; - - if (asprintf(&name, "hostapd.%s", hapd->conf->iface) < 0) - return; - - avl_init(&hapd->ubus.banned, avl_compare_macaddr, false, NULL); - obj->name = name; - obj->type = &bss_object_type; - obj->methods = bss_object_type.methods; - obj->n_methods = bss_object_type.n_methods; - ret = ubus_add_object(ctx, obj); - hostapd_ubus_ref_inc(); -} - -void hostapd_ubus_free_bss(struct hostapd_data *hapd) -{ - struct ubus_object *obj = &hapd->ubus.obj; - char *name = (char *) obj->name; - -#ifdef CONFIG_MESH - if (hapd->conf->mesh & MESH_ENABLED) - return; -#endif - - if (!ctx) - return; - - if (obj->id) { - ubus_remove_object(ctx, obj); - hostapd_ubus_ref_dec(); - } - - 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"); -} - -struct ubus_event_req { - struct ubus_notify_request nreq; - int resp; -}; - -static void -ubus_event_cb(struct ubus_notify_request *req, int idx, int ret) -{ - struct ubus_event_req *ureq = container_of(req, struct ubus_event_req, nreq); - - ureq->resp = ret; -} - -int hostapd_ubus_handle_event(struct hostapd_data *hapd, struct hostapd_ubus_request *req) -{ - struct ubus_banned_client *ban; - const char *types[HOSTAPD_UBUS_TYPE_MAX] = { - [HOSTAPD_UBUS_PROBE_REQ] = "probe", - [HOSTAPD_UBUS_AUTH_REQ] = "auth", - [HOSTAPD_UBUS_ASSOC_REQ] = "assoc", - }; - const char *type = "mgmt"; - struct ubus_event_req ureq = {}; - const u8 *addr; - - if (req->mgmt_frame) - addr = req->mgmt_frame->sa; - else - addr = req->addr; - - ban = avl_find_element(&hapd->ubus.banned, addr, ban, avl); - if (ban) - return WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA; - - if (!hapd->ubus.obj.has_subscribers) - return WLAN_STATUS_SUCCESS; - - if (req->type < ARRAY_SIZE(types)) - type = types[req->type]; - - blob_buf_init(&b, 0); - blobmsg_add_macaddr(&b, "address", addr); - if (req->mgmt_frame) - blobmsg_add_macaddr(&b, "target", req->mgmt_frame->da); - if (req->ssi_signal) - blobmsg_add_u32(&b, "signal", req->ssi_signal); - blobmsg_add_u32(&b, "freq", hapd->iface->freq); - - if (req->elems) { - if(req->elems->ht_capabilities) - { - struct ieee80211_ht_capabilities *ht_capabilities; - void *ht_cap, *ht_cap_mcs_set, *mcs_set; - - - ht_capabilities = (struct ieee80211_ht_capabilities*) req->elems->ht_capabilities; - ht_cap = blobmsg_open_table(&b, "ht_capabilities"); - blobmsg_add_u16(&b, "ht_capabilities_info", ht_capabilities->ht_capabilities_info); - ht_cap_mcs_set = blobmsg_open_table(&b, "supported_mcs_set"); - blobmsg_add_u16(&b, "a_mpdu_params", ht_capabilities->a_mpdu_params); - blobmsg_add_u16(&b, "ht_extended_capabilities", ht_capabilities->ht_extended_capabilities); - blobmsg_add_u32(&b, "tx_bf_capability_info", ht_capabilities->tx_bf_capability_info); - blobmsg_add_u16(&b, "asel_capabilities", ht_capabilities->asel_capabilities); - mcs_set = blobmsg_open_array(&b, "supported_mcs_set"); - for (int i = 0; i < 16; i++) { - blobmsg_add_u16(&b, NULL, (u16) ht_capabilities->supported_mcs_set[i]); - } - blobmsg_close_array(&b, mcs_set); - blobmsg_close_table(&b, ht_cap_mcs_set); - blobmsg_close_table(&b, ht_cap); - } - if(req->elems->vht_capabilities) - { - struct ieee80211_vht_capabilities *vht_capabilities; - void *vht_cap, *vht_cap_mcs_set; - - vht_capabilities = (struct ieee80211_vht_capabilities*) req->elems->vht_capabilities; - vht_cap = blobmsg_open_table(&b, "vht_capabilities"); - blobmsg_add_u32(&b, "vht_capabilities_info", vht_capabilities->vht_capabilities_info); - vht_cap_mcs_set = blobmsg_open_table(&b, "vht_supported_mcs_set"); - blobmsg_add_u16(&b, "rx_map", vht_capabilities->vht_supported_mcs_set.rx_map); - blobmsg_add_u16(&b, "rx_highest", vht_capabilities->vht_supported_mcs_set.rx_highest); - blobmsg_add_u16(&b, "tx_map", vht_capabilities->vht_supported_mcs_set.tx_map); - blobmsg_add_u16(&b, "tx_highest", vht_capabilities->vht_supported_mcs_set.tx_highest); - blobmsg_close_table(&b, vht_cap_mcs_set); - blobmsg_close_table(&b, vht_cap); - } - } - - if (!hapd->ubus.notify_response) { - ubus_notify(ctx, &hapd->ubus.obj, type, b.head, -1); - return WLAN_STATUS_SUCCESS; - } - - if (ubus_notify_async(ctx, &hapd->ubus.obj, type, b.head, &ureq.nreq)) - return WLAN_STATUS_SUCCESS; - - ureq.nreq.status_cb = ubus_event_cb; - ubus_complete_request(ctx, &ureq.nreq.req, 100); - - if (ureq.resp) - return ureq.resp; - - return WLAN_STATUS_SUCCESS; -} - -void hostapd_ubus_notify(struct hostapd_data *hapd, const char *type, const u8 *addr) -{ - if (!hapd->ubus.obj.has_subscribers) - return; - - if (!addr) - return; - - blob_buf_init(&b, 0); - blobmsg_add_macaddr(&b, "address", addr); - - ubus_notify(ctx, &hapd->ubus.obj, type, b.head, -1); -} - -void hostapd_ubus_notify_authorized(struct hostapd_data *hapd, struct sta_info *sta, - const char *auth_alg) -{ - if (!hapd->ubus.obj.has_subscribers) - return; - - blob_buf_init(&b, 0); - blobmsg_add_macaddr(&b, "address", sta->addr); - if (auth_alg) - blobmsg_add_string(&b, "auth-alg", auth_alg); - - ubus_notify(ctx, &hapd->ubus.obj, "sta-authorized", b.head, -1); -} - -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) -{ - if (!hapd->ubus.obj.has_subscribers) - return; - - if (!addr || !rep) - return; - - blob_buf_init(&b, 0); - blobmsg_add_macaddr(&b, "address", addr); - blobmsg_add_u16(&b, "op-class", rep->op_class); - blobmsg_add_u16(&b, "channel", rep->channel); - blobmsg_add_u64(&b, "start-time", rep->start_time); - blobmsg_add_u16(&b, "duration", rep->duration); - blobmsg_add_u16(&b, "report-info", rep->report_info); - blobmsg_add_u16(&b, "rcpi", rep->rcpi); - blobmsg_add_u16(&b, "rsni", rep->rsni); - blobmsg_add_macaddr(&b, "bssid", rep->bssid); - blobmsg_add_u16(&b, "antenna-id", rep->antenna_id); - blobmsg_add_u16(&b, "parent-tsf", rep->parent_tsf); - blobmsg_add_u16(&b, "rep-mode", rep_mode); - - 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 (!ctx) - 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); - } -} - -#ifdef CONFIG_WNM_AP -static void hostapd_ubus_notify_bss_transition_add_candidate_list( - const u8 *candidate_list, u16 candidate_list_len) -{ - char *cl_str; - int i; - - if (candidate_list_len == 0) - return; - - cl_str = blobmsg_alloc_string_buffer(&b, "candidate-list", candidate_list_len * 2 + 1); - for (i = 0; i < candidate_list_len; i++) - snprintf(&cl_str[i*2], 3, "%02X", candidate_list[i]); - blobmsg_add_string_buffer(&b); - -} -#endif - -void hostapd_ubus_notify_bss_transition_response( - struct hostapd_data *hapd, const u8 *addr, u8 dialog_token, u8 status_code, - u8 bss_termination_delay, const u8 *target_bssid, - const u8 *candidate_list, u16 candidate_list_len) -{ -#ifdef CONFIG_WNM_AP - u16 i; - - if (!hapd->ubus.obj.has_subscribers) - return; - - if (!addr) - return; - - blob_buf_init(&b, 0); - blobmsg_add_macaddr(&b, "address", addr); - blobmsg_add_u8(&b, "dialog-token", dialog_token); - blobmsg_add_u8(&b, "status-code", status_code); - blobmsg_add_u8(&b, "bss-termination-delay", bss_termination_delay); - if (target_bssid) - blobmsg_add_macaddr(&b, "target-bssid", target_bssid); - - hostapd_ubus_notify_bss_transition_add_candidate_list(candidate_list, candidate_list_len); - - ubus_notify(ctx, &hapd->ubus.obj, "bss-transition-response", b.head, -1); -#endif -} - -int hostapd_ubus_notify_bss_transition_query( - struct hostapd_data *hapd, const u8 *addr, u8 dialog_token, u8 reason, - const u8 *candidate_list, u16 candidate_list_len) -{ -#ifdef CONFIG_WNM_AP - struct ubus_event_req ureq = {}; - char *cl_str; - u16 i; - - if (!hapd->ubus.obj.has_subscribers) - return 0; - - if (!addr) - return 0; - - blob_buf_init(&b, 0); - blobmsg_add_macaddr(&b, "address", addr); - blobmsg_add_u8(&b, "dialog-token", dialog_token); - blobmsg_add_u8(&b, "reason", reason); - hostapd_ubus_notify_bss_transition_add_candidate_list(candidate_list, candidate_list_len); - - if (!hapd->ubus.notify_response) { - ubus_notify(ctx, &hapd->ubus.obj, "bss-transition-query", b.head, -1); - return 0; - } - - if (ubus_notify_async(ctx, &hapd->ubus.obj, "bss-transition-query", b.head, &ureq.nreq)) - return 0; - - ureq.nreq.status_cb = ubus_event_cb; - ubus_complete_request(ctx, &ureq.nreq.req, 100); - - return ureq.resp; -#endif -} diff --git a/package/network/services/hostapd/src/src/utils/ap/ubus.h b/package/network/services/hostapd/src/src/utils/ap/ubus.h deleted file mode 100644 index 22767d67ee7564..00000000000000 --- a/package/network/services/hostapd/src/src/utils/ap/ubus.h +++ /dev/null @@ -1,157 +0,0 @@ -/* - * hostapd / ubus support - * Copyright (c) 2013, Felix Fietkau - * - * This software may be distributed under the terms of the BSD license. - * See README for more details. - */ -#ifndef __HOSTAPD_UBUS_H -#define __HOSTAPD_UBUS_H - -#include "sta_info.h" - -enum hostapd_ubus_event_type { - HOSTAPD_UBUS_PROBE_REQ, - HOSTAPD_UBUS_AUTH_REQ, - HOSTAPD_UBUS_ASSOC_REQ, - HOSTAPD_UBUS_TYPE_MAX -}; - -struct hostapd_ubus_request { - enum hostapd_ubus_event_type type; - const struct ieee80211_mgmt *mgmt_frame; - const struct ieee802_11_elems *elems; - int ssi_signal; /* dBm */ - const u8 *addr; -}; - -struct hostapd_iface; -struct hostapd_data; -struct hapd_interfaces; -struct rrm_measurement_beacon_report; -struct sta_info; - -#ifdef UBUS_SUPPORT - -#include -#include - -struct hostapd_ubus_bss { - struct ubus_object obj; - struct avl_tree banned; - int notify_response; -}; - -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_handle_link_measurement(struct hostapd_data *hapd, const u8 *data, size_t len); -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, - 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_notify_bss_transition_response( - struct hostapd_data *hapd, const u8 *addr, u8 dialog_token, u8 status_code, - u8 bss_termination_delay, const u8 *target_bssid, - const u8 *candidate_list, u16 candidate_list_len); -void hostapd_ubus_add(struct hapd_interfaces *interfaces); -void hostapd_ubus_free(struct hapd_interfaces *interfaces); -int hostapd_ubus_notify_bss_transition_query( - struct hostapd_data *hapd, const u8 *addr, u8 dialog_token, u8 reason, - const u8 *candidate_list, u16 candidate_list_len); -void hostapd_ubus_notify_authorized(struct hostapd_data *hapd, struct sta_info *sta, - const char *auth_alg); - -#else - -struct hostapd_ubus_bss {}; - -static inline void hostapd_ubus_add_iface(struct hostapd_iface *iface) -{ -} - -static inline void hostapd_ubus_free_iface(struct hostapd_iface *iface) -{ -} - -static inline void hostapd_ubus_add_bss(struct hostapd_data *hapd) -{ -} - -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; -} - -static inline void hostapd_ubus_handle_link_measurement(struct hostapd_data *hapd, const u8 *data, size_t len) -{ -} - -static inline void hostapd_ubus_notify(struct hostapd_data *hapd, const char *type, const u8 *mac) -{ -} - -static inline 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) -{ -} -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_notify_bss_transition_response( - struct hostapd_data *hapd, const u8 *addr, u8 dialog_token, u8 status_code, - u8 bss_termination_delay, const u8 *target_bssid, - const u8 *candidate_list, u16 candidate_list_len) -{ -} - -static inline void hostapd_ubus_add(struct hapd_interfaces *interfaces) -{ -} - -static inline void hostapd_ubus_free(struct hapd_interfaces *interfaces) -{ -} - -static inline int hostapd_ubus_notify_bss_transition_query( - struct hostapd_data *hapd, const u8 *addr, u8 dialog_token, u8 reason, - const u8 *candidate_list, u16 candidate_list_len) -{ - return 0; -} - -static inline void -hostapd_ubus_notify_authorized(struct hostapd_data *hapd, struct sta_info *sta, - const char *auth_alg) -{ -} - -#endif - -#endif diff --git a/package/network/services/hostapd/src/src/utils/ap/ucode.c b/package/network/services/hostapd/src/src/utils/ap/ucode.c deleted file mode 100644 index 68fb450884e2f3..00000000000000 --- a/package/network/services/hostapd/src/src/utils/ap/ucode.c +++ /dev/null @@ -1,817 +0,0 @@ -#include - -#include "utils/includes.h" -#include "utils/common.h" -#include "utils/ucode.h" -#include "hostapd.h" -#include "beacon.h" -#include "hw_features.h" -#include "ap_drv_ops.h" -#include "dfs.h" -#include "acs.h" -#include - -static uc_resource_type_t *global_type, *bss_type, *iface_type; -static struct hapd_interfaces *interfaces; -static uc_value_t *global, *bss_registry, *iface_registry; -static uc_vm_t *vm; - -static uc_value_t * -hostapd_ucode_bss_get_uval(struct hostapd_data *hapd) -{ - uc_value_t *val; - - if (hapd->ucode.idx) - return wpa_ucode_registry_get(bss_registry, hapd->ucode.idx); - - val = uc_resource_new(bss_type, hapd); - hapd->ucode.idx = wpa_ucode_registry_add(bss_registry, val); - - return val; -} - -static uc_value_t * -hostapd_ucode_iface_get_uval(struct hostapd_iface *hapd) -{ - uc_value_t *val; - - if (hapd->ucode.idx) - return wpa_ucode_registry_get(iface_registry, hapd->ucode.idx); - - val = uc_resource_new(iface_type, hapd); - hapd->ucode.idx = wpa_ucode_registry_add(iface_registry, val); - - return val; -} - -static void -hostapd_ucode_update_bss_list(struct hostapd_iface *iface, uc_value_t *if_bss, uc_value_t *bss) -{ - uc_value_t *list; - int i; - - list = ucv_array_new(vm); - for (i = 0; iface->bss && i < iface->num_bss; i++) { - struct hostapd_data *hapd = iface->bss[i]; - uc_value_t *val = hostapd_ucode_bss_get_uval(hapd); - - ucv_array_set(list, i, ucv_get(ucv_string_new(hapd->conf->iface))); - ucv_object_add(bss, hapd->conf->iface, ucv_get(val)); - } - ucv_object_add(if_bss, iface->phy, ucv_get(list)); -} - -static void -hostapd_ucode_update_interfaces(void) -{ - uc_value_t *ifs = ucv_object_new(vm); - uc_value_t *if_bss = ucv_array_new(vm); - uc_value_t *bss = ucv_object_new(vm); - int i; - - for (i = 0; i < interfaces->count; i++) { - struct hostapd_iface *iface = interfaces->iface[i]; - - ucv_object_add(ifs, iface->phy, ucv_get(hostapd_ucode_iface_get_uval(iface))); - hostapd_ucode_update_bss_list(iface, if_bss, bss); - } - - ucv_object_add(ucv_prototype_get(global), "interfaces", ucv_get(ifs)); - ucv_object_add(ucv_prototype_get(global), "interface_bss", ucv_get(if_bss)); - ucv_object_add(ucv_prototype_get(global), "bss", ucv_get(bss)); - ucv_gc(vm); -} - -static uc_value_t * -uc_hostapd_add_iface(uc_vm_t *vm, size_t nargs) -{ - uc_value_t *iface = uc_fn_arg(0); - char *data; - int ret; - - if (ucv_type(iface) != UC_STRING) - return ucv_int64_new(-1); - - data = strdup(ucv_string_get(iface)); - ret = hostapd_add_iface(interfaces, data); - free(data); - - hostapd_ucode_update_interfaces(); - - return ucv_int64_new(ret); -} - -static uc_value_t * -uc_hostapd_remove_iface(uc_vm_t *vm, size_t nargs) -{ - uc_value_t *iface = uc_fn_arg(0); - - if (ucv_type(iface) != UC_STRING) - return NULL; - - hostapd_remove_iface(interfaces, ucv_string_get(iface)); - hostapd_ucode_update_interfaces(); - - return NULL; -} - -static struct hostapd_vlan * -bss_conf_find_vlan(struct hostapd_bss_config *bss, int id) -{ - struct hostapd_vlan *vlan; - - for (vlan = bss->vlan; vlan; vlan = vlan->next) - if (vlan->vlan_id == id) - return vlan; - - return NULL; -} - -static int -bss_conf_rename_vlan(struct hostapd_data *hapd, struct hostapd_vlan *vlan, - const char *ifname) -{ - if (!strcmp(ifname, vlan->ifname)) - return 0; - - hostapd_drv_if_rename(hapd, WPA_IF_AP_VLAN, vlan->ifname, ifname); - os_strlcpy(vlan->ifname, ifname, sizeof(vlan->ifname)); - - return 0; -} - -static int -bss_reload_vlans(struct hostapd_data *hapd, struct hostapd_bss_config *bss) -{ - struct hostapd_bss_config *old_bss = hapd->conf; - struct hostapd_vlan *vlan, *vlan_new, *wildcard; - char ifname[IFNAMSIZ + 1], vlan_ifname[IFNAMSIZ + 1], *pos; - int ret; - - vlan = bss_conf_find_vlan(old_bss, VLAN_ID_WILDCARD); - wildcard = bss_conf_find_vlan(bss, VLAN_ID_WILDCARD); - if (!!vlan != !!wildcard) - return -1; - - if (vlan && wildcard && strcmp(vlan->ifname, wildcard->ifname) != 0) - strcpy(vlan->ifname, wildcard->ifname); - else - wildcard = NULL; - - for (vlan = bss->vlan; vlan; vlan = vlan->next) { - if (vlan->vlan_id == VLAN_ID_WILDCARD || - vlan->dynamic_vlan > 0) - continue; - - if (!bss_conf_find_vlan(old_bss, vlan->vlan_id)) - return -1; - } - - for (vlan = old_bss->vlan; vlan; vlan = vlan->next) { - if (vlan->vlan_id == VLAN_ID_WILDCARD) - continue; - - if (vlan->dynamic_vlan == 0) { - vlan_new = bss_conf_find_vlan(bss, vlan->vlan_id); - if (!vlan_new) - return -1; - - if (bss_conf_rename_vlan(hapd, vlan, vlan_new->ifname)) - return -1; - - continue; - } - - if (!wildcard) - continue; - - os_strlcpy(ifname, wildcard->ifname, sizeof(ifname)); - pos = os_strchr(ifname, '#'); - if (!pos) - return -1; - - *pos++ = '\0'; - ret = os_snprintf(vlan_ifname, sizeof(vlan_ifname), "%s%d%s", - ifname, vlan->vlan_id, pos); - if (os_snprintf_error(sizeof(vlan_ifname), ret)) - return -1; - - if (bss_conf_rename_vlan(hapd, vlan, vlan_ifname)) - return -1; - } - - return 0; -} - -static uc_value_t * -uc_hostapd_bss_set_config(uc_vm_t *vm, size_t nargs) -{ - struct hostapd_data *hapd = uc_fn_thisval("hostapd.bss"); - struct hostapd_bss_config *old_bss; - struct hostapd_iface *iface; - struct hostapd_config *conf; - uc_value_t *file = uc_fn_arg(0); - uc_value_t *index = uc_fn_arg(1); - uc_value_t *files_only = uc_fn_arg(2); - unsigned int i, idx = 0; - int ret = -1; - - if (!hapd || ucv_type(file) != UC_STRING) - goto out; - - if (ucv_type(index) == UC_INTEGER) - idx = ucv_int64_get(index); - - iface = hapd->iface; - conf = interfaces->config_read_cb(ucv_string_get(file)); - if (!conf) - goto out; - - if (idx > conf->num_bss || !conf->bss[idx]) - goto free; - - if (ucv_boolean_get(files_only)) { - struct hostapd_bss_config *bss = conf->bss[idx]; - struct hostapd_bss_config *old_bss = hapd->conf; - -#define swap_field(name) \ - do { \ - void *ptr = old_bss->name; \ - old_bss->name = bss->name; \ - bss->name = ptr; \ - } while (0) - - swap_field(ssid.wpa_psk_file); - ret = bss_reload_vlans(hapd, bss); - goto done; - } - - hostapd_bss_deinit_no_free(hapd); - hostapd_drv_stop_ap(hapd); - hostapd_free_hapd_data(hapd); - - old_bss = hapd->conf; - for (i = 0; i < iface->conf->num_bss; i++) - if (iface->conf->bss[i] == hapd->conf) - iface->conf->bss[i] = conf->bss[idx]; - hapd->conf = conf->bss[idx]; - conf->bss[idx] = old_bss; - - hostapd_setup_bss(hapd, hapd == iface->bss[0], true); - hostapd_ucode_update_interfaces(); - -done: - ret = 0; -free: - hostapd_config_free(conf); -out: - return ucv_int64_new(ret); -} - -static void -hostapd_remove_iface_bss_conf(struct hostapd_config *iconf, - struct hostapd_bss_config *conf) -{ - int i; - - for (i = 0; i < iconf->num_bss; i++) - if (iconf->bss[i] == conf) - break; - - if (i == iconf->num_bss) - return; - - for (i++; i < iconf->num_bss; i++) - iconf->bss[i - 1] = iconf->bss[i]; - iconf->num_bss--; -} - - -static uc_value_t * -uc_hostapd_bss_delete(uc_vm_t *vm, size_t nargs) -{ - struct hostapd_data *hapd = uc_fn_thisval("hostapd.bss"); - struct hostapd_iface *iface; - int i, idx; - - if (!hapd) - return NULL; - - iface = hapd->iface; - if (iface->num_bss == 1) { - wpa_printf(MSG_ERROR, "trying to delete last bss of an iface: %s\n", hapd->conf->iface); - return NULL; - } - - for (idx = 0; idx < iface->num_bss; idx++) - if (iface->bss[idx] == hapd) - break; - - if (idx == iface->num_bss) - return NULL; - - for (i = idx + 1; i < iface->num_bss; i++) - iface->bss[i - 1] = iface->bss[i]; - - iface->num_bss--; - - iface->bss[0]->interface_added = 0; - hostapd_drv_set_first_bss(iface->bss[0]); - hapd->interface_added = 1; - - hostapd_drv_stop_ap(hapd); - hostapd_bss_deinit(hapd); - hostapd_remove_iface_bss_conf(iface->conf, hapd->conf); - hostapd_config_free_bss(hapd->conf); - os_free(hapd); - - hostapd_ucode_update_interfaces(); - ucv_gc(vm); - - return NULL; -} - -static uc_value_t * -uc_hostapd_iface_add_bss(uc_vm_t *vm, size_t nargs) -{ - struct hostapd_iface *iface = uc_fn_thisval("hostapd.iface"); - struct hostapd_bss_config *bss; - struct hostapd_config *conf; - struct hostapd_data *hapd; - uc_value_t *file = uc_fn_arg(0); - uc_value_t *index = uc_fn_arg(1); - unsigned int idx = 0; - uc_value_t *ret = NULL; - - if (!iface || ucv_type(file) != UC_STRING) - goto out; - - if (ucv_type(index) == UC_INTEGER) - idx = ucv_int64_get(index); - - conf = interfaces->config_read_cb(ucv_string_get(file)); - if (!conf || idx > conf->num_bss || !conf->bss[idx]) - goto out; - - bss = conf->bss[idx]; - hapd = hostapd_alloc_bss_data(iface, iface->conf, bss); - if (!hapd) - goto out; - - hapd->driver = iface->bss[0]->driver; - hapd->drv_priv = iface->bss[0]->drv_priv; - if (interfaces->ctrl_iface_init && - interfaces->ctrl_iface_init(hapd) < 0) - goto free_hapd; - - if (iface->state == HAPD_IFACE_ENABLED && - hostapd_setup_bss(hapd, -1, true)) - goto deinit_ctrl; - - iface->bss = os_realloc_array(iface->bss, iface->num_bss + 1, - sizeof(*iface->bss)); - iface->bss[iface->num_bss++] = hapd; - - iface->conf->bss = os_realloc_array(iface->conf->bss, - iface->conf->num_bss + 1, - sizeof(*iface->conf->bss)); - iface->conf->bss[iface->conf->num_bss] = bss; - conf->bss[idx] = NULL; - ret = hostapd_ucode_bss_get_uval(hapd); - hostapd_ucode_update_interfaces(); - goto out; - -deinit_ctrl: - if (interfaces->ctrl_iface_deinit) - interfaces->ctrl_iface_deinit(hapd); -free_hapd: - hostapd_free_hapd_data(hapd); - os_free(hapd); -out: - hostapd_config_free(conf); - return ret; -} - -static uc_value_t * -uc_hostapd_iface_set_bss_order(uc_vm_t *vm, size_t nargs) -{ - struct hostapd_iface *iface = uc_fn_thisval("hostapd.iface"); - uc_value_t *bss_list = uc_fn_arg(0); - struct hostapd_data **new_bss; - struct hostapd_bss_config **new_conf; - - if (!iface) - return NULL; - - if (ucv_type(bss_list) != UC_ARRAY || - ucv_array_length(bss_list) != iface->num_bss) - return NULL; - - new_bss = calloc(iface->num_bss, sizeof(*new_bss)); - new_conf = calloc(iface->num_bss, sizeof(*new_conf)); - for (size_t i = 0; i < iface->num_bss; i++) { - struct hostapd_data *bss; - - bss = ucv_resource_data(ucv_array_get(bss_list, i), "hostapd.bss"); - if (bss->iface != iface) - goto free; - - for (size_t k = 0; k < i; k++) - if (new_bss[k] == bss) - goto free; - - new_bss[i] = bss; - new_conf[i] = bss->conf; - } - - new_bss[0]->interface_added = 0; - for (size_t i = 1; i < iface->num_bss; i++) - new_bss[i]->interface_added = 1; - - free(iface->bss); - iface->bss = new_bss; - - free(iface->conf->bss); - iface->conf->bss = new_conf; - iface->conf->num_bss = iface->num_bss; - hostapd_drv_set_first_bss(iface->bss[0]); - - return ucv_boolean_new(true); - -free: - free(new_bss); - free(new_conf); - return NULL; -} - -static uc_value_t * -uc_hostapd_bss_ctrl(uc_vm_t *vm, size_t nargs) -{ - struct hostapd_data *hapd = uc_fn_thisval("hostapd.bss"); - uc_value_t *arg = uc_fn_arg(0); - struct sockaddr_storage from = {}; - static char reply[4096]; - int reply_len; - - if (!hapd || !interfaces->ctrl_iface_recv || - ucv_type(arg) != UC_STRING) - return NULL; - - reply_len = interfaces->ctrl_iface_recv(hapd, ucv_string_get(arg), - reply, sizeof(reply), - &from, sizeof(from)); - if (reply_len < 0) - return NULL; - - if (reply_len && reply[reply_len - 1] == '\n') - reply_len--; - - return ucv_string_new_length(reply, reply_len); -} - -static void -uc_hostapd_disable_iface(struct hostapd_iface *iface) -{ - switch (iface->state) { - case HAPD_IFACE_DISABLED: - break; -#ifdef CONFIG_ACS - case HAPD_IFACE_ACS: - acs_cleanup(iface); - iface->scan_cb = NULL; - /* fallthrough */ -#endif - default: - hostapd_disable_iface(iface); - break; - } -} - -static uc_value_t * -uc_hostapd_iface_stop(uc_vm_t *vm, size_t nargs) -{ - struct hostapd_iface *iface = uc_fn_thisval("hostapd.iface"); - int i; - - if (!iface) - return NULL; - - if (iface->state != HAPD_IFACE_ENABLED) - uc_hostapd_disable_iface(iface); - - for (i = 0; i < iface->num_bss; i++) { - struct hostapd_data *hapd = iface->bss[i]; - - hostapd_drv_stop_ap(hapd); - hapd->beacon_set_done = 0; - } - - return NULL; -} - -static uc_value_t * -uc_hostapd_iface_start(uc_vm_t *vm, size_t nargs) -{ - struct hostapd_iface *iface = uc_fn_thisval("hostapd.iface"); - uc_value_t *info = uc_fn_arg(0); - struct hostapd_config *conf; - bool changed = false; - uint64_t intval; - int i; - - if (!iface) - return NULL; - - if (!info) { - iface->freq = 0; - goto out; - } - - if (ucv_type(info) != UC_OBJECT) - return NULL; - -#define UPDATE_VAL(field, name) \ - if ((intval = ucv_int64_get(ucv_object_get(info, name, NULL))) && \ - !errno && intval != conf->field) do { \ - conf->field = intval; \ - changed = true; \ - } while(0) - - conf = iface->conf; - UPDATE_VAL(op_class, "op_class"); - UPDATE_VAL(hw_mode, "hw_mode"); - UPDATE_VAL(channel, "channel"); - UPDATE_VAL(secondary_channel, "sec_channel"); - if (!changed && - (iface->bss[0]->beacon_set_done || - iface->state == HAPD_IFACE_DFS)) - return ucv_boolean_new(true); - - intval = ucv_int64_get(ucv_object_get(info, "center_seg0_idx", NULL)); - if (!errno) - hostapd_set_oper_centr_freq_seg0_idx(conf, intval); - - intval = ucv_int64_get(ucv_object_get(info, "center_seg1_idx", NULL)); - if (!errno) - hostapd_set_oper_centr_freq_seg1_idx(conf, intval); - - intval = ucv_int64_get(ucv_object_get(info, "oper_chwidth", NULL)); - if (!errno) - hostapd_set_oper_chwidth(conf, intval); - - intval = ucv_int64_get(ucv_object_get(info, "frequency", NULL)); - if (!errno) - iface->freq = intval; - else - iface->freq = 0; - conf->acs = 0; - -out: - switch (iface->state) { - case HAPD_IFACE_ENABLED: - if (!hostapd_is_dfs_required(iface) || - hostapd_is_dfs_chan_available(iface)) - break; - wpa_printf(MSG_INFO, "DFS CAC required on new channel, restart interface"); - /* fallthrough */ - default: - uc_hostapd_disable_iface(iface); - break; - } - - if (conf->channel && !iface->freq) - iface->freq = hostapd_hw_get_freq(iface->bss[0], conf->channel); - - if (iface->state != HAPD_IFACE_ENABLED) { - hostapd_enable_iface(iface); - return ucv_boolean_new(true); - } - - for (i = 0; i < iface->num_bss; i++) { - struct hostapd_data *hapd = iface->bss[i]; - int ret; - - hapd->conf->start_disabled = 0; - hostapd_set_freq(hapd, conf->hw_mode, iface->freq, - conf->channel, - conf->enable_edmg, - conf->edmg_channel, - conf->ieee80211n, - conf->ieee80211ac, - conf->ieee80211ax, - conf->ieee80211be, - conf->secondary_channel, - hostapd_get_oper_chwidth(conf), - hostapd_get_oper_centr_freq_seg0_idx(conf), - hostapd_get_oper_centr_freq_seg1_idx(conf)); - - ieee802_11_set_beacon(hapd); - } - - return ucv_boolean_new(true); -} - -static uc_value_t * -uc_hostapd_iface_switch_channel(uc_vm_t *vm, size_t nargs) -{ - struct hostapd_iface *iface = uc_fn_thisval("hostapd.iface"); - uc_value_t *info = uc_fn_arg(0); - struct hostapd_config *conf; - struct csa_settings csa = {}; - uint64_t intval; - int i, ret = 0; - - if (!iface || ucv_type(info) != UC_OBJECT) - return NULL; - - conf = iface->conf; - if ((intval = ucv_int64_get(ucv_object_get(info, "csa_count", NULL))) && !errno) - csa.cs_count = intval; - if ((intval = ucv_int64_get(ucv_object_get(info, "sec_channel", NULL))) && !errno) - csa.freq_params.sec_channel_offset = intval; - - csa.freq_params.ht_enabled = conf->ieee80211n; - csa.freq_params.vht_enabled = conf->ieee80211ac; - csa.freq_params.he_enabled = conf->ieee80211ax; -#ifdef CONFIG_IEEE80211BE - csa.freq_params.eht_enabled = conf->ieee80211be; -#endif - intval = ucv_int64_get(ucv_object_get(info, "oper_chwidth", NULL)); - if (errno) - intval = hostapd_get_oper_chwidth(conf); - if (intval) - csa.freq_params.bandwidth = 40 << intval; - else - csa.freq_params.bandwidth = csa.freq_params.sec_channel_offset ? 40 : 20; - - if ((intval = ucv_int64_get(ucv_object_get(info, "frequency", NULL))) && !errno) - csa.freq_params.freq = intval; - if ((intval = ucv_int64_get(ucv_object_get(info, "center_freq1", NULL))) && !errno) - csa.freq_params.center_freq1 = intval; - if ((intval = ucv_int64_get(ucv_object_get(info, "center_freq2", NULL))) && !errno) - csa.freq_params.center_freq2 = intval; - - for (i = 0; i < iface->num_bss; i++) - ret = hostapd_switch_channel(iface->bss[i], &csa); - - return ucv_boolean_new(!ret); -} - -static uc_value_t * -uc_hostapd_bss_rename(uc_vm_t *vm, size_t nargs) -{ - struct hostapd_data *hapd = uc_fn_thisval("hostapd.bss"); - uc_value_t *ifname_arg = uc_fn_arg(0); - char prev_ifname[IFNAMSIZ + 1]; - struct sta_info *sta; - const char *ifname; - int ret; - - if (!hapd || ucv_type(ifname_arg) != UC_STRING) - return NULL; - - os_strlcpy(prev_ifname, hapd->conf->iface, sizeof(prev_ifname)); - ifname = ucv_string_get(ifname_arg); - - hostapd_ubus_free_bss(hapd); - if (interfaces->ctrl_iface_deinit) - interfaces->ctrl_iface_deinit(hapd); - - ret = hostapd_drv_if_rename(hapd, WPA_IF_AP_BSS, NULL, ifname); - if (ret) - goto out; - - for (sta = hapd->sta_list; sta; sta = sta->next) { - char cur_name[IFNAMSIZ + 1], new_name[IFNAMSIZ + 1]; - - if (!(sta->flags & WLAN_STA_WDS) || sta->pending_wds_enable) - continue; - - snprintf(cur_name, sizeof(cur_name), "%s.sta%d", prev_ifname, sta->aid); - snprintf(new_name, sizeof(new_name), "%s.sta%d", ifname, sta->aid); - hostapd_drv_if_rename(hapd, WPA_IF_AP_VLAN, cur_name, new_name); - } - - if (!strncmp(hapd->conf->ssid.vlan, hapd->conf->iface, sizeof(hapd->conf->ssid.vlan))) - os_strlcpy(hapd->conf->ssid.vlan, ifname, sizeof(hapd->conf->ssid.vlan)); - os_strlcpy(hapd->conf->iface, ifname, sizeof(hapd->conf->iface)); - hostapd_ubus_add_bss(hapd); - - hostapd_ucode_update_interfaces(); -out: - if (interfaces->ctrl_iface_init) - interfaces->ctrl_iface_init(hapd); - - return ret ? NULL : ucv_boolean_new(true); -} - - -int hostapd_ucode_init(struct hapd_interfaces *ifaces) -{ - static const uc_function_list_t global_fns[] = { - { "printf", uc_wpa_printf }, - { "getpid", uc_wpa_getpid }, - { "sha1", uc_wpa_sha1 }, - { "freq_info", uc_wpa_freq_info }, - { "add_iface", uc_hostapd_add_iface }, - { "remove_iface", uc_hostapd_remove_iface }, - { "udebug_set", uc_wpa_udebug_set }, - }; - static const uc_function_list_t bss_fns[] = { - { "ctrl", uc_hostapd_bss_ctrl }, - { "set_config", uc_hostapd_bss_set_config }, - { "rename", uc_hostapd_bss_rename }, - { "delete", uc_hostapd_bss_delete }, - }; - static const uc_function_list_t iface_fns[] = { - { "set_bss_order", uc_hostapd_iface_set_bss_order }, - { "add_bss", uc_hostapd_iface_add_bss }, - { "stop", uc_hostapd_iface_stop }, - { "start", uc_hostapd_iface_start }, - { "switch_channel", uc_hostapd_iface_switch_channel }, - }; - uc_value_t *data, *proto; - - interfaces = ifaces; - vm = wpa_ucode_create_vm(); - - global_type = uc_type_declare(vm, "hostapd.global", global_fns, NULL); - bss_type = uc_type_declare(vm, "hostapd.bss", bss_fns, NULL); - iface_type = uc_type_declare(vm, "hostapd.iface", iface_fns, NULL); - - bss_registry = ucv_array_new(vm); - uc_vm_registry_set(vm, "hostap.bss_registry", bss_registry); - - iface_registry = ucv_array_new(vm); - uc_vm_registry_set(vm, "hostap.iface_registry", iface_registry); - - global = wpa_ucode_global_init("hostapd", global_type); - - if (wpa_ucode_run(HOSTAPD_UC_PATH "hostapd.uc")) - goto free_vm; - ucv_gc(vm); - - return 0; - -free_vm: - wpa_ucode_free_vm(); - return -1; -} - -void hostapd_ucode_free(void) -{ - if (wpa_ucode_call_prepare("shutdown") == 0) - ucv_put(wpa_ucode_call(0)); - wpa_ucode_free_vm(); -} - -void hostapd_ucode_free_iface(struct hostapd_iface *iface) -{ - wpa_ucode_registry_remove(iface_registry, iface->ucode.idx); -} - -void hostapd_ucode_add_bss(struct hostapd_data *hapd) -{ - uc_value_t *val; - - if (wpa_ucode_call_prepare("bss_add")) - return; - - val = hostapd_ucode_bss_get_uval(hapd); - uc_value_push(ucv_get(ucv_string_new(hapd->conf->iface))); - uc_value_push(ucv_get(val)); - ucv_put(wpa_ucode_call(2)); - ucv_gc(vm); -} - -void hostapd_ucode_reload_bss(struct hostapd_data *hapd) -{ - uc_value_t *val; - - if (wpa_ucode_call_prepare("bss_reload")) - return; - - val = hostapd_ucode_bss_get_uval(hapd); - uc_value_push(ucv_get(ucv_string_new(hapd->conf->iface))); - uc_value_push(ucv_get(val)); - ucv_put(wpa_ucode_call(2)); - ucv_gc(vm); -} - -void hostapd_ucode_free_bss(struct hostapd_data *hapd) -{ - uc_value_t *val; - - val = wpa_ucode_registry_remove(bss_registry, hapd->ucode.idx); - if (!val) - return; - - hapd->ucode.idx = 0; - if (wpa_ucode_call_prepare("bss_remove")) - return; - - uc_value_push(ucv_string_new(hapd->conf->iface)); - uc_value_push(ucv_get(val)); - ucv_put(wpa_ucode_call(2)); - ucv_gc(vm); -} diff --git a/package/network/services/hostapd/src/src/utils/ap/ucode.h b/package/network/services/hostapd/src/src/utils/ap/ucode.h deleted file mode 100644 index d00b787169d104..00000000000000 --- a/package/network/services/hostapd/src/src/utils/ap/ucode.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef __HOSTAPD_AP_UCODE_H -#define __HOSTAPD_AP_UCODE_H - -#include "utils/ucode.h" - -struct hostapd_data; - -struct hostapd_ucode_bss { -#ifdef UCODE_SUPPORT - int idx; -#endif -}; - -struct hostapd_ucode_iface { -#ifdef UCODE_SUPPORT - int idx; -#endif -}; - -#ifdef UCODE_SUPPORT - -int hostapd_ucode_init(struct hapd_interfaces *ifaces); - -void hostapd_ucode_free(void); -void hostapd_ucode_free_iface(struct hostapd_iface *iface); -void hostapd_ucode_add_bss(struct hostapd_data *hapd); -void hostapd_ucode_free_bss(struct hostapd_data *hapd); -void hostapd_ucode_reload_bss(struct hostapd_data *hapd); - -#else - -static inline int hostapd_ucode_init(struct hapd_interfaces *ifaces) -{ - return -EINVAL; -} -static inline void hostapd_ucode_free(void) -{ -} -static inline void hostapd_ucode_free_iface(struct hostapd_iface *iface) -{ -} -static inline void hostapd_ucode_reload_bss(struct hostapd_data *hapd) -{ -} -static inline void hostapd_ucode_add_bss(struct hostapd_data *hapd) -{ -} -static inline void hostapd_ucode_free_bss(struct hostapd_data *hapd) -{ -} - -#endif - -#endif From 34c71514f9196b2c3742c22006e0527b89fe3da3 Mon Sep 17 00:00:00 2001 From: Rudy Andram Date: Wed, 18 Sep 2024 07:16:06 +0100 Subject: [PATCH 21/40] bump rpcd and iwinfo to support 11be --- .../files/lib/netifd/wireless/mac80211.sh | 422 ++++-- .../files/lib/netifd/wireless/mac80211.sh.old | 1230 +++++++++++++++++ package/network/utils/iwinfo/Makefile | 10 +- package/system/rpcd/Makefile | 10 +- 4 files changed, 1543 insertions(+), 129 deletions(-) create mode 100755 package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh.old diff --git a/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh b/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh index d32cdceeb9c46f..8129022933ce2f 100755 --- a/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh +++ b/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh @@ -29,10 +29,12 @@ drv_mac80211_init_device_config() { config_add_string path phy 'macaddr:macaddr' config_add_string tx_burst config_add_string distance + config_add_int mbssid mu_onoff sr_enable sr_enhanced rnr obss_interval config_add_int beacon_int chanbw frag rts config_add_int rxantenna txantenna txpower min_tx_power config_add_int num_global_macaddr multiple_bssid config_add_boolean noscan ht_coex acs_exclude_dfs background_radar + config_add_boolean noscan ht_coex acs_exclude_dfs background_radar background_cert_mode config_add_array ht_capab config_add_array channels config_add_array scan_list @@ -55,7 +57,10 @@ drv_mac80211_init_device_config() { he_spr_sr_control \ he_spr_psr_enabled \ he_bss_color_enabled \ - he_twt_required + he_twt_required \ + he_twt_responder \ + etxbfen \ + itxbfen config_add_int \ beamformer_antennas \ beamformee_antennas \ @@ -142,13 +147,11 @@ mac80211_hostapd_setup_base() { [ -n "$acs_exclude_dfs" ] && [ "$acs_exclude_dfs" -gt 0 ] && append base_cfg "acs_exclude_dfs=1" "$N" - json_get_vars noscan ht_coex min_tx_power:0 tx_burst + json_get_vars noscan ht_coex min_tx_power:0 tx_burst mbssid mu_onoff rnr obss_interval + json_get_vars etxbfen:1 itxbfen:0 json_get_values ht_capab_list ht_capab json_get_values channel_list channels - [ "$auto_channel" = 0 ] && [ -z "$channel_list" ] && \ - channel_list="$channel" - [ "$min_tx_power" -gt 0 ] && append base_cfg "min_tx_power=$min_tx_power" "$N" set_default noscan 0 @@ -159,79 +162,102 @@ mac80211_hostapd_setup_base() { chan_ofs=0 [ "$band" = "6g" ] && chan_ofs=1 - if [ "$band" != "6g" ]; then - ieee80211n=1 - ht_capab= - case "$htmode" in - VHT20|HT20|HE20|EHT20) ;; - HT40*|VHT40|VHT80|VHT160|HE40|HE80|HE160|EHT40|EHT80|EHT160) - case "$hwmode" in - a) - case "$(( (($channel / 4) + $chan_ofs) % 2 ))" in - 1) ht_capab="[HT40+]";; - 0) ht_capab="[HT40-]";; - esac - ;; - *) - case "$htmode" in - HT40+) ht_capab="[HT40+]";; - HT40-) ht_capab="[HT40-]";; - *) - if [ "$channel" -lt 7 ]; then - ht_capab="[HT40+]" - else - ht_capab="[HT40-]" - fi - ;; - esac - ;; - esac - [ "$auto_channel" -gt 0 ] && ht_capab="[HT40+]" - ;; - *) ieee80211n= ;; - esac + ieee80211n=1 + ht_capab= + case "$htmode" in + VHT20|HT20|HE20|EHT20) ;; + HT40*|VHT40|VHT80|VHT160|HE40*|HE80|HE160|EHT40*|EHT80|EHT160|EHT320*) + case "$hwmode" in + a) + case "$(( (($channel / 4) + $chan_ofs) % 2 ))" in + 1) ht_capab="[HT40+]";; + 0) ht_capab="[HT40-]";; + esac + case "$htmode" in + HT40-|HE40-|EHT40-) + if [ "$auto_channel" -gt 0 ]; then + ht_capab="[HT40-]" + fi + ;; + esac + ;; + *) + case "$htmode" in + HT40+|HE40+|EHT40+) + if [ "$channel" -gt 9 ]; then + echo "Could not set the center freq with this HT mode setting" + return 1 + else + ht_capab="[HT40+]" + fi + ;; + HT40-|HE40-|EHT40-) + if [ "$channel" -lt 5 -a "$auto_channel" -eq 0 ]; then + echo "Could not set the center freq with this HT mode setting" + return 1 + else + ht_capab="[HT40-]" + fi + ;; + *) + if [ "$channel" -lt 7 -o "$auto_channel" -gt 0 ]; then + ht_capab="[HT40+]" + else + ht_capab="[HT40-]" + fi + ;; + esac + ;; + esac + ;; + *) ieee80211n= ;; + esac + + [ -n "$ieee80211n" ] && { + append base_cfg "ieee80211n=1" "$N" - [ -n "$ieee80211n" ] && { - append base_cfg "ieee80211n=1" "$N" - - set_default ht_coex 0 - append base_cfg "ht_coex=$ht_coex" "$N" - - json_get_vars \ - ldpc:1 \ - greenfield:0 \ - short_gi_20:1 \ - short_gi_40:1 \ - tx_stbc:1 \ - rx_stbc:3 \ - max_amsdu:1 \ - dsss_cck_40:1 - - ht_cap_mask=0 - for cap in $(iw phy "$phy" info | grep 'Capabilities:' | cut -d: -f2); do - ht_cap_mask="$(($ht_cap_mask | $cap))" - done - - cap_rx_stbc=$((($ht_cap_mask >> 8) & 3)) - [ "$rx_stbc" -lt "$cap_rx_stbc" ] && cap_rx_stbc="$rx_stbc" - ht_cap_mask="$(( ($ht_cap_mask & ~(0x300)) | ($cap_rx_stbc << 8) ))" - - mac80211_add_capabilities ht_capab_flags $ht_cap_mask \ - LDPC:0x1::$ldpc \ - GF:0x10::$greenfield \ - SHORT-GI-20:0x20::$short_gi_20 \ - SHORT-GI-40:0x40::$short_gi_40 \ - TX-STBC:0x80::$tx_stbc \ - RX-STBC1:0x300:0x100:1 \ - RX-STBC12:0x300:0x200:1 \ - RX-STBC123:0x300:0x300:1 \ - MAX-AMSDU-7935:0x800::$max_amsdu \ - DSSS_CCK-40:0x1000::$dsss_cck_40 - - ht_capab="$ht_capab$ht_capab_flags" - [ -n "$ht_capab" ] && append base_cfg "ht_capab=$ht_capab" "$N" + set_default ht_coex 0 + append base_cfg "ht_coex=$ht_coex" "$N" + + [ "$ht_coex" -eq 1 ] && { + set_default obss_interval 300 + append base_cfg "obss_interval=$obss_interval" "$N" } - fi + + json_get_vars \ + ldpc:1 \ + greenfield:0 \ + short_gi_20:1 \ + short_gi_40:1 \ + tx_stbc:1 \ + rx_stbc:3 \ + max_amsdu:1 \ + dsss_cck_40:1 + + ht_cap_mask=0 + for cap in $(iw phy "$phy" info | grep 'Capabilities: 0x' | cut -d: -f2); do + ht_cap_mask="$(($ht_cap_mask | $cap))" + done + + cap_rx_stbc=$((($ht_cap_mask >> 8) & 3)) + [ "$rx_stbc" -lt "$cap_rx_stbc" ] && cap_rx_stbc="$rx_stbc" + ht_cap_mask="$(( ($ht_cap_mask & ~(0x300)) | ($cap_rx_stbc << 8) ))" + + mac80211_add_capabilities ht_capab_flags $ht_cap_mask \ + LDPC:0x1::$ldpc \ + GF:0x10::$greenfield \ + SHORT-GI-20:0x20::$short_gi_20 \ + SHORT-GI-40:0x40::$short_gi_40 \ + TX-STBC:0x80::$tx_stbc \ + RX-STBC1:0x300:0x100:1 \ + RX-STBC12:0x300:0x200:1 \ + RX-STBC123:0x300:0x300:1 \ + MAX-AMSDU-7935:0x800::$max_amsdu \ + DSSS_CCK-40:0x1000::$dsss_cck_40 + + ht_capab="$ht_capab$ht_capab_flags" + [ -n "$ht_capab" ] && append base_cfg "ht_capab=$ht_capab" "$N" + } # 802.11ac enable_ac=0 @@ -260,7 +286,7 @@ mac80211_hostapd_setup_base() { vht_oper_chwidth=1 vht_center_seg0=$idx ;; - VHT160|HE160|EHT160|EHT320) + VHT160|HE160|EHT160) if [ "$band" = "6g" ]; then case "$channel" in 1|5|9|13|17|21|25|29) idx=15;; @@ -282,38 +308,61 @@ mac80211_hostapd_setup_base() { vht_oper_chwidth=2 vht_center_seg0=$idx ;; + EHT320*) + case "$channel" in + 1|5|9|13|17|21|25|29) idx=31;; + 33|37|41|45|49|53|57|61| \ + 65|69|73|77|81|85|89|93) idx=63;; + 97|101|105|109|113|117|121|125| \ + 129|133|137|141|145|149|153|157) idx=127;; + 161|165|169|173|177|181|185|189| \ + 193|197|201|205|209|213|217|221) idx=191;; + esac + if [[ "$htmode" = "EHT320-1" && "$channel" -ge "193" ]] || + [[ "$htmode" = "EHT320-2" && "$channel" -le "29" ]]; then + echo "Could not set the center freq with this EHT setting" + return 1 + elif [[ "$htmode" = "EHT320-1" && "$channel" -ge "33" ]]; then + if [ "$channel" -gt $idx ]; then + idx=$(($idx + 32)) + else + idx=$(($idx - 32)) + fi + fi + vht_oper_chwidth=2 + if [ "$channel" -gt $idx ]; then + vht_center_seg0=$(($idx + 16)) + else + vht_center_seg0=$(($idx - 16)) + fi + eht_oper_chwidth=9 + eht_oper_centr_freq_seg0_idx=$idx + + case $htmode in + EHT320-1) eht_bw320_offset=1;; + EHT320-2) eht_bw320_offset=2;; + EHT320) eht_bw320_offset=0;; + esac + ;; esac [ "$band" = "5g" ] && { - json_get_vars background_radar:0 + json_get_vars \ + background_radar:0 \ + background_cert_mode:0 \ [ "$background_radar" -eq 1 ] && append base_cfg "enable_background_radar=1" "$N" + [ "$background_cert_mode" -eq 1 ] && append base_cfg "background_radar_mode=1" "$N" } - - eht_oper_chwidth=$vht_oper_chwidth - eht_center_seg0=$vht_center_seg0 - [ "$band" = "6g" ] && { op_class= case "$htmode" in HE20|EHT20) op_class=131;; - EHT320) - case "$channel" in - 1|5|9|13|17|21|25|29|33|37|41|45|49|53|57|61) idx=31;; - 65|69|73|77|81|85|89|93|97|101|105|109|113|117|121|125) idx=95;; - 129|133|137|141|145|149|153|157|161|165|169|173|177|181|185|189) idx=159;; - 193|197|201|205|209|213|217|221) idx=191;; - esac - - op_class=137 - eht_center_seg0=$idx - eht_oper_chwidth=9 - ;; - HE*|EHT*) op_class=$((132 + $vht_oper_chwidth));; + EHT320*) op_class=137;; + HE*|EHT*) op_class=$((132 + $vht_oper_chwidth)) esac [ -n "$op_class" ] && append base_cfg "op_class=$op_class" "$N" } [ "$hwmode" = "a" ] || enable_ac=0 - [ "$band" = "6g" ] && enable_ac=0 if [ "$enable_ac" != "0" ]; then json_get_vars \ @@ -337,7 +386,6 @@ mac80211_hostapd_setup_base() { vht_link_adapt:3 \ vht160:2 - set_default tx_burst 2.0 append base_cfg "ieee80211ac=1" "$N" vht_cap=0 for cap in $(iw phy "$phy" info | awk -F "[()]" '/VHT Capabilities/ { print $2 }'); do @@ -356,6 +404,12 @@ mac80211_hostapd_setup_base() { short_gi_160=0 } + [ "$etxbfen" -eq 0 ] && { + su_beamformer=0 + su_beamformee=0 + mu_beamformer=0 + } + mac80211_add_capabilities vht_capab $vht_cap \ RXLDPC:0x10::$rxldpc \ SHORT-GI-80:0x20::$short_gi_80 \ @@ -436,10 +490,8 @@ mac80211_hostapd_setup_base() { # 802.11ax enable_ax=0 - enable_be=0 case "$htmode" in - HE*) enable_ax=1 ;; - EHT*) enable_ax=1; enable_be=1 ;; + HE*|EHT*) enable_ax=1 ;; esac if [ "$enable_ax" != "0" ]; then @@ -448,10 +500,11 @@ mac80211_hostapd_setup_base() { he_su_beamformee:1 \ he_mu_beamformer:1 \ he_twt_required:0 \ + he_twt_responder \ he_spr_sr_control:3 \ he_spr_psr_enabled:0 \ he_spr_non_srg_obss_pd_max_offset:0 \ - he_bss_color:128 \ + he_bss_color \ he_bss_color_enabled:1 he_phy_cap=$(iw phy "$phy" info | sed -n '/HE Iftypes: .*AP/,$p' | awk -F "[()]" '/HE PHY Capabilities/ { print $2 }' | head -1) @@ -465,6 +518,11 @@ mac80211_hostapd_setup_base() { append base_cfg "he_oper_centr_freq_seg0_idx=$vht_center_seg0" "$N" } + [ "$etxbfen" -eq 0 ] && { + he_su_beamformer=0 + he_mu_beamformer=0 + } + 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 \ @@ -472,7 +530,14 @@ mac80211_hostapd_setup_base() { he_spr_psr_enabled:${he_phy_cap:14:2}:0x1:$he_spr_psr_enabled \ he_twt_required:${he_mac_cap:0:2}:0x6:$he_twt_required + if [ -n "$he_twt_responder" ]; then + append base_cfg "he_twt_responder=$he_twt_responder" "$N" + fi if [ "$he_bss_color_enabled" -gt 0 ]; then + if !([ "$he_bss_color" -gt 0 ] && [ "$he_bss_color" -le 64 ]); then + rand=$(head -n 1 /dev/urandom | tr -dc 0-9 | head -c 2) + he_bss_color=$((rand % 63 + 1)) + fi append base_cfg "he_bss_color=$he_bss_color" "$N" [ "$he_spr_non_srg_obss_pd_max_offset" -gt 0 ] && { \ append base_cfg "he_spr_non_srg_obss_pd_max_offset=$he_spr_non_srg_obss_pd_max_offset" "$N" @@ -491,45 +556,73 @@ mac80211_hostapd_setup_base() { 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_aifsn=0" "$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_be_timer=3" "$N" + append base_cfg "he_mu_edca_ac_bk_aifsn=0" "$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_bk_timer=3" "$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_aifsn=0" "$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_vi_timer=3" "$N" + append base_cfg "he_mu_edca_ac_vo_aifsn=0" "$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" + append base_cfg "he_mu_edca_ac_vo_timer=3" "$N" fi + set_default tx_burst 2 + + # 802.11be + enable_be=0 + case "$htmode" in + EHT*) enable_be=1 ;; + esac + if [ "$enable_be" != "0" ]; then append base_cfg "ieee80211be=1" "$N" - case "$htmode" in - EHT*) - append base_cfg "eht_oper_chwidth=$eht_oper_chwidth" "$N" - append base_cfg "eht_oper_centr_freq_seg0_idx=$eht_center_seg0" "$N" - append base_cfg "country3=0x49" "$N" - ;; - esac + if [ "$etxbfen" -eq 0 ]; then + append base_cfg "eht_su_beamformee=1" "$N" + else + append base_cfg "eht_su_beamformer=1" "$N" + append base_cfg "eht_su_beamformee=1" "$N" + append base_cfg "eht_mu_beamformer=1" "$N" + fi + [ "$hwmode" = "a" ] && { + case $htmode in + EHT320*) + append base_cfg "eht_oper_chwidth=$eht_oper_chwidth" "$N" + append base_cfg "eht_oper_centr_freq_seg0_idx=$eht_oper_centr_freq_seg0_idx" "$N" + append base_cfg "eht_bw320_offset=$eht_bw320_offset" "$N" + append base_cfg "acs_exclude_6ghz_non_psc=1" "$N" + ;; + *) + append base_cfg "eht_oper_chwidth=$vht_oper_chwidth" "$N" + append base_cfg "eht_oper_centr_freq_seg0_idx=$vht_center_seg0" "$N" + append base_cfg "acs_exclude_6ghz_non_psc=1" "$N" + ;; + esac + } fi + + append base_cfg "country3=0x49" "$N" + hostapd_prepare_device_config "$hostapd_conf_file" nl80211 cat >> "$hostapd_conf_file" <> /var/run/hostapd-$phy.conf < /dev/null return 0; @@ -1032,6 +1170,9 @@ mac80211_setup_vif() { json_select .. [ -n "$failed" ] || wireless_add_vif "$name" "$ifname" + + echo "Setup SMP Affinity" + /sbin/smp-mt76.sh } get_freq() { @@ -1083,6 +1224,25 @@ mac80211_reset_config() { wdev_tool "$phy" set_config '{}' } +mac80211_count_ap() { + total_num_ap=$(($total_num_ap + 1)) +} + +country_consistent_check() { + local i + inconsistent_country=0 + country_list="$(cat /etc/config/wireless | grep country | cut -d ' ' -f3 | tr -s "'\n" ' ')" + for i in $country_list + do + ret="$(echo $country_list | awk '{print ($2 == "" || $1 == $2)}')" + [ $ret = '0' ] && { + inconsistent_country=1 + return + } + country_list="$(echo $country_list | sed -r 's/[A-Z]{2}( )*//')" + done +} + drv_mac80211_setup() { json_select config json_get_vars \ @@ -1091,7 +1251,8 @@ drv_mac80211_setup() { txpower \ rxantenna txantenna \ frag rts beacon_int:100 htmode \ - num_global_macaddr:1 multiple_bssid + num_global_macaddr:1 multiple_bssid \ + sr_enable sr_enhanced json_get_values basic_rate_list basic_rate json_get_values scan_list scan_list json_select .. @@ -1122,10 +1283,18 @@ drv_mac80211_setup() { } } + # each phy sleeps different times to prevent for ubus race condition. + if [ "$phy" = "phy1" ]; then + sleep 3; + elif [ "$phy" = "phy2" ]; then + sleep 6; + fi + hostapd_conf_file="/var/run/hostapd-$phy.conf" macidx=0 staidx=0 + mbssidx=0 [ -n "$chanbw" ] && { for file in /sys/kernel/debug/ieee80211/$phy/ath9k*/chanbw /sys/kernel/debug/ieee80211/$phy/ath5k/bwmode; do @@ -1174,14 +1343,29 @@ drv_mac80211_setup() { wpa_supplicant_init_config + total_num_ap=0 + max_mbssid=1 + for_each_interface "ap" mac80211_count_ap + total_num_ap=$(($total_num_ap - 1)) + while [ $total_num_ap -gt 0 ] + do + total_num_ap=$(($total_num_ap >> 1)) + max_mbssid=$(($max_mbssid << 1)) + done + mac80211_prepare_iw_htmode active_ifnames= for_each_interface "ap sta adhoc mesh monitor" mac80211_prepare_vif for_each_interface "ap sta adhoc mesh monitor" mac80211_setup_vif + country_consistent_check + [ -x /usr/sbin/wpa_supplicant ] && wpa_supplicant_set_config "$phy" [ -x /usr/sbin/hostapd ] && hostapd_set_config "$phy" + [ -n "$sr_enable" ] && echo "$sr_enable" > /sys/kernel/debug/ieee80211/$phy/mt76/sr_enable + [ -n "$sr_enhanced" ] && echo "$sr_enhanced" > /sys/kernel/debug/ieee80211/$phy/mt76/sr_enhanced_enable + [ -x /usr/sbin/wpa_supplicant ] && wpa_supplicant_start "$phy" json_set_namespace wdev_uc prev diff --git a/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh.old b/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh.old new file mode 100755 index 00000000000000..d32cdceeb9c46f --- /dev/null +++ b/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh.old @@ -0,0 +1,1230 @@ +#!/bin/sh +. /lib/netifd/netifd-wireless.sh +. /lib/netifd/hostapd.sh +. /lib/functions/system.sh + +init_wireless_driver "$@" + +MP_CONFIG_INT="mesh_retry_timeout mesh_confirm_timeout mesh_holding_timeout mesh_max_peer_links + mesh_max_retries mesh_ttl mesh_element_ttl mesh_hwmp_max_preq_retries + mesh_path_refresh_time mesh_min_discovery_timeout mesh_hwmp_active_path_timeout + mesh_hwmp_preq_min_interval mesh_hwmp_net_diameter_traversal_time mesh_hwmp_rootmode + mesh_hwmp_rann_interval mesh_gate_announcements mesh_sync_offset_max_neighor + mesh_rssi_threshold mesh_hwmp_active_path_to_root_timeout mesh_hwmp_root_interval + mesh_hwmp_confirmation_interval mesh_awake_window mesh_plink_timeout" +MP_CONFIG_BOOL="mesh_auto_open_plinks mesh_fwding" +MP_CONFIG_STRING="mesh_power_mode" + +wdev_tool() { + ucode /usr/share/hostap/wdev.uc "$@" +} + +ubus_call() { + flock /var/run/hostapd.lock ubus call "$@" +} + +drv_mac80211_init_device_config() { + hostapd_common_add_device_config + + config_add_string path phy 'macaddr:macaddr' + config_add_string tx_burst + config_add_string distance + config_add_int beacon_int chanbw frag rts + config_add_int rxantenna txantenna txpower min_tx_power + config_add_int num_global_macaddr multiple_bssid + config_add_boolean noscan ht_coex acs_exclude_dfs background_radar + config_add_array ht_capab + config_add_array channels + config_add_array scan_list + config_add_boolean \ + rxldpc \ + short_gi_80 \ + short_gi_160 \ + tx_stbc_2by1 \ + su_beamformer \ + 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 \ + he_spr_sr_control \ + he_spr_psr_enabled \ + he_bss_color_enabled \ + he_twt_required + config_add_int \ + beamformer_antennas \ + beamformee_antennas \ + 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 \ + short_gi_20 \ + short_gi_40 \ + max_amsdu \ + dsss_cck_40 +} + +drv_mac80211_init_iface_config() { + hostapd_common_add_bss_config + + config_add_string 'macaddr:macaddr' ifname + + config_add_boolean wds powersave enable + config_add_string wds_bridge + config_add_int maxassoc + config_add_int max_listen_int + config_add_int dtim_period + config_add_int start_disabled + + # mesh + config_add_string mesh_id + config_add_int $MP_CONFIG_INT + config_add_boolean $MP_CONFIG_BOOL + config_add_string $MP_CONFIG_STRING +} + +mac80211_add_capabilities() { + local __var="$1"; shift + local __mask="$1"; shift + local __out= oifs + + oifs="$IFS" + IFS=: + for capab in "$@"; do + set -- $capab + + [ "$(($4))" -gt 0 ] || continue + [ "$(($__mask & $2))" -eq "$((${3:-$2}))" ] || continue + __out="$__out[$1]" + done + IFS="$oifs" + + 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 "$1=0" + continue + } + append base_cfg "$1=1" "$N" + done + IFS="$oifs" +} + +mac80211_hostapd_setup_base() { + local phy="$1" + + json_select config + + [ "$auto_channel" -gt 0 ] && channel=acs_survey + + [ "$auto_channel" -gt 0 ] && json_get_vars acs_exclude_dfs + [ -n "$acs_exclude_dfs" ] && [ "$acs_exclude_dfs" -gt 0 ] && + append base_cfg "acs_exclude_dfs=1" "$N" + + json_get_vars noscan ht_coex min_tx_power:0 tx_burst + json_get_values ht_capab_list ht_capab + json_get_values channel_list channels + + [ "$auto_channel" = 0 ] && [ -z "$channel_list" ] && \ + channel_list="$channel" + + [ "$min_tx_power" -gt 0 ] && append base_cfg "min_tx_power=$min_tx_power" "$N" + + set_default noscan 0 + + [ "$noscan" -gt 0 ] && hostapd_noscan=1 + [ "$tx_burst" = 0 ] && tx_burst= + + chan_ofs=0 + [ "$band" = "6g" ] && chan_ofs=1 + + if [ "$band" != "6g" ]; then + ieee80211n=1 + ht_capab= + case "$htmode" in + VHT20|HT20|HE20|EHT20) ;; + HT40*|VHT40|VHT80|VHT160|HE40|HE80|HE160|EHT40|EHT80|EHT160) + case "$hwmode" in + a) + case "$(( (($channel / 4) + $chan_ofs) % 2 ))" in + 1) ht_capab="[HT40+]";; + 0) ht_capab="[HT40-]";; + esac + ;; + *) + case "$htmode" in + HT40+) ht_capab="[HT40+]";; + HT40-) ht_capab="[HT40-]";; + *) + if [ "$channel" -lt 7 ]; then + ht_capab="[HT40+]" + else + ht_capab="[HT40-]" + fi + ;; + esac + ;; + esac + [ "$auto_channel" -gt 0 ] && ht_capab="[HT40+]" + ;; + *) ieee80211n= ;; + esac + + [ -n "$ieee80211n" ] && { + append base_cfg "ieee80211n=1" "$N" + + set_default ht_coex 0 + append base_cfg "ht_coex=$ht_coex" "$N" + + json_get_vars \ + ldpc:1 \ + greenfield:0 \ + short_gi_20:1 \ + short_gi_40:1 \ + tx_stbc:1 \ + rx_stbc:3 \ + max_amsdu:1 \ + dsss_cck_40:1 + + ht_cap_mask=0 + for cap in $(iw phy "$phy" info | grep 'Capabilities:' | cut -d: -f2); do + ht_cap_mask="$(($ht_cap_mask | $cap))" + done + + cap_rx_stbc=$((($ht_cap_mask >> 8) & 3)) + [ "$rx_stbc" -lt "$cap_rx_stbc" ] && cap_rx_stbc="$rx_stbc" + ht_cap_mask="$(( ($ht_cap_mask & ~(0x300)) | ($cap_rx_stbc << 8) ))" + + mac80211_add_capabilities ht_capab_flags $ht_cap_mask \ + LDPC:0x1::$ldpc \ + GF:0x10::$greenfield \ + SHORT-GI-20:0x20::$short_gi_20 \ + SHORT-GI-40:0x40::$short_gi_40 \ + TX-STBC:0x80::$tx_stbc \ + RX-STBC1:0x300:0x100:1 \ + RX-STBC12:0x300:0x200:1 \ + RX-STBC123:0x300:0x300:1 \ + MAX-AMSDU-7935:0x800::$max_amsdu \ + DSSS_CCK-40:0x1000::$dsss_cck_40 + + ht_capab="$ht_capab$ht_capab_flags" + [ -n "$ht_capab" ] && append base_cfg "ht_capab=$ht_capab" "$N" + } + fi + + # 802.11ac + enable_ac=0 + vht_oper_chwidth=0 + vht_center_seg0= + + idx="$channel" + case "$htmode" in + VHT20|HE20|EHT20) enable_ac=1;; + VHT40|HE40|EHT40) + case "$(( (($channel / 4) + $chan_ofs) % 2 ))" in + 1) idx=$(($channel + 2));; + 0) idx=$(($channel - 2));; + esac + enable_ac=1 + vht_center_seg0=$idx + ;; + VHT80|HE80|EHT80) + case "$(( (($channel / 4) + $chan_ofs) % 4 ))" in + 1) idx=$(($channel + 6));; + 2) idx=$(($channel + 2));; + 3) idx=$(($channel - 2));; + 0) idx=$(($channel - 6));; + esac + enable_ac=1 + vht_oper_chwidth=1 + vht_center_seg0=$idx + ;; + VHT160|HE160|EHT160|EHT320) + 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;; + 149|153|157|161|165|169|173|177) idx=163;; + esac + fi + enable_ac=1 + vht_oper_chwidth=2 + vht_center_seg0=$idx + ;; + esac + [ "$band" = "5g" ] && { + json_get_vars background_radar:0 + + [ "$background_radar" -eq 1 ] && append base_cfg "enable_background_radar=1" "$N" + } + + eht_oper_chwidth=$vht_oper_chwidth + eht_center_seg0=$vht_center_seg0 + + [ "$band" = "6g" ] && { + op_class= + case "$htmode" in + HE20|EHT20) op_class=131;; + EHT320) + case "$channel" in + 1|5|9|13|17|21|25|29|33|37|41|45|49|53|57|61) idx=31;; + 65|69|73|77|81|85|89|93|97|101|105|109|113|117|121|125) idx=95;; + 129|133|137|141|145|149|153|157|161|165|169|173|177|181|185|189) idx=159;; + 193|197|201|205|209|213|217|221) idx=191;; + esac + + op_class=137 + eht_center_seg0=$idx + eht_oper_chwidth=9 + ;; + HE*|EHT*) op_class=$((132 + $vht_oper_chwidth));; + esac + [ -n "$op_class" ] && append base_cfg "op_class=$op_class" "$N" + } + [ "$hwmode" = "a" ] || enable_ac=0 + [ "$band" = "6g" ] && enable_ac=0 + + if [ "$enable_ac" != "0" ]; then + json_get_vars \ + rxldpc:1 \ + short_gi_80:1 \ + short_gi_160:1 \ + tx_stbc_2by1:1 \ + su_beamformer:1 \ + su_beamformee:1 \ + mu_beamformer:1 \ + mu_beamformee:1 \ + vht_txop_ps:1 \ + htc_vht:1 \ + beamformee_antennas:4 \ + beamformer_antennas:4 \ + rx_antenna_pattern:1 \ + tx_antenna_pattern:1 \ + vht_max_a_mpdu_len_exp:7 \ + vht_max_mpdu:11454 \ + rx_stbc:4 \ + vht_link_adapt:3 \ + vht160:2 + + set_default tx_burst 2.0 + append base_cfg "ieee80211ac=1" "$N" + vht_cap=0 + for cap in $(iw phy "$phy" info | awk -F "[()]" '/VHT Capabilities/ { print $2 }'); do + vht_cap="$(($vht_cap | $cap))" + done + + append base_cfg "vht_oper_chwidth=$vht_oper_chwidth" "$N" + append base_cfg "vht_oper_centr_freq_seg0_idx=$vht_center_seg0" "$N" + + cap_rx_stbc=$((($vht_cap >> 8) & 7)) + [ "$rx_stbc" -lt "$cap_rx_stbc" ] && cap_rx_stbc="$rx_stbc" + vht_cap="$(( ($vht_cap & ~(0x700)) | ($cap_rx_stbc << 8) ))" + + [ "$vht_oper_chwidth" -lt 2 ] && { + vht160=0 + short_gi_160=0 + } + + mac80211_add_capabilities vht_capab $vht_cap \ + RXLDPC:0x10::$rxldpc \ + SHORT-GI-80:0x20::$short_gi_80 \ + SHORT-GI-160:0x40::$short_gi_160 \ + TX-STBC-2BY1:0x80::$tx_stbc_2by1 \ + SU-BEAMFORMER:0x800::$su_beamformer \ + SU-BEAMFORMEE:0x1000::$su_beamformee \ + MU-BEAMFORMER:0x80000::$mu_beamformer \ + MU-BEAMFORMEE:0x100000::$mu_beamformee \ + VHT-TXOP-PS:0x200000::$vht_txop_ps \ + HTC-VHT:0x400000::$htc_vht \ + RX-ANTENNA-PATTERN:0x10000000::$rx_antenna_pattern \ + TX-ANTENNA-PATTERN:0x20000000::$tx_antenna_pattern \ + RX-STBC-1:0x700:0x100:1 \ + RX-STBC-12:0x700:0x200:1 \ + RX-STBC-123:0x700:0x300:1 \ + RX-STBC-1234:0x700:0x400:1 \ + + [ "$(($vht_cap & 0x800))" -gt 0 -a "$su_beamformer" -gt 0 ] && { + cap_ant="$(( ( ($vht_cap >> 16) & 3 ) + 1 ))" + [ "$cap_ant" -gt "$beamformer_antennas" ] && cap_ant="$beamformer_antennas" + [ "$cap_ant" -gt 1 ] && vht_capab="$vht_capab[SOUNDING-DIMENSION-$cap_ant]" + } + + [ "$(($vht_cap & 0x1000))" -gt 0 -a "$su_beamformee" -gt 0 ] && { + cap_ant="$(( ( ($vht_cap >> 13) & 3 ) + 1 ))" + [ "$cap_ant" -gt "$beamformee_antennas" ] && cap_ant="$beamformee_antennas" + [ "$cap_ant" -gt 1 ] && vht_capab="$vht_capab[BF-ANTENNA-$cap_ant]" + } + + # supported Channel widths + vht160_hw=0 + [ "$(($vht_cap & 12))" -eq 4 -a 1 -le "$vht160" ] && \ + vht160_hw=1 + [ "$(($vht_cap & 12))" -eq 8 -a 2 -le "$vht160" ] && \ + vht160_hw=2 + [ "$vht160_hw" = 1 ] && vht_capab="$vht_capab[VHT160]" + [ "$vht160_hw" = 2 ] && vht_capab="$vht_capab[VHT160-80PLUS80]" + + # maximum MPDU length + vht_max_mpdu_hw=3895 + [ "$(($vht_cap & 3))" -ge 1 -a 7991 -le "$vht_max_mpdu" ] && \ + vht_max_mpdu_hw=7991 + [ "$(($vht_cap & 3))" -ge 2 -a 11454 -le "$vht_max_mpdu" ] && \ + vht_max_mpdu_hw=11454 + [ "$vht_max_mpdu_hw" != 3895 ] && \ + vht_capab="$vht_capab[MAX-MPDU-$vht_max_mpdu_hw]" + + # maximum A-MPDU length exponent + vht_max_a_mpdu_len_exp_hw=0 + [ "$(($vht_cap & 58720256))" -ge 8388608 -a 1 -le "$vht_max_a_mpdu_len_exp" ] && \ + vht_max_a_mpdu_len_exp_hw=1 + [ "$(($vht_cap & 58720256))" -ge 16777216 -a 2 -le "$vht_max_a_mpdu_len_exp" ] && \ + vht_max_a_mpdu_len_exp_hw=2 + [ "$(($vht_cap & 58720256))" -ge 25165824 -a 3 -le "$vht_max_a_mpdu_len_exp" ] && \ + vht_max_a_mpdu_len_exp_hw=3 + [ "$(($vht_cap & 58720256))" -ge 33554432 -a 4 -le "$vht_max_a_mpdu_len_exp" ] && \ + vht_max_a_mpdu_len_exp_hw=4 + [ "$(($vht_cap & 58720256))" -ge 41943040 -a 5 -le "$vht_max_a_mpdu_len_exp" ] && \ + vht_max_a_mpdu_len_exp_hw=5 + [ "$(($vht_cap & 58720256))" -ge 50331648 -a 6 -le "$vht_max_a_mpdu_len_exp" ] && \ + vht_max_a_mpdu_len_exp_hw=6 + [ "$(($vht_cap & 58720256))" -ge 58720256 -a 7 -le "$vht_max_a_mpdu_len_exp" ] && \ + vht_max_a_mpdu_len_exp_hw=7 + vht_capab="$vht_capab[MAX-A-MPDU-LEN-EXP$vht_max_a_mpdu_len_exp_hw]" + + # whether or not the STA supports link adaptation using VHT variant + vht_link_adapt_hw=0 + [ "$(($vht_cap & 201326592))" -ge 134217728 -a 2 -le "$vht_link_adapt" ] && \ + vht_link_adapt_hw=2 + [ "$(($vht_cap & 201326592))" -ge 201326592 -a 3 -le "$vht_link_adapt" ] && \ + vht_link_adapt_hw=3 + [ "$vht_link_adapt_hw" != 0 ] && \ + vht_capab="$vht_capab[VHT-LINK-ADAPT-$vht_link_adapt_hw]" + + [ -n "$vht_capab" ] && append base_cfg "vht_capab=$vht_capab" "$N" + fi + + # 802.11ax + enable_ax=0 + enable_be=0 + case "$htmode" in + HE*) enable_ax=1 ;; + EHT*) enable_ax=1; enable_be=1 ;; + esac + + if [ "$enable_ax" != "0" ]; then + json_get_vars \ + he_su_beamformer:1 \ + he_su_beamformee:1 \ + he_mu_beamformer:1 \ + he_twt_required:0 \ + he_spr_sr_control:3 \ + he_spr_psr_enabled:0 \ + he_spr_non_srg_obss_pd_max_offset:0 \ + he_bss_color:128 \ + he_bss_color_enabled:1 + + he_phy_cap=$(iw phy "$phy" info | sed -n '/HE Iftypes: .*AP/,$p' | awk -F "[()]" '/HE PHY Capabilities/ { print $2 }' | head -1) + he_phy_cap=${he_phy_cap:2} + he_mac_cap=$(iw phy "$phy" info | sed -n '/HE Iftypes: .*AP/,$p' | awk -F "[()]" '/HE MAC Capabilities/ { print $2 }' | head -1) + he_mac_cap=${he_mac_cap:2} + + append base_cfg "ieee80211ax=1" "$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_psr_enabled:${he_phy_cap:14:2}:0x1:$he_spr_psr_enabled \ + he_twt_required:${he_mac_cap:0:2}:0x6:$he_twt_required + + if [ "$he_bss_color_enabled" -gt 0 ]; then + append base_cfg "he_bss_color=$he_bss_color" "$N" + [ "$he_spr_non_srg_obss_pd_max_offset" -gt 0 ] && { \ + append base_cfg "he_spr_non_srg_obss_pd_max_offset=$he_spr_non_srg_obss_pd_max_offset" "$N" + he_spr_sr_control=$((he_spr_sr_control | (1 << 2))) + } + [ "$he_spr_psr_enabled" -gt 0 ] || he_spr_sr_control=$((he_spr_sr_control | (1 << 0))) + append base_cfg "he_spr_sr_control=$he_spr_sr_control" "$N" + else + append base_cfg "he_bss_color_disabled=1" "$N" + fi + + + append base_cfg "he_default_pe_duration=4" "$N" + append base_cfg "he_rts_threshold=1023" "$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 + + if [ "$enable_be" != "0" ]; then + append base_cfg "ieee80211be=1" "$N" + case "$htmode" in + EHT*) + append base_cfg "eht_oper_chwidth=$eht_oper_chwidth" "$N" + append base_cfg "eht_oper_centr_freq_seg0_idx=$eht_center_seg0" "$N" + append base_cfg "country3=0x49" "$N" + ;; + esac + fi + + hostapd_prepare_device_config "$hostapd_conf_file" nl80211 + cat >> "$hostapd_conf_file" <> /var/run/hostapd-$phy.conf </dev/null); do + grep -i -q "$macaddr" "/sys/class/ieee80211/${phy}/macaddress" && { + path="$(iwinfo nl80211 path "$phy")" + rename_board_phy_by_path "$path" + return 0 + } + done + } + return 1 +} + +mac80211_check_ap() { + has_ap=1 +} + +mac80211_set_ifname() { + local phy="$1" + local prefix="$2" + eval "ifname=\"$phy-$prefix\${idx_$prefix:-0}\"; idx_$prefix=\$((\${idx_$prefix:-0 } + 1))" +} + +mac80211_prepare_vif() { + json_select config + + json_get_vars ifname mode ssid wds powersave macaddr enable wpa_psk_file vlan_file + + [ -n "$ifname" ] || { + local prefix; + + case "$mode" in + ap|sta|mesh) prefix=$mode;; + adhoc) prefix=ibss;; + monitor) prefix=mon;; + esac + + mac80211_set_ifname "$phy" "$prefix" + } + + append active_ifnames "$ifname" + set_default wds 0 + set_default powersave 0 + json_add_string _ifname "$ifname" + + default_macaddr= + if [ -z "$macaddr" ]; then + macaddr="$(mac80211_generate_mac $phy)" + macidx="$(($macidx + 1))" + default_macaddr=1 + elif [ "$macaddr" = 'random' ]; then + macaddr="$(macaddr_random)" + fi + json_add_string _macaddr "$macaddr" + json_add_string _default_macaddr "$default_macaddr" + json_select .. + + + [ "$mode" == "ap" ] && { + [ -z "$wpa_psk_file" ] && hostapd_set_psk "$ifname" + [ -z "$vlan_file" ] && hostapd_set_vlan "$ifname" + } + + json_select config + + # It is far easier to delete and create the desired interface + case "$mode" in + ap) + # Hostapd will handle recreating the interface and + # subsequent virtual APs belonging to the same PHY + if [ -n "$hostapd_ctrl" ]; then + type=bss + else + type=interface + fi + + mac80211_hostapd_setup_bss "$phy" "$ifname" "$macaddr" "$type" || return + + [ -n "$hostapd_ctrl" ] || { + ap_ifname="${ifname}" + hostapd_ctrl="${hostapd_ctrl:-/var/run/hostapd/$ifname}" + } + ;; + esac + + json_select .. +} + +mac80211_prepare_iw_htmode() { + case "$htmode" in + VHT20|HT20|HE20) iw_htmode=HT20;; + HT40*|VHT40|VHT160|HE40) + case "$band" in + 2g) + case "$htmode" in + HT40+) iw_htmode="HT40+";; + HT40-) iw_htmode="HT40-";; + *) + if [ "$channel" -lt 7 ]; then + iw_htmode="HT40+" + else + iw_htmode="HT40-" + fi + ;; + 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) + iw_htmode="80MHZ" + ;; + NONE|NOHT) + iw_htmode="NOHT" + ;; + *) iw_htmode="" ;; + esac +} + +mac80211_add_mesh_params() { + for var in $MP_CONFIG_INT $MP_CONFIG_BOOL $MP_CONFIG_STRING; do + eval "mp_val=\"\$$var\"" + [ -n "$mp_val" ] && json_add_string "$var" "$mp_val" + done +} + +mac80211_setup_adhoc() { + local enable=$1 + json_get_vars bssid ssid key mcast_rate + + NEWUMLIST="${NEWUMLIST}$ifname " + + [ "$enable" = 0 ] && { + ip link set dev "$ifname" down + return 0 + } + + keyspec= + [ "$auth_type" = "wep" ] && { + set_default key 1 + case "$key" in + [1234]) + local idx + for idx in 1 2 3 4; do + json_get_var ikey "key$idx" + + [ -n "$ikey" ] && { + ikey="$(($idx - 1)):$(prepare_key_wep "$ikey")" + [ $idx -eq $key ] && ikey="d:$ikey" + append keyspec "$ikey" + } + done + ;; + *) + append keyspec "d:0:$(prepare_key_wep "$key")" + ;; + esac + } + + brstr= + for br in $basic_rate_list; do + wpa_supplicant_add_rate brstr "$br" + done + + mcval= + [ -n "$mcast_rate" ] && wpa_supplicant_add_rate mcval "$mcast_rate" + + local prev + json_set_namespace wdev_uc prev + + json_add_object "$ifname" + json_add_string mode adhoc + [ -n "$default_macaddr" ] || json_add_string macaddr "$macaddr" + json_add_string ssid "$ssid" + json_add_string freq "$freq" + json_add_string htmode "$iw_htmode" + [ -n "$bssid" ] && json_add_string bssid "$bssid" + json_add_int beacon-interval "$beacon_int" + [ -n "$brstr" ] && json_add_string basic-rates "$brstr" + [ -n "$mcval" ] && json_add_string mcast-rate "$mcval" + [ -n "$keyspec" ] && json_add_string keys "$keyspec" + json_close_object + + json_set_namespace "$prev" +} + +mac80211_setup_mesh() { + json_get_vars ssid mesh_id mcast_rate + + mcval= + [ -n "$mcast_rate" ] && wpa_supplicant_add_rate mcval "$mcast_rate" + [ -n "$mesh_id" ] && ssid="$mesh_id" + + local prev + json_set_namespace wdev_uc prev + + json_add_object "$ifname" + json_add_string mode mesh + [ -n "$default_macaddr" ] || json_add_string macaddr "$macaddr" + json_add_string ssid "$ssid" + json_add_string freq "$freq" + json_add_string htmode "$iw_htmode" + [ -n "$mcval" ] && json_add_string mcast-rate "$mcval" + json_add_int beacon-interval "$beacon_int" + mac80211_add_mesh_params + + json_close_object + + json_set_namespace "$prev" +} + +mac80211_setup_monitor() { + local prev + json_set_namespace wdev_uc prev + + json_add_object "$ifname" + json_add_string mode monitor + [ -n "$freq" ] && json_add_string freq "$freq" + json_add_string htmode "$iw_htmode" + json_close_object + + json_set_namespace "$prev" +} + +mac80211_set_vif_txpower() { + local name="$1" + + json_select config + json_get_var ifname _ifname + json_get_vars vif_txpower + json_select .. + + [ -z "$vif_txpower" ] || iw dev "$ifname" set txpower fixed "${vif_txpower%%.*}00" +} + +wpa_supplicant_init_config() { + json_set_namespace wpa_supp prev + + json_init + json_add_array config + + json_set_namespace "$prev" +} + +wpa_supplicant_add_interface() { + local ifname="$1" + local mode="$2" + local prev + + _wpa_supplicant_common "$ifname" + + json_set_namespace wpa_supp prev + + json_add_object + json_add_string ctrl "$_rpath" + json_add_string iface "$ifname" + json_add_string mode "$mode" + json_add_string config "$_config" + [ -n "$default_macaddr" ] || json_add_string macaddr "$macaddr" + [ -n "$network_bridge" ] && json_add_string bridge "$network_bridge" + [ -n "$wds" ] && json_add_boolean 4addr "$wds" + json_add_boolean powersave "$powersave" + [ "$mode" = "mesh" ] && mac80211_add_mesh_params + json_close_object + + json_set_namespace "$prev" + + wpa_supp_init=1 +} + +wpa_supplicant_set_config() { + local phy="$1" + local prev + + json_set_namespace wpa_supp prev + json_close_array + json_add_string phy "$phy" + json_add_boolean defer 1 + local data="$(json_dump)" + + json_cleanup + json_set_namespace "$prev" + + ubus -S -t 0 wait_for wpa_supplicant || { + [ -n "$wpa_supp_init" ] || return 0 + + ubus wait_for wpa_supplicant + } + + local supplicant_res="$(ubus_call wpa_supplicant config_set "$data")" + ret="$?" + [ "$ret" != 0 -o -z "$supplicant_res" ] && wireless_setup_vif_failed WPA_SUPPLICANT_FAILED + + wireless_add_process "$(jsonfilter -s "$supplicant_res" -l 1 -e @.pid)" "/usr/sbin/wpa_supplicant" 1 1 + +} + +hostapd_set_config() { + [ -n "$hostapd_ctrl" ] || { + ubus_call hostapd config_set '{ "phy": "'"$phy"'", "config": "", "prev_config": "'"${hostapd_conf_file}.prev"'" }' > /dev/null + return 0; + } + + ubus wait_for hostapd + local hostapd_res="$(ubus_call hostapd config_set "{ \"phy\": \"$phy\", \"config\":\"${hostapd_conf_file}\", \"prev_config\": \"${hostapd_conf_file}.prev\"}")" + 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 +} + + +wpa_supplicant_start() { + local phy="$1" + + [ -n "$wpa_supp_init" ] || return 0 + + ubus_call wpa_supplicant config_set '{ "phy": "'"$phy"'" }' > /dev/null +} + +mac80211_setup_supplicant() { + local enable=$1 + local add_sp=0 + + wpa_supplicant_prepare_interface "$ifname" nl80211 || return 1 + + if [ "$mode" = "sta" ]; then + wpa_supplicant_add_network "$ifname" + else + wpa_supplicant_add_network "$ifname" "$freq" "$htmode" "$hostapd_noscan" + fi + + wpa_supplicant_add_interface "$ifname" "$mode" + + return 0 +} + +mac80211_setup_vif() { + local name="$1" + local failed + + json_select config + json_get_var ifname _ifname + json_get_var macaddr _macaddr + json_get_var default_macaddr _default_macaddr + json_get_vars mode wds powersave + + set_default powersave 0 + set_default wds 0 + + case "$mode" in + mesh) + json_get_vars $MP_CONFIG_INT $MP_CONFIG_BOOL $MP_CONFIG_STRING + wireless_vif_parse_encryption + [ -z "$htmode" ] && htmode="NOHT"; + if wpa_supplicant -vmesh; then + mac80211_setup_supplicant || failed=1 + else + mac80211_setup_mesh + fi + ;; + adhoc) + wireless_vif_parse_encryption + if [ "$wpa" -gt 0 -o "$auto_channel" -gt 0 ]; then + mac80211_setup_supplicant || failed=1 + else + mac80211_setup_adhoc + fi + ;; + sta) + mac80211_setup_supplicant || failed=1 + ;; + monitor) + mac80211_setup_monitor + ;; + esac + + json_select .. + [ -n "$failed" ] || wireless_add_vif "$name" "$ifname" +} + +get_freq() { + local phy="$1" + 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 int($2) + exit +} +' +} + +chan_is_dfs() { + local phy="$1" + local chan="$2" + iw "$phy" info | grep -E -m1 "(\* ${chan:-....} MHz${chan:+|\\[$chan\\]})" | grep -q "MHz.*radar detection" + return $! +} + +mac80211_set_noscan() { + hostapd_noscan=1 +} + +drv_mac80211_cleanup() { + : +} + +mac80211_reset_config() { + local phy="$1" + + hostapd_conf_file="/var/run/hostapd-$phy.conf" + ubus_call hostapd config_set '{ "phy": "'"$phy"'", "config": "", "prev_config": "'"$hostapd_conf_file"'" }' > /dev/null + ubus_call wpa_supplicant config_set '{ "phy": "'"$phy"'", "config": [] }' > /dev/null + wdev_tool "$phy" set_config '{}' +} + +drv_mac80211_setup() { + json_select config + json_get_vars \ + phy macaddr path \ + country chanbw distance \ + txpower \ + rxantenna txantenna \ + frag rts beacon_int:100 htmode \ + num_global_macaddr:1 multiple_bssid + json_get_values basic_rate_list basic_rate + json_get_values scan_list scan_list + json_select .. + + json_select data && { + json_get_var prev_rxantenna rxantenna + json_get_var prev_txantenna txantenna + json_select .. + } + + find_phy || { + echo "Could not find PHY for device '$1'" + wireless_set_retry 0 + return 1 + } + + local wdev + local cwdev + local found + + # convert channel to frequency + [ "$auto_channel" -gt 0 ] || freq="$(get_freq "$phy" "$channel" "$band")" + + [ -n "$country" ] && { + iw reg get | grep -q "^country $country:" || { + iw reg set "$country" + sleep 1 + } + } + + hostapd_conf_file="/var/run/hostapd-$phy.conf" + + macidx=0 + staidx=0 + + [ -n "$chanbw" ] && { + for file in /sys/kernel/debug/ieee80211/$phy/ath9k*/chanbw /sys/kernel/debug/ieee80211/$phy/ath5k/bwmode; do + [ -f "$file" ] && echo "$chanbw" > "$file" + done + } + + set_default rxantenna 0xffffffff + set_default txantenna 0xffffffff + set_default distance 0 + + [ "$txantenna" = "all" ] && txantenna=0xffffffff + [ "$rxantenna" = "all" ] && rxantenna=0xffffffff + + [ "$rxantenna" = "$prev_rxantenna" -a "$txantenna" = "$prev_txantenna" ] || mac80211_reset_config "$phy" + wireless_set_data phy="$phy" txantenna="$txantenna" rxantenna="$rxantenna" + + iw phy "$phy" set antenna $txantenna $rxantenna >/dev/null 2>&1 + iw phy "$phy" set distance "$distance" >/dev/null 2>&1 + + if [ -n "$txpower" ]; then + iw phy "$phy" set txpower fixed "${txpower%%.*}00" + else + iw phy "$phy" set txpower auto + fi + + [ -n "$frag" ] && iw phy "$phy" set frag "${frag%%.*}" + [ -n "$rts" ] && iw phy "$phy" set rts "${rts%%.*}" + + has_ap= + hostapd_ctrl= + ap_ifname= + hostapd_noscan= + wpa_supp_init= + for_each_interface "ap" mac80211_check_ap + + [ -f "$hostapd_conf_file" ] && mv "$hostapd_conf_file" "$hostapd_conf_file.prev" + + for_each_interface "sta adhoc mesh" mac80211_set_noscan + [ -n "$has_ap" ] && mac80211_hostapd_setup_base "$phy" + + local prev + json_set_namespace wdev_uc prev + json_init + json_set_namespace "$prev" + + wpa_supplicant_init_config + + mac80211_prepare_iw_htmode + active_ifnames= + for_each_interface "ap sta adhoc mesh monitor" mac80211_prepare_vif + for_each_interface "ap sta adhoc mesh monitor" mac80211_setup_vif + + [ -x /usr/sbin/wpa_supplicant ] && wpa_supplicant_set_config "$phy" + [ -x /usr/sbin/hostapd ] && hostapd_set_config "$phy" + + [ -x /usr/sbin/wpa_supplicant ] && wpa_supplicant_start "$phy" + + json_set_namespace wdev_uc prev + wdev_tool "$phy" set_config "$(json_dump)" $active_ifnames + json_set_namespace "$prev" + + for_each_interface "ap sta adhoc mesh monitor" mac80211_set_vif_txpower + wireless_set_up +} + +_list_phy_interfaces() { + local phy="$1" + if [ -d "/sys/class/ieee80211/${phy}/device/net" ]; then + ls "/sys/class/ieee80211/${phy}/device/net" 2>/dev/null; + else + ls "/sys/class/ieee80211/${phy}/device" 2>/dev/null | grep net: | sed -e 's,net:,,g' + fi +} + +list_phy_interfaces() { + local phy="$1" + + for dev in $(_list_phy_interfaces "$phy"); do + readlink "/sys/class/net/${dev}/phy80211" | grep -q "/${phy}\$" || continue + echo "$dev" + done +} + +drv_mac80211_teardown() { + json_select data + json_get_vars phy + json_select .. + [ -n "$phy" ] || { + echo "Bug: PHY is undefined for device '$1'" + return 1 + } + + mac80211_reset_config "$phy" + + for wdev in $(list_phy_interfaces "$phy"); do + ip link set dev "$wdev" down + iw dev "$wdev" del + done +} + +add_driver mac80211 diff --git a/package/network/utils/iwinfo/Makefile b/package/network/utils/iwinfo/Makefile index 15828da4eb9f41..53f8d44f469200 100644 --- a/package/network/utils/iwinfo/Makefile +++ b/package/network/utils/iwinfo/Makefile @@ -7,13 +7,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libiwinfo -PKG_RELEASE:=3 +PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git -PKG_SOURCE_URL=https://github.com/rmandrad/iwinfo -PKG_SOURCE_DATE:=2024-09-12 -PKG_SOURCE_VERSION:=872a657482fb652776121ba25e3adeaeb727b2bc -PKG_MIRROR_HASH:=f815ee1e0bde98f80a5de9f2711d5044479f936c07e21fc47d3a7f97955e7883 +PKG_SOURCE_URL=$(PROJECT_GIT)/project/iwinfo.git +PKG_SOURCE_DATE:=2024-09-17 +PKG_SOURCE_VERSION:=268a662421fa03798881b34658a3d6bd6a30d97d +PKG_MIRROR_HASH:=2ea07521149fb45665184f80ee99595c8b4f06aaf2c1004b74c944da632778de PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=GPL-2.0 diff --git a/package/system/rpcd/Makefile b/package/system/rpcd/Makefile index 95d116afc71ec1..da031db8498d0f 100644 --- a/package/system/rpcd/Makefile +++ b/package/system/rpcd/Makefile @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=rpcd -PKG_RELEASE:=3 +PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git -PKG_SOURCE_URL=https://github.com/rmandrad/rpcd -PKG_MIRROR_HASH:=48caadbe3979bf90a2fbc56083f946dbbba5bbc2 -PKG_SOURCE_DATE:=2024-09-12 -PKG_SOURCE_VERSION:=8ef4c2587ac0041049c67befed281a70cf240769 +PKG_SOURCE_URL=$(PROJECT_GIT)/project/rpcd.git +PKG_MIRROR_HASH:=67b2cb985d8712a3e5a17ebf8c74fd35d553c8f9a4197616f9a3649a8740cc33 +PKG_SOURCE_DATE:=2024-09-17 +PKG_SOURCE_VERSION:=9f4b86e70352ab9ca6aa272d096419acc53e2390 PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=ISC From 693c759077aaddf9c5cb1d4f521cdd2701d4348c Mon Sep 17 00:00:00 2001 From: Rudy Andram Date: Fri, 20 Sep 2024 04:50:57 +0100 Subject: [PATCH 22/40] Update mac80211.uc to support 11be --- .../wifi-scripts/files/lib/wifi/mac80211.uc | 176 ++++++++++++------ 1 file changed, 115 insertions(+), 61 deletions(-) diff --git a/package/network/config/wifi-scripts/files/lib/wifi/mac80211.uc b/package/network/config/wifi-scripts/files/lib/wifi/mac80211.uc index 8f25a791b38b3b..d3a401b476784a 100644 --- a/package/network/config/wifi-scripts/files/lib/wifi/mac80211.uc +++ b/package/network/config/wifi-scripts/files/lib/wifi/mac80211.uc @@ -3,92 +3,146 @@ import { readfile } from "fs"; import * as uci from 'uci'; const bands_order = [ "6G", "5G", "2G" ]; -const htmode_order = [ "HE", "VHT", "HT" ]; +const htmode_order = [ "EHT", "HE", "VHT", "HT" ]; let board = json(readfile("/etc/board.json")); if (!board.wlan) - exit(0); + exit(0); let idx = 0; let commit; +let random_mac_bytes = getenv("MT76_ENV_RANDOM_MAC_BYTES"); let config = uci.cursor().get_all("wireless") ?? {}; function radio_exists(path, macaddr, phy) { - for (let name, s in config) { - if (s[".type"] != "wifi-device") - continue; - if (s.macaddr & lc(s.macaddr) == lc(macaddr)) - return true; - if (s.phy == phy) - return true; - if (!s.path || !path) - continue; - if (substr(s.path, -length(path)) == path) - return true; - } + for (let name, s in config) { + if (s[".type"] != "wifi-device") + continue; + if (s.macaddr & lc(s.macaddr) == lc(macaddr)) + return true; + if (s.phy == phy) + return true; + if (!s.path || !path) + continue; + if (substr(s.path, -length(path)) == path) + return true; + } } for (let phy_name, phy in board.wlan) { - let info = phy.info; - if (!info || !length(info.bands)) - continue; - - while (config[`radio${idx}`]) - idx++; - let name = "radio" + idx++; - - let s = "wireless." + name; - let si = "wireless.default_" + name; - - let band_name = filter(bands_order, (b) => info.bands[b])[0]; - if (!band_name) - continue; - - let band = info.bands[band_name]; - let channel = band.default_channel ?? "auto"; - - let width = band.max_width; - if (band_name == "2G") - width = 20; - else if (width > 80) - width = 80; - - let htmode = filter(htmode_order, (m) => band[lc(m)])[0]; - if (htmode) - htmode += width; - else - htmode = "NOHT"; - - if (!phy.path) - continue; - - let macaddr = trim(readfile(`/sys/class/ieee80211/${phy_name}/macaddress`)); - if (radio_exists(phy.path, macaddr, phy_name)) - continue; - - let id = `phy='${phy_name}'`; - if (match(phy_name, /^phy[0-9]/)) - id = `path='${phy.path}'`; - - print(`set ${s}=wifi-device + let info = phy.info; + if (!info || !length(info.bands)) + continue; + + while (config[`radio${idx}`]) + idx++; + let name = "radio" + idx++; + + let s = "wireless." + name; + let si = "wireless.default_" + name; + + let band_name = filter(bands_order, (b) => info.bands[b])[0]; + if (!band_name) + continue; + + let band = info.bands[band_name]; + let channel = band.default_channel ?? "auto"; + if (band_name == "6G") + channel = 37; + + let width = band.max_width; + + let htmode = filter(htmode_order, (m) => band[lc(m)])[0]; + if (htmode) + htmode += width; + else + htmode = "NOHT"; + + if (!phy.path) + continue; + + let macaddr = trim(readfile(`/sys/class/ieee80211/${phy_name}/macaddress`)); + if (radio_exists(phy.path, macaddr, phy_name)) + continue; + + let id = `phy='${phy_name}'`; + if (match(phy_name, /^phy[0-9]/)) + id = `path='${phy.path}'`; + + let disabled = getenv("MT76_ENV_WM_TM") ? 1 : 0; + let noscan = 0; + let mbssid = 0; + let rnr = 0; + let background_radar = 0; + let encryption = "none"; + let mbo = 0; + let band_idx = 0; + let ssid = ""; + + if (band_name == "6G") { + encryption = "sae"; + mbo = 1; + band_idx = 2; + ssid = "OpenWrt-6g"; + } else if (band_name == "5G") { + noscan = 1; + rnr = 1; + background_radar = 1; + band_idx = 1; + ssid = "OpenWrt-5g"; + } else { + noscan = 1; + rnr = 1; + ssid = "OpenWrt-2g"; + } + + print(`set ${s}=wifi-device set ${s}.type='mac80211' set ${s}.${id} set ${s}.band='${lc(band_name)}' set ${s}.channel='${channel}' set ${s}.htmode='${htmode}' -set ${s}.disabled='1' +set ${s}.country='US' +set ${s}.noscan=${noscan} +set ${s}.disabled=${disabled} set ${si}=wifi-iface set ${si}.device='${name}' set ${si}.network='lan' set ${si}.mode='ap' -set ${si}.ssid='OpenWrt' -set ${si}.encryption='none' +set ${si}.ssid=${ssid} +set ${si}.encryption=${encryption} +set ${si}.mbo=${mbo} + +`); + if (mbssid) + print(`set ${s}.mbssid=${mbssid} +`); + if (rnr) + print(`set ${s}.rnr=${rnr} +`); + if (background_radar) + print(`set ${s}.background_radar=${background_radar} +`); + if (getenv("MT76_ENV_TX_BURST_ZERO")) + print(`set ${s}.tx_burst=0.0 +`); + if (encryption == "sae") + print(`set ${si}.key=12345678 +set ${si}.sae_pwe=2 +set ${si}.ieee80211w=2 +`); + if (random_mac_bytes) { + print(`set ${si}.macaddr=00:0${idx - 1}:55:66${random_mac_bytes} +`); + if (has_mlo) + print(`set ${si_mld}.macaddr=00:1${idx - 1}:55:66${random_mac_bytes} `); - commit = true; + } + commit = true; } if (commit) - print("commit wireless\n"); + print("commit wireless\n"); From 3b7346064c7ff2e41d813a85496b11e1e0c47de5 Mon Sep 17 00:00:00 2001 From: Rudy Andram Date: Fri, 20 Sep 2024 05:05:16 +0100 Subject: [PATCH 23/40] Update wifi-detect.uc add 11be support --- .../files/usr/share/hostap/wifi-detect.uc | 312 +++++++++--------- 1 file changed, 164 insertions(+), 148 deletions(-) diff --git a/package/network/config/wifi-scripts/files/usr/share/hostap/wifi-detect.uc b/package/network/config/wifi-scripts/files/usr/share/hostap/wifi-detect.uc index 109b6a33cfce02..a4f5e2369882d7 100644 --- a/package/network/config/wifi-scripts/files/usr/share/hostap/wifi-detect.uc +++ b/package/network/config/wifi-scripts/files/usr/share/hostap/wifi-detect.uc @@ -9,179 +9,195 @@ let prev_board_data = json(readfile(board_file)); let board_data = json(readfile(board_file)); function phy_idx(name) { - return +rtrim(readfile(`/sys/class/ieee80211/${name}/index`)); + return +rtrim(readfile(`/sys/class/ieee80211/${name}/index`)); } function phy_path(name) { - let devpath = realpath(`/sys/class/ieee80211/${name}/device`); + let devpath = realpath(`/sys/class/ieee80211/${name}/device`); - devpath = replace(devpath, /^\/sys\/devices\//, ""); - if (match(devpath, /^platform\/.*\/pci/)) - devpath = replace(devpath, /^platform\//, ""); - let dev_phys = map(glob(`/sys/class/ieee80211/${name}/device/ieee80211/*`), basename); - sort(dev_phys, (a, b) => phy_idx(a) - phy_idx(b)); + devpath = replace(devpath, /^\/sys\/devices\//, ""); + if (match(devpath, /^platform\/.*\/pci/)) + devpath = replace(devpath, /^platform\//, ""); + let dev_phys = map(glob(`/sys/class/ieee80211/${name}/device/ieee80211/*`), basename); + sort(dev_phys, (a, b) => phy_idx(a) - phy_idx(b)); - let ofs = index(dev_phys, name); - if (ofs > 0) - devpath += `+${ofs}`; + let ofs = index(dev_phys, name); + if (ofs > 0) + devpath += `+${ofs}`; - return devpath; + return devpath; } function cleanup() { - let wlan = board_data.wlan; + let wlan = board_data.wlan; - for (let name in wlan) - if (substr(name, 0, 3) == "phy") - delete wlan[name]; - else - delete wlan[name].info; + for (let name in wlan) + if (substr(name, 0, 3) == "phy") + delete wlan[name]; + else + delete wlan[name].info; } function wiphy_get_entry(phy, path) { - board_data.wlan ??= {}; + board_data.wlan ??= {}; - let wlan = board_data.wlan; - for (let name in wlan) - if (wlan[name].path == path) - return wlan[name]; + let wlan = board_data.wlan; + for (let name in wlan) + if (wlan[name].path == path) + return wlan[name]; - wlan[phy] = { - path: path - }; + wlan[phy] = { + path: path + }; - return wlan[phy]; + return wlan[phy]; } function freq_to_channel(freq) { - if (freq < 1000) - return 0; - if (freq == 2484) - return 14; - if (freq == 5935) - return 2; - if (freq < 2484) - return (freq - 2407) / 5; - if (freq >= 4910 && freq <= 4980) - return (freq - 4000) / 5; - if (freq < 5950) - return (freq - 5000) / 5; - if (freq <= 45000) - return (freq - 5950) / 5; - if (freq >= 58320 && freq <= 70200) - return (freq - 56160) / 2160; - return 0; + if (freq < 1000) + return 0; + if (freq == 2484) + return 14; + if (freq == 5935) + return 2; + if (freq < 2484) + return (freq - 2407) / 5; + if (freq >= 4910 && freq <= 4980) + return (freq - 4000) / 5; + if (freq < 5950) + return (freq - 5000) / 5; + if (freq <= 45000) + return (freq - 5950) / 5; + if (freq >= 58320 && freq <= 70200) + return (freq - 56160) / 2160; + return 0; } function wiphy_detect() { - let phys = nl.request(nl.const.NL80211_CMD_GET_WIPHY, nl.const.NLM_F_DUMP, { split_wiphy_dump: true }); - if (!phys) - return; - - for (let phy in phys) { - let name = phy.wiphy_name; - let path = phy_path(name); - let info = { - antenna_rx: phy.wiphy_antenna_avail_rx, - antenna_tx: phy.wiphy_antenna_avail_tx, - bands: {}, - }; - - let bands = info.bands; - for (let band in phy.wiphy_bands) { - if (!band || !band.freqs) - continue; - let freq = band.freqs[0].freq; - let band_info = {}; - let band_name; - if (freq > 50000) - band_name = "60G"; - else if (freq > 5900) - band_name = "6G"; - else if (freq > 4000) - band_name = "5G"; - else if (freq > 2000) - band_name = "2G"; - else - continue; - bands[band_name] = band_info; - if (band.ht_capa > 0) - band_info.ht = true; - if (band.vht_capa > 0) - band_info.vht = true; - let he_phy_cap = 0; - - for (let ift in band.iftype_data) { - if (!ift.he_cap_phy) - continue; - - band_info.he = true; - he_phy_cap |= ift.he_cap_phy[0]; - /* TODO: EHT */ - } - - if (band_name != "2G" && - (he_phy_cap & 0x18) || ((band.vht_capa >> 2) & 0x3)) - band_info.max_width = 160; - else if (band_name != "2G" && - (he_phy_cap & 4) || band.vht_capa > 0) - band_info.max_width = 80; - else if ((band.ht_capa & 0x2) || (he_phy_cap & 0x2)) - band_info.max_width = 40; - else - band_info.max_width = 20; - - let modes = band_info.modes = [ "NOHT" ]; - if (band_info.ht) - push(modes, "HT20"); - if (band_info.vht) - push(modes, "VHT20"); - if (band_info.he) - push(modes, "HE20"); - if (band.ht_capa & 0x2) { - push(modes, "HT40"); - if (band_info.vht) - push(modes, "VHT40") - } - if (he_phy_cap & 0x2) - push(modes, "HE40"); - - for (let freq in band.freqs) { - if (freq.disabled) - continue; - let chan = freq_to_channel(freq.freq); - if (!chan) - continue; - band_info.default_channel = chan; - break; - } - - if (band_name == "2G") - continue; - if (band_info.vht) - push(modes, "VHT80"); - if (he_phy_cap & 4) - push(modes, "HE80"); - if ((band.vht_capa >> 2) & 0x3) - push(modes, "VHT160"); - if (he_phy_cap & 0x18) - push(modes, "HE160"); - } - - let entry = wiphy_get_entry(name, path); - entry.info = info; - } + let phys = nl.request(nl.const.NL80211_CMD_GET_WIPHY, nl.const.NLM_F_DUMP, { split_wiphy_dump: true }); + if (!phys) + return; + + for (let phy in phys) { + let name = phy.wiphy_name; + let path = phy_path(name); + let info = { + antenna_rx: phy.wiphy_antenna_avail_rx, + antenna_tx: phy.wiphy_antenna_avail_tx, + bands: {}, + }; + + let bands = info.bands; + for (let band in phy.wiphy_bands) { + if (!band || !band.freqs) + continue; + let freq = band.freqs[0].freq; + let band_info = {}; + let band_name; + if (freq > 50000) + band_name = "60G"; + else if (freq > 5900) + band_name = "6G"; + else if (freq > 4000) + band_name = "5G"; + else if (freq > 2000) + band_name = "2G"; + else + continue; + bands[band_name] = band_info; + if (band.ht_capa > 0) + band_info.ht = true; + if (band.vht_capa > 0) + band_info.vht = true; + let he_phy_cap = 0; + + for (let ift in band.iftype_data) { + if (!ift.he_cap_phy) + continue; + + band_info.he = true; + he_phy_cap |= ift.he_cap_phy[0]; + /* FIXME: hardcode */ + band_info.eht = true; + } + + if (band_name == "6G" && band_info.eht) + band_info.max_width = 320; + else if (band_name != "2G" && + (he_phy_cap & 0x18) || ((band.vht_capa >> 2) & 0x3)) + band_info.max_width = 160; + else if (band_name != "2G" && + (he_phy_cap & 4) || band.vht_capa > 0) + band_info.max_width = 80; + else if ((band.ht_capa & 0x2) || (he_phy_cap & 0x2)) + band_info.max_width = 40; + else + band_info.max_width = 20; + + let modes = band_info.modes = [ "NOHT" ]; + if (band_info.ht) + push(modes, "HT20"); + if (band_info.vht) + push(modes, "VHT20"); + if (band_info.he) + push(modes, "HE20"); + if (band_info.eht) + push(modes, "EHT20"); + if (band.ht_capa & 0x2) { + push(modes, "HT40"); + if (band_info.vht) + push(modes, "VHT40") + } + if (he_phy_cap & 0x2) { + push(modes, "HE40"); + if (band_info.eht) + push(modes, "EHT40"); + } + + for (let freq in band.freqs) { + if (freq.disabled) + continue; + let chan = freq_to_channel(freq.freq); + if (!chan) + continue; + band_info.default_channel = chan; + break; + } + + if (band_name == "2G") + continue; + if (band_info.vht) + push(modes, "VHT80"); + if (he_phy_cap & 4) { + push(modes, "HE80"); + if (band_info.eht) + push(modes, "EHT80"); + } + if ((band.vht_capa >> 2) & 0x3) + push(modes, "VHT160"); + if (he_phy_cap & 0x18) { + push(modes, "HE160"); + if (band_info.eht) + push(modes, "EHT160"); + } + if (band_name == "6G" && band_info.eht) + push(modes, "EHT320"); + } + + let entry = wiphy_get_entry(name, path); + entry.info = info; + } } cleanup(); wiphy_detect(); if (!is_equal(prev_board_data, board_data)) { - let new_file = board_file + ".new"; - unlink(new_file); - let f = open(new_file, "wx"); - if (!f) - exit(1); - f.write(sprintf("%.J\n", board_data)); - f.close(); - rename(new_file, board_file); + let new_file = board_file + ".new"; + unlink(new_file); + let f = open(new_file, "wx"); + if (!f) + exit(1); + f.write(sprintf("%.J\n", board_data)); + f.close(); + rename(new_file, board_file); } From 6321d8e1be3e0083e1a6ba20b4585be6babd6c48 Mon Sep 17 00:00:00 2001 From: Rudy Andram Date: Fri, 20 Sep 2024 05:22:45 +0100 Subject: [PATCH 24/40] additional mt7996 patch from mediatek and wifi script updated from mtk feeds --- .../0003-mt7996_mcu_sta_bfer_he-null.patch | 14 +++++++++++ .../config/wifi-scripts/files/sbin/wifi | 25 +++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 package/kernel/mt76/patches/0003-mt7996_mcu_sta_bfer_he-null.patch diff --git a/package/kernel/mt76/patches/0003-mt7996_mcu_sta_bfer_he-null.patch b/package/kernel/mt76/patches/0003-mt7996_mcu_sta_bfer_he-null.patch new file mode 100644 index 00000000000000..b9cd4994df2f48 --- /dev/null +++ b/package/kernel/mt76/patches/0003-mt7996_mcu_sta_bfer_he-null.patch @@ -0,0 +1,14 @@ +--- a/mt7996/mcu.c ++++ b/mt7996/mcu.c +@@ -1544,6 +1544,9 @@ mt7996_mcu_sta_bfer_he(struct ieee80211_sta *sta, struct ieee80211_vif *vif, + u8 nss_mcs = mt7996_mcu_get_sta_nss(mcs_map); + u8 snd_dim, sts; + ++ if (!vc) ++ return; ++ + bf->tx_mode = MT_PHY_TYPE_HE_SU; + + mt7996_mcu_sta_sounding_rate(bf); +-- +2.25.1 diff --git a/package/network/config/wifi-scripts/files/sbin/wifi b/package/network/config/wifi-scripts/files/sbin/wifi index f937dba7e6d92d..ba2d392c78ae95 100755 --- a/package/network/config/wifi-scripts/files/sbin/wifi +++ b/package/network/config/wifi-scripts/files/sbin/wifi @@ -175,8 +175,33 @@ wifi_detect_notice() { } wifi_config() { + # Add sleep to prevent parsing before wifi modules get ready + sleep 1 + [ -e /tmp/.config_pending ] && return ucode /usr/share/hostap/wifi-detect.uc + + if (dmesg | grep -q "WM_TM"); then + export MT76_ENV_WM_TM=1 + fi + + if (lspci | grep -q "7992"); then + export MT76_ENV_TX_BURST_ZERO=1 + fi + + if (dmesg | grep -q "eeprom load fail"); then + # generate random bytes for macaddr + rand=$(hexdump -C /dev/urandom | head -n 1 &) + killall hexdump + + macaddr="" + for i in $(seq 2 3); do + macaddr=${macaddr}:$(echo $rand | cut -d ' ' -f $i) + done + + export MT76_ENV_RANDOM_MAC_BYTES=${macaddr} + fi + [ ! -f /etc/config/wireless ] && touch /etc/config/wireless ucode /lib/wifi/mac80211.uc | uci -q batch From 71fd710b2440277de80d60761b3fb96312780ec8 Mon Sep 17 00:00:00 2001 From: Rudy Andram Date: Fri, 20 Sep 2024 07:40:12 +0100 Subject: [PATCH 25/40] add background radar check support to mt76 --- package/kernel/mt76/Makefile | 8 +-- ...-background-radar-cap-check-for-2-3-.patch | 56 ------------------- .../0003-mt7996_mcu_sta_bfer_he-null.patch | 14 ----- 3 files changed, 4 insertions(+), 74 deletions(-) delete mode 100644 package/kernel/mt76/patches/0002-wifi-mt76-mt7996-background-radar-cap-check-for-2-3-.patch delete mode 100644 package/kernel/mt76/patches/0003-mt7996_mcu_sta_bfer_he-null.patch diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile index 137d0ec717d2a9..536263af15f3dc 100644 --- a/package/kernel/mt76/Makefile +++ b/package/kernel/mt76/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mt76 -PKG_RELEASE=1 +PKG_RELEASE=2 PKG_LICENSE:=GPLv2 PKG_LICENSE_FILES:= @@ -9,9 +9,9 @@ PKG_LICENSE_FILES:= PKG_SOURCE_URL:=https://github.com/rmandrad/mt76 PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2024-09-11 -PKG_SOURCE_VERSION:=c12640ee09baf17f8a286c92e9e600426073e30d -PKG_MIRROR_HASH:=82d781b6d57ac1a76c697115230ac63592430d48594e90de2c6bebb27177acb9 +PKG_SOURCE_DATE:=2024-09-20 +PKG_SOURCE_VERSION:=1e930e0c7397b2bf20e6b821434982b8ee970c05 +PKG_MIRROR_HASH:=771d9992ef837f0c4a58329ed425fb8b00334ab73834216596b3ee9872ab3f79 PKG_MAINTAINER:=Felix Fietkau PKG_USE_NINJA:=0 diff --git a/package/kernel/mt76/patches/0002-wifi-mt76-mt7996-background-radar-cap-check-for-2-3-.patch b/package/kernel/mt76/patches/0002-wifi-mt76-mt7996-background-radar-cap-check-for-2-3-.patch deleted file mode 100644 index 1ddc1df2542679..00000000000000 --- a/package/kernel/mt76/patches/0002-wifi-mt76-mt7996-background-radar-cap-check-for-2-3-.patch +++ /dev/null @@ -1,56 +0,0 @@ -From c307a3423ced37be475dd18adf65886aa8bb54d8 Mon Sep 17 00:00:00 2001 -From: Shayne Chen -Date: Fri, 30 Aug 2024 19:28:21 +0800 -Subject: [PATCH 2/2] wifi: mt76: mt7996: background radar cap check for 2+3+3 - sku -Change-Id: I75928ec859f8f35692eabf17d1771df7f0da799b ---- - mt7996/init.c | 7 ++++--- - mt7996/mt7996.h | 15 +++++++++++++++ - 2 files changed, 19 insertions(+), 3 deletions(-) -diff --git a/mt7996/init.c b/mt7996/init.c -index ab1a9a8e..03dfe5dc 100644 ---- a/mt7996/init.c -+++ b/mt7996/init.c -@@ -390,9 +390,10 @@ mt7996_init_wiphy(struct ieee80211_hw *hw, struct mtk_wed_device *wed) - wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_CAN_REPLACE_PTK0); - wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_MU_MIMO_AIR_SNIFFER); - -- if (!mdev->dev->of_node || -- !of_property_read_bool(mdev->dev->of_node, -- "mediatek,disable-radar-background")) -+ if (mt7996_get_background_radar_cap(phy->dev) && -+ (!mdev->dev->of_node || -+ !of_property_read_bool(mdev->dev->of_node, -+ "mediatek,disable-radar-background"))) - wiphy_ext_feature_set(wiphy, - NL80211_EXT_FEATURE_RADAR_BACKGROUND); - -diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h -index e9fc6134..e7386a90 100644 ---- a/mt7996/mt7996.h -+++ b/mt7996/mt7996.h -@@ -426,6 +426,21 @@ mt7996_band_valid(struct mt7996_dev *dev, u8 band) - return band == MT_BAND0 || band == MT_BAND2; - } - -+static inline bool -+mt7996_get_background_radar_cap(struct mt7996_dev *dev) -+{ -+ switch (mt76_chip(&dev->mt76)) { -+ case 0x7990: -+ if (dev->var_type == MT7996_VAR_TYPE_233) -+ return false; -+ break; -+ default: -+ break; -+ } -+ -+ return true; -+} -+ - extern const struct ieee80211_ops mt7996_ops; - extern struct pci_driver mt7996_pci_driver; - extern struct pci_driver mt7996_hif_driver; --- -2.45.2 diff --git a/package/kernel/mt76/patches/0003-mt7996_mcu_sta_bfer_he-null.patch b/package/kernel/mt76/patches/0003-mt7996_mcu_sta_bfer_he-null.patch deleted file mode 100644 index b9cd4994df2f48..00000000000000 --- a/package/kernel/mt76/patches/0003-mt7996_mcu_sta_bfer_he-null.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- a/mt7996/mcu.c -+++ b/mt7996/mcu.c -@@ -1544,6 +1544,9 @@ mt7996_mcu_sta_bfer_he(struct ieee80211_sta *sta, struct ieee80211_vif *vif, - u8 nss_mcs = mt7996_mcu_get_sta_nss(mcs_map); - u8 snd_dim, sts; - -+ if (!vc) -+ return; -+ - bf->tx_mode = MT_PHY_TYPE_HE_SU; - - mt7996_mcu_sta_sounding_rate(bf); --- -2.25.1 From d33f05a5e13f8992c2e9e966fd074d2df6818cfc Mon Sep 17 00:00:00 2001 From: Rudy Andram Date: Sun, 22 Sep 2024 14:12:29 +0100 Subject: [PATCH 26/40] Revert "generic: phy: aquantia: add pending patch to force MDI pair order" This reverts commit cb2a11f49c989d46bd366e52deac529e33118ce4. --- ...hy-aquantia-enable-AQR112-and-AQR412.patch | 8 +- ...aquantia-fix-system-side-protocol-mi.patch | 2 +- ...ntia-add-PHY_IDs-for-AQR112-variants.patch | 6 +- ...tia-allow-forcing-order-of-MDI-pairs.patch | 104 ------------------ 4 files changed, 8 insertions(+), 112 deletions(-) delete mode 100644 target/linux/generic/pending-6.6/752-net-phy-aquantia-allow-forcing-order-of-MDI-pairs.patch diff --git a/target/linux/generic/hack-6.6/722-net-phy-aquantia-enable-AQR112-and-AQR412.patch b/target/linux/generic/hack-6.6/722-net-phy-aquantia-enable-AQR112-and-AQR412.patch index 4ebddb3b4560af..cba05f4bbcd77c 100644 --- a/target/linux/generic/hack-6.6/722-net-phy-aquantia-enable-AQR112-and-AQR412.patch +++ b/target/linux/generic/hack-6.6/722-net-phy-aquantia-enable-AQR112-and-AQR412.patch @@ -15,7 +15,7 @@ Signed-off-by: Alex Marginean --- a/drivers/net/phy/aquantia/aquantia_main.c +++ b/drivers/net/phy/aquantia/aquantia_main.c -@@ -96,6 +96,29 @@ +@@ -90,6 +90,29 @@ #define AQR107_OP_IN_PROG_SLEEP 1000 #define AQR107_OP_IN_PROG_TIMEOUT 100000 @@ -45,7 +45,7 @@ Signed-off-by: Alex Marginean static int aqr107_get_sset_count(struct phy_device *phydev) { return AQR107_SGMII_STAT_SZ; -@@ -202,6 +225,51 @@ static int aqr_config_aneg(struct phy_de +@@ -196,6 +219,51 @@ static int aqr_config_aneg(struct phy_de return genphy_c45_check_and_restart_aneg(phydev, changed); } @@ -97,7 +97,7 @@ Signed-off-by: Alex Marginean static int aqr_config_intr(struct phy_device *phydev) { bool en = phydev->interrupts == PHY_INTERRUPT_ENABLED; -@@ -848,7 +916,7 @@ static struct phy_driver aqr_driver[] = +@@ -815,7 +883,7 @@ static struct phy_driver aqr_driver[] = PHY_ID_MATCH_MODEL(PHY_ID_AQR112), .name = "Aquantia AQR112", .probe = aqr107_probe, @@ -106,7 +106,7 @@ Signed-off-by: Alex Marginean .config_intr = aqr_config_intr, .handle_interrupt = aqr_handle_interrupt, .get_tunable = aqr107_get_tunable, -@@ -871,7 +939,7 @@ static struct phy_driver aqr_driver[] = +@@ -838,7 +906,7 @@ static struct phy_driver aqr_driver[] = PHY_ID_MATCH_MODEL(PHY_ID_AQR412), .name = "Aquantia AQR412", .probe = aqr107_probe, diff --git a/target/linux/generic/hack-6.6/723-net-phy-aquantia-fix-system-side-protocol-mi.patch b/target/linux/generic/hack-6.6/723-net-phy-aquantia-fix-system-side-protocol-mi.patch index b0cd8016018beb..b5e35dfdd75892 100644 --- a/target/linux/generic/hack-6.6/723-net-phy-aquantia-fix-system-side-protocol-mi.patch +++ b/target/linux/generic/hack-6.6/723-net-phy-aquantia-fix-system-side-protocol-mi.patch @@ -14,7 +14,7 @@ Signed-off-by: Alex Marginean --- a/drivers/net/phy/aquantia/aquantia_main.c +++ b/drivers/net/phy/aquantia/aquantia_main.c -@@ -258,10 +258,16 @@ static int aqr_config_aneg_set_prot(stru +@@ -252,10 +252,16 @@ static int aqr_config_aneg_set_prot(stru phy_write_mmd(phydev, MDIO_MMD_VEND1, AQUANTIA_VND1_GSTART_RATE, aquantia_syscfg[if_type].start_rate); diff --git a/target/linux/generic/hack-6.6/725-net-phy-aquantia-add-PHY_IDs-for-AQR112-variants.patch b/target/linux/generic/hack-6.6/725-net-phy-aquantia-add-PHY_IDs-for-AQR112-variants.patch index b3767f13464ecf..78ba501145dbc9 100644 --- a/target/linux/generic/hack-6.6/725-net-phy-aquantia-add-PHY_IDs-for-AQR112-variants.patch +++ b/target/linux/generic/hack-6.6/725-net-phy-aquantia-add-PHY_IDs-for-AQR112-variants.patch @@ -12,7 +12,7 @@ Signed-off-by: Daniel Golle --- a/drivers/net/phy/aquantia/aquantia_main.c +++ b/drivers/net/phy/aquantia/aquantia_main.c -@@ -31,6 +31,8 @@ +@@ -30,6 +30,8 @@ #define PHY_ID_AQR113C 0x31c31c12 #define PHY_ID_AQR114C 0x31c31c22 #define PHY_ID_AQR813 0x31c31cb2 @@ -21,7 +21,7 @@ Signed-off-by: Daniel Golle #define MDIO_PHYXS_VEND_IF_STATUS 0xe812 #define MDIO_PHYXS_VEND_IF_STATUS_TYPE_MASK GENMASK(7, 3) -@@ -1055,6 +1057,30 @@ static struct phy_driver aqr_driver[] = +@@ -1022,6 +1024,30 @@ static struct phy_driver aqr_driver[] = .led_hw_control_get = aqr_phy_led_hw_control_get, .led_polarity_set = aqr_phy_led_polarity_set, }, @@ -52,7 +52,7 @@ Signed-off-by: Daniel Golle }; module_phy_driver(aqr_driver); -@@ -1075,6 +1101,8 @@ static struct mdio_device_id __maybe_unu +@@ -1042,6 +1068,8 @@ static struct mdio_device_id __maybe_unu { PHY_ID_MATCH_MODEL(PHY_ID_AQR113C) }, { PHY_ID_MATCH_MODEL(PHY_ID_AQR114C) }, { PHY_ID_MATCH_MODEL(PHY_ID_AQR813) }, diff --git a/target/linux/generic/pending-6.6/752-net-phy-aquantia-allow-forcing-order-of-MDI-pairs.patch b/target/linux/generic/pending-6.6/752-net-phy-aquantia-allow-forcing-order-of-MDI-pairs.patch deleted file mode 100644 index 97e2953a5073e9..00000000000000 --- a/target/linux/generic/pending-6.6/752-net-phy-aquantia-allow-forcing-order-of-MDI-pairs.patch +++ /dev/null @@ -1,104 +0,0 @@ -From 49d46df79404a37685e0f32deb36506f5723e3a0 Mon Sep 17 00:00:00 2001 -From: Daniel Golle -Date: Wed, 28 Aug 2024 23:52:09 +0100 -Subject: [PATCH] net: phy: aquantia: allow forcing order of MDI pairs - -Despite supporting Auto MDI-X, it looks like Aquantia only supports -swapping pair (1,2) with pair (3,6) like it used to be for MDI-X on -100MBit/s networks. - -When all 4 pairs are in use (for 1000MBit/s or faster) the link does not -come up with pair order is not configured correctly, either using -MDI_CFG pin or using the "PMA Receive Reserved Vendor Provisioning 1" -register. - -Normally, the order of MDI pairs being either ABCD or DCBA is configured -by pulling the MDI_CFG pin. - -However, some hardware designs require overriding the value configured -by that bootstrap pin. The PHY allows doing that by setting a bit in -"PMA Receive Reserved Vendor Provisioning 1" register which allows -ignoring the state of the MDI_CFG pin and another bit configuring -whether the order of MDI pairs should be normal (ABCD) or reverse -(DCBA). Pair polarity is not affected and remains identical in both -settings. - -Introduce property "marvell,mdi-cfg-order" which allows forcing either -normal or reverse order of the MDI pairs from DT. - -If the property isn't present, the behavior is unchanged and MDI pair -order configuration is untouched (ie. either the result of MDI_CFG pin -pull-up/pull-down, or pair order override already configured by the -bootloader before Linux is started). - -Forcing normal pair order is required on the Adtran SDG-8733A Wi-Fi 7 -residential gateway. - -Signed-off-by: Daniel Golle ---- - drivers/net/phy/aquantia/aquantia_main.c | 33 ++++++++++++++++++++++++ - 1 file changed, 33 insertions(+) - ---- a/drivers/net/phy/aquantia/aquantia_main.c -+++ b/drivers/net/phy/aquantia/aquantia_main.c -@@ -11,6 +11,7 @@ - #include - #include - #include -+#include - #include - - #include "aquantia.h" -@@ -70,6 +71,11 @@ - #define MDIO_AN_TX_VEND_INT_MASK2 0xd401 - #define MDIO_AN_TX_VEND_INT_MASK2_LINK BIT(0) - -+#define PMAPMD_RSVD_VEND_PROV 0xe400 -+#define PMAPMD_RSVD_VEND_PROV_MDI_CONF GENMASK(1, 0) -+#define PMAPMD_RSVD_VEND_PROV_MDI_REVERSE BIT(0) -+#define PMAPMD_RSVD_VEND_PROV_MDI_FORCE BIT(1) -+ - #define MDIO_AN_RX_LP_STAT1 0xe820 - #define MDIO_AN_RX_LP_STAT1_1000BASET_FULL BIT(15) - #define MDIO_AN_RX_LP_STAT1_1000BASET_HALF BIT(14) -@@ -497,6 +503,29 @@ static int aqr107_wait_processor_intensi - return 0; - } - -+static int aqr107_config_mdi(struct phy_device *phydev) -+{ -+ struct device_node *np = phydev->mdio.dev.of_node; -+ u32 mdi_conf; -+ int ret; -+ -+ ret = of_property_read_u32(np, "marvell,mdi-cfg-order", &mdi_conf); -+ -+ /* Do nothing in case property "marvell,mdi-cfg-order" is not present */ -+ if (ret == -ENOENT) -+ return 0; -+ -+ if (ret) -+ return ret; -+ -+ if (mdi_conf & ~PMAPMD_RSVD_VEND_PROV_MDI_REVERSE) -+ return -EINVAL; -+ -+ return phy_modify_mmd(phydev, MDIO_MMD_PMAPMD, PMAPMD_RSVD_VEND_PROV, -+ PMAPMD_RSVD_VEND_PROV_MDI_CONF, -+ mdi_conf | PMAPMD_RSVD_VEND_PROV_MDI_FORCE); -+} -+ - static int aqr107_config_init(struct phy_device *phydev) - { - struct aqr107_priv *priv = phydev->priv; -@@ -535,6 +564,10 @@ static int aqr107_config_init(struct phy - if (ret) - return ret; - -+ ret = aqr107_config_mdi(phydev); -+ if (ret) -+ return ret; -+ - /* Restore LED polarity state after reset */ - for_each_set_bit(led_active_low, &priv->leds_active_low, AQR_MAX_LEDS) { - ret = aqr_phy_led_active_low_set(phydev, led_active_low, true); From 8209ca5ad7c91cac353b6b1d04dcd6d970a53b4e Mon Sep 17 00:00:00 2001 From: Rudy Andram Date: Mon, 23 Sep 2024 17:29:40 +0100 Subject: [PATCH 27/40] update mt76 with latest upstream changes --- package/kernel/mt76/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile index 536263af15f3dc..50251d3d59e59b 100644 --- a/package/kernel/mt76/Makefile +++ b/package/kernel/mt76/Makefile @@ -9,8 +9,8 @@ PKG_LICENSE_FILES:= PKG_SOURCE_URL:=https://github.com/rmandrad/mt76 PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2024-09-20 -PKG_SOURCE_VERSION:=1e930e0c7397b2bf20e6b821434982b8ee970c05 +PKG_SOURCE_DATE:=2024-09-23 +PKG_SOURCE_VERSION:=09ae763c65539f2177430c44a1eb5dcb2b734bdd PKG_MIRROR_HASH:=771d9992ef837f0c4a58329ed425fb8b00334ab73834216596b3ee9872ab3f79 PKG_MAINTAINER:=Felix Fietkau From 2d1f1d8ef114ec861434f818e0d34b09352b8c45 Mon Sep 17 00:00:00 2001 From: Rudy Andram Date: Mon, 23 Sep 2024 17:43:13 +0100 Subject: [PATCH 28/40] update netifd/hostapd.sh --- .../wifi-scripts/files/lib/netifd/hostapd.sh | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/package/network/config/wifi-scripts/files/lib/netifd/hostapd.sh b/package/network/config/wifi-scripts/files/lib/netifd/hostapd.sh index dac4a22cfa10dd..1069823678caa5 100644 --- a/package/network/config/wifi-scripts/files/lib/netifd/hostapd.sh +++ b/package/network/config/wifi-scripts/files/lib/netifd/hostapd.sh @@ -386,8 +386,8 @@ hostapd_common_add_bss_config() { config_add_array radius_auth_req_attr config_add_array radius_acct_req_attr - 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 eap_server radius_server_auth_port + config_add_string eap_user_file ca_cert server_cert private_key private_key_passwd server_id radius_server_clients config_add_boolean fils config_add_string fils_dhcp @@ -601,7 +601,7 @@ hostapd_set_bss_options() { multicast_to_unicast_all proxy_arp per_sta_vif \ eap_server eap_user_file ca_cert server_cert private_key private_key_passwd server_id \ vendor_elements fils ocv apup unsol_bcast_probe_resp_interval fils_discovery_min_interval \ - fils_discovery_max_interval rnr group_cipher group_mgmt_cipher + fils_discovery_max_interval rnr group_cipher group_mgmt_cipher radius_server_clients radius_server_auth_port set_default fils 0 set_default isolate 0 @@ -1239,16 +1239,18 @@ 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" - append bss_conf "eap_server_erp=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 + if [ "$eap_server" = "1" ]; then + append bss_conf "eap_server=1" "$N" + append bss_conf "eap_server_erp=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" + [ -n "$radius_server_clients" ] && append bss_conf "radius_server_clients=$radius_server_clients" "$N" + [ -n "$radius_server_auth_port" ] && append bss_conf "radius_server_auth_port=$radius_server_auth_port" "$N" + fi set_default multicast_to_unicast_all 0 if [ "$multicast_to_unicast_all" -gt 0 ]; then From 104d2147e602728f572cb93dadbf68a83f538110 Mon Sep 17 00:00:00 2001 From: Rudy Andram Date: Tue, 24 Sep 2024 05:00:01 +0100 Subject: [PATCH 29/40] add AQR patch for forcing order of mdi pairs if enabled on the dts --- ...tia-allow-forcing-order-of-MDI-pairs.patch | 104 ++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 target/linux/generic/pending-6.6/752-net-phy-aquantia-allow-forcing-order-of-MDI-pairs.patch diff --git a/target/linux/generic/pending-6.6/752-net-phy-aquantia-allow-forcing-order-of-MDI-pairs.patch b/target/linux/generic/pending-6.6/752-net-phy-aquantia-allow-forcing-order-of-MDI-pairs.patch new file mode 100644 index 00000000000000..f3ae893b32b99e --- /dev/null +++ b/target/linux/generic/pending-6.6/752-net-phy-aquantia-allow-forcing-order-of-MDI-pairs.patch @@ -0,0 +1,104 @@ +From 49d46df79404a37685e0f32deb36506f5723e3a0 Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Wed, 28 Aug 2024 23:52:09 +0100 +Subject: [PATCH] net: phy: aquantia: allow forcing order of MDI pairs + +Despite supporting Auto MDI-X, it looks like Aquantia only supports +swapping pair (1,2) with pair (3,6) like it used to be for MDI-X on +100MBit/s networks. + +When all 4 pairs are in use (for 1000MBit/s or faster) the link does not +come up with pair order is not configured correctly, either using +MDI_CFG pin or using the "PMA Receive Reserved Vendor Provisioning 1" +register. + +Normally, the order of MDI pairs being either ABCD or DCBA is configured +by pulling the MDI_CFG pin. + +However, some hardware designs require overriding the value configured +by that bootstrap pin. The PHY allows doing that by setting a bit in +"PMA Receive Reserved Vendor Provisioning 1" register which allows +ignoring the state of the MDI_CFG pin and another bit configuring +whether the order of MDI pairs should be normal (ABCD) or reverse +(DCBA). Pair polarity is not affected and remains identical in both +settings. + +Introduce property "marvell,mdi-cfg-order" which allows forcing either +normal or reverse order of the MDI pairs from DT. + +If the property isn't present, the behavior is unchanged and MDI pair +order configuration is untouched (ie. either the result of MDI_CFG pin +pull-up/pull-down, or pair order override already configured by the +bootloader before Linux is started). + +Forcing normal pair order is required on the Adtran SDG-8733A Wi-Fi 7 +residential gateway. + +Signed-off-by: Daniel Golle +--- + drivers/net/phy/aquantia/aquantia_main.c | 33 ++++++++++++++++++++++++ + 1 file changed, 33 insertions(+) + +--- a/drivers/net/phy/aquantia/aquantia_main.c ++++ b/drivers/net/phy/aquantia/aquantia_main.c +@@ -11,6 +11,7 @@ + #include + #include + #include ++#include + #include + + #include "aquantia.h" +@@ -70,6 +71,11 @@ + #define MDIO_AN_TX_VEND_INT_MASK2 0xd401 + #define MDIO_AN_TX_VEND_INT_MASK2_LINK BIT(0) + ++#define PMAPMD_RSVD_VEND_PROV 0xe400 ++#define PMAPMD_RSVD_VEND_PROV_MDI_CONF GENMASK(1, 0) ++#define PMAPMD_RSVD_VEND_PROV_MDI_REVERSE BIT(0) ++#define PMAPMD_RSVD_VEND_PROV_MDI_FORCE BIT(1) ++ + #define MDIO_AN_RX_LP_STAT1 0xe820 + #define MDIO_AN_RX_LP_STAT1_1000BASET_FULL BIT(15) + #define MDIO_AN_RX_LP_STAT1_1000BASET_HALF BIT(14) +@@ -497,6 +503,29 @@ static int aqr107_wait_processor_intensi + return 0; + } + ++static int aqr107_config_mdi(struct phy_device *phydev) ++{ ++ struct device_node *np = phydev->mdio.dev.of_node; ++ u32 mdi_conf; ++ int ret; ++ ++ ret = of_property_read_u32(np, "marvell,mdi-cfg-order", &mdi_conf); ++ ++ /* Do nothing in case property "marvell,mdi-cfg-order" is not present */ ++ if (ret == -EINVAL) ++ return 0; ++ ++ if (ret) ++ return ret; ++ ++ if (mdi_conf & ~PMAPMD_RSVD_VEND_PROV_MDI_REVERSE) ++ return -EINVAL; ++ ++ return phy_modify_mmd(phydev, MDIO_MMD_PMAPMD, PMAPMD_RSVD_VEND_PROV, ++ PMAPMD_RSVD_VEND_PROV_MDI_CONF, ++ mdi_conf | PMAPMD_RSVD_VEND_PROV_MDI_FORCE); ++} ++ + static int aqr107_config_init(struct phy_device *phydev) + { + struct aqr107_priv *priv = phydev->priv; +@@ -535,6 +564,10 @@ static int aqr107_config_init(struct phy + if (ret) + return ret; + ++ ret = aqr107_config_mdi(phydev); ++ if (ret) ++ return ret; ++ + /* Restore LED polarity state after reset */ + for_each_set_bit(led_active_low, &priv->leds_active_low, AQR_MAX_LEDS) { + ret = aqr_phy_led_active_low_set(phydev, led_active_low, true); From 4b2f622256ac714f667b8c4b26d958034c8cb6fa Mon Sep 17 00:00:00 2001 From: Rudy Andram Date: Wed, 25 Sep 2024 07:56:47 +0100 Subject: [PATCH 30/40] several updates / sync patches --- feeds.conf.default | 3 +- ...80211-add-rate-duration-for-EHT-rate.patch | 437 ------------------ package/kernel/mt76/Makefile | 4 +- .../files/lib/netifd/wireless/mac80211.sh | 2 +- package/network/services/hostapd/Config.in | 4 +- .../hostapd/files/hostapd-basic.config | 2 +- .../hostapd/files/hostapd-full.config | 2 +- .../hostapd/files/hostapd-mini.config | 2 +- 8 files changed, 11 insertions(+), 445 deletions(-) delete mode 100644 package/kernel/mac80211/patches/subsys/0002-mtk-mac80211-add-rate-duration-for-EHT-rate.patch diff --git a/feeds.conf.default b/feeds.conf.default index 4ad5c9c515b9b1..a03547a83c2729 100644 --- a/feeds.conf.default +++ b/feeds.conf.default @@ -6,4 +6,5 @@ src-git telephony https://git.openwrt.org/feed/telephony.git #src-git targets https://github.com/openwrt/targets.git #src-git oldpackages http://git.openwrt.org/packages.git #src-link custom /usr/src/openwrt/custom-feed -src-git mtk_openwrt_feed https://git01.mediatek.com/openwrt/feeds/mtk-openwrt-feeds;master +#src-git mtk_openwrt_feed https://git01.mediatek.com/openwrt/feeds/mtk-openwrt-feeds;master +src-git mtk_openwrt_feed https://github.com/rmandrad/mtk-openwrt-feeds.git;rmandrad diff --git a/package/kernel/mac80211/patches/subsys/0002-mtk-mac80211-add-rate-duration-for-EHT-rate.patch b/package/kernel/mac80211/patches/subsys/0002-mtk-mac80211-add-rate-duration-for-EHT-rate.patch deleted file mode 100644 index 5e3d05862bf109..00000000000000 --- a/package/kernel/mac80211/patches/subsys/0002-mtk-mac80211-add-rate-duration-for-EHT-rate.patch +++ /dev/null @@ -1,437 +0,0 @@ -From 87774509ec7a9c7dea18a542eddd895dd2158b1a Mon Sep 17 00:00:00 2001 -From: Evelyn Tsai -Date: Wed, 28 Aug 2024 02:17:57 +0800 -mtk: mac80211: add rate duration for EHT rate. ---- - net/mac80211/airtime.c | 349 ++++++++++++++++++++++++++++++++++++++++- - 1 file changed, 346 insertions(+), 3 deletions(-) -diff --git a/net/mac80211/airtime.c b/net/mac80211/airtime.c -index fdf8b65..370477c 100644 ---- a/net/mac80211/airtime.c -+++ b/net/mac80211/airtime.c -@@ -55,10 +55,21 @@ - #define HE_DURATION_S(shift, streams, gi, bps) \ - (HE_DURATION(streams, gi, bps) >> shift) - -+/* Transmit duration for the raw data part of an average sized packet */ -+#define EHT_GI_08 HE_GI_08 -+#define EHT_GI_16 HE_GI_16 -+#define EHT_GI_32 HE_GI_32 -+ -+#define EHT_DURATION(streams, gi, bps) \ -+ HE_DURATION(streams, gi, bps) -+#define EHT_DURATION_S(shift, streams, gi, bps) \ -+ HE_DURATION_S(shift, streams, gi, bps) -+ - #define BW_20 0 - #define BW_40 1 - #define BW_80 2 - #define BW_160 3 -+#define BW_320 4 - - /* - * Define group sort order: HT40 -> SGI -> #streams -@@ -68,17 +79,26 @@ - #define IEEE80211_VHT_STREAM_GROUPS 8 /* BW(=4) * SGI(=2) */ - - #define IEEE80211_HE_MAX_STREAMS 8 -+#define IEEE80211_HE_STREAM_GROUPS 12 /* BW(=4) * GI(=3) */ -+ -+#define IEEE80211_EHT_MAX_STREAMS 16 -+#define IEEE80211_EHT_STREAM_GROUPS 15 /* BW(=5) * GI(=3) */ - - #define IEEE80211_HT_GROUPS_NB (IEEE80211_MAX_STREAMS * \ - IEEE80211_HT_STREAM_GROUPS) - #define IEEE80211_VHT_GROUPS_NB (IEEE80211_MAX_STREAMS * \ - IEEE80211_VHT_STREAM_GROUPS) -+#define IEEE80211_HE_GROUPS_NB (IEEE80211_HE_MAX_STREAMS * \ -+ IEEE80211_HE_STREAM_GROUPS) -+#define IEEE80211_EHT_GROUPS_NB (IEEE80211_EHT_MAX_STREAMS * \ -+ IEEE80211_EHT_STREAM_GROUPS) - - #define IEEE80211_HT_GROUP_0 0 - #define IEEE80211_VHT_GROUP_0 (IEEE80211_HT_GROUP_0 + IEEE80211_HT_GROUPS_NB) - #define IEEE80211_HE_GROUP_0 (IEEE80211_VHT_GROUP_0 + IEEE80211_VHT_GROUPS_NB) -+#define IEEE80211_EHT_GROUP_0 (IEEE80211_HE_GROUP_0 + IEEE80211_HE_GROUPS_NB) - --#define MCS_GROUP_RATES 12 -+#define MCS_GROUP_RATES 14 - - #define HT_GROUP_IDX(_streams, _sgi, _ht40) \ - IEEE80211_HT_GROUP_0 + \ -@@ -203,6 +223,59 @@ - #define HE_GROUP(_streams, _gi, _bw) \ - __HE_GROUP(_streams, _gi, _bw, \ - HE_GROUP_SHIFT(_streams, _gi, _bw)) -+ -+#define EHT_BW2VBPS(_bw, r5, r4, r3, r2, r1) \ -+ (_bw == BW_320 ? r5 : _bw == BW_160 ? r4 : _bw == BW_80 ? r3 : _bw == BW_40 ? r2 : r1) -+ -+#define EHT_GROUP_IDX(_streams, _gi, _bw) \ -+ (IEEE80211_EHT_GROUP_0 + \ -+ IEEE80211_EHT_MAX_STREAMS * 3 * (_bw) + \ -+ IEEE80211_EHT_MAX_STREAMS * (_gi) + \ -+ (_streams) - 1) -+ -+#define __EHT_GROUP(_streams, _gi, _bw, _s) \ -+ [EHT_GROUP_IDX(_streams, _gi, _bw)] = { \ -+ .shift = _s, \ -+ .duration = { \ -+ EHT_DURATION_S(_s, _streams, _gi, \ -+ EHT_BW2VBPS(_bw, 1960, 979, 489, 230, 115)), \ -+ EHT_DURATION_S(_s, _streams, _gi, \ -+ EHT_BW2VBPS(_bw, 3920, 1958, 979, 475, 230)), \ -+ EHT_DURATION_S(_s, _streams, _gi, \ -+ EHT_BW2VBPS(_bw, 5880, 2937, 1468, 705, 345)), \ -+ EHT_DURATION_S(_s, _streams, _gi, \ -+ EHT_BW2VBPS(_bw, 7840, 3916, 1958, 936, 475)), \ -+ EHT_DURATION_S(_s, _streams, _gi, \ -+ EHT_BW2VBPS(_bw, 11760, 5875, 2937, 1411, 705)), \ -+ EHT_DURATION_S(_s, _streams, _gi, \ -+ EHT_BW2VBPS(_bw, 15680, 7833, 3916, 1872, 936)), \ -+ EHT_DURATION_S(_s, _streams, _gi, \ -+ EHT_BW2VBPS(_bw, 17640, 8827, 4406, 2102, 1051)), \ -+ EHT_DURATION_S(_s, _streams, _gi, \ -+ EHT_BW2VBPS(_bw, 19600, 9806, 4896, 2347, 1166)), \ -+ EHT_DURATION_S(_s, _streams, _gi, \ -+ EHT_BW2VBPS(_bw, 23520, 11764, 5875, 2808, 1411)), \ -+ EHT_DURATION_S(_s, _streams, _gi, \ -+ EHT_BW2VBPS(_bw, 26133, 13060, 6523, 3124, 1555)), \ -+ EHT_DURATION_S(_s, _streams, _gi, \ -+ EHT_BW2VBPS(_bw, 29400, 14702, 7344, 3513, 1756)), \ -+ EHT_DURATION_S(_s, _streams, _gi, \ -+ EHT_BW2VBPS(_bw, 32666, 16329, 8164, 3902, 1944)), \ -+ EHT_DURATION_S(_s, _streams, _gi, \ -+ EHT_BW2VBPS(_bw, 35280, 17640, 8820, 4212, 2106)), \ -+ EHT_DURATION_S(_s, _streams, _gi, \ -+ EHT_BW2VBPS(_bw, 39200, 19600, 9800, 4680, 2340)) \ -+ } \ -+} -+ -+#define EHT_GROUP_SHIFT(_streams, _gi, _bw) \ -+ GROUP_SHIFT(EHT_DURATION(_streams, _gi, \ -+ EHT_BW2VBPS(_bw, 1960, 979, 489, 230, 115))) -+ -+#define EHT_GROUP(_streams, _gi, _bw) \ -+ __EHT_GROUP(_streams, _gi, _bw, \ -+ EHT_GROUP_SHIFT(_streams, _gi, _bw)) -+ - struct mcs_group { - u8 shift; - u16 duration[MCS_GROUP_RATES]; -@@ -376,6 +449,262 @@ static const struct mcs_group airtime_mcs_groups[] = { - HE_GROUP(6, HE_GI_32, BW_160), - HE_GROUP(7, HE_GI_32, BW_160), - HE_GROUP(8, HE_GI_32, BW_160), -+ -+ /* EHT */ -+ EHT_GROUP( 1, EHT_GI_08, BW_20), -+ EHT_GROUP( 2, EHT_GI_08, BW_20), -+ EHT_GROUP( 3, EHT_GI_08, BW_20), -+ EHT_GROUP( 4, EHT_GI_08, BW_20), -+ EHT_GROUP( 5, EHT_GI_08, BW_20), -+ EHT_GROUP( 6, EHT_GI_08, BW_20), -+ EHT_GROUP( 7, EHT_GI_08, BW_20), -+ EHT_GROUP( 8, EHT_GI_08, BW_20), -+ EHT_GROUP( 9, EHT_GI_08, BW_20), -+ EHT_GROUP(10, EHT_GI_08, BW_20), -+ EHT_GROUP(11, EHT_GI_08, BW_20), -+ EHT_GROUP(12, EHT_GI_08, BW_20), -+ EHT_GROUP(13, EHT_GI_08, BW_20), -+ EHT_GROUP(14, EHT_GI_08, BW_20), -+ EHT_GROUP(15, EHT_GI_08, BW_20), -+ EHT_GROUP(16, EHT_GI_08, BW_20), -+ -+ EHT_GROUP( 1, EHT_GI_16, BW_20), -+ EHT_GROUP( 2, EHT_GI_16, BW_20), -+ EHT_GROUP( 3, EHT_GI_16, BW_20), -+ EHT_GROUP( 4, EHT_GI_16, BW_20), -+ EHT_GROUP( 5, EHT_GI_16, BW_20), -+ EHT_GROUP( 6, EHT_GI_16, BW_20), -+ EHT_GROUP( 7, EHT_GI_16, BW_20), -+ EHT_GROUP( 8, EHT_GI_16, BW_20), -+ EHT_GROUP( 9, EHT_GI_16, BW_20), -+ EHT_GROUP(10, EHT_GI_16, BW_20), -+ EHT_GROUP(11, EHT_GI_16, BW_20), -+ EHT_GROUP(12, EHT_GI_16, BW_20), -+ EHT_GROUP(13, EHT_GI_16, BW_20), -+ EHT_GROUP(14, EHT_GI_16, BW_20), -+ EHT_GROUP(15, EHT_GI_16, BW_20), -+ EHT_GROUP(16, EHT_GI_16, BW_20), -+ -+ EHT_GROUP( 1, EHT_GI_32, BW_20), -+ EHT_GROUP( 2, EHT_GI_32, BW_20), -+ EHT_GROUP( 3, EHT_GI_32, BW_20), -+ EHT_GROUP( 4, EHT_GI_32, BW_20), -+ EHT_GROUP( 5, EHT_GI_32, BW_20), -+ EHT_GROUP( 6, EHT_GI_32, BW_20), -+ EHT_GROUP( 7, EHT_GI_32, BW_20), -+ EHT_GROUP( 8, EHT_GI_32, BW_20), -+ EHT_GROUP( 9, EHT_GI_32, BW_20), -+ EHT_GROUP(10, EHT_GI_32, BW_20), -+ EHT_GROUP(11, EHT_GI_32, BW_20), -+ EHT_GROUP(12, EHT_GI_32, BW_20), -+ EHT_GROUP(13, EHT_GI_32, BW_20), -+ EHT_GROUP(14, EHT_GI_32, BW_20), -+ EHT_GROUP(15, EHT_GI_32, BW_20), -+ EHT_GROUP(16, EHT_GI_32, BW_20), -+ -+ EHT_GROUP( 1, EHT_GI_08, BW_40), -+ EHT_GROUP( 2, EHT_GI_08, BW_40), -+ EHT_GROUP( 3, EHT_GI_08, BW_40), -+ EHT_GROUP( 4, EHT_GI_08, BW_40), -+ EHT_GROUP( 5, EHT_GI_08, BW_40), -+ EHT_GROUP( 6, EHT_GI_08, BW_40), -+ EHT_GROUP( 7, EHT_GI_08, BW_40), -+ EHT_GROUP( 8, EHT_GI_08, BW_40), -+ EHT_GROUP( 9, EHT_GI_08, BW_40), -+ EHT_GROUP(10, EHT_GI_08, BW_40), -+ EHT_GROUP(11, EHT_GI_08, BW_40), -+ EHT_GROUP(12, EHT_GI_08, BW_40), -+ EHT_GROUP(13, EHT_GI_08, BW_40), -+ EHT_GROUP(14, EHT_GI_08, BW_40), -+ EHT_GROUP(15, EHT_GI_08, BW_40), -+ EHT_GROUP(16, EHT_GI_08, BW_40), -+ -+ EHT_GROUP( 1, EHT_GI_16, BW_40), -+ EHT_GROUP( 2, EHT_GI_16, BW_40), -+ EHT_GROUP( 3, EHT_GI_16, BW_40), -+ EHT_GROUP( 4, EHT_GI_16, BW_40), -+ EHT_GROUP( 5, EHT_GI_16, BW_40), -+ EHT_GROUP( 6, EHT_GI_16, BW_40), -+ EHT_GROUP( 7, EHT_GI_16, BW_40), -+ EHT_GROUP( 8, EHT_GI_16, BW_40), -+ EHT_GROUP( 9, EHT_GI_16, BW_40), -+ EHT_GROUP(10, EHT_GI_16, BW_40), -+ EHT_GROUP(11, EHT_GI_16, BW_40), -+ EHT_GROUP(12, EHT_GI_16, BW_40), -+ EHT_GROUP(13, EHT_GI_16, BW_40), -+ EHT_GROUP(14, EHT_GI_16, BW_40), -+ EHT_GROUP(15, EHT_GI_16, BW_40), -+ EHT_GROUP(16, EHT_GI_16, BW_40), -+ -+ EHT_GROUP( 1, EHT_GI_32, BW_40), -+ EHT_GROUP( 2, EHT_GI_32, BW_40), -+ EHT_GROUP( 3, EHT_GI_32, BW_40), -+ EHT_GROUP( 4, EHT_GI_32, BW_40), -+ EHT_GROUP( 5, EHT_GI_32, BW_40), -+ EHT_GROUP( 6, EHT_GI_32, BW_40), -+ EHT_GROUP( 7, EHT_GI_32, BW_40), -+ EHT_GROUP( 8, EHT_GI_32, BW_40), -+ EHT_GROUP( 9, EHT_GI_32, BW_40), -+ EHT_GROUP(10, EHT_GI_32, BW_40), -+ EHT_GROUP(11, EHT_GI_32, BW_40), -+ EHT_GROUP(12, EHT_GI_32, BW_40), -+ EHT_GROUP(13, EHT_GI_32, BW_40), -+ EHT_GROUP(14, EHT_GI_32, BW_40), -+ EHT_GROUP(15, EHT_GI_32, BW_40), -+ EHT_GROUP(16, EHT_GI_32, BW_40), -+ -+ EHT_GROUP( 1, EHT_GI_08, BW_80), -+ EHT_GROUP( 2, EHT_GI_08, BW_80), -+ EHT_GROUP( 3, EHT_GI_08, BW_80), -+ EHT_GROUP( 4, EHT_GI_08, BW_80), -+ EHT_GROUP( 5, EHT_GI_08, BW_80), -+ EHT_GROUP( 6, EHT_GI_08, BW_80), -+ EHT_GROUP( 7, EHT_GI_08, BW_80), -+ EHT_GROUP( 8, EHT_GI_08, BW_80), -+ EHT_GROUP( 9, EHT_GI_08, BW_80), -+ EHT_GROUP(10, EHT_GI_08, BW_80), -+ EHT_GROUP(11, EHT_GI_08, BW_80), -+ EHT_GROUP(12, EHT_GI_08, BW_80), -+ EHT_GROUP(13, EHT_GI_08, BW_80), -+ EHT_GROUP(14, EHT_GI_08, BW_80), -+ EHT_GROUP(15, EHT_GI_08, BW_80), -+ EHT_GROUP(16, EHT_GI_08, BW_80), -+ -+ EHT_GROUP( 1, EHT_GI_16, BW_80), -+ EHT_GROUP( 2, EHT_GI_16, BW_80), -+ EHT_GROUP( 3, EHT_GI_16, BW_80), -+ EHT_GROUP( 4, EHT_GI_16, BW_80), -+ EHT_GROUP( 5, EHT_GI_16, BW_80), -+ EHT_GROUP( 6, EHT_GI_16, BW_80), -+ EHT_GROUP( 7, EHT_GI_16, BW_80), -+ EHT_GROUP( 8, EHT_GI_16, BW_80), -+ EHT_GROUP( 9, EHT_GI_16, BW_80), -+ EHT_GROUP(10, EHT_GI_16, BW_80), -+ EHT_GROUP(11, EHT_GI_16, BW_80), -+ EHT_GROUP(12, EHT_GI_16, BW_80), -+ EHT_GROUP(13, EHT_GI_16, BW_80), -+ EHT_GROUP(14, EHT_GI_16, BW_80), -+ EHT_GROUP(15, EHT_GI_16, BW_80), -+ EHT_GROUP(16, EHT_GI_16, BW_80), -+ -+ EHT_GROUP( 1, EHT_GI_32, BW_80), -+ EHT_GROUP( 2, EHT_GI_32, BW_80), -+ EHT_GROUP( 3, EHT_GI_32, BW_80), -+ EHT_GROUP( 4, EHT_GI_32, BW_80), -+ EHT_GROUP( 5, EHT_GI_32, BW_80), -+ EHT_GROUP( 6, EHT_GI_32, BW_80), -+ EHT_GROUP( 7, EHT_GI_32, BW_80), -+ EHT_GROUP( 8, EHT_GI_32, BW_80), -+ EHT_GROUP( 9, EHT_GI_32, BW_80), -+ EHT_GROUP(10, EHT_GI_32, BW_80), -+ EHT_GROUP(11, EHT_GI_32, BW_80), -+ EHT_GROUP(12, EHT_GI_32, BW_80), -+ EHT_GROUP(13, EHT_GI_32, BW_80), -+ EHT_GROUP(14, EHT_GI_32, BW_80), -+ EHT_GROUP(15, EHT_GI_32, BW_80), -+ EHT_GROUP(16, EHT_GI_32, BW_80), -+ -+ EHT_GROUP( 1, EHT_GI_08, BW_160), -+ EHT_GROUP( 2, EHT_GI_08, BW_160), -+ EHT_GROUP( 3, EHT_GI_08, BW_160), -+ EHT_GROUP( 4, EHT_GI_08, BW_160), -+ EHT_GROUP( 5, EHT_GI_08, BW_160), -+ EHT_GROUP( 6, EHT_GI_08, BW_160), -+ EHT_GROUP( 7, EHT_GI_08, BW_160), -+ EHT_GROUP( 8, EHT_GI_08, BW_160), -+ EHT_GROUP( 9, EHT_GI_08, BW_160), -+ EHT_GROUP(10, EHT_GI_08, BW_160), -+ EHT_GROUP(11, EHT_GI_08, BW_160), -+ EHT_GROUP(12, EHT_GI_08, BW_160), -+ EHT_GROUP(13, EHT_GI_08, BW_160), -+ EHT_GROUP(14, EHT_GI_08, BW_160), -+ EHT_GROUP(15, EHT_GI_08, BW_160), -+ EHT_GROUP(16, EHT_GI_08, BW_160), -+ -+ EHT_GROUP( 1, EHT_GI_16, BW_160), -+ EHT_GROUP( 2, EHT_GI_16, BW_160), -+ EHT_GROUP( 3, EHT_GI_16, BW_160), -+ EHT_GROUP( 4, EHT_GI_16, BW_160), -+ EHT_GROUP( 5, EHT_GI_16, BW_160), -+ EHT_GROUP( 6, EHT_GI_16, BW_160), -+ EHT_GROUP( 7, EHT_GI_16, BW_160), -+ EHT_GROUP( 8, EHT_GI_16, BW_160), -+ EHT_GROUP( 9, EHT_GI_16, BW_160), -+ EHT_GROUP(10, EHT_GI_16, BW_160), -+ EHT_GROUP(11, EHT_GI_16, BW_160), -+ EHT_GROUP(12, EHT_GI_16, BW_160), -+ EHT_GROUP(13, EHT_GI_16, BW_160), -+ EHT_GROUP(14, EHT_GI_16, BW_160), -+ EHT_GROUP(15, EHT_GI_16, BW_160), -+ EHT_GROUP(16, EHT_GI_16, BW_160), -+ -+ EHT_GROUP( 1, EHT_GI_32, BW_160), -+ EHT_GROUP( 2, EHT_GI_32, BW_160), -+ EHT_GROUP( 3, EHT_GI_32, BW_160), -+ EHT_GROUP( 4, EHT_GI_32, BW_160), -+ EHT_GROUP( 5, EHT_GI_32, BW_160), -+ EHT_GROUP( 6, EHT_GI_32, BW_160), -+ EHT_GROUP( 7, EHT_GI_32, BW_160), -+ EHT_GROUP( 8, EHT_GI_32, BW_160), -+ EHT_GROUP( 9, EHT_GI_32, BW_160), -+ EHT_GROUP(10, EHT_GI_32, BW_160), -+ EHT_GROUP(11, EHT_GI_32, BW_160), -+ EHT_GROUP(12, EHT_GI_32, BW_160), -+ EHT_GROUP(13, EHT_GI_32, BW_160), -+ EHT_GROUP(14, EHT_GI_32, BW_160), -+ EHT_GROUP(15, EHT_GI_32, BW_160), -+ EHT_GROUP(16, EHT_GI_32, BW_160), -+ -+ EHT_GROUP( 1, EHT_GI_08, BW_320), -+ EHT_GROUP( 2, EHT_GI_08, BW_320), -+ EHT_GROUP( 3, EHT_GI_08, BW_320), -+ EHT_GROUP( 4, EHT_GI_08, BW_320), -+ EHT_GROUP( 5, EHT_GI_08, BW_320), -+ EHT_GROUP( 6, EHT_GI_08, BW_320), -+ EHT_GROUP( 7, EHT_GI_08, BW_320), -+ EHT_GROUP( 8, EHT_GI_08, BW_320), -+ EHT_GROUP( 9, EHT_GI_08, BW_320), -+ EHT_GROUP(10, EHT_GI_08, BW_320), -+ EHT_GROUP(11, EHT_GI_08, BW_320), -+ EHT_GROUP(12, EHT_GI_08, BW_320), -+ EHT_GROUP(13, EHT_GI_08, BW_320), -+ EHT_GROUP(14, EHT_GI_08, BW_320), -+ EHT_GROUP(15, EHT_GI_08, BW_320), -+ EHT_GROUP(16, EHT_GI_08, BW_320), -+ -+ EHT_GROUP( 1, EHT_GI_16, BW_320), -+ EHT_GROUP( 2, EHT_GI_16, BW_320), -+ EHT_GROUP( 3, EHT_GI_16, BW_320), -+ EHT_GROUP( 4, EHT_GI_16, BW_320), -+ EHT_GROUP( 5, EHT_GI_16, BW_320), -+ EHT_GROUP( 6, EHT_GI_16, BW_320), -+ EHT_GROUP( 7, EHT_GI_16, BW_320), -+ EHT_GROUP( 8, EHT_GI_16, BW_320), -+ EHT_GROUP( 9, EHT_GI_16, BW_320), -+ EHT_GROUP(10, EHT_GI_16, BW_320), -+ EHT_GROUP(11, EHT_GI_16, BW_320), -+ EHT_GROUP(12, EHT_GI_16, BW_320), -+ EHT_GROUP(13, EHT_GI_16, BW_320), -+ EHT_GROUP(14, EHT_GI_16, BW_320), -+ EHT_GROUP(15, EHT_GI_16, BW_320), -+ EHT_GROUP(16, EHT_GI_16, BW_320), -+ -+ EHT_GROUP( 1, EHT_GI_32, BW_320), -+ EHT_GROUP( 2, EHT_GI_32, BW_320), -+ EHT_GROUP( 3, EHT_GI_32, BW_320), -+ EHT_GROUP( 4, EHT_GI_32, BW_320), -+ EHT_GROUP( 5, EHT_GI_32, BW_320), -+ EHT_GROUP( 6, EHT_GI_32, BW_320), -+ EHT_GROUP( 7, EHT_GI_32, BW_320), -+ EHT_GROUP( 8, EHT_GI_32, BW_320), -+ EHT_GROUP( 9, EHT_GI_32, BW_320), -+ EHT_GROUP(10, EHT_GI_32, BW_320), -+ EHT_GROUP(11, EHT_GI_32, BW_320), -+ EHT_GROUP(12, EHT_GI_32, BW_320), -+ EHT_GROUP(13, EHT_GI_32, BW_320), -+ EHT_GROUP(14, EHT_GI_32, BW_320), -+ EHT_GROUP(15, EHT_GI_32, BW_320), -+ EHT_GROUP(16, EHT_GI_32, BW_320), - }; - - static u32 -@@ -422,6 +751,9 @@ static u32 ieee80211_get_rate_duration(struct ieee80211_hw *hw, - case RATE_INFO_BW_160: - bw = BW_160; - break; -+ case RATE_INFO_BW_320: -+ bw = BW_320; -+ break; - default: - WARN_ON_ONCE(1); - return 0; -@@ -443,11 +775,20 @@ static u32 ieee80211_get_rate_duration(struct ieee80211_hw *hw, - idx = status->rate_idx; - group = HE_GROUP_IDX(streams, status->he_gi, bw); - break; -+ case RX_ENC_EHT: -+ streams = status->nss; -+ idx = status->rate_idx; -+ group = EHT_GROUP_IDX(streams, status->he_gi, bw); -+ break; - default: - WARN_ON_ONCE(1); - return 0; - } - -+ if (WARN_ON_ONCE((status->encoding != RX_ENC_EHT && streams > 8) || -+ (status->encoding == RX_ENC_EHT && streams > 16))) -+ return 0; -+ - if (WARN_ON_ONCE((status->encoding != RX_ENC_HE && streams > 4) || - (status->encoding == RX_ENC_HE && streams > 8))) - return 0; -@@ -517,7 +858,9 @@ static bool ieee80211_fill_rate_info(struct ieee80211_hw *hw, - stat->nss = ri->nss; - stat->rate_idx = ri->mcs; - -- if (ri->flags & RATE_INFO_FLAGS_HE_MCS) -+ if (ri->flags & RATE_INFO_FLAGS_EHT_MCS) -+ stat->encoding = RX_ENC_EHT; -+ else if (ri->flags & RATE_INFO_FLAGS_HE_MCS) - stat->encoding = RX_ENC_HE; - else if (ri->flags & RATE_INFO_FLAGS_VHT_MCS) - stat->encoding = RX_ENC_VHT; -@@ -529,7 +872,7 @@ static bool ieee80211_fill_rate_info(struct ieee80211_hw *hw, - if (ri->flags & RATE_INFO_FLAGS_SHORT_GI) - stat->enc_flags |= RX_ENC_FLAG_SHORT_GI; - -- stat->he_gi = ri->he_gi; -+ stat->he_gi = (ri->flags & RATE_INFO_FLAGS_EHT_MCS) ? ri->eht_gi : ri->he_gi; - - if (stat->encoding != RX_ENC_LEGACY) - return true; --- -2.45.2 diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile index 50251d3d59e59b..630485ba6f969e 100644 --- a/package/kernel/mt76/Makefile +++ b/package/kernel/mt76/Makefile @@ -11,7 +11,7 @@ PKG_SOURCE_PROTO:=git PKG_SOURCE_DATE:=2024-09-23 PKG_SOURCE_VERSION:=09ae763c65539f2177430c44a1eb5dcb2b734bdd -PKG_MIRROR_HASH:=771d9992ef837f0c4a58329ed425fb8b00334ab73834216596b3ee9872ab3f79 +PKG_MIRROR_HASH:=a68df9981167ccb1731537035f7a48bf481b1f090c9ecf856eda4d931ab545d4 PKG_MAINTAINER:=Felix Fietkau PKG_USE_NINJA:=0 @@ -42,6 +42,8 @@ define KernelPackage/mt76-default DEPENDS:= \ +kmod-mac80211 \ +@DRIVER_11AC_SUPPORT \ + +@DRIVER_11AX_SUPPORT \ + +@DRIVER_11BE_SUPPORT \ +@KERNEL_PAGE_POOL endef diff --git a/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh b/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh index ede13bb01c2c32..98e6bfbe94b7ef 100755 --- a/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh +++ b/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh @@ -578,7 +578,7 @@ mac80211_hostapd_setup_base() { append base_cfg "he_mu_edca_ac_vo_timer=3" "$N" fi - set_default tx_burst 2 + set_default tx_burst 2.0 # 802.11be enable_be=0 diff --git a/package/network/services/hostapd/Config.in b/package/network/services/hostapd/Config.in index 742cd78a14627b..25df1efbd6a79d 100644 --- a/package/network/services/hostapd/Config.in +++ b/package/network/services/hostapd/Config.in @@ -37,12 +37,12 @@ config DRIVER_11AC_SUPPORT config DRIVER_11AX_SUPPORT bool - default n + default y select WPA_MBO_SUPPORT config DRIVER_11BE_SUPPORT bool - default n + default y config WPA_ENABLE_WEP bool "Enable support for unsecure and obsolete WEP" diff --git a/package/network/services/hostapd/files/hostapd-basic.config b/package/network/services/hostapd/files/hostapd-basic.config index fa06a95043f3a4..6924cc1ffe8ada 100644 --- a/package/network/services/hostapd/files/hostapd-basic.config +++ b/package/network/services/hostapd/files/hostapd-basic.config @@ -170,7 +170,7 @@ CONFIG_IEEE80211AC=y # final IEEE 802.11ax version. #CONFIG_IEEE80211AX=y -#CONFIG_IEEE80211BE=y +CONFIG_IEEE80211BE=y # Remove debugging code that is printing out debug messages to stdout. # This can be used to reduce the size of the hostapd considerably if debugging diff --git a/package/network/services/hostapd/files/hostapd-full.config b/package/network/services/hostapd/files/hostapd-full.config index e2561e6424ca12..d2397c850568f6 100644 --- a/package/network/services/hostapd/files/hostapd-full.config +++ b/package/network/services/hostapd/files/hostapd-full.config @@ -170,7 +170,7 @@ CONFIG_IEEE80211AC=y # final IEEE 802.11ax version. #CONFIG_IEEE80211AX=y -#CONFIG_IEEE80211BE=y +CONFIG_IEEE80211BE=y # Remove debugging code that is printing out debug messages to stdout. # This can be used to reduce the size of the hostapd considerably if debugging diff --git a/package/network/services/hostapd/files/hostapd-mini.config b/package/network/services/hostapd/files/hostapd-mini.config index 5d38b777636b62..9a3aa838ce59cf 100644 --- a/package/network/services/hostapd/files/hostapd-mini.config +++ b/package/network/services/hostapd/files/hostapd-mini.config @@ -170,7 +170,7 @@ CONFIG_IEEE80211AC=y # final IEEE 802.11ax version. #CONFIG_IEEE80211AX=y -#CONFIG_IEEE80211BE=y +CONFIG_IEEE80211BE=y # Remove debugging code that is printing out debug messages to stdout. # This can be used to reduce the size of the hostapd considerably if debugging From 0c12b0d958349d84f264b436c291c43d275ebfd4 Mon Sep 17 00:00:00 2001 From: N-Storm Date: Wed, 25 Sep 2024 16:42:31 +0300 Subject: [PATCH 31/40] Increase partition sizes to fit current images --- target/linux/mediatek/image/filogic.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 42d096d4651550..d9fdfabbdecb83 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -40,13 +40,13 @@ define Build/mt798x-gpt -t 0x83 -N ubootenv -r -p 512k@4M \ -t 0x83 -N factory -r -p 2M@4608k \ -t 0xef -N fip -r -p 4M@6656k \ - -N recovery -r -p 32M@12M \ + -N recovery -r -p 64M@12M \ $(if $(findstring sdmmc,$1), \ - -N install -r -p 20M@44M \ - -t 0x2e -N production -p $(CONFIG_TARGET_ROOTFS_PARTSIZE)M@64M \ + -N install -r -p 52M@76M \ + -t 0x2e -N production -p $(CONFIG_TARGET_ROOTFS_PARTSIZE)M@128M \ ) \ $(if $(findstring emmc,$1), \ - -t 0x2e -N production -p $(CONFIG_TARGET_ROOTFS_PARTSIZE)M@64M \ + -t 0x2e -N production -p $(CONFIG_TARGET_ROOTFS_PARTSIZE)M@128M \ ) cat $@.tmp >> $@ rm $@.tmp From cde283cafbee7dd7b12411515b96091309f81b9f Mon Sep 17 00:00:00 2001 From: N-Storm Date: Wed, 25 Sep 2024 17:30:34 +0300 Subject: [PATCH 32/40] Refresh patches & fixup packages --- package/kernel/mt76/Makefile | 2 +- .../722-net-phy-aquantia-enable-AQR112-and-AQR412.patch | 8 ++++---- ...723-net-phy-aquantia-fix-system-side-protocol-mi.patch | 2 +- ...net-phy-aquantia-add-PHY_IDs-for-AQR112-variants.patch | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile index 50251d3d59e59b..dfba591c17de3e 100644 --- a/package/kernel/mt76/Makefile +++ b/package/kernel/mt76/Makefile @@ -11,7 +11,7 @@ PKG_SOURCE_PROTO:=git PKG_SOURCE_DATE:=2024-09-23 PKG_SOURCE_VERSION:=09ae763c65539f2177430c44a1eb5dcb2b734bdd -PKG_MIRROR_HASH:=771d9992ef837f0c4a58329ed425fb8b00334ab73834216596b3ee9872ab3f79 +PKG_MIRROR_HASH:=a68df9981167ccb1731537035f7a48bf481b1f090c9ecf856eda4d931ab545d4 PKG_MAINTAINER:=Felix Fietkau PKG_USE_NINJA:=0 diff --git a/target/linux/generic/hack-6.6/722-net-phy-aquantia-enable-AQR112-and-AQR412.patch b/target/linux/generic/hack-6.6/722-net-phy-aquantia-enable-AQR112-and-AQR412.patch index cba05f4bbcd77c..4ebddb3b4560af 100644 --- a/target/linux/generic/hack-6.6/722-net-phy-aquantia-enable-AQR112-and-AQR412.patch +++ b/target/linux/generic/hack-6.6/722-net-phy-aquantia-enable-AQR112-and-AQR412.patch @@ -15,7 +15,7 @@ Signed-off-by: Alex Marginean --- a/drivers/net/phy/aquantia/aquantia_main.c +++ b/drivers/net/phy/aquantia/aquantia_main.c -@@ -90,6 +90,29 @@ +@@ -96,6 +96,29 @@ #define AQR107_OP_IN_PROG_SLEEP 1000 #define AQR107_OP_IN_PROG_TIMEOUT 100000 @@ -45,7 +45,7 @@ Signed-off-by: Alex Marginean static int aqr107_get_sset_count(struct phy_device *phydev) { return AQR107_SGMII_STAT_SZ; -@@ -196,6 +219,51 @@ static int aqr_config_aneg(struct phy_de +@@ -202,6 +225,51 @@ static int aqr_config_aneg(struct phy_de return genphy_c45_check_and_restart_aneg(phydev, changed); } @@ -97,7 +97,7 @@ Signed-off-by: Alex Marginean static int aqr_config_intr(struct phy_device *phydev) { bool en = phydev->interrupts == PHY_INTERRUPT_ENABLED; -@@ -815,7 +883,7 @@ static struct phy_driver aqr_driver[] = +@@ -848,7 +916,7 @@ static struct phy_driver aqr_driver[] = PHY_ID_MATCH_MODEL(PHY_ID_AQR112), .name = "Aquantia AQR112", .probe = aqr107_probe, @@ -106,7 +106,7 @@ Signed-off-by: Alex Marginean .config_intr = aqr_config_intr, .handle_interrupt = aqr_handle_interrupt, .get_tunable = aqr107_get_tunable, -@@ -838,7 +906,7 @@ static struct phy_driver aqr_driver[] = +@@ -871,7 +939,7 @@ static struct phy_driver aqr_driver[] = PHY_ID_MATCH_MODEL(PHY_ID_AQR412), .name = "Aquantia AQR412", .probe = aqr107_probe, diff --git a/target/linux/generic/hack-6.6/723-net-phy-aquantia-fix-system-side-protocol-mi.patch b/target/linux/generic/hack-6.6/723-net-phy-aquantia-fix-system-side-protocol-mi.patch index b5e35dfdd75892..b0cd8016018beb 100644 --- a/target/linux/generic/hack-6.6/723-net-phy-aquantia-fix-system-side-protocol-mi.patch +++ b/target/linux/generic/hack-6.6/723-net-phy-aquantia-fix-system-side-protocol-mi.patch @@ -14,7 +14,7 @@ Signed-off-by: Alex Marginean --- a/drivers/net/phy/aquantia/aquantia_main.c +++ b/drivers/net/phy/aquantia/aquantia_main.c -@@ -252,10 +252,16 @@ static int aqr_config_aneg_set_prot(stru +@@ -258,10 +258,16 @@ static int aqr_config_aneg_set_prot(stru phy_write_mmd(phydev, MDIO_MMD_VEND1, AQUANTIA_VND1_GSTART_RATE, aquantia_syscfg[if_type].start_rate); diff --git a/target/linux/generic/hack-6.6/725-net-phy-aquantia-add-PHY_IDs-for-AQR112-variants.patch b/target/linux/generic/hack-6.6/725-net-phy-aquantia-add-PHY_IDs-for-AQR112-variants.patch index 78ba501145dbc9..b3767f13464ecf 100644 --- a/target/linux/generic/hack-6.6/725-net-phy-aquantia-add-PHY_IDs-for-AQR112-variants.patch +++ b/target/linux/generic/hack-6.6/725-net-phy-aquantia-add-PHY_IDs-for-AQR112-variants.patch @@ -12,7 +12,7 @@ Signed-off-by: Daniel Golle --- a/drivers/net/phy/aquantia/aquantia_main.c +++ b/drivers/net/phy/aquantia/aquantia_main.c -@@ -30,6 +30,8 @@ +@@ -31,6 +31,8 @@ #define PHY_ID_AQR113C 0x31c31c12 #define PHY_ID_AQR114C 0x31c31c22 #define PHY_ID_AQR813 0x31c31cb2 @@ -21,7 +21,7 @@ Signed-off-by: Daniel Golle #define MDIO_PHYXS_VEND_IF_STATUS 0xe812 #define MDIO_PHYXS_VEND_IF_STATUS_TYPE_MASK GENMASK(7, 3) -@@ -1022,6 +1024,30 @@ static struct phy_driver aqr_driver[] = +@@ -1055,6 +1057,30 @@ static struct phy_driver aqr_driver[] = .led_hw_control_get = aqr_phy_led_hw_control_get, .led_polarity_set = aqr_phy_led_polarity_set, }, @@ -52,7 +52,7 @@ Signed-off-by: Daniel Golle }; module_phy_driver(aqr_driver); -@@ -1042,6 +1068,8 @@ static struct mdio_device_id __maybe_unu +@@ -1075,6 +1101,8 @@ static struct mdio_device_id __maybe_unu { PHY_ID_MATCH_MODEL(PHY_ID_AQR113C) }, { PHY_ID_MATCH_MODEL(PHY_ID_AQR114C) }, { PHY_ID_MATCH_MODEL(PHY_ID_AQR813) }, From aae49b094f25d675cdc2f8d270f5e91744bbadf3 Mon Sep 17 00:00:00 2001 From: N-Storm Date: Thu, 26 Sep 2024 04:26:39 +0300 Subject: [PATCH 33/40] Changed mtk-openwrt-feeds to upstream url. Added BPI-R4 config. --- config-nstorm-bananapi-bpi-r4 | 829 ++++++++++++++++++++++++++++++++++ feeds.conf.default | 4 +- 2 files changed, 831 insertions(+), 2 deletions(-) create mode 100644 config-nstorm-bananapi-bpi-r4 diff --git a/config-nstorm-bananapi-bpi-r4 b/config-nstorm-bananapi-bpi-r4 new file mode 100644 index 00000000000000..9357e26b50d1a8 --- /dev/null +++ b/config-nstorm-bananapi-bpi-r4 @@ -0,0 +1,829 @@ +CONFIG_TARGET_mediatek=y +CONFIG_TARGET_mediatek_filogic=y +CONFIG_TARGET_mediatek_filogic_DEVICE_bananapi_bpi-r4=y +CONFIG_DEVEL=y +CONFIG_TOOLCHAINOPTS=y +CONFIG_BUSYBOX_CUSTOM=y +CONFIG_BPF_TOOLCHAIN_BUILD_LLVM=y +# CONFIG_BPF_TOOLCHAIN_NONE is not set +CONFIG_BUILD_PATENTED=y +CONFIG_BUSYBOX_CONFIG_ASH_HELP=y +CONFIG_BUSYBOX_CONFIG_ASH_OPTIMIZE_FOR_SIZE=y +CONFIG_BUSYBOX_CONFIG_ASH_SLEEP=y +CONFIG_BUSYBOX_CONFIG_BLKDISCARD=y +CONFIG_BUSYBOX_CONFIG_DEFAULT_DEPMOD_FILE="" +CONFIG_BUSYBOX_CONFIG_DEFAULT_MODULES_DIR="" +CONFIG_BUSYBOX_CONFIG_DNSDOMAINNAME=y +CONFIG_BUSYBOX_CONFIG_EJECT=y +CONFIG_BUSYBOX_CONFIG_FEATURE_CMDLINE_MODULE_OPTIONS=y +CONFIG_BUSYBOX_CONFIG_FEATURE_EDITING_HISTORY=9999 +CONFIG_BUSYBOX_CONFIG_FEATURE_EDITING_SAVEHISTORY=y +CONFIG_BUSYBOX_CONFIG_FEATURE_EDITING_VI=y +CONFIG_BUSYBOX_CONFIG_FEATURE_EDITING_WINCH=y +CONFIG_BUSYBOX_CONFIG_FEATURE_ETC_SERVICES=y +CONFIG_BUSYBOX_CONFIG_FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED=y +CONFIG_BUSYBOX_CONFIG_FEATURE_NTPD_CONF=y +CONFIG_BUSYBOX_CONFIG_FEATURE_PS_LONG=y +CONFIG_BUSYBOX_CONFIG_FEATURE_REVERSE_SEARCH=y +CONFIG_BUSYBOX_CONFIG_FEATURE_SH_HISTFILESIZE=y +CONFIG_BUSYBOX_CONFIG_FEATURE_SH_READ_FRAC=y +CONFIG_BUSYBOX_CONFIG_FEATURE_TC_INGRESS=y +CONFIG_BUSYBOX_CONFIG_FEATURE_TELNET_WIDTH=y +CONFIG_BUSYBOX_CONFIG_FEATURE_USERNAME_COMPLETION=y +CONFIG_BUSYBOX_CONFIG_FEATURE_VOLUMEID_F2FS=y +CONFIG_BUSYBOX_CONFIG_FEATURE_VOLUMEID_LINUXSWAP=y +CONFIG_BUSYBOX_CONFIG_FEATURE_VOLUMEID_UBIFS=y +CONFIG_BUSYBOX_CONFIG_FEATURE_XARGS_SUPPORT_REPL_STR=y +CONFIG_BUSYBOX_CONFIG_FINDFS=y +CONFIG_BUSYBOX_CONFIG_FSTRIM=y +CONFIG_BUSYBOX_CONFIG_FUSER=y +CONFIG_BUSYBOX_CONFIG_HD=y +CONFIG_BUSYBOX_CONFIG_HOSTNAME=y +CONFIG_BUSYBOX_CONFIG_INSMOD=y +CONFIG_BUSYBOX_CONFIG_IONICE=y +CONFIG_BUSYBOX_CONFIG_IOSTAT=y +CONFIG_BUSYBOX_CONFIG_LAST_SUPPORTED_WCHAR=0 +CONFIG_BUSYBOX_CONFIG_LOCALE_SUPPORT=y +CONFIG_BUSYBOX_CONFIG_LSMOD=y +CONFIG_BUSYBOX_CONFIG_LSOF=y +CONFIG_BUSYBOX_CONFIG_LSPCI=y +CONFIG_BUSYBOX_CONFIG_LSUSB=y +CONFIG_BUSYBOX_CONFIG_MD5_SMALL=3 +CONFIG_BUSYBOX_CONFIG_MODINFO=y +CONFIG_BUSYBOX_CONFIG_MODPROBE=y +CONFIG_BUSYBOX_CONFIG_MODPROBE_SMALL=y +CONFIG_BUSYBOX_CONFIG_NC_SERVER=y +CONFIG_BUSYBOX_CONFIG_NETCAT=y +CONFIG_BUSYBOX_CONFIG_PSTREE=y +CONFIG_BUSYBOX_CONFIG_REALPATH=y +CONFIG_BUSYBOX_CONFIG_RMMOD=y +# CONFIG_BUSYBOX_CONFIG_SETSID is not set +CONFIG_BUSYBOX_CONFIG_SUBST_WCHAR=0 +CONFIG_BUSYBOX_CONFIG_TC=y +CONFIG_BUSYBOX_CONFIG_TELNET=y +CONFIG_BUSYBOX_CONFIG_TREE=y +CONFIG_BUSYBOX_CONFIG_UNICODE_COMBINING_WCHARS=y +CONFIG_BUSYBOX_CONFIG_UNICODE_PRESERVE_BROKEN=y +CONFIG_BUSYBOX_CONFIG_UNICODE_SUPPORT=y +CONFIG_BUSYBOX_CONFIG_UNICODE_USING_LOCALE=y +CONFIG_BUSYBOX_CONFIG_UNICODE_WIDE_WCHARS=y +CONFIG_BUSYBOX_CONFIG_VOLUMEID=y +CONFIG_BUSYBOX_CONFIG_WATCH=y +CONFIG_BUSYBOX_CONFIG_WHOIS=y +CONFIG_BUSYBOX_CONFIG_XXD=y +CONFIG_BUSYBOX_DEFAULT_PIE=y +CONFIG_BWMNG_EXTENDEDSTATS=y +CONFIG_BWMNG_TIME=y +CONFIG_DROPBEAR_ASKPASS=y +CONFIG_EXPERIMENTAL=y +CONFIG_FEED_mtk_openwrt_feed=m +CONFIG_GCC_DEFAULT_PIE=y +CONFIG_GCC_USE_GRAPHITE=y +# CONFIG_GCC_USE_VERSION_13 is not set +CONFIG_GCC_USE_VERSION_14=y +CONFIG_GCC_VERSION="14.2.0" +CONFIG_GCC_VERSION_14=y +# CONFIG_GDB is not set +CONFIG_GETDNS_ENABLE_STUB_ONLY=y +CONFIG_HAS_BPF_TOOLCHAIN=y +CONFIG_HTOP_LMSENSORS=y +CONFIG_IFSTAT_SNMP=y +CONFIG_IMAGEOPT=y +CONFIG_INITOPT=y +# CONFIG_KERNEL_BTRFS_FS_POSIX_ACL is not set +CONFIG_KERNEL_BUILD_DOMAIN="local" +CONFIG_KERNEL_BUILD_USER="NStorm" +# CONFIG_KERNEL_CC_OPTIMIZE_FOR_PERFORMANCE is not set +CONFIG_KERNEL_CC_OPTIMIZE_FOR_SIZE=y +# CONFIG_KERNEL_CC_STACKPROTECTOR_REGULAR is not set +CONFIG_KERNEL_CC_STACKPROTECTOR_STRONG=y +# CONFIG_KERNEL_CIFS_ACL is not set +CONFIG_KERNEL_DEVMEM=y +# CONFIG_KERNEL_EXT4_FS_POSIX_ACL is not set +# CONFIG_KERNEL_EXT4_FS_SECURITY is not set +# CONFIG_KERNEL_F2FS_FS_POSIX_ACL is not set +# CONFIG_KERNEL_F2FS_FS_SECURITY is not set +# CONFIG_KERNEL_FS_POSIX_ACL is not set +# CONFIG_KERNEL_HFSPLUS_FS_POSIX_ACL is not set +# CONFIG_KERNEL_HFS_FS_POSIX_ACL is not set +# CONFIG_KERNEL_JFFS2_FS_POSIX_ACL is not set +# CONFIG_KERNEL_JFFS2_FS_SECURITY is not set +# CONFIG_KERNEL_JFS_POSIX_ACL is not set +# CONFIG_KERNEL_NFS_ACL_SUPPORT is not set +# CONFIG_KERNEL_REISER_FS_POSIX_ACL is not set +CONFIG_KERNEL_STACKPROTECTOR_STRONG=y +# CONFIG_KERNEL_TMPFS_POSIX_ACL is not set +# CONFIG_KERNEL_UBIFS_FS_SECURITY is not set +# CONFIG_KERNEL_XFS_POSIX_ACL is not set +CONFIG_LIBCURL_COOKIES=y +CONFIG_LIBCURL_FILE=y +CONFIG_LIBCURL_FTP=y +CONFIG_LIBCURL_HTTP=y +CONFIG_LIBCURL_MBEDTLS=y +CONFIG_LIBCURL_NGHTTP2=y +CONFIG_LIBCURL_NO_SMB="!" +CONFIG_LIBCURL_PROXY=y +CONFIG_LIBCURL_UNIX_SOCKETS=y +CONFIG_LIBIIO_LOCAL_BACKEND=y +CONFIG_LIBIIO_NETWORK_BACKEND=y +CONFIG_LIBIIO_XML_BACKEND=y +CONFIG_LIBQMI_COLLECTION_BASIC=y +CONFIG_LIBQMI_WITH_MBIM_QMUX=y +CONFIG_LIBQMI_WITH_QRTR_GLIB=y +CONFIG_LUCI_SRCDIET=y +CONFIG_OPENSSH_LIBFIDO2=y +CONFIG_OPENSSL_ENGINE=y +CONFIG_OPENSSL_OPTIMIZE_SPEED=y +CONFIG_OPENSSL_WITH_ASM=y +CONFIG_OPENSSL_WITH_BLAKE2=y +CONFIG_OPENSSL_WITH_CHACHA_POLY1305=y +CONFIG_OPENSSL_WITH_CMS=y +CONFIG_OPENSSL_WITH_COMPRESSION=y +CONFIG_OPENSSL_WITH_DEPRECATED=y +CONFIG_OPENSSL_WITH_ERROR_MESSAGES=y +CONFIG_OPENSSL_WITH_IDEA=y +CONFIG_OPENSSL_WITH_MDC2=y +CONFIG_OPENSSL_WITH_PSK=y +CONFIG_OPENSSL_WITH_SEED=y +CONFIG_OPENSSL_WITH_SRP=y +CONFIG_OPENSSL_WITH_TLS13=y +CONFIG_OPENSSL_WITH_WHIRLPOOL=y +CONFIG_PACKAGE_afuse=y +CONFIG_PACKAGE_attendedsysupgrade-common=y +CONFIG_PACKAGE_avahi-dbus-daemon=y +CONFIG_PACKAGE_bash=m +CONFIG_PACKAGE_blkdiscard=m +CONFIG_PACKAGE_blkid=m +CONFIG_PACKAGE_block-mount=y +CONFIG_PACKAGE_blockd=y +CONFIG_PACKAGE_blockdev=y +CONFIG_PACKAGE_bridge=y +CONFIG_PACKAGE_bwm-ng=y +CONFIG_PACKAGE_bzip2=m +CONFIG_PACKAGE_ca-certificates=y +CONFIG_PACKAGE_cgi-io=y +CONFIG_PACKAGE_curl=y +CONFIG_PACKAGE_dbus=y +CONFIG_PACKAGE_dbus-utils=y +CONFIG_PACKAGE_diffutils=m +# CONFIG_PACKAGE_dnsmasq is not set +CONFIG_PACKAGE_dnsmasq-full=y +CONFIG_PACKAGE_dnsmasq_full_auth=y +CONFIG_PACKAGE_dnsmasq_full_conntrack=y +CONFIG_PACKAGE_dnsmasq_full_dhcp=y +CONFIG_PACKAGE_dnsmasq_full_dhcpv6=y +CONFIG_PACKAGE_dnsmasq_full_dnssec=y +CONFIG_PACKAGE_dnsmasq_full_ipset=y +CONFIG_PACKAGE_dnsmasq_full_nftset=y +CONFIG_PACKAGE_dnsmasq_full_noid=y +CONFIG_PACKAGE_dnsmasq_full_tftp=y +CONFIG_PACKAGE_dosfstools=m +# CONFIG_PACKAGE_e2fsprogs is not set +CONFIG_PACKAGE_eject=m +CONFIG_PACKAGE_ethtool-full=y +CONFIG_PACKAGE_external-protocol=y +CONFIG_PACKAGE_f2fs-tools=y +CONFIG_PACKAGE_fdisk=m +CONFIG_PACKAGE_findfs=m +CONFIG_PACKAGE_fstrim=m +CONFIG_PACKAGE_fuse-utils=y +CONFIG_PACKAGE_fuse3-utils=m +CONFIG_PACKAGE_getdns=y +CONFIG_PACKAGE_glib2=y +CONFIG_PACKAGE_gzip=m +CONFIG_PACKAGE_hexedit=m +CONFIG_PACKAGE_hostapd-mbedtls=y +CONFIG_PACKAGE_hostapd-openssl=m +CONFIG_PACKAGE_hostapd-utils=y +CONFIG_PACKAGE_htop=m +CONFIG_PACKAGE_i2c-tools=y +CONFIG_PACKAGE_i2csfp=y +CONFIG_PACKAGE_ifstat=y +CONFIG_PACKAGE_iftop=y +CONFIG_PACKAGE_ip-bridge=y +CONFIG_PACKAGE_ip-full=y +CONFIG_PACKAGE_ip6tables-extra=y +CONFIG_PACKAGE_ip6tables-mod-nat=y +CONFIG_PACKAGE_ip6tables-nft=y +CONFIG_PACKAGE_ip6tables-zz-legacy=y +CONFIG_PACKAGE_iperf3=m +CONFIG_PACKAGE_iperf3-ssl=m +CONFIG_PACKAGE_ipip=m +CONFIG_PACKAGE_ipset=y +CONFIG_PACKAGE_iptables-mod-account=y +CONFIG_PACKAGE_iptables-mod-asn=y +CONFIG_PACKAGE_iptables-mod-chaos=y +CONFIG_PACKAGE_iptables-mod-checksum=y +CONFIG_PACKAGE_iptables-mod-cluster=y +CONFIG_PACKAGE_iptables-mod-condition=y +CONFIG_PACKAGE_iptables-mod-conntrack-extra=y +CONFIG_PACKAGE_iptables-mod-delude=y +CONFIG_PACKAGE_iptables-mod-dhcpmac=y +CONFIG_PACKAGE_iptables-mod-dnetmap=y +CONFIG_PACKAGE_iptables-mod-extra=y +CONFIG_PACKAGE_iptables-mod-filter=y +CONFIG_PACKAGE_iptables-mod-fuzzy=y +CONFIG_PACKAGE_iptables-mod-geoip=y +CONFIG_PACKAGE_iptables-mod-hashlimit=y +CONFIG_PACKAGE_iptables-mod-iface=y +CONFIG_PACKAGE_iptables-mod-ipmark=y +CONFIG_PACKAGE_iptables-mod-ipopt=y +CONFIG_PACKAGE_iptables-mod-ipp2p=y +CONFIG_PACKAGE_iptables-mod-iprange=y +CONFIG_PACKAGE_iptables-mod-ipsec=y +CONFIG_PACKAGE_iptables-mod-ipv4options=y +CONFIG_PACKAGE_iptables-mod-led=y +CONFIG_PACKAGE_iptables-mod-length2=y +CONFIG_PACKAGE_iptables-mod-logmark=y +CONFIG_PACKAGE_iptables-mod-lscan=y +CONFIG_PACKAGE_iptables-mod-lua=y +CONFIG_PACKAGE_iptables-mod-nat-extra=y +CONFIG_PACKAGE_iptables-mod-nflog=y +CONFIG_PACKAGE_iptables-mod-nfqueue=y +CONFIG_PACKAGE_iptables-mod-physdev=y +CONFIG_PACKAGE_iptables-mod-proto=y +CONFIG_PACKAGE_iptables-mod-psd=y +CONFIG_PACKAGE_iptables-mod-quota2=y +CONFIG_PACKAGE_iptables-mod-rpfilter=y +CONFIG_PACKAGE_iptables-mod-rtpengine=y +CONFIG_PACKAGE_iptables-mod-socket=y +CONFIG_PACKAGE_iptables-mod-sysrq=y +CONFIG_PACKAGE_iptables-mod-tarpit=y +CONFIG_PACKAGE_iptables-mod-tee=y +CONFIG_PACKAGE_iptables-mod-tproxy=y +CONFIG_PACKAGE_iptables-mod-trace=y +CONFIG_PACKAGE_iptables-mod-u32=y +CONFIG_PACKAGE_iptables-nft=y +CONFIG_PACKAGE_iptables-zz-legacy=y +CONFIG_PACKAGE_irqbalance=y +# CONFIG_PACKAGE_iw is not set +CONFIG_PACKAGE_iw-full=y +CONFIG_PACKAGE_kmod-arptables=m +CONFIG_PACKAGE_kmod-asn1-decoder=y +CONFIG_PACKAGE_kmod-asn1-encoder=y +CONFIG_PACKAGE_kmod-bonding=y +CONFIG_PACKAGE_kmod-br-netfilter=y +CONFIG_PACKAGE_kmod-crypto-acompress=y +CONFIG_PACKAGE_kmod-crypto-cbc=y +CONFIG_PACKAGE_kmod-crypto-chacha20poly1305=y +CONFIG_PACKAGE_kmod-crypto-crc32=y +CONFIG_PACKAGE_kmod-crypto-deflate=y +CONFIG_PACKAGE_kmod-crypto-ecb=y +CONFIG_PACKAGE_kmod-crypto-echainiv=y +CONFIG_PACKAGE_kmod-crypto-eip=y +CONFIG_PACKAGE_kmod-crypto-lib-chacha20=y +CONFIG_PACKAGE_kmod-crypto-lib-chacha20poly1305=y +CONFIG_PACKAGE_kmod-crypto-lib-curve25519=y +CONFIG_PACKAGE_kmod-crypto-lib-poly1305=y +CONFIG_PACKAGE_kmod-crypto-michael-mic=y +CONFIG_PACKAGE_kmod-crypto-misc=y +CONFIG_PACKAGE_kmod-crypto-user=y +CONFIG_PACKAGE_kmod-crypto-xcbc=y +CONFIG_PACKAGE_kmod-crypto-xts=y +CONFIG_PACKAGE_kmod-crypto-xxhash=y +CONFIG_PACKAGE_kmod-cryptodev=y +CONFIG_PACKAGE_kmod-dax=y +CONFIG_PACKAGE_kmod-dm=y +CONFIG_PACKAGE_kmod-dnsresolver=y +CONFIG_PACKAGE_kmod-ebtables=m +CONFIG_PACKAGE_kmod-ebtables-ipv4=m +CONFIG_PACKAGE_kmod-ebtables-ipv6=m +CONFIG_PACKAGE_kmod-eeprom-93cx6=y +CONFIG_PACKAGE_kmod-fs-autofs4=y +CONFIG_PACKAGE_kmod-fs-cifs=m +CONFIG_PACKAGE_kmod-fs-ext4=m +CONFIG_PACKAGE_kmod-fs-f2fs=y +CONFIG_PACKAGE_kmod-fs-msdos=y +CONFIG_PACKAGE_kmod-fs-netfs=m +CONFIG_PACKAGE_kmod-fs-smbfs-common=m +CONFIG_PACKAGE_kmod-fs-squashfs=y +CONFIG_PACKAGE_kmod-fs-vfat=y +CONFIG_PACKAGE_kmod-fuse=y +CONFIG_PACKAGE_kmod-gpio-cascade=y +CONFIG_PACKAGE_kmod-gpio-pca953x=y +CONFIG_PACKAGE_kmod-i2c-algo-bit=y +CONFIG_PACKAGE_kmod-i2c-gpio=y +CONFIG_PACKAGE_kmod-i2c-mux-reg=y +CONFIG_PACKAGE_kmod-i2c-smbus=y +CONFIG_PACKAGE_kmod-i2c-tiny-usb=y +CONFIG_PACKAGE_kmod-ifb=m +CONFIG_PACKAGE_kmod-iio-core=y +CONFIG_PACKAGE_kmod-ip6tables=y +CONFIG_PACKAGE_kmod-ip6tables-extra=y +CONFIG_PACKAGE_kmod-ipip=y +CONFIG_PACKAGE_kmod-ipsec=y +CONFIG_PACKAGE_kmod-ipsec4=y +CONFIG_PACKAGE_kmod-ipsec6=y +CONFIG_PACKAGE_kmod-ipt-account=y +CONFIG_PACKAGE_kmod-ipt-asn=y +CONFIG_PACKAGE_kmod-ipt-chaos=y +CONFIG_PACKAGE_kmod-ipt-checksum=y +CONFIG_PACKAGE_kmod-ipt-cluster=y +CONFIG_PACKAGE_kmod-ipt-compat-xtables=y +CONFIG_PACKAGE_kmod-ipt-condition=y +CONFIG_PACKAGE_kmod-ipt-conntrack=y +CONFIG_PACKAGE_kmod-ipt-conntrack-extra=y +CONFIG_PACKAGE_kmod-ipt-conntrack-label=y +CONFIG_PACKAGE_kmod-ipt-core=y +CONFIG_PACKAGE_kmod-ipt-debug=y +CONFIG_PACKAGE_kmod-ipt-delude=y +CONFIG_PACKAGE_kmod-ipt-dhcpmac=y +CONFIG_PACKAGE_kmod-ipt-dnetmap=y +CONFIG_PACKAGE_kmod-ipt-extra=y +CONFIG_PACKAGE_kmod-ipt-filter=y +CONFIG_PACKAGE_kmod-ipt-fuzzy=y +CONFIG_PACKAGE_kmod-ipt-geoip=y +CONFIG_PACKAGE_kmod-ipt-hashlimit=y +CONFIG_PACKAGE_kmod-ipt-iface=y +CONFIG_PACKAGE_kmod-ipt-ipmark=y +CONFIG_PACKAGE_kmod-ipt-ipopt=y +CONFIG_PACKAGE_kmod-ipt-ipp2p=y +CONFIG_PACKAGE_kmod-ipt-iprange=y +CONFIG_PACKAGE_kmod-ipt-ipsec=y +CONFIG_PACKAGE_kmod-ipt-ipset=y +CONFIG_PACKAGE_kmod-ipt-ipv4options=y +CONFIG_PACKAGE_kmod-ipt-led=y +CONFIG_PACKAGE_kmod-ipt-length2=y +CONFIG_PACKAGE_kmod-ipt-logmark=y +CONFIG_PACKAGE_kmod-ipt-lscan=y +CONFIG_PACKAGE_kmod-ipt-lua=y +CONFIG_PACKAGE_kmod-ipt-nat=y +CONFIG_PACKAGE_kmod-ipt-nat-extra=y +CONFIG_PACKAGE_kmod-ipt-nat6=y +CONFIG_PACKAGE_kmod-ipt-nathelper-rtsp=y +CONFIG_PACKAGE_kmod-ipt-nflog=y +CONFIG_PACKAGE_kmod-ipt-nfqueue=y +CONFIG_PACKAGE_kmod-ipt-offload=y +CONFIG_PACKAGE_kmod-ipt-physdev=y +CONFIG_PACKAGE_kmod-ipt-proto=y +CONFIG_PACKAGE_kmod-ipt-psd=y +CONFIG_PACKAGE_kmod-ipt-quota2=y +CONFIG_PACKAGE_kmod-ipt-raw=y +CONFIG_PACKAGE_kmod-ipt-raw6=y +CONFIG_PACKAGE_kmod-ipt-rpfilter=y +CONFIG_PACKAGE_kmod-ipt-rtpengine=y +CONFIG_PACKAGE_kmod-ipt-socket=y +CONFIG_PACKAGE_kmod-ipt-sysrq=y +CONFIG_PACKAGE_kmod-ipt-tarpit=y +CONFIG_PACKAGE_kmod-ipt-tee=y +CONFIG_PACKAGE_kmod-ipt-tproxy=y +CONFIG_PACKAGE_kmod-ipt-u32=y +CONFIG_PACKAGE_kmod-iptunnel=y +CONFIG_PACKAGE_kmod-iptunnel4=y +CONFIG_PACKAGE_kmod-iptunnel6=y +CONFIG_PACKAGE_kmod-keys-encrypted=y +CONFIG_PACKAGE_kmod-keys-trusted=y +CONFIG_PACKAGE_kmod-leds-uleds=y +CONFIG_PACKAGE_kmod-ledtrig-activity=y +CONFIG_PACKAGE_kmod-ledtrig-gpio=y +CONFIG_PACKAGE_kmod-ledtrig-oneshot=y +CONFIG_PACKAGE_kmod-ledtrig-pattern=y +CONFIG_PACKAGE_kmod-ledtrig-transient=y +CONFIG_PACKAGE_kmod-lib-crc-itu-t=y +CONFIG_PACKAGE_kmod-lib-crc16=y +CONFIG_PACKAGE_kmod-lib-crc7=y +CONFIG_PACKAGE_kmod-lib-textsearch=y +CONFIG_PACKAGE_kmod-lib-xxhash=y +CONFIG_PACKAGE_kmod-lib-zlib-deflate=y +CONFIG_PACKAGE_kmod-lib-zlib-inflate=y +CONFIG_PACKAGE_kmod-lib-zstd=y +CONFIG_PACKAGE_kmod-loop=y +CONFIG_PACKAGE_kmod-macremapper=y +CONFIG_PACKAGE_kmod-macsec=y +CONFIG_PACKAGE_kmod-macvlan=y +CONFIG_PACKAGE_kmod-mdio-gpio=y +CONFIG_PACKAGE_kmod-mdio-netlink=y +CONFIG_PACKAGE_kmod-mhi-bus=y +CONFIG_PACKAGE_kmod-mhi-net=y +CONFIG_PACKAGE_kmod-mhi-pci-generic=y +CONFIG_PACKAGE_kmod-mii=y +CONFIG_PACKAGE_kmod-mmc=y +CONFIG_PACKAGE_kmod-mmc-spi=y +CONFIG_PACKAGE_kmod-mt76=y +CONFIG_PACKAGE_kmod-mt76-sdio=y +CONFIG_PACKAGE_kmod-mt76-usb=y +CONFIG_PACKAGE_kmod-mt7603=y +CONFIG_PACKAGE_kmod-mt76x02-common=y +CONFIG_PACKAGE_kmod-mt76x2=y +CONFIG_PACKAGE_kmod-mt76x2-common=y +CONFIG_PACKAGE_kmod-mt7921-common=y +CONFIG_PACKAGE_kmod-mt7921-firmware=y +CONFIG_PACKAGE_kmod-mt7921e=y +CONFIG_PACKAGE_kmod-mt7921s=y +CONFIG_PACKAGE_kmod-mt7921u=y +CONFIG_PACKAGE_kmod-mt7922-firmware=y +CONFIG_PACKAGE_kmod-mt7925-common=y +CONFIG_PACKAGE_kmod-mt7925e=y +CONFIG_PACKAGE_kmod-mt7925u=y +CONFIG_PACKAGE_kmod-mt792x-common=y +CONFIG_PACKAGE_kmod-mt792x-usb=y +CONFIG_PACKAGE_kmod-mt7981-firmware=y +CONFIG_PACKAGE_kmod-mt7986-firmware=y +CONFIG_PACKAGE_kmod-mtd-rw=y +CONFIG_PACKAGE_kmod-mux-core=y +CONFIG_PACKAGE_kmod-mux-gpio=y +CONFIG_PACKAGE_kmod-nat46=y +CONFIG_PACKAGE_kmod-netatop=y +CONFIG_PACKAGE_kmod-netlink-diag=y +CONFIG_PACKAGE_kmod-nf-conncount=y +CONFIG_PACKAGE_kmod-nf-conntrack-netlink=y +CONFIG_PACKAGE_kmod-nf-dup-inet=y +CONFIG_PACKAGE_kmod-nf-ipt=y +CONFIG_PACKAGE_kmod-nf-ipt6=y +CONFIG_PACKAGE_kmod-nf-nat6=y +CONFIG_PACKAGE_kmod-nf-nathelper=y +CONFIG_PACKAGE_kmod-nf-nathelper-extra=y +CONFIG_PACKAGE_kmod-nf-socket=y +CONFIG_PACKAGE_kmod-nf-tproxy=y +CONFIG_PACKAGE_kmod-nfnetlink-log=y +CONFIG_PACKAGE_kmod-nfnetlink-queue=y +CONFIG_PACKAGE_kmod-nft-arp=y +CONFIG_PACKAGE_kmod-nft-bridge=y +CONFIG_PACKAGE_kmod-nft-compat=y +CONFIG_PACKAGE_kmod-nft-connlimit=y +CONFIG_PACKAGE_kmod-nft-dup-inet=y +CONFIG_PACKAGE_kmod-nft-netdev=y +CONFIG_PACKAGE_kmod-nft-queue=y +CONFIG_PACKAGE_kmod-nft-socket=y +CONFIG_PACKAGE_kmod-nft-tproxy=y +CONFIG_PACKAGE_kmod-nft-xfrm=y +CONFIG_PACKAGE_kmod-nlmon=y +CONFIG_PACKAGE_kmod-nls-cp437=y +CONFIG_PACKAGE_kmod-nls-iso8859-1=y +CONFIG_PACKAGE_kmod-nls-ucs2-utils=m +CONFIG_PACKAGE_kmod-nls-utf8=y +CONFIG_PACKAGE_kmod-nsh=y +CONFIG_PACKAGE_kmod-nvme=y +CONFIG_PACKAGE_kmod-oid-registry=y +CONFIG_PACKAGE_kmod-pf-ring=y +CONFIG_PACKAGE_kmod-pps=y +CONFIG_PACKAGE_kmod-pstore=y +CONFIG_PACKAGE_kmod-ptp=y +CONFIG_PACKAGE_kmod-ramoops=y +CONFIG_PACKAGE_kmod-random-core=y +CONFIG_PACKAGE_kmod-reed-solomon=y +CONFIG_PACKAGE_kmod-sched=y +CONFIG_PACKAGE_kmod-sched-act-vlan=y +CONFIG_PACKAGE_kmod-sched-bpf=y +CONFIG_PACKAGE_kmod-sched-cake=y +CONFIG_PACKAGE_kmod-sched-connmark=y +CONFIG_PACKAGE_kmod-sched-core=y +CONFIG_PACKAGE_kmod-sched-flower=y +CONFIG_PACKAGE_kmod-sched-skbprio=y +CONFIG_PACKAGE_kmod-scsi-core=y +CONFIG_PACKAGE_kmod-sdhci=y +CONFIG_PACKAGE_kmod-spi-bitbang=y +CONFIG_PACKAGE_kmod-spi-dev=y +CONFIG_PACKAGE_kmod-spi-gpio=y +CONFIG_PACKAGE_kmod-tcp-bbr=y +CONFIG_PACKAGE_kmod-tcp-scalable=y +CONFIG_PACKAGE_kmod-tls=y +CONFIG_PACKAGE_kmod-tpm=y +CONFIG_PACKAGE_kmod-tun=y +CONFIG_PACKAGE_kmod-udptunnel4=y +CONFIG_PACKAGE_kmod-udptunnel6=y +CONFIG_PACKAGE_kmod-usb-net=y +CONFIG_PACKAGE_kmod-usb-net-cdc-ether=y +CONFIG_PACKAGE_kmod-usb-net-cdc-ncm=y +CONFIG_PACKAGE_kmod-usb-storage=y +CONFIG_PACKAGE_kmod-usb-storage-extras=y +CONFIG_PACKAGE_kmod-usb-storage-uas=y +CONFIG_PACKAGE_kmod-veth=y +CONFIG_PACKAGE_kmod-vxlan=y +CONFIG_PACKAGE_kmod-wireguard=y +CONFIG_PACKAGE_kmod-xfrm-interface=y +CONFIG_PACKAGE_kmod-zram=m +CONFIG_PACKAGE_less=m +CONFIG_PACKAGE_libatomic=y +CONFIG_PACKAGE_libattr=y +CONFIG_PACKAGE_libavahi-client=y +CONFIG_PACKAGE_libavahi-dbus-support=y +CONFIG_PACKAGE_libbfd=m +CONFIG_PACKAGE_libbpf=y +CONFIG_PACKAGE_libbz2=y +CONFIG_PACKAGE_libcbor=y +CONFIG_PACKAGE_libctf=m +CONFIG_PACKAGE_libcurl=y +CONFIG_PACKAGE_libdaemon=y +CONFIG_PACKAGE_libdbus=y +CONFIG_PACKAGE_libdevmapper=y +CONFIG_PACKAGE_libdw=y +CONFIG_PACKAGE_libelf=y +CONFIG_PACKAGE_libestr=m +CONFIG_PACKAGE_libevdev=y +CONFIG_PACKAGE_libevent2=y +CONFIG_PACKAGE_libevent2-core=m +CONFIG_PACKAGE_libexpat=y +CONFIG_PACKAGE_libfastjson=m +CONFIG_PACKAGE_libfdisk=y +CONFIG_PACKAGE_libffi=y +CONFIG_PACKAGE_libfido2=y +CONFIG_PACKAGE_libfuse=y +CONFIG_PACKAGE_libfuse3=y +CONFIG_PACKAGE_libgcrypt=y +CONFIG_PACKAGE_libgmp=y +CONFIG_PACKAGE_libgpg-error=y +CONFIG_PACKAGE_libi2c=y +CONFIG_PACKAGE_libiio=y +CONFIG_PACKAGE_libip4tc=y +CONFIG_PACKAGE_libip6tc=y +CONFIG_PACKAGE_libiperf3=m +CONFIG_PACKAGE_libipset=y +CONFIG_PACKAGE_libiptext=y +CONFIG_PACKAGE_libiptext-nft=y +CONFIG_PACKAGE_libiptext6=y +CONFIG_PACKAGE_libkmod=y +CONFIG_PACKAGE_libltdl=y +CONFIG_PACKAGE_liblua=y +CONFIG_PACKAGE_liblucihttp=y +CONFIG_PACKAGE_liblucihttp-lua=y +CONFIG_PACKAGE_liblucihttp-ucode=y +CONFIG_PACKAGE_liblz4=y +CONFIG_PACKAGE_liblzma=y +CONFIG_PACKAGE_liblzo=y +CONFIG_PACKAGE_libmbim=y +CONFIG_PACKAGE_libmicrohttpd-no-ssl=y +CONFIG_PACKAGE_libmount=y +CONFIG_PACKAGE_libncurses=y +CONFIG_PACKAGE_libnetfilter-conntrack=y +CONFIG_PACKAGE_libnetsnmp=y +CONFIG_PACKAGE_libnettle=y +CONFIG_PACKAGE_libnfnetlink=y +CONFIG_PACKAGE_libnghttp2=y +CONFIG_PACKAGE_libnl=y +CONFIG_PACKAGE_libnl-cli=y +CONFIG_PACKAGE_libnl-core=y +CONFIG_PACKAGE_libnl-genl=y +CONFIG_PACKAGE_libnl-nf=y +CONFIG_PACKAGE_libnl-route=y +CONFIG_PACKAGE_libnvme=y +CONFIG_PACKAGE_libopcodes=m +CONFIG_PACKAGE_libopenssl=y +CONFIG_PACKAGE_libopenssl-conf=y +CONFIG_PACKAGE_libopenssl-devcrypto=m +CONFIG_PACKAGE_libopenssl-legacy=m +CONFIG_PACKAGE_liboping=y +CONFIG_PACKAGE_libowipcalc=y +CONFIG_PACKAGE_libparted=y +CONFIG_PACKAGE_libpcap=y +CONFIG_PACKAGE_libpci=y +CONFIG_PACKAGE_libpcre2=y +CONFIG_PACKAGE_libpopt=m +CONFIG_PACKAGE_libprotobuf-c=y +CONFIG_PACKAGE_libqmi=y +CONFIG_PACKAGE_libqrtr-glib=y +CONFIG_PACKAGE_libreadline=y +CONFIG_PACKAGE_librrd1=y +CONFIG_PACKAGE_libsensors=y +CONFIG_PACKAGE_libsmartcols=y +CONFIG_PACKAGE_libspeedtestcpp=y +CONFIG_PACKAGE_libstdcpp=y +CONFIG_PACKAGE_libsysfs=y +CONFIG_PACKAGE_libtirpc=y +CONFIG_PACKAGE_libtraceevent=y +CONFIG_PACKAGE_libtraceevent-extra=y +CONFIG_PACKAGE_libtracefs=y +CONFIG_PACKAGE_libubus-lua=y +CONFIG_PACKAGE_libudev-zero=y +CONFIG_PACKAGE_libunbound=y +CONFIG_PACKAGE_libunbound_ipset=y +CONFIG_PACKAGE_libunbound_libevent=y +CONFIG_PACKAGE_libunbound_libpthread=y +# CONFIG_PACKAGE_libustream-mbedtls is not set +CONFIG_PACKAGE_libxml2=y +CONFIG_PACKAGE_libxtables=y +CONFIG_PACKAGE_libyaml=y +CONFIG_PACKAGE_libzstd=y +CONFIG_PACKAGE_lm-sensors=y +CONFIG_PACKAGE_lm-sensors-detect=y +CONFIG_PACKAGE_losetup=y +CONFIG_PACKAGE_lsblk=m +CONFIG_PACKAGE_lua=y +CONFIG_PACKAGE_luci=y +CONFIG_PACKAGE_luci-app-attendedsysupgrade=y +CONFIG_PACKAGE_luci-app-commands=y +CONFIG_PACKAGE_luci-app-firewall=y +CONFIG_PACKAGE_luci-app-opkg=y +CONFIG_PACKAGE_luci-base=y +CONFIG_PACKAGE_luci-compat=y +CONFIG_PACKAGE_luci-lib-base=y +CONFIG_PACKAGE_luci-lib-ip=y +CONFIG_PACKAGE_luci-lib-json=y +CONFIG_PACKAGE_luci-lib-jsonc=y +CONFIG_PACKAGE_luci-lib-nixio=y +CONFIG_PACKAGE_luci-light=y +CONFIG_PACKAGE_luci-lua-runtime=y +CONFIG_PACKAGE_luci-mod-admin-full=y +CONFIG_PACKAGE_luci-mod-dashboard=y +CONFIG_PACKAGE_luci-mod-network=y +CONFIG_PACKAGE_luci-mod-rpc=y +CONFIG_PACKAGE_luci-mod-status=y +CONFIG_PACKAGE_luci-mod-system=y +CONFIG_PACKAGE_luci-proto-bonding=y +CONFIG_PACKAGE_luci-proto-external=y +CONFIG_PACKAGE_luci-proto-ipv6=y +CONFIG_PACKAGE_luci-proto-ppp=y +CONFIG_PACKAGE_luci-proto-relay=y +CONFIG_PACKAGE_luci-theme-bootstrap=y +CONFIG_PACKAGE_mmc-utils=y +CONFIG_PACKAGE_moreutils=m +CONFIG_PACKAGE_mount-utils=m +CONFIG_PACKAGE_mt76-test=y +CONFIG_PACKAGE_mt76-vendor=m +CONFIG_PACKAGE_mt7981-wo-firmware=y +CONFIG_PACKAGE_mt7986-wo-firmware=y +CONFIG_PACKAGE_mt7988-2p5g-phy-firmware=m +CONFIG_PACKAGE_musl-fts=y +CONFIG_PACKAGE_mwan3=y +CONFIG_PACKAGE_nand-utils=m +CONFIG_PACKAGE_nano=y +CONFIG_PACKAGE_nstat=y +CONFIG_PACKAGE_nvme-cli=m +CONFIG_PACKAGE_objdump=m +CONFIG_PACKAGE_odhcpd=y +# CONFIG_PACKAGE_odhcpd-ipv6only is not set +CONFIG_PACKAGE_odhcpd_full_ext_cer_id=0 +CONFIG_PACKAGE_openssh-keygen=y +CONFIG_PACKAGE_openssh-moduli=y +CONFIG_PACKAGE_openssh-server=y +CONFIG_PACKAGE_openssh-sftp-server=y +CONFIG_PACKAGE_openssl-util=y +CONFIG_PACKAGE_owipcalc=y +CONFIG_PACKAGE_parted=m +CONFIG_PACKAGE_patch=m +CONFIG_PACKAGE_perl=y +CONFIG_PACKAGE_perlbase-base=y +CONFIG_PACKAGE_perlbase-bytes=y +CONFIG_PACKAGE_perlbase-class=y +CONFIG_PACKAGE_perlbase-config=y +CONFIG_PACKAGE_perlbase-cwd=y +CONFIG_PACKAGE_perlbase-dynaloader=y +CONFIG_PACKAGE_perlbase-errno=y +CONFIG_PACKAGE_perlbase-essential=y +CONFIG_PACKAGE_perlbase-fcntl=y +CONFIG_PACKAGE_perlbase-file=y +CONFIG_PACKAGE_perlbase-filehandle=y +CONFIG_PACKAGE_perlbase-getopt=y +CONFIG_PACKAGE_perlbase-i18n=y +CONFIG_PACKAGE_perlbase-integer=y +CONFIG_PACKAGE_perlbase-io=y +CONFIG_PACKAGE_perlbase-ipc=y +CONFIG_PACKAGE_perlbase-list=y +CONFIG_PACKAGE_perlbase-locale=y +CONFIG_PACKAGE_perlbase-params=y +CONFIG_PACKAGE_perlbase-posix=y +CONFIG_PACKAGE_perlbase-re=y +CONFIG_PACKAGE_perlbase-scalar=y +CONFIG_PACKAGE_perlbase-selectsaver=y +CONFIG_PACKAGE_perlbase-selfloader=y +CONFIG_PACKAGE_perlbase-socket=y +CONFIG_PACKAGE_perlbase-symbol=y +CONFIG_PACKAGE_perlbase-text=y +CONFIG_PACKAGE_perlbase-tie=y +CONFIG_PACKAGE_perlbase-time=y +CONFIG_PACKAGE_perlbase-unicore=y +CONFIG_PACKAGE_perlbase-utf8=y +CONFIG_PACKAGE_perlbase-xsloader=y +CONFIG_PACKAGE_procps-ng=y +CONFIG_PACKAGE_procps-ng-ps=y +CONFIG_PACKAGE_proto-bonding=y +CONFIG_PACKAGE_qosify=m +CONFIG_PACKAGE_relayd=y +CONFIG_PACKAGE_resolveip=y +CONFIG_PACKAGE_rpcd=y +CONFIG_PACKAGE_rpcd-mod-file=y +CONFIG_PACKAGE_rpcd-mod-iwinfo=y +CONFIG_PACKAGE_rpcd-mod-luci=y +CONFIG_PACKAGE_rpcd-mod-rpcsys=y +CONFIG_PACKAGE_rpcd-mod-rrdns=y +CONFIG_PACKAGE_rpcd-mod-ucode=y +CONFIG_PACKAGE_rsyslog=m +CONFIG_PACKAGE_screen=m +CONFIG_PACKAGE_sfdisk=m +CONFIG_PACKAGE_sgdisk=m +CONFIG_PACKAGE_speedtestcpp=m +CONFIG_PACKAGE_squashfs-tools-unsquashfs=m +CONFIG_PACKAGE_strongswan=y +CONFIG_PACKAGE_strongswan-charon=y +CONFIG_PACKAGE_strongswan-default=y +CONFIG_PACKAGE_strongswan-mod-aes=y +CONFIG_PACKAGE_strongswan-mod-attr=y +CONFIG_PACKAGE_strongswan-mod-connmark=y +CONFIG_PACKAGE_strongswan-mod-constraints=y +CONFIG_PACKAGE_strongswan-mod-des=y +CONFIG_PACKAGE_strongswan-mod-dnskey=y +CONFIG_PACKAGE_strongswan-mod-fips-prf=y +CONFIG_PACKAGE_strongswan-mod-gmp=y +CONFIG_PACKAGE_strongswan-mod-hmac=y +CONFIG_PACKAGE_strongswan-mod-kdf=y +CONFIG_PACKAGE_strongswan-mod-kernel-netlink=y +CONFIG_PACKAGE_strongswan-mod-md5=y +CONFIG_PACKAGE_strongswan-mod-mgf1=y +CONFIG_PACKAGE_strongswan-mod-pem=y +CONFIG_PACKAGE_strongswan-mod-pgp=y +CONFIG_PACKAGE_strongswan-mod-pkcs1=y +CONFIG_PACKAGE_strongswan-mod-pubkey=y +CONFIG_PACKAGE_strongswan-mod-random=y +CONFIG_PACKAGE_strongswan-mod-rc2=y +CONFIG_PACKAGE_strongswan-mod-resolve=y +CONFIG_PACKAGE_strongswan-mod-revocation=y +CONFIG_PACKAGE_strongswan-mod-sha1=y +CONFIG_PACKAGE_strongswan-mod-sha2=y +CONFIG_PACKAGE_strongswan-mod-socket-default=y +CONFIG_PACKAGE_strongswan-mod-sshkey=y +CONFIG_PACKAGE_strongswan-mod-updown=y +CONFIG_PACKAGE_strongswan-mod-vici=y +CONFIG_PACKAGE_strongswan-mod-x509=y +CONFIG_PACKAGE_strongswan-mod-xauth-generic=y +CONFIG_PACKAGE_strongswan-mod-xcbc=y +CONFIG_PACKAGE_strongswan-swanctl=y +CONFIG_PACKAGE_stubby=y +CONFIG_PACKAGE_sysfsutils=y +CONFIG_PACKAGE_tc-full=y +CONFIG_PACKAGE_tcpdump=m +CONFIG_PACKAGE_telnet-bsd=m +CONFIG_PACKAGE_terminfo=y +CONFIG_PACKAGE_tmux=m +CONFIG_PACKAGE_ucert-full=y +CONFIG_PACKAGE_ucode-mod-bpf=y +CONFIG_PACKAGE_ucode-mod-html=y +CONFIG_PACKAGE_ucode-mod-lua=y +CONFIG_PACKAGE_ucode-mod-math=y +CONFIG_PACKAGE_uhttpd=y +CONFIG_PACKAGE_uhttpd-mod-ubus=y +CONFIG_PACKAGE_unbound-anchor=y +CONFIG_PACKAGE_unbound-checkconf=y +CONFIG_PACKAGE_unbound-control=y +CONFIG_PACKAGE_unbound-control-setup=y +CONFIG_PACKAGE_unbound-daemon=y +CONFIG_PACKAGE_unbound-host=y +CONFIG_PACKAGE_unzip=m +CONFIG_PACKAGE_vxlan=y +CONFIG_PACKAGE_wavemon=y +CONFIG_PACKAGE_wg-installer-client=y +CONFIG_PACKAGE_wget-ssl=y +CONFIG_PACKAGE_wipefs=m +CONFIG_PACKAGE_wireguard-tools=y +CONFIG_PACKAGE_wireless-tools=y +# CONFIG_PACKAGE_wpad-basic-mbedtls is not set +CONFIG_PACKAGE_wpad-openssl=m +CONFIG_PACKAGE_xtables-legacy=y +CONFIG_PACKAGE_xtables-nft=y +CONFIG_PACKAGE_xz-utils=m +CONFIG_PACKAGE_zlib=y +CONFIG_PACKAGE_zoneinfo-core=y +CONFIG_PACKAGE_zoneinfo-europe=y +CONFIG_PACKAGE_zram-swap=m +CONFIG_PACKAGE_zstd=m +CONFIG_PARTED_LVM2=y +CONFIG_PARTED_READLINE=y +CONFIG_PERL_NOCOMMENT=y +CONFIG_PERL_THREADS=y +CONFIG_PKG_ASLR_PIE_ALL=y +# CONFIG_PKG_ASLR_PIE_REGULAR is not set +# CONFIG_PKG_CC_STACKPROTECTOR_REGULAR is not set +CONFIG_PKG_CC_STACKPROTECTOR_STRONG=y +# CONFIG_PKG_FORTIFY_SOURCE_1 is not set +CONFIG_PKG_FORTIFY_SOURCE_2=y +CONFIG_PREINITOPT=y +CONFIG_PROCD_SHOW_BOOT=y +CONFIG_SQUASHFS_TOOLS_LZ4_SUPPORT=y +CONFIG_SQUASHFS_TOOLS_LZO_SUPPORT=y +CONFIG_SQUASHFS_TOOLS_XZ_SUPPORT=y +CONFIG_SQUASHFS_TOOLS_ZSTD_SUPPORT=y +CONFIG_STRONGSWAN_ROUTING_TABLE="220" +CONFIG_STRONGSWAN_ROUTING_TABLE_PRIO="220" +CONFIG_TARGET_DEFAULT_LAN_IP_FROM_PREINIT=y +# CONFIG_TARGET_INIT_SUPPRESS_STDERR is not set +CONFIG_TARGET_OPTIMIZATION="-Os -pipe -mcpu=cortex-a73+crc+crypto+rdma" +CONFIG_TARGET_OPTIONS=y +# CONFIG_TARGET_PREINIT_SUPPRESS_STDERR is not set +CONFIG_TARGET_ROOTFS_PERSIST_VAR=y +# CONFIG_USE_FS_ACL_ATTR is not set +CONFIG_USE_GC_SECTIONS=y +CONFIG_USE_LLVM_BUILD=y +CONFIG_USE_LTO=y +CONFIG_USE_MOLD=y +CONFIG_VERSIONOPT=y +CONFIG_VERSION_BUG_URL="" +CONFIG_VERSION_CODE="12" +CONFIG_VERSION_CODE_FILENAMES=y +CONFIG_VERSION_DIST="openwrt-nstorm" +CONFIG_VERSION_FILENAMES=y +CONFIG_VERSION_HOME_URL="https://github.com/N-Storm/openwrt" +CONFIG_VERSION_HWREV="" +CONFIG_VERSION_MANUFACTURER="Sinovoip" +CONFIG_VERSION_MANUFACTURER_URL="" +CONFIG_VERSION_NUMBER="6.6.52-SNAPSHOT" +CONFIG_VERSION_PRODUCT="BananaPI BPI-R4" +CONFIG_VERSION_REPO="https://github.com/N-Storm/Openwrt_Builder" +CONFIG_VERSION_SUPPORT_URL="" +CONFIG_ZRAM_DEF_COMP_ZSTD=y +CONFIG_ZSTD_OPTIMIZE_O3=y +# CONFIG_BUSYBOX_CONFIG_PIE is not set +CONFIG_KERNEL_WERROR=y +# CONFIG_PACKAGE_kmod-crypto-kpp is not set +CONFIG_PACKAGE_libcomerr=y +CONFIG_PACKAGE_libe2p=y +CONFIG_PACKAGE_libext2fs=y +CONFIG_PACKAGE_libss=y diff --git a/feeds.conf.default b/feeds.conf.default index a03547a83c2729..d3f508e56948aa 100644 --- a/feeds.conf.default +++ b/feeds.conf.default @@ -6,5 +6,5 @@ src-git telephony https://git.openwrt.org/feed/telephony.git #src-git targets https://github.com/openwrt/targets.git #src-git oldpackages http://git.openwrt.org/packages.git #src-link custom /usr/src/openwrt/custom-feed -#src-git mtk_openwrt_feed https://git01.mediatek.com/openwrt/feeds/mtk-openwrt-feeds;master -src-git mtk_openwrt_feed https://github.com/rmandrad/mtk-openwrt-feeds.git;rmandrad +src-git mtk_openwrt_feed https://git01.mediatek.com/openwrt/feeds/mtk-openwrt-feeds;master +#src-git mtk_openwrt_feed https://github.com/rmandrad/mtk-openwrt-feeds.git;rmandrad From 0b44d5715a49b8bcc41d7bd61d945d595f6e293c Mon Sep 17 00:00:00 2001 From: N-Storm Date: Thu, 26 Sep 2024 05:47:47 +0300 Subject: [PATCH 34/40] config r16 --- config-nstorm-bananapi-bpi-r4 | 226 +++++++--------------------------- 1 file changed, 44 insertions(+), 182 deletions(-) diff --git a/config-nstorm-bananapi-bpi-r4 b/config-nstorm-bananapi-bpi-r4 index 9357e26b50d1a8..f2aa2786bfc598 100644 --- a/config-nstorm-bananapi-bpi-r4 +++ b/config-nstorm-bananapi-bpi-r4 @@ -33,6 +33,8 @@ CONFIG_BUSYBOX_CONFIG_FEATURE_USERNAME_COMPLETION=y CONFIG_BUSYBOX_CONFIG_FEATURE_VOLUMEID_F2FS=y CONFIG_BUSYBOX_CONFIG_FEATURE_VOLUMEID_LINUXSWAP=y CONFIG_BUSYBOX_CONFIG_FEATURE_VOLUMEID_UBIFS=y +CONFIG_BUSYBOX_CONFIG_FEATURE_WGET_HTTPS=y +CONFIG_BUSYBOX_CONFIG_FEATURE_WGET_LONG_OPTIONS=y CONFIG_BUSYBOX_CONFIG_FEATURE_XARGS_SUPPORT_REPL_STR=y CONFIG_BUSYBOX_CONFIG_FINDFS=y CONFIG_BUSYBOX_CONFIG_FSTRIM=y @@ -61,7 +63,9 @@ CONFIG_BUSYBOX_CONFIG_RMMOD=y CONFIG_BUSYBOX_CONFIG_SUBST_WCHAR=0 CONFIG_BUSYBOX_CONFIG_TC=y CONFIG_BUSYBOX_CONFIG_TELNET=y +CONFIG_BUSYBOX_CONFIG_TLS=y CONFIG_BUSYBOX_CONFIG_TREE=y +# CONFIG_BUSYBOX_CONFIG_UDHCPC is not set CONFIG_BUSYBOX_CONFIG_UNICODE_COMBINING_WCHARS=y CONFIG_BUSYBOX_CONFIG_UNICODE_PRESERVE_BROKEN=y CONFIG_BUSYBOX_CONFIG_UNICODE_SUPPORT=y @@ -69,6 +73,7 @@ CONFIG_BUSYBOX_CONFIG_UNICODE_USING_LOCALE=y CONFIG_BUSYBOX_CONFIG_UNICODE_WIDE_WCHARS=y CONFIG_BUSYBOX_CONFIG_VOLUMEID=y CONFIG_BUSYBOX_CONFIG_WATCH=y +CONFIG_BUSYBOX_CONFIG_WGET=y CONFIG_BUSYBOX_CONFIG_WHOIS=y CONFIG_BUSYBOX_CONFIG_XXD=y CONFIG_BUSYBOX_DEFAULT_PIE=y @@ -76,7 +81,6 @@ CONFIG_BWMNG_EXTENDEDSTATS=y CONFIG_BWMNG_TIME=y CONFIG_DROPBEAR_ASKPASS=y CONFIG_EXPERIMENTAL=y -CONFIG_FEED_mtk_openwrt_feed=m CONFIG_GCC_DEFAULT_PIE=y CONFIG_GCC_USE_GRAPHITE=y # CONFIG_GCC_USE_VERSION_13 is not set @@ -84,9 +88,7 @@ CONFIG_GCC_USE_VERSION_14=y CONFIG_GCC_VERSION="14.2.0" CONFIG_GCC_VERSION_14=y # CONFIG_GDB is not set -CONFIG_GETDNS_ENABLE_STUB_ONLY=y CONFIG_HAS_BPF_TOOLCHAIN=y -CONFIG_HTOP_LMSENSORS=y CONFIG_IFSTAT_SNMP=y CONFIG_IMAGEOPT=y CONFIG_INITOPT=y @@ -127,75 +129,38 @@ CONFIG_LIBCURL_UNIX_SOCKETS=y CONFIG_LIBIIO_LOCAL_BACKEND=y CONFIG_LIBIIO_NETWORK_BACKEND=y CONFIG_LIBIIO_XML_BACKEND=y -CONFIG_LIBQMI_COLLECTION_BASIC=y -CONFIG_LIBQMI_WITH_MBIM_QMUX=y -CONFIG_LIBQMI_WITH_QRTR_GLIB=y +CONFIG_LUCI_LANG_ru=y CONFIG_LUCI_SRCDIET=y -CONFIG_OPENSSH_LIBFIDO2=y -CONFIG_OPENSSL_ENGINE=y -CONFIG_OPENSSL_OPTIMIZE_SPEED=y -CONFIG_OPENSSL_WITH_ASM=y -CONFIG_OPENSSL_WITH_BLAKE2=y -CONFIG_OPENSSL_WITH_CHACHA_POLY1305=y -CONFIG_OPENSSL_WITH_CMS=y -CONFIG_OPENSSL_WITH_COMPRESSION=y -CONFIG_OPENSSL_WITH_DEPRECATED=y -CONFIG_OPENSSL_WITH_ERROR_MESSAGES=y -CONFIG_OPENSSL_WITH_IDEA=y -CONFIG_OPENSSL_WITH_MDC2=y -CONFIG_OPENSSL_WITH_PSK=y -CONFIG_OPENSSL_WITH_SEED=y -CONFIG_OPENSSL_WITH_SRP=y -CONFIG_OPENSSL_WITH_TLS13=y -CONFIG_OPENSSL_WITH_WHIRLPOOL=y CONFIG_PACKAGE_afuse=y +CONFIG_PACKAGE_arptables-legacy=y +CONFIG_PACKAGE_arptables-nft=y CONFIG_PACKAGE_attendedsysupgrade-common=y CONFIG_PACKAGE_avahi-dbus-daemon=y -CONFIG_PACKAGE_bash=m -CONFIG_PACKAGE_blkdiscard=m -CONFIG_PACKAGE_blkid=m CONFIG_PACKAGE_block-mount=y CONFIG_PACKAGE_blockd=y CONFIG_PACKAGE_blockdev=y CONFIG_PACKAGE_bridge=y CONFIG_PACKAGE_bwm-ng=y -CONFIG_PACKAGE_bzip2=m CONFIG_PACKAGE_ca-certificates=y CONFIG_PACKAGE_cgi-io=y +CONFIG_PACKAGE_conntrack=y CONFIG_PACKAGE_curl=y CONFIG_PACKAGE_dbus=y CONFIG_PACKAGE_dbus-utils=y -CONFIG_PACKAGE_diffutils=m -# CONFIG_PACKAGE_dnsmasq is not set -CONFIG_PACKAGE_dnsmasq-full=y -CONFIG_PACKAGE_dnsmasq_full_auth=y -CONFIG_PACKAGE_dnsmasq_full_conntrack=y -CONFIG_PACKAGE_dnsmasq_full_dhcp=y -CONFIG_PACKAGE_dnsmasq_full_dhcpv6=y -CONFIG_PACKAGE_dnsmasq_full_dnssec=y -CONFIG_PACKAGE_dnsmasq_full_ipset=y -CONFIG_PACKAGE_dnsmasq_full_nftset=y -CONFIG_PACKAGE_dnsmasq_full_noid=y -CONFIG_PACKAGE_dnsmasq_full_tftp=y CONFIG_PACKAGE_dosfstools=m # CONFIG_PACKAGE_e2fsprogs is not set -CONFIG_PACKAGE_eject=m +CONFIG_PACKAGE_ebtables-legacy=y +CONFIG_PACKAGE_ebtables-legacy-utils=y +CONFIG_PACKAGE_ebtables-nft=y CONFIG_PACKAGE_ethtool-full=y CONFIG_PACKAGE_external-protocol=y CONFIG_PACKAGE_f2fs-tools=y -CONFIG_PACKAGE_fdisk=m -CONFIG_PACKAGE_findfs=m CONFIG_PACKAGE_fstrim=m CONFIG_PACKAGE_fuse-utils=y CONFIG_PACKAGE_fuse3-utils=m -CONFIG_PACKAGE_getdns=y CONFIG_PACKAGE_glib2=y -CONFIG_PACKAGE_gzip=m -CONFIG_PACKAGE_hexedit=m CONFIG_PACKAGE_hostapd-mbedtls=y -CONFIG_PACKAGE_hostapd-openssl=m CONFIG_PACKAGE_hostapd-utils=y -CONFIG_PACKAGE_htop=m CONFIG_PACKAGE_i2c-tools=y CONFIG_PACKAGE_i2csfp=y CONFIG_PACKAGE_ifstat=y @@ -206,9 +171,6 @@ CONFIG_PACKAGE_ip6tables-extra=y CONFIG_PACKAGE_ip6tables-mod-nat=y CONFIG_PACKAGE_ip6tables-nft=y CONFIG_PACKAGE_ip6tables-zz-legacy=y -CONFIG_PACKAGE_iperf3=m -CONFIG_PACKAGE_iperf3-ssl=m -CONFIG_PACKAGE_ipip=m CONFIG_PACKAGE_ipset=y CONFIG_PACKAGE_iptables-mod-account=y CONFIG_PACKAGE_iptables-mod-asn=y @@ -258,7 +220,7 @@ CONFIG_PACKAGE_iptables-zz-legacy=y CONFIG_PACKAGE_irqbalance=y # CONFIG_PACKAGE_iw is not set CONFIG_PACKAGE_iw-full=y -CONFIG_PACKAGE_kmod-arptables=m +CONFIG_PACKAGE_kmod-arptables=y CONFIG_PACKAGE_kmod-asn1-decoder=y CONFIG_PACKAGE_kmod-asn1-encoder=y CONFIG_PACKAGE_kmod-bonding=y @@ -270,11 +232,6 @@ CONFIG_PACKAGE_kmod-crypto-crc32=y CONFIG_PACKAGE_kmod-crypto-deflate=y CONFIG_PACKAGE_kmod-crypto-ecb=y CONFIG_PACKAGE_kmod-crypto-echainiv=y -CONFIG_PACKAGE_kmod-crypto-eip=y -CONFIG_PACKAGE_kmod-crypto-lib-chacha20=y -CONFIG_PACKAGE_kmod-crypto-lib-chacha20poly1305=y -CONFIG_PACKAGE_kmod-crypto-lib-curve25519=y -CONFIG_PACKAGE_kmod-crypto-lib-poly1305=y CONFIG_PACKAGE_kmod-crypto-michael-mic=y CONFIG_PACKAGE_kmod-crypto-misc=y CONFIG_PACKAGE_kmod-crypto-user=y @@ -285,7 +242,7 @@ CONFIG_PACKAGE_kmod-cryptodev=y CONFIG_PACKAGE_kmod-dax=y CONFIG_PACKAGE_kmod-dm=y CONFIG_PACKAGE_kmod-dnsresolver=y -CONFIG_PACKAGE_kmod-ebtables=m +CONFIG_PACKAGE_kmod-ebtables=y CONFIG_PACKAGE_kmod-ebtables-ipv4=m CONFIG_PACKAGE_kmod-ebtables-ipv6=m CONFIG_PACKAGE_kmod-eeprom-93cx6=y @@ -306,7 +263,6 @@ CONFIG_PACKAGE_kmod-i2c-gpio=y CONFIG_PACKAGE_kmod-i2c-mux-reg=y CONFIG_PACKAGE_kmod-i2c-smbus=y CONFIG_PACKAGE_kmod-i2c-tiny-usb=y -CONFIG_PACKAGE_kmod-ifb=m CONFIG_PACKAGE_kmod-iio-core=y CONFIG_PACKAGE_kmod-ip6tables=y CONFIG_PACKAGE_kmod-ip6tables-extra=y @@ -480,8 +436,6 @@ CONFIG_PACKAGE_kmod-tcp-scalable=y CONFIG_PACKAGE_kmod-tls=y CONFIG_PACKAGE_kmod-tpm=y CONFIG_PACKAGE_kmod-tun=y -CONFIG_PACKAGE_kmod-udptunnel4=y -CONFIG_PACKAGE_kmod-udptunnel6=y CONFIG_PACKAGE_kmod-usb-net=y CONFIG_PACKAGE_kmod-usb-net-cdc-ether=y CONFIG_PACKAGE_kmod-usb-net-cdc-ncm=y @@ -489,49 +443,44 @@ CONFIG_PACKAGE_kmod-usb-storage=y CONFIG_PACKAGE_kmod-usb-storage-extras=y CONFIG_PACKAGE_kmod-usb-storage-uas=y CONFIG_PACKAGE_kmod-veth=y -CONFIG_PACKAGE_kmod-vxlan=y -CONFIG_PACKAGE_kmod-wireguard=y CONFIG_PACKAGE_kmod-xfrm-interface=y -CONFIG_PACKAGE_kmod-zram=m -CONFIG_PACKAGE_less=m +CONFIG_PACKAGE_kmod-zram=y CONFIG_PACKAGE_libatomic=y CONFIG_PACKAGE_libattr=y CONFIG_PACKAGE_libavahi-client=y CONFIG_PACKAGE_libavahi-dbus-support=y -CONFIG_PACKAGE_libbfd=m +CONFIG_PACKAGE_libbfd=y CONFIG_PACKAGE_libbpf=y CONFIG_PACKAGE_libbz2=y -CONFIG_PACKAGE_libcbor=y -CONFIG_PACKAGE_libctf=m CONFIG_PACKAGE_libcurl=y CONFIG_PACKAGE_libdaemon=y CONFIG_PACKAGE_libdbus=y CONFIG_PACKAGE_libdevmapper=y -CONFIG_PACKAGE_libdw=y +# CONFIG_PACKAGE_libe2p is not set CONFIG_PACKAGE_libelf=y -CONFIG_PACKAGE_libestr=m +CONFIG_PACKAGE_libestr=y CONFIG_PACKAGE_libevdev=y CONFIG_PACKAGE_libevent2=y -CONFIG_PACKAGE_libevent2-core=m +CONFIG_PACKAGE_libevent2-core=y CONFIG_PACKAGE_libexpat=y -CONFIG_PACKAGE_libfastjson=m +# CONFIG_PACKAGE_libext2fs is not set CONFIG_PACKAGE_libfdisk=y CONFIG_PACKAGE_libffi=y -CONFIG_PACKAGE_libfido2=y CONFIG_PACKAGE_libfuse=y CONFIG_PACKAGE_libfuse3=y CONFIG_PACKAGE_libgcrypt=y CONFIG_PACKAGE_libgmp=y CONFIG_PACKAGE_libgpg-error=y CONFIG_PACKAGE_libi2c=y +CONFIG_PACKAGE_libidn2=y CONFIG_PACKAGE_libiio=y CONFIG_PACKAGE_libip4tc=y CONFIG_PACKAGE_libip6tc=y -CONFIG_PACKAGE_libiperf3=m CONFIG_PACKAGE_libipset=y CONFIG_PACKAGE_libiptext=y CONFIG_PACKAGE_libiptext-nft=y CONFIG_PACKAGE_libiptext6=y +CONFIG_PACKAGE_libiw=y CONFIG_PACKAGE_libkmod=y CONFIG_PACKAGE_libltdl=y CONFIG_PACKAGE_liblua=y @@ -542,12 +491,13 @@ CONFIG_PACKAGE_liblz4=y CONFIG_PACKAGE_liblzma=y CONFIG_PACKAGE_liblzo=y CONFIG_PACKAGE_libmbim=y -CONFIG_PACKAGE_libmicrohttpd-no-ssl=y CONFIG_PACKAGE_libmount=y CONFIG_PACKAGE_libncurses=y CONFIG_PACKAGE_libnetfilter-conntrack=y +CONFIG_PACKAGE_libnetfilter-cthelper=y +CONFIG_PACKAGE_libnetfilter-cttimeout=y +CONFIG_PACKAGE_libnetfilter-queue=y CONFIG_PACKAGE_libnetsnmp=y -CONFIG_PACKAGE_libnettle=y CONFIG_PACKAGE_libnfnetlink=y CONFIG_PACKAGE_libnghttp2=y CONFIG_PACKAGE_libnl=y @@ -557,21 +507,12 @@ CONFIG_PACKAGE_libnl-genl=y CONFIG_PACKAGE_libnl-nf=y CONFIG_PACKAGE_libnl-route=y CONFIG_PACKAGE_libnvme=y -CONFIG_PACKAGE_libopcodes=m -CONFIG_PACKAGE_libopenssl=y -CONFIG_PACKAGE_libopenssl-conf=y -CONFIG_PACKAGE_libopenssl-devcrypto=m -CONFIG_PACKAGE_libopenssl-legacy=m -CONFIG_PACKAGE_liboping=y CONFIG_PACKAGE_libowipcalc=y CONFIG_PACKAGE_libparted=y CONFIG_PACKAGE_libpcap=y CONFIG_PACKAGE_libpci=y CONFIG_PACKAGE_libpcre2=y CONFIG_PACKAGE_libpopt=m -CONFIG_PACKAGE_libprotobuf-c=y -CONFIG_PACKAGE_libqmi=y -CONFIG_PACKAGE_libqrtr-glib=y CONFIG_PACKAGE_libreadline=y CONFIG_PACKAGE_librrd1=y CONFIG_PACKAGE_libsensors=y @@ -579,16 +520,8 @@ CONFIG_PACKAGE_libsmartcols=y CONFIG_PACKAGE_libspeedtestcpp=y CONFIG_PACKAGE_libstdcpp=y CONFIG_PACKAGE_libsysfs=y -CONFIG_PACKAGE_libtirpc=y -CONFIG_PACKAGE_libtraceevent=y -CONFIG_PACKAGE_libtraceevent-extra=y -CONFIG_PACKAGE_libtracefs=y CONFIG_PACKAGE_libubus-lua=y -CONFIG_PACKAGE_libudev-zero=y -CONFIG_PACKAGE_libunbound=y -CONFIG_PACKAGE_libunbound_ipset=y -CONFIG_PACKAGE_libunbound_libevent=y -CONFIG_PACKAGE_libunbound_libpthread=y +CONFIG_PACKAGE_libunistring=y # CONFIG_PACKAGE_libustream-mbedtls is not set CONFIG_PACKAGE_libxml2=y CONFIG_PACKAGE_libxtables=y @@ -597,15 +530,22 @@ CONFIG_PACKAGE_libzstd=y CONFIG_PACKAGE_lm-sensors=y CONFIG_PACKAGE_lm-sensors-detect=y CONFIG_PACKAGE_losetup=y -CONFIG_PACKAGE_lsblk=m CONFIG_PACKAGE_lua=y CONFIG_PACKAGE_luci=y CONFIG_PACKAGE_luci-app-attendedsysupgrade=y CONFIG_PACKAGE_luci-app-commands=y CONFIG_PACKAGE_luci-app-firewall=y CONFIG_PACKAGE_luci-app-opkg=y +CONFIG_PACKAGE_luci-app-uhttpd=y CONFIG_PACKAGE_luci-base=y CONFIG_PACKAGE_luci-compat=y +CONFIG_PACKAGE_luci-i18n-attendedsysupgrade-ru=y +CONFIG_PACKAGE_luci-i18n-base-ru=y +CONFIG_PACKAGE_luci-i18n-commands-ru=y +CONFIG_PACKAGE_luci-i18n-dashboard-ru=y +CONFIG_PACKAGE_luci-i18n-firewall-ru=y +CONFIG_PACKAGE_luci-i18n-opkg-ru=y +CONFIG_PACKAGE_luci-i18n-uhttpd-ru=y CONFIG_PACKAGE_luci-lib-base=y CONFIG_PACKAGE_luci-lib-ip=y CONFIG_PACKAGE_luci-lib-json=y @@ -626,31 +566,19 @@ CONFIG_PACKAGE_luci-proto-ppp=y CONFIG_PACKAGE_luci-proto-relay=y CONFIG_PACKAGE_luci-theme-bootstrap=y CONFIG_PACKAGE_mmc-utils=y -CONFIG_PACKAGE_moreutils=m -CONFIG_PACKAGE_mount-utils=m CONFIG_PACKAGE_mt76-test=y -CONFIG_PACKAGE_mt76-vendor=m CONFIG_PACKAGE_mt7981-wo-firmware=y CONFIG_PACKAGE_mt7986-wo-firmware=y -CONFIG_PACKAGE_mt7988-2p5g-phy-firmware=m +CONFIG_PACKAGE_mt7988-2p5g-phy-firmware=y CONFIG_PACKAGE_musl-fts=y CONFIG_PACKAGE_mwan3=y -CONFIG_PACKAGE_nand-utils=m CONFIG_PACKAGE_nano=y CONFIG_PACKAGE_nstat=y -CONFIG_PACKAGE_nvme-cli=m -CONFIG_PACKAGE_objdump=m +CONFIG_PACKAGE_nvme-cli=y CONFIG_PACKAGE_odhcpd=y # CONFIG_PACKAGE_odhcpd-ipv6only is not set CONFIG_PACKAGE_odhcpd_full_ext_cer_id=0 -CONFIG_PACKAGE_openssh-keygen=y -CONFIG_PACKAGE_openssh-moduli=y -CONFIG_PACKAGE_openssh-server=y -CONFIG_PACKAGE_openssh-sftp-server=y -CONFIG_PACKAGE_openssl-util=y CONFIG_PACKAGE_owipcalc=y -CONFIG_PACKAGE_parted=m -CONFIG_PACKAGE_patch=m CONFIG_PACKAGE_perl=y CONFIG_PACKAGE_perlbase-base=y CONFIG_PACKAGE_perlbase-bytes=y @@ -684,10 +612,7 @@ CONFIG_PACKAGE_perlbase-time=y CONFIG_PACKAGE_perlbase-unicore=y CONFIG_PACKAGE_perlbase-utf8=y CONFIG_PACKAGE_perlbase-xsloader=y -CONFIG_PACKAGE_procps-ng=y -CONFIG_PACKAGE_procps-ng-ps=y CONFIG_PACKAGE_proto-bonding=y -CONFIG_PACKAGE_qosify=m CONFIG_PACKAGE_relayd=y CONFIG_PACKAGE_resolveip=y CONFIG_PACKAGE_rpcd=y @@ -697,53 +622,10 @@ CONFIG_PACKAGE_rpcd-mod-luci=y CONFIG_PACKAGE_rpcd-mod-rpcsys=y CONFIG_PACKAGE_rpcd-mod-rrdns=y CONFIG_PACKAGE_rpcd-mod-ucode=y -CONFIG_PACKAGE_rsyslog=m -CONFIG_PACKAGE_screen=m -CONFIG_PACKAGE_sfdisk=m -CONFIG_PACKAGE_sgdisk=m -CONFIG_PACKAGE_speedtestcpp=m CONFIG_PACKAGE_squashfs-tools-unsquashfs=m -CONFIG_PACKAGE_strongswan=y -CONFIG_PACKAGE_strongswan-charon=y -CONFIG_PACKAGE_strongswan-default=y -CONFIG_PACKAGE_strongswan-mod-aes=y -CONFIG_PACKAGE_strongswan-mod-attr=y -CONFIG_PACKAGE_strongswan-mod-connmark=y -CONFIG_PACKAGE_strongswan-mod-constraints=y -CONFIG_PACKAGE_strongswan-mod-des=y -CONFIG_PACKAGE_strongswan-mod-dnskey=y -CONFIG_PACKAGE_strongswan-mod-fips-prf=y -CONFIG_PACKAGE_strongswan-mod-gmp=y -CONFIG_PACKAGE_strongswan-mod-hmac=y -CONFIG_PACKAGE_strongswan-mod-kdf=y -CONFIG_PACKAGE_strongswan-mod-kernel-netlink=y -CONFIG_PACKAGE_strongswan-mod-md5=y -CONFIG_PACKAGE_strongswan-mod-mgf1=y -CONFIG_PACKAGE_strongswan-mod-pem=y -CONFIG_PACKAGE_strongswan-mod-pgp=y -CONFIG_PACKAGE_strongswan-mod-pkcs1=y -CONFIG_PACKAGE_strongswan-mod-pubkey=y -CONFIG_PACKAGE_strongswan-mod-random=y -CONFIG_PACKAGE_strongswan-mod-rc2=y -CONFIG_PACKAGE_strongswan-mod-resolve=y -CONFIG_PACKAGE_strongswan-mod-revocation=y -CONFIG_PACKAGE_strongswan-mod-sha1=y -CONFIG_PACKAGE_strongswan-mod-sha2=y -CONFIG_PACKAGE_strongswan-mod-socket-default=y -CONFIG_PACKAGE_strongswan-mod-sshkey=y -CONFIG_PACKAGE_strongswan-mod-updown=y -CONFIG_PACKAGE_strongswan-mod-vici=y -CONFIG_PACKAGE_strongswan-mod-x509=y -CONFIG_PACKAGE_strongswan-mod-xauth-generic=y -CONFIG_PACKAGE_strongswan-mod-xcbc=y -CONFIG_PACKAGE_strongswan-swanctl=y -CONFIG_PACKAGE_stubby=y CONFIG_PACKAGE_sysfsutils=y CONFIG_PACKAGE_tc-full=y -CONFIG_PACKAGE_tcpdump=m -CONFIG_PACKAGE_telnet-bsd=m CONFIG_PACKAGE_terminfo=y -CONFIG_PACKAGE_tmux=m CONFIG_PACKAGE_ucert-full=y CONFIG_PACKAGE_ucode-mod-bpf=y CONFIG_PACKAGE_ucode-mod-html=y @@ -751,34 +633,19 @@ CONFIG_PACKAGE_ucode-mod-lua=y CONFIG_PACKAGE_ucode-mod-math=y CONFIG_PACKAGE_uhttpd=y CONFIG_PACKAGE_uhttpd-mod-ubus=y -CONFIG_PACKAGE_unbound-anchor=y -CONFIG_PACKAGE_unbound-checkconf=y -CONFIG_PACKAGE_unbound-control=y -CONFIG_PACKAGE_unbound-control-setup=y -CONFIG_PACKAGE_unbound-daemon=y -CONFIG_PACKAGE_unbound-host=y -CONFIG_PACKAGE_unzip=m -CONFIG_PACKAGE_vxlan=y -CONFIG_PACKAGE_wavemon=y -CONFIG_PACKAGE_wg-installer-client=y -CONFIG_PACKAGE_wget-ssl=y -CONFIG_PACKAGE_wipefs=m -CONFIG_PACKAGE_wireguard-tools=y CONFIG_PACKAGE_wireless-tools=y +CONFIG_PACKAGE_wpa-cli=y +CONFIG_PACKAGE_wpa-supplicant-mbedtls=y # CONFIG_PACKAGE_wpad-basic-mbedtls is not set -CONFIG_PACKAGE_wpad-openssl=m CONFIG_PACKAGE_xtables-legacy=y CONFIG_PACKAGE_xtables-nft=y -CONFIG_PACKAGE_xz-utils=m CONFIG_PACKAGE_zlib=y CONFIG_PACKAGE_zoneinfo-core=y CONFIG_PACKAGE_zoneinfo-europe=y -CONFIG_PACKAGE_zram-swap=m -CONFIG_PACKAGE_zstd=m -CONFIG_PARTED_LVM2=y -CONFIG_PARTED_READLINE=y +CONFIG_PACKAGE_zram-swap=y CONFIG_PERL_NOCOMMENT=y CONFIG_PERL_THREADS=y +# CONFIG_PER_FEED_REPO is not set CONFIG_PKG_ASLR_PIE_ALL=y # CONFIG_PKG_ASLR_PIE_REGULAR is not set # CONFIG_PKG_CC_STACKPROTECTOR_REGULAR is not set @@ -791,8 +658,6 @@ CONFIG_SQUASHFS_TOOLS_LZ4_SUPPORT=y CONFIG_SQUASHFS_TOOLS_LZO_SUPPORT=y CONFIG_SQUASHFS_TOOLS_XZ_SUPPORT=y CONFIG_SQUASHFS_TOOLS_ZSTD_SUPPORT=y -CONFIG_STRONGSWAN_ROUTING_TABLE="220" -CONFIG_STRONGSWAN_ROUTING_TABLE_PRIO="220" CONFIG_TARGET_DEFAULT_LAN_IP_FROM_PREINIT=y # CONFIG_TARGET_INIT_SUPPRESS_STDERR is not set CONFIG_TARGET_OPTIMIZATION="-Os -pipe -mcpu=cortex-a73+crc+crypto+rdma" @@ -806,24 +671,21 @@ CONFIG_USE_LTO=y CONFIG_USE_MOLD=y CONFIG_VERSIONOPT=y CONFIG_VERSION_BUG_URL="" -CONFIG_VERSION_CODE="12" +CONFIG_VERSION_CODE="2024-09-26-r16" CONFIG_VERSION_CODE_FILENAMES=y -CONFIG_VERSION_DIST="openwrt-nstorm" +CONFIG_VERSION_DIST="OpenWrt-NStorm-BPI-R4" CONFIG_VERSION_FILENAMES=y CONFIG_VERSION_HOME_URL="https://github.com/N-Storm/openwrt" CONFIG_VERSION_HWREV="" CONFIG_VERSION_MANUFACTURER="Sinovoip" CONFIG_VERSION_MANUFACTURER_URL="" -CONFIG_VERSION_NUMBER="6.6.52-SNAPSHOT" +CONFIG_VERSION_NUMBER="v24-SNAPSHOT-6.6.52" CONFIG_VERSION_PRODUCT="BananaPI BPI-R4" -CONFIG_VERSION_REPO="https://github.com/N-Storm/Openwrt_Builder" +CONFIG_VERSION_REPO="" CONFIG_VERSION_SUPPORT_URL="" CONFIG_ZRAM_DEF_COMP_ZSTD=y CONFIG_ZSTD_OPTIMIZE_O3=y # CONFIG_BUSYBOX_CONFIG_PIE is not set CONFIG_KERNEL_WERROR=y -# CONFIG_PACKAGE_kmod-crypto-kpp is not set CONFIG_PACKAGE_libcomerr=y -CONFIG_PACKAGE_libe2p=y -CONFIG_PACKAGE_libext2fs=y CONFIG_PACKAGE_libss=y From 094f62611a0fa76f3f789c5eacfb6e0c98f90feb Mon Sep 17 00:00:00 2001 From: N-Storm Date: Thu, 26 Sep 2024 06:05:09 +0300 Subject: [PATCH 35/40] Config r17 --- config-nstorm-bananapi-bpi-r4 | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/config-nstorm-bananapi-bpi-r4 b/config-nstorm-bananapi-bpi-r4 index f2aa2786bfc598..579be48836bc0b 100644 --- a/config-nstorm-bananapi-bpi-r4 +++ b/config-nstorm-bananapi-bpi-r4 @@ -81,6 +81,7 @@ CONFIG_BWMNG_EXTENDEDSTATS=y CONFIG_BWMNG_TIME=y CONFIG_DROPBEAR_ASKPASS=y CONFIG_EXPERIMENTAL=y +# CONFIG_FEED_mtk_openwrt_feed is not set CONFIG_GCC_DEFAULT_PIE=y CONFIG_GCC_USE_GRAPHITE=y # CONFIG_GCC_USE_VERSION_13 is not set @@ -468,7 +469,6 @@ CONFIG_PACKAGE_libfdisk=y CONFIG_PACKAGE_libffi=y CONFIG_PACKAGE_libfuse=y CONFIG_PACKAGE_libfuse3=y -CONFIG_PACKAGE_libgcrypt=y CONFIG_PACKAGE_libgmp=y CONFIG_PACKAGE_libgpg-error=y CONFIG_PACKAGE_libi2c=y @@ -481,7 +481,6 @@ CONFIG_PACKAGE_libiptext=y CONFIG_PACKAGE_libiptext-nft=y CONFIG_PACKAGE_libiptext6=y CONFIG_PACKAGE_libiw=y -CONFIG_PACKAGE_libkmod=y CONFIG_PACKAGE_libltdl=y CONFIG_PACKAGE_liblua=y CONFIG_PACKAGE_liblucihttp=y @@ -490,7 +489,6 @@ CONFIG_PACKAGE_liblucihttp-ucode=y CONFIG_PACKAGE_liblz4=y CONFIG_PACKAGE_liblzma=y CONFIG_PACKAGE_liblzo=y -CONFIG_PACKAGE_libmbim=y CONFIG_PACKAGE_libmount=y CONFIG_PACKAGE_libncurses=y CONFIG_PACKAGE_libnetfilter-conntrack=y @@ -508,7 +506,6 @@ CONFIG_PACKAGE_libnl-nf=y CONFIG_PACKAGE_libnl-route=y CONFIG_PACKAGE_libnvme=y CONFIG_PACKAGE_libowipcalc=y -CONFIG_PACKAGE_libparted=y CONFIG_PACKAGE_libpcap=y CONFIG_PACKAGE_libpci=y CONFIG_PACKAGE_libpcre2=y @@ -645,7 +642,6 @@ CONFIG_PACKAGE_zoneinfo-europe=y CONFIG_PACKAGE_zram-swap=y CONFIG_PERL_NOCOMMENT=y CONFIG_PERL_THREADS=y -# CONFIG_PER_FEED_REPO is not set CONFIG_PKG_ASLR_PIE_ALL=y # CONFIG_PKG_ASLR_PIE_REGULAR is not set # CONFIG_PKG_CC_STACKPROTECTOR_REGULAR is not set @@ -658,6 +654,7 @@ CONFIG_SQUASHFS_TOOLS_LZ4_SUPPORT=y CONFIG_SQUASHFS_TOOLS_LZO_SUPPORT=y CONFIG_SQUASHFS_TOOLS_XZ_SUPPORT=y CONFIG_SQUASHFS_TOOLS_ZSTD_SUPPORT=y +CONFIG_SRC_TREE_OVERRIDE=y CONFIG_TARGET_DEFAULT_LAN_IP_FROM_PREINIT=y # CONFIG_TARGET_INIT_SUPPRESS_STDERR is not set CONFIG_TARGET_OPTIMIZATION="-Os -pipe -mcpu=cortex-a73+crc+crypto+rdma" @@ -671,9 +668,9 @@ CONFIG_USE_LTO=y CONFIG_USE_MOLD=y CONFIG_VERSIONOPT=y CONFIG_VERSION_BUG_URL="" -CONFIG_VERSION_CODE="2024-09-26-r16" +CONFIG_VERSION_CODE="2024-09-26-r17" CONFIG_VERSION_CODE_FILENAMES=y -CONFIG_VERSION_DIST="OpenWrt-NStorm-BPI-R4" +CONFIG_VERSION_DIST="" CONFIG_VERSION_FILENAMES=y CONFIG_VERSION_HOME_URL="https://github.com/N-Storm/openwrt" CONFIG_VERSION_HWREV="" From 69fe1f294300f43cef8064843133a599956d2581 Mon Sep 17 00:00:00 2001 From: Rudy Andram Date: Thu, 26 Sep 2024 07:41:03 +0100 Subject: [PATCH 36/40] fix typo on wifi-detect.uc --- .../files/usr/share/hostap/wifi-detect.uc | 335 +++++++++--------- 1 file changed, 171 insertions(+), 164 deletions(-) diff --git a/package/network/config/wifi-scripts/files/usr/share/hostap/wifi-detect.uc b/package/network/config/wifi-scripts/files/usr/share/hostap/wifi-detect.uc index a4f5e2369882d7..4bea7d0772e74c 100644 --- a/package/network/config/wifi-scripts/files/usr/share/hostap/wifi-detect.uc +++ b/package/network/config/wifi-scripts/files/usr/share/hostap/wifi-detect.uc @@ -9,195 +9,202 @@ let prev_board_data = json(readfile(board_file)); let board_data = json(readfile(board_file)); function phy_idx(name) { - return +rtrim(readfile(`/sys/class/ieee80211/${name}/index`)); + return +rtrim(readfile(`/sys/class/ieee80211/${name}/index`)); } function phy_path(name) { - let devpath = realpath(`/sys/class/ieee80211/${name}/device`); + let devpath = realpath(`/sys/class/ieee80211/${name}/device`); - devpath = replace(devpath, /^\/sys\/devices\//, ""); - if (match(devpath, /^platform\/.*\/pci/)) - devpath = replace(devpath, /^platform\//, ""); - let dev_phys = map(glob(`/sys/class/ieee80211/${name}/device/ieee80211/*`), basename); - sort(dev_phys, (a, b) => phy_idx(a) - phy_idx(b)); + devpath = replace(devpath, /^\/sys\/devices\//, ""); + if (match(devpath, /^platform\/.*\/pci/)) + devpath = replace(devpath, /^platform\//, ""); + let dev_phys = map(glob(`/sys/class/ieee80211/${name}/device/ieee80211/*`), basename); + sort(dev_phys, (a, b) => phy_idx(a) - phy_idx(b)); - let ofs = index(dev_phys, name); - if (ofs > 0) - devpath += `+${ofs}`; + let ofs = index(dev_phys, name); + if (ofs > 0) + devpath += `+${ofs}`; - return devpath; + return devpath; } function cleanup() { - let wlan = board_data.wlan; + let wlan = board_data.wlan; - for (let name in wlan) - if (substr(name, 0, 3) == "phy") - delete wlan[name]; - else - delete wlan[name].info; + for (let name in wlan) + if (substr(name, 0, 3) == "phy") + delete wlan[name]; + else + delete wlan[name].info; } function wiphy_get_entry(phy, path) { - board_data.wlan ??= {}; + board_data.wlan ??= {}; - let wlan = board_data.wlan; - for (let name in wlan) - if (wlan[name].path == path) - return wlan[name]; + let wlan = board_data.wlan; + for (let name in wlan) + if (wlan[name].path == path) + return wlan[name]; - wlan[phy] = { - path: path - }; + wlan[phy] = { + path: path + }; - return wlan[phy]; + return wlan[phy]; } function freq_to_channel(freq) { - if (freq < 1000) - return 0; - if (freq == 2484) - return 14; - if (freq == 5935) - return 2; - if (freq < 2484) - return (freq - 2407) / 5; - if (freq >= 4910 && freq <= 4980) - return (freq - 4000) / 5; - if (freq < 5950) - return (freq - 5000) / 5; - if (freq <= 45000) - return (freq - 5950) / 5; - if (freq >= 58320 && freq <= 70200) - return (freq - 56160) / 2160; - return 0; + if (freq < 1000) + return 0; + if (freq == 2484) + return 14; + if (freq == 5935) + return 2; + if (freq < 2484) + return (freq - 2407) / 5; + if (freq >= 4910 && freq <= 4980) + return (freq - 4000) / 5; + if (freq < 5950) + return (freq - 5000) / 5; + if (freq <= 45000) + return (freq - 5950) / 5; + if (freq >= 58320 && freq <= 70200) + return (freq - 56160) / 2160; + return 0; } function wiphy_detect() { - let phys = nl.request(nl.const.NL80211_CMD_GET_WIPHY, nl.const.NLM_F_DUMP, { split_wiphy_dump: true }); - if (!phys) - return; - - for (let phy in phys) { - let name = phy.wiphy_name; - let path = phy_path(name); - let info = { - antenna_rx: phy.wiphy_antenna_avail_rx, - antenna_tx: phy.wiphy_antenna_avail_tx, - bands: {}, - }; - - let bands = info.bands; - for (let band in phy.wiphy_bands) { - if (!band || !band.freqs) - continue; - let freq = band.freqs[0].freq; - let band_info = {}; - let band_name; - if (freq > 50000) - band_name = "60G"; - else if (freq > 5900) - band_name = "6G"; - else if (freq > 4000) - band_name = "5G"; - else if (freq > 2000) - band_name = "2G"; - else - continue; - bands[band_name] = band_info; - if (band.ht_capa > 0) - band_info.ht = true; - if (band.vht_capa > 0) - band_info.vht = true; - let he_phy_cap = 0; - - for (let ift in band.iftype_data) { - if (!ift.he_cap_phy) - continue; - - band_info.he = true; - he_phy_cap |= ift.he_cap_phy[0]; - /* FIXME: hardcode */ - band_info.eht = true; - } - - if (band_name == "6G" && band_info.eht) - band_info.max_width = 320; - else if (band_name != "2G" && - (he_phy_cap & 0x18) || ((band.vht_capa >> 2) & 0x3)) - band_info.max_width = 160; - else if (band_name != "2G" && - (he_phy_cap & 4) || band.vht_capa > 0) - band_info.max_width = 80; - else if ((band.ht_capa & 0x2) || (he_phy_cap & 0x2)) - band_info.max_width = 40; - else - band_info.max_width = 20; - - let modes = band_info.modes = [ "NOHT" ]; - if (band_info.ht) - push(modes, "HT20"); - if (band_info.vht) - push(modes, "VHT20"); - if (band_info.he) - push(modes, "HE20"); - if (band_info.eht) - push(modes, "EHT20"); - if (band.ht_capa & 0x2) { - push(modes, "HT40"); - if (band_info.vht) - push(modes, "VHT40") - } - if (he_phy_cap & 0x2) { - push(modes, "HE40"); - if (band_info.eht) - push(modes, "EHT40"); - } - - for (let freq in band.freqs) { - if (freq.disabled) - continue; - let chan = freq_to_channel(freq.freq); - if (!chan) - continue; - band_info.default_channel = chan; - break; - } - - if (band_name == "2G") - continue; - if (band_info.vht) - push(modes, "VHT80"); - if (he_phy_cap & 4) { - push(modes, "HE80"); - if (band_info.eht) - push(modes, "EHT80"); - } - if ((band.vht_capa >> 2) & 0x3) - push(modes, "VHT160"); - if (he_phy_cap & 0x18) { - push(modes, "HE160"); - if (band_info.eht) - push(modes, "EHT160"); - } - if (band_name == "6G" && band_info.eht) - push(modes, "EHT320"); - } - - let entry = wiphy_get_entry(name, path); - entry.info = info; - } + let phys = nl.request(nl.const.NL80211_CMD_GET_WIPHY, nl.const.NLM_F_DUMP, { split_wiphy_dump: true }); + if (!phys) + return; + + for (let phy in phys) { + let name = phy.wiphy_name; + let path = phy_path(name); + let info = { + antenna_rx: phy.wiphy_antenna_avail_rx, + antenna_tx: phy.wiphy_antenna_avail_tx, + bands: {}, + }; + + let bands = info.bands; + for (let band in phy.wiphy_bands) { + if (!band || !band.freqs) + continue; + let freq = band.freqs[0].freq; + let band_info = {}; + let band_name; + if (freq > 50000) + band_name = "60G"; + else if (freq > 5900) + band_name = "6G"; + else if (freq > 4000) + band_name = "5G"; + else if (freq > 2000) + band_name = "2G"; + else + continue; + bands[band_name] = band_info; + if (band.ht_capa > 0) + band_info.ht = true; + if (band.vht_capa > 0) + band_info.vht = true; + let he_phy_cap = 0; + let eht_phy_cap = 0; + + for (let ift in band.iftype_data) { + if (!ift.he_cap_phy) + continue; + + band_info.he = true; + he_phy_cap |= ift.he_cap_phy[0]; + + if (!ift.eht_cap_phy) + continue; + + band_info.eht = true; + eht_phy_cap |= ift.eht_cap_phy[0]; + } + + if (band_name != "2G" && + (he_phy_cap & 0x18) || ((band.vht_capa >> 2) & 0x3)) + band_info.max_width = 160; + else if (band_name != "2G" && + (he_phy_cap & 4) || band.vht_capa > 0) + band_info.max_width = 80; + else if ((band.ht_capa & 0x2) || (he_phy_cap & 0x2)) + band_info.max_width = 40; + else + band_info.max_width = 20; + + let modes = band_info.modes = [ "NOHT" ]; + if (band_info.ht) + push(modes, "HT20"); + if (band_info.vht) + push(modes, "VHT20"); + if (band_info.he) + push(modes, "HE20"); + if (band_info.eht) + push(modes, "EHT20"); + if (band.ht_capa & 0x2) { + push(modes, "HT40"); + if (band_info.vht) + push(modes, "VHT40") + } + if (he_phy_cap & 2) + push(modes, "HE40"); + + if (eht_phy_cap && he_phy_cap & 2) + push(modes, "EHT40"); + + for (let freq in band.freqs) { + if (freq.disabled) + continue; + let chan = freq_to_channel(freq.freq); + if (!chan) + continue; + band_info.default_channel = chan; + break; + } + + if (band_name == "2G") + continue; + + if (he_phy_cap & 4) + push(modes, "HE40"); + if (eht_phy_cap && he_phy_cap & 4) + push(modes, "EHT40"); + if (band_info.vht) + push(modes, "VHT80"); + if (he_phy_cap & 4) + push(modes, "HE80"); + if (eht_phy_cap && he_phy_cap & 4) + push(modes, "EHT80"); + if ((band.vht_capa >> 2) & 0x3) + push(modes, "VHT160"); + if (he_phy_cap & 0x18) + push(modes, "HE160"); + if (eht_phy_cap && he_phy_cap & 0x18) + push(modes, "EHT160"); + + if (eht_phy_cap & 2) + push(modes, "ETH320"); + } + + let entry = wiphy_get_entry(name, path); + entry.info = info; + } } cleanup(); wiphy_detect(); if (!is_equal(prev_board_data, board_data)) { - let new_file = board_file + ".new"; - unlink(new_file); - let f = open(new_file, "wx"); - if (!f) - exit(1); - f.write(sprintf("%.J\n", board_data)); - f.close(); - rename(new_file, board_file); + let new_file = board_file + ".new"; + unlink(new_file); + let f = open(new_file, "wx"); + if (!f) + exit(1); + f.write(sprintf("%.J\n", board_data)); + f.close(); + rename(new_file, board_file); } From 2082d7c71c88f65245afa1fb47cf7403f2899d00 Mon Sep 17 00:00:00 2001 From: N-Storm Date: Fri, 27 Sep 2024 04:16:29 +0300 Subject: [PATCH 37/40] r18. Further fixes on partition sizes. This build proven to boot. --- config-nstorm-bananapi-bpi-r4 | 2 +- target/linux/mediatek/image/filogic.mk | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/config-nstorm-bananapi-bpi-r4 b/config-nstorm-bananapi-bpi-r4 index 579be48836bc0b..482415e64b22ae 100644 --- a/config-nstorm-bananapi-bpi-r4 +++ b/config-nstorm-bananapi-bpi-r4 @@ -668,7 +668,7 @@ CONFIG_USE_LTO=y CONFIG_USE_MOLD=y CONFIG_VERSIONOPT=y CONFIG_VERSION_BUG_URL="" -CONFIG_VERSION_CODE="2024-09-26-r17" +CONFIG_VERSION_CODE="2024-09-26-r18" CONFIG_VERSION_CODE_FILENAMES=y CONFIG_VERSION_DIST="" CONFIG_VERSION_FILENAMES=y diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index d9fdfabbdecb83..179f27bba3ef02 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -40,13 +40,13 @@ define Build/mt798x-gpt -t 0x83 -N ubootenv -r -p 512k@4M \ -t 0x83 -N factory -r -p 2M@4608k \ -t 0xef -N fip -r -p 4M@6656k \ - -N recovery -r -p 64M@12M \ + -N recovery -r -p 49M@11M \ $(if $(findstring sdmmc,$1), \ - -N install -r -p 52M@76M \ - -t 0x2e -N production -p $(CONFIG_TARGET_ROOTFS_PARTSIZE)M@128M \ + -N install -r -p 58M@60M \ + -t 0x2e -N production -p $(CONFIG_TARGET_ROOTFS_PARTSIZE)M@118M \ ) \ $(if $(findstring emmc,$1), \ - -t 0x2e -N production -p $(CONFIG_TARGET_ROOTFS_PARTSIZE)M@128M \ + -t 0x2e -N production -p $(CONFIG_TARGET_ROOTFS_PARTSIZE)M@118M \ ) cat $@.tmp >> $@ rm $@.tmp @@ -390,15 +390,15 @@ define Device/bananapi_bpi-r4-common pad-to 17k | mt7988-bl2 sdmmc-comb |\ pad-to 6656k | mt7988-bl31-uboot $$(DEVICE_NAME)-sdmmc |\ $(if $(CONFIG_TARGET_ROOTFS_INITRAMFS),\ - pad-to 12M | append-image-stage initramfs-recovery.itb | check-size 512m |\ + pad-to 11M | append-image-stage initramfs-recovery.itb | check-size 512m |\ ) \ - pad-to 44M | mt7988-bl2 spim-nand-ubi-comb |\ - pad-to 45M | mt7988-bl31-uboot $$(DEVICE_NAME)-snand |\ - pad-to 51M | mt7988-bl2 emmc-comb |\ - pad-to 52M | mt7988-bl31-uboot $$(DEVICE_NAME)-emmc |\ - pad-to 56M | mt798x-gpt emmc |\ + pad-to 60M | mt7988-bl2 spim-nand-ubi-comb |\ + pad-to 61M | mt7988-bl31-uboot $$(DEVICE_NAME)-snand |\ + pad-to 67M | mt7988-bl2 emmc-comb |\ + pad-to 68M | mt7988-bl31-uboot $$(DEVICE_NAME)-emmc |\ + pad-to 72M | mt798x-gpt emmc |\ $(if $(CONFIG_TARGET_ROOTFS_SQUASHFS),\ - pad-to 64M | append-image squashfs-sysupgrade.itb | check-size |\ + pad-to 118M | append-image squashfs-sysupgrade.itb | check-size |\ ) \ gzip IMAGE_SIZE := $$(shell expr 64 + $$(CONFIG_TARGET_ROOTFS_PARTSIZE))m From 5d9c9f3c1e7eaeec2b9949cd582ec051f6e6a1c3 Mon Sep 17 00:00:00 2001 From: Rudy Andram Date: Sat, 28 Sep 2024 03:36:59 +0100 Subject: [PATCH 38/40] sync with upstream mt76; removed mt76 100-api_update.patch --- package/kernel/mt76/Makefile | 4 +- .../kernel/mt76/patches/100-api_update.patch | 216 ------------------ 2 files changed, 2 insertions(+), 218 deletions(-) delete mode 100644 package/kernel/mt76/patches/100-api_update.patch diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile index 630485ba6f969e..ac3f941ee30523 100644 --- a/package/kernel/mt76/Makefile +++ b/package/kernel/mt76/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mt76 -PKG_RELEASE=2 +PKG_RELEASE=3 PKG_LICENSE:=GPLv2 PKG_LICENSE_FILES:= @@ -10,7 +10,7 @@ PKG_SOURCE_URL:=https://github.com/rmandrad/mt76 PKG_SOURCE_PROTO:=git PKG_SOURCE_DATE:=2024-09-23 -PKG_SOURCE_VERSION:=09ae763c65539f2177430c44a1eb5dcb2b734bdd +PKG_SOURCE_VERSION:=716d296048fd27286d15a825a4611d445b0b439e PKG_MIRROR_HASH:=a68df9981167ccb1731537035f7a48bf481b1f090c9ecf856eda4d931ab545d4 PKG_MAINTAINER:=Felix Fietkau diff --git a/package/kernel/mt76/patches/100-api_update.patch b/package/kernel/mt76/patches/100-api_update.patch deleted file mode 100644 index 30f2eebcfa13aa..00000000000000 --- a/package/kernel/mt76/patches/100-api_update.patch +++ /dev/null @@ -1,216 +0,0 @@ ---- a/mt76.h -+++ b/mt76.h -@@ -14,6 +14,7 @@ - #include - #include - #include -+#include - #include - #if LINUX_VERSION_CODE < KERNEL_VERSION(6,6,0) - #include -@@ -1475,6 +1476,7 @@ static inline void mt76_testmode_reset(s - #endif - } - -+extern const struct nla_policy mt76_tm_policy[NUM_MT76_TM_ATTRS]; - - /* internal */ - static inline struct ieee80211_hw * ---- a/mt7603/main.c -+++ b/mt7603/main.c -@@ -23,7 +23,7 @@ mt7603_start(struct ieee80211_hw *hw) - } - - static void --mt7603_stop(struct ieee80211_hw *hw) -+mt7603_stop(struct ieee80211_hw *hw, bool suspend) - { - struct mt7603_dev *dev = hw->priv; - ---- a/mt7615/main.c -+++ b/mt7615/main.c -@@ -91,7 +91,7 @@ out: - return ret; - } - --static void mt7615_stop(struct ieee80211_hw *hw) -+static void mt7615_stop(struct ieee80211_hw *hw, bool suspend) - { - struct mt7615_dev *dev = mt7615_hw_dev(hw); - struct mt7615_phy *phy = mt7615_hw_phy(hw); ---- a/mt7615/usb.c -+++ b/mt7615/usb.c -@@ -79,7 +79,7 @@ static void mt7663u_copy(struct mt76_dev - mutex_unlock(&usb->usb_ctrl_mtx); - } - --static void mt7663u_stop(struct ieee80211_hw *hw) -+static void mt7663u_stop(struct ieee80211_hw *hw, bool suspend) - { - struct mt7615_phy *phy = mt7615_hw_phy(hw); - struct mt7615_dev *dev = hw->priv; ---- a/mt76x0/pci.c -+++ b/mt76x0/pci.c -@@ -44,7 +44,7 @@ static void mt76x0e_stop_hw(struct mt76x - mt76_clear(dev, MT_WPDMA_GLO_CFG, MT_WPDMA_GLO_CFG_RX_DMA_EN); - } - --static void mt76x0e_stop(struct ieee80211_hw *hw) -+static void mt76x0e_stop(struct ieee80211_hw *hw, bool suspend) - { - struct mt76x02_dev *dev = hw->priv; - ---- a/mt76x0/usb.c -+++ b/mt76x0/usb.c -@@ -77,7 +77,7 @@ static void mt76x0u_cleanup(struct mt76x - mt76u_queues_deinit(&dev->mt76); - } - --static void mt76x0u_stop(struct ieee80211_hw *hw) -+static void mt76x0u_stop(struct ieee80211_hw *hw, bool suspend) - { - struct mt76x02_dev *dev = hw->priv; - ---- a/mt76x2/pci_main.c -+++ b/mt76x2/pci_main.c -@@ -24,7 +24,7 @@ mt76x2_start(struct ieee80211_hw *hw) - } - - static void --mt76x2_stop(struct ieee80211_hw *hw) -+mt76x2_stop(struct ieee80211_hw *hw, bool suspend) - { - struct mt76x02_dev *dev = hw->priv; - ---- a/mt76x2/usb_main.c -+++ b/mt76x2/usb_main.c -@@ -22,7 +22,7 @@ static int mt76x2u_start(struct ieee8021 - return 0; - } - --static void mt76x2u_stop(struct ieee80211_hw *hw) -+static void mt76x2u_stop(struct ieee80211_hw *hw, bool suspend) - { - struct mt76x02_dev *dev = hw->priv; - ---- a/mt7915/main.c -+++ b/mt7915/main.c -@@ -108,7 +108,7 @@ static int mt7915_start(struct ieee80211 - return ret; - } - --static void mt7915_stop(struct ieee80211_hw *hw) -+static void mt7915_stop(struct ieee80211_hw *hw, bool suspend) - { - struct mt7915_dev *dev = mt7915_hw_dev(hw); - struct mt7915_phy *phy = mt7915_hw_phy(hw); ---- a/mt7915/mcu.c -+++ b/mt7915/mcu.c -@@ -335,7 +335,7 @@ mt7915_mcu_cca_finish(void *priv, u8 *ma - if (!vif->bss_conf.color_change_active || vif->type == NL80211_IFTYPE_STATION) - return; - -- ieee80211_color_change_finish(vif); -+ ieee80211_color_change_finish(vif, 0); - } - - static void ---- a/mt7921/main.c -+++ b/mt7921/main.c -@@ -268,7 +268,7 @@ static int mt7921_start(struct ieee80211 - return err; - } - --static void mt7921_stop(struct ieee80211_hw *hw) -+static void mt7921_stop(struct ieee80211_hw *hw, bool suspend) - { - struct mt792x_dev *dev = mt792x_hw_dev(hw); - int err = 0; -@@ -281,7 +281,7 @@ static void mt7921_stop(struct ieee80211 - return; - } - -- mt792x_stop(hw); -+ mt792x_stop(hw, false); - } - - static int ---- a/mt792x.h -+++ b/mt792x.h -@@ -337,7 +337,7 @@ static inline bool mt792x_dma_need_reini - #define mt792x_mutex_release(dev) \ - mt76_connac_mutex_release(&(dev)->mt76, &(dev)->pm) - --void mt792x_stop(struct ieee80211_hw *hw); -+void mt792x_stop(struct ieee80211_hw *hw, bool suspend); - void mt792x_pm_wake_work(struct work_struct *work); - void mt792x_pm_power_save_work(struct work_struct *work); - void mt792x_reset(struct mt76_dev *mdev); -@@ -457,7 +457,7 @@ void mt792xu_wr(struct mt76_dev *dev, u3 - u32 mt792xu_rmw(struct mt76_dev *dev, u32 addr, u32 mask, u32 val); - void mt792xu_copy(struct mt76_dev *dev, u32 offset, const void *data, int len); - void mt792xu_disconnect(struct usb_interface *usb_intf); --void mt792xu_stop(struct ieee80211_hw *hw); -+void mt792xu_stop(struct ieee80211_hw *hw, bool suspend); - - static inline void - mt792x_skb_add_usb_sdio_hdr(struct mt792x_dev *dev, struct sk_buff *skb, ---- a/mt792x_core.c -+++ b/mt792x_core.c -@@ -113,7 +113,7 @@ void mt792x_tx(struct ieee80211_hw *hw, - } - EXPORT_SYMBOL_GPL(mt792x_tx); - --void mt792x_stop(struct ieee80211_hw *hw) -+void mt792x_stop(struct ieee80211_hw *hw, bool suspend) - { - struct mt792x_dev *dev = mt792x_hw_dev(hw); - struct mt792x_phy *phy = mt792x_hw_phy(hw); ---- a/mt792x_usb.c -+++ b/mt792x_usb.c -@@ -285,12 +285,12 @@ int mt792xu_init_reset(struct mt792x_dev - } - EXPORT_SYMBOL_GPL(mt792xu_init_reset); - --void mt792xu_stop(struct ieee80211_hw *hw) -+void mt792xu_stop(struct ieee80211_hw *hw, bool suspend) - { - struct mt792x_dev *dev = mt792x_hw_dev(hw); - - mt76u_stop_tx(&dev->mt76); -- mt792x_stop(hw); -+ mt792x_stop(hw, false); - } - EXPORT_SYMBOL_GPL(mt792xu_stop); - ---- a/mt7996/main.c -+++ b/mt7996/main.c -@@ -93,7 +93,7 @@ static int mt7996_start(struct ieee80211 - return ret; - } - --static void mt7996_stop(struct ieee80211_hw *hw) -+static void mt7996_stop(struct ieee80211_hw *hw, bool suspend) - { - struct mt7996_dev *dev = mt7996_hw_dev(hw); - struct mt7996_phy *phy = mt7996_hw_phy(hw); ---- a/mt7996/mcu.c -+++ b/mt7996/mcu.c -@@ -421,7 +421,7 @@ mt7996_mcu_cca_finish(void *priv, u8 *ma - if (!vif->bss_conf.color_change_active || vif->type == NL80211_IFTYPE_STATION) - return; - -- ieee80211_color_change_finish(vif); -+ ieee80211_color_change_finish(vif, 0); - } - - static void ---- a/testmode.h -+++ b/testmode.h -@@ -193,6 +193,4 @@ enum mt76_testmode_tx_mode { - MT76_TM_TX_MODE_MAX = NUM_MT76_TM_TX_MODES - 1, - }; - --extern const struct nla_policy mt76_tm_policy[NUM_MT76_TM_ATTRS]; -- - #endif From fe398514e78b792d5a050420de6cb8d8efa1f8fc Mon Sep 17 00:00:00 2001 From: Rudy Andram Date: Sat, 28 Sep 2024 04:18:12 +0100 Subject: [PATCH 39/40] update mt76 to point to latest update --- package/kernel/mt76/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile index ac3f941ee30523..a5cdf815304796 100644 --- a/package/kernel/mt76/Makefile +++ b/package/kernel/mt76/Makefile @@ -11,7 +11,7 @@ PKG_SOURCE_PROTO:=git PKG_SOURCE_DATE:=2024-09-23 PKG_SOURCE_VERSION:=716d296048fd27286d15a825a4611d445b0b439e -PKG_MIRROR_HASH:=a68df9981167ccb1731537035f7a48bf481b1f090c9ecf856eda4d931ab545d4 +PKG_MIRROR_HASH:=d2451dbbdeadf1238ff16c9cf71d485902ee73c7e575eb46e4be6bec3e4db667 PKG_MAINTAINER:=Felix Fietkau PKG_USE_NINJA:=0 From 79db754b8ba98d511f0a1f7b2e74c00090ee671e Mon Sep 17 00:00:00 2001 From: Rudy Andram Date: Sat, 28 Sep 2024 06:26:43 +0100 Subject: [PATCH 40/40] add kmod-thermal to mt7996e --- package/kernel/mt76/Makefile | 10 +++++----- target/linux/mediatek/filogic/target.mk | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile index a5cdf815304796..7cdf4c00abc6b4 100644 --- a/package/kernel/mt76/Makefile +++ b/package/kernel/mt76/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mt76 -PKG_RELEASE=3 +PKG_RELEASE=1 PKG_LICENSE:=GPLv2 PKG_LICENSE_FILES:= @@ -9,9 +9,9 @@ PKG_LICENSE_FILES:= PKG_SOURCE_URL:=https://github.com/rmandrad/mt76 PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2024-09-23 -PKG_SOURCE_VERSION:=716d296048fd27286d15a825a4611d445b0b439e -PKG_MIRROR_HASH:=d2451dbbdeadf1238ff16c9cf71d485902ee73c7e575eb46e4be6bec3e4db667 +PKG_SOURCE_DATE:=2024-09-28 +PKG_SOURCE_VERSION:=92d81f9038dff83c085bb2d824feafb48c574d6b +PKG_MIRROR_HASH:=a06e015bf120863c9b29de424a9998b022fca6c1dc8e0ee644a3a41b958a5f30 PKG_MAINTAINER:=Felix Fietkau PKG_USE_NINJA:=0 @@ -321,7 +321,7 @@ endef define KernelPackage/mt7996e $(KernelPackage/mt76-default) TITLE:=MediaTek MT7996E wireless driver - DEPENDS+=@PCI_SUPPORT +kmod-mt76-connac +kmod-hwmon-core +@DRIVER_11AX_SUPPORT +@DRIVER_11BE_SUPPORT +@KERNEL_RELAY + DEPENDS+=@PCI_SUPPORT +kmod-mt76-core +kmod-mt76-connac +kmod-hwmon-core +kmod-thermal +@DRIVER_11AX_SUPPORT +@DRIVER_11BE_SUPPORT +@KERNEL_RELAY FILES:= $(PKG_BUILD_DIR)/mt7996/mt7996e.ko AUTOLOAD:=$(call AutoProbe,mt7996e) endef diff --git a/target/linux/mediatek/filogic/target.mk b/target/linux/mediatek/filogic/target.mk index d1637e06af700e..0e001cfce9fae7 100644 --- a/target/linux/mediatek/filogic/target.mk +++ b/target/linux/mediatek/filogic/target.mk @@ -2,7 +2,7 @@ ARCH:=aarch64 SUBTARGET:=filogic BOARDNAME:=Filogic 8x0 (MT798x) CPU_TYPE:=cortex-a53 -DEFAULT_PACKAGES += fitblk kmod-phy-aquantia kmod-crypto-hw-safexcel wpad-basic-mbedtls uboot-envtools +DEFAULT_PACKAGES += fitblk kmod-thermal kmod-phy-aquantia kmod-crypto-hw-safexcel wpad-basic-mbedtls uboot-envtools KERNELNAME:=Image dtbs define Target/Description