From 693d2c8f201fe3c7c8b92c94c032207d578458a6 Mon Sep 17 00:00:00 2001 From: Rudy Andram Date: Mon, 16 Sep 2024 14:25:56 +0100 Subject: [PATCH] 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;