From 3576fb83134b3a1b47491287513a0b9d8a35c35b Mon Sep 17 00:00:00 2001 From: AmadeusGhost <42570690+AmadeusGhost@users.noreply.github.com> Date: Sat, 20 Feb 2021 18:01:21 +0800 Subject: [PATCH] treewide: sync all related packages with mac80211 --- package/firmware/ath10k-ct-firmware/Makefile | 68 +-- package/firmware/linux-firmware/intel.mk | 6 +- package/firmware/linux-firmware/qca.mk | 8 + package/kernel/ath10k-ct/Makefile | 14 +- ...64-ath10k-commit-rates-from-mac80211.patch | 24 +- ...rolling-support-for-various-chipsets.patch | 126 +++--- ...02-ath10k-use-tpt-trigger-by-default.patch | 24 +- ...10k-Add-NL80211_EXT_FEATURE_AQL-flag.patch | 10 - ...0-0010-ath10k-limit-htt-rx-ring-size.patch | 6 +- ...60-0011-ath10k-limit-pci-buffer-size.patch | 12 +- package/kernel/mt76/Makefile | 190 +++++++- .../mt76/patches/001-allow-vht-on-2g.patch | 48 +- package/network/config/netifd/Makefile | 6 +- package/network/services/hostapd/Config.in | 13 +- package/network/services/hostapd/Makefile | 168 ++++--- .../hostapd/files/hostapd-basic.config | 2 +- .../hostapd/files/hostapd-full.config | 6 +- .../hostapd/files/hostapd-mini.config | 2 +- .../network/services/hostapd/files/hostapd.sh | 425 +++++++++++++++--- .../hostapd/files/wpa_supplicant-basic.config | 4 +- .../hostapd/files/wpa_supplicant-full.config | 6 +- .../hostapd/files/wpa_supplicant-mini.config | 4 +- .../hostapd/files/wpa_supplicant-p2p.config | 2 +- .../network/services/hostapd/files/wpad.init | 4 +- ...-fix-frequency-setup-with-HE-enabled.patch | 196 ++++++++ ...-init-order-disable-pri-sec-channel-.patch | 126 ++++++ ...andle-HT40-and-mode-downgrade-in-AP-.patch | 102 +++++ ...ix-frequency-config-for-non-p2p-vht-.patch | 63 +++ ...nable-vht-and-he-in-default-config-p.patch | 25 ++ ...er-debug-messages-for-some-error-cas.patch | 83 ++++ ...lper-functions-for-vht-he-parameters.patch | 27 ++ ...annel-attributes-before-running-Mesh.patch | 47 -- ...mpletion-callback-to-complete-mesh-.patch} | 78 ++-- ...frequency-as-pri-sec-channel-switch.patch} | 8 +- ...annels-to-be-selected-if-dfs-is-ena.patch} | 28 +- ...ffchanok-on-DFS-channels-in-non-ETS.patch} | 30 +- ...fix-channel-switch-error-during-CAC.patch} | 27 +- ...-do-not-allow-pri-sec-channel-switch.patch | 29 -- ...nel-driver-DFS-handler-in-userspace.patch} | 14 +- .../014-mesh-fixes-for-mesh-init-deinit.patch | 158 +++++++ .../015-mesh-fix-DFS-deinit-init.patch | 262 +++++++++++ ...sts-DFS-test-for-wpa_supplicant-mesh.patch | 94 ++++ .../patches/017-mesh-fix-mesh_oom-test.patch | 24 + ...ve-mesh-freq-setting-to-own-function.patch | 93 ++++ ...erministic-channel-on-channel-switch.patch | 81 ++++ ...0-mesh-make-forwarding-configurable.patch} | 38 +- ...ix-race-condition-in-mesh-mpm-new-pe.patch | 34 -- ...re-management-frame-from-unexpected-.patch | 66 --- ...ix-WMM-queue-mapping-for-regulatory-.patch | 41 -- ...ix-regulatory-limits-for-wmm-cwmin-c.patch | 47 -- .../090-wolfssl-fix-crypto_bignum_sum.patch | 26 -- ...iler-warnings-on-size_t-printf-forma.patch | 31 -- ...ix-crypto_bignum_rand-implementation.patch | 49 -- ...ardcode-include-directory-in-wpa_sup.patch | 26 -- .../hostapd/patches/100-daemonize_fix.patch | 2 +- .../patches/110-notify-mgmt-frames.patch | 116 +++++ .../120-reconfigure-wps-credentials.patch | 178 ++++++++ .../130-wpa_supplicant-multi_ap_roam.patch | 37 ++ .../hostapd/patches/200-multicall.patch | 56 +-- .../services/hostapd/patches/300-noscan.patch | 12 +- .../hostapd/patches/301-mesh-noscan.patch | 22 +- .../patches/310-rescan_immediately.patch | 2 +- .../hostapd/patches/320-optional_rfkill.patch | 2 +- .../patches/330-nl80211_fix_set_freq.patch | 2 +- .../patches/340-reload_freq_change.patch | 8 +- .../341-mesh-ctrl-iface-channel-switch.patch | 2 +- .../patches/350-nl80211_del_beacon_bss.patch | 10 +- .../patches/360-ctrl_iface_reload.patch | 12 +- .../hostapd/patches/370-ap_sta_support.patch | 66 +-- .../patches/380-disable_ctrl_iface_mib.patch | 36 +- .../381-hostapd_cli_UNKNOWN-COMMAND.patch | 2 +- .../patches/390-wpa_ie_cap_workaround.patch | 4 +- .../400-wps_single_auth_enc_type.patch | 13 +- .../patches/410-limit_debug_messages.patch | 44 +- .../patches/420-indicate-features.patch | 4 +- .../patches/430-hostapd_cli_ifdef.patch | 18 +- .../hostapd/patches/450-scan_wait.patch | 10 +- ...dd-new-config-params-to-be-used-with.patch | 16 +- ...-use-new-parameters-during-ibss-join.patch | 4 +- .../patches/463-add-mcast_rate-to-11s.patch | 10 +- .../patches/464-fix-mesh-obss-check.patch | 2 +- .../patches/470-survey_data_fallback.patch | 4 +- .../patches/500-lto-jobserver-support.patch | 4 +- .../hostapd/patches/600-ubus_support.patch | 122 ++--- .../hostapd/patches/700-wifi-reload.patch | 50 ++- ...ate-if-no-available-channel-is-found.patch | 37 ++ .../services/hostapd/patches/800-usleep.patch | 53 --- ...of-secondary-device-types-for-P2P-gr.patch | 33 ++ .../services/hostapd/src/src/ap/ubus.c | 292 +++++++++++- .../hostapd/src/src/utils/build_features.h | 18 +- .../hostapd/src/wpa_supplicant/ubus.c | 4 + package/network/utils/iw/Makefile | 4 +- .../utils/iw/patches/001-nl80211_h_sync.patch | 32 +- .../utils/iw/patches/200-reduce_size.patch | 97 ++-- package/network/utils/iwinfo/Makefile | 18 +- package/system/rpcd/Makefile | 7 +- 96 files changed, 3339 insertions(+), 1257 deletions(-) delete mode 100644 package/kernel/ath10k-ct/patches/205-ath10k-Add-NL80211_EXT_FEATURE_AQL-flag.patch create mode 100644 package/network/services/hostapd/patches/001-HE-VHT-fix-frequency-setup-with-HE-enabled.patch create mode 100644 package/network/services/hostapd/patches/002-mesh-fix-channel-init-order-disable-pri-sec-channel-.patch create mode 100644 package/network/services/hostapd/patches/003-wpa_supplicant-handle-HT40-and-mode-downgrade-in-AP-.patch create mode 100644 package/network/services/hostapd/patches/004-wpa_supplicant-fix-frequency-config-for-non-p2p-vht-.patch create mode 100644 package/network/services/hostapd/patches/005-wpa_supplicant-enable-vht-and-he-in-default-config-p.patch create mode 100644 package/network/services/hostapd/patches/006-hw_features-better-debug-messages-for-some-error-cas.patch create mode 100644 package/network/services/hostapd/patches/007-dfs-use-helper-functions-for-vht-he-parameters.patch delete mode 100644 package/network/services/hostapd/patches/007-mesh-apply-channel-attributes-before-running-Mesh.patch rename package/network/services/hostapd/patches/{004-mesh-use-setup-completion-callback-to-complete-mesh-.patch => 008-mesh-use-setup-completion-callback-to-complete-mesh-.patch} (55%) rename package/network/services/hostapd/patches/{005-mesh-update-ssid-frequency-as-pri-sec-channel-switch.patch => 009-mesh-update-ssid-frequency-as-pri-sec-channel-switch.patch} (75%) rename package/network/services/hostapd/patches/{011-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch => 010-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch} (71%) rename package/network/services/hostapd/patches/{015-mesh-do-not-use-offchan-mgmt-tx-on-DFS.patch => 011-mesh-do-not-set-offchanok-on-DFS-channels-in-non-ETS.patch} (59%) rename package/network/services/hostapd/patches/{016-mesh-fix-channel-switch-error-during-CAC.patch => 012-mesh-fix-channel-switch-error-during-CAC.patch} (71%) delete mode 100644 package/network/services/hostapd/patches/013-mesh-do-not-allow-pri-sec-channel-switch.patch rename package/network/services/hostapd/patches/{006-mesh-inform-kernel-driver-DFS-handler-in-userspace.patch => 013-mesh-inform-kernel-driver-DFS-handler-in-userspace.patch} (74%) create mode 100644 package/network/services/hostapd/patches/014-mesh-fixes-for-mesh-init-deinit.patch create mode 100644 package/network/services/hostapd/patches/015-mesh-fix-DFS-deinit-init.patch create mode 100644 package/network/services/hostapd/patches/016-tests-DFS-test-for-wpa_supplicant-mesh.patch create mode 100644 package/network/services/hostapd/patches/017-mesh-fix-mesh_oom-test.patch create mode 100644 package/network/services/hostapd/patches/018-mesh-move-mesh-freq-setting-to-own-function.patch create mode 100644 package/network/services/hostapd/patches/019-mesh-use-deterministic-channel-on-channel-switch.patch rename package/network/services/hostapd/patches/{018-mesh-make-forwarding-configurable.patch => 050-mesh-make-forwarding-configurable.patch} (87%) delete mode 100644 package/network/services/hostapd/patches/051-wpa_supplicant-fix-race-condition-in-mesh-mpm-new-pe.patch delete mode 100644 package/network/services/hostapd/patches/067-0001-AP-Silently-ignore-management-frame-from-unexpected-.patch delete mode 100644 package/network/services/hostapd/patches/070-driver_nl80211-fix-WMM-queue-mapping-for-regulatory-.patch delete mode 100644 package/network/services/hostapd/patches/071-driver_nl80211-fix-regulatory-limits-for-wmm-cwmin-c.patch delete mode 100644 package/network/services/hostapd/patches/090-wolfssl-fix-crypto_bignum_sum.patch delete mode 100644 package/network/services/hostapd/patches/091-0001-wolfssl-Fix-compiler-warnings-on-size_t-printf-forma.patch delete mode 100644 package/network/services/hostapd/patches/091-0002-wolfssl-Fix-crypto_bignum_rand-implementation.patch delete mode 100644 package/network/services/hostapd/patches/091-0003-wolfssl-Do-not-hardcode-include-directory-in-wpa_sup.patch create mode 100644 package/network/services/hostapd/patches/110-notify-mgmt-frames.patch create mode 100644 package/network/services/hostapd/patches/120-reconfigure-wps-credentials.patch create mode 100644 package/network/services/hostapd/patches/130-wpa_supplicant-multi_ap_roam.patch create mode 100644 package/network/services/hostapd/patches/800-dfs-enter-DFS-state-if-no-available-channel-is-found.patch delete mode 100644 package/network/services/hostapd/patches/800-usleep.patch create mode 100644 package/network/services/hostapd/patches/801-P2P-Fix-copying-of-secondary-device-types-for-P2P-gr.patch diff --git a/package/firmware/ath10k-ct-firmware/Makefile b/package/firmware/ath10k-ct-firmware/Makefile index 83e5563e64..4fd7266f22 100644 --- a/package/firmware/ath10k-ct-firmware/Makefile +++ b/package/firmware/ath10k-ct-firmware/Makefile @@ -1,8 +1,8 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ath10k-ct-firmware -PKG_VERSION:=2020-07-02 -PKG_RELEASE:=3 +PKG_VERSION:=2020-11-08 +PKG_RELEASE:=1 include $(INCLUDE_DIR)/package.mk @@ -28,120 +28,120 @@ define Download/ct-firmware-htt URL_FILE:=$($(1)_FIRMWARE_FILE_CT_HTT) endef -QCA988X_FIRMWARE_FILE_CT:=firmware-2-ct-full-community-22.bin.lede.019 +QCA988X_FIRMWARE_FILE_CT:=firmware-2-ct-full-community-22.bin.lede.022 define Download/ath10k-firmware-qca988x-ct $(call Download/ct-firmware,QCA988X,) - HASH:=8b4c99253aa309d35f2e060c190091b8db1b84dbda06a6a15c83ac0f9a938126 + HASH:=398e4380e7e55105f3da0f78af29d1e437404ed3a82597aa4b6daaa7dce1a38e endef $(eval $(call Download,ath10k-firmware-qca988x-ct)) -QCA988X_FIRMWARE_FILE_CT_FULL_HTT:=firmware-2-ct-full-htt-mgt-community-22.bin.lede.019 +QCA988X_FIRMWARE_FILE_CT_FULL_HTT:=firmware-2-ct-full-htt-mgt-community-22.bin.lede.022 define Download/ath10k-firmware-qca988x-ct-full-htt $(call Download/ct-firmware-full-htt,QCA988X,) - HASH:=a7168916d6aa5e4d7858f8b620c0c980c76d03f390929db6f4077685ce2051e7 + HASH:=990d9cbf79dd81f141257a289f89808bd7726406c9ed845a7e49e5167002ffde endef $(eval $(call Download,ath10k-firmware-qca988x-ct-full-htt)) -QCA9887_FIRMWARE_FILE_CT:=firmware-2-ct-full-community-22.bin.lede.019 +QCA9887_FIRMWARE_FILE_CT:=firmware-2-ct-full-community-22.bin.lede.022 define Download/ath10k-firmware-qca9887-ct $(call Download/ct-firmware,QCA9887,ath10k-9887) - HASH:=459692deb186a63ab8eeddb7ad5d54779266e68ca686e7c46062554db6dca12b + HASH:=a526cb44560da569781e10bf608194b1eff29b250e9887dba6d4d9a15c921c1e endef $(eval $(call Download,ath10k-firmware-qca9887-ct)) -QCA9887_FIRMWARE_FILE_CT_FULL_HTT:=firmware-2-ct-full-htt-mgt-community-22.bin.lede.019 +QCA9887_FIRMWARE_FILE_CT_FULL_HTT:=firmware-2-ct-full-htt-mgt-community-22.bin.lede.022 define Download/ath10k-firmware-qca9887-ct-full-htt $(call Download/ct-firmware-full-htt,QCA9887,ath10k-9887) - HASH:=fd126a457d0927d0c8ea10d66ef5b67d5e1e0741f8692bb3016bb602d0af3098 + HASH:=0b60fc558b773e9cbd5c2df903c894a030872fdb96390b0cca4b23b7fc7b881f endef $(eval $(call Download,ath10k-firmware-qca9887-ct-full-htt)) -QCA99X0_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.019 +QCA99X0_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.022 define Download/ath10k-firmware-qca99x0-ct $(call Download/ct-firmware,QCA99X0,ath10k-10-4b) - HASH:=7dc934f934bc4973c9273a4f22cfead8e26ec6f579647af31b718a860eca0a4b + HASH:=578ad67976b61a393eb820a05e8eae70ec95f6b803bedbe952b8ff573eb09abe endef $(eval $(call Download,ath10k-firmware-qca99x0-ct)) -QCA99X0_FIRMWARE_FILE_CT_FULL_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.019 +QCA99X0_FIRMWARE_FILE_CT_FULL_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.022 define Download/ath10k-firmware-qca99x0-ct-full-htt $(call Download/ct-firmware-full-htt,QCA99X0,ath10k-10-4b) - HASH:=71a27b245a382fe009938d2826d5c97a90dceb10ddf638325268df91837ea302 + HASH:=8ea5c9f27c048796d406706a9c8471cd070f5aeb768622bb334a04853d557a4d endef $(eval $(call Download,ath10k-firmware-qca99x0-ct-full-htt)) -QCA99X0_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-htt-mgt-community-12.bin-lede.019 +QCA99X0_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-htt-mgt-community-12.bin-lede.022 define Download/ath10k-firmware-qca99x0-ct-htt $(call Download/ct-firmware-htt,QCA99X0,ath10k-10-4b) - HASH:=9ed4fe41e5b0f30172f71ae0fe382dc0aab8aa4f8a898417af4f7ee936575ef6 + HASH:=7b0b7545114e8dc0f2c70dc8a43a5a48d84d37f2a4673977a692c5f3361445c6 endef $(eval $(call Download,ath10k-firmware-qca99x0-ct-htt)) -QCA9984_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.019 +QCA9984_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.022 define Download/ath10k-firmware-qca9984-ct $(call Download/ct-firmware,QCA9984,ath10k-9984-10-4b) - HASH:=32d13f432691fe759ded7d027052e925233adb436cd8f729f85ec3d19ccd1dfd + HASH:=7bfe5bf7c38532fa57db62ebc56ec625583928d5d4736475d5dec4d4ae031154 endef $(eval $(call Download,ath10k-firmware-qca9984-ct)) -QCA9984_FIRMWARE_FILE_CT_FULL_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.019 +QCA9984_FIRMWARE_FILE_CT_FULL_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.022 define Download/ath10k-firmware-qca9984-ct-full-htt $(call Download/ct-firmware-full-htt,QCA9984,ath10k-9984-10-4b) - HASH:=e8ab69777bd00b5fc6b1b7acccb55b903553a99932a5b0351602b5f690106588 + HASH:=672be40c4d987d7e8e309341262a37cda7baf925416d1dc651284b6d2bd30969 endef $(eval $(call Download,ath10k-firmware-qca9984-ct-full-htt)) -QCA9984_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-htt-mgt-community-12.bin-lede.019 +QCA9984_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-htt-mgt-community-12.bin-lede.022 define Download/ath10k-firmware-qca9984-ct-htt $(call Download/ct-firmware-htt,QCA9984,ath10k-9984-10-4b) - HASH:=74449b303b626e0713b3fd4f2d6103d65859403b2dd7bdd8882aa772b69b59c7 + HASH:=a24e887f13aca4358ab2b6a42a7212d066e4d19e29b00bb26f9681b1dc8d0eb0 endef $(eval $(call Download,ath10k-firmware-qca9984-ct-htt)) -QCA4019_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.019 +QCA4019_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.022 define Download/ath10k-firmware-qca4019-ct $(call Download/ct-firmware,QCA4019,ath10k-4019-10-4b) - HASH:=4b89763087c7ed9b56046c4e621b7f045e452436d8d9b430a5d171179e313592 + HASH:=503956d9bf09d603e4cf36ac080fa5b5a22032166204e3c15ae898647bc50df3 endef $(eval $(call Download,ath10k-firmware-qca4019-ct)) -QCA4019_FIRMWARE_FILE_CT_FULL_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.019 +QCA4019_FIRMWARE_FILE_CT_FULL_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.022 define Download/ath10k-firmware-qca4019-ct-full-htt $(call Download/ct-firmware-full-htt,QCA4019,ath10k-4019-10-4b) - HASH:=fba591e5777c53b82542ba16cae69d9bb4684837f2fa4cee1b9b26f648096748 + HASH:=591bf9ed00fb540d7ba034453f17696e8dd91a4b7d81f7cc1ec41f447fa74831 endef $(eval $(call Download,ath10k-firmware-qca4019-ct-full-htt)) -QCA4019_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-htt-mgt-community-12.bin-lede.019 +QCA4019_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-htt-mgt-community-12.bin-lede.022 define Download/ath10k-firmware-qca4019-ct-htt $(call Download/ct-firmware-htt,QCA4019,ath10k-4019-10-4b) - HASH:=0d534c3c424184b8ec2773f15c8933bdab0d39b6f664d2578c6602b0eb7035d1 + HASH:=06e58a283ff90d021ff7cb58684cbf39750bd71cf91c56b32add64253133929c endef $(eval $(call Download,ath10k-firmware-qca4019-ct-htt)) -QCA9888_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.019 +QCA9888_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.022 define Download/ath10k-firmware-qca9888-ct $(call Download/ct-firmware,QCA9888,ath10k-9888-10-4b) - HASH:=048f4300725e6ebbf94a6bf4f3f4e4592c446fcdbe1d801aaac024b15e89e0c9 + HASH:=82ff5afcf0c9dcdb03b0b40c6eddc81e11b18e4f522f681935b5ec42537972ee endef $(eval $(call Download,ath10k-firmware-qca9888-ct)) -QCA9888_FIRMWARE_FILE_CT_FULL_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.019 +QCA9888_FIRMWARE_FILE_CT_FULL_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.022 define Download/ath10k-firmware-qca9888-ct-full-htt $(call Download/ct-firmware-full-htt,QCA9888,ath10k-9888-10-4b) - HASH:=d2a7e9fea6bd854721b3fc03a3a00d379d303b2bce339377ee87a1c14a60312d + HASH:=1a741f2cf43fbea24ed831b4e76cbb114b525d1ee9b917ce0000916cbcc42f92 endef $(eval $(call Download,ath10k-firmware-qca9888-ct-full-htt)) -QCA9888_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-htt-mgt-community-12.bin-lede.019 +QCA9888_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-htt-mgt-community-12.bin-lede.022 define Download/ath10k-firmware-qca9888-ct-htt $(call Download/ct-firmware-htt,QCA9888,ath10k-9888-10-4b) - HASH:=e52a6db33347c641ee791fd9a3a57a2503cdda1adc6b8d943e336431528b9d2a + HASH:=34bf07912a2f3fce4a5887c690848bb06d339bd1c86541b0b57b9c45eccc88e4 endef $(eval $(call Download,ath10k-firmware-qca9888-ct-htt)) diff --git a/package/firmware/linux-firmware/intel.mk b/package/firmware/linux-firmware/intel.mk index 401ab1aa7e..923701c703 100644 --- a/package/firmware/linux-firmware/intel.mk +++ b/package/firmware/linux-firmware/intel.mk @@ -73,7 +73,7 @@ $(eval $(call BuildPackage,iwlwifi-firmware-iwl3160)) Package/iwlwifi-firmware-iwl3168 = $(call Package/firmware-default,Intel Wireless 3168 firmware) define Package/iwlwifi-firmware-iwl3168/install $(INSTALL_DIR) $(1)/lib/firmware - $(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-3168-27.ucode $(1)/lib/firmware + $(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-3168-29.ucode $(1)/lib/firmware endef $(eval $(call BuildPackage,iwlwifi-firmware-iwl3168)) @@ -157,14 +157,14 @@ $(eval $(call BuildPackage,iwlwifi-firmware-iwl8265)) Package/iwlwifi-firmware-iwl9000 = $(call Package/firmware-default,Intel Wireless 9000 firmware) define Package/iwlwifi-firmware-iwl9000/install $(INSTALL_DIR) $(1)/lib/firmware - $(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-9000-pu-b0-jf-b0-38.ucode $(1)/lib/firmware + $(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-9000-pu-b0-jf-b0-46.ucode $(1)/lib/firmware endef $(eval $(call BuildPackage,iwlwifi-firmware-iwl9000)) Package/iwlwifi-firmware-iwl9260 = $(call Package/firmware-default,Intel Wireless 9260 firmware) define Package/iwlwifi-firmware-iwl9260/install $(INSTALL_DIR) $(1)/lib/firmware - $(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-9260-th-b0-jf-b0-38.ucode $(1)/lib/firmware + $(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-9260-th-b0-jf-b0-46.ucode $(1)/lib/firmware endef $(eval $(call BuildPackage,iwlwifi-firmware-iwl9260)) diff --git a/package/firmware/linux-firmware/qca.mk b/package/firmware/linux-firmware/qca.mk index 23fcc0905a..71b484d5c7 100644 --- a/package/firmware/linux-firmware/qca.mk +++ b/package/firmware/linux-firmware/qca.mk @@ -37,3 +37,11 @@ define Package/carl9170-firmware/install $(INSTALL_DATA) $(PKG_BUILD_DIR)/carl9170-1.fw $(1)/lib/firmware endef $(eval $(call BuildPackage,carl9170-firmware)) + +Package/wil6210-firmware = $(call Package/firmware-default,wil6210 firmware) +define Package/wil6210-firmware/install + $(INSTALL_DIR) $(1)/lib/firmware + $(INSTALL_DATA) $(PKG_BUILD_DIR)/wil6210.fw $(1)/lib/firmware + $(INSTALL_DATA) $(PKG_BUILD_DIR)/wil6210.brd $(1)/lib/firmware +endef +$(eval $(call BuildPackage,wil6210-firmware)) diff --git a/package/kernel/ath10k-ct/Makefile b/package/kernel/ath10k-ct/Makefile index 03a605dac5..32b294a69f 100644 --- a/package/kernel/ath10k-ct/Makefile +++ b/package/kernel/ath10k-ct/Makefile @@ -1,21 +1,21 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ath10k-ct -PKG_RELEASE=1 +PKG_RELEASE=2 PKG_LICENSE:=GPLv2 PKG_LICENSE_FILES:= PKG_SOURCE_URL:=https://github.com/greearb/ath10k-ct.git PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2020-10-08 -PKG_SOURCE_VERSION:=1d28d176e5b6e63a6583f497adf68e1d9c1dc962 -PKG_MIRROR_HASH:=f611762647822742f7c8f9da242e33d9bf6da0a14976b87408af28f280802ae0 +PKG_SOURCE_DATE:=2021-01-11 +PKG_SOURCE_VERSION:=9fe1df7d4f783b6b0cd1c99d11979e5a6e6fc40b +PKG_MIRROR_HASH:=4e30e256716611045e930b95eadaa8bfcadd5bdd8bbe3869cfe0f377920e812b -# Build the 5.4 ath10k-ct driver version. Other option is "-4.19". +# Build the 5.10 ath10k-ct driver version. # Probably this should match as closely as # possible to whatever mac80211 backports version is being used. -CT_KVER="-5.4" +CT_KVER="-5.10" PKG_MAINTAINER:=Ben Greear PKG_BUILD_PARALLEL:=1 @@ -29,7 +29,7 @@ include $(INCLUDE_DIR)/package.mk define KernelPackage/ath10k-ct SUBMENU:=Wireless Drivers TITLE:=ath10k-ct driver optimized for CT ath10k firmware - DEPENDS:=+kmod-mac80211 +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11AC_SUPPORT +@DRIVER_11W_SUPPORT @PCI_SUPPORT +kmod-hwmon-core + DEPENDS:=+kmod-mac80211 +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11AC_SUPPORT @PCI_SUPPORT +kmod-hwmon-core FILES:=\ $(PKG_BUILD_DIR)/ath10k$(CT_KVER)/ath10k_pci.ko \ $(PKG_BUILD_DIR)/ath10k$(CT_KVER)/ath10k_core.ko diff --git a/package/kernel/ath10k-ct/patches/164-ath10k-commit-rates-from-mac80211.patch b/package/kernel/ath10k-ct/patches/164-ath10k-commit-rates-from-mac80211.patch index c13036984b..842f3ea2a5 100644 --- a/package/kernel/ath10k-ct/patches/164-ath10k-commit-rates-from-mac80211.patch +++ b/package/kernel/ath10k-ct/patches/164-ath10k-commit-rates-from-mac80211.patch @@ -9,9 +9,17 @@ mcast_rate set for a wifi-iface. Signed-off-by: Sven Eckelmann ---- a/ath10k-5.4/mac.c -+++ b/ath10k-5.4/mac.c -@@ -6797,6 +6797,7 @@ static void ath10k_bss_info_changed(stru +--- a/ath10k-5.10/mac.c ++++ b/ath10k-5.10/mac.c +@@ -6774,6 +6774,7 @@ static void ath10k_recalculate_mgmt_rate + return; + } + ++ arvif->mgt_rate[def->chan->band] = hw_rate_code; + vdev_param = ar->wmi.vdev_param->mgmt_rate; + ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, + hw_rate_code); +@@ -7000,6 +7001,7 @@ static void ath10k_bss_info_changed(stru "mac vdev %d mcast_rate %x\n", arvif->vdev_id, rate); @@ -19,7 +27,7 @@ Signed-off-by: Sven Eckelmann vdev_param = ar->wmi.vdev_param->mcast_data_rate; ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, rate); -@@ -6805,6 +6806,7 @@ static void ath10k_bss_info_changed(stru +@@ -7008,6 +7010,7 @@ static void ath10k_bss_info_changed(stru "failed to set mcast rate on vdev %i: %d\n", arvif->vdev_id, ret); @@ -27,11 +35,3 @@ Signed-off-by: Sven Eckelmann vdev_param = ar->wmi.vdev_param->bcast_data_rate; ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, rate); -@@ -6831,6 +6833,7 @@ static void ath10k_bss_info_changed(stru - return; - } - -+ arvif->mgt_rate[def.chan->band] = hw_rate_code; - vdev_param = ar->wmi.vdev_param->mgmt_rate; - ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, - hw_rate_code); diff --git a/package/kernel/ath10k-ct/patches/201-ath10k-add-LED-and-GPIO-controlling-support-for-various-chipsets.patch b/package/kernel/ath10k-ct/patches/201-ath10k-add-LED-and-GPIO-controlling-support-for-various-chipsets.patch index c6d42679dd..749e796148 100644 --- a/package/kernel/ath10k-ct/patches/201-ath10k-add-LED-and-GPIO-controlling-support-for-various-chipsets.patch +++ b/package/kernel/ath10k-ct/patches/201-ath10k-add-LED-and-GPIO-controlling-support-for-various-chipsets.patch @@ -66,25 +66,25 @@ v13: * cleanup includes - ath10k-5.4/Kconfig | 10 +++ - ath10k-5.4/Makefile | 1 + - ath10k-5.4/core.c | 22 +++++++ - ath10k-5.4/core.h | 9 ++- - ath10k-5.4/hw.h | 1 + - ath10k-5.4/leds.c | 103 ++++++++++++++++++++++++++++++ - ath10k-5.4/leds.h | 45 +++++++++++++ - ath10k-5.4/mac.c | 1 + - ath10k-5.4/wmi-ops.h | 32 ++++++++++ - ath10k-5.4/wmi-tlv.c | 2 + - ath10k-5.4/wmi.c | 54 ++++++++++++++++ - ath10k-5.4/wmi.h | 35 ++++++++++ + ath10k-5.10/Kconfig | 10 +++ + ath10k-5.10/Makefile | 1 + + ath10k-5.10/core.c | 22 +++++++ + ath10k-5.10/core.h | 9 ++- + ath10k-5.10/hw.h | 1 + + ath10k-5.10/leds.c | 103 ++++++++++++++++++++++++++++++ + ath10k-5.10/leds.h | 45 +++++++++++++ + ath10k-5.10/mac.c | 1 + + ath10k-5.10/wmi-ops.h | 32 ++++++++++ + ath10k-5.10/wmi-tlv.c | 2 + + ath10k-5.10/wmi.c | 54 ++++++++++++++++ + ath10k-5.10/wmi.h | 35 ++++++++++ 12 files changed, 314 insertions(+), 1 deletion(-) - create mode 100644 ath10k-5.4/leds.c - create mode 100644 ath10k-5.4/leds.h + create mode 100644 ath10k-5.10/leds.c + create mode 100644 ath10k-5.10/leds.h ---- a/ath10k-5.4/Kconfig -+++ b/ath10k-5.4/Kconfig -@@ -66,6 +66,16 @@ config ATH10K_DEBUGFS +--- a/ath10k-5.10/Kconfig ++++ b/ath10k-5.10/Kconfig +@@ -65,6 +65,16 @@ config ATH10K_DEBUGFS If unsure, say Y to make it easier to debug problems. @@ -101,19 +101,19 @@ v13: config ATH10K_SPECTRAL bool "Atheros ath10k spectral scan support" depends on ATH10K_DEBUGFS ---- a/ath10k-5.4/Makefile -+++ b/ath10k-5.4/Makefile -@@ -19,6 +19,7 @@ ath10k_core-$(CONFIG_ATH10K_SPECTRAL) += +--- a/ath10k-5.10/Makefile ++++ b/ath10k-5.10/Makefile +@@ -20,6 +20,7 @@ ath10k_core-$(CONFIG_ATH10K_SPECTRAL) += ath10k_core-$(CONFIG_NL80211_TESTMODE) += testmode.o ath10k_core-$(CONFIG_ATH10K_TRACING) += trace.o ath10k_core-$(CONFIG_THERMAL) += thermal.o +ath10k_core-$(CONFIG_ATH10K_LEDS) += leds.o ath10k_core-$(CONFIG_MAC80211_DEBUGFS) += debugfs_sta.o ath10k_core-$(CONFIG_PM) += wow.o - ath10k_core-$(CONFIG_DEV_COREDUMP) += coredump.o ---- a/ath10k-5.4/core.c -+++ b/ath10k-5.4/core.c -@@ -25,6 +25,7 @@ + ath10k_core-$(CONFIG_ATH10K_CE) += ce.o +--- a/ath10k-5.10/core.c ++++ b/ath10k-5.10/core.c +@@ -26,6 +26,7 @@ #include "testmode.h" #include "wmi-ops.h" #include "coredump.h" @@ -121,7 +121,7 @@ v13: /* Disable ath10k-ct DBGLOG output by default */ unsigned int ath10k_debug_mask = ATH10K_DBG_NO_DBGLOG; -@@ -67,6 +68,7 @@ static const struct ath10k_hw_params ath +@@ -68,6 +69,7 @@ static const struct ath10k_hw_params ath .dev_id = QCA988X_2_0_DEVICE_ID, .bus = ATH10K_BUS_PCI, .name = "qca988x hw2.0", @@ -137,7 +137,7 @@ v13: .patch_load_addr = QCA9887_HW_1_0_PATCH_LOAD_ADDR, .uart_pin = 7, .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_ALL, -@@ -344,6 +347,7 @@ static const struct ath10k_hw_params ath +@@ -342,6 +345,7 @@ static const struct ath10k_hw_params ath .dev_id = QCA99X0_2_0_DEVICE_ID, .bus = ATH10K_BUS_PCI, .name = "qca99x0 hw2.0", @@ -145,7 +145,7 @@ v13: .patch_load_addr = QCA99X0_HW_2_0_PATCH_LOAD_ADDR, .uart_pin = 7, .otp_exe_param = 0x00000700, -@@ -385,6 +389,7 @@ static const struct ath10k_hw_params ath +@@ -382,6 +386,7 @@ static const struct ath10k_hw_params ath .dev_id = QCA9984_1_0_DEVICE_ID, .bus = ATH10K_BUS_PCI, .name = "qca9984/qca9994 hw1.0", @@ -153,7 +153,7 @@ v13: .patch_load_addr = QCA9984_HW_1_0_PATCH_LOAD_ADDR, .uart_pin = 7, .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_EACH, -@@ -433,6 +438,7 @@ static const struct ath10k_hw_params ath +@@ -429,6 +434,7 @@ static const struct ath10k_hw_params ath .dev_id = QCA9888_2_0_DEVICE_ID, .bus = ATH10K_BUS_PCI, .name = "qca9888 hw2.0", @@ -161,7 +161,7 @@ v13: .patch_load_addr = QCA9888_HW_2_0_PATCH_LOAD_ADDR, .uart_pin = 7, .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_EACH, -@@ -3579,6 +3585,10 @@ int ath10k_core_start(struct ath10k *ar, +@@ -3705,6 +3711,10 @@ int ath10k_core_start(struct ath10k *ar, ath10k_wmi_check_apply_board_power_ctl_table(ar); } @@ -172,7 +172,7 @@ v13: return 0; err_hif_stop: -@@ -3835,9 +3845,18 @@ static void ath10k_core_register_work(st +@@ -3963,9 +3973,18 @@ static void ath10k_core_register_work(st goto err_spectral_destroy; } @@ -191,7 +191,7 @@ v13: err_spectral_destroy: ath10k_spectral_destroy(ar); err_debug_destroy: -@@ -3897,6 +3916,8 @@ void ath10k_core_unregister(struct ath10 +@@ -4025,6 +4044,8 @@ void ath10k_core_unregister(struct ath10 if (!test_bit(ATH10K_FLAG_CORE_REGISTERED, &ar->dev_flags)) return; @@ -200,8 +200,8 @@ v13: ath10k_thermal_unregister(ar); /* Stop spectral before unregistering from mac80211 to remove the * relayfs debugfs file cleanly. Otherwise the parent debugfs tree ---- a/ath10k-5.4/core.h -+++ b/ath10k-5.4/core.h +--- a/ath10k-5.10/core.h ++++ b/ath10k-5.10/core.h @@ -14,6 +14,7 @@ #include #include @@ -210,7 +210,7 @@ v13: #include "htt.h" #include "htc.h" -@@ -1476,6 +1477,13 @@ struct ath10k { +@@ -1551,6 +1552,13 @@ struct ath10k { } testmode; struct { @@ -222,11 +222,11 @@ v13: + + struct { /* protected by data_lock */ + u32 rx_crc_err_drop; u32 fw_crash_counter; - u32 fw_warm_reset_counter; ---- a/ath10k-5.4/hw.h -+++ b/ath10k-5.4/hw.h -@@ -518,6 +518,7 @@ struct ath10k_hw_params { +--- a/ath10k-5.10/hw.h ++++ b/ath10k-5.10/hw.h +@@ -521,6 +521,7 @@ struct ath10k_hw_params { const char *name; u32 patch_load_addr; int uart_pin; @@ -235,7 +235,7 @@ v13: /* Type of hw cycle counter wraparound logic, for more info --- /dev/null -+++ b/ath10k-5.4/leds.c ++++ b/ath10k-5.10/leds.c @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2005-2011 Atheros Communications Inc. @@ -341,7 +341,7 @@ v13: +} + --- /dev/null -+++ b/ath10k-5.4/leds.h ++++ b/ath10k-5.10/leds.h @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2018, The Linux Foundation. All rights reserved. @@ -384,9 +384,9 @@ v13: + +#endif +#endif /* _LEDS_H_ */ ---- a/ath10k-5.4/mac.c -+++ b/ath10k-5.4/mac.c -@@ -24,6 +24,7 @@ +--- a/ath10k-5.10/mac.c ++++ b/ath10k-5.10/mac.c +@@ -25,6 +25,7 @@ #include "wmi-tlv.h" #include "wmi-ops.h" #include "wow.h" @@ -394,12 +394,12 @@ v13: /*********/ /* Rates */ ---- a/ath10k-5.4/wmi-ops.h -+++ b/ath10k-5.4/wmi-ops.h -@@ -219,7 +219,10 @@ struct wmi_ops { - struct sk_buff *(*gen_bb_timing) - (struct ath10k *ar, +--- a/ath10k-5.10/wmi-ops.h ++++ b/ath10k-5.10/wmi-ops.h +@@ -228,7 +228,10 @@ struct wmi_ops { const struct wmi_bb_timing_cfg_arg *arg); + struct sk_buff *(*gen_per_peer_per_tid_cfg)(struct ath10k *ar, + const struct wmi_per_peer_per_tid_cfg_arg *arg); + struct sk_buff *(*gen_gpio_config)(struct ath10k *ar, u32 gpio_num, + u32 input, u32 pull_type, u32 intr_mode); @@ -407,7 +407,7 @@ v13: }; int ath10k_wmi_cmd_send(struct ath10k *ar, struct sk_buff *skb, u32 cmd_id); -@@ -1115,6 +1118,35 @@ ath10k_wmi_force_fw_hang(struct ath10k * +@@ -1147,6 +1150,35 @@ ath10k_wmi_force_fw_hang(struct ath10k * return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->force_fw_hang_cmdid); } @@ -443,9 +443,9 @@ v13: static inline int ath10k_wmi_dbglog_cfg(struct ath10k *ar, u64 module_enable, u32 log_level) { ---- a/ath10k-5.4/wmi-tlv.c -+++ b/ath10k-5.4/wmi-tlv.c -@@ -4382,6 +4382,8 @@ static const struct wmi_ops wmi_tlv_ops +--- a/ath10k-5.10/wmi-tlv.c ++++ b/ath10k-5.10/wmi-tlv.c +@@ -4585,6 +4585,8 @@ static const struct wmi_ops wmi_tlv_ops .gen_echo = ath10k_wmi_tlv_op_gen_echo, .gen_vdev_spectral_conf = ath10k_wmi_tlv_op_gen_vdev_spectral_conf, .gen_vdev_spectral_enable = ath10k_wmi_tlv_op_gen_vdev_spectral_enable, @@ -454,9 +454,9 @@ v13: }; static const struct wmi_peer_flags_map wmi_tlv_peer_flags_map = { ---- a/ath10k-5.4/wmi.c -+++ b/ath10k-5.4/wmi.c -@@ -8313,6 +8313,49 @@ ath10k_wmi_op_gen_peer_set_param(struct +--- a/ath10k-5.10/wmi.c ++++ b/ath10k-5.10/wmi.c +@@ -8409,6 +8409,49 @@ ath10k_wmi_op_gen_peer_set_param(struct return skb; } @@ -506,7 +506,7 @@ v13: static struct sk_buff * ath10k_wmi_op_gen_set_psmode(struct ath10k *ar, u32 vdev_id, enum wmi_sta_ps_mode psmode) -@@ -10112,6 +10155,9 @@ static const struct wmi_ops wmi_ops = { +@@ -10238,6 +10281,9 @@ static const struct wmi_ops wmi_ops = { .fw_stats_fill = ath10k_wmi_main_op_fw_stats_fill, .get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype, .gen_echo = ath10k_wmi_op_gen_echo, @@ -516,7 +516,7 @@ v13: /* .gen_bcn_tmpl not implemented */ /* .gen_prb_tmpl not implemented */ /* .gen_p2p_go_bcn_ie not implemented */ -@@ -10182,6 +10228,8 @@ static const struct wmi_ops wmi_10_1_ops +@@ -10308,6 +10354,8 @@ static const struct wmi_ops wmi_10_1_ops .fw_stats_fill = ath10k_wmi_10x_op_fw_stats_fill, .get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype, .gen_echo = ath10k_wmi_op_gen_echo, @@ -525,7 +525,7 @@ v13: /* .gen_bcn_tmpl not implemented */ /* .gen_prb_tmpl not implemented */ /* .gen_p2p_go_bcn_ie not implemented */ -@@ -10261,6 +10309,8 @@ static const struct wmi_ops wmi_10_2_ops +@@ -10387,6 +10435,8 @@ static const struct wmi_ops wmi_10_2_ops .gen_delba_send = ath10k_wmi_op_gen_delba_send, .fw_stats_fill = ath10k_wmi_10x_op_fw_stats_fill, .get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype, @@ -534,7 +534,7 @@ v13: /* .gen_pdev_enable_adaptive_cca not implemented */ }; -@@ -10332,6 +10382,8 @@ static const struct wmi_ops wmi_10_2_4_o +@@ -10458,6 +10508,8 @@ static const struct wmi_ops wmi_10_2_4_o ath10k_wmi_op_gen_pdev_enable_adaptive_cca, .get_vdev_subtype = ath10k_wmi_10_2_4_op_get_vdev_subtype, .gen_bb_timing = ath10k_wmi_10_2_4_op_gen_bb_timing, @@ -543,7 +543,7 @@ v13: /* .gen_bcn_tmpl not implemented */ /* .gen_prb_tmpl not implemented */ /* .gen_p2p_go_bcn_ie not implemented */ -@@ -10413,6 +10465,8 @@ static const struct wmi_ops wmi_10_4_ops +@@ -10540,6 +10592,8 @@ static const struct wmi_ops wmi_10_4_ops .gen_pdev_bss_chan_info_req = ath10k_wmi_10_2_op_gen_pdev_bss_chan_info, .gen_echo = ath10k_wmi_op_gen_echo, .gen_pdev_get_tpc_config = ath10k_wmi_10_2_4_op_gen_pdev_get_tpc_config, @@ -552,9 +552,9 @@ v13: }; int ath10k_wmi_attach(struct ath10k *ar) ---- a/ath10k-5.4/wmi.h -+++ b/ath10k-5.4/wmi.h -@@ -3110,6 +3110,41 @@ enum wmi_10_4_feature_mask { +--- a/ath10k-5.10/wmi.h ++++ b/ath10k-5.10/wmi.h +@@ -3133,6 +3133,41 @@ enum wmi_10_4_feature_mask { }; diff --git a/package/kernel/ath10k-ct/patches/202-ath10k-use-tpt-trigger-by-default.patch b/package/kernel/ath10k-ct/patches/202-ath10k-use-tpt-trigger-by-default.patch index 25a6c12d51..eae779ef58 100644 --- a/package/kernel/ath10k-ct/patches/202-ath10k-use-tpt-trigger-by-default.patch +++ b/package/kernel/ath10k-ct/patches/202-ath10k-use-tpt-trigger-by-default.patch @@ -9,14 +9,14 @@ traffic. Signed-off-by: Mathias Kresin --- - ath10k-5.4/core.h | 4 ++++ - ath10k-5.4/leds.c | 4 +--- - ath10k-5.4/mac.c | 2 +- + ath10k-5.10/core.h | 4 ++++ + ath10k-5.10/leds.c | 4 +--- + ath10k-5.10/mac.c | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) ---- a/ath10k-5.4/core.h -+++ b/ath10k-5.4/core.h -@@ -1580,6 +1580,10 @@ struct ath10k { +--- a/ath10k-5.10/core.h ++++ b/ath10k-5.10/core.h +@@ -1659,6 +1659,10 @@ struct ath10k { u8 csi_data[4096]; u16 csi_data_len; @@ -25,10 +25,10 @@ Signed-off-by: Mathias Kresin +#endif + /* must be last */ - u8 drv_priv[0] __aligned(sizeof(void *)); + u8 drv_priv[] __aligned(sizeof(void *)); }; ---- a/ath10k-5.4/leds.c -+++ b/ath10k-5.4/leds.c +--- a/ath10k-5.10/leds.c ++++ b/ath10k-5.10/leds.c @@ -81,9 +81,7 @@ int ath10k_leds_register(struct ath10k * ar->leds.cdev.name = ar->leds.label; @@ -40,9 +40,9 @@ Signed-off-by: Mathias Kresin ret = led_classdev_register(wiphy_dev(ar->hw->wiphy), &ar->leds.cdev); if (ret) ---- a/ath10k-5.4/mac.c -+++ b/ath10k-5.4/mac.c -@@ -10387,7 +10387,7 @@ int ath10k_mac_register(struct ath10k *a +--- a/ath10k-5.10/mac.c ++++ b/ath10k-5.10/mac.c +@@ -11400,7 +11400,7 @@ int ath10k_mac_register(struct ath10k *a ar->hw->weight_multiplier = ATH10K_AIRTIME_WEIGHT_MULTIPLIER; #ifdef CPTCFG_MAC80211_LEDS diff --git a/package/kernel/ath10k-ct/patches/205-ath10k-Add-NL80211_EXT_FEATURE_AQL-flag.patch b/package/kernel/ath10k-ct/patches/205-ath10k-Add-NL80211_EXT_FEATURE_AQL-flag.patch deleted file mode 100644 index 4a49909133..0000000000 --- a/package/kernel/ath10k-ct/patches/205-ath10k-Add-NL80211_EXT_FEATURE_AQL-flag.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/ath10k-5.4/mac.c -+++ b/ath10k-5.4/mac.c -@@ -10186,6 +10186,7 @@ int ath10k_mac_register(struct ath10k *a - wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_VHT_IBSS); - wiphy_ext_feature_set(ar->hw->wiphy, - NL80211_EXT_FEATURE_SET_SCAN_DWELL); -+ wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_AQL); - - if (test_bit(WMI_SERVICE_TX_DATA_ACK_RSSI, ar->wmi.svc_map) || - test_bit(WMI_SERVICE_HTT_MGMT_TX_COMP_VALID_FLAGS, ar->wmi.svc_map)) diff --git a/package/kernel/ath10k-ct/patches/960-0010-ath10k-limit-htt-rx-ring-size.patch b/package/kernel/ath10k-ct/patches/960-0010-ath10k-limit-htt-rx-ring-size.patch index c527430898..af9c3d455b 100644 --- a/package/kernel/ath10k-ct/patches/960-0010-ath10k-limit-htt-rx-ring-size.patch +++ b/package/kernel/ath10k-ct/patches/960-0010-ath10k-limit-htt-rx-ring-size.patch @@ -1,6 +1,6 @@ ---- a/ath10k-5.4/htt.h -+++ b/ath10k-5.4/htt.h -@@ -225,7 +225,11 @@ enum htt_rx_ring_flags { +--- a/ath10k-5.10/htt.h ++++ b/ath10k-5.10/htt.h +@@ -237,7 +237,11 @@ enum htt_rx_ring_flags { }; #define HTT_RX_RING_SIZE_MIN 128 diff --git a/package/kernel/ath10k-ct/patches/960-0011-ath10k-limit-pci-buffer-size.patch b/package/kernel/ath10k-ct/patches/960-0011-ath10k-limit-pci-buffer-size.patch index f559a78f29..1fc2566f9c 100644 --- a/package/kernel/ath10k-ct/patches/960-0011-ath10k-limit-pci-buffer-size.patch +++ b/package/kernel/ath10k-ct/patches/960-0011-ath10k-limit-pci-buffer-size.patch @@ -1,6 +1,6 @@ ---- a/ath10k-5.4/pci.c -+++ b/ath10k-5.4/pci.c -@@ -131,7 +131,11 @@ static struct ce_attr host_ce_config_wla +--- a/ath10k-5.10/pci.c ++++ b/ath10k-5.10/pci.c +@@ -131,7 +131,11 @@ static const struct ce_attr pci_host_ce_ .flags = CE_ATTR_FLAGS, .src_nentries = 0, .src_sz_max = 2048, @@ -12,7 +12,7 @@ .recv_cb = ath10k_pci_htt_htc_rx_cb, }, -@@ -140,7 +144,11 @@ static struct ce_attr host_ce_config_wla +@@ -140,7 +144,11 @@ static const struct ce_attr pci_host_ce_ .flags = CE_ATTR_FLAGS, .src_nentries = 0, .src_sz_max = 2048, @@ -24,7 +24,7 @@ .recv_cb = ath10k_pci_htc_rx_cb, }, -@@ -167,7 +175,11 @@ static struct ce_attr host_ce_config_wla +@@ -167,7 +175,11 @@ static const struct ce_attr pci_host_ce_ .flags = CE_ATTR_FLAGS, .src_nentries = 0, .src_sz_max = 512, @@ -36,7 +36,7 @@ .recv_cb = ath10k_pci_htt_rx_cb, }, -@@ -192,7 +204,11 @@ static struct ce_attr host_ce_config_wla +@@ -192,7 +204,11 @@ static const struct ce_attr pci_host_ce_ .flags = CE_ATTR_FLAGS, .src_nentries = 0, .src_sz_max = 2048, diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile index 3d431b30b2..810ee4c3d4 100644 --- a/package/kernel/mt76/Makefile +++ b/package/kernel/mt76/Makefile @@ -1,16 +1,16 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mt76 -PKG_RELEASE=1 +PKG_RELEASE=4 PKG_LICENSE:=GPLv2 PKG_LICENSE_FILES:= PKG_SOURCE_URL:=https://github.com/openwrt/mt76 PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2020-03-10 -PKG_SOURCE_VERSION:=08054d5ab1350fcb8563feb90e6ab7f8f4a0a1b7 -PKG_MIRROR_HASH:=b41a3cab1485c68befb1dcb4c1e426d41705db1b2a57851dafd6e8f75eeea3d7 +PKG_SOURCE_DATE:=2021-02-14 +PKG_SOURCE_VERSION:=289cd7804587dc48f776d450db9cd3762692a370 +PKG_MIRROR_HASH:=91885feca9d935586c6e33a8e3734bfa61991d869bf42ac0d1c8c3b19bfa9653 PKG_MAINTAINER:=Felix Fietkau PKG_BUILD_PARALLEL:=1 @@ -23,18 +23,23 @@ PKG_CONFIG_DEPENDS += \ CONFIG_PACKAGE_kmod-mt76x2-common \ CONFIG_PACKAGE_kmod-mt76x2 \ CONFIG_PACKAGE_kmod-mt76x2u \ - CONFIG_PACKAGE_kmod-mt7603 + CONFIG_PACKAGE_kmod-mt7603 \ + CONFIG_PACKAGE_CFG80211_TESTMODE STAMP_CONFIGURED_DEPENDS := $(STAGING_DIR)/usr/include/mac80211-backport/backport/autoconf.h include $(INCLUDE_DIR)/kernel.mk include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/cmake.mk + +CMAKE_SOURCE_DIR:=$(PKG_BUILD_DIR)/tools +CMAKE_BINARY_DIR:=$(PKG_BUILD_DIR)/tools define KernelPackage/mt76-default SUBMENU:=Wireless Drivers DEPENDS:= \ +kmod-mac80211 \ - +@DRIVER_11AC_SUPPORT +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT + +@DRIVER_11AC_SUPPORT +@DRIVER_11N_SUPPORT endef define KernelPackage/mt76 @@ -138,15 +143,98 @@ define KernelPackage/mt7603 AUTOLOAD:=$(call AutoProbe,mt7603e) endef +define KernelPackage/mt76-connac + $(KernelPackage/mt76-default) + TITLE:=MediaTek MT7615/MT79xx wireless driver common code + HIDDEN:=1 + DEPENDS+=+kmod-mt76-core + FILES:= $(PKG_BUILD_DIR)/mt76-connac-lib.ko +endef + +define KernelPackage/mt7615-common + $(KernelPackage/mt76-default) + TITLE:=MediaTek MT7615 wireless driver common code + HIDDEN:=1 + DEPENDS+=@PCI_SUPPORT +kmod-mt76-core +kmod-mt76-connac + FILES:= $(PKG_BUILD_DIR)/mt7615/mt7615-common.ko +endef + +define KernelPackage/mt7615-firmware + $(KernelPackage/mt76-default) + TITLE:=MediaTek MT7615e firmware + DEFAULT:=PACKAGE_kmod-mt7615e +endef + define KernelPackage/mt7615e $(KernelPackage/mt76-default) - TITLE:=MediaTek MT7615 wireless driver - DEPENDS+=@PCI_SUPPORT +kmod-mt76-core - FILES:=\ - $(PKG_BUILD_DIR)/mt7615/mt7615e.ko + TITLE:=MediaTek MT7615e wireless driver + DEPENDS+=@PCI_SUPPORT +kmod-mt7615-common + FILES:= $(PKG_BUILD_DIR)/mt7615/mt7615e.ko AUTOLOAD:=$(call AutoProbe,mt7615e) endef +define KernelPackage/mt7663-firmware-ap + $(KernelPackage/mt76-default) + TITLE:=MediaTek MT7663e firmware (optimized for AP) +endef + +define KernelPackage/mt7663-firmware-sta + $(KernelPackage/mt76-default) + TITLE:=MediaTek MT7663e firmware (client mode offload) +endef + +define KernelPackage/mt7663-usb-sdio + $(KernelPackage/mt76-default) + TITLE:=MediaTek MT7663 USB/SDIO shared code + DEPENDS+=+kmod-mt7615-common + HIDDEN:=1 + FILES:= \ + $(PKG_BUILD_DIR)/mt7615/mt7663-usb-sdio-common.ko +endef + +define KernelPackage/mt7663s + $(KernelPackage/mt76-default) + TITLE:=MediaTek MT7663s wireless driver + DEPENDS+=+kmod-mmc +kmod-mt7615-common +kmod-mt7663-usb-sdio + FILES:= \ + $(PKG_BUILD_DIR)/mt76-sdio.ko \ + $(PKG_BUILD_DIR)/mt7615/mt7663s.ko + AUTOLOAD:=$(call AutoProbe,mt7663s) +endef + +define KernelPackage/mt7663u + $(KernelPackage/mt76-default) + TITLE:=MediaTek MT7663u wireless driver + DEPENDS+=+kmod-mt76-usb +kmod-mt7615-common +kmod-mt7663-usb-sdio + FILES:= $(PKG_BUILD_DIR)/mt7615/mt7663u.ko + AUTOLOAD:=$(call AutoProbe,mt7663u) +endef + +define KernelPackage/mt7915e + $(KernelPackage/mt76-default) + TITLE:=MediaTek MT7915e wireless driver + DEPENDS+=@PCI_SUPPORT +kmod-mt7615-common +@DRIVER_11AX_SUPPORT + FILES:= $(PKG_BUILD_DIR)/mt7915/mt7915e.ko + AUTOLOAD:=$(call AutoProbe,mt7915e) +endef + +define KernelPackage/mt7921e + $(KernelPackage/mt76-default) + TITLE:=MediaTek MT7921e wireless driver + DEPENDS+=@PCI_SUPPORT +kmod-mt76-connac + FILES:= $(PKG_BUILD_DIR)/mt7921/mt7921e.ko + AUTOLOAD:=$(call AutoProbe,mt7921e) +endef + +define Package/mt76-test + SECTION:=devel + CATEGORY:=Development + TITLE:=mt76 testmode CLI + DEPENDS:=kmod-mt76-core +libnl-tiny +endef + +TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include/libnl-tiny + NOSTDINC_FLAGS = \ -I$(PKG_BUILD_DIR) \ -I$(STAGING_DIR)/usr/include/mac80211-backport/uapi \ @@ -160,6 +248,11 @@ ifdef CONFIG_PACKAGE_MAC80211_MESH NOSTDINC_FLAGS += -DCONFIG_MAC80211_MESH endif +ifdef CONFIG_PACKAGE_CFG80211_TESTMODE + NOSTDINC_FLAGS += -DCONFIG_NL80211_TESTMODE + PKG_MAKE_FLAGS += CONFIG_NL80211_TESTMODE=y +endif + ifdef CONFIG_PACKAGE_kmod-mt76-usb PKG_MAKE_FLAGS += CONFIG_MT76_USB=m endif @@ -190,8 +283,34 @@ endif ifdef CONFIG_PACKAGE_kmod-mt7603 PKG_MAKE_FLAGS += CONFIG_MT7603E=m endif +ifdef CONFIG_PACKAGE_kmod-mt76-connac + PKG_MAKE_FLAGS += CONFIG_MT76_CONNAC_LIB=m +endif +ifdef CONFIG_PACKAGE_kmod-mt7615-common + PKG_MAKE_FLAGS += CONFIG_MT7615_COMMON=m +endif ifdef CONFIG_PACKAGE_kmod-mt7615e PKG_MAKE_FLAGS += CONFIG_MT7615E=m + ifdef CONFIG_TARGET_mediatek_mt7622 + PKG_MAKE_FLAGS += CONFIG_MT7622_WMAC=y + NOSTDINC_FLAGS += -DCONFIG_MT7622_WMAC + endif +endif +ifdef CONFIG_PACKAGE_kmod-mt7663-usb-sdio + PKG_MAKE_FLAGS += CONFIG_MT7663_USB_SDIO_COMMON=m +endif +ifdef CONFIG_PACKAGE_kmod-mt7663s + PKG_MAKE_FLAGS += CONFIG_MT76_SDIO=m + PKG_MAKE_FLAGS += CONFIG_MT7663S=m +endif +ifdef CONFIG_PACKAGE_kmod-mt7663u + PKG_MAKE_FLAGS += CONFIG_MT7663U=m +endif +ifdef CONFIG_PACKAGE_kmod-mt7915e + PKG_MAKE_FLAGS += CONFIG_MT7915E=m +endif +ifdef CONFIG_PACKAGE_kmod-mt7921e + PKG_MAKE_FLAGS += CONFIG_MT7921E=m endif define Build/Compile @@ -201,6 +320,11 @@ define Build/Compile M="$(PKG_BUILD_DIR)" \ NOSTDINC_FLAGS="$(NOSTDINC_FLAGS)" \ modules + $(MAKE) -C $(PKG_BUILD_DIR)/tools +endef + +define Build/Install + : endef define Package/kmod-mt76/install @@ -245,15 +369,48 @@ define KernelPackage/mt7603/install $(1)/lib/firmware endef -define KernelPackage/mt7615e/install +define KernelPackage/mt7615-firmware/install $(INSTALL_DIR) $(1)/lib/firmware/mediatek cp \ $(PKG_BUILD_DIR)/firmware/mt7615_cr4.bin \ $(PKG_BUILD_DIR)/firmware/mt7615_n9.bin \ $(PKG_BUILD_DIR)/firmware/mt7615_rom_patch.bin \ + $(if $(CONFIG_TARGET_mediatek_mt7622), \ + $(PKG_BUILD_DIR)/firmware/mt7622_n9.bin \ + $(PKG_BUILD_DIR)/firmware/mt7622_rom_patch.bin) \ $(1)/lib/firmware/mediatek endef +define KernelPackage/mt7663-firmware-ap/install + $(INSTALL_DIR) $(1)/lib/firmware/mediatek + cp \ + $(PKG_BUILD_DIR)/firmware/mt7663_n9_rebb.bin \ + $(PKG_BUILD_DIR)/firmware/mt7663pr2h_rebb.bin \ + $(1)/lib/firmware/mediatek +endef + +define KernelPackage/mt7663-firmware-sta/install + $(INSTALL_DIR) $(1)/lib/firmware/mediatek + cp \ + $(PKG_BUILD_DIR)/firmware/mt7663_n9_v3.bin \ + $(PKG_BUILD_DIR)/firmware/mt7663pr2h.bin \ + $(1)/lib/firmware/mediatek +endef + +define KernelPackage/mt7915e/install + $(INSTALL_DIR) $(1)/lib/firmware/mediatek + cp \ + $(PKG_BUILD_DIR)/firmware/mt7915_wa.bin \ + $(PKG_BUILD_DIR)/firmware/mt7915_wm.bin \ + $(PKG_BUILD_DIR)/firmware/mt7915_rom_patch.bin \ + $(1)/lib/firmware/mediatek +endef + +define Package/mt76-test/install + mkdir -p $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/mt76-test $(1)/usr/sbin +endef + $(eval $(call KernelPackage,mt76-core)) $(eval $(call KernelPackage,mt76-usb)) $(eval $(call KernelPackage,mt76x02-usb)) @@ -265,5 +422,16 @@ $(eval $(call KernelPackage,mt76x2-common)) $(eval $(call KernelPackage,mt76x2u)) $(eval $(call KernelPackage,mt76x2)) $(eval $(call KernelPackage,mt7603)) +$(eval $(call KernelPackage,mt76-connac)) +$(eval $(call KernelPackage,mt7615-common)) +$(eval $(call KernelPackage,mt7615-firmware)) $(eval $(call KernelPackage,mt7615e)) +$(eval $(call KernelPackage,mt7663-firmware-ap)) +$(eval $(call KernelPackage,mt7663-firmware-sta)) +$(eval $(call KernelPackage,mt7663-usb-sdio)) +$(eval $(call KernelPackage,mt7663u)) +$(eval $(call KernelPackage,mt7663s)) +$(eval $(call KernelPackage,mt7915e)) +$(eval $(call KernelPackage,mt7921e)) $(eval $(call KernelPackage,mt76)) +$(eval $(call BuildPackage,mt76-test)) diff --git a/package/kernel/mt76/patches/001-allow-vht-on-2g.patch b/package/kernel/mt76/patches/001-allow-vht-on-2g.patch index 53cd01b8b7..99767a0268 100644 --- a/package/kernel/mt76/patches/001-allow-vht-on-2g.patch +++ b/package/kernel/mt76/patches/001-allow-vht-on-2g.patch @@ -1,37 +1,45 @@ --- a/mac80211.c +++ b/mac80211.c -@@ -156,7 +156,7 @@ static void mt76_init_stream_cap(struct mt76_dev *dev, - void mt76_set_stream_caps(struct mt76_dev *dev, bool vht) +@@ -160,7 +160,7 @@ static void mt76_init_stream_cap(struct + void mt76_set_stream_caps(struct mt76_phy *phy, bool vht) { - if (dev->cap.has_2ghz) -- mt76_init_stream_cap(dev, &dev->sband_2g.sband, false); -+ mt76_init_stream_cap(dev, &dev->sband_2g.sband, vht); - if (dev->cap.has_5ghz) - mt76_init_stream_cap(dev, &dev->sband_5g.sband, vht); + if (phy->cap.has_2ghz) +- mt76_init_stream_cap(phy, &phy->sband_2g.sband, false); ++ mt76_init_stream_cap(phy, &phy->sband_2g.sband, vht); + if (phy->cap.has_5ghz) + mt76_init_stream_cap(phy, &phy->sband_5g.sband, vht); } -@@ -221,14 +221,14 @@ mt76_init_sband(struct mt76_dev *dev, struct mt76_sband *msband, +@@ -223,13 +223,13 @@ mt76_init_sband(struct mt76_phy *phy, st static int - mt76_init_sband_2g(struct mt76_dev *dev, struct ieee80211_rate *rates, + mt76_init_sband_2g(struct mt76_phy *phy, struct ieee80211_rate *rates, - int n_rates) + int n_rates, bool vht) { - dev->hw->wiphy->bands[NL80211_BAND_2GHZ] = &dev->sband_2g.sband; + phy->hw->wiphy->bands[NL80211_BAND_2GHZ] = &phy->sband_2g.sband; - return mt76_init_sband(dev, &dev->sband_2g, - mt76_channels_2ghz, - ARRAY_SIZE(mt76_channels_2ghz), -- rates, n_rates, false); -+ rates, n_rates, vht); + return mt76_init_sband(phy, &phy->sband_2g, mt76_channels_2ghz, + ARRAY_SIZE(mt76_channels_2ghz), rates, +- n_rates, false); ++ n_rates, vht); } static int -@@ -349,7 +349,7 @@ int mt76_register_device(struct mt76_dev *dev, bool vht, - BIT(NL80211_IFTYPE_ADHOC); +@@ -358,7 +358,7 @@ int mt76_register_phy(struct mt76_phy *p + mt76_phy_init(phy, phy->hw); - if (dev->cap.has_2ghz) { -- ret = mt76_init_sband_2g(dev, rates, n_rates); -+ ret = mt76_init_sband_2g(dev, rates, n_rates, vht); + if (phy->cap.has_2ghz) { +- ret = mt76_init_sband_2g(phy, rates, n_rates); ++ ret = mt76_init_sband_2g(phy, rates, n_rates, vht); + if (ret) + return ret; + } +@@ -454,7 +454,7 @@ int mt76_register_device(struct mt76_dev + mt76_phy_init(phy, hw); + + if (phy->cap.has_2ghz) { +- ret = mt76_init_sband_2g(phy, rates, n_rates); ++ ret = mt76_init_sband_2g(phy, rates, n_rates, vht); if (ret) return ret; } diff --git a/package/network/config/netifd/Makefile b/package/network/config/netifd/Makefile index 32aa350a21..7061456b08 100644 --- a/package/network/config/netifd/Makefile +++ b/package/network/config/netifd/Makefile @@ -5,9 +5,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/netifd.git -PKG_SOURCE_DATE:=2020-11-30 -PKG_SOURCE_VERSION:=42c48866f1c1fce068f41536baa8dd2e80fc08d7 -PKG_MIRROR_HASH:=7eeec56364f1e6de8f0917f16ae933ca9bd0298e6a68e330025282164ea9af63 +PKG_SOURCE_DATE:=2021-01-09 +PKG_SOURCE_VERSION:=c00c8335d6188daa326ecfe5a62da15a9b9987e1 +PKG_MIRROR_HASH:=c740e51e0cec13eec336ba1c7a643db3b64a9a2235f8c1b73a566cb89e841190 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=GPL-2.0 diff --git a/package/network/services/hostapd/Config.in b/package/network/services/hostapd/Config.in index db73295a9f..5c00f3e24e 100644 --- a/package/network/services/hostapd/Config.in +++ b/package/network/services/hostapd/Config.in @@ -13,6 +13,7 @@ config WPA_RFKILL_SUPPORT PACKAGE_wpad-openssl || \ PACKAGE_wpad-wolfssl || \ PACKAGE_wpad-basic || \ + PACKAGE_wpad-basic-openssl || \ PACKAGE_wpad-basic-wolfssl || \ PACKAGE_wpad-mini || \ PACKAGE_wpad-mesh-openssl || \ @@ -33,6 +34,7 @@ config WPA_MSG_MIN_PRIORITY PACKAGE_wpad-openssl || \ PACKAGE_wpad-wolfssl || \ PACKAGE_wpad-basic || \ + PACKAGE_wpad-basic-openssl || \ PACKAGE_wpad-basic-wolfssl || \ PACKAGE_wpad-mini || \ PACKAGE_wpad-mesh-openssl || \ @@ -73,6 +75,15 @@ config DRIVER_11AC_SUPPORT bool default n -config DRIVER_11W_SUPPORT +config DRIVER_11AX_SUPPORT bool default n + +config WPA_ENABLE_WEP + bool "Enable support for unsecure and obsolete WEP" + help + Wired equivalent privacy (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 and completely + removed in a future release. diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile index 4835507c5b..66a93ff5d8 100644 --- a/package/network/services/hostapd/Makefile +++ b/package/network/services/hostapd/Makefile @@ -7,13 +7,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=hostapd -PKG_RELEASE:=10 +PKG_RELEASE:=30 PKG_SOURCE_URL:=http://w1.fi/hostap.git PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2019-08-08 -PKG_SOURCE_VERSION:=ca8c2bd28ad53f431d6ee60ef754e98cfdb4c17b -PKG_MIRROR_HASH:=9d9f1c60afa5324ee17219bd3ec61c1a6fa4043b4187da9bb44e59025d3ed31d +PKG_SOURCE_DATE:=2020-06-08 +PKG_SOURCE_VERSION:=5a8b366233f5585e68a4ffbb604fbb4a848eb325 +PKG_MIRROR_HASH:=1b2a4947034142587a3f81eac2ea27dd64650e77f8943d973623b47533be2393 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=BSD-3-Clause @@ -32,6 +32,8 @@ PKG_CONFIG_DEPENDS:= \ CONFIG_DRIVER_WEXT_SUPPORT \ CONFIG_DRIVER_11N_SUPPORT \ CONFIG_DRIVER_11AC_SUPPORT \ + CONFIG_DRIVER_11AX_SUPPORT \ + CONFIG_WPA_ENABLE_WEP EAPOL_TEST_PROVIDERS:=eapol-test eapol-test-openssl eapol-test-wolfssl @@ -80,40 +82,49 @@ ifneq ($(CONFIG_DRIVER_11AC_SUPPORT),) HOSTAPD_IEEE80211AC:=y endif +ifneq ($(CONFIG_DRIVER_11AX_SUPPORT),) + HOSTAPD_IEEE80211AX:=y +endif + DRIVER_MAKEOPTS= \ CONFIG_ACS=$(CONFIG_PACKAGE_kmod-cfg80211) \ CONFIG_DRIVER_NL80211=$(CONFIG_PACKAGE_kmod-cfg80211) \ CONFIG_IEEE80211N=$(HOSTAPD_IEEE80211N) \ CONFIG_IEEE80211AC=$(HOSTAPD_IEEE80211AC) \ + CONFIG_IEEE80211AX=$(HOSTAPD_IEEE80211AX) \ CONFIG_DRIVER_WEXT=$(CONFIG_DRIVER_WEXT_SUPPORT) \ -ifneq ($(LOCAL_VARIANT),mini) - DRIVER_MAKEOPTS += CONFIG_IEEE80211W=$(CONFIG_DRIVER_11W_SUPPORT) +ifeq ($(SSL_VARIANT),openssl) + DRIVER_MAKEOPTS += CONFIG_TLS=openssl CONFIG_SAE=y + TARGET_LDFLAGS += -lcrypto -lssl + + ifeq ($(LOCAL_VARIANT),basic) + DRIVER_MAKEOPTS += CONFIG_OWE=y + endif + ifeq ($(LOCAL_VARIANT),mesh) + DRIVER_MAKEOPTS += CONFIG_AP=y CONFIG_MESH=y + endif + ifeq ($(LOCAL_VARIANT),full) + DRIVER_MAKEOPTS += CONFIG_OWE=y CONFIG_SUITEB192=y CONFIG_AP=y CONFIG_MESH=y + endif endif -ifeq ($(LOCAL_VARIANT),full) - ifeq ($(SSL_VARIANT),openssl) - DRIVER_MAKEOPTS += CONFIG_TLS=openssl CONFIG_SAE=y CONFIG_OWE=y CONFIG_SUITEB192=y CONFIG_AP=y CONFIG_MESH=y - TARGET_LDFLAGS += -lcrypto -lssl +ifeq ($(SSL_VARIANT),wolfssl) + DRIVER_MAKEOPTS += CONFIG_TLS=wolfssl CONFIG_SAE=y + TARGET_LDFLAGS += -lwolfssl + + ifeq ($(LOCAL_VARIANT),basic) + DRIVER_MAKEOPTS += CONFIG_OWE=y endif - ifeq ($(SSL_VARIANT),wolfssl) - DRIVER_MAKEOPTS += CONFIG_TLS=wolfssl CONFIG_WPS_NFC=1 CONFIG_SAE=y CONFIG_OWE=y CONFIG_SUITEB192=y CONFIG_AP=y CONFIG_MESH=y - TARGET_LDFLAGS += -lwolfssl + ifeq ($(LOCAL_VARIANT),mesh) + DRIVER_MAKEOPTS += CONFIG_AP=y CONFIG_MESH=y CONFIG_WPS_NFC=1 + endif + ifeq ($(LOCAL_VARIANT),full) + DRIVER_MAKEOPTS += CONFIG_OWE=y CONFIG_SUITEB192=y CONFIG_AP=y CONFIG_MESH=y CONFIG_WPS_NFC=1 endif endif ifneq ($(LOCAL_TYPE),hostapd) - ifeq ($(LOCAL_VARIANT),mesh) - ifeq ($(SSL_VARIANT),openssl) - DRIVER_MAKEOPTS += CONFIG_TLS=openssl CONFIG_AP=y CONFIG_SAE=y CONFIG_MESH=y - TARGET_LDFLAGS += -lcrypto -lssl - endif - ifeq ($(SSL_VARIANT),wolfssl) - DRIVER_MAKEOPTS += CONFIG_TLS=wolfssl CONFIG_WPS_NFC=1 CONFIG_AP=y CONFIG_SAE=y CONFIG_MESH=y - TARGET_LDFLAGS += -lwolfssl - endif - endif - ifdef CONFIG_WPA_RFKILL_SUPPORT DRIVER_MAKEOPTS += NEED_RFKILL=y endif @@ -141,7 +152,7 @@ endef define Package/hostapd $(call Package/hostapd/Default,$(1)) - TITLE+= (full) + TITLE+= (built-in full) VARIANT:=full-internal endef @@ -152,7 +163,7 @@ endef define Package/hostapd-openssl $(call Package/hostapd/Default,$(1)) - TITLE+= (full) + TITLE+= (OpenSSL full) VARIANT:=full-openssl DEPENDS+=+libopenssl endef @@ -161,7 +172,7 @@ Package/hostapd-openssl/description = $(Package/hostapd/description) define Package/hostapd-wolfssl $(call Package/hostapd/Default,$(1)) - TITLE+= (full) + TITLE+= (wolfSSL full) VARIANT:=full-wolfssl DEPENDS+=+libwolfssl endef @@ -170,7 +181,7 @@ Package/hostapd-wolfssl/description = $(Package/hostapd/description) define Package/hostapd-basic $(call Package/hostapd/Default,$(1)) - TITLE+= (WPA-PSK, 11r and 11w) + TITLE+= (WPA-PSK, 11r, 11w) VARIANT:=basic endef @@ -178,6 +189,28 @@ define Package/hostapd-basic/description This package contains a basic IEEE 802.1x/WPA Authenticator with WPA-PSK, 802.11r and 802.11w support. endef +define Package/hostapd-basic-openssl +$(call Package/hostapd/Default,$(1)) + TITLE+= (WPA-PSK, 11r and 11w) + VARIANT:=basic-openssl + DEPENDS+=+libopenssl +endef + +define Package/hostapd-basic-openssl/description + This package contains a basic IEEE 802.1x/WPA Authenticator with WPA-PSK, 802.11r and 802.11w support. +endef + +define Package/hostapd-basic-wolfssl +$(call Package/hostapd/Default,$(1)) + TITLE+= (WPA-PSK, 11r and 11w) + VARIANT:=basic-wolfssl + DEPENDS+=+libwolfssl +endef + +define Package/hostapd-basic-wolfssl/description + This package contains a basic IEEE 802.1x/WPA Authenticator with WPA-PSK, 802.11r and 802.11w support. +endef + define Package/hostapd-mini $(call Package/hostapd/Default,$(1)) TITLE+= (WPA-PSK only) @@ -193,7 +226,7 @@ define Package/wpad/Default SECTION:=net CATEGORY:=Network SUBMENU:=WirelessAPD - TITLE:=IEEE 802.1x Authenticator/Supplicant + TITLE:=IEEE 802.1x Auth/Supplicant DEPENDS:=$(DRV_DEPENDS) +hostapd-common +libubus URL:=http://hostap.epitest.fi/ PROVIDES:=hostapd wpa-supplicant @@ -204,7 +237,7 @@ endef define Package/wpad $(call Package/wpad/Default,$(1)) - TITLE+= (full) + TITLE+= (built-in full) VARIANT:=wpad-full-internal endef @@ -215,7 +248,7 @@ endef define Package/wpad-openssl $(call Package/wpad/Default,$(1)) - TITLE+= (full) + TITLE+= (OpenSSL full) VARIANT:=wpad-full-openssl DEPENDS+=+libopenssl endef @@ -224,7 +257,7 @@ Package/wpad-openssl/description = $(Package/wpad/description) define Package/wpad-wolfssl $(call Package/wpad/Default,$(1)) - TITLE+= (full) + TITLE+= (wolfSSL full) VARIANT:=wpad-full-wolfssl DEPENDS+=+libwolfssl endef @@ -233,7 +266,7 @@ Package/wpad-wolfssl/description = $(Package/wpad/description) define Package/wpad-basic $(call Package/wpad/Default,$(1)) - TITLE+= (WPA-PSK, 11r and 11w) + TITLE+= (WPA-PSK, 11r, 11w) VARIANT:=wpad-basic endef @@ -241,6 +274,17 @@ define Package/wpad-basic/description This package contains a basic IEEE 802.1x/WPA Authenticator and Supplicant with WPA-PSK, 802.11r and 802.11w support. endef +define Package/wpad-basic-openssl +$(call Package/wpad/Default,$(1)) + TITLE+= (OpenSSL, 11r, 11w) + VARIANT:=wpad-basic-openssl + DEPENDS+=+libopenssl +endef + +define Package/wpad-basic-openssl/description + This package contains a basic IEEE 802.1x/WPA Authenticator and Supplicant with WPA-PSK, SAE (WPA3-Personal), 802.11r and 802.11w support. +endef + define Package/wpad-basic-wolfssl $(call Package/wpad/Default,$(1)) TITLE+= (wolfSSL, 11r, 11w) @@ -264,7 +308,6 @@ endef define Package/wpad-mesh $(call Package/wpad/Default,$(1)) - TITLE+= (with 802.11s mesh and SAE support) DEPENDS+=@PACKAGE_kmod-cfg80211 @(!TARGET_uml||BROKEN) PROVIDES+=wpa-supplicant-mesh wpad-mesh endef @@ -275,6 +318,7 @@ endef define Package/wpad-mesh-openssl $(call Package/wpad-mesh,$(1)) + TITLE+= (OpenSSL, 11s, SAE) DEPENDS+=+libopenssl VARIANT:=wpad-mesh-openssl endef @@ -283,6 +327,7 @@ Package/wpad-mesh-openssl/description = $(Package/wpad-mesh/description) define Package/wpad-mesh-wolfssl $(call Package/wpad-mesh,$(1)) + TITLE+= (wolfSSL, 11s, SAE) DEPENDS+=+libwolfssl VARIANT:=wpad-mesh-wolfssl endef @@ -304,17 +349,20 @@ endef define Package/wpa-supplicant $(call Package/wpa-supplicant/Default,$(1)) + TITLE+= (built-in full) VARIANT:=supplicant-full-internal endef define Package/wpa-supplicant-openssl $(call Package/wpa-supplicant/Default,$(1)) + TITLE+= (OpenSSL full) VARIANT:=supplicant-full-openssl DEPENDS+=+libopenssl endef define Package/wpa-supplicant-wolfssl $(call Package/wpa-supplicant/Default,$(1)) + TITLE+= (wolfSSL full) VARIANT:=supplicant-full-wolfssl DEPENDS+=+libwolfssl endef @@ -325,39 +373,40 @@ endef define Package/wpa-supplicant-p2p $(call Package/wpa-supplicant/Default,$(1)) - TITLE+= (with Wi-Fi P2P support) + TITLE+= (Wi-Fi P2P support) DEPENDS+=@PACKAGE_kmod-cfg80211 VARIANT:=supplicant-p2p-internal endef define Package/wpa-supplicant-mesh/Default $(call Package/wpa-supplicant/Default,$(1)) - TITLE+= (with 802.11s and SAE) DEPENDS+=@PACKAGE_kmod-cfg80211 @(!TARGET_uml||BROKEN) PROVIDES+=wpa-supplicant-mesh endef define Package/wpa-supplicant-mesh-openssl $(call Package/wpa-supplicant-mesh/Default,$(1)) + TITLE+= (OpenSSL, 11s, SAE) VARIANT:=supplicant-mesh-openssl DEPENDS+=+libopenssl endef define Package/wpa-supplicant-mesh-wolfssl $(call Package/wpa-supplicant-mesh/Default,$(1)) + TITLE+= (wolfSSL, 11s, SAE) VARIANT:=supplicant-mesh-wolfssl DEPENDS+=+libwolfssl endef define Package/wpa-supplicant-basic $(call Package/wpa-supplicant/Default,$(1)) - TITLE+= (with 11r and 11w) + TITLE+= (11r, 11w) VARIANT:=supplicant-basic endef define Package/wpa-supplicant-mini $(call Package/wpa-supplicant/Default,$(1)) - TITLE+= (minimal version) + TITLE+= (minimal) VARIANT:=supplicant-mini endef @@ -391,34 +440,35 @@ define Package/wpa-cli TITLE:=WPA Supplicant command line control utility endef -define Package/eapol-test - TITLE:=802.1x authentication test utility +define Package/eapol-test/Default + TITLE:=802.1x auth test utility SECTION:=net - CATEGORY:=Network SUBMENU:=WirelessAPD - VARIANT:=supplicant-full-internal + CATEGORY:=Network DEPENDS:=$(DRV_DEPENDS) +libubus endef +define Package/eapol-test + $(call Package/eapol-test/Default,$(1)) + TITLE+= (built-in full) + VARIANT:=supplicant-full-internal +endef + define Package/eapol-test-openssl - TITLE:=802.1x authentication test utility - SECTION:=net - CATEGORY:=Network - SUBMENU:=WirelessAPD + $(call Package/eapol-test/Default,$(1)) + TITLE+= (OpenSSL full) VARIANT:=supplicant-full-openssl CONFLICTS:=$(filter-out eapol-test-openssl ,$(EAPOL_TEST_PROVIDERS)) - DEPENDS:=$(DRV_DEPENDS) +libubus +libopenssl + DEPENDS+=+libopenssl PROVIDES:=eapol-test endef define Package/eapol-test-wolfssl - TITLE:=802.1x authentication test utility - SECTION:=net - CATEGORY:=Network - SUBMENU:=WirelessAPD + $(call Package/eapol-test/Default,$(1)) + TITLE+= (wolfSSL full) VARIANT:=supplicant-full-wolfssl CONFLICTS:=$(filter-out eapol-test-openssl ,$(filter-out eapol-test-wolfssl ,$(EAPOL_TEST_PROVIDERS))) - DEPENDS:=$(DRV_DEPENDS) +libubus +libwolfssl + DEPENDS+=+libwolfssl PROVIDES:=eapol-test endef @@ -438,7 +488,9 @@ define Build/Configure $(if $(wildcard ./files/hostapd-$(CONFIG_VARIANT).config), \ $(CP) ./files/hostapd-$(CONFIG_VARIANT).config $(PKG_BUILD_DIR)/hostapd/.config \ ) - $(CP) ./files/wpa_supplicant-$(CONFIG_VARIANT).config $(PKG_BUILD_DIR)/wpa_supplicant/.config + $(if $(wildcard ./files/wpa_supplicant-$(CONFIG_VARIANT).config), \ + $(CP) ./files/wpa_supplicant-$(CONFIG_VARIANT).config $(PKG_BUILD_DIR)/wpa_supplicant/.config + ) endef TARGET_CPPFLAGS := \ @@ -456,6 +508,10 @@ ifdef CONFIG_PACKAGE_kmod-cfg80211 TARGET_LDFLAGS += -lm -lnl-tiny endif +ifdef CONFIG_WPA_ENABLE_WEP + DRIVER_MAKEOPTS += CONFIG_WEP=y +endif + define Build/RunMake CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \ $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)/$(1) \ @@ -548,6 +604,8 @@ define Package/hostapd/install $(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd/hostapd $(1)/usr/sbin/ endef Package/hostapd-basic/install = $(Package/hostapd/install) +Package/hostapd-basic-openssl/install = $(Package/hostapd/install) +Package/hostapd-basic-wolfssl/install = $(Package/hostapd/install) Package/hostapd-mini/install = $(Package/hostapd/install) Package/hostapd-openssl/install = $(Package/hostapd/install) Package/hostapd-wolfssl/install = $(Package/hostapd/install) @@ -567,6 +625,7 @@ define Package/wpad/install $(LN) wpad $(1)/usr/sbin/wpa_supplicant endef Package/wpad-basic/install = $(Package/wpad/install) +Package/wpad-basic-openssl/install = $(Package/wpad/install) Package/wpad-basic-wolfssl/install = $(Package/wpad/install) Package/wpad-mini/install = $(Package/wpad/install) Package/wpad-openssl/install = $(Package/wpad/install) @@ -616,6 +675,8 @@ endif $(eval $(call BuildPackage,hostapd)) $(eval $(call BuildPackage,hostapd-basic)) +$(eval $(call BuildPackage,hostapd-basic-openssl)) +$(eval $(call BuildPackage,hostapd-basic-wolfssl)) $(eval $(call BuildPackage,hostapd-mini)) $(eval $(call BuildPackage,hostapd-openssl)) $(eval $(call BuildPackage,hostapd-wolfssl)) @@ -623,6 +684,7 @@ $(eval $(call BuildPackage,wpad)) $(eval $(call BuildPackage,wpad-mesh-openssl)) $(eval $(call BuildPackage,wpad-mesh-wolfssl)) $(eval $(call BuildPackage,wpad-basic)) +$(eval $(call BuildPackage,wpad-basic-openssl)) $(eval $(call BuildPackage,wpad-basic-wolfssl)) $(eval $(call BuildPackage,wpad-mini)) $(eval $(call BuildPackage,wpad-openssl)) diff --git a/package/network/services/hostapd/files/hostapd-basic.config b/package/network/services/hostapd/files/hostapd-basic.config index 19ea850f6b..947e2fa200 100644 --- a/package/network/services/hostapd/files/hostapd-basic.config +++ b/package/network/services/hostapd/files/hostapd-basic.config @@ -268,7 +268,7 @@ CONFIG_GETRANDOM=y #CONFIG_ELOOP_POLL=y # Should we use epoll instead of select? Select is used by default. -#CONFIG_ELOOP_EPOLL=y +CONFIG_ELOOP_EPOLL=y # Should we use kqueue instead of select? Select is used by default. #CONFIG_ELOOP_KQUEUE=y diff --git a/package/network/services/hostapd/files/hostapd-full.config b/package/network/services/hostapd/files/hostapd-full.config index 0ecce423e7..df272e443a 100644 --- a/package/network/services/hostapd/files/hostapd-full.config +++ b/package/network/services/hostapd/files/hostapd-full.config @@ -268,7 +268,7 @@ CONFIG_GETRANDOM=y #CONFIG_ELOOP_POLL=y # Should we use epoll instead of select? Select is used by default. -#CONFIG_ELOOP_EPOLL=y +CONFIG_ELOOP_EPOLL=y # Should we use kqueue instead of select? Select is used by default. #CONFIG_ELOOP_KQUEUE=y @@ -313,7 +313,7 @@ CONFIG_INTERNAL_LIBTOMMATH=y # Interworking (IEEE 802.11u) # This can be used to enable functionality to improve interworking with # external networks. -#CONFIG_INTERWORKING=y +CONFIG_INTERWORKING=y # Hotspot 2.0 #CONFIG_HS20=y @@ -384,7 +384,7 @@ CONFIG_TAXONOMY=y #CONFIG_OWE=y # Airtime policy support -#CONFIG_AIRTIME_POLICY=y +CONFIG_AIRTIME_POLICY=y # Override default value for the wpa_disable_eapol_key_retries configuration # parameter. See that parameter in hostapd.conf for more details. diff --git a/package/network/services/hostapd/files/hostapd-mini.config b/package/network/services/hostapd/files/hostapd-mini.config index d9511441e6..b3050f7bbc 100644 --- a/package/network/services/hostapd/files/hostapd-mini.config +++ b/package/network/services/hostapd/files/hostapd-mini.config @@ -268,7 +268,7 @@ CONFIG_GETRANDOM=y #CONFIG_ELOOP_POLL=y # Should we use epoll instead of select? Select is used by default. -#CONFIG_ELOOP_EPOLL=y +CONFIG_ELOOP_EPOLL=y # Should we use kqueue instead of select? Select is used by default. #CONFIG_ELOOP_KQUEUE=y diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh index 252622b863..6d279b3db1 100755 --- a/package/network/services/hostapd/files/hostapd.sh +++ b/package/network/services/hostapd/files/hostapd.sh @@ -1,4 +1,5 @@ . /lib/functions/network.sh +. /lib/functions.sh wpa_supplicant_add_rate() { local var="$1" @@ -70,6 +71,8 @@ hostapd_append_wpa_key_mgmt() { append wpa_key_mgmt "OWE" ;; esac + + [ "$auth_osen" = "1" ] && append wpa_key_mgmt "OSEN" } hostapd_add_log_config() { @@ -95,11 +98,14 @@ hostapd_common_add_device_config() { config_add_int local_pwr_constraint config_add_string require_mode config_add_boolean legacy_rates + config_add_int cell_density config_add_boolean vendor_vht config_add_string acs_chan_bias config_add_array hostapd_options + config_add_int airtime_mode + hostapd_add_log_config } @@ -107,20 +113,19 @@ hostapd_prepare_device_config() { local config="$1" local driver="$2" - local base="${config%%.conf}" local base_cfg= json_get_vars country country_ie beacon_int:100 dtim_period:2 doth require_mode legacy_rates \ - acs_chan_bias local_pwr_constraint spectrum_mgmt_required vendor_vht + acs_chan_bias local_pwr_constraint spectrum_mgmt_required airtime_mode cell_density vendor_vht hostapd_set_log_options base_cfg set_default country_ie 1 set_default spectrum_mgmt_required 0 set_default doth 1 - set_default legacy_rates 1 - - [ "$hwmode" = "b" ] && legacy_rates=1 + set_default legacy_rates 0 + set_default airtime_mode 0 + set_default cell_density 0 [ -n "$country" ] && { append base_cfg "country_code=$country" "$N" @@ -141,17 +146,58 @@ hostapd_prepare_device_config() { json_get_values rate_list supported_rates [ -n "$hwmode" ] && append base_cfg "hw_mode=$hwmode" "$N" - [ "$legacy_rates" -eq 0 ] && set_default require_mode g - - [ "$hwmode" = "g" ] && { - [ "$legacy_rates" -eq 0 ] && set_default rate_list "6000 9000 12000 18000 24000 36000 48000 54000" - [ -n "$require_mode" ] && set_default basic_rate_list "6000 12000 24000" - [ -n "$vendor_vht" ] && append base_cfg "vendor_vht=$vendor_vht" "$N" - } - - case "$require_mode" in - n) append base_cfg "require_ht=1" "$N";; - ac) append base_cfg "require_vht=1" "$N";; + if [ "$hwmode" = "g" ] || [ "$hwmode" = "a" ]; then + [ -n "$require_mode" ] && legacy_rates=0 + case "$require_mode" in + n) append base_cfg "require_ht=1" "$N";; + ac) append base_cfg "require_vht=1" "$N";; + esac + fi + case "$hwmode" in + b) + if [ "$cell_density" -eq 1 ]; then + set_default rate_list "5500 11000" + set_default basic_rate_list "5500 11000" + elif [ "$cell_density" -ge 2 ]; then + set_default rate_list "11000" + set_default basic_rate_list "11000" + fi + ;; + g) + if [ "$cell_density" -eq 0 ] || [ "$cell_density" -eq 1 ]; then + if [ "$legacy_rates" -eq 0 ]; then + set_default rate_list "6000 9000 12000 18000 24000 36000 48000 54000" + set_default basic_rate_list "6000 12000 24000" + elif [ "$cell_density" -eq 1 ]; then + set_default rate_list "5500 6000 9000 11000 12000 18000 24000 36000 48000 54000" + set_default basic_rate_list "5500 11000" + fi + elif [ "$cell_density" -ge 3 ] && [ "$legacy_rates" -ne 0 ] || [ "$cell_density" -eq 2 ]; then + if [ "$legacy_rates" -eq 0 ]; then + set_default rate_list "12000 18000 24000 36000 48000 54000" + set_default basic_rate_list "12000 24000" + else + set_default rate_list "11000 12000 18000 24000 36000 48000 54000" + set_default basic_rate_list "11000" + fi + elif [ "$cell_density" -ge 3 ]; then + set_default rate_list "24000 36000 48000 54000" + set_default basic_rate_list "24000" + fi + [ -n "$vendor_vht" ] && append base_cfg "vendor_vht=$vendor_vht" "$N" + ;; + a) + if [ "$cell_density" -eq 1 ]; then + set_default rate_list "6000 9000 12000 18000 24000 36000 48000 54000" + set_default basic_rate_list "6000 12000 24000" + elif [ "$cell_density" -eq 2 ]; then + set_default rate_list "12000 18000 24000 36000 48000 54000" + set_default basic_rate_list "12000 24000" + elif [ "$cell_density" -ge 3 ]; then + set_default rate_list "24000 36000 48000 54000" + set_default basic_rate_list "24000" + fi + ;; esac for r in $rate_list; do @@ -166,6 +212,7 @@ hostapd_prepare_device_config() { [ -n "$brlist" ] && append base_cfg "basic_rates=$brlist" "$N" append base_cfg "beacon_int=$beacon_int" "$N" append base_cfg "dtim_period=$dtim_period" "$N" + [ "$airtime_mode" -gt 0 ] && append base_cfg "airtime_mode=$airtime_mode" "$N" json_get_values opts hostapd_options for val in $opts; do @@ -183,7 +230,7 @@ hostapd_common_add_bss_config() { config_add_boolean wds wmm uapsd hidden utf8_ssid config_add_int maxassoc max_inactivity - config_add_boolean disassoc_low_ack isolate short_preamble + config_add_boolean disassoc_low_ack isolate short_preamble skip_inactivity_poll config_add_int \ wep_rekey eap_reauth_period \ @@ -198,7 +245,7 @@ hostapd_common_add_bss_config() { config_add_int eapol_version config_add_string 'auth_server:host' 'server:host' - config_add_string auth_secret + config_add_string auth_secret key config_add_int 'auth_port:port' 'port:port' config_add_string acct_server @@ -236,12 +283,15 @@ hostapd_common_add_bss_config() { config_add_string wps_device_type wps_device_name wps_manufacturer wps_pin config_add_string multi_ap_backhaul_ssid multi_ap_backhaul_key - config_add_boolean ieee80211v wnm_sleep_mode bss_transition + config_add_boolean wnm_sleep_mode bss_transition config_add_int time_advertisement config_add_string time_zone config_add_boolean ieee80211k rrm_neighbor_report rrm_beacon_report + config_add_boolean ftm_responder stationary_ap + config_add_string lci civic + config_add_boolean ieee80211r pmk_r1_push ft_psk_generate_local ft_over_ds config_add_int r0_key_lifetime reassociation_deadline config_add_string mobility_domain r1_key_holder @@ -258,10 +308,158 @@ hostapd_common_add_bss_config() { config_add_int mcast_rate config_add_array basic_rate config_add_array supported_rates - + config_add_boolean sae_require_mfp - + config_add_string 'owe_transition_bssid:macaddr' 'owe_transition_ssid:string' + + config_add_boolean iw_enabled iw_internet iw_asra iw_esr iw_uesa + config_add_int iw_access_network_type iw_venue_group iw_venue_type + config_add_int iw_ipaddr_type_availability iw_gas_address3 + config_add_string iw_hessid iw_network_auth_type iw_qos_map_set + config_add_array iw_roaming_consortium iw_domain_name iw_anqp_3gpp_cell_net iw_nai_realm + config_add_array iw_anqp_elem + + config_add_boolean hs20 disable_dgaf osen + config_add_int anqp_domain_id + config_add_int hs20_deauth_req_timeout + config_add_array hs20_oper_friendly_name + config_add_array osu_provider + config_add_array operator_icon + config_add_array hs20_conn_capab + config_add_string osu_ssid hs20_wan_metrics hs20_operating_class hs20_t_c_filename hs20_t_c_timestamp + + config_add_array airtime_sta_weight + config_add_int airtime_bss_weight airtime_bss_limit + + config_add_boolean multicast_to_unicast per_sta_vif + + config_add_array hostapd_bss_options +} + +hostapd_set_vlan_file() { + local ifname="$1" + local vlan="$2" + json_get_vars name vid + echo "${vid} ${ifname}-${name}" >> /var/run/hostapd-${ifname}.vlan + wireless_add_vlan "${vlan}" "${ifname}-${name}" +} + +hostapd_set_vlan() { + local ifname="$1" + + rm -f /var/run/hostapd-${ifname}.vlan + for_each_vlan hostapd_set_vlan_file ${ifname} +} + +hostapd_set_psk_file() { + local ifname="$1" + local vlan="$2" + local vlan_id="" + + json_get_vars mac vid key + set_default mac "00:00:00:00:00:00" + [ -n "$vid" ] && vlan_id="vlanid=$vid " + echo "${vlan_id} ${mac} ${key}" >> /var/run/hostapd-${ifname}.psk +} + +hostapd_set_psk() { + local ifname="$1" + + rm -f /var/run/hostapd-${ifname}.psk + for_each_station hostapd_set_psk_file ${ifname} +} + +append_iw_roaming_consortium() { + [ -n "$1" ] && append bss_conf "roaming_consortium=$1" "$N" +} + +append_iw_domain_name() { + if [ -z "$iw_domain_name_conf" ]; then + iw_domain_name_conf="$1" + else + iw_domain_name_conf="$iw_domain_name_conf,$1" + fi +} + +append_iw_anqp_3gpp_cell_net() { + if [ -z "$iw_anqp_3gpp_cell_net_conf" ]; then + iw_anqp_3gpp_cell_net_conf="$1" + else + iw_anqp_3gpp_cell_net_conf="$iw_anqp_3gpp_cell_net_conf:$1" + fi +} + +append_iw_anqp_elem() { + [ -n "$1" ] && append bss_conf "anqp_elem=$1" "$N" +} + +append_iw_nai_realm() { + [ -n "$1" ] && append bss_conf "nai_realm=$1" "$N" +} + +append_hs20_oper_friendly_name() { + append bss_conf "hs20_oper_friendly_name=$1" "$N" +} + +append_osu_provider_service_desc() { + append bss_conf "osu_service_desc=$1" "$N" +} + +append_hs20_icon() { + local width height lang type path + config_get width "$1" width + config_get height "$1" height + config_get lang "$1" lang + config_get type "$1" type + config_get path "$1" path + + append bss_conf "hs20_icon=$width:$height:$lang:$type:$1:$path" "$N" +} + +append_hs20_icons() { + config_load wireless + config_foreach append_hs20_icon hs20-icon +} + +append_operator_icon() { + append bss_conf "operator_icon=$1" "$N" +} + +append_osu_icon() { + append bss_conf "osu_icon=$1" "$N" +} + +append_osu_provider() { + local cfgtype osu_server_uri osu_friendly_name osu_nai osu_nai2 osu_method_list + + config_load wireless + config_get cfgtype "$1" TYPE + [ "$cfgtype" != "osu-provider" ] && return + + append bss_conf "# provider $1" "$N" + config_get osu_server_uri "$1" osu_server_uri + config_get osu_nai "$1" osu_nai + config_get osu_nai2 "$1" osu_nai2 + config_get osu_method_list "$1" osu_method + + append bss_conf "osu_server_uri=$osu_server_uri" "$N" + append bss_conf "osu_nai=$osu_nai" "$N" + append bss_conf "osu_nai2=$osu_nai2" "$N" + append bss_conf "osu_method_list=$osu_method_list" "$N" + + config_list_foreach "$1" osu_service_desc append_osu_provider_service_desc + config_list_foreach "$1" osu_icon append_osu_icon + + append bss_conf "$N" +} + +append_hs20_conn_capab() { + [ -n "$1" ] && append bss_conf "hs20_conn_capab=$1" "$N" +} + +append_airtime_sta_weight() { + [ -n "$1" ] && append bss_conf "airtime_sta_weight=$1" "$N" } hostapd_set_bss_options() { @@ -284,24 +482,29 @@ hostapd_set_bss_options() { iapp_interface eapol_version dynamic_vlan ieee80211w nasid \ acct_server acct_secret acct_port acct_interval \ bss_load_update_period chan_util_avg_period sae_require_mfp \ - multi_ap multi_ap_backhaul_ssid multi_ap_backhaul_key + multi_ap multi_ap_backhaul_ssid multi_ap_backhaul_key skip_inactivity_poll \ + airtime_bss_weight airtime_bss_limit airtime_sta_weight \ + multicast_to_unicast per_sta_vif set_default isolate 0 set_default maxassoc 0 set_default max_inactivity 0 set_default short_preamble 1 set_default disassoc_low_ack 1 + set_default skip_inactivity_poll 0 set_default hidden 0 set_default wmm 1 set_default uapsd 1 set_default wpa_disable_eapol_key_retries 0 set_default tdls_prohibit 0 - set_default eapol_version 0 + set_default eapol_version $((wpa & 1)) set_default acct_port 1813 set_default bss_load_update_period 60 set_default chan_util_avg_period 600 set_default utf8_ssid 1 set_default multi_ap 0 + set_default airtime_bss_weight 0 + set_default airtime_bss_limit 0 append bss_conf "ctrl_interface=/var/run/hostapd" if [ "$isolate" -gt 0 ]; then @@ -314,9 +517,14 @@ hostapd_set_bss_options() { append bss_conf "ap_max_inactivity=$max_inactivity" "$N" fi + [ "$airtime_bss_weight" -gt 0 ] && append bss_conf "airtime_bss_weight=$airtime_bss_weight" "$N" + [ "$airtime_bss_limit" -gt 0 ] && append bss_conf "airtime_bss_limit=$airtime_bss_limit" "$N" + json_for_each_item append_airtime_sta_weight airtime_sta_weight + append bss_conf "bss_load_update_period=$bss_load_update_period" "$N" append bss_conf "chan_util_avg_period=$chan_util_avg_period" "$N" append bss_conf "disassoc_low_ack=$disassoc_low_ack" "$N" + append bss_conf "skip_inactivity_poll=$skip_inactivity_poll" "$N" append bss_conf "preamble=$short_preamble" "$N" append bss_conf "wmm_enabled=$wmm" "$N" append bss_conf "ignore_broadcast_ssid=$hidden" "$N" @@ -371,20 +579,23 @@ hostapd_set_bss_options() { ;; psk|sae|psk-sae) json_get_vars key wpa_psk_file - if [ ${#key} -lt 8 ]; then + if [ ${#key} -eq 64 ]; then + append bss_conf "wpa_psk=$key" "$N" + elif [ ${#key} -ge 8 ] && [ ${#key} -le 63 ]; then + append bss_conf "wpa_passphrase=$key" "$N" + elif [ -n "$key" ] || [ -z "$wpa_psk_file" ]; then wireless_setup_vif_failed INVALID_WPA_PSK return 1 - elif [ ${#key} -eq 64 ]; then - append bss_conf "wpa_psk=$key" "$N" - else - append bss_conf "wpa_passphrase=$key" "$N" fi + [ -z "$wpa_psk_file" ] && set_default wpa_psk_file /var/run/hostapd-$ifname.psk [ -n "$wpa_psk_file" ] && { [ -e "$wpa_psk_file" ] || touch "$wpa_psk_file" append bss_conf "wpa_psk_file=$wpa_psk_file" "$N" } [ "$eapol_version" -ge "1" -a "$eapol_version" -le "2" ] && append bss_conf "eapol_version=$eapol_version" "$N" + set_default dynamic_vlan 0 + vlan_possible=1 wps_possible=1 ;; eap|eap192|eap-eap192) @@ -457,7 +668,7 @@ hostapd_set_bss_options() { set_default wps_independent 1 wps_state=2 - [ -n "$wps_configured" ] && wps_state=1 + [ -n "$wps_not_configured" ] && wps_state=1 [ "$ext_registrar" -gt 0 -a -n "$network_bridge" ] && append bss_conf "upnp_iface=$network_bridge" "$N" @@ -494,30 +705,38 @@ hostapd_set_bss_options() { append bss_conf "iapp_interface=$ifname" "$N" } - json_get_vars ieee80211v - set_default ieee80211v 0 - if [ "$ieee80211v" -eq "1" ]; then - json_get_vars time_advertisement time_zone wnm_sleep_mode bss_transition + json_get_vars time_advertisement time_zone wnm_sleep_mode bss_transition + set_default bss_transition 0 + set_default wnm_sleep_mode 0 - set_default time_advertisement 0 - set_default wnm_sleep_mode 0 - set_default bss_transition 0 + [ -n "$time_advertisement" ] && append bss_conf "time_advertisement=$time_advertisement" "$N" + [ -n "$time_zone" ] && append bss_conf "time_zone=$time_zone" "$N" + [ "$wnm_sleep_mode" -eq "1" ] && append bss_conf "wnm_sleep_mode=1" "$N" + [ "$bss_transition" -eq "1" ] && append bss_conf "bss_transition=1" "$N" - append bss_conf "time_advertisement=$time_advertisement" "$N" - [ -n "$time_zone" ] && append bss_conf "time_zone=$time_zone" "$N" - append bss_conf "wnm_sleep_mode=$wnm_sleep_mode" "$N" - append bss_conf "bss_transition=$bss_transition" "$N" - fi - - json_get_vars ieee80211k + json_get_vars ieee80211k rrm_neighbor_report rrm_beacon_report set_default ieee80211k 0 if [ "$ieee80211k" -eq "1" ]; then - json_get_vars rrm_neighbor_report rrm_beacon_report - set_default rrm_neighbor_report 1 set_default rrm_beacon_report 1 - append bss_conf "rrm_neighbor_report=$rrm_neighbor_report" "$N" - append bss_conf "rrm_beacon_report=$rrm_beacon_report" "$N" + else + set_default rrm_neighbor_report 0 + set_default rrm_beacon_report 0 + fi + + [ "$rrm_neighbor_report" -eq "1" ] && append bss_conf "rrm_neighbor_report=1" "$N" + [ "$rrm_beacon_report" -eq "1" ] && append bss_conf "rrm_beacon_report=1" "$N" + + json_get_vars ftm_responder stationary_ap lci civic + set_default ftm_responder 0 + if [ "$ftm_responder" -eq "1" ]; then + set_default stationary_ap 0 + iw phy "$phy" info | grep -q "ENABLE_FTM_RESPONDER" && { + append bss_conf "ftm_responder=1" "$N" + [ "$stationary_ap" -eq "1" ] && append bss_conf "stationary_ap=1" "$N" + [ -n "$lci" ] && append bss_conf "lci=$lci" "$N" + [ -n "$civic" ] && append bss_conf "lci=$civic" "$N" + } fi if [ "$wpa" -ge "1" ]; then @@ -526,7 +745,7 @@ hostapd_set_bss_options() { if [ "$ieee80211r" -gt "0" ]; then json_get_vars mobility_domain ft_psk_generate_local ft_over_ds reassociation_deadline - + set_default mobility_domain "$(echo "$ssid" | md5sum | head -c 4)" set_default ft_over_ds 1 set_default reassociation_deadline 1000 @@ -641,6 +860,7 @@ hostapd_set_bss_options() { [ -n "$vlan_possible" -a -n "$dynamic_vlan" ] && { json_get_vars vlan_naming vlan_tagged_interface vlan_bridge vlan_file set_default vlan_naming 1 + [ -z "$vlan_file" ] && set_default vlan_file /var/run/hostapd-$ifname.vlan append bss_conf "dynamic_vlan=$dynamic_vlan" "$N" append bss_conf "vlan_naming=$vlan_naming" "$N" [ -n "$vlan_bridge" ] && \ @@ -653,6 +873,94 @@ hostapd_set_bss_options() { } } + json_get_vars iw_enabled iw_internet iw_asra iw_esr iw_uesa iw_access_network_type + json_get_vars iw_hessid iw_venue_group iw_venue_type iw_network_auth_type + json_get_vars iw_roaming_consortium iw_domain_name iw_anqp_3gpp_cell_net iw_nai_realm + json_get_vars iw_anqp_elem iw_qos_map_set iw_ipaddr_type_availability iw_gas_address3 + + set_default iw_enabled 0 + if [ "$iw_enabled" = "1" ]; then + append bss_conf "interworking=1" "$N" + set_default iw_internet 1 + set_default iw_asra 0 + set_default iw_esr 0 + set_default iw_uesa 0 + + append bss_conf "internet=$iw_internet" "$N" + append bss_conf "asra=$iw_asra" "$N" + append bss_conf "esr=$iw_esr" "$N" + append bss_conf "uesa=$iw_uesa" "$N" + + [ -n "$iw_access_network_type" ] && \ + append bss_conf "access_network_type=$iw_access_network_type" "$N" + [ -n "$iw_hessid" ] && append bss_conf "hessid=$iw_hessid" "$N" + [ -n "$iw_venue_group" ] && \ + append bss_conf "venue_group=$iw_venue_group" "$N" + [ -n "$iw_venue_type" ] && append bss_conf "venue_type=$iw_venue_type" "$N" + [ -n "$iw_network_auth_type" ] && \ + append bss_conf "network_auth_type=$iw_network_auth_type" "$N" + [ -n "$iw_gas_address3" ] && append bss_conf "gas_address3=$iw_gas_address3" "$N" + [ -n "$iw_qos_map_set" ] && append bss_conf "qos_map_set=$iw_qos_map_set" "$N" + + json_for_each_item append_iw_roaming_consortium iw_roaming_consortium + json_for_each_item append_iw_anqp_elem iw_anqp_elem + json_for_each_item append_iw_nai_realm iw_nai_realm + + iw_domain_name_conf= + json_for_each_item append_iw_domain_name iw_domain_name + [ -n "$iw_domain_name_conf" ] && \ + append bss_conf "domain_name=$iw_domain_name_conf" "$N" + + iw_anqp_3gpp_cell_net_conf= + json_for_each_item append_iw_anqp_3gpp_cell_net iw_anqp_3gpp_cell_net + [ -n "$iw_anqp_3gpp_cell_net_conf" ] && \ + append bss_conf "anqp_3gpp_cell_net=$iw_anqp_3gpp_cell_net_conf" "$N" + fi + + + local hs20 disable_dgaf osen anqp_domain_id hs20_deauth_req_timeout \ + osu_ssid hs20_wan_metrics hs20_operating_class hs20_t_c_filename hs20_t_c_timestamp + json_get_vars hs20 disable_dgaf osen anqp_domain_id hs20_deauth_req_timeout \ + osu_ssid hs20_wan_metrics hs20_operating_class hs20_t_c_filename hs20_t_c_timestamp + + set_default hs20 0 + set_default disable_dgaf $hs20 + set_default osen 0 + set_default anqp_domain_id 0 + set_default hs20_deauth_req_timeout 60 + if [ "$hs20" = "1" ]; then + append bss_conf "hs20=1" "$N" + append_hs20_icons + append bss_conf "disable_dgaf=$disable_dgaf" "$N" + append bss_conf "osen=$osen" "$N" + append bss_conf "anqp_domain_id=$anqp_domain_id" "$N" + append bss_conf "hs20_deauth_req_timeout=$hs20_deauth_req_timeout" "$N" + [ -n "$osu_ssid" ] && append bss_conf "osu_ssid=$osu_ssid" "$N" + [ -n "$hs20_wan_metrics" ] && append bss_conf "hs20_wan_metrics=$hs20_wan_metrics" "$N" + [ -n "$hs20_operating_class" ] && append bss_conf "hs20_operating_class=$hs20_operating_class" "$N" + [ -n "$hs20_t_c_filename" ] && append bss_conf "hs20_t_c_filename=$hs20_t_c_filename" "$N" + [ -n "$hs20_t_c_timestamp" ] && append bss_conf "hs20_t_c_timestamp=$hs20_t_c_timestamp" "$N" + json_for_each_item append_hs20_conn_capab hs20_conn_capab + json_for_each_item append_hs20_oper_friendly_name hs20_oper_friendly_name + json_for_each_item append_osu_provider osu_provider + json_for_each_item append_operator_icon operator_icon + fi + + set_default multicast_to_unicast 0 + if [ "$multicast_to_unicast" -gt 0 ]; then + append bss_conf "multicast_to_unicast=$multicast_to_unicast" "$N" + fi + + set_default per_sta_vif 0 + if [ "$per_sta_vif" -gt 0 ]; then + append bss_conf "per_sta_vif=$per_sta_vif" "$N" + fi + + json_get_values opts hostapd_bss_options + for val in $opts; do + append bss_conf "$val" "$N" + done + bss_md5sum=$(echo $bss_conf | md5sum | cut -d" " -f1) append bss_conf "config_id=$bss_md5sum" "$N" @@ -751,6 +1059,7 @@ wpa_supplicant_prepare_interface() { fi wpa_supplicant_teardown_interface "$ifname" cat > "$_config" <> "$_config" else cat >> "$_config" < +Date: Tue, 30 Jun 2020 13:53:17 +0200 +Subject: [PATCH 01/19] HE/VHT: fix frequency setup with HE enabled + +Some places in the code base were not using the +wrappers like hostapd_set_oper_centr_freq_seg0_idx +and friends. This could lead to errors, for example when +joining 80 MHz mesh networks. Fix this, by enforcing +usage of these wrappers. + +wpa_supplicant_conf_ap_ht now checks for HE capability +before dealing with VHT in order for these wrappers to work, +as they first check HE support in the config. + +While doing these changes, I've noticed that the extra +channel setup code for mesh networks in wpa_supplicant/mesh.c +should not be necessary anymore and dropped it. +wpa_supplicant_conf_ap_ht should handle this setup already. + +Acked-by: John Crispin +Signed-off-by: Markus Theil +--- + src/ap/dfs.c | 8 ++++---- + wpa_supplicant/ap.c | 40 +++++++++++++++++++++++----------------- + wpa_supplicant/mesh.c | 24 ------------------------ + 3 files changed, 27 insertions(+), 45 deletions(-) + +--- a/src/ap/dfs.c ++++ b/src/ap/dfs.c +@@ -1028,7 +1028,7 @@ static int hostapd_dfs_start_channel_swi + unsigned int i; + int err = 1; + struct hostapd_hw_modes *cmode = iface->current_mode; +- u8 current_vht_oper_chwidth = iface->conf->vht_oper_chwidth; ++ u8 current_vht_oper_chwidth = hostapd_get_oper_chwidth(iface->conf); + + wpa_printf(MSG_DEBUG, "%s called (CAC active: %s, CSA active: %s)", + __func__, iface->cac_started ? "yes" : "no", +@@ -1089,8 +1089,8 @@ static int hostapd_dfs_start_channel_swi + "freq=%d chan=%d sec_chan=%d", channel->freq, + channel->chan, secondary_channel); + +- new_vht_oper_chwidth = iface->conf->vht_oper_chwidth; +- iface->conf->vht_oper_chwidth = current_vht_oper_chwidth; ++ new_vht_oper_chwidth = hostapd_get_oper_chwidth(iface->conf); ++ hostapd_set_oper_chwidth(iface->conf, current_vht_oper_chwidth); + + /* Setup CSA request */ + os_memset(&csa_settings, 0, sizeof(csa_settings)); +@@ -1130,7 +1130,7 @@ static int hostapd_dfs_start_channel_swi + iface->freq = channel->freq; + iface->conf->channel = channel->chan; + iface->conf->secondary_channel = secondary_channel; +- iface->conf->vht_oper_chwidth = new_vht_oper_chwidth; ++ hostapd_set_oper_chwidth(iface->conf, new_vht_oper_chwidth); + hostapd_set_oper_centr_freq_seg0_idx(iface->conf, + oper_centr_freq_seg0_idx); + hostapd_set_oper_centr_freq_seg1_idx(iface->conf, +--- a/wpa_supplicant/ap.c ++++ b/wpa_supplicant/ap.c +@@ -52,6 +52,7 @@ static void wpas_conf_ap_vht(struct wpa_ + #ifdef CONFIG_P2P + u8 center_chan = 0; + u8 channel = conf->channel; ++ u8 freq_seg_idx; + #endif /* CONFIG_P2P */ + + if (!conf->secondary_channel) +@@ -59,19 +60,21 @@ static void wpas_conf_ap_vht(struct wpa_ + + /* Use the maximum oper channel width if it's given. */ + if (ssid->max_oper_chwidth) +- conf->vht_oper_chwidth = ssid->max_oper_chwidth; ++ hostapd_set_oper_chwidth(conf, ssid->max_oper_chwidth); + + ieee80211_freq_to_chan(ssid->vht_center_freq2, +- &conf->vht_oper_centr_freq_seg1_idx); ++ &freq_seg_idx); ++ hostapd_set_oper_centr_freq_seg1_idx(conf, freq_seg_idx); + + if (!ssid->p2p_group) { + if (!ssid->vht_center_freq1 || +- conf->vht_oper_chwidth == CHANWIDTH_USE_HT) ++ hostapd_get_oper_chwidth(conf) == CHANWIDTH_USE_HT) + goto no_vht; + ieee80211_freq_to_chan(ssid->vht_center_freq1, +- &conf->vht_oper_centr_freq_seg0_idx); ++ &freq_seg_idx); ++ hostapd_set_oper_centr_freq_seg0_idx(conf, freq_seg_idx); + wpa_printf(MSG_DEBUG, "VHT seg0 index %d for AP", +- conf->vht_oper_centr_freq_seg0_idx); ++ hostapd_get_oper_centr_freq_seg0_idx(conf)); + return; + } + +@@ -96,14 +99,14 @@ static void wpas_conf_ap_vht(struct wpa_ + * try oper_cwidth 160 MHz first then VHT 80 MHz, if 160 MHz is + * not supported. + */ +- conf->vht_oper_chwidth = CHANWIDTH_160MHZ; ++ hostapd_set_oper_chwidth(conf, CHANWIDTH_160MHZ); + center_chan = wpas_p2p_get_vht160_center(wpa_s, mode, channel); + if (center_chan) { + wpa_printf(MSG_DEBUG, + "VHT center channel %u for auto-selected 160 MHz bandwidth", + center_chan); + } else { +- conf->vht_oper_chwidth = CHANWIDTH_80MHZ; ++ hostapd_set_oper_chwidth(conf, CHANWIDTH_80MHZ); + center_chan = wpas_p2p_get_vht80_center(wpa_s, mode, + channel); + wpa_printf(MSG_DEBUG, +@@ -115,9 +118,9 @@ static void wpas_conf_ap_vht(struct wpa_ + if (!center_chan) + goto no_vht; + +- conf->vht_oper_centr_freq_seg0_idx = center_chan; ++ hostapd_set_oper_centr_freq_seg0_idx(conf, center_chan); + wpa_printf(MSG_DEBUG, "VHT seg0 index %d for P2P GO", +- conf->vht_oper_centr_freq_seg0_idx); ++ hostapd_get_oper_centr_freq_seg0_idx(conf)); + return; + #endif /* CONFIG_P2P */ + +@@ -125,9 +128,9 @@ no_vht: + wpa_printf(MSG_DEBUG, + "No VHT higher bandwidth support for the selected channel %d", + conf->channel); +- conf->vht_oper_centr_freq_seg0_idx = +- conf->channel + conf->secondary_channel * 2; +- conf->vht_oper_chwidth = CHANWIDTH_USE_HT; ++ hostapd_set_oper_centr_freq_seg0_idx(conf, ++ conf->channel + conf->secondary_channel * 2); ++ hostapd_set_oper_chwidth(conf, CHANWIDTH_USE_HT); + } + + +@@ -231,16 +234,19 @@ int wpa_supplicant_conf_ap_ht(struct wpa + HT_CAP_INFO_TX_STBC | + HT_CAP_INFO_MAX_AMSDU_SIZE); + ++ /* check this before VHT, because setting oper chan ++ * width and friends is the same call for HE and VHT ++ * and checks if conf->ieee8021ax == 1 */ ++ if (mode->he_capab[wpas_mode_to_ieee80211_mode( ++ ssid->mode)].he_supported && ++ ssid->he) ++ conf->ieee80211ax = 1; ++ + if (mode->vht_capab && ssid->vht) { + conf->ieee80211ac = 1; + conf->vht_capab |= mode->vht_capab; + wpas_conf_ap_vht(wpa_s, ssid, conf, mode); + } +- +- if (mode->he_capab[wpas_mode_to_ieee80211_mode( +- ssid->mode)].he_supported && +- ssid->he) +- conf->ieee80211ax = 1; + } + } + +--- a/wpa_supplicant/mesh.c ++++ b/wpa_supplicant/mesh.c +@@ -333,30 +333,6 @@ static int wpa_supplicant_mesh_init(stru + frequency); + goto out_free; + } +- if (ssid->ht40) +- conf->secondary_channel = ssid->ht40; +- if (conf->hw_mode == HOSTAPD_MODE_IEEE80211A && ssid->vht) { +- if (ssid->max_oper_chwidth != DEFAULT_MAX_OPER_CHWIDTH) +- conf->vht_oper_chwidth = ssid->max_oper_chwidth; +- switch (conf->vht_oper_chwidth) { +- case CHANWIDTH_80MHZ: +- case CHANWIDTH_80P80MHZ: +- ieee80211_freq_to_chan( +- frequency, +- &conf->vht_oper_centr_freq_seg0_idx); +- conf->vht_oper_centr_freq_seg0_idx += ssid->ht40 * 2; +- break; +- case CHANWIDTH_160MHZ: +- ieee80211_freq_to_chan( +- frequency, +- &conf->vht_oper_centr_freq_seg0_idx); +- conf->vht_oper_centr_freq_seg0_idx += ssid->ht40 * 2; +- conf->vht_oper_centr_freq_seg0_idx += 40 / 5; +- break; +- } +- ieee80211_freq_to_chan(ssid->vht_center_freq2, +- &conf->vht_oper_centr_freq_seg1_idx); +- } + + if (ssid->mesh_basic_rates == NULL) { + /* diff --git a/package/network/services/hostapd/patches/002-mesh-fix-channel-init-order-disable-pri-sec-channel-.patch b/package/network/services/hostapd/patches/002-mesh-fix-channel-init-order-disable-pri-sec-channel-.patch new file mode 100644 index 0000000000..c7101b1dbc --- /dev/null +++ b/package/network/services/hostapd/patches/002-mesh-fix-channel-init-order-disable-pri-sec-channel-.patch @@ -0,0 +1,126 @@ +From d869c753b79a1423c2bd9b0afdfa0d89d55a930c Mon Sep 17 00:00:00 2001 +From: Markus Theil +Date: Tue, 30 Jun 2020 13:53:18 +0200 +Subject: [PATCH 02/19] mesh: fix channel init order, disable pri/sec channel + switch + +wpa_supplicant_conf_ap_ht has to happen before hostapd_setup_interface +in order for its configuration settings to have effect on interface +configuration. + +Disable primary and secondary channel switch because of missing tie +breaking rule/frames in mesh networks. A rather long comment about +this issue is placed in mesh.c in the corresponding place. + +In consequence, remove mesh coex test, which contradicts this change. + +I was not able to reproduce the memory corruption during +mesh_secure_ocv_mix_legacy, which lead to a revert of a similar patch +in the past. + +Signed-off-by: Markus Theil +--- + tests/hwsim/test_wpas_mesh.py | 50 ----------------------------------- + wpa_supplicant/mesh.c | 25 ++++++++++++++++-- + 2 files changed, 23 insertions(+), 52 deletions(-) + +--- a/tests/hwsim/test_wpas_mesh.py ++++ b/tests/hwsim/test_wpas_mesh.py +@@ -933,56 +933,6 @@ def _test_wpas_mesh_open_5ghz(dev, apdev + dev[0].dump_monitor() + dev[1].dump_monitor() + +-def test_wpas_mesh_open_5ghz_coex(dev, apdev): +- """Mesh network on 5 GHz band and 20/40 coex change""" +- try: +- _test_wpas_mesh_open_5ghz_coex(dev, apdev) +- finally: +- dev[0].request("MESH_GROUP_REMOVE " + dev[0].ifname) +- dev[1].request("MESH_GROUP_REMOVE " + dev[1].ifname) +- set_world_reg(apdev0=apdev[0], dev0=dev[0]) +- dev[0].flush_scan_cache() +- dev[1].flush_scan_cache() +- +-def _test_wpas_mesh_open_5ghz_coex(dev, apdev): +- check_mesh_support(dev[0]) +- subprocess.call(['iw', 'reg', 'set', 'US']) +- +- # Start a 20 MHz BSS on channel 40 that would be the secondary channel of +- # HT40+ mesh on channel 36. +- params = {"ssid": "test-ht40", +- "hw_mode": "a", +- "channel": "40", +- "country_code": "US"} +- hapd = hostapd.add_ap(apdev[0], params) +- bssid = hapd.own_addr() +- +- for i in range(2): +- for j in range(5): +- ev = dev[i].wait_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=5) +- if ev is None: +- raise Exception("No regdom change event") +- if "alpha2=US" in ev: +- break +- dev[i].scan_for_bss(bssid, freq=5200) +- add_open_mesh_network(dev[i], freq="5180") +- +- check_mesh_joined_connected(dev) +- +- freq = dev[0].get_status_field("freq") +- if freq != "5200": +- raise Exception("Unexpected STATUS freq=" + freq) +- sig = dev[0].request("SIGNAL_POLL").splitlines() +- if "FREQUENCY=5200" not in sig: +- raise Exception("Unexpected SIGNAL_POLL output: " + str(sig)) +- +- hapd.disable() +- dev[0].mesh_group_remove() +- dev[1].mesh_group_remove() +- check_mesh_group_removed(dev[0]) +- check_mesh_group_removed(dev[1]) +- dev[0].dump_monitor() +- dev[1].dump_monitor() + + def test_wpas_mesh_open_ht40(dev, apdev): + """Mesh and HT40 support difference""" +--- a/wpa_supplicant/mesh.c ++++ b/wpa_supplicant/mesh.c +@@ -363,6 +363,29 @@ static int wpa_supplicant_mesh_init(stru + conf->basic_rates[rate_len] = -1; + } + ++ /* While it can enhance performance to switch the primary channel, which ++ * is also the secondary channel of another network at the same time), ++ * to the other primary channel, problems exist with this in mesh networks. ++ * ++ * Example with problems: ++ * - 3 mesh nodes M1-M3, freq (5200, 5180) ++ * - other node O1, e.g. AP mode, freq (5180, 5200), ++ * Locations: O1 M1 M2 M3 ++ * ++ * M3 can only send frames to M1 over M2, no direct connection is possible ++ * Start O1, M1 and M3 first, M1 or O1 will switch channels to align with ++ * each other. M3 does not swap, because M1 or O1 cannot be reached. ++ * M2 is started afterwards and can either connect to M3 or M1 because of ++ * this primary secondary channel switch. ++ * ++ * Solutions: (1) central coordination -> not always possible ++ * (2) disable pri/sec channel switch in mesh networks ++ * ++ * In AP mode, when all nodes can work independently, this poses of course ++ * no problem, therefore disable it only in mesh mode.`*/ ++ conf->no_pri_sec_switch = 1; ++ wpa_supplicant_conf_ap_ht(wpa_s, ssid, conf); ++ + if (wpa_drv_init_mesh(wpa_s)) { + wpa_msg(wpa_s, MSG_ERROR, "Failed to init mesh in driver"); + return -1; +@@ -374,8 +397,6 @@ static int wpa_supplicant_mesh_init(stru + return -1; + } + +- wpa_supplicant_conf_ap_ht(wpa_s, ssid, conf); +- + return 0; + out_free: + wpa_supplicant_mesh_deinit(wpa_s); diff --git a/package/network/services/hostapd/patches/003-wpa_supplicant-handle-HT40-and-mode-downgrade-in-AP-.patch b/package/network/services/hostapd/patches/003-wpa_supplicant-handle-HT40-and-mode-downgrade-in-AP-.patch new file mode 100644 index 0000000000..f42620042d --- /dev/null +++ b/package/network/services/hostapd/patches/003-wpa_supplicant-handle-HT40-and-mode-downgrade-in-AP-.patch @@ -0,0 +1,102 @@ +From 978a59514ccde994b5c06e1cbb49cc8cebe6381c Mon Sep 17 00:00:00 2001 +From: Markus Theil +Date: Tue, 30 Jun 2020 13:53:19 +0200 +Subject: [PATCH 03/19] wpa_supplicant: handle HT40 and mode downgrade in AP + mode + +This patch adds some missing pieces to the interface configuration +of AP/mesh mode in wpa_supplicant. + - check for secondary channel and HT40 capability + - try to downgrade to 11b if 11g is not available +Especially with the HT40 check, this code now performs all settings, +which the deleted/duplicated mesh code did. + +Signed-off-by: Markus Theil +--- + wpa_supplicant/ap.c | 49 ++++++++++++++++++++++++++++++++++++--------- + 1 file changed, 40 insertions(+), 9 deletions(-) + +--- a/wpa_supplicant/ap.c ++++ b/wpa_supplicant/ap.c +@@ -134,6 +134,23 @@ no_vht: + } + + ++static struct hostapd_hw_modes *wpa_supplicant_find_hw_mode(struct wpa_supplicant *wpa_s, ++ enum hostapd_hw_mode hw_mode) ++{ ++ struct hostapd_hw_modes *mode = NULL; ++ int i; ++ ++ for (i = 0; i < wpa_s->hw.num_modes; i++) { ++ if (wpa_s->hw.modes[i].mode == hw_mode) { ++ mode = &wpa_s->hw.modes[i]; ++ break; ++ } ++ } ++ ++ return mode; ++} ++ ++ + int wpa_supplicant_conf_ap_ht(struct wpa_supplicant *wpa_s, + struct wpa_ssid *ssid, + struct hostapd_config *conf) +@@ -147,9 +164,6 @@ int wpa_supplicant_conf_ap_ht(struct wpa + return -1; + } + +- /* TODO: enable HT40 if driver supports it; +- * drop to 11b if driver does not support 11g */ +- + /* + * Enable HT20 if the driver supports it, by setting conf->ieee80211n + * and a mask of allowed capabilities within conf->ht_capab. +@@ -158,17 +172,27 @@ int wpa_supplicant_conf_ap_ht(struct wpa + */ + if (wpa_s->hw.modes) { + struct hostapd_hw_modes *mode = NULL; +- int i, no_ht = 0; ++ int no_ht = 0; + + wpa_printf(MSG_DEBUG, + "Determining HT/VHT options based on driver capabilities (freq=%u chan=%u)", + ssid->frequency, conf->channel); + +- for (i = 0; i < wpa_s->hw.num_modes; i++) { +- if (wpa_s->hw.modes[i].mode == conf->hw_mode) { +- mode = &wpa_s->hw.modes[i]; +- break; +- } ++ mode = wpa_supplicant_find_hw_mode(wpa_s, conf->hw_mode); ++ ++ /* may drop drop to 11b if driver does not support 11g */ ++ if (!mode && conf->hw_mode == HOSTAPD_MODE_IEEE80211G) { ++ conf->hw_mode = HOSTAPD_MODE_IEEE80211B; ++ wpa_printf(MSG_INFO, ++ "Try downgrade to IEEE 802.11b as 802.11g is not " ++ "supported by the current hardware"); ++ mode = wpa_supplicant_find_hw_mode(wpa_s, conf->hw_mode); ++ } ++ ++ if (!mode) { ++ wpa_printf(MSG_ERROR, ++ "No match between requested and supported hw modes found"); ++ return -1; + } + + #ifdef CONFIG_HT_OVERRIDES +@@ -193,6 +217,13 @@ int wpa_supplicant_conf_ap_ht(struct wpa + HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET), + ssid->ht40); + conf->ieee80211n = 1; ++ ++ if (ssid->ht40 && ++ mode->ht_capab & HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET) ++ conf->secondary_channel = ssid->ht40; ++ else ++ conf->secondary_channel = 0; ++ + #ifdef CONFIG_P2P + if (ssid->p2p_group && + conf->hw_mode == HOSTAPD_MODE_IEEE80211A && diff --git a/package/network/services/hostapd/patches/004-wpa_supplicant-fix-frequency-config-for-non-p2p-vht-.patch b/package/network/services/hostapd/patches/004-wpa_supplicant-fix-frequency-config-for-non-p2p-vht-.patch new file mode 100644 index 0000000000..e8682af644 --- /dev/null +++ b/package/network/services/hostapd/patches/004-wpa_supplicant-fix-frequency-config-for-non-p2p-vht-.patch @@ -0,0 +1,63 @@ +From 7f7325dae1d03a3964d4e91940d8369f3fed7b43 Mon Sep 17 00:00:00 2001 +From: Markus Theil +Date: Tue, 30 Jun 2020 13:53:20 +0200 +Subject: [PATCH 04/19] wpa_supplicant: fix frequency config for non p2p vht/he + cases + +Fix compile without CONFIG_P2P and only set secondary channel seg idx +if we use a mode supporting a sec channel for vht/he. + +Signed-off-by: Markus Theil +--- + wpa_supplicant/ap.c | 23 +++++++++++++---------- + 1 file changed, 13 insertions(+), 10 deletions(-) + +--- a/wpa_supplicant/ap.c ++++ b/wpa_supplicant/ap.c +@@ -52,8 +52,8 @@ static void wpas_conf_ap_vht(struct wpa_ + #ifdef CONFIG_P2P + u8 center_chan = 0; + u8 channel = conf->channel; +- u8 freq_seg_idx; + #endif /* CONFIG_P2P */ ++ u8 freq_seg_idx; + + if (!conf->secondary_channel) + goto no_vht; +@@ -62,24 +62,27 @@ static void wpas_conf_ap_vht(struct wpa_ + if (ssid->max_oper_chwidth) + hostapd_set_oper_chwidth(conf, ssid->max_oper_chwidth); + +- ieee80211_freq_to_chan(ssid->vht_center_freq2, +- &freq_seg_idx); +- hostapd_set_oper_centr_freq_seg1_idx(conf, freq_seg_idx); +- + if (!ssid->p2p_group) { +- if (!ssid->vht_center_freq1 || +- hostapd_get_oper_chwidth(conf) == CHANWIDTH_USE_HT) ++ if (!ssid->vht_center_freq1) + goto no_vht; + ieee80211_freq_to_chan(ssid->vht_center_freq1, + &freq_seg_idx); + hostapd_set_oper_centr_freq_seg0_idx(conf, freq_seg_idx); +- wpa_printf(MSG_DEBUG, "VHT seg0 index %d for AP", +- hostapd_get_oper_centr_freq_seg0_idx(conf)); ++ ++ if (hostapd_get_oper_chwidth(conf) == CHANWIDTH_80P80MHZ) { ++ ieee80211_freq_to_chan(ssid->vht_center_freq2, ++ &freq_seg_idx); ++ hostapd_set_oper_centr_freq_seg1_idx(conf, freq_seg_idx); ++ } ++ ++ wpa_printf(MSG_DEBUG, "VHT seg0 index %d and seg1 index %d for AP", ++ hostapd_get_oper_centr_freq_seg0_idx(conf), ++ hostapd_get_oper_centr_freq_seg1_idx(conf)); + return; + } + + #ifdef CONFIG_P2P +- switch (conf->vht_oper_chwidth) { ++ switch (hostapd_get_oper_chwidth(conf)) { + case CHANWIDTH_80MHZ: + case CHANWIDTH_80P80MHZ: + center_chan = wpas_p2p_get_vht80_center(wpa_s, mode, channel); diff --git a/package/network/services/hostapd/patches/005-wpa_supplicant-enable-vht-and-he-in-default-config-p.patch b/package/network/services/hostapd/patches/005-wpa_supplicant-enable-vht-and-he-in-default-config-p.patch new file mode 100644 index 0000000000..25d74252cd --- /dev/null +++ b/package/network/services/hostapd/patches/005-wpa_supplicant-enable-vht-and-he-in-default-config-p.patch @@ -0,0 +1,25 @@ +From ff7fb3fa0831c8521327d777c5607a3b7d8736b8 Mon Sep 17 00:00:00 2001 +From: Markus Theil +Date: Tue, 30 Jun 2020 13:53:21 +0200 +Subject: [PATCH 05/19] wpa_supplicant: enable vht and he in default config + parameters + +Enable VHT and HE as default config parameters in order for +wpa_supplicant AP mode to use it, if hw support is given. + +Signed-off-by: Markus Theil +--- + wpa_supplicant/config.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/wpa_supplicant/config.c ++++ b/wpa_supplicant/config.c +@@ -3036,6 +3036,8 @@ void wpa_config_set_network_defaults(str + ssid->wpa_deny_ptk0_rekey = PTK0_REKEY_ALLOW_ALWAYS; + ssid->bg_scan_period = DEFAULT_BG_SCAN_PERIOD; + ssid->ht = 1; ++ ssid->vht = 1; ++ ssid->he = 1; + #ifdef IEEE8021X_EAPOL + ssid->eapol_flags = DEFAULT_EAPOL_FLAGS; + ssid->eap_workaround = DEFAULT_EAP_WORKAROUND; diff --git a/package/network/services/hostapd/patches/006-hw_features-better-debug-messages-for-some-error-cas.patch b/package/network/services/hostapd/patches/006-hw_features-better-debug-messages-for-some-error-cas.patch new file mode 100644 index 0000000000..31b1ac0d38 --- /dev/null +++ b/package/network/services/hostapd/patches/006-hw_features-better-debug-messages-for-some-error-cas.patch @@ -0,0 +1,83 @@ +From 6522dcbbcf71abcb80cce84b93b4a9a5cfcd4fca Mon Sep 17 00:00:00 2001 +From: Markus Theil +Date: Tue, 30 Jun 2020 13:53:22 +0200 +Subject: [PATCH 06/19] hw_features: better debug messages for some error cases + +Signed-off-by: Markus Theil +--- + src/common/hw_features_common.c | 29 ++++++++++++++++++++++------- + 1 file changed, 22 insertions(+), 7 deletions(-) + +--- a/src/common/hw_features_common.c ++++ b/src/common/hw_features_common.c +@@ -540,13 +540,18 @@ int hostapd_set_freq_params(struct hosta + if (center_segment1 || + (center_segment0 != 0 && + 5000 + center_segment0 * 5 != data->center_freq1 && +- 2407 + center_segment0 * 5 != data->center_freq1)) ++ 2407 + center_segment0 * 5 != data->center_freq1)) { ++ wpa_printf(MSG_ERROR, "20/40 MHz: center segment 0 (=%i) and center freq 1 (=%i) not in sync", ++ center_segment0, data->center_freq1); + return -1; ++ } + break; + case CHANWIDTH_80P80MHZ: + if (center_segment1 == center_segment0 + 4 || +- center_segment1 == center_segment0 - 4) ++ center_segment1 == center_segment0 - 4) { ++ wpa_printf(MSG_ERROR, "80+80 MHz: center segment 1 only 20 MHz apart"); + return -1; ++ } + data->center_freq2 = 5000 + center_segment1 * 5; + /* fall through */ + case CHANWIDTH_80MHZ: +@@ -555,8 +560,10 @@ int hostapd_set_freq_params(struct hosta + center_segment1) || + (oper_chwidth == CHANWIDTH_80P80MHZ && + !center_segment1) || +- !sec_channel_offset) ++ !sec_channel_offset) { ++ wpa_printf(MSG_ERROR, "80/80+80 MHz: center segment 1 wrong or no second channel offset"); + return -1; ++ } + if (!center_segment0) { + if (channel <= 48) + center_segment0 = 42; +@@ -582,16 +589,22 @@ int hostapd_set_freq_params(struct hosta + center_segment0 == channel - 2 || + center_segment0 == channel - 6) + data->center_freq1 = 5000 + center_segment0 * 5; +- else ++ else { ++ wpa_printf(MSG_ERROR, "Wrong coupling between HT and VHT/HE channel setting"); + return -1; ++ } + } + break; + case CHANWIDTH_160MHZ: + data->bandwidth = 160; +- if (center_segment1) ++ if (center_segment1) { ++ wpa_printf(MSG_ERROR, "160 MHz: center segment 1 should not be set"); + return -1; +- if (!sec_channel_offset) ++ } ++ if (!sec_channel_offset) { ++ wpa_printf(MSG_ERROR, "160 MHz: second channel offset not set"); + return -1; ++ } + /* + * Note: HT/VHT config and params are coupled. Check if + * HT40 channel band is in VHT160 channel band configuration. +@@ -605,8 +618,10 @@ int hostapd_set_freq_params(struct hosta + center_segment0 == channel - 10 || + center_segment0 == channel - 14) + data->center_freq1 = 5000 + center_segment0 * 5; +- else ++ else { ++ wpa_printf(MSG_ERROR, "160 MHz: HT40 channel band is not in 160 MHz band"); + return -1; ++ } + break; + } + diff --git a/package/network/services/hostapd/patches/007-dfs-use-helper-functions-for-vht-he-parameters.patch b/package/network/services/hostapd/patches/007-dfs-use-helper-functions-for-vht-he-parameters.patch new file mode 100644 index 0000000000..3481c52eef --- /dev/null +++ b/package/network/services/hostapd/patches/007-dfs-use-helper-functions-for-vht-he-parameters.patch @@ -0,0 +1,27 @@ +From 6eacc14904b6f09a1490e697c01adf5dc56c4905 Mon Sep 17 00:00:00 2001 +From: Markus Theil +Date: Tue, 30 Jun 2020 13:53:23 +0200 +Subject: [PATCH 07/19] dfs: use helper functions for vht/he parameters + +Signed-off-by: Markus Theil +--- + src/ap/dfs.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +--- a/src/ap/dfs.c ++++ b/src/ap/dfs.c +@@ -955,10 +955,12 @@ dfs_downgrade_bandwidth(struct hostapd_i + if (*skip_radar) { + *skip_radar = 0; + } else { +- if (iface->conf->vht_oper_chwidth == CHANWIDTH_USE_HT) ++ int oper_chwidth = hostapd_get_oper_chwidth(iface->conf); ++ ++ if (oper_chwidth == CHANWIDTH_USE_HT) + break; + *skip_radar = 1; +- iface->conf->vht_oper_chwidth--; ++ hostapd_set_oper_chwidth(iface->conf, oper_chwidth - 1); + } + } + diff --git a/package/network/services/hostapd/patches/007-mesh-apply-channel-attributes-before-running-Mesh.patch b/package/network/services/hostapd/patches/007-mesh-apply-channel-attributes-before-running-Mesh.patch deleted file mode 100644 index f04fcc49e8..0000000000 --- a/package/network/services/hostapd/patches/007-mesh-apply-channel-attributes-before-running-Mesh.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 2564184440d9d6041d11a8c7d50b31368634c3bd Mon Sep 17 00:00:00 2001 -From: Peter Oh -Date: Mon, 27 Aug 2018 14:28:40 -0700 -Subject: [PATCH] mesh: Apply channel attributes before setup interface - -This helps mesh interface initialization with correct channel -parameters. - -Signed-off-by: Peter Oh ---- - wpa_supplicant/mesh.c | 11 ++++++++--- - 1 file changed, 8 insertions(+), 3 deletions(-) - ---- a/wpa_supplicant/mesh.c -+++ b/wpa_supplicant/mesh.c -@@ -249,7 +249,7 @@ static int wpa_supplicant_mesh_init(stru - struct mesh_conf *mconf; - int basic_rates_erp[] = { 10, 20, 55, 60, 110, 120, 240, -1 }; - int rate_len; -- int frequency; -+ int frequency, saved_freq; - - if (!wpa_s->conf->user_mpm) { - /* not much for us to do here */ -@@ -386,6 +386,13 @@ static int wpa_supplicant_mesh_init(stru - conf->basic_rates[rate_len] = -1; - } - -+ /* Handle pri/sec switch frequency within AP configuration parameter -+ * generation without changing the stored network profile in the end. */ -+ saved_freq = ssid->frequency; -+ ssid->frequency = frequency; -+ wpa_supplicant_conf_ap_ht(wpa_s, ssid, conf); -+ ssid->frequency = saved_freq; -+ - if (wpa_drv_init_mesh(wpa_s)) { - wpa_msg(wpa_s, MSG_ERROR, "Failed to init mesh in driver"); - return -1; -@@ -397,8 +404,6 @@ static int wpa_supplicant_mesh_init(stru - return -1; - } - -- wpa_supplicant_conf_ap_ht(wpa_s, ssid, conf); -- - return 0; - out_free: - wpa_supplicant_mesh_deinit(wpa_s); diff --git a/package/network/services/hostapd/patches/004-mesh-use-setup-completion-callback-to-complete-mesh-.patch b/package/network/services/hostapd/patches/008-mesh-use-setup-completion-callback-to-complete-mesh-.patch similarity index 55% rename from package/network/services/hostapd/patches/004-mesh-use-setup-completion-callback-to-complete-mesh-.patch rename to package/network/services/hostapd/patches/008-mesh-use-setup-completion-callback-to-complete-mesh-.patch index 3d99b3bfb9..28c283d035 100644 --- a/package/network/services/hostapd/patches/004-mesh-use-setup-completion-callback-to-complete-mesh-.patch +++ b/package/network/services/hostapd/patches/008-mesh-use-setup-completion-callback-to-complete-mesh-.patch @@ -1,7 +1,8 @@ -From c05ace7510ead96e72b97ce47b33f7b5865d6d36 Mon Sep 17 00:00:00 2001 +From 11e5bbe58eebdb10793eec374b6c8ccc7daf7ec8 Mon Sep 17 00:00:00 2001 From: Peter Oh -Date: Mon, 27 Aug 2018 14:28:38 -0700 -Subject: [PATCH 1/7] mesh: use setup completion callback to complete mesh join +Date: Tue, 30 Jun 2020 14:18:56 +0200 +Subject: [PATCH 08/19] mesh: use setup completion callback to complete mesh + join mesh join function is the last function to be called during mesh join process, but it's been called a bit earlier than @@ -16,16 +17,15 @@ The callback will be called by hostapd_setup_interface_complete_sync. There is possiblity that completing mesh init fails, so add error handle codes. -Signed-off-by: Peter Oh Signed-off-by: Peter Oh --- src/ap/hostapd.c | 11 ++++++++++- - wpa_supplicant/mesh.c | 13 +++++++------ - 2 files changed, 17 insertions(+), 7 deletions(-) + wpa_supplicant/mesh.c | 12 ++++++++++-- + 2 files changed, 20 insertions(+), 3 deletions(-) --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c -@@ -423,6 +423,8 @@ static void hostapd_free_hapd_data(struc +@@ -434,6 +434,8 @@ static void hostapd_free_hapd_data(struc #ifdef CONFIG_MESH wpabuf_free(hapd->mesh_pending_auth); hapd->mesh_pending_auth = NULL; @@ -34,12 +34,12 @@ Signed-off-by: Peter Oh #endif /* CONFIG_MESH */ hostapd_clean_rrm(hapd); -@@ -2049,6 +2051,13 @@ dfs_offload: +@@ -2156,6 +2158,13 @@ dfs_offload: if (hapd->setup_complete_cb) hapd->setup_complete_cb(hapd->setup_complete_cb_ctx); +#ifdef CONFIG_MESH -+ if (delay_apply_cfg && !iface->mconf) { ++ if (delay_apply_cfg && iface->mconf == NULL) { + wpa_printf(MSG_ERROR, "Error while completing mesh init"); + goto fail; + } @@ -48,64 +48,48 @@ Signed-off-by: Peter Oh wpa_printf(MSG_DEBUG, "%s: Setup of interface done.", iface->bss[0]->conf->iface); if (iface->interfaces && iface->interfaces->terminate_on_error > 0) -@@ -2192,7 +2201,7 @@ int hostapd_setup_interface(struct hosta +@@ -2299,7 +2308,7 @@ int hostapd_setup_interface(struct hosta ret = setup_interface(iface); if (ret) { wpa_printf(MSG_ERROR, "%s: Unable to setup interface.", - iface->bss[0]->conf->iface); -+ iface->conf ? iface->conf->bss[0]->iface : "N/A"); ++ iface->conf ? iface->conf->bss[0]->iface : "N/A"); return -1; } --- a/wpa_supplicant/mesh.c +++ b/wpa_supplicant/mesh.c -@@ -190,8 +190,9 @@ static int wpas_mesh_init_rsn(struct wpa +@@ -193,7 +193,6 @@ static int wpas_mesh_init_rsn(struct wpa + return !wpa_s->mesh_rsn ? -1 : 0; } - --static int wpas_mesh_complete(struct wpa_supplicant *wpa_s) -+static void wpas_mesh_complete_cb(void *ctx) - { -+ struct wpa_supplicant *wpa_s = ctx; - struct hostapd_iface *ifmsh = wpa_s->ifmsh; - struct wpa_driver_mesh_join_params *params = wpa_s->mesh_params; - struct wpa_ssid *ssid = wpa_s->current_ssid; -@@ -200,7 +201,7 @@ static int wpas_mesh_complete(struct wpa - if (!params || !ssid || !ifmsh) { - wpa_printf(MSG_ERROR, "mesh: %s called without active mesh", - __func__); -- return -1; -+ return; - } - - if (ifmsh->mconf->security != MESH_CONF_SEC_NONE && -@@ -209,7 +210,7 @@ static int wpas_mesh_complete(struct wpa - "mesh: RSN initialization failed - deinit mesh"); - wpa_supplicant_mesh_deinit(wpa_s); - wpa_drv_leave_mesh(wpa_s); -- return -1; -+ return; - } - - if (ssid->key_mgmt & WPA_KEY_MGMT_SAE) { -@@ -235,8 +236,6 @@ static int wpas_mesh_complete(struct wpa - - if (!ret) - wpa_supplicant_set_state(wpa_s, WPA_COMPLETED); - -- return ret; + static int wpas_mesh_complete(struct wpa_supplicant *wpa_s) + { + struct hostapd_iface *ifmsh = wpa_s->ifmsh; +@@ -244,6 +243,13 @@ static int wpas_mesh_complete(struct wpa } -@@ -263,6 +262,7 @@ static int wpa_supplicant_mesh_init(stru ++static void wpas_mesh_complete_cb(void *arg) ++{ ++ struct wpa_supplicant *wpa_s = arg; ++ wpas_mesh_complete(wpa_s); ++} ++ ++ + static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s, + struct wpa_ssid *ssid, + struct hostapd_freq_params *freq) +@@ -267,6 +273,7 @@ static int wpa_supplicant_mesh_init(stru if (!ifmsh) return -ENOMEM; + ifmsh->owner = wpa_s; ifmsh->drv_flags = wpa_s->drv_flags; + ifmsh->drv_flags2 = wpa_s->drv_flags2; ifmsh->num_bss = 1; - ifmsh->bss = os_calloc(wpa_s->ifmsh->num_bss, -@@ -280,6 +280,8 @@ static int wpa_supplicant_mesh_init(stru +@@ -285,6 +292,8 @@ static int wpa_supplicant_mesh_init(stru bss->drv_priv = wpa_s->drv_priv; bss->iface = ifmsh; bss->mesh_sta_free_cb = mesh_mpm_free_sta; @@ -114,7 +98,7 @@ Signed-off-by: Peter Oh frequency = ssid->frequency; if (frequency != freq->freq && frequency == freq->freq + freq->sec_channel_offset * 20) { -@@ -521,7 +523,6 @@ int wpa_supplicant_join_mesh(struct wpa_ +@@ -523,7 +532,6 @@ int wpa_supplicant_join_mesh(struct wpa_ goto out; } diff --git a/package/network/services/hostapd/patches/005-mesh-update-ssid-frequency-as-pri-sec-channel-switch.patch b/package/network/services/hostapd/patches/009-mesh-update-ssid-frequency-as-pri-sec-channel-switch.patch similarity index 75% rename from package/network/services/hostapd/patches/005-mesh-update-ssid-frequency-as-pri-sec-channel-switch.patch rename to package/network/services/hostapd/patches/009-mesh-update-ssid-frequency-as-pri-sec-channel-switch.patch index 4d77f2d206..b48de67636 100644 --- a/package/network/services/hostapd/patches/005-mesh-update-ssid-frequency-as-pri-sec-channel-switch.patch +++ b/package/network/services/hostapd/patches/009-mesh-update-ssid-frequency-as-pri-sec-channel-switch.patch @@ -1,7 +1,7 @@ -From c56f18380d1d404a2abc0ea5373d294508ef1e54 Mon Sep 17 00:00:00 2001 +From 87c5e8883898e7eb8e9637e212350c1925a22654 Mon Sep 17 00:00:00 2001 From: Peter Oh -Date: Mon, 27 Aug 2018 14:28:41 -0700 -Subject: [PATCH 2/7] mesh: update ssid->frequency as pri/sec channel switch +Date: Tue, 30 Jun 2020 14:18:57 +0200 +Subject: [PATCH 09/19] mesh: update ssid->frequency as pri/sec channel switch ssid->frequency is one of variables used to gets channel number from given frequency. Leave it as unchanged when @@ -16,7 +16,7 @@ Signed-off-by: Peter Oh --- a/wpa_supplicant/mesh.c +++ b/wpa_supplicant/mesh.c -@@ -287,6 +287,7 @@ static int wpa_supplicant_mesh_init(stru +@@ -299,6 +299,7 @@ static int wpa_supplicant_mesh_init(stru frequency == freq->freq + freq->sec_channel_offset * 20) { wpa_printf(MSG_DEBUG, "mesh: pri/sec channels switched"); frequency = freq->freq; diff --git a/package/network/services/hostapd/patches/011-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch b/package/network/services/hostapd/patches/010-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch similarity index 71% rename from package/network/services/hostapd/patches/011-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch rename to package/network/services/hostapd/patches/010-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch index 37f7f635ea..8afeba93ed 100644 --- a/package/network/services/hostapd/patches/011-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch +++ b/package/network/services/hostapd/patches/010-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch @@ -1,28 +1,29 @@ -From 89fa0d75fb1be82330258082ed3d7fd452eb6076 Mon Sep 17 00:00:00 2001 +From 8de8cd8380af0c43d4fde67a668d79ef73b26b26 Mon Sep 17 00:00:00 2001 From: Peter Oh -Date: Mon, 27 Aug 2018 14:28:45 -0700 -Subject: [PATCH 3/7] mesh: Allow DFS channels to be selected if dfs is enabled +Date: Tue, 30 Jun 2020 14:18:58 +0200 +Subject: [PATCH 10/19] mesh: Allow DFS channels to be selected if dfs is + enabled Note: DFS is assumed to be usable if a country code has been set Signed-off-by: Benjamin Berg Signed-off-by: Peter Oh --- - wpa_supplicant/wpa_supplicant.c | 24 ++++++++++++++++++------ - 1 file changed, 18 insertions(+), 6 deletions(-) + wpa_supplicant/wpa_supplicant.c | 25 +++++++++++++++++++------ + 1 file changed, 19 insertions(+), 6 deletions(-) --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -2153,6 +2153,8 @@ void ibss_mesh_setup_freq(struct wpa_sup - struct hostapd_freq_params vht_freq; +@@ -2349,6 +2349,8 @@ void ibss_mesh_setup_freq(struct wpa_sup int chwidth, seg0, seg1; u32 vht_caps = 0; + int is_24ghz; + int dfs_enabled = wpa_s->conf->country[0] && -+ (wpa_s->drv_flags & WPA_DRIVER_FLAGS_RADAR); ++ (wpa_s->drv_flags & WPA_DRIVER_FLAGS_RADAR); freq->freq = ssid->frequency; -@@ -2232,8 +2234,11 @@ void ibss_mesh_setup_freq(struct wpa_sup +@@ -2436,8 +2438,11 @@ void ibss_mesh_setup_freq(struct wpa_sup return; /* Check primary channel flags */ @@ -35,7 +36,7 @@ Signed-off-by: Peter Oh freq->channel = pri_chan->chan; -@@ -2264,8 +2269,11 @@ void ibss_mesh_setup_freq(struct wpa_sup +@@ -2470,8 +2475,11 @@ void ibss_mesh_setup_freq(struct wpa_sup return; /* Check secondary channel flags */ @@ -48,7 +49,7 @@ Signed-off-by: Peter Oh if (ht40 == -1) { if (!(pri_chan->flag & HOSTAPD_CHAN_HT40MINUS)) -@@ -2356,8 +2364,11 @@ skip_ht40: +@@ -2564,8 +2572,11 @@ skip_ht40: return; /* Back to HT configuration if channel not usable */ @@ -61,7 +62,7 @@ Signed-off-by: Peter Oh } chwidth = CHANWIDTH_80MHZ; -@@ -2377,10 +2388,11 @@ skip_ht40: +@@ -2585,10 +2596,12 @@ skip_ht40: if (!chan) continue; @@ -70,7 +71,8 @@ Signed-off-by: Peter Oh - HOSTAPD_CHAN_RADAR)) + if (chan->flag & HOSTAPD_CHAN_DISABLED) continue; -+ if (chan->flag & (HOSTAPD_CHAN_RADAR | HOSTAPD_CHAN_NO_IR)) ++ if (chan->flag & (HOSTAPD_CHAN_RADAR | ++ HOSTAPD_CHAN_NO_IR)) + if (!dfs_enabled) + continue; diff --git a/package/network/services/hostapd/patches/015-mesh-do-not-use-offchan-mgmt-tx-on-DFS.patch b/package/network/services/hostapd/patches/011-mesh-do-not-set-offchanok-on-DFS-channels-in-non-ETS.patch similarity index 59% rename from package/network/services/hostapd/patches/015-mesh-do-not-use-offchan-mgmt-tx-on-DFS.patch rename to package/network/services/hostapd/patches/011-mesh-do-not-set-offchanok-on-DFS-channels-in-non-ETS.patch index 8bac9082d7..d491f7c4bc 100644 --- a/package/network/services/hostapd/patches/015-mesh-do-not-use-offchan-mgmt-tx-on-DFS.patch +++ b/package/network/services/hostapd/patches/011-mesh-do-not-set-offchanok-on-DFS-channels-in-non-ETS.patch @@ -1,7 +1,7 @@ -From 71e9c65a7c8af90a5fd11072062b596421316452 Mon Sep 17 00:00:00 2001 +From af8dcbc87466ed6472850a4f1cfe252652cb3d26 Mon Sep 17 00:00:00 2001 From: Peter Oh -Date: Mon, 27 Aug 2018 14:28:46 -0700 -Subject: [PATCH 4/7] mesh: do not set offchanok on DFS channels in non-ETSI +Date: Tue, 30 Jun 2020 14:18:59 +0200 +Subject: [PATCH 11/19] mesh: do not set offchanok on DFS channels in non-ETSI mac80211 does not allow mgmt tx to use off channel on DFS channels in non-ETSI domain, because it will invalidate @@ -12,23 +12,24 @@ in non-ETSI. Signed-off-by: Peter Oh --- - src/drivers/driver_nl80211.c | 21 ++++++++++++++++++++- - 1 file changed, 20 insertions(+), 1 deletion(-) + src/drivers/driver_nl80211.c | 19 +++++++++++++++++++ + 1 file changed, 19 insertions(+) --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -7462,6 +7462,10 @@ static int wpa_driver_nl80211_send_actio +@@ -7788,7 +7788,11 @@ static int wpa_driver_nl80211_send_actio int ret = -1; u8 *buf; struct ieee80211_hdr *hdr; + struct hostapd_hw_modes *modes; -+ int i, offchanok = 1; + int offchanok = 1; + u16 num_modes, flags; + u8 dfs_domain; ++ int i; - wpa_printf(MSG_DEBUG, "nl80211: Send Action frame (ifindex=%d, " - "freq=%u MHz wait=%d ms no_cck=%d)", -@@ -7486,6 +7490,21 @@ static int wpa_driver_nl80211_send_actio + if (is_ap_interface(drv->nlmode) && (int) freq == bss->freq && + bss->beacon_set) +@@ -7817,6 +7821,21 @@ static int wpa_driver_nl80211_send_actio os_memset(bss->rand_addr, 0, ETH_ALEN); } @@ -50,12 +51,3 @@ Signed-off-by: Peter Oh if (is_ap_interface(drv->nlmode) && (!(drv->capa.flags & WPA_DRIVER_FLAGS_OFFCHANNEL_TX) || (int) freq == bss->freq || drv->device_ap_sme || -@@ -7497,7 +7516,7 @@ static int wpa_driver_nl80211_send_actio - ret = nl80211_send_frame_cmd(bss, freq, wait_time, buf, - 24 + data_len, - &drv->send_action_cookie, -- no_cck, 0, 1, NULL, 0); -+ no_cck, 0, offchanok, NULL, 0); - - os_free(buf); - return ret; diff --git a/package/network/services/hostapd/patches/016-mesh-fix-channel-switch-error-during-CAC.patch b/package/network/services/hostapd/patches/012-mesh-fix-channel-switch-error-during-CAC.patch similarity index 71% rename from package/network/services/hostapd/patches/016-mesh-fix-channel-switch-error-during-CAC.patch rename to package/network/services/hostapd/patches/012-mesh-fix-channel-switch-error-during-CAC.patch index f2baf1d8b7..f324d81ae3 100644 --- a/package/network/services/hostapd/patches/016-mesh-fix-channel-switch-error-during-CAC.patch +++ b/package/network/services/hostapd/patches/012-mesh-fix-channel-switch-error-during-CAC.patch @@ -1,7 +1,7 @@ -From 5913d6e2a741683e7c747c046f72ca790bbe1337 Mon Sep 17 00:00:00 2001 +From ab6995f15aae17af93507dd2344615f91672a31a Mon Sep 17 00:00:00 2001 From: Peter Oh -Date: Mon, 27 Aug 2018 14:28:47 -0700 -Subject: [PATCH 5/7] mesh: fix channel switch error during CAC +Date: Tue, 30 Jun 2020 14:19:00 +0200 +Subject: [PATCH 12/19] mesh: fix channel switch error during CAC Mesh interface has used its channel parameters that configured during its initialization even after channel switched due to @@ -11,8 +11,8 @@ when channel's been changed from initial one. Signed-off-by: Peter Oh --- - wpa_supplicant/mesh.c | 25 +++++++++++++++++++++++++ - 1 file changed, 25 insertions(+) + wpa_supplicant/mesh.c | 34 ++++++++++++++++++++++++++++++++++ + 1 file changed, 34 insertions(+) --- a/wpa_supplicant/mesh.c +++ b/wpa_supplicant/mesh.c @@ -24,8 +24,8 @@ Signed-off-by: Peter Oh #include "ap/sta_info.h" #include "ap/hostapd.h" #include "ap/ieee802_11.h" -@@ -204,6 +205,32 @@ static void wpas_mesh_complete_cb(void * - return; +@@ -206,6 +207,39 @@ static int wpas_mesh_complete(struct wpa + return -1; } + /* @@ -35,10 +35,17 @@ Signed-off-by: Peter Oh + if (ifmsh->freq != params->freq.freq) { + wpa_s->assoc_freq = ifmsh->freq; + ssid->frequency = ifmsh->freq; ++ struct he_capabilities *he_capab = NULL; ++ ++ if (ifmsh->current_mode) ++ he_capab = &ifmsh->current_mode->he_capab[IEEE80211_MODE_MESH]; ++ + if (hostapd_set_freq_params(¶ms->freq, + ifmsh->conf->hw_mode, + ifmsh->freq, + ifmsh->conf->channel, ++ ifmsh->conf->enable_edmg, ++ ifmsh->conf->edmg_channel, + ifmsh->conf->ieee80211n, + ifmsh->conf->ieee80211ac, + ifmsh->conf->ieee80211ax, @@ -46,11 +53,11 @@ Signed-off-by: Peter Oh + hostapd_get_oper_chwidth(ifmsh->conf), + hostapd_get_oper_centr_freq_seg0_idx(ifmsh->conf), + hostapd_get_oper_centr_freq_seg1_idx(ifmsh->conf), -+ ifmsh->current_mode->vht_capab, -+ &ifmsh->current_mode->he_capab[IEEE80211_MODE_AP])) { ++ ifmsh->conf->vht_capab, ++ he_capab)) { + wpa_printf(MSG_ERROR, "Error updating mesh frequency params."); + wpa_supplicant_mesh_deinit(wpa_s); -+ return; ++ return -1; + } + } + diff --git a/package/network/services/hostapd/patches/013-mesh-do-not-allow-pri-sec-channel-switch.patch b/package/network/services/hostapd/patches/013-mesh-do-not-allow-pri-sec-channel-switch.patch deleted file mode 100644 index 778273e67c..0000000000 --- a/package/network/services/hostapd/patches/013-mesh-do-not-allow-pri-sec-channel-switch.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 4f4a9b9e2e61fba334a21dadea749e4b440f42e6 Mon Sep 17 00:00:00 2001 -From: Peter Oh -Date: Mon, 27 Aug 2018 14:28:48 -0700 -Subject: [PATCH 6/7] mesh: don't allow pri/sec channel switch - -This limitation isn't backed by standard, but it is known that -mesh doesn't have capability to handle 20/40 coex change in -current implementation and it will not able to establish -PLINK when channel switch between primary and secondary happens. - -Since it's unknown when we will have the implementation of handling -20/40 coex change for mesh, it'd better to avoid them from happening -until standard based implementation is introduced. - -Signed-off-by: Peter Oh ---- - wpa_supplicant/mesh.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/wpa_supplicant/mesh.c -+++ b/wpa_supplicant/mesh.c -@@ -386,6 +386,7 @@ static int wpa_supplicant_mesh_init(stru - conf->basic_rates[rate_len] = -1; - } - -+ conf->no_pri_sec_switch = 1; - /* Handle pri/sec switch frequency within AP configuration parameter - * generation without changing the stored network profile in the end. */ - saved_freq = ssid->frequency; diff --git a/package/network/services/hostapd/patches/006-mesh-inform-kernel-driver-DFS-handler-in-userspace.patch b/package/network/services/hostapd/patches/013-mesh-inform-kernel-driver-DFS-handler-in-userspace.patch similarity index 74% rename from package/network/services/hostapd/patches/006-mesh-inform-kernel-driver-DFS-handler-in-userspace.patch rename to package/network/services/hostapd/patches/013-mesh-inform-kernel-driver-DFS-handler-in-userspace.patch index 76c43da8e2..fb4e68636e 100644 --- a/package/network/services/hostapd/patches/006-mesh-inform-kernel-driver-DFS-handler-in-userspace.patch +++ b/package/network/services/hostapd/patches/013-mesh-inform-kernel-driver-DFS-handler-in-userspace.patch @@ -1,7 +1,7 @@ -From 593602b7f14be5c2695979639764b1c50f01bbec Mon Sep 17 00:00:00 2001 +From f1118eca5b1a63a4acb2a11ceea15dc4bc259c77 Mon Sep 17 00:00:00 2001 From: Peter Oh -Date: Mon, 27 Aug 2018 14:28:49 -0700 -Subject: [PATCH 7/7] mesh: inform kernel driver DFS handler in userspace +Date: Tue, 30 Jun 2020 14:19:01 +0200 +Subject: [PATCH 13/19] mesh: inform kernel driver DFS handler in userspace NL80211_ATTR_HANDLE_DFS is required by kerenel space to enable DFS channels that indicates DFS handler @@ -16,17 +16,17 @@ Signed-off-by: Peter Oh --- a/src/drivers/driver.h +++ b/src/drivers/driver.h -@@ -1477,6 +1477,7 @@ struct wpa_driver_mesh_join_params { +@@ -1542,6 +1542,7 @@ struct wpa_driver_mesh_join_params { #define WPA_DRIVER_MESH_FLAG_SAE_AUTH 0x00000004 #define WPA_DRIVER_MESH_FLAG_AMPE 0x00000008 unsigned int flags; + u8 handle_dfs; }; - /** + struct wpa_driver_set_key_params { --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -9624,6 +9624,9 @@ static int nl80211_join_mesh(struct i802 +@@ -10070,6 +10070,9 @@ static int nl80211_join_mesh(struct i802 wpa_printf(MSG_DEBUG, " * flags=%08X", params->flags); @@ -38,7 +38,7 @@ Signed-off-by: Peter Oh goto fail; --- a/wpa_supplicant/mesh.c +++ b/wpa_supplicant/mesh.c -@@ -309,6 +309,7 @@ static int wpa_supplicant_mesh_init(stru +@@ -355,6 +355,7 @@ static int wpa_supplicant_mesh_init(stru conf->country[0] = wpa_s->conf->country[0]; conf->country[1] = wpa_s->conf->country[1]; conf->country[2] = ' '; diff --git a/package/network/services/hostapd/patches/014-mesh-fixes-for-mesh-init-deinit.patch b/package/network/services/hostapd/patches/014-mesh-fixes-for-mesh-init-deinit.patch new file mode 100644 index 0000000000..fe12d401e4 --- /dev/null +++ b/package/network/services/hostapd/patches/014-mesh-fixes-for-mesh-init-deinit.patch @@ -0,0 +1,158 @@ +From 30bdefd7559d57eae8c3c7e6f721ecf7be929bf2 Mon Sep 17 00:00:00 2001 +From: Markus Theil +Date: Tue, 30 Jun 2020 14:19:02 +0200 +Subject: [PATCH 14/19] mesh: fixes for mesh init/deinit + +Send mesh group started notification after join completion +callback is called. + +Implement outstanding TODO, to leave the mesh network on deinit. + +Signed-off-by: Markus Theil +--- + wpa_supplicant/mesh.c | 32 ++++++++++++++++++++------------ + wpa_supplicant/mesh.h | 6 ++++-- + wpa_supplicant/wpa_supplicant.c | 8 ++------ + 3 files changed, 26 insertions(+), 20 deletions(-) + +--- a/wpa_supplicant/mesh.c ++++ b/wpa_supplicant/mesh.c +@@ -30,20 +30,20 @@ + + static void wpa_supplicant_mesh_deinit(struct wpa_supplicant *wpa_s) + { +- wpa_supplicant_mesh_iface_deinit(wpa_s, wpa_s->ifmsh); ++ wpa_supplicant_mesh_iface_deinit(wpa_s, wpa_s->ifmsh, true); + wpa_s->ifmsh = NULL; + wpa_s->current_ssid = NULL; + os_free(wpa_s->mesh_rsn); + wpa_s->mesh_rsn = NULL; + os_free(wpa_s->mesh_params); + wpa_s->mesh_params = NULL; +- /* TODO: leave mesh (stop beacon). This will happen on link down +- * anyway, so it's not urgent */ ++ wpa_supplicant_leave_mesh(wpa_s, false); + } + + + void wpa_supplicant_mesh_iface_deinit(struct wpa_supplicant *wpa_s, +- struct hostapd_iface *ifmsh) ++ struct hostapd_iface *ifmsh, ++ bool also_clear_hostapd) + { + if (!ifmsh) + return; +@@ -64,8 +64,10 @@ void wpa_supplicant_mesh_iface_deinit(st + } + + /* take care of shared data */ +- hostapd_interface_deinit(ifmsh); +- hostapd_interface_free(ifmsh); ++ if (also_clear_hostapd) { ++ hostapd_interface_deinit(ifmsh); ++ hostapd_interface_free(ifmsh); ++ } + } + + +@@ -244,8 +246,7 @@ static int wpas_mesh_complete(struct wpa + wpas_mesh_init_rsn(wpa_s)) { + wpa_printf(MSG_ERROR, + "mesh: RSN initialization failed - deinit mesh"); +- wpa_supplicant_mesh_deinit(wpa_s); +- wpa_drv_leave_mesh(wpa_s); ++ wpa_supplicant_mesh_iface_deinit(wpa_s, wpa_s->ifmsh, false); + return -1; + } + +@@ -270,9 +271,15 @@ static int wpas_mesh_complete(struct wpa + /* hostapd sets the interface down until we associate */ + wpa_drv_set_operstate(wpa_s, 1); + +- if (!ret) ++ if (!ret) { + wpa_supplicant_set_state(wpa_s, WPA_COMPLETED); + ++ wpa_msg(wpa_s, MSG_INFO, MESH_GROUP_STARTED "ssid=\"%s\" id=%d", ++ wpa_ssid_txt(ssid->ssid, ssid->ssid_len), ++ ssid->id); ++ wpas_notify_mesh_group_started(wpa_s, ssid); ++ } ++ + return ret; + } + +@@ -563,7 +570,7 @@ int wpa_supplicant_join_mesh(struct wpa_ + wpa_s->mesh_params = params; + if (wpa_supplicant_mesh_init(wpa_s, ssid, ¶ms->freq)) { + wpa_msg(wpa_s, MSG_ERROR, "Failed to init mesh"); +- wpa_drv_leave_mesh(wpa_s); ++ wpa_supplicant_leave_mesh(wpa_s, true); + ret = -1; + goto out; + } +@@ -573,14 +580,15 @@ out: + } + + +-int wpa_supplicant_leave_mesh(struct wpa_supplicant *wpa_s) ++int wpa_supplicant_leave_mesh(struct wpa_supplicant *wpa_s, bool need_deinit) + { + int ret = 0; + + wpa_msg(wpa_s, MSG_INFO, "leaving mesh"); + + /* Need to send peering close messages first */ +- wpa_supplicant_mesh_deinit(wpa_s); ++ if (need_deinit) ++ wpa_supplicant_mesh_deinit(wpa_s); + + ret = wpa_drv_leave_mesh(wpa_s); + if (ret) +--- a/wpa_supplicant/mesh.h ++++ b/wpa_supplicant/mesh.h +@@ -11,9 +11,11 @@ + + int wpa_supplicant_join_mesh(struct wpa_supplicant *wpa_s, + struct wpa_ssid *ssid); +-int wpa_supplicant_leave_mesh(struct wpa_supplicant *wpa_s); ++int wpa_supplicant_leave_mesh(struct wpa_supplicant *wpa_s, ++ bool need_deinit); + void wpa_supplicant_mesh_iface_deinit(struct wpa_supplicant *wpa_s, +- struct hostapd_iface *ifmsh); ++ struct hostapd_iface *ifmsh, ++ bool also_clear_hostapd); + int wpas_mesh_scan_result_text(const u8 *ies, size_t ies_len, char *buf, + char *end); + int wpas_mesh_add_interface(struct wpa_supplicant *wpa_s, char *ifname, +--- a/wpa_supplicant/wpa_supplicant.c ++++ b/wpa_supplicant/wpa_supplicant.c +@@ -2225,10 +2225,6 @@ void wpa_supplicant_associate(struct wpa + return; + } + wpa_s->current_bss = bss; +- wpa_msg(wpa_s, MSG_INFO, MESH_GROUP_STARTED "ssid=\"%s\" id=%d", +- wpa_ssid_txt(ssid->ssid, ssid->ssid_len), +- ssid->id); +- wpas_notify_mesh_group_started(wpa_s, ssid); + #else /* CONFIG_MESH */ + wpa_msg(wpa_s, MSG_ERROR, + "mesh mode support not included in the build"); +@@ -3938,7 +3934,7 @@ void wpa_supplicant_deauthenticate(struc + wpa_s->ifname); + wpas_notify_mesh_group_removed(wpa_s, mconf->meshid, + mconf->meshid_len, reason_code); +- wpa_supplicant_leave_mesh(wpa_s); ++ wpa_supplicant_leave_mesh(wpa_s, true); + } + #endif /* CONFIG_MESH */ + +@@ -6551,7 +6547,7 @@ static void wpa_supplicant_deinit_iface( + + #ifdef CONFIG_MESH + if (wpa_s->ifmsh) { +- wpa_supplicant_mesh_iface_deinit(wpa_s, wpa_s->ifmsh); ++ wpa_supplicant_mesh_iface_deinit(wpa_s, wpa_s->ifmsh, true); + wpa_s->ifmsh = NULL; + } + #endif /* CONFIG_MESH */ diff --git a/package/network/services/hostapd/patches/015-mesh-fix-DFS-deinit-init.patch b/package/network/services/hostapd/patches/015-mesh-fix-DFS-deinit-init.patch new file mode 100644 index 0000000000..c540dd6786 --- /dev/null +++ b/package/network/services/hostapd/patches/015-mesh-fix-DFS-deinit-init.patch @@ -0,0 +1,262 @@ +From d017f5d98a143c46c3c3fcb0e6507ca0b2bebdb0 Mon Sep 17 00:00:00 2001 +From: Markus Theil +Date: Tue, 30 Jun 2020 14:19:03 +0200 +Subject: [PATCH 15/19] mesh: fix DFS deinit/init + +The hostapd DFS code deinitializes and initializes the +AP interface, if a clean channel switch is not possible. +In this case the AP code paths would deinit the driver, for +example nl80211, without wpa_supplicant code paths getting +notice of this. + +Therefore add callbacks for wpa_supplicant mesh methods, +which are called on init/deinit of the AP bss. These +callbacks are then used to handle the reset in the mesh +code. + +Signed-off-by: Markus Theil +--- + src/ap/dfs.c | 2 +- + src/ap/hostapd.c | 17 ++++++-- + src/ap/hostapd.h | 6 +++ + wpa_supplicant/mesh.c | 90 +++++++++++++++++++++++++++++++++++++------ + 4 files changed, 100 insertions(+), 15 deletions(-) + +--- a/src/ap/dfs.c ++++ b/src/ap/dfs.c +@@ -1112,7 +1112,7 @@ static int hostapd_dfs_start_channel_swi + oper_centr_freq_seg0_idx, + oper_centr_freq_seg1_idx, + cmode->vht_capab, +- &cmode->he_capab[IEEE80211_MODE_AP]); ++ &cmode->he_capab[iface->conf->hw_mode]); + + if (err) { + wpa_printf(MSG_ERROR, "DFS failed to calculate CSA freq params"); +--- a/src/ap/hostapd.c ++++ b/src/ap/hostapd.c +@@ -354,7 +354,7 @@ static int hostapd_broadcast_wep_set(str + #endif /* CONFIG_WEP */ + + +-static void hostapd_free_hapd_data(struct hostapd_data *hapd) ++void hostapd_free_hapd_data(struct hostapd_data *hapd) + { + os_free(hapd->probereq_cb); + hapd->probereq_cb = NULL; +@@ -498,7 +498,7 @@ static void sta_track_deinit(struct host + } + + +-static void hostapd_cleanup_iface_partial(struct hostapd_iface *iface) ++void hostapd_cleanup_iface_partial(struct hostapd_iface *iface) + { + wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface); + #ifdef NEED_AP_MLME +@@ -626,7 +626,7 @@ static int hostapd_flush_old_stations(st + } + + +-static void hostapd_bss_deinit_no_free(struct hostapd_data *hapd) ++void hostapd_bss_deinit_no_free(struct hostapd_data *hapd) + { + hostapd_free_stas(hapd); + hostapd_flush_old_stations(hapd, WLAN_REASON_DEAUTH_LEAVING); +@@ -2690,6 +2690,13 @@ int hostapd_enable_iface(struct hostapd_ + { + size_t j; + ++ if (hapd_iface == NULL) ++ return -1; ++ ++ if (hapd_iface->enable_iface_cb != NULL) { ++ return hapd_iface->enable_iface_cb(hapd_iface); ++ } ++ + if (hapd_iface->bss[0]->drv_priv != NULL) { + wpa_printf(MSG_ERROR, "Interface %s already enabled", + hapd_iface->conf->bss[0]->iface); +@@ -2751,6 +2758,10 @@ int hostapd_disable_iface(struct hostapd + if (hapd_iface == NULL) + return -1; + ++ if (hapd_iface->disable_iface_cb != NULL) { ++ return hapd_iface->disable_iface_cb(hapd_iface); ++ } ++ + if (hapd_iface->bss[0]->drv_priv == NULL) { + wpa_printf(MSG_INFO, "Interface %s already disabled", + hapd_iface->conf->bss[0]->iface); +--- a/src/ap/hostapd.h ++++ b/src/ap/hostapd.h +@@ -589,6 +589,9 @@ struct hostapd_iface { + + /* Previous WMM element information */ + struct hostapd_wmm_ac_params prev_wmm[WMM_AC_NUM]; ++ ++ int (*enable_iface_cb)(struct hostapd_iface *iface); ++ int (*disable_iface_cb)(struct hostapd_iface *iface); + }; + + /* hostapd.c */ +@@ -617,6 +620,9 @@ void hostapd_interface_deinit_free(struc + int hostapd_enable_iface(struct hostapd_iface *hapd_iface); + int hostapd_reload_iface(struct hostapd_iface *hapd_iface); + int hostapd_disable_iface(struct hostapd_iface *hapd_iface); ++void hostapd_bss_deinit_no_free(struct hostapd_data *hapd); ++void hostapd_free_hapd_data(struct hostapd_data *hapd); ++void hostapd_cleanup_iface_partial(struct hostapd_iface *iface); + int hostapd_add_iface(struct hapd_interfaces *ifaces, char *buf); + int hostapd_remove_iface(struct hapd_interfaces *ifaces, char *buf); + void hostapd_channel_list_updated(struct hostapd_iface *iface, int initiator); +--- a/wpa_supplicant/mesh.c ++++ b/wpa_supplicant/mesh.c +@@ -28,15 +28,20 @@ + #include "mesh.h" + + +-static void wpa_supplicant_mesh_deinit(struct wpa_supplicant *wpa_s) ++static void wpa_supplicant_mesh_deinit(struct wpa_supplicant *wpa_s, bool also_clear_hostapd) + { +- wpa_supplicant_mesh_iface_deinit(wpa_s, wpa_s->ifmsh, true); +- wpa_s->ifmsh = NULL; +- wpa_s->current_ssid = NULL; ++ wpa_supplicant_mesh_iface_deinit(wpa_s, wpa_s->ifmsh, also_clear_hostapd); ++ ++ if (also_clear_hostapd) { ++ wpa_s->ifmsh = NULL; ++ wpa_s->current_ssid = NULL; ++ os_free(wpa_s->mesh_params); ++ wpa_s->mesh_params = NULL; ++ } ++ + os_free(wpa_s->mesh_rsn); + wpa_s->mesh_rsn = NULL; +- os_free(wpa_s->mesh_params); +- wpa_s->mesh_params = NULL; ++ + wpa_supplicant_leave_mesh(wpa_s, false); + } + +@@ -237,7 +242,7 @@ static int wpas_mesh_complete(struct wpa + ifmsh->conf->vht_capab, + he_capab)) { + wpa_printf(MSG_ERROR, "Error updating mesh frequency params."); +- wpa_supplicant_mesh_deinit(wpa_s); ++ wpa_supplicant_mesh_deinit(wpa_s, true); + return -1; + } + } +@@ -246,7 +251,7 @@ static int wpas_mesh_complete(struct wpa + wpas_mesh_init_rsn(wpa_s)) { + wpa_printf(MSG_ERROR, + "mesh: RSN initialization failed - deinit mesh"); +- wpa_supplicant_mesh_iface_deinit(wpa_s, wpa_s->ifmsh, false); ++ wpa_supplicant_mesh_deinit(wpa_s, false); + return -1; + } + +@@ -291,6 +296,67 @@ static void wpas_mesh_complete_cb(void * + } + + ++static int wpa_supplicant_mesh_enable_iface_cb(struct hostapd_iface *ifmsh) ++{ ++ struct wpa_supplicant *wpa_s = ifmsh->owner; ++ struct hostapd_data *bss; ++ ++ ifmsh->mconf = mesh_config_create(wpa_s, wpa_s->current_ssid); ++ ++ bss = ifmsh->bss[0]; ++ bss->msg_ctx = wpa_s; ++ os_memcpy(bss->own_addr, wpa_s->own_addr, ETH_ALEN); ++ bss->driver = wpa_s->driver; ++ bss->drv_priv = wpa_s->drv_priv; ++ bss->iface = ifmsh; ++ bss->mesh_sta_free_cb = mesh_mpm_free_sta; ++ bss->setup_complete_cb = wpas_mesh_complete_cb; ++ bss->setup_complete_cb_ctx = wpa_s; ++ ++ bss->conf->start_disabled = 1; ++ bss->conf->mesh = MESH_ENABLED; ++ bss->conf->ap_max_inactivity = wpa_s->conf->mesh_max_inactivity; ++ ++ if (wpa_drv_init_mesh(wpa_s)) { ++ wpa_msg(wpa_s, MSG_ERROR, "Failed to init mesh in driver"); ++ return -1; ++ } ++ ++ if (hostapd_setup_interface(ifmsh)) { ++ wpa_printf(MSG_ERROR, ++ "Failed to initialize hostapd interface for mesh"); ++ return -1; ++ } ++ ++ return 0; ++} ++ ++ ++static int wpa_supplicant_mesh_disable_iface_cb(struct hostapd_iface *ifmsh) ++{ ++ struct wpa_supplicant *wpa_s = ifmsh->owner; ++ int j; ++ ++ wpa_supplicant_mesh_deinit(wpa_s, false); ++ ++#ifdef NEED_AP_MLME ++ for (j = 0; j < ifmsh->num_bss; j++) ++ hostapd_cleanup_cs_params(ifmsh->bss[j]); ++#endif /* NEED_AP_MLME */ ++ ++ /* same as hostapd_interface_deinit without deinitializing ctrl-iface */ ++ for (j = 0; j < ifmsh->num_bss; j++) { ++ struct hostapd_data *hapd = ifmsh->bss[j]; ++ hostapd_bss_deinit_no_free(hapd); ++ hostapd_free_hapd_data(hapd); ++ } ++ ++ hostapd_cleanup_iface_partial(ifmsh); ++ ++ return 0; ++} ++ ++ + static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s, + struct wpa_ssid *ssid, + struct hostapd_freq_params *freq) +@@ -318,6 +384,8 @@ static int wpa_supplicant_mesh_init(stru + ifmsh->drv_flags = wpa_s->drv_flags; + ifmsh->drv_flags2 = wpa_s->drv_flags2; + ifmsh->num_bss = 1; ++ ifmsh->enable_iface_cb = wpa_supplicant_mesh_enable_iface_cb; ++ ifmsh->disable_iface_cb = wpa_supplicant_mesh_disable_iface_cb; + ifmsh->bss = os_calloc(wpa_s->ifmsh->num_bss, + sizeof(struct hostapd_data *)); + if (!ifmsh->bss) +@@ -451,7 +519,7 @@ static int wpa_supplicant_mesh_init(stru + + return 0; + out_free: +- wpa_supplicant_mesh_deinit(wpa_s); ++ wpa_supplicant_mesh_deinit(wpa_s, true); + return -ENOMEM; + } + +@@ -499,7 +567,7 @@ int wpa_supplicant_join_mesh(struct wpa_ + goto out; + } + +- wpa_supplicant_mesh_deinit(wpa_s); ++ wpa_supplicant_mesh_deinit(wpa_s, true); + + wpa_s->pairwise_cipher = WPA_CIPHER_NONE; + wpa_s->group_cipher = WPA_CIPHER_NONE; +@@ -588,7 +656,7 @@ int wpa_supplicant_leave_mesh(struct wpa + + /* Need to send peering close messages first */ + if (need_deinit) +- wpa_supplicant_mesh_deinit(wpa_s); ++ wpa_supplicant_mesh_deinit(wpa_s, true); + + ret = wpa_drv_leave_mesh(wpa_s); + if (ret) diff --git a/package/network/services/hostapd/patches/016-tests-DFS-test-for-wpa_supplicant-mesh.patch b/package/network/services/hostapd/patches/016-tests-DFS-test-for-wpa_supplicant-mesh.patch new file mode 100644 index 0000000000..b6a51b2f35 --- /dev/null +++ b/package/network/services/hostapd/patches/016-tests-DFS-test-for-wpa_supplicant-mesh.patch @@ -0,0 +1,94 @@ +From 6ee4e70d469b8ce05013ed524eea32ea303e6563 Mon Sep 17 00:00:00 2001 +From: Markus Theil +Date: Tue, 30 Jun 2020 14:19:04 +0200 +Subject: [PATCH 16/19] tests: DFS test for wpa_supplicant mesh + +Add a test with uses a DFS channel, waits for CAC +afterwards successfull mesh join and then triggers +a radar event and check if the mesh comes up again +on the same device. + +Signed-off-by: Markus Theil +--- + tests/hwsim/test_wpas_mesh.py | 56 +++++++++++++++++++++++++++++++++-- + 1 file changed, 54 insertions(+), 2 deletions(-) + +--- a/tests/hwsim/test_wpas_mesh.py ++++ b/tests/hwsim/test_wpas_mesh.py +@@ -80,8 +80,23 @@ def check_mesh_scan(dev, params, other_s + if '[MESH]' not in bss['flags']: + raise Exception("BSS output did not include MESH flag") + +-def check_mesh_group_added(dev): +- ev = dev.wait_event(["MESH-GROUP-STARTED"]) ++def check_dfs_started(dev, timeout=10): ++ ev = dev.wait_event(["DFS-CAC-START"], timeout=timeout) ++ if ev is None: ++ raise Exception("Test exception: CAC did not start") ++ ++def check_dfs_finished(dev, timeout=70): ++ ev = dev.wait_event(["DFS-CAC-COMPLETED"], timeout=timeout) ++ if ev is None: ++ raise Exception("Test exception: CAC did not finish") ++ ++def check_mesh_radar_handling_finished(dev, timeout=75): ++ ev = dev.wait_event(["CTRL-EVENT-CHANNEL-SWITCH", "MESH-GROUP-STARTED"], timeout=timeout) ++ if ev is None: ++ raise Exception("Test exception: Couldn't join mesh") ++ ++def check_mesh_group_added(dev, timeout=10): ++ ev = dev.wait_event(["MESH-GROUP-STARTED"], timeout=timeout) + if ev is None: + raise Exception("Test exception: Couldn't join mesh") + +@@ -91,6 +106,10 @@ def check_mesh_group_removed(dev): + if ev is None: + raise Exception("Test exception: Couldn't leave mesh") + ++def check_regdom_change(dev, timeout=10): ++ ev = dev.wait_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=timeout) ++ if ev is None: ++ raise Exception("Test exception: No regdom change happened.") + + def check_mesh_peer_connected(dev, timeout=10): + ev = dev.wait_event(["MESH-PEER-CONNECTED"], timeout=timeout) +@@ -167,6 +186,39 @@ def test_wpas_mesh_group_remove(dev): + check_mesh_group_removed(dev[0]) + dev[0].mesh_group_remove() + ++def dfs_simulate_radar(dev): ++ logger.info("Trigger a simulated radar event") ++ phyname = dev.get_driver_status_field("phyname") ++ radar_file = '/sys/kernel/debug/ieee80211/' + phyname + '/hwsim/dfs_simulate_radar' ++ with open(radar_file, 'w') as f: ++ f.write('1') ++ ++@long_duration_test ++def test_wpas_mesh_peer_connected_dfs(dev): ++ """wpa_supplicant MESH peer connected""" ++ dev[0].set("country", "DE") ++ dev[1].set("country", "DE") ++ ++ check_regdom_change(dev[0]) ++ check_regdom_change(dev[1]) ++ ++ check_mesh_support(dev[0]) ++ add_open_mesh_network(dev[0], freq="5500", beacon_int=160) ++ add_open_mesh_network(dev[1], freq="5500", beacon_int=160) ++ check_dfs_started(dev[0]) ++ check_dfs_finished(dev[0]) ++ check_mesh_joined_connected(dev, timeout0=10) ++ ++ dfs_simulate_radar(dev[0]) ++ ++ check_mesh_radar_handling_finished(dev[0], timeout=75) ++ ++ dev[0].set("country", "00") ++ dev[1].set("country", "00") ++ ++ check_regdom_change(dev[0]) ++ check_regdom_change(dev[1]) ++ + def test_wpas_mesh_peer_connected(dev): + """wpa_supplicant MESH peer connected""" + check_mesh_support(dev[0]) diff --git a/package/network/services/hostapd/patches/017-mesh-fix-mesh_oom-test.patch b/package/network/services/hostapd/patches/017-mesh-fix-mesh_oom-test.patch new file mode 100644 index 0000000000..cc566c7de2 --- /dev/null +++ b/package/network/services/hostapd/patches/017-mesh-fix-mesh_oom-test.patch @@ -0,0 +1,24 @@ +From 928da9a270deaf4409aee4d87a33a6f61b56c136 Mon Sep 17 00:00:00 2001 +From: Markus Theil +Date: Tue, 30 Jun 2020 14:19:05 +0200 +Subject: [PATCH 17/19] mesh: fix mesh_oom test + +Only change freq params, if ifmsh->freq is set initially, which only +happens if hostapd_get_hw_features in setup_interface2 succeeds. + +Signed-off-by: Markus Theil +--- + wpa_supplicant/mesh.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/wpa_supplicant/mesh.c ++++ b/wpa_supplicant/mesh.c +@@ -218,7 +218,7 @@ static int wpas_mesh_complete(struct wpa + * inspect if channel's been changed since initialized. + * i.e. DFS radar detection + */ +- if (ifmsh->freq != params->freq.freq) { ++ if (ifmsh->freq > 0 && ifmsh->freq != params->freq.freq) { + wpa_s->assoc_freq = ifmsh->freq; + ssid->frequency = ifmsh->freq; + struct he_capabilities *he_capab = NULL; diff --git a/package/network/services/hostapd/patches/018-mesh-move-mesh-freq-setting-to-own-function.patch b/package/network/services/hostapd/patches/018-mesh-move-mesh-freq-setting-to-own-function.patch new file mode 100644 index 0000000000..1dd7d37411 --- /dev/null +++ b/package/network/services/hostapd/patches/018-mesh-move-mesh-freq-setting-to-own-function.patch @@ -0,0 +1,93 @@ +From 1eab0e62920f443f8814bad846f6439843223b69 Mon Sep 17 00:00:00 2001 +From: Markus Theil +Date: Tue, 30 Jun 2020 14:19:06 +0200 +Subject: [PATCH 18/19] mesh: move mesh freq setting to own function + +Signed-off-by: Markus Theil +--- + wpa_supplicant/mesh.c | 59 ++++++++++++++++++++++++++----------------- + 1 file changed, 36 insertions(+), 23 deletions(-) + +--- a/wpa_supplicant/mesh.c ++++ b/wpa_supplicant/mesh.c +@@ -201,6 +201,40 @@ static int wpas_mesh_init_rsn(struct wpa + return !wpa_s->mesh_rsn ? -1 : 0; + } + ++ ++static int wpas_mesh_update_freq_params(struct wpa_supplicant *wpa_s) ++{ ++ struct wpa_driver_mesh_join_params *params = wpa_s->mesh_params; ++ struct hostapd_iface *ifmsh = wpa_s->ifmsh; ++ struct he_capabilities *he_capab = NULL; ++ ++ if (ifmsh->current_mode) ++ he_capab = &ifmsh->current_mode->he_capab[IEEE80211_MODE_MESH]; ++ ++ if (hostapd_set_freq_params(¶ms->freq, ++ ifmsh->conf->hw_mode, ++ ifmsh->freq, ++ ifmsh->conf->channel, ++ ifmsh->conf->enable_edmg, ++ ifmsh->conf->edmg_channel, ++ ifmsh->conf->ieee80211n, ++ ifmsh->conf->ieee80211ac, ++ ifmsh->conf->ieee80211ax, ++ ifmsh->conf->secondary_channel, ++ hostapd_get_oper_chwidth(ifmsh->conf), ++ hostapd_get_oper_centr_freq_seg0_idx(ifmsh->conf), ++ hostapd_get_oper_centr_freq_seg1_idx(ifmsh->conf), ++ ifmsh->conf->vht_capab, ++ he_capab)) { ++ wpa_printf(MSG_ERROR, "Error updating mesh frequency params."); ++ wpa_supplicant_mesh_deinit(wpa_s, true); ++ return -1; ++ } ++ ++ return 0; ++} ++ ++ + static int wpas_mesh_complete(struct wpa_supplicant *wpa_s) + { + struct hostapd_iface *ifmsh = wpa_s->ifmsh; +@@ -221,30 +255,8 @@ static int wpas_mesh_complete(struct wpa + if (ifmsh->freq > 0 && ifmsh->freq != params->freq.freq) { + wpa_s->assoc_freq = ifmsh->freq; + ssid->frequency = ifmsh->freq; +- struct he_capabilities *he_capab = NULL; +- +- if (ifmsh->current_mode) +- he_capab = &ifmsh->current_mode->he_capab[IEEE80211_MODE_MESH]; +- +- if (hostapd_set_freq_params(¶ms->freq, +- ifmsh->conf->hw_mode, +- ifmsh->freq, +- ifmsh->conf->channel, +- ifmsh->conf->enable_edmg, +- ifmsh->conf->edmg_channel, +- ifmsh->conf->ieee80211n, +- ifmsh->conf->ieee80211ac, +- ifmsh->conf->ieee80211ax, +- ifmsh->conf->secondary_channel, +- hostapd_get_oper_chwidth(ifmsh->conf), +- hostapd_get_oper_centr_freq_seg0_idx(ifmsh->conf), +- hostapd_get_oper_centr_freq_seg1_idx(ifmsh->conf), +- ifmsh->conf->vht_capab, +- he_capab)) { +- wpa_printf(MSG_ERROR, "Error updating mesh frequency params."); +- wpa_supplicant_mesh_deinit(wpa_s, true); ++ if (wpas_mesh_update_freq_params(wpa_s) != 0) + return -1; +- } + } + + if (ifmsh->mconf->security != MESH_CONF_SEC_NONE && +@@ -518,6 +530,7 @@ static int wpa_supplicant_mesh_init(stru + } + + return 0; ++ + out_free: + wpa_supplicant_mesh_deinit(wpa_s, true); + return -ENOMEM; diff --git a/package/network/services/hostapd/patches/019-mesh-use-deterministic-channel-on-channel-switch.patch b/package/network/services/hostapd/patches/019-mesh-use-deterministic-channel-on-channel-switch.patch new file mode 100644 index 0000000000..8e38a8e53c --- /dev/null +++ b/package/network/services/hostapd/patches/019-mesh-use-deterministic-channel-on-channel-switch.patch @@ -0,0 +1,81 @@ +From fc8ea40f6130ac18d9c66797de2cf1d5af55d496 Mon Sep 17 00:00:00 2001 +From: Markus Theil +Date: Tue, 30 Jun 2020 14:19:07 +0200 +Subject: [PATCH 19/19] mesh: use deterministic channel on channel switch + +This patch uses a deterministic channel on DFS channel switch +in mesh networks. Otherwise, when switching to a usable but not +available channel, no CSA can be sent and a random channel is choosen +without notification of other nodes. It is then quite likely, that +the mesh network gets disconnected. + +Fix this by using a deterministic number, based on the sha256 hash +of the mesh ID, in order to use at least a different number in each +mesh network. + +Signed-off-by: Markus Theil +--- + src/ap/dfs.c | 20 +++++++++++++++++++- + src/drivers/driver_nl80211.c | 4 ++++ + 2 files changed, 23 insertions(+), 1 deletion(-) + +--- a/src/ap/dfs.c ++++ b/src/ap/dfs.c +@@ -17,6 +17,7 @@ + #include "ap_drv_ops.h" + #include "drivers/driver.h" + #include "dfs.h" ++#include "crypto/crypto.h" + + + static int dfs_get_used_n_chans(struct hostapd_iface *iface, int *seg1) +@@ -480,9 +481,14 @@ dfs_get_valid_channel(struct hostapd_ifa + int num_available_chandefs; + int chan_idx, chan_idx2; + int sec_chan_idx_80p80 = -1; ++ bool is_mesh = false; + int i; + u32 _rand; + ++#ifdef CONFIG_MESH ++ is_mesh = iface->mconf; ++#endif ++ + wpa_printf(MSG_DEBUG, "DFS: Selecting random channel"); + *secondary_channel = 0; + *oper_centr_freq_seg0_idx = 0; +@@ -502,8 +508,20 @@ dfs_get_valid_channel(struct hostapd_ifa + if (num_available_chandefs == 0) + return NULL; + +- if (os_get_random((u8 *) &_rand, sizeof(_rand)) < 0) ++ /* try to use deterministic channel in mesh, so that both sides ++ * have a chance to switch to the same channel */ ++ if (is_mesh) { ++#ifdef CONFIG_MESH ++ u64 hash[4]; ++ const u8 *meshid[1] = { &iface->mconf->meshid[0] }; ++ const size_t meshid_len = iface->mconf->meshid_len; ++ ++ sha256_vector(1, meshid, &meshid_len, (u8 *)&hash[0]); ++ _rand = hash[0] + hash[1] + hash[2] + hash[3]; ++#endif ++ } else if (os_get_random((u8 *) &_rand, sizeof(_rand)) < 0) + return NULL; ++ + chan_idx = _rand % num_available_chandefs; + dfs_find_channel(iface, &chan, chan_idx, skip_radar); + if (!chan) { +--- a/src/drivers/driver_nl80211.c ++++ b/src/drivers/driver_nl80211.c +@@ -9473,6 +9473,10 @@ static int nl80211_switch_channel(void * + if (ret) + goto error; + ++ if (drv->nlmode == NL80211_IFTYPE_MESH_POINT) { ++ nla_put_flag(msg, NL80211_ATTR_HANDLE_DFS); ++ } ++ + /* beacon_csa params */ + beacon_csa = nla_nest_start(msg, NL80211_ATTR_CSA_IES); + if (!beacon_csa) diff --git a/package/network/services/hostapd/patches/018-mesh-make-forwarding-configurable.patch b/package/network/services/hostapd/patches/050-mesh-make-forwarding-configurable.patch similarity index 87% rename from package/network/services/hostapd/patches/018-mesh-make-forwarding-configurable.patch rename to package/network/services/hostapd/patches/050-mesh-make-forwarding-configurable.patch index af94fed4b8..0ecb9ba078 100644 --- a/package/network/services/hostapd/patches/018-mesh-make-forwarding-configurable.patch +++ b/package/network/services/hostapd/patches/050-mesh-make-forwarding-configurable.patch @@ -31,7 +31,7 @@ Signed-off-by: Daniel Golle }; #define MAX_STA_COUNT 2007 -@@ -666,6 +667,7 @@ struct hostapd_bss_config { +@@ -701,6 +702,7 @@ struct hostapd_bss_config { #define MESH_ENABLED BIT(0) int mesh; @@ -41,7 +41,7 @@ Signed-off-by: Daniel Golle --- a/src/drivers/driver.h +++ b/src/drivers/driver.h -@@ -1450,6 +1450,7 @@ struct wpa_driver_mesh_bss_params { +@@ -1515,6 +1515,7 @@ struct wpa_driver_mesh_bss_params { #define WPA_DRIVER_MESH_CONF_FLAG_MAX_PEER_LINKS 0x00000004 #define WPA_DRIVER_MESH_CONF_FLAG_HT_OP_MODE 0x00000008 #define WPA_DRIVER_MESH_CONF_FLAG_RSSI_THRESHOLD 0x00000010 @@ -49,7 +49,7 @@ Signed-off-by: Daniel Golle /* * TODO: Other mesh configuration parameters would go here. * See NL80211_MESHCONF_* for all the mesh config parameters. -@@ -1459,6 +1460,7 @@ struct wpa_driver_mesh_bss_params { +@@ -1524,6 +1525,7 @@ struct wpa_driver_mesh_bss_params { int peer_link_timeout; int max_peer_links; int rssi_threshold; @@ -59,7 +59,7 @@ Signed-off-by: Daniel Golle --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -9592,6 +9592,9 @@ static int nl80211_put_mesh_config(struc +@@ -10023,6 +10023,9 @@ static int nl80211_put_mesh_config(struc if (((params->flags & WPA_DRIVER_MESH_CONF_FLAG_AUTO_PLINKS) && nla_put_u8(msg, NL80211_MESHCONF_AUTO_OPEN_PLINKS, params->auto_plinks)) || @@ -71,7 +71,7 @@ Signed-off-by: Daniel Golle params->max_peer_links)) || --- a/wpa_supplicant/config.c +++ b/wpa_supplicant/config.c -@@ -2307,6 +2307,7 @@ static const struct parse_data ssid_fiel +@@ -2473,6 +2473,7 @@ static const struct parse_data ssid_fiel #ifdef CONFIG_MESH { INT_RANGE(mode, 0, 5) }, { INT_RANGE(no_auto_peer, 0, 1) }, @@ -79,7 +79,7 @@ Signed-off-by: Daniel Golle { INT_RANGE(mesh_rssi_threshold, -255, 1) }, #else /* CONFIG_MESH */ { INT_RANGE(mode, 0, 4) }, -@@ -2869,6 +2870,7 @@ void wpa_config_set_network_defaults(str +@@ -3049,6 +3050,7 @@ void wpa_config_set_network_defaults(str ssid->dot11MeshRetryTimeout = DEFAULT_MESH_RETRY_TIMEOUT; ssid->dot11MeshConfirmTimeout = DEFAULT_MESH_CONFIRM_TIMEOUT; ssid->dot11MeshHoldingTimeout = DEFAULT_MESH_HOLDING_TIMEOUT; @@ -87,7 +87,7 @@ Signed-off-by: Daniel Golle ssid->mesh_rssi_threshold = DEFAULT_MESH_RSSI_THRESHOLD; #endif /* CONFIG_MESH */ #ifdef CONFIG_HT_OVERRIDES -@@ -4089,6 +4091,7 @@ struct wpa_config * wpa_config_alloc_emp +@@ -4276,6 +4278,7 @@ struct wpa_config * wpa_config_alloc_emp config->user_mpm = DEFAULT_USER_MPM; config->max_peer_links = DEFAULT_MAX_PEER_LINKS; config->mesh_max_inactivity = DEFAULT_MESH_MAX_INACTIVITY; @@ -95,7 +95,7 @@ Signed-off-by: Daniel Golle config->dot11RSNASAERetransPeriod = DEFAULT_DOT11_RSNA_SAE_RETRANS_PERIOD; config->fast_reauth = DEFAULT_FAST_REAUTH; -@@ -4726,6 +4729,7 @@ static const struct global_parse_data gl +@@ -4914,6 +4917,7 @@ static const struct global_parse_data gl { INT(user_mpm), 0 }, { INT_RANGE(max_peer_links, 0, 255), 0 }, { INT(mesh_max_inactivity), 0 }, @@ -113,7 +113,7 @@ Signed-off-by: Daniel Golle /* * The default dot11RSNASAERetransPeriod is defined as 40 ms in the standard, * but use 1000 ms in practice to avoid issues on low power CPUs. -@@ -1327,6 +1328,14 @@ struct wpa_config { +@@ -1351,6 +1352,14 @@ struct wpa_config { int mesh_max_inactivity; /** @@ -130,15 +130,15 @@ Signed-off-by: Daniel Golle * This timeout value is used in mesh STA to retransmit --- a/wpa_supplicant/config_file.c +++ b/wpa_supplicant/config_file.c -@@ -829,6 +829,7 @@ static void wpa_config_write_network(FIL +@@ -866,6 +866,7 @@ static void wpa_config_write_network(FIL #endif /* IEEE8021X_EAPOL */ INT(mode); INT(no_auto_peer); + INT(mesh_fwding); INT(frequency); - INT(fixed_freq); - #ifdef CONFIG_ACS -@@ -1472,6 +1473,9 @@ static void wpa_config_write_global(FILE + INT(enable_edmg); + INT(edmg_channel); +@@ -1527,6 +1528,9 @@ static void wpa_config_write_global(FILE fprintf(f, "mesh_max_inactivity=%d\n", config->mesh_max_inactivity); @@ -150,7 +150,7 @@ Signed-off-by: Daniel Golle fprintf(f, "dot11RSNASAERetransPeriod=%d\n", --- a/wpa_supplicant/config_ssid.h +++ b/wpa_supplicant/config_ssid.h -@@ -516,6 +516,11 @@ struct wpa_ssid { +@@ -546,6 +546,11 @@ struct wpa_ssid { int dot11MeshConfirmTimeout; /* msec */ int dot11MeshHoldingTimeout; /* msec */ @@ -164,7 +164,7 @@ Signed-off-by: Daniel Golle --- a/wpa_supplicant/mesh.c +++ b/wpa_supplicant/mesh.c -@@ -126,6 +126,7 @@ static struct mesh_conf * mesh_config_cr +@@ -137,6 +137,7 @@ static struct mesh_conf * mesh_config_cr conf->mesh_cc_id = 0; conf->mesh_sp_id = MESH_SYNC_METHOD_NEIGHBOR_OFFSET; conf->mesh_auth_id = (conf->security & MESH_CONF_SEC_AUTH) ? 1 : 0; @@ -172,7 +172,7 @@ Signed-off-by: Daniel Golle conf->dot11MeshMaxRetries = ssid->dot11MeshMaxRetries; conf->dot11MeshRetryTimeout = ssid->dot11MeshRetryTimeout; conf->dot11MeshConfirmTimeout = ssid->dot11MeshConfirmTimeout; -@@ -328,6 +329,7 @@ static int wpa_supplicant_mesh_init(stru +@@ -434,6 +435,7 @@ static int wpa_supplicant_mesh_init(stru bss->conf->start_disabled = 1; bss->conf->mesh = MESH_ENABLED; bss->conf->ap_max_inactivity = wpa_s->conf->mesh_max_inactivity; @@ -180,7 +180,7 @@ Signed-off-by: Daniel Golle if (ieee80211_is_dfs(ssid->frequency, wpa_s->hw.modes, wpa_s->hw.num_modes) && wpa_s->conf->country[0]) { -@@ -549,6 +551,10 @@ int wpa_supplicant_join_mesh(struct wpa_ +@@ -647,6 +649,10 @@ int wpa_supplicant_join_mesh(struct wpa_ } params->conf.peer_link_timeout = wpa_s->conf->mesh_max_inactivity; @@ -193,7 +193,7 @@ Signed-off-by: Daniel Golle if (wpa_supplicant_mesh_init(wpa_s, ssid, ¶ms->freq)) { --- a/wpa_supplicant/mesh_mpm.c +++ b/wpa_supplicant/mesh_mpm.c -@@ -305,9 +305,9 @@ static void mesh_mpm_send_plink_action(s +@@ -303,9 +303,9 @@ static void mesh_mpm_send_plink_action(s info = (bss->num_plinks > 63 ? 63 : bss->num_plinks) << 1; /* TODO: Add Connected to Mesh Gate/AS subfields */ wpabuf_put_u8(buf, info); @@ -207,7 +207,7 @@ Signed-off-by: Daniel Golle wpabuf_put_u8(buf, WLAN_EID_MESH_ID); --- a/wpa_supplicant/wpa_supplicant.conf +++ b/wpa_supplicant/wpa_supplicant.conf -@@ -153,6 +153,9 @@ ap_scan=1 +@@ -150,6 +150,9 @@ ap_scan=1 # This timeout value is used in mesh STA to clean up inactive stations. #mesh_max_inactivity=300 diff --git a/package/network/services/hostapd/patches/051-wpa_supplicant-fix-race-condition-in-mesh-mpm-new-pe.patch b/package/network/services/hostapd/patches/051-wpa_supplicant-fix-race-condition-in-mesh-mpm-new-pe.patch deleted file mode 100644 index cca8d47488..0000000000 --- a/package/network/services/hostapd/patches/051-wpa_supplicant-fix-race-condition-in-mesh-mpm-new-pe.patch +++ /dev/null @@ -1,34 +0,0 @@ -From: Felix Fietkau -Date: Tue, 12 Feb 2019 14:22:43 +0100 -Subject: [PATCH v2] wpa_supplicant: fix race condition in mesh mpm new peer - handling - -When wpa_supplicant receives another new peer event before the first one -has been processed, it tries to add a station to the driver a second time -(which fails) and then tears down the station entry until another event -comes in. -Fix this by only adding a station to the driver if it didn't exist already. - -Signed-off-by: Felix Fietkau ---- - ---- a/wpa_supplicant/mesh_mpm.c -+++ b/wpa_supplicant/mesh_mpm.c -@@ -710,11 +710,12 @@ static struct sta_info * mesh_mpm_add_pe - } - - sta = ap_get_sta(data, addr); -- if (!sta) { -- sta = ap_sta_add(data, addr); -- if (!sta) -- return NULL; -- } -+ if (sta) -+ return NULL; -+ -+ sta = ap_sta_add(data, addr); -+ if (!sta) -+ return NULL; - - /* Set WMM by default since Mesh STAs are QoS STAs */ - sta->flags |= WLAN_STA_WMM; diff --git a/package/network/services/hostapd/patches/067-0001-AP-Silently-ignore-management-frame-from-unexpected-.patch b/package/network/services/hostapd/patches/067-0001-AP-Silently-ignore-management-frame-from-unexpected-.patch deleted file mode 100644 index 25ee2c9f85..0000000000 --- a/package/network/services/hostapd/patches/067-0001-AP-Silently-ignore-management-frame-from-unexpected-.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 8c07fa9eda13e835f3f968b2e1c9a8be3a851ff9 Mon Sep 17 00:00:00 2001 -From: Jouni Malinen -Date: Thu, 29 Aug 2019 11:52:04 +0300 -Subject: [PATCH] AP: Silently ignore management frame from unexpected source - address - -Do not process any received Management frames with unexpected/invalid SA -so that we do not add any state for unexpected STA addresses or end up -sending out frames to unexpected destination. This prevents unexpected -sequences where an unprotected frame might end up causing the AP to send -out a response to another device and that other device processing the -unexpected response. - -In particular, this prevents some potential denial of service cases -where the unexpected response frame from the AP might result in a -connected station dropping its association. - -Signed-off-by: Jouni Malinen ---- - src/ap/drv_callbacks.c | 13 +++++++++++++ - src/ap/ieee802_11.c | 12 ++++++++++++ - 2 files changed, 25 insertions(+) - ---- a/src/ap/drv_callbacks.c -+++ b/src/ap/drv_callbacks.c -@@ -131,6 +131,19 @@ int hostapd_notif_assoc(struct hostapd_d - "hostapd_notif_assoc: Skip event with no address"); - return -1; - } -+ -+ if (is_multicast_ether_addr(addr) || -+ is_zero_ether_addr(addr) || -+ os_memcmp(addr, hapd->own_addr, ETH_ALEN) == 0) { -+ /* Do not process any frames with unexpected/invalid SA so that -+ * we do not add any state for unexpected STA addresses or end -+ * up sending out frames to unexpected destination. */ -+ wpa_printf(MSG_DEBUG, "%s: Invalid SA=" MACSTR -+ " in received indication - ignore this indication silently", -+ __func__, MAC2STR(addr)); -+ return 0; -+ } -+ - random_add_randomness(addr, ETH_ALEN); - - hostapd_logger(hapd, addr, HOSTAPD_MODULE_IEEE80211, ---- a/src/ap/ieee802_11.c -+++ b/src/ap/ieee802_11.c -@@ -4626,6 +4626,18 @@ int ieee802_11_mgmt(struct hostapd_data - fc = le_to_host16(mgmt->frame_control); - stype = WLAN_FC_GET_STYPE(fc); - -+ if (is_multicast_ether_addr(mgmt->sa) || -+ is_zero_ether_addr(mgmt->sa) || -+ os_memcmp(mgmt->sa, hapd->own_addr, ETH_ALEN) == 0) { -+ /* Do not process any frames with unexpected/invalid SA so that -+ * we do not add any state for unexpected STA addresses or end -+ * up sending out frames to unexpected destination. */ -+ wpa_printf(MSG_DEBUG, "MGMT: Invalid SA=" MACSTR -+ " in received frame - ignore this frame silently", -+ MAC2STR(mgmt->sa)); -+ return 0; -+ } -+ - if (stype == WLAN_FC_STYPE_BEACON) { - handle_beacon(hapd, mgmt, len, fi); - return 1; diff --git a/package/network/services/hostapd/patches/070-driver_nl80211-fix-WMM-queue-mapping-for-regulatory-.patch b/package/network/services/hostapd/patches/070-driver_nl80211-fix-WMM-queue-mapping-for-regulatory-.patch deleted file mode 100644 index 240411236a..0000000000 --- a/package/network/services/hostapd/patches/070-driver_nl80211-fix-WMM-queue-mapping-for-regulatory-.patch +++ /dev/null @@ -1,41 +0,0 @@ -From: Felix Fietkau -Date: Thu, 23 Jan 2020 13:50:47 +0100 -Subject: [PATCH] driver_nl80211: fix WMM queue mapping for regulatory - limit - -nl80211 uses a different queue mapping from hostap, so AC indexes need to -be converted. - -Signed-off-by: Felix Fietkau ---- - ---- a/src/drivers/driver_nl80211_capa.c -+++ b/src/drivers/driver_nl80211_capa.c -@@ -1403,6 +1403,12 @@ static void phy_info_freq(struct hostapd - [NL80211_WMMR_AIFSN] = { .type = NLA_U8 }, - [NL80211_WMMR_TXOP] = { .type = NLA_U16 }, - }; -+ static const u8 wmm_map[4] = { -+ [NL80211_AC_BE] = WMM_AC_BE, -+ [NL80211_AC_BK] = WMM_AC_BK, -+ [NL80211_AC_VI] = WMM_AC_VI, -+ [NL80211_AC_VO] = WMM_AC_VO, -+ }; - struct nlattr *nl_wmm; - struct nlattr *tb_wmm[NL80211_WMMR_MAX + 1]; - int rem_wmm, ac, count = 0; -@@ -1424,12 +1430,13 @@ static void phy_info_freq(struct hostapd - return; - } - ac = nl_wmm->nla_type; -- if (ac < 0 || ac >= WMM_AC_NUM) { -+ if (ac >= ARRAY_SIZE(wmm_map)) { - wpa_printf(MSG_DEBUG, - "nl80211: Invalid AC value %d", ac); - return; - } - -+ ac = wmm_map[ac]; - chan->wmm_rules[ac].min_cwmin = - nla_get_u16(tb_wmm[NL80211_WMMR_CW_MIN]); - chan->wmm_rules[ac].min_cwmax = diff --git a/package/network/services/hostapd/patches/071-driver_nl80211-fix-regulatory-limits-for-wmm-cwmin-c.patch b/package/network/services/hostapd/patches/071-driver_nl80211-fix-regulatory-limits-for-wmm-cwmin-c.patch deleted file mode 100644 index fe41e2b788..0000000000 --- a/package/network/services/hostapd/patches/071-driver_nl80211-fix-regulatory-limits-for-wmm-cwmin-c.patch +++ /dev/null @@ -1,47 +0,0 @@ -From: Felix Fietkau -Date: Thu, 23 Jan 2020 14:10:20 +0100 -Subject: [PATCH] driver_nl80211: fix regulatory limits for wmm cwmin/cwmax - values - -The internal WMM AC parameters use just the exponent of the CW value, while -nl80211 reports the full CW value. -This led to completely bogus CWmin/CWmax values in the WMM IE when a regulatory -limit was present. Fix this by converting the value to the exponent before -passing it on - -Signed-off-by: Felix Fietkau ---- - ---- a/src/drivers/driver_nl80211_capa.c -+++ b/src/drivers/driver_nl80211_capa.c -@@ -1336,6 +1336,18 @@ static void phy_info_vht_capa(struct hos - } - } - -+static inline int cw2ecw(unsigned int cw) -+{ -+ int bit; -+ -+ if (cw == 0) -+ return 0; -+ -+ for (bit = 1; cw != 1; bit++) -+ cw >>= 1; -+ -+ return bit; -+} - - static void phy_info_freq(struct hostapd_hw_modes *mode, - struct hostapd_channel_data *chan, -@@ -1438,9 +1450,9 @@ static void phy_info_freq(struct hostapd - - ac = wmm_map[ac]; - chan->wmm_rules[ac].min_cwmin = -- nla_get_u16(tb_wmm[NL80211_WMMR_CW_MIN]); -+ cw2ecw(nla_get_u16(tb_wmm[NL80211_WMMR_CW_MIN])); - chan->wmm_rules[ac].min_cwmax = -- nla_get_u16(tb_wmm[NL80211_WMMR_CW_MAX]); -+ cw2ecw(nla_get_u16(tb_wmm[NL80211_WMMR_CW_MAX])); - chan->wmm_rules[ac].min_aifs = - nla_get_u8(tb_wmm[NL80211_WMMR_AIFSN]); - chan->wmm_rules[ac].max_txop = diff --git a/package/network/services/hostapd/patches/090-wolfssl-fix-crypto_bignum_sum.patch b/package/network/services/hostapd/patches/090-wolfssl-fix-crypto_bignum_sum.patch deleted file mode 100644 index 7cc0dec3fe..0000000000 --- a/package/network/services/hostapd/patches/090-wolfssl-fix-crypto_bignum_sum.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 1766e608ba1114220f3b3598e77aa53b50c38a6e Mon Sep 17 00:00:00 2001 -From: Jouni Malinen -Date: Mon, 14 Oct 2019 19:27:47 +0300 -Subject: [PATCH] wolfSSL: Fix crypto_bignum_sub() - -The initial crypto wrapper implementation for wolfSSL seems to have -included a copy-paste error in crypto_bignum_sub() implementation that -was identical to crypto_bignum_add() while mp_sub() should have been -used instead of mp_add(). - -Signed-off-by: Jouni Malinen ---- - src/crypto/crypto_wolfssl.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/src/crypto/crypto_wolfssl.c -+++ b/src/crypto/crypto_wolfssl.c -@@ -1151,7 +1151,7 @@ int crypto_bignum_sub(const struct crypt - if (TEST_FAIL()) - return -1; - -- return mp_add((mp_int *) a, (mp_int *) b, -+ return mp_sub((mp_int *) a, (mp_int *) b, - (mp_int *) r) == MP_OKAY ? 0 : -1; - } - diff --git a/package/network/services/hostapd/patches/091-0001-wolfssl-Fix-compiler-warnings-on-size_t-printf-forma.patch b/package/network/services/hostapd/patches/091-0001-wolfssl-Fix-compiler-warnings-on-size_t-printf-forma.patch deleted file mode 100644 index 464bcff0b5..0000000000 --- a/package/network/services/hostapd/patches/091-0001-wolfssl-Fix-compiler-warnings-on-size_t-printf-forma.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 6a28c4dbc102de3fed9db44637f47a10e7adfb78 Mon Sep 17 00:00:00 2001 -From: Jouni Malinen -Date: Sat, 16 May 2020 21:01:51 +0300 -Subject: [PATCH 1/3] wolfssl: Fix compiler warnings on size_t printf format - use - -Signed-off-by: Jouni Malinen ---- - src/crypto/tls_wolfssl.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - ---- a/src/crypto/tls_wolfssl.c -+++ b/src/crypto/tls_wolfssl.c -@@ -1741,7 +1741,7 @@ struct wpabuf * tls_connection_encrypt(v - if (!conn) - return NULL; - -- wpa_printf(MSG_DEBUG, "SSL: encrypt: %ld bytes", wpabuf_len(in_data)); -+ wpa_printf(MSG_DEBUG, "SSL: encrypt: %zu bytes", wpabuf_len(in_data)); - - wolfssl_reset_out_data(&conn->output); - -@@ -1792,7 +1792,7 @@ struct wpabuf * tls_connection_decrypt(v - } - wpabuf_put(buf, res); - -- wpa_printf(MSG_DEBUG, "SSL: decrypt: %ld bytes", wpabuf_len(buf)); -+ wpa_printf(MSG_DEBUG, "SSL: decrypt: %zu bytes", wpabuf_len(buf)); - - return buf; - } diff --git a/package/network/services/hostapd/patches/091-0002-wolfssl-Fix-crypto_bignum_rand-implementation.patch b/package/network/services/hostapd/patches/091-0002-wolfssl-Fix-crypto_bignum_rand-implementation.patch deleted file mode 100644 index 2464b63489..0000000000 --- a/package/network/services/hostapd/patches/091-0002-wolfssl-Fix-crypto_bignum_rand-implementation.patch +++ /dev/null @@ -1,49 +0,0 @@ -From eb595b3e3ab531645a5bde71cf6385335b7a4b95 Mon Sep 17 00:00:00 2001 -From: Jouni Malinen -Date: Sat, 16 May 2020 21:02:17 +0300 -Subject: [PATCH 2/3] wolfssl: Fix crypto_bignum_rand() implementation - -The previous implementation used mp_rand_prime() to generate a random -value in range 0..m. That is insanely slow way of generating a random -value since mp_rand_prime() is for generating a random _prime_ which is -not what is needed here. Replace that implementation with generationg of -a random value in the requested range without doing any kind of prime -number checks or loops to reject values that are not primes. - -This speeds up SAE and EAP-pwd routines by couple of orders of -magnitude.. - -Signed-off-by: Jouni Malinen ---- - src/crypto/crypto_wolfssl.c | 12 +++++++----- - 1 file changed, 7 insertions(+), 5 deletions(-) - ---- a/src/crypto/crypto_wolfssl.c -+++ b/src/crypto/crypto_wolfssl.c -@@ -1084,19 +1084,21 @@ int crypto_bignum_rand(struct crypto_big - { - int ret = 0; - WC_RNG rng; -+ size_t len; -+ u8 *buf; - - if (TEST_FAIL()) - return -1; - if (wc_InitRng(&rng) != 0) - return -1; -- if (mp_rand_prime((mp_int *) r, -- (mp_count_bits((mp_int *) m) + 7) / 8 * 2, -- &rng, NULL) != 0) -- ret = -1; -- if (ret == 0 && -+ len = (mp_count_bits((mp_int *) m) + 7) / 8; -+ buf = os_malloc(len); -+ if (!buf || wc_RNG_GenerateBlock(&rng, buf, len) != 0 || -+ mp_read_unsigned_bin((mp_int *) r, buf, len) != MP_OKAY || - mp_mod((mp_int *) r, (mp_int *) m, (mp_int *) r) != 0) - ret = -1; - wc_FreeRng(&rng); -+ bin_clear_free(buf, len); - return ret; - } - diff --git a/package/network/services/hostapd/patches/091-0003-wolfssl-Do-not-hardcode-include-directory-in-wpa_sup.patch b/package/network/services/hostapd/patches/091-0003-wolfssl-Do-not-hardcode-include-directory-in-wpa_sup.patch deleted file mode 100644 index b15dccd7d1..0000000000 --- a/package/network/services/hostapd/patches/091-0003-wolfssl-Do-not-hardcode-include-directory-in-wpa_sup.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 79488da576aeeb9400e1742fab7f463eed0fa7a1 Mon Sep 17 00:00:00 2001 -From: Jouni Malinen -Date: Sat, 16 May 2020 21:07:45 +0300 -Subject: [PATCH 3/3] wolfssl: Do not hardcode include directory in - wpa_supplicant build - -This is not really appropriate for any kind of cross compilations and is -not really needed in general since system specific values can be set in -.config. - -Signed-off-by: Jouni Malinen ---- - wpa_supplicant/Makefile | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/wpa_supplicant/Makefile -+++ b/wpa_supplicant/Makefile -@@ -1086,7 +1086,7 @@ endif - - ifeq ($(CONFIG_TLS), wolfssl) - ifdef TLS_FUNCS --CFLAGS += -DWOLFSSL_DER_LOAD -I/usr/local/include/wolfssl -+CFLAGS += -DWOLFSSL_DER_LOAD - OBJS += ../src/crypto/tls_wolfssl.o - endif - OBJS += ../src/crypto/crypto_wolfssl.o diff --git a/package/network/services/hostapd/patches/100-daemonize_fix.patch b/package/network/services/hostapd/patches/100-daemonize_fix.patch index 43057ef9fe..687bd4082d 100644 --- a/package/network/services/hostapd/patches/100-daemonize_fix.patch +++ b/package/network/services/hostapd/patches/100-daemonize_fix.patch @@ -8,7 +8,7 @@ #ifdef ANDROID #include -@@ -182,59 +183,46 @@ int os_gmtime(os_time_t t, struct os_tm +@@ -188,59 +189,46 @@ int os_gmtime(os_time_t t, struct os_tm return 0; } diff --git a/package/network/services/hostapd/patches/110-notify-mgmt-frames.patch b/package/network/services/hostapd/patches/110-notify-mgmt-frames.patch new file mode 100644 index 0000000000..9e187253d4 --- /dev/null +++ b/package/network/services/hostapd/patches/110-notify-mgmt-frames.patch @@ -0,0 +1,116 @@ +From 53f8fdb534d5222a0e852e38afde3f49832ace06 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rapha=C3=ABl=20M=C3=A9lotte?= +Date: Thu, 26 Nov 2020 09:27:40 +0100 +Subject: [PATCH] hostapd: Add an option to notify management frames on + ctrl_iface +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +In some contexts (e.g. Multi-AP) it can be useful to have access to +some of the management frames in upper layers (e.g. to be able to +process the content of association requests externally). + +Add 'notify_mgmt_frames'. When enabled, it will notify the ctrl_iface +when a management frame arrives using 'AP_MGMT_FRAME_RECEIVED'. + +Note that to avoid completely flooding the ctrl_iface, not all +management frames are included (e.g. beacons are excluded). + +Signed-off-by: Raphaël Mélotte +--- + hostapd/config_file.c | 2 ++ + hostapd/hostapd.conf | 4 ++++ + src/ap/ap_config.h | 2 ++ + src/ap/ieee802_11.c | 25 +++++++++++++++++++++++++ + src/common/wpa_ctrl.h | 3 +++ + 5 files changed, 36 insertions(+) + +--- a/hostapd/config_file.c ++++ b/hostapd/config_file.c +@@ -4456,6 +4456,8 @@ static int hostapd_config_fill(struct ho + bss->multicast_to_unicast = atoi(pos); + } else if (os_strcmp(buf, "broadcast_deauth") == 0) { + bss->broadcast_deauth = atoi(pos); ++ } else if (os_strcmp(buf, "notify_mgmt_frames") == 0) { ++ conf->notify_mgmt_frames = atoi(pos); + #ifdef CONFIG_DPP + } else if (os_strcmp(buf, "dpp_name") == 0) { + os_free(bss->dpp_name); +--- a/hostapd/hostapd.conf ++++ b/hostapd/hostapd.conf +@@ -571,6 +571,10 @@ wmm_ac_vo_acm=0 + # Default: 1 (enabled) + #broadcast_deauth=1 + ++# Get notifications for management frames: ++# Default: 0 (disabled) ++#notify_mgmt_frames=0 ++ + ##### IEEE 802.11n related configuration ###################################### + + # ieee80211n: Whether IEEE 802.11n (HT) is enabled +--- a/src/ap/ap_config.h ++++ b/src/ap/ap_config.h +@@ -1060,6 +1060,8 @@ struct hostapd_config { + unsigned int airtime_update_interval; + #define AIRTIME_MODE_MAX (__AIRTIME_MODE_MAX - 1) + #endif /* CONFIG_AIRTIME_POLICY */ ++ ++ u8 notify_mgmt_frames; + }; + + +--- a/src/ap/ieee802_11.c ++++ b/src/ap/ieee802_11.c +@@ -4878,6 +4878,28 @@ static int handle_action(struct hostapd_ + return 1; + } + ++/** ++ * notify_mgmt_frame - notify of management frames on the control interface. ++ * @hapd: hostapd BSS data structure (the BSS to which the management frame was ++ * sent to) ++ * @buf: management frame data (starting from IEEE 802.11 header) ++ * @len: length of frame data in octets ++ * ++ * Notify the control interface of any management frame. ++ */ ++static void notify_mgmt_frame(struct hostapd_data *hapd, const u8 *buf, ++ size_t len) ++{ ++ ++ int hex_len = len * 2 + 1; ++ char *hex = os_malloc(hex_len); ++ ++ if (hex) { ++ wpa_snprintf_hex(hex, hex_len, buf, len); ++ wpa_msg_ctrl(hapd->msg_ctx, MSG_INFO, AP_MGMT_FRAME_RECEIVED "buf=%s", hex); ++ os_free(hex); ++ } ++} + + /** + * ieee802_11_mgmt - process incoming IEEE 802.11 management frames +@@ -4969,6 +4991,9 @@ int ieee802_11_mgmt(struct hostapd_data + if (hapd->iconf->track_sta_max_num) + sta_track_add(hapd->iface, mgmt->sa, ssi_signal); + ++ if (hapd->iconf->notify_mgmt_frames) ++ notify_mgmt_frame(hapd, buf, len); ++ + switch (stype) { + case WLAN_FC_STYPE_AUTH: + wpa_printf(MSG_DEBUG, "mgmt::auth"); +--- a/src/common/wpa_ctrl.h ++++ b/src/common/wpa_ctrl.h +@@ -396,6 +396,9 @@ extern "C" { + #define BIT(x) (1U << (x)) + #endif + ++/* Event triggered for received management frame */ ++#define AP_MGMT_FRAME_RECEIVED "AP-MGMT-FRAME-RECEIVED " ++ + /* BSS command information masks */ + + #define WPA_BSS_MASK_ALL 0xFFFDFFFF diff --git a/package/network/services/hostapd/patches/120-reconfigure-wps-credentials.patch b/package/network/services/hostapd/patches/120-reconfigure-wps-credentials.patch new file mode 100644 index 0000000000..1826b6685b --- /dev/null +++ b/package/network/services/hostapd/patches/120-reconfigure-wps-credentials.patch @@ -0,0 +1,178 @@ +From b389a77a0f6dccf495dbce5be9476000f6ec06a2 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rapha=C3=ABl=20M=C3=A9lotte?= +Date: Wed, 9 Dec 2020 19:55:53 +0100 +Subject: [PATCH] wps: reconfigure credentials on reload +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +When new credentials are configured and hostapd is reconfigured using +SIGHUP (or reload on the ctrl_iface), also update the wps credentials. + +Before these changes, when WPS is triggered the registar always serves +the credentials that were configured when hostapd started. + +Signed-off-by: Raphaël Mélotte +--- + src/ap/wps_hostapd.c | 86 +++++++++++++++++++++++++++++++++++++++-- + src/wps/wps.h | 6 +++ + src/wps/wps_registrar.c | 29 ++++++++++++++ + 3 files changed, 118 insertions(+), 3 deletions(-) + +--- a/src/ap/wps_hostapd.c ++++ b/src/ap/wps_hostapd.c +@@ -1375,6 +1375,43 @@ static void hostapd_wps_nfc_clear(struct + #endif /* CONFIG_WPS_NFC */ + } + ++int hostapd_wps_update_multi_ap(struct hostapd_data *hapd, ++ struct wps_registrar *reg) { ++ struct hostapd_bss_config *conf = hapd->conf; ++ u8 *multi_ap_backhaul_network_key = NULL; ++ size_t multi_ap_backhaul_network_key_len = 0; ++ int ret = -1; ++ ++ if ((conf->multi_ap & FRONTHAUL_BSS) && ++ conf->multi_ap_backhaul_ssid.ssid_len) { ++ if (conf->multi_ap_backhaul_ssid.wpa_passphrase) { ++ multi_ap_backhaul_network_key = ++ (u8 *) os_strdup(conf->multi_ap_backhaul_ssid.wpa_passphrase); ++ if (multi_ap_backhaul_network_key == NULL) ++ return -1; ++ multi_ap_backhaul_network_key_len = ++ os_strlen(conf->multi_ap_backhaul_ssid.wpa_passphrase); ++ } else if (conf->multi_ap_backhaul_ssid.wpa_psk) { ++ multi_ap_backhaul_network_key = os_malloc(2 * PMK_LEN + 1); ++ if (multi_ap_backhaul_network_key == NULL) ++ return -1; ++ wpa_snprintf_hex((char *) multi_ap_backhaul_network_key, ++ 2 * PMK_LEN + 1, ++ conf->multi_ap_backhaul_ssid.wpa_psk->psk, ++ PMK_LEN); ++ multi_ap_backhaul_network_key_len = 2 * PMK_LEN; ++ } ++ ret = wps_registrar_update_multi_ap(reg, ++ conf->multi_ap_backhaul_ssid.ssid, ++ conf->multi_ap_backhaul_ssid.ssid_len, ++ multi_ap_backhaul_network_key, ++ multi_ap_backhaul_network_key_len); ++ os_free(multi_ap_backhaul_network_key); ++ } ++ return ret; ++} ++ ++ + + void hostapd_deinit_wps(struct hostapd_data *hapd) + { +@@ -1409,11 +1446,54 @@ void hostapd_update_wps(struct hostapd_d + hapd->wps->upc = hapd->conf->upc; + #endif /* CONFIG_WPS_UPNP */ + +- hostapd_wps_set_vendor_ext(hapd, hapd->wps); +- hostapd_wps_set_application_ext(hapd, hapd->wps); ++ struct wps_context *wps = hapd->wps; ++ struct hostapd_bss_config *conf = hapd->conf; ++ ++ os_memcpy(wps->ssid, conf->ssid.ssid, conf->ssid.ssid_len); ++ wps->ssid_len = conf->ssid.ssid_len; ++ ++ /* Clear wps settings, then fill them again */ ++ os_free(wps->network_key); ++ wps->network_key = NULL; ++ wps->network_key_len = 0; ++ wps->psk_set = 0; ++ if (conf->ssid.wpa_psk_file) { ++ /* Use per-device PSKs */ ++ } else if (conf->ssid.wpa_passphrase) { ++ wps->network_key = (u8 *) os_strdup(conf->ssid.wpa_passphrase); ++ if (wps->network_key == NULL) ++ return; ++ wps->network_key_len = os_strlen(conf->ssid.wpa_passphrase); ++ } else if (conf->ssid.wpa_psk) { ++ wps->network_key = os_malloc(2 * PMK_LEN + 1); ++ if (wps->network_key == NULL) ++ return; ++ wpa_snprintf_hex((char *) wps->network_key, 2 * PMK_LEN + 1, ++ conf->ssid.wpa_psk->psk, PMK_LEN); ++ wps->network_key_len = 2 * PMK_LEN; ++#ifdef CONFIG_WEP ++ } else if (conf->ssid.wep.keys_set && conf->ssid.wep.key[0]) { ++ wps->network_key = os_malloc(conf->ssid.wep.len[0]); ++ if (wps->network_key == NULL) ++ return; ++ os_memcpy(wps->network_key, conf->ssid.wep.key[0], ++ conf->ssid.wep.len[0]); ++ wps->network_key_len = conf->ssid.wep.len[0]; ++#endif /* CONFIG_WEP */ ++ } ++ ++ if (conf->ssid.wpa_psk) { ++ os_memcpy(wps->psk, conf->ssid.wpa_psk->psk, PMK_LEN); ++ wps->psk_set = 1; ++ } ++ ++ hostapd_wps_update_multi_ap(hapd, wps->registrar); ++ ++ hostapd_wps_set_vendor_ext(hapd, wps); ++ hostapd_wps_set_application_ext(hapd, wps); + + if (hapd->conf->wps_state) +- wps_registrar_update_ie(hapd->wps->registrar); ++ wps_registrar_update_ie(wps->registrar); + else + hostapd_deinit_wps(hapd); + } +--- a/src/wps/wps.h ++++ b/src/wps/wps.h +@@ -938,6 +938,12 @@ struct wpabuf * wps_build_nfc_handover_s + struct wpabuf *nfc_dh_pubkey, + struct wpabuf *nfc_dev_pw); + ++int wps_registrar_update_multi_ap(struct wps_registrar *reg, ++ const u8 *multi_ap_backhaul_ssid, ++ size_t multi_ap_backhaul_ssid_len, ++ const u8 *multi_ap_backhaul_network_key, ++ size_t multi_ap_backhaul_network_key_len); ++ + /* ndef.c */ + struct wpabuf * ndef_parse_wifi(const struct wpabuf *buf); + struct wpabuf * ndef_build_wifi(const struct wpabuf *buf); +--- a/src/wps/wps_registrar.c ++++ b/src/wps/wps_registrar.c +@@ -3669,6 +3669,35 @@ int wps_registrar_config_ap(struct wps_r + } + + ++int wps_registrar_update_multi_ap(struct wps_registrar *reg, ++ const u8 *multi_ap_backhaul_ssid, ++ size_t multi_ap_backhaul_ssid_len, ++ const u8 *multi_ap_backhaul_network_key, ++ size_t multi_ap_backhaul_network_key_len) ++{ ++ if (multi_ap_backhaul_ssid != NULL) { ++ os_memcpy(reg->multi_ap_backhaul_ssid, ++ multi_ap_backhaul_ssid, ++ multi_ap_backhaul_ssid_len); ++ reg->multi_ap_backhaul_ssid_len = ++ multi_ap_backhaul_ssid_len; ++ } ++ os_free(reg->multi_ap_backhaul_network_key); ++ reg->multi_ap_backhaul_network_key = NULL; ++ reg->multi_ap_backhaul_network_key_len = 0; ++ ++ if (multi_ap_backhaul_network_key != NULL) { ++ reg->multi_ap_backhaul_network_key = ++ os_memdup(multi_ap_backhaul_network_key, ++ multi_ap_backhaul_network_key_len); ++ if (reg->multi_ap_backhaul_network_key == NULL) ++ return -1; ++ reg->multi_ap_backhaul_network_key_len = ++ multi_ap_backhaul_network_key_len; ++ } ++ return 0; ++} ++ + #ifdef CONFIG_WPS_NFC + + int wps_registrar_add_nfc_pw_token(struct wps_registrar *reg, diff --git a/package/network/services/hostapd/patches/130-wpa_supplicant-multi_ap_roam.patch b/package/network/services/hostapd/patches/130-wpa_supplicant-multi_ap_roam.patch new file mode 100644 index 0000000000..fd3017af92 --- /dev/null +++ b/package/network/services/hostapd/patches/130-wpa_supplicant-multi_ap_roam.patch @@ -0,0 +1,37 @@ +From 8a4893dd06eb236460db4937f3c54e246739ad28 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rapha=C3=ABl=20M=C3=A9lotte?= +Date: Wed, 3 Feb 2021 14:23:17 +0100 +Subject: [PATCH] wpa_supplicant: multi_ap: only enable 4addr mode if not + already enabled +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +If 4addr mode is already enabled, the call to enable it a second time +may fail. If this happens when roaming, it leads to deauthentication. + +Signed-off-by: Raphaël Mélotte +--- + wpa_supplicant/events.c | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) + +--- a/wpa_supplicant/events.c ++++ b/wpa_supplicant/events.c +@@ -2589,11 +2589,13 @@ static void multi_ap_set_4addr_mode(stru + goto fail; + } + +- if (wpa_drv_set_4addr_mode(wpa_s, 1) < 0) { +- wpa_printf(MSG_ERROR, "Failed to set 4addr mode"); +- goto fail; ++ if (wpa_s->enabled_4addr_mode == 0) { ++ if (wpa_drv_set_4addr_mode(wpa_s, 1) < 0) { ++ wpa_printf(MSG_ERROR, "Failed to set 4addr mode"); ++ goto fail; ++ } ++ wpa_s->enabled_4addr_mode = 1; + } +- wpa_s->enabled_4addr_mode = 1; + return; + + fail: diff --git a/package/network/services/hostapd/patches/200-multicall.patch b/package/network/services/hostapd/patches/200-multicall.patch index a8597edae4..4f3e3decfe 100644 --- a/package/network/services/hostapd/patches/200-multicall.patch +++ b/package/network/services/hostapd/patches/200-multicall.patch @@ -1,6 +1,6 @@ --- a/hostapd/Makefile +++ b/hostapd/Makefile -@@ -28,6 +28,7 @@ CFLAGS += -I$(abspath ../src/utils) +@@ -31,6 +31,7 @@ CFLAGS += -I$(abspath ../src/utils) export BINDIR ?= /usr/local/bin/ -include .config @@ -8,7 +8,7 @@ ifndef CONFIG_NO_GITVER # Add VERSION_STR postfix for builds from a git repository -@@ -198,7 +199,8 @@ endif +@@ -204,7 +205,8 @@ endif ifdef CONFIG_NO_VLAN CFLAGS += -DCONFIG_NO_VLAN @@ -18,7 +18,7 @@ OBJS += ../src/ap/vlan_init.o OBJS += ../src/ap/vlan_ifconfig.o OBJS += ../src/ap/vlan.o -@@ -366,10 +368,14 @@ CFLAGS += -DCONFIG_MBO +@@ -354,10 +356,14 @@ CFLAGS += -DCONFIG_MBO OBJS += ../src/ap/mbo_ap.o endif @@ -36,7 +36,7 @@ LIBS += $(DRV_AP_LIBS) ifdef CONFIG_L2_PACKET -@@ -1316,6 +1322,12 @@ install: $(addprefix $(DESTDIR)$(BINDIR) +@@ -1311,6 +1317,12 @@ install: $(addprefix $(DESTDIR)$(BINDIR) BCHECK=../src/drivers/build.hostapd @@ -49,9 +49,9 @@ hostapd: $(BCHECK) $(OBJS) $(Q)$(CC) $(LDFLAGS) -o hostapd $(OBJS) $(LIBS) @$(E) " LD " $@ -@@ -1358,6 +1370,12 @@ ifeq ($(CONFIG_TLS), linux) - HOBJS += ../src/crypto/crypto_linux.o - endif +@@ -1374,6 +1386,12 @@ SOBJS += ../src/crypto/sha256-kdf.o + SOBJS += ../src/crypto/sha384-kdf.o + SOBJS += ../src/crypto/sha512-kdf.o +dump_cflags: + @printf "%s " "$(CFLAGS)" @@ -72,7 +72,7 @@ ifndef CONFIG_NO_GITVER # Add VERSION_STR postfix for builds from a git repository -@@ -363,7 +364,9 @@ endif +@@ -369,7 +370,9 @@ endif ifdef CONFIG_IBSS_RSN NEED_RSN_AUTHENTICATOR=y CFLAGS += -DCONFIG_IBSS_RSN @@ -82,7 +82,7 @@ OBJS += ibss_rsn.o endif -@@ -892,6 +895,10 @@ ifdef CONFIG_DYNAMIC_EAP_METHODS +@@ -890,6 +893,10 @@ ifdef CONFIG_DYNAMIC_EAP_METHODS CFLAGS += -DCONFIG_DYNAMIC_EAP_METHODS LIBS += -ldl -rdynamic endif @@ -93,7 +93,7 @@ endif ifdef CONFIG_AP -@@ -899,9 +906,11 @@ NEED_EAP_COMMON=y +@@ -897,9 +904,11 @@ NEED_EAP_COMMON=y NEED_RSN_AUTHENTICATOR=y CFLAGS += -DCONFIG_AP OBJS += ap.o @@ -105,7 +105,7 @@ OBJS += ../src/ap/hostapd.o OBJS += ../src/ap/wpa_auth_glue.o OBJS += ../src/ap/utils.o -@@ -983,6 +992,12 @@ endif +@@ -979,6 +988,12 @@ endif ifdef CONFIG_HS20 OBJS += ../src/ap/hs20.o endif @@ -118,7 +118,7 @@ endif ifdef CONFIG_MBO -@@ -991,7 +1006,9 @@ CFLAGS += -DCONFIG_MBO +@@ -987,7 +1002,9 @@ CFLAGS += -DCONFIG_MBO endif ifdef NEED_RSN_AUTHENTICATOR @@ -128,7 +128,7 @@ NEED_AES_WRAP=y OBJS += ../src/ap/wpa_auth.o OBJS += ../src/ap/wpa_auth_ie.o -@@ -1899,6 +1916,12 @@ wpa_priv: $(BCHECK) $(OBJS_priv) +@@ -1897,6 +1914,12 @@ wpa_priv: $(BCHECK) $(OBJS_priv) $(OBJS_c) $(OBJS_t) $(OBJS_t2) $(OBJS) $(BCHECK) $(EXTRA_progs): .config @@ -141,7 +141,7 @@ wpa_supplicant: $(BCHECK) $(OBJS) $(EXTRA_progs) $(Q)$(LDO) $(LDFLAGS) -o wpa_supplicant $(OBJS) $(LIBS) $(EXTRALIBS) @$(E) " LD " $@ -@@ -1999,6 +2022,12 @@ endif +@@ -1997,6 +2020,12 @@ endif $(Q)sed -e 's|\@BINDIR\@|$(BINDIR)|g' $< >$@ @$(E) " sed" $< @@ -156,7 +156,7 @@ wpa_cli.exe: wpa_cli --- a/src/drivers/driver.h +++ b/src/drivers/driver.h -@@ -5657,8 +5657,8 @@ union wpa_event_data { +@@ -5886,8 +5886,8 @@ union wpa_event_data { * Driver wrapper code should call this function whenever an event is received * from the driver. */ @@ -167,7 +167,7 @@ /** * wpa_supplicant_event_global - Report a driver event for wpa_supplicant -@@ -5670,7 +5670,7 @@ void wpa_supplicant_event(void *ctx, enu +@@ -5899,7 +5899,7 @@ void wpa_supplicant_event(void *ctx, enu * Same as wpa_supplicant_event(), but we search for the interface in * wpa_global. */ @@ -178,7 +178,7 @@ /* --- a/src/ap/drv_callbacks.c +++ b/src/ap/drv_callbacks.c -@@ -1669,8 +1669,8 @@ err: +@@ -1789,8 +1789,8 @@ err: #endif /* CONFIG_OWE */ @@ -189,7 +189,7 @@ { struct hostapd_data *hapd = ctx; #ifndef CONFIG_NO_STDOUT_DEBUG -@@ -1915,7 +1915,7 @@ void wpa_supplicant_event(void *ctx, enu +@@ -2035,7 +2035,7 @@ void wpa_supplicant_event(void *ctx, enu } @@ -200,7 +200,7 @@ struct hapd_interfaces *interfaces = ctx; --- a/wpa_supplicant/wpa_priv.c +++ b/wpa_supplicant/wpa_priv.c -@@ -1031,8 +1031,8 @@ static void wpa_priv_send_ft_response(st +@@ -1038,8 +1038,8 @@ static void wpa_priv_send_ft_response(st } @@ -211,7 +211,7 @@ { struct wpa_priv_interface *iface = ctx; -@@ -1095,7 +1095,7 @@ void wpa_supplicant_event(void *ctx, enu +@@ -1102,7 +1102,7 @@ void wpa_supplicant_event(void *ctx, enu } @@ -220,7 +220,7 @@ union wpa_event_data *data) { struct wpa_priv_global *global = ctx; -@@ -1207,6 +1207,8 @@ int main(int argc, char *argv[]) +@@ -1215,6 +1215,8 @@ int main(int argc, char *argv[]) if (os_program_init()) return -1; @@ -231,7 +231,7 @@ os_memset(&global, 0, sizeof(global)); --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c -@@ -4184,8 +4184,8 @@ static void wpas_event_assoc_reject(stru +@@ -4581,8 +4581,8 @@ static void wpas_event_unprot_beacon(str } @@ -242,7 +242,7 @@ { struct wpa_supplicant *wpa_s = ctx; int resched; -@@ -4967,7 +4967,7 @@ void wpa_supplicant_event(void *ctx, enu +@@ -5400,7 +5400,7 @@ void wpa_supplicant_event(void *ctx, enu } @@ -253,7 +253,7 @@ struct wpa_supplicant *wpa_s; --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -6096,7 +6096,6 @@ struct wpa_interface * wpa_supplicant_ma +@@ -6594,7 +6594,6 @@ struct wpa_interface * wpa_supplicant_ma return NULL; } @@ -261,7 +261,7 @@ /** * wpa_supplicant_match_existing - Match existing interfaces * @global: Pointer to global data from wpa_supplicant_init() -@@ -6133,6 +6132,11 @@ static int wpa_supplicant_match_existing +@@ -6631,6 +6630,11 @@ static int wpa_supplicant_match_existing #endif /* CONFIG_MATCH_IFACE */ @@ -273,7 +273,7 @@ /** * wpa_supplicant_add_iface - Add a new network interface -@@ -6389,6 +6393,8 @@ struct wpa_global * wpa_supplicant_init( +@@ -6887,6 +6891,8 @@ struct wpa_global * wpa_supplicant_init( #ifndef CONFIG_NO_WPA_MSG wpa_msg_register_ifname_cb(wpa_supplicant_msg_ifname_cb); #endif /* CONFIG_NO_WPA_MSG */ @@ -284,7 +284,7 @@ wpa_debug_open_file(params->wpa_debug_file_path); --- a/hostapd/main.c +++ b/hostapd/main.c -@@ -592,6 +592,11 @@ fail: +@@ -590,6 +590,11 @@ fail: return -1; } @@ -296,7 +296,7 @@ #ifdef CONFIG_WPS static int gen_uuid(const char *txt_addr) -@@ -682,6 +687,8 @@ int main(int argc, char *argv[]) +@@ -684,6 +689,8 @@ int main(int argc, char *argv[]) return -1; #endif /* CONFIG_DPP */ diff --git a/package/network/services/hostapd/patches/300-noscan.patch b/package/network/services/hostapd/patches/300-noscan.patch index 4c3728bc8f..638b76f84e 100644 --- a/package/network/services/hostapd/patches/300-noscan.patch +++ b/package/network/services/hostapd/patches/300-noscan.patch @@ -1,9 +1,9 @@ --- a/hostapd/config_file.c +++ b/hostapd/config_file.c -@@ -3411,6 +3411,10 @@ static int hostapd_config_fill(struct ho +@@ -3493,6 +3493,10 @@ static int hostapd_config_fill(struct ho + if (bss->ocv && !bss->ieee80211w) bss->ieee80211w = 1; #endif /* CONFIG_OCV */ - #ifdef CONFIG_IEEE80211N + } else if (os_strcmp(buf, "noscan") == 0) { + conf->noscan = atoi(pos); + } else if (os_strcmp(buf, "ht_coex") == 0) { @@ -13,7 +13,7 @@ } else if (os_strcmp(buf, "ht_capab") == 0) { --- a/src/ap/ap_config.h +++ b/src/ap/ap_config.h -@@ -934,6 +934,8 @@ struct hostapd_config { +@@ -984,6 +984,8 @@ struct hostapd_config { int ht_op_mode_fixed; u16 ht_capab; @@ -24,7 +24,7 @@ int no_pri_sec_switch; --- a/src/ap/hw_features.c +++ b/src/ap/hw_features.c -@@ -477,7 +477,8 @@ static int ieee80211n_check_40mhz(struct +@@ -500,7 +500,8 @@ static int ieee80211n_check_40mhz(struct int ret; /* Check that HT40 is used and PRI / SEC switch is allowed */ @@ -36,7 +36,7 @@ hostapd_set_state(iface, HAPD_IFACE_HT_SCAN); --- a/src/ap/ieee802_11_ht.c +++ b/src/ap/ieee802_11_ht.c -@@ -252,6 +252,9 @@ void hostapd_2040_coex_action(struct hos +@@ -230,6 +230,9 @@ void hostapd_2040_coex_action(struct hos return; } @@ -46,7 +46,7 @@ if (len < IEEE80211_HDRLEN + 2 + sizeof(*bc_ie)) { wpa_printf(MSG_DEBUG, "Ignore too short 20/40 BSS Coexistence Management frame"); -@@ -412,6 +415,9 @@ void ht40_intolerant_add(struct hostapd_ +@@ -390,6 +393,9 @@ void ht40_intolerant_add(struct hostapd_ if (iface->current_mode->mode != HOSTAPD_MODE_IEEE80211G) return; diff --git a/package/network/services/hostapd/patches/301-mesh-noscan.patch b/package/network/services/hostapd/patches/301-mesh-noscan.patch index b1450ef6db..f85b72453e 100644 --- a/package/network/services/hostapd/patches/301-mesh-noscan.patch +++ b/package/network/services/hostapd/patches/301-mesh-noscan.patch @@ -1,6 +1,6 @@ --- a/wpa_supplicant/config.c +++ b/wpa_supplicant/config.c -@@ -2312,6 +2312,7 @@ static const struct parse_data ssid_fiel +@@ -2478,6 +2478,7 @@ static const struct parse_data ssid_fiel #else /* CONFIG_MESH */ { INT_RANGE(mode, 0, 4) }, #endif /* CONFIG_MESH */ @@ -10,28 +10,28 @@ { STR(id_str) }, --- a/wpa_supplicant/config_file.c +++ b/wpa_supplicant/config_file.c -@@ -829,6 +829,7 @@ static void wpa_config_write_network(FIL +@@ -866,6 +866,7 @@ static void wpa_config_write_network(FIL #endif /* IEEE8021X_EAPOL */ INT(mode); INT(no_auto_peer); + INT(noscan); INT(mesh_fwding); INT(frequency); - INT(fixed_freq); + INT(enable_edmg); --- a/wpa_supplicant/mesh.c +++ b/wpa_supplicant/mesh.c -@@ -361,6 +361,8 @@ static int wpa_supplicant_mesh_init(stru +@@ -467,6 +467,8 @@ static int wpa_supplicant_mesh_init(stru frequency); goto out_free; } + if (ssid->noscan) + conf->noscan = 1; - if (ssid->ht40) - conf->secondary_channel = ssid->ht40; - if (conf->hw_mode == HOSTAPD_MODE_IEEE80211A && ssid->vht) { + + if (ssid->mesh_basic_rates == NULL) { + /* --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -2143,12 +2143,12 @@ void ibss_mesh_setup_freq(struct wpa_sup +@@ -2334,12 +2334,12 @@ void ibss_mesh_setup_freq(struct wpa_sup int ieee80211_mode = wpas_mode_to_ieee80211_mode(ssid->mode); enum hostapd_hw_mode hw_mode; struct hostapd_hw_modes *mode = NULL; @@ -46,8 +46,8 @@ unsigned int j, k; struct hostapd_freq_params vht_freq; int chwidth, seg0, seg1; -@@ -2221,7 +2221,7 @@ void ibss_mesh_setup_freq(struct wpa_sup - return; +@@ -2421,7 +2421,7 @@ void ibss_mesh_setup_freq(struct wpa_sup + #endif /* CONFIG_HE_OVERRIDES */ /* Setup higher BW only for 5 GHz */ - if (mode->mode != HOSTAPD_MODE_IEEE80211A) @@ -57,7 +57,7 @@ for (chan_idx = 0; chan_idx < mode->num_channels; chan_idx++) { --- a/wpa_supplicant/config_ssid.h +++ b/wpa_supplicant/config_ssid.h -@@ -918,6 +918,8 @@ struct wpa_ssid { +@@ -971,6 +971,8 @@ struct wpa_ssid { */ int no_auto_peer; diff --git a/package/network/services/hostapd/patches/310-rescan_immediately.patch b/package/network/services/hostapd/patches/310-rescan_immediately.patch index 8d0307c3a2..0040b61c6b 100644 --- a/package/network/services/hostapd/patches/310-rescan_immediately.patch +++ b/package/network/services/hostapd/patches/310-rescan_immediately.patch @@ -1,6 +1,6 @@ --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -4474,7 +4474,7 @@ wpa_supplicant_alloc(struct wpa_supplica +@@ -4949,7 +4949,7 @@ wpa_supplicant_alloc(struct wpa_supplica if (wpa_s == NULL) return NULL; wpa_s->scan_req = INITIAL_SCAN_REQ; diff --git a/package/network/services/hostapd/patches/320-optional_rfkill.patch b/package/network/services/hostapd/patches/320-optional_rfkill.patch index 9a3afad1f8..a703c7e132 100644 --- a/package/network/services/hostapd/patches/320-optional_rfkill.patch +++ b/package/network/services/hostapd/patches/320-optional_rfkill.patch @@ -24,7 +24,7 @@ endif ifdef NEED_NETLINK -@@ -146,6 +143,7 @@ endif +@@ -142,6 +139,7 @@ endif ifdef NEED_RFKILL DRV_OBJS += ../src/drivers/rfkill.o diff --git a/package/network/services/hostapd/patches/330-nl80211_fix_set_freq.patch b/package/network/services/hostapd/patches/330-nl80211_fix_set_freq.patch index 13343e22e6..9e2551ce60 100644 --- a/package/network/services/hostapd/patches/330-nl80211_fix_set_freq.patch +++ b/package/network/services/hostapd/patches/330-nl80211_fix_set_freq.patch @@ -1,6 +1,6 @@ --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -4431,7 +4431,7 @@ static int nl80211_set_channel(struct i8 +@@ -4646,7 +4646,7 @@ static int nl80211_set_channel(struct i8 freq->freq, freq->ht_enabled, freq->vht_enabled, freq->he_enabled, freq->bandwidth, freq->center_freq1, freq->center_freq2); diff --git a/package/network/services/hostapd/patches/340-reload_freq_change.patch b/package/network/services/hostapd/patches/340-reload_freq_change.patch index 369586769c..e0e62c2a11 100644 --- a/package/network/services/hostapd/patches/340-reload_freq_change.patch +++ b/package/network/services/hostapd/patches/340-reload_freq_change.patch @@ -1,12 +1,14 @@ --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c -@@ -108,6 +108,26 @@ static void hostapd_reload_bss(struct ho +@@ -114,6 +114,28 @@ static void hostapd_reload_bss(struct ho #endif /* CONFIG_NO_RADIUS */ ssid = &hapd->conf->ssid; + + hostapd_set_freq(hapd, hapd->iconf->hw_mode, hapd->iface->freq, + hapd->iconf->channel, ++ hapd->iconf->enable_edmg, ++ hapd->iconf->edmg_channel, + hapd->iconf->ieee80211n, + hapd->iconf->ieee80211ac, + hapd->iconf->ieee80211ax, @@ -27,7 +29,7 @@ if (!ssid->wpa_psk_set && ssid->wpa_psk && !ssid->wpa_psk->next && ssid->wpa_passphrase_set && ssid->wpa_passphrase) { /* -@@ -205,6 +225,7 @@ int hostapd_reload_config(struct hostapd +@@ -215,6 +237,7 @@ int hostapd_reload_config(struct hostapd struct hostapd_data *hapd = iface->bss[0]; struct hostapd_config *newconf, *oldconf; size_t j; @@ -35,7 +37,7 @@ if (iface->config_fname == NULL) { /* Only in-memory config in use - assume it has been updated */ -@@ -255,24 +276,20 @@ int hostapd_reload_config(struct hostapd +@@ -265,24 +288,20 @@ int hostapd_reload_config(struct hostapd } iface->conf = newconf; diff --git a/package/network/services/hostapd/patches/341-mesh-ctrl-iface-channel-switch.patch b/package/network/services/hostapd/patches/341-mesh-ctrl-iface-channel-switch.patch index 70fb01b8e5..90fa5eff5d 100644 --- a/package/network/services/hostapd/patches/341-mesh-ctrl-iface-channel-switch.patch +++ b/package/network/services/hostapd/patches/341-mesh-ctrl-iface-channel-switch.patch @@ -1,6 +1,6 @@ --- a/wpa_supplicant/ap.c +++ b/wpa_supplicant/ap.c -@@ -1378,15 +1378,35 @@ int ap_switch_channel(struct wpa_supplic +@@ -1466,15 +1466,35 @@ int ap_switch_channel(struct wpa_supplic #ifdef CONFIG_CTRL_IFACE diff --git a/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch b/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch index c3ce2b474d..a2a03c04f7 100644 --- a/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch +++ b/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch @@ -1,6 +1,6 @@ --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -2721,10 +2721,15 @@ static int wpa_driver_nl80211_del_beacon +@@ -2788,10 +2788,15 @@ static int wpa_driver_nl80211_del_beacon struct nl_msg *msg; struct wpa_driver_nl80211_data *drv = bss->drv; @@ -18,7 +18,7 @@ return send_and_recv_msgs(drv, msg, NULL, NULL); } -@@ -5042,7 +5047,7 @@ static void nl80211_teardown_ap(struct i +@@ -5261,7 +5266,7 @@ static void nl80211_teardown_ap(struct i nl80211_mgmt_unsubscribe(bss, "AP teardown"); nl80211_put_wiphy_data_ap(bss); @@ -27,7 +27,7 @@ } -@@ -7353,8 +7358,6 @@ static int wpa_driver_nl80211_if_remove( +@@ -7679,8 +7684,6 @@ static int wpa_driver_nl80211_if_remove( } else { wpa_printf(MSG_DEBUG, "nl80211: First BSS - reassign context"); nl80211_teardown_ap(bss); @@ -36,7 +36,7 @@ nl80211_destroy_bss(bss); if (!bss->added_if) i802_set_iface_flags(bss, 0); -@@ -7744,7 +7747,6 @@ static int wpa_driver_nl80211_deinit_ap( +@@ -8074,7 +8077,6 @@ static int wpa_driver_nl80211_deinit_ap( if (!is_ap_interface(drv->nlmode)) return -1; wpa_driver_nl80211_del_beacon(bss); @@ -44,7 +44,7 @@ /* * If the P2P GO interface was dynamically added, then it is -@@ -7764,7 +7766,6 @@ static int wpa_driver_nl80211_stop_ap(vo +@@ -8094,7 +8096,6 @@ static int wpa_driver_nl80211_stop_ap(vo if (!is_ap_interface(drv->nlmode)) return -1; wpa_driver_nl80211_del_beacon(bss); diff --git a/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch b/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch index 1706abb0ad..31c5102cb1 100644 --- a/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch +++ b/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch @@ -1,6 +1,6 @@ --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c -@@ -60,6 +60,7 @@ +@@ -65,6 +65,7 @@ #include "fst/fst_ctrl_iface.h" #include "config_file.h" #include "ctrl_iface.h" @@ -8,7 +8,7 @@ #define HOSTAPD_CLI_DUP_VALUE_MAX_LEN 256 -@@ -78,6 +79,7 @@ static void hostapd_ctrl_iface_send(stru +@@ -80,6 +81,7 @@ static void hostapd_ctrl_iface_send(stru enum wpa_msg_type type, const char *buf, size_t len); @@ -16,7 +16,7 @@ static int hostapd_ctrl_iface_attach(struct hostapd_data *hapd, struct sockaddr_storage *from, -@@ -129,6 +131,61 @@ static int hostapd_ctrl_iface_new_sta(st +@@ -131,6 +133,61 @@ static int hostapd_ctrl_iface_new_sta(st return 0; } @@ -76,9 +76,9 @@ + iface->interfaces->config_read_cb = config_read_cb; +} - #ifdef CONFIG_IEEE80211W #ifdef NEED_AP_MLME -@@ -3195,6 +3252,8 @@ static int hostapd_ctrl_iface_receive_pr + static int hostapd_ctrl_iface_sa_query(struct hostapd_data *hapd, +@@ -3546,6 +3603,8 @@ static int hostapd_ctrl_iface_receive_pr } else if (os_strncmp(buf, "VENDOR ", 7) == 0) { reply_len = hostapd_ctrl_iface_vendor(hapd, buf + 7, reply, reply_size); @@ -89,7 +89,7 @@ #ifdef RADIUS_SERVER --- a/src/ap/ctrl_iface_ap.c +++ b/src/ap/ctrl_iface_ap.c -@@ -874,7 +874,13 @@ int hostapd_parse_csa_settings(const cha +@@ -917,7 +917,13 @@ int hostapd_parse_csa_settings(const cha int hostapd_ctrl_iface_stop_ap(struct hostapd_data *hapd) { diff --git a/package/network/services/hostapd/patches/370-ap_sta_support.patch b/package/network/services/hostapd/patches/370-ap_sta_support.patch index a861ce4153..a7a646d2d1 100644 --- a/package/network/services/hostapd/patches/370-ap_sta_support.patch +++ b/package/network/services/hostapd/patches/370-ap_sta_support.patch @@ -11,7 +11,7 @@ -include .config -include $(if $(MULTICALL),../hostapd/.config) -@@ -116,6 +120,8 @@ OBJS_c += ../src/utils/common.o +@@ -118,6 +122,8 @@ OBJS_c += ../src/utils/common.o OBJS_c += ../src/common/cli.o OBJS += wmm_ac.o @@ -59,7 +59,7 @@ --- a/wpa_supplicant/bss.h +++ b/wpa_supplicant/bss.h -@@ -82,6 +82,10 @@ struct wpa_bss { +@@ -83,6 +83,10 @@ struct wpa_bss { u8 ssid[SSID_MAX_LEN]; /** Length of SSID */ size_t ssid_len; @@ -110,9 +110,9 @@ break; --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -127,6 +127,55 @@ static void wpas_update_fils_connect_par - #endif /* CONFIG_FILS && IEEE8021X_EAPOL */ - +@@ -129,6 +129,54 @@ static void wpas_update_fils_connect_par + static void wpas_update_owe_connect_params(struct wpa_supplicant *wpa_s); + #endif /* CONFIG_OWE */ +static int hostapd_stop(struct wpa_supplicant *wpa_s) +{ @@ -162,11 +162,10 @@ + } + return 0; +} -+ + + #ifdef CONFIG_WEP /* Configure default/group WEP keys for static WEP */ - int wpa_set_wep_keys(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid) - { -@@ -940,12 +989,16 @@ void wpa_supplicant_set_state(struct wpa +@@ -991,6 +1039,8 @@ void wpa_supplicant_set_state(struct wpa sme_sched_obss_scan(wpa_s, 1); @@ -174,8 +173,9 @@ + hostapd_reload(wpa_s, wpa_s->current_bss); #if defined(CONFIG_FILS) && defined(IEEE8021X_EAPOL) if (!fils_hlp_sent && ssid && ssid->eap.erp) - wpas_update_fils_connect_params(wpa_s); - #endif /* CONFIG_FILS && IEEE8021X_EAPOL */ + update_fils_connect_params = true; +@@ -1001,6 +1051,8 @@ void wpa_supplicant_set_state(struct wpa + #endif /* CONFIG_OWE */ } else if (state == WPA_DISCONNECTED || state == WPA_ASSOCIATING || state == WPA_ASSOCIATED) { + if (wpa_s->hostapd) @@ -183,16 +183,16 @@ wpa_s->new_connection = 1; wpa_drv_set_operstate(wpa_s, 0); #ifndef IEEE8021X_EAPOL -@@ -2038,6 +2091,8 @@ void wpa_supplicant_associate(struct wpa - wpa_ssid_txt(ssid->ssid, ssid->ssid_len), - ssid->id); - wpas_notify_mesh_group_started(wpa_s, ssid); +@@ -2225,6 +2277,8 @@ void wpa_supplicant_associate(struct wpa + return; + } + wpa_s->current_bss = bss; + if (wpa_s->hostapd) + hostapd_reload(wpa_s, wpa_s->current_bss); #else /* CONFIG_MESH */ wpa_msg(wpa_s, MSG_ERROR, "mesh mode support not included in the build"); -@@ -5716,6 +5771,16 @@ static int wpa_supplicant_init_iface(str +@@ -6207,6 +6261,16 @@ static int wpa_supplicant_init_iface(str sizeof(wpa_s->bridge_ifname)); } @@ -207,9 +207,9 @@ + } + /* RSNA Supplicant Key Management - INITIALIZE */ - eapol_sm_notify_portEnabled(wpa_s->eapol, FALSE); - eapol_sm_notify_portValid(wpa_s->eapol, FALSE); -@@ -6043,6 +6108,11 @@ static void wpa_supplicant_deinit_iface( + eapol_sm_notify_portEnabled(wpa_s->eapol, false); + eapol_sm_notify_portValid(wpa_s->eapol, false); +@@ -6540,6 +6604,11 @@ static void wpa_supplicant_deinit_iface( if (terminate) wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_TERMINATING); @@ -223,7 +223,7 @@ wpa_s->ctrl_iface = NULL; --- a/wpa_supplicant/wpa_supplicant_i.h +++ b/wpa_supplicant/wpa_supplicant_i.h -@@ -101,6 +101,11 @@ struct wpa_interface { +@@ -104,6 +104,11 @@ struct wpa_interface { const char *ifname; /** @@ -235,7 +235,7 @@ * bridge_ifname - Optional bridge interface name * * If the driver interface (ifname) is included in a Linux bridge -@@ -516,6 +521,8 @@ struct wpa_supplicant { +@@ -530,6 +535,8 @@ struct wpa_supplicant { #endif /* CONFIG_CTRL_IFACE_BINDER */ char bridge_ifname[16]; @@ -246,9 +246,9 @@ --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c -@@ -2408,6 +2408,11 @@ static int hostapd_ctrl_iface_chan_switc - if (ret) - return ret; +@@ -2712,6 +2712,11 @@ static int hostapd_ctrl_iface_chan_switc + return 0; + } + if (os_strstr(pos, " auto-ht")) { + settings.freq_params.ht_enabled = iface->conf->ieee80211n; @@ -260,7 +260,7 @@ /* Save CHAN_SWITCH VHT config */ --- a/src/ap/beacon.c +++ b/src/ap/beacon.c -@@ -1403,11 +1403,6 @@ int ieee802_11_set_beacon(struct hostapd +@@ -1468,11 +1468,6 @@ int ieee802_11_set_beacon(struct hostapd struct wpabuf *beacon, *proberesp, *assocresp; int res, ret = -1; @@ -274,7 +274,7 @@ if (ieee802_11_build_ap_params(hapd, ¶ms) < 0) --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c -@@ -4184,6 +4184,60 @@ static void wpas_event_assoc_reject(stru +@@ -4581,6 +4581,60 @@ static void wpas_event_unprot_beacon(str } @@ -335,7 +335,7 @@ void supplicant_event(void *ctx, enum wpa_event_type event, union wpa_event_data *data) { -@@ -4485,8 +4539,10 @@ void supplicant_event(void *ctx, enum wp +@@ -4883,8 +4937,10 @@ void supplicant_event(void *ctx, enum wp channel_width_to_string(data->ch_switch.ch_width), data->ch_switch.cf1, data->ch_switch.cf2); @@ -349,7 +349,7 @@ wpa_s->current_ssid->frequency = data->ch_switch.freq; --- a/src/drivers/driver.h +++ b/src/drivers/driver.h -@@ -5478,6 +5478,7 @@ union wpa_event_data { +@@ -5690,6 +5690,7 @@ union wpa_event_data { /** * struct ch_switch @@ -357,7 +357,7 @@ * @freq: Frequency of new channel in MHz * @ht_enabled: Whether this is an HT channel * @ch_offset: Secondary channel offset -@@ -5486,6 +5487,7 @@ union wpa_event_data { +@@ -5698,6 +5699,7 @@ union wpa_event_data { * @cf2: Center frequency 2 */ struct ch_switch { @@ -367,7 +367,7 @@ int ch_offset; --- a/src/drivers/driver_nl80211_event.c +++ b/src/drivers/driver_nl80211_event.c -@@ -536,7 +536,7 @@ static void mlme_event_ch_switch(struct +@@ -541,7 +541,7 @@ static void mlme_event_ch_switch(struct struct nlattr *ifindex, struct nlattr *freq, struct nlattr *type, struct nlattr *bw, struct nlattr *cf1, struct nlattr *cf2, @@ -376,7 +376,7 @@ { struct i802_bss *bss; union wpa_event_data data; -@@ -595,6 +595,8 @@ static void mlme_event_ch_switch(struct +@@ -600,6 +600,8 @@ static void mlme_event_ch_switch(struct data.ch_switch.cf1 = nla_get_u32(cf1); if (cf2) data.ch_switch.cf2 = nla_get_u32(cf2); @@ -385,7 +385,7 @@ if (finished) bss->freq = data.ch_switch.freq; -@@ -2544,6 +2546,7 @@ static void do_process_drv_event(struct +@@ -2686,6 +2688,7 @@ static void do_process_drv_event(struct tb[NL80211_ATTR_CHANNEL_WIDTH], tb[NL80211_ATTR_CENTER_FREQ1], tb[NL80211_ATTR_CENTER_FREQ2], @@ -393,7 +393,7 @@ 0); break; case NL80211_CMD_CH_SWITCH_NOTIFY: -@@ -2554,6 +2557,7 @@ static void do_process_drv_event(struct +@@ -2696,6 +2699,7 @@ static void do_process_drv_event(struct tb[NL80211_ATTR_CHANNEL_WIDTH], tb[NL80211_ATTR_CENTER_FREQ1], tb[NL80211_ATTR_CENTER_FREQ2], diff --git a/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch b/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch index 7f16d3a12a..b98b2d0cba 100644 --- a/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch +++ b/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch @@ -1,6 +1,6 @@ --- a/hostapd/Makefile +++ b/hostapd/Makefile -@@ -220,6 +220,9 @@ endif +@@ -226,6 +226,9 @@ endif ifdef CONFIG_NO_CTRL_IFACE CFLAGS += -DCONFIG_NO_CTRL_IFACE else @@ -12,7 +12,7 @@ else --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c -@@ -3020,6 +3020,7 @@ static int hostapd_ctrl_iface_receive_pr +@@ -3370,6 +3370,7 @@ static int hostapd_ctrl_iface_receive_pr reply_size); } else if (os_strcmp(buf, "STATUS-DRIVER") == 0) { reply_len = hostapd_drv_status(hapd, reply, reply_size); @@ -20,7 +20,7 @@ } else if (os_strcmp(buf, "MIB") == 0) { reply_len = ieee802_11_get_mib(hapd, reply, reply_size); if (reply_len >= 0) { -@@ -3061,6 +3062,7 @@ static int hostapd_ctrl_iface_receive_pr +@@ -3411,6 +3412,7 @@ static int hostapd_ctrl_iface_receive_pr } else if (os_strncmp(buf, "STA-NEXT ", 9) == 0) { reply_len = hostapd_ctrl_iface_sta_next(hapd, buf + 9, reply, reply_size); @@ -30,7 +30,7 @@ reply_len = -1; --- a/wpa_supplicant/Makefile +++ b/wpa_supplicant/Makefile -@@ -957,6 +957,9 @@ ifdef CONFIG_FILS +@@ -952,6 +952,9 @@ ifdef CONFIG_FILS OBJS += ../src/ap/fils_hlp.o endif ifdef CONFIG_CTRL_IFACE @@ -42,7 +42,7 @@ --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c -@@ -2144,7 +2144,7 @@ static int wpa_supplicant_ctrl_iface_sta +@@ -2267,7 +2267,7 @@ static int wpa_supplicant_ctrl_iface_sta pos += ret; } @@ -51,7 +51,7 @@ if (wpa_s->ap_iface) { pos += ap_ctrl_iface_wpa_get_status(wpa_s, pos, end - pos, -@@ -9962,6 +9962,7 @@ char * wpa_supplicant_ctrl_iface_process +@@ -10366,6 +10366,7 @@ char * wpa_supplicant_ctrl_iface_process reply_len = -1; } else if (os_strncmp(buf, "NOTE ", 5) == 0) { wpa_printf(MSG_INFO, "NOTE: %s", buf + 5); @@ -59,7 +59,7 @@ } else if (os_strcmp(buf, "MIB") == 0) { reply_len = wpa_sm_get_mib(wpa_s->wpa, reply, reply_size); if (reply_len >= 0) { -@@ -9974,6 +9975,7 @@ char * wpa_supplicant_ctrl_iface_process +@@ -10378,6 +10379,7 @@ char * wpa_supplicant_ctrl_iface_process reply_size - reply_len); #endif /* CONFIG_MACSEC */ } @@ -67,7 +67,7 @@ } else if (os_strncmp(buf, "STATUS", 6) == 0) { reply_len = wpa_supplicant_ctrl_iface_status( wpa_s, buf + 6, reply, reply_size); -@@ -10458,6 +10460,7 @@ char * wpa_supplicant_ctrl_iface_process +@@ -10862,6 +10864,7 @@ char * wpa_supplicant_ctrl_iface_process reply_len = wpa_supplicant_ctrl_iface_bss( wpa_s, buf + 4, reply, reply_size); #ifdef CONFIG_AP @@ -75,7 +75,7 @@ } else if (os_strcmp(buf, "STA-FIRST") == 0) { reply_len = ap_ctrl_iface_sta_first(wpa_s, reply, reply_size); } else if (os_strncmp(buf, "STA ", 4) == 0) { -@@ -10466,12 +10469,15 @@ char * wpa_supplicant_ctrl_iface_process +@@ -10870,12 +10873,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); @@ -101,7 +101,7 @@ static size_t hostapd_write_ht_mcs_bitmask(char *buf, size_t buflen, size_t curr_len, const u8 *mcs_set) -@@ -423,6 +424,7 @@ int hostapd_ctrl_iface_sta_next(struct h +@@ -451,6 +452,7 @@ int hostapd_ctrl_iface_sta_next(struct h return hostapd_ctrl_iface_sta_mib(hapd, sta->next, buf, buflen); } @@ -109,7 +109,7 @@ #ifdef CONFIG_P2P_MANAGER static int p2p_manager_disconnect(struct hostapd_data *hapd, u16 stype, -@@ -763,12 +765,12 @@ int hostapd_ctrl_iface_status(struct hos +@@ -806,12 +808,12 @@ int hostapd_ctrl_iface_status(struct hos return len; len += ret; } @@ -126,7 +126,7 @@ if (os_snprintf_error(buflen - len, ret)) --- a/src/ap/ieee802_1x.c +++ b/src/ap/ieee802_1x.c -@@ -2706,6 +2706,7 @@ static const char * bool_txt(Boolean val +@@ -2711,6 +2711,7 @@ static const char * bool_txt(bool val) return val ? "TRUE" : "FALSE"; } @@ -134,7 +134,7 @@ int ieee802_1x_get_mib(struct hostapd_data *hapd, char *buf, size_t buflen) { -@@ -2892,6 +2893,7 @@ int ieee802_1x_get_mib_sta(struct hostap +@@ -2897,6 +2898,7 @@ int ieee802_1x_get_mib_sta(struct hostap return len; } @@ -144,7 +144,7 @@ static void ieee802_1x_wnm_notif_send(void *eloop_ctx, void *timeout_ctx) --- a/src/ap/wpa_auth.c +++ b/src/ap/wpa_auth.c -@@ -4116,6 +4116,7 @@ static const char * wpa_bool_txt(int val +@@ -4451,6 +4451,7 @@ static const char * wpa_bool_txt(int val return val ? "TRUE" : "FALSE"; } @@ -152,7 +152,7 @@ #define RSN_SUITE "%02x-%02x-%02x-%d" #define RSN_SUITE_ARG(s) \ -@@ -4264,7 +4265,7 @@ int wpa_get_mib_sta(struct wpa_state_mac +@@ -4601,7 +4602,7 @@ int wpa_get_mib_sta(struct wpa_state_mac return len; } @@ -163,7 +163,7 @@ { --- a/src/rsn_supp/wpa.c +++ b/src/rsn_supp/wpa.c -@@ -2502,6 +2502,8 @@ static u32 wpa_key_mgmt_suite(struct wpa +@@ -2728,6 +2728,8 @@ static u32 wpa_key_mgmt_suite(struct wpa } @@ -172,7 +172,7 @@ #define RSN_SUITE "%02x-%02x-%02x-%d" #define RSN_SUITE_ARG(s) \ ((s) >> 24) & 0xff, ((s) >> 16) & 0xff, ((s) >> 8) & 0xff, (s) & 0xff -@@ -2585,6 +2587,7 @@ int wpa_sm_get_mib(struct wpa_sm *sm, ch +@@ -2809,6 +2811,7 @@ int wpa_sm_get_mib(struct wpa_sm *sm, ch return (int) len; } @@ -182,7 +182,7 @@ --- a/wpa_supplicant/ap.c +++ b/wpa_supplicant/ap.c -@@ -1236,7 +1236,7 @@ int wpas_ap_wps_nfc_report_handover(stru +@@ -1324,7 +1324,7 @@ int wpas_ap_wps_nfc_report_handover(stru #endif /* CONFIG_WPS */ 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 7bac937373..d2414faf01 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 @@ -1,6 +1,6 @@ --- a/hostapd/hostapd_cli.c +++ b/hostapd/hostapd_cli.c -@@ -743,7 +743,7 @@ static int wpa_ctrl_command_sta(struct w +@@ -744,7 +744,7 @@ static int wpa_ctrl_command_sta(struct w } buf[len] = '\0'; diff --git a/package/network/services/hostapd/patches/390-wpa_ie_cap_workaround.patch b/package/network/services/hostapd/patches/390-wpa_ie_cap_workaround.patch index c879c3fb84..9dee2d738e 100644 --- a/package/network/services/hostapd/patches/390-wpa_ie_cap_workaround.patch +++ b/package/network/services/hostapd/patches/390-wpa_ie_cap_workaround.patch @@ -1,6 +1,6 @@ --- a/src/common/wpa_common.c +++ b/src/common/wpa_common.c -@@ -2089,6 +2089,31 @@ u32 wpa_akm_to_suite(int akm) +@@ -2121,6 +2121,31 @@ u32 wpa_akm_to_suite(int akm) } @@ -32,7 +32,7 @@ int wpa_compare_rsn_ie(int ft_initial_assoc, const u8 *ie1, size_t ie1len, const u8 *ie2, size_t ie2len) -@@ -2096,8 +2121,19 @@ int wpa_compare_rsn_ie(int ft_initial_as +@@ -2128,8 +2153,19 @@ int wpa_compare_rsn_ie(int ft_initial_as if (ie1 == NULL || ie2 == NULL) return -1; diff --git a/package/network/services/hostapd/patches/400-wps_single_auth_enc_type.patch b/package/network/services/hostapd/patches/400-wps_single_auth_enc_type.patch index 7f1986ec46..73a8c7694d 100644 --- a/package/network/services/hostapd/patches/400-wps_single_auth_enc_type.patch +++ b/package/network/services/hostapd/patches/400-wps_single_auth_enc_type.patch @@ -1,22 +1,23 @@ --- a/src/ap/wps_hostapd.c +++ b/src/ap/wps_hostapd.c -@@ -346,8 +346,7 @@ static int hapd_wps_reconfig_in_memory(s +@@ -394,9 +394,8 @@ static int hapd_wps_reconfig_in_memory(s bss->wpa_pairwise |= WPA_CIPHER_GCMP; else bss->wpa_pairwise |= WPA_CIPHER_CCMP; - } + #ifndef CONFIG_NO_TKIP - if (cred->encr_type & WPS_ENCR_TKIP) + } else if (cred->encr_type & WPS_ENCR_TKIP) bss->wpa_pairwise |= WPA_CIPHER_TKIP; + #endif /* CONFIG_NO_TKIP */ bss->rsn_pairwise = bss->wpa_pairwise; - bss->wpa_group = wpa_select_ap_group_cipher(bss->wpa, -@@ -1108,8 +1107,7 @@ int hostapd_init_wps(struct hostapd_data +@@ -1178,8 +1177,7 @@ int hostapd_init_wps(struct hostapd_data WPA_CIPHER_GCMP_256)) { wps->encr_types |= WPS_ENCR_AES; wps->encr_types_rsn |= WPS_ENCR_AES; - } - if (conf->rsn_pairwise & WPA_CIPHER_TKIP) { + } else if (conf->rsn_pairwise & WPA_CIPHER_TKIP) { - wps->encr_types |= WPS_ENCR_TKIP; - wps->encr_types_rsn |= WPS_ENCR_TKIP; - } + #ifdef CONFIG_NO_TKIP + wpa_printf(MSG_INFO, "WPS: TKIP not supported"); + goto fail; diff --git a/package/network/services/hostapd/patches/410-limit_debug_messages.patch b/package/network/services/hostapd/patches/410-limit_debug_messages.patch index 3947eb8611..d2713fc29b 100644 --- a/package/network/services/hostapd/patches/410-limit_debug_messages.patch +++ b/package/network/services/hostapd/patches/410-limit_debug_messages.patch @@ -9,41 +9,37 @@ { va_list ap; -@@ -253,8 +253,8 @@ void wpa_printf(int level, const char *f +@@ -255,7 +255,7 @@ void wpa_printf(int level, const char *f } -static void _wpa_hexdump(int level, const char *title, const u8 *buf, -- size_t len, int show) +void _wpa_hexdump(int level, const char *title, const u8 *buf, -+ size_t len, int show) + size_t len, int show, int only_syslog) { size_t i; - -@@ -380,20 +380,8 @@ static void _wpa_hexdump(int level, cons +@@ -382,19 +382,7 @@ static void _wpa_hexdump(int level, cons #endif /* CONFIG_ANDROID_LOG */ } -void wpa_hexdump(int level, const char *title, const void *buf, size_t len) -{ -- _wpa_hexdump(level, title, buf, len, 1); +- _wpa_hexdump(level, title, buf, len, 1, 0); -} - - -void wpa_hexdump_key(int level, const char *title, const void *buf, size_t len) -{ -- _wpa_hexdump(level, title, buf, len, wpa_debug_show_keys); +- _wpa_hexdump(level, title, buf, len, wpa_debug_show_keys, 0); -} - - -static void _wpa_hexdump_ascii(int level, const char *title, const void *buf, -- size_t len, int show) +void _wpa_hexdump_ascii(int level, const char *title, const void *buf, -+ size_t len, int show) + size_t len, int show) { size_t i, llen; - const u8 *pos = buf; -@@ -506,20 +494,6 @@ static void _wpa_hexdump_ascii(int level +@@ -507,20 +495,6 @@ file_done: } @@ -64,7 +60,7 @@ #ifdef CONFIG_DEBUG_FILE static char *last_path = NULL; #endif /* CONFIG_DEBUG_FILE */ -@@ -635,7 +609,7 @@ void wpa_msg_register_ifname_cb(wpa_msg_ +@@ -636,7 +610,7 @@ void wpa_msg_register_ifname_cb(wpa_msg_ } @@ -73,7 +69,7 @@ { va_list ap; char *buf; -@@ -673,7 +647,7 @@ void wpa_msg(void *ctx, int level, const +@@ -674,7 +648,7 @@ void wpa_msg(void *ctx, int level, const } @@ -84,13 +80,13 @@ char *buf; --- a/src/utils/wpa_debug.h +++ b/src/utils/wpa_debug.h -@@ -52,6 +52,17 @@ int wpa_debug_reopen_file(void); +@@ -50,6 +50,17 @@ int wpa_debug_reopen_file(void); void wpa_debug_close_file(void); void wpa_debug_setup_stdout(void); +/* internal */ +void _wpa_hexdump(int level, const char *title, const u8 *buf, -+ size_t len, int show); ++ size_t len, int show, int only_syslog); +void _wpa_hexdump_ascii(int level, const char *title, const void *buf, + size_t len, int show); +extern int wpa_debug_show_keys; @@ -102,7 +98,7 @@ /** * wpa_debug_printf_timestamp - Print timestamp for debug output * -@@ -72,9 +83,15 @@ void wpa_debug_print_timestamp(void); +@@ -70,9 +81,15 @@ void wpa_debug_print_timestamp(void); * * Note: New line '\n' is added to the end of the text when printing to stdout. */ @@ -119,7 +115,7 @@ /** * wpa_hexdump - conditional hex dump * @level: priority level (MSG_*) of the message -@@ -86,7 +103,13 @@ PRINTF_FORMAT(2, 3); +@@ -84,7 +101,13 @@ PRINTF_FORMAT(2, 3); * output may be directed to stdout, stderr, and/or syslog based on * configuration. The contents of buf is printed out has hex dump. */ @@ -129,12 +125,12 @@ + if (level < CONFIG_MSG_MIN_PRIORITY) + return; + -+ _wpa_hexdump(level, title, buf, len, 1); ++ _wpa_hexdump(level, title, buf, len, 1, 1); +} static inline void wpa_hexdump_buf(int level, const char *title, const struct wpabuf *buf) -@@ -108,7 +131,13 @@ static inline void wpa_hexdump_buf(int l +@@ -106,7 +129,13 @@ static inline void wpa_hexdump_buf(int l * like wpa_hexdump(), but by default, does not include secret keys (passwords, * etc.) in debug output. */ @@ -144,12 +140,12 @@ + if (level < CONFIG_MSG_MIN_PRIORITY) + return; + -+ _wpa_hexdump(level, title, buf, len, wpa_debug_show_keys); ++ _wpa_hexdump(level, title, buf, len, wpa_debug_show_keys, 1); +} static inline void wpa_hexdump_buf_key(int level, const char *title, const struct wpabuf *buf) -@@ -130,8 +159,14 @@ static inline void wpa_hexdump_buf_key(i +@@ -128,8 +157,14 @@ static inline void wpa_hexdump_buf_key(i * the hex numbers and ASCII characters (for printable range) are shown. 16 * bytes per line will be shown. */ @@ -166,7 +162,7 @@ /** * wpa_hexdump_ascii_key - conditional hex dump, hide keys -@@ -147,8 +182,14 @@ void wpa_hexdump_ascii(int level, const +@@ -145,8 +180,14 @@ void wpa_hexdump_ascii(int level, const * bytes per line will be shown. This works like wpa_hexdump_ascii(), but by * default, does not include secret keys (passwords, etc.) in debug output. */ @@ -183,7 +179,7 @@ /* * wpa_dbg() behaves like wpa_msg(), but it can be removed from build to reduce -@@ -185,7 +226,12 @@ void wpa_hexdump_ascii_key(int level, co +@@ -183,7 +224,12 @@ void wpa_hexdump_ascii_key(int level, co * * Note: New line '\n' is added to the end of the text when printing to stdout. */ @@ -197,7 +193,7 @@ /** * wpa_msg_ctrl - Conditional printf for ctrl_iface monitors -@@ -199,8 +245,13 @@ void wpa_msg(void *ctx, int level, const +@@ -197,8 +243,13 @@ void wpa_msg(void *ctx, int level, const * attached ctrl_iface monitors. In other words, it can be used for frequent * events that do not need to be sent to syslog. */ diff --git a/package/network/services/hostapd/patches/420-indicate-features.patch b/package/network/services/hostapd/patches/420-indicate-features.patch index 1f8b049f36..9f216347f4 100644 --- a/package/network/services/hostapd/patches/420-indicate-features.patch +++ b/package/network/services/hostapd/patches/420-indicate-features.patch @@ -8,7 +8,7 @@ #include "crypto/random.h" #include "crypto/tls.h" #include "common/version.h" -@@ -690,7 +691,7 @@ int main(int argc, char *argv[]) +@@ -692,7 +693,7 @@ int main(int argc, char *argv[]) wpa_supplicant_event = hostapd_wpa_event; wpa_supplicant_event_global = hostapd_wpa_event_global; for (;;) { @@ -17,7 +17,7 @@ if (c < 0) break; switch (c) { -@@ -727,6 +728,8 @@ int main(int argc, char *argv[]) +@@ -729,6 +730,8 @@ int main(int argc, char *argv[]) break; #endif /* CONFIG_DEBUG_LINUX_TRACING */ case 'v': diff --git a/package/network/services/hostapd/patches/430-hostapd_cli_ifdef.patch b/package/network/services/hostapd/patches/430-hostapd_cli_ifdef.patch index ca053bcdf6..3744464c89 100644 --- a/package/network/services/hostapd/patches/430-hostapd_cli_ifdef.patch +++ b/package/network/services/hostapd/patches/430-hostapd_cli_ifdef.patch @@ -1,6 +1,6 @@ --- a/hostapd/hostapd_cli.c +++ b/hostapd/hostapd_cli.c -@@ -385,7 +385,6 @@ static int hostapd_cli_cmd_disassociate( +@@ -388,7 +388,6 @@ static int hostapd_cli_cmd_disassociate( } @@ -8,23 +8,23 @@ static int hostapd_cli_cmd_signature(struct wpa_ctrl *ctrl, int argc, char *argv[]) { -@@ -398,7 +397,6 @@ static int hostapd_cli_cmd_signature(str +@@ -401,7 +400,6 @@ static int hostapd_cli_cmd_signature(str os_snprintf(buf, sizeof(buf), "SIGNATURE %s", argv[0]); return wpa_ctrl_command(ctrl, buf); } -#endif /* CONFIG_TAXONOMY */ - #ifdef CONFIG_IEEE80211W -@@ -417,7 +415,6 @@ static int hostapd_cli_cmd_sa_query(stru - #endif /* CONFIG_IEEE80211W */ + static int hostapd_cli_cmd_sa_query(struct wpa_ctrl *ctrl, int argc, +@@ -418,7 +416,6 @@ static int hostapd_cli_cmd_sa_query(stru + } -#ifdef CONFIG_WPS static int hostapd_cli_cmd_wps_pin(struct wpa_ctrl *ctrl, int argc, char *argv[]) { -@@ -643,7 +640,6 @@ static int hostapd_cli_cmd_wps_config(st +@@ -644,7 +641,6 @@ static int hostapd_cli_cmd_wps_config(st ssid_hex, argv[1]); return wpa_ctrl_command(ctrl, buf); } @@ -32,7 +32,7 @@ static int hostapd_cli_cmd_disassoc_imminent(struct wpa_ctrl *ctrl, int argc, -@@ -1538,15 +1534,12 @@ static const struct hostapd_cli_cmd host +@@ -1532,13 +1528,10 @@ static const struct hostapd_cli_cmd host { "disassociate", hostapd_cli_cmd_disassociate, hostapd_complete_stations, " = disassociate a station" }, @@ -40,15 +40,13 @@ { "signature", hostapd_cli_cmd_signature, hostapd_complete_stations, " = get taxonomy signature for a station" }, -#endif /* CONFIG_TAXONOMY */ - #ifdef CONFIG_IEEE80211W { "sa_query", hostapd_cli_cmd_sa_query, hostapd_complete_stations, " = send SA Query to a station" }, - #endif /* CONFIG_IEEE80211W */ -#ifdef CONFIG_WPS { "wps_pin", hostapd_cli_cmd_wps_pin, NULL, " [timeout] [addr] = add WPS Enrollee PIN" }, { "wps_check_pin", hostapd_cli_cmd_wps_check_pin, NULL, -@@ -1571,7 +1564,6 @@ static const struct hostapd_cli_cmd host +@@ -1563,7 +1556,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/450-scan_wait.patch b/package/network/services/hostapd/patches/450-scan_wait.patch index 5e080df82f..ac874ad66a 100644 --- a/package/network/services/hostapd/patches/450-scan_wait.patch +++ b/package/network/services/hostapd/patches/450-scan_wait.patch @@ -9,7 +9,7 @@ #ifndef CONFIG_NO_HOSTAPD_LOGGER -@@ -149,6 +151,14 @@ static void hostapd_logger_cb(void *ctx, +@@ -146,6 +148,14 @@ static void hostapd_logger_cb(void *ctx, } #endif /* CONFIG_NO_HOSTAPD_LOGGER */ @@ -24,7 +24,7 @@ /** * hostapd_driver_init - Preparate driver interface -@@ -167,6 +177,8 @@ static int hostapd_driver_init(struct ho +@@ -164,6 +174,8 @@ static int hostapd_driver_init(struct ho return -1; } @@ -33,7 +33,7 @@ /* Initialize the driver interface */ if (!(b[0] | b[1] | b[2] | b[3] | b[4] | b[5])) b = NULL; -@@ -407,8 +419,6 @@ static void hostapd_global_deinit(const +@@ -404,8 +416,6 @@ static void hostapd_global_deinit(const #endif /* CONFIG_NATIVE_WINDOWS */ eap_server_unregister_methods(); @@ -42,7 +42,7 @@ } -@@ -434,18 +444,6 @@ static int hostapd_global_run(struct hap +@@ -431,18 +441,6 @@ static int hostapd_global_run(struct hap } #endif /* EAP_SERVER_TNC */ @@ -61,7 +61,7 @@ eloop_run(); return 0; -@@ -647,8 +645,7 @@ int main(int argc, char *argv[]) +@@ -645,8 +643,7 @@ int main(int argc, char *argv[]) struct hapd_interfaces interfaces; int ret = 1; size_t i, j; 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 b740378090..99c552821b 100644 --- a/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch +++ b/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch @@ -22,7 +22,7 @@ Signed-hostap: Antonio Quartulli #include "common/defs.h" #include "common/ieee802_11_defs.h" #include "common/wpa_common.h" -@@ -819,6 +820,9 @@ struct wpa_driver_associate_params { +@@ -850,6 +851,9 @@ struct wpa_driver_associate_params { * responsible for selecting with which BSS to associate. */ const u8 *bssid; @@ -34,7 +34,7 @@ Signed-hostap: Antonio Quartulli * --- a/wpa_supplicant/config.c +++ b/wpa_supplicant/config.c -@@ -17,6 +17,7 @@ +@@ -18,6 +18,7 @@ #include "eap_peer/eap.h" #include "p2p/p2p.h" #include "fst/fst.h" @@ -42,7 +42,7 @@ Signed-hostap: Antonio Quartulli #include "config.h" -@@ -2130,6 +2131,97 @@ static char * wpa_config_write_peerkey(c +@@ -2269,6 +2270,97 @@ static char * wpa_config_write_peerkey(c #endif /* NO_CONFIG_WRITE */ @@ -140,7 +140,7 @@ Signed-hostap: Antonio Quartulli /* Helper macros for network block parser */ #ifdef OFFSET -@@ -2382,6 +2474,8 @@ static const struct parse_data ssid_fiel +@@ -2552,6 +2644,8 @@ static const struct parse_data ssid_fiel { INT(ap_max_inactivity) }, { INT(dtim_period) }, { INT(beacon_int) }, @@ -162,7 +162,7 @@ Signed-hostap: Antonio Quartulli #define DEFAULT_EAP_WORKAROUND ((unsigned int) -1) -@@ -790,6 +792,9 @@ struct wpa_ssid { +@@ -843,6 +845,9 @@ struct wpa_ssid { */ void *parent_cred; @@ -174,11 +174,11 @@ Signed-hostap: Antonio Quartulli * macsec_policy - Determines the policy for MACsec secure session --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -3266,6 +3266,12 @@ static void wpas_start_assoc_cb(struct w +@@ -3638,6 +3638,12 @@ static void wpas_start_assoc_cb(struct w params.beacon_int = ssid->beacon_int; else params.beacon_int = wpa_s->conf->beacon_int; -+ i = 0; ++ int i = 0; + while (i < WLAN_SUPP_RATES_MAX) { + params.rates[i] = ssid->rates[i]; + i++; @@ -186,4 +186,4 @@ Signed-hostap: Antonio Quartulli + params.mcast_rate = ssid->mcast_rate; } - params.pairwise_suite = cipher_pairwise; + if (bss && ssid->enable_edmg) diff --git a/package/network/services/hostapd/patches/461-driver_nl80211-use-new-parameters-during-ibss-join.patch b/package/network/services/hostapd/patches/461-driver_nl80211-use-new-parameters-during-ibss-join.patch index 54ac6a7e3c..61d2089bc8 100644 --- a/package/network/services/hostapd/patches/461-driver_nl80211-use-new-parameters-during-ibss-join.patch +++ b/package/network/services/hostapd/patches/461-driver_nl80211-use-new-parameters-during-ibss-join.patch @@ -10,7 +10,7 @@ Signed-hostap: Antonio Quartulli --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -5323,7 +5323,7 @@ static int wpa_driver_nl80211_ibss(struc +@@ -5584,7 +5584,7 @@ static int wpa_driver_nl80211_ibss(struc struct wpa_driver_associate_params *params) { struct nl_msg *msg; @@ -19,7 +19,7 @@ Signed-hostap: Antonio Quartulli int count = 0; wpa_printf(MSG_DEBUG, "nl80211: Join IBSS (ifindex=%d)", drv->ifindex); -@@ -5350,6 +5350,37 @@ retry: +@@ -5611,6 +5611,37 @@ retry: nl80211_put_beacon_int(msg, params->beacon_int)) goto fail; diff --git a/package/network/services/hostapd/patches/463-add-mcast_rate-to-11s.patch b/package/network/services/hostapd/patches/463-add-mcast_rate-to-11s.patch index b1c0a59188..33ef097e75 100644 --- a/package/network/services/hostapd/patches/463-add-mcast_rate-to-11s.patch +++ b/package/network/services/hostapd/patches/463-add-mcast_rate-to-11s.patch @@ -19,17 +19,17 @@ Tested-by: Simon Wunderlich --- a/src/drivers/driver.h +++ b/src/drivers/driver.h -@@ -1484,6 +1484,7 @@ struct wpa_driver_mesh_join_params { +@@ -1549,6 +1549,7 @@ struct wpa_driver_mesh_join_params { #define WPA_DRIVER_MESH_FLAG_AMPE 0x00000008 unsigned int flags; u8 handle_dfs; + int mcast_rate; }; - /** + struct wpa_driver_set_key_params { --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -9612,6 +9612,18 @@ static int nl80211_put_mesh_id(struct nl +@@ -10043,6 +10043,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) { -@@ -9673,6 +9685,7 @@ static int nl80211_join_mesh(struct i802 +@@ -10104,6 +10116,7 @@ static int nl80211_join_mesh(struct i802 nl80211_put_basic_rates(msg, params->basic_rates) || nl80211_put_mesh_id(msg, params->meshid, params->meshid_len) || nl80211_put_beacon_int(msg, params->beacon_int) || @@ -58,7 +58,7 @@ Tested-by: Simon Wunderlich --- a/wpa_supplicant/mesh.c +++ b/wpa_supplicant/mesh.c -@@ -494,6 +494,7 @@ int wpa_supplicant_join_mesh(struct wpa_ +@@ -592,6 +592,7 @@ int wpa_supplicant_join_mesh(struct wpa_ params->meshid = ssid->ssid; params->meshid_len = ssid->ssid_len; diff --git a/package/network/services/hostapd/patches/464-fix-mesh-obss-check.patch b/package/network/services/hostapd/patches/464-fix-mesh-obss-check.patch index 4b63b6fd78..6d48175163 100644 --- a/package/network/services/hostapd/patches/464-fix-mesh-obss-check.patch +++ b/package/network/services/hostapd/patches/464-fix-mesh-obss-check.patch @@ -1,6 +1,6 @@ --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -2216,11 +2216,13 @@ void ibss_mesh_setup_freq(struct wpa_sup +@@ -2407,11 +2407,13 @@ void ibss_mesh_setup_freq(struct wpa_sup for (j = 0; j < wpa_s->last_scan_res_used; j++) { struct wpa_bss *bss = wpa_s->last_scan_res[j]; diff --git a/package/network/services/hostapd/patches/470-survey_data_fallback.patch b/package/network/services/hostapd/patches/470-survey_data_fallback.patch index a0e5384e3c..57a78ee865 100644 --- a/package/network/services/hostapd/patches/470-survey_data_fallback.patch +++ b/package/network/services/hostapd/patches/470-survey_data_fallback.patch @@ -1,6 +1,6 @@ --- a/src/ap/acs.c +++ b/src/ap/acs.c -@@ -293,18 +293,12 @@ static void acs_fail(struct hostapd_ifac +@@ -302,18 +302,12 @@ static void acs_fail(struct hostapd_ifac static long double acs_survey_interference_factor(struct freq_survey *survey, s8 min_nf) { @@ -20,7 +20,7 @@ total = survey->channel_time; -@@ -406,20 +400,19 @@ static int acs_usable_vht160_chan(const +@@ -415,20 +409,19 @@ static int acs_usable_vht160_chan(const static int acs_survey_is_sufficient(struct freq_survey *survey) { if (!(survey->filled & SURVEY_HAS_NF)) { diff --git a/package/network/services/hostapd/patches/500-lto-jobserver-support.patch b/package/network/services/hostapd/patches/500-lto-jobserver-support.patch index 1edfb8e804..46030859de 100644 --- a/package/network/services/hostapd/patches/500-lto-jobserver-support.patch +++ b/package/network/services/hostapd/patches/500-lto-jobserver-support.patch @@ -1,6 +1,6 @@ --- a/hostapd/Makefile +++ b/hostapd/Makefile -@@ -1332,14 +1332,14 @@ hostapd_multi.a: $(BCHECK) $(OBJS) +@@ -1327,14 +1327,14 @@ hostapd_multi.a: $(BCHECK) $(OBJS) @$(AR) cr $@ hostapd_multi.o $(OBJS) hostapd: $(BCHECK) $(OBJS) @@ -19,7 +19,7 @@ NOBJS = nt_password_hash.o ../src/crypto/ms_funcs.o $(SHA1OBJS) --- a/wpa_supplicant/Makefile +++ b/wpa_supplicant/Makefile -@@ -1932,23 +1932,23 @@ wpa_supplicant_multi.a: .config $(BCHECK +@@ -1930,23 +1930,23 @@ wpa_supplicant_multi.a: .config $(BCHECK @$(AR) cr $@ wpa_supplicant_multi.o $(OBJS) wpa_supplicant: $(BCHECK) $(OBJS) $(EXTRA_progs) diff --git a/package/network/services/hostapd/patches/600-ubus_support.patch b/package/network/services/hostapd/patches/600-ubus_support.patch index cc49ae3b24..938840755a 100644 --- a/package/network/services/hostapd/patches/600-ubus_support.patch +++ b/package/network/services/hostapd/patches/600-ubus_support.patch @@ -1,6 +1,6 @@ --- a/hostapd/Makefile +++ b/hostapd/Makefile -@@ -165,6 +165,11 @@ OBJS += ../src/common/hw_features_common +@@ -171,6 +171,11 @@ OBJS += ../src/common/hw_features_common OBJS += ../src/eapol_auth/eapol_auth_sm.o @@ -22,15 +22,16 @@ #define OCE_STA_CFON_ENABLED(hapd) \ ((hapd->conf->oce & OCE_STA_CFON) && \ -@@ -72,6 +73,7 @@ struct hapd_interfaces { - #ifdef CONFIG_DPP - struct dpp_global *dpp; - #endif /* CONFIG_DPP */ +@@ -80,7 +81,7 @@ struct hapd_interfaces { + #ifdef CONFIG_CTRL_IFACE_UDP + unsigned char ctrl_iface_cookie[CTRL_IFACE_COOKIE_LEN]; + #endif /* CONFIG_CTRL_IFACE_UDP */ +- + struct ubus_object ubus; }; enum hostapd_chan_status { -@@ -145,6 +147,7 @@ struct hostapd_data { +@@ -154,6 +155,7 @@ struct hostapd_data { struct hostapd_iface *iface; struct hostapd_config *iconf; struct hostapd_bss_config *conf; @@ -38,7 +39,7 @@ int interface_added; /* virtual interface added for this BSS */ unsigned int started:1; unsigned int disabled:1; -@@ -580,6 +583,7 @@ hostapd_alloc_bss_data(struct hostapd_if +@@ -606,6 +608,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); @@ -48,15 +49,15 @@ struct hostapd_iface * hostapd_alloc_iface(void); --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c -@@ -380,6 +380,7 @@ static void hostapd_free_hapd_data(struc +@@ -395,6 +395,7 @@ void hostapd_free_hapd_data(struct hosta hapd->beacon_set_done = 0; wpa_printf(MSG_DEBUG, "%s(%s)", __func__, hapd->conf->iface); + hostapd_ubus_free_bss(hapd); - iapp_deinit(hapd->iapp); - hapd->iapp = NULL; accounting_deinit(hapd); -@@ -1377,6 +1378,8 @@ static int hostapd_setup_bss(struct host + hostapd_deinit_wpa(hapd); + vlan_deinit(hapd); +@@ -1417,6 +1418,8 @@ static int hostapd_setup_bss(struct host if (hapd->driver && hapd->driver->set_operstate) hapd->driver->set_operstate(hapd->drv_priv, 1); @@ -65,15 +66,15 @@ return 0; } -@@ -1891,6 +1894,7 @@ static int hostapd_setup_interface_compl +@@ -1999,6 +2002,7 @@ static int hostapd_setup_interface_compl if (err) goto fail; + hostapd_ubus_add_iface(iface); wpa_printf(MSG_DEBUG, "Completing interface initialization"); - if (iface->conf->channel) { + if (iface->freq) { #ifdef NEED_AP_MLME -@@ -2087,6 +2091,7 @@ dfs_offload: +@@ -2196,6 +2200,7 @@ dfs_offload: fail: wpa_printf(MSG_ERROR, "Interface initialization failed"); @@ -81,7 +82,7 @@ hostapd_set_state(iface, HAPD_IFACE_DISABLED); wpa_msg(hapd->msg_ctx, MSG_INFO, AP_EVENT_DISABLED); #ifdef CONFIG_FST -@@ -2562,6 +2567,7 @@ void hostapd_interface_deinit_free(struc +@@ -2669,6 +2674,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; @@ -91,7 +92,7 @@ __func__, driver, drv_priv); --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c -@@ -2032,7 +2032,7 @@ static void handle_auth(struct hostapd_d +@@ -2327,13 +2327,18 @@ static void handle_auth(struct hostapd_d u16 auth_alg, auth_transaction, status_code; u16 resp = WLAN_STATUS_SUCCESS; struct sta_info *sta = NULL; @@ -99,11 +100,10 @@ + int res, reply_res, ubus_resp; u16 fc; const u8 *challenge = NULL; - u32 session_timeout, acct_interim_interval; -@@ -2043,6 +2043,11 @@ static void handle_auth(struct hostapd_d - char *identity = NULL; - char *radius_cui = NULL; + u8 resp_ies[2 + WLAN_AUTH_CHALLENGE_LEN]; + size_t resp_ies_len = 0; u16 seq_ctrl; + struct radius_sta rad_info; + struct hostapd_ubus_request req = { + .type = HOSTAPD_UBUS_AUTH_REQ, + .mgmt_frame = mgmt, @@ -112,7 +112,7 @@ if (len < IEEE80211_HDRLEN + sizeof(mgmt->u.auth)) { wpa_printf(MSG_INFO, "handle_auth - too short payload (len=%lu)", -@@ -2204,6 +2209,13 @@ static void handle_auth(struct hostapd_d +@@ -2493,6 +2498,13 @@ static void handle_auth(struct hostapd_d resp = WLAN_STATUS_UNSPECIFIED_FAILURE; goto fail; } @@ -126,18 +126,18 @@ if (res == HOSTAPD_ACL_PENDING) return; -@@ -3862,7 +3874,7 @@ static void handle_assoc(struct hostapd_ - u16 capab_info, listen_interval, seq_ctrl, fc; - u16 resp = WLAN_STATUS_SUCCESS, reply_res; +@@ -4166,7 +4178,7 @@ static void handle_assoc(struct hostapd_ + int resp = WLAN_STATUS_SUCCESS; + u16 reply_res; const u8 *pos; - int left, i; + int left, i, ubus_resp; struct sta_info *sta; u8 *tmp = NULL; - struct hostapd_sta_wpa_psk_short *psk = NULL; -@@ -3871,6 +3883,11 @@ static void handle_assoc(struct hostapd_ #ifdef CONFIG_FILS - int delay_assoc = 0; +@@ -4379,6 +4391,11 @@ static void handle_assoc(struct hostapd_ + left = res; + } #endif /* CONFIG_FILS */ + struct hostapd_ubus_request req = { + .type = HOSTAPD_UBUS_ASSOC_REQ, @@ -145,11 +145,11 @@ + .ssi_signal = rssi, + }; - if (len < IEEE80211_HDRLEN + (reassoc ? sizeof(mgmt->u.reassoc_req) : - sizeof(mgmt->u.assoc_req))) { -@@ -4050,6 +4067,14 @@ static void handle_assoc(struct hostapd_ - } - #endif /* CONFIG_MBO */ + /* followed by SSID and Supported rates; and HT capabilities if 802.11n + * is used */ +@@ -4543,6 +4560,14 @@ static void handle_assoc(struct hostapd_ + pos, left, rssi, omit_rsnxe); + os_free(tmp); + ubus_resp = hostapd_ubus_handle_event(hapd, &req); + if (ubus_resp) { @@ -160,9 +160,9 @@ + } + /* - * sta->capability is used in check_assoc_ies() for RRM enabled - * capability element. -@@ -4277,6 +4302,7 @@ static void handle_disassoc(struct hosta + * Remove the station in case tranmission of a success response fails + * (the STA was added associated to the driver) or if the station was +@@ -4570,6 +4595,7 @@ static void handle_disassoc(struct hosta wpa_printf(MSG_DEBUG, "disassocation: STA=" MACSTR " reason_code=%d", MAC2STR(mgmt->sa), le_to_host16(mgmt->u.disassoc.reason_code)); @@ -170,7 +170,7 @@ sta = ap_get_sta(hapd, mgmt->sa); if (sta == NULL) { -@@ -4342,6 +4368,8 @@ static void handle_deauth(struct hostapd +@@ -4636,6 +4662,8 @@ static void handle_deauth(struct hostapd " reason_code=%d", MAC2STR(mgmt->sa), le_to_host16(mgmt->u.deauth.reason_code)); @@ -181,10 +181,10 @@ wpa_msg(hapd->msg_ctx, MSG_DEBUG, "Station " MACSTR " trying " --- a/src/ap/beacon.c +++ b/src/ap/beacon.c -@@ -746,6 +746,12 @@ void handle_probe_req(struct hostapd_dat - struct hostapd_sta_wpa_psk_short *psk = NULL; - char *identity = NULL; - char *radius_cui = NULL; +@@ -814,6 +814,12 @@ void handle_probe_req(struct hostapd_dat + u16 csa_offs[2]; + size_t csa_offs_len; + struct radius_sta rad_info; + struct hostapd_ubus_request req = { + .type = HOSTAPD_UBUS_PROBE_REQ, + .mgmt_frame = mgmt, @@ -194,7 +194,7 @@ if (len < IEEE80211_HDRLEN) return; -@@ -923,6 +929,12 @@ void handle_probe_req(struct hostapd_dat +@@ -996,6 +1002,12 @@ void handle_probe_req(struct hostapd_dat } #endif /* CONFIG_P2P */ @@ -209,9 +209,9 @@ --- a/src/ap/drv_callbacks.c +++ b/src/ap/drv_callbacks.c -@@ -118,6 +118,10 @@ int hostapd_notif_assoc(struct hostapd_d +@@ -119,6 +119,10 @@ int hostapd_notif_assoc(struct hostapd_d u16 reason = WLAN_REASON_UNSPECIFIED; - u16 status = WLAN_STATUS_SUCCESS; + int status = WLAN_STATUS_SUCCESS; const u8 *p2p_dev_addr = NULL; + struct hostapd_ubus_request req = { + .type = HOSTAPD_UBUS_ASSOC_REQ, @@ -220,7 +220,7 @@ if (addr == NULL) { /* -@@ -210,6 +214,12 @@ int hostapd_notif_assoc(struct hostapd_d +@@ -211,6 +215,12 @@ int hostapd_notif_assoc(struct hostapd_d goto fail; } @@ -243,7 +243,7 @@ return; } -@@ -578,6 +579,7 @@ skip_poll: +@@ -579,6 +580,7 @@ skip_poll: hapd, sta, WLAN_REASON_PREV_AUTH_NOT_VALID); ap_free_sta(hapd, sta); @@ -251,7 +251,7 @@ break; } } -@@ -1284,6 +1286,7 @@ void ap_sta_set_authorized(struct hostap +@@ -1294,6 +1296,7 @@ void ap_sta_set_authorized(struct hostap buf, ip_addr, keyid_buf); } else { wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_DISCONNECTED "%s", buf); @@ -261,7 +261,7 @@ hapd->msg_ctx_parent != hapd->msg_ctx) --- a/src/ap/wpa_auth_glue.c +++ b/src/ap/wpa_auth_glue.c -@@ -185,6 +185,7 @@ static void hostapd_wpa_auth_psk_failure +@@ -259,6 +259,7 @@ static void hostapd_wpa_auth_psk_failure struct hostapd_data *hapd = ctx; wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_POSSIBLE_PSK_MISMATCH MACSTR, MAC2STR(addr)); @@ -271,7 +271,7 @@ --- a/wpa_supplicant/Makefile +++ b/wpa_supplicant/Makefile -@@ -188,6 +188,12 @@ ifdef CONFIG_EAPOL_TEST +@@ -190,6 +190,12 @@ ifdef CONFIG_EAPOL_TEST CFLAGS += -Werror -DEAPOL_TEST endif @@ -284,19 +284,19 @@ ifdef CONFIG_CODE_COVERAGE CFLAGS += -O0 -fprofile-arcs -ftest-coverage LIBS += -lgcov -@@ -945,6 +951,9 @@ endif - ifdef CONFIG_IEEE80211AX - OBJS += ../src/ap/ieee802_11_he.o +@@ -956,6 +962,9 @@ ifdef CONFIG_CTRL_IFACE_MIB + CFLAGS += -DCONFIG_CTRL_IFACE_MIB endif + OBJS += ../src/ap/ctrl_iface_ap.o +ifdef CONFIG_UBUS +OBJS += ../src/ap/ubus.o +endif endif - ifdef CONFIG_WNM_AP - CFLAGS += -DCONFIG_WNM_AP + + CFLAGS += -DEAP_SERVER -DEAP_SERVER_IDENTITY --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -6297,6 +6297,8 @@ struct wpa_supplicant * wpa_supplicant_a +@@ -6794,6 +6794,8 @@ struct wpa_supplicant * wpa_supplicant_a } #endif /* CONFIG_P2P */ @@ -305,7 +305,7 @@ return wpa_s; } -@@ -6323,6 +6325,8 @@ int wpa_supplicant_remove_iface(struct w +@@ -6820,6 +6822,8 @@ int wpa_supplicant_remove_iface(struct w struct wpa_supplicant *parent = wpa_s->parent; #endif /* CONFIG_MESH */ @@ -314,7 +314,7 @@ /* Remove interface from the global list of interfaces */ prev = global->ifaces; if (prev == wpa_s) { -@@ -6626,8 +6630,12 @@ int wpa_supplicant_run(struct wpa_global +@@ -7123,8 +7127,12 @@ int wpa_supplicant_run(struct wpa_global eloop_register_signal_terminate(wpa_supplicant_terminate, global); eloop_register_signal_reconfig(wpa_supplicant_reconfig, global); @@ -337,7 +337,7 @@ extern const char *const wpa_supplicant_version; extern const char *const wpa_supplicant_license; -@@ -306,6 +307,8 @@ struct wpa_global { +@@ -310,6 +311,8 @@ struct wpa_global { #endif /* CONFIG_WIFI_DISPLAY */ struct psk_list_entry *add_psk; /* From group formation */ @@ -346,7 +346,7 @@ }; -@@ -506,6 +509,7 @@ struct wpa_supplicant { +@@ -520,6 +523,7 @@ struct wpa_supplicant { unsigned char own_addr[ETH_ALEN]; unsigned char perm_addr[ETH_ALEN]; char ifname[100]; @@ -364,7 +364,7 @@ #ifndef WPS_PIN_SCAN_IGNORE_SEL_REG -@@ -388,6 +389,8 @@ static int wpa_supplicant_wps_cred(void +@@ -392,6 +393,8 @@ static int wpa_supplicant_wps_cred(void wpa_hexdump_key(MSG_DEBUG, "WPS: Received Credential attribute", cred->cred_attr, cred->cred_attr_len); @@ -375,7 +375,7 @@ --- a/hostapd/main.c +++ b/hostapd/main.c -@@ -894,6 +894,7 @@ int main(int argc, char *argv[]) +@@ -896,6 +896,7 @@ int main(int argc, char *argv[]) } hostapd_global_ctrl_iface_init(&interfaces); @@ -383,7 +383,7 @@ if (hostapd_global_run(&interfaces, daemonize, pid_file)) { wpa_printf(MSG_ERROR, "Failed to start eloop"); -@@ -903,6 +904,7 @@ int main(int argc, char *argv[]) +@@ -905,6 +906,7 @@ int main(int argc, char *argv[]) ret = 0; out: diff --git a/package/network/services/hostapd/patches/700-wifi-reload.patch b/package/network/services/hostapd/patches/700-wifi-reload.patch index e89d21d580..d5520d0b77 100644 --- a/package/network/services/hostapd/patches/700-wifi-reload.patch +++ b/package/network/services/hostapd/patches/700-wifi-reload.patch @@ -1,6 +1,6 @@ --- a/hostapd/config_file.c +++ b/hostapd/config_file.c -@@ -2470,6 +2470,8 @@ static int hostapd_config_fill(struct ho +@@ -2501,6 +2501,8 @@ static int hostapd_config_fill(struct ho bss->isolate = atoi(pos); } else if (os_strcmp(buf, "ap_max_inactivity") == 0) { bss->ap_max_inactivity = atoi(pos); @@ -9,18 +9,18 @@ } else if (os_strcmp(buf, "skip_inactivity_poll") == 0) { bss->skip_inactivity_poll = atoi(pos); } else if (os_strcmp(buf, "country_code") == 0) { -@@ -3131,6 +3133,8 @@ static int hostapd_config_fill(struct ho +@@ -3197,6 +3199,8 @@ static int hostapd_config_fill(struct ho } } else if (os_strcmp(buf, "acs_exclude_dfs") == 0) { conf->acs_exclude_dfs = atoi(pos); + } else if (os_strcmp(buf, "radio_config_id") == 0) { + conf->config_id = os_strdup(pos); + } else if (os_strcmp(buf, "op_class") == 0) { + conf->op_class = atoi(pos); } else if (os_strcmp(buf, "channel") == 0) { - if (os_strcmp(pos, "acs_survey") == 0) { - #ifndef CONFIG_ACS --- a/src/ap/ap_config.c +++ b/src/ap/ap_config.c -@@ -698,6 +698,7 @@ void hostapd_config_free_bss(struct host +@@ -780,6 +780,7 @@ void hostapd_config_free_bss(struct host os_free(conf->radius_req_attr_sqlite); os_free(conf->rsn_preauth_interfaces); os_free(conf->ctrl_interface); @@ -28,7 +28,7 @@ os_free(conf->ca_cert); os_free(conf->server_cert); os_free(conf->server_cert2); -@@ -881,6 +882,7 @@ void hostapd_config_free(struct hostapd_ +@@ -972,6 +973,7 @@ void hostapd_config_free(struct hostapd_ for (i = 0; i < conf->num_bss; i++) hostapd_config_free_bss(conf->bss[i]); @@ -38,7 +38,7 @@ os_free(conf->basic_rates); --- a/src/ap/ap_config.h +++ b/src/ap/ap_config.h -@@ -829,6 +829,7 @@ struct hostapd_bss_config { +@@ -871,6 +871,7 @@ struct hostapd_bss_config { */ u8 mka_psk_set; #endif /* CONFIG_MACSEC */ @@ -46,17 +46,17 @@ }; /** -@@ -1012,6 +1013,7 @@ struct hostapd_config { +@@ -1062,6 +1063,7 @@ struct hostapd_config { unsigned int airtime_update_interval; #define AIRTIME_MODE_MAX (__AIRTIME_MODE_MAX - 1) #endif /* CONFIG_AIRTIME_POLICY */ + char *config_id; + + u8 notify_mgmt_frames; }; - - --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c -@@ -206,6 +206,10 @@ static int hostapd_iface_conf_changed(st +@@ -218,6 +218,10 @@ static int hostapd_iface_conf_changed(st { size_t i; @@ -67,7 +67,7 @@ if (newconf->num_bss != oldconf->num_bss) return 1; -@@ -219,7 +223,7 @@ static int hostapd_iface_conf_changed(st +@@ -231,7 +235,7 @@ static int hostapd_iface_conf_changed(st } @@ -76,7 +76,7 @@ { struct hapd_interfaces *interfaces = iface->interfaces; struct hostapd_data *hapd = iface->bss[0]; -@@ -242,13 +246,16 @@ int hostapd_reload_config(struct hostapd +@@ -254,13 +258,16 @@ int hostapd_reload_config(struct hostapd if (newconf == NULL) return -1; @@ -95,7 +95,7 @@ wpa_printf(MSG_DEBUG, "Configuration changes include interface/BSS modification - force full disable+enable sequence"); fname = os_strdup(iface->config_fname); -@@ -273,6 +280,22 @@ int hostapd_reload_config(struct hostapd +@@ -285,6 +292,24 @@ int hostapd_reload_config(struct hostapd wpa_printf(MSG_ERROR, "Failed to enable interface on config reload"); return res; @@ -105,20 +105,22 @@ + if (!hapd->config_id || strcmp(hapd->config_id, newconf->bss[j]->config_id)) { + hostapd_flush_old_stations(iface->bss[j], + WLAN_REASON_PREV_AUTH_NOT_VALID); ++#ifdef CONFIG_WEP + hostapd_broadcast_wep_clear(iface->bss[j]); ++#endif + +#ifndef CONFIG_NO_RADIUS + /* TODO: update dynamic data based on changed configuration + * items (e.g., open/close sockets, etc.) */ + radius_client_flush(iface->bss[j]->radius, 0); +#endif /* CONFIG_NO_RADIUS */ -+ wpa_printf(MSG_INFO, "bss %d changed", j); ++ wpa_printf(MSG_INFO, "bss %zu changed", j); + } + } } iface->conf = newconf; -@@ -289,6 +312,12 @@ int hostapd_reload_config(struct hostapd +@@ -301,6 +326,12 @@ int hostapd_reload_config(struct hostapd for (j = 0; j < iface->num_bss; j++) { hapd = iface->bss[j]; @@ -131,7 +133,7 @@ hapd->iconf = newconf; hapd->conf = newconf->bss[j]; hostapd_reload_bss(hapd); -@@ -2257,6 +2286,10 @@ hostapd_alloc_bss_data(struct hostapd_if +@@ -2366,6 +2397,10 @@ hostapd_alloc_bss_data(struct hostapd_if hapd->iconf = conf; hapd->conf = bss; hapd->iface = hapd_iface; @@ -144,7 +146,7 @@ hapd->ctrl_sock = -1; --- a/src/ap/hostapd.h +++ b/src/ap/hostapd.h -@@ -42,7 +42,7 @@ struct mesh_conf; +@@ -46,7 +46,7 @@ struct mesh_conf; struct hostapd_iface; struct hapd_interfaces { @@ -153,7 +155,7 @@ struct hostapd_config * (*config_read_cb)(const char *config_fname); int (*ctrl_iface_init)(struct hostapd_data *hapd); void (*ctrl_iface_deinit)(struct hostapd_data *hapd); -@@ -148,6 +148,7 @@ struct hostapd_data { +@@ -156,6 +156,7 @@ struct hostapd_data { struct hostapd_config *iconf; struct hostapd_bss_config *conf; struct hostapd_ubus_bss ubus; @@ -161,7 +163,7 @@ int interface_added; /* virtual interface added for this BSS */ unsigned int started:1; unsigned int disabled:1; -@@ -575,7 +576,7 @@ struct hostapd_iface { +@@ -600,7 +601,7 @@ struct hostapd_iface { int hostapd_for_each_interface(struct hapd_interfaces *interfaces, int (*cb)(struct hostapd_iface *iface, void *ctx), void *ctx); @@ -172,7 +174,7 @@ hostapd_alloc_bss_data(struct hostapd_iface *hapd_iface, --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -4295,6 +4295,9 @@ static int wpa_driver_nl80211_set_ap(voi +@@ -4493,6 +4493,9 @@ static int wpa_driver_nl80211_set_ap(voi if (ret) { wpa_printf(MSG_DEBUG, "nl80211: Beacon set failed: %d (%s)", ret, strerror(-ret)); @@ -184,7 +186,7 @@ nl80211_set_bss(bss, params->cts_protect, params->preamble, --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c -@@ -182,7 +182,7 @@ static int hostapd_ctrl_iface_update(str +@@ -184,7 +184,7 @@ static int hostapd_ctrl_iface_update(str iface->interfaces->config_read_cb = hostapd_ctrl_iface_config_read; reload_opts = txt; @@ -195,7 +197,7 @@ } --- a/hostapd/main.c +++ b/hostapd/main.c -@@ -320,7 +320,7 @@ static void handle_term(int sig, void *s +@@ -317,7 +317,7 @@ static void handle_term(int sig, void *s static int handle_reload_iface(struct hostapd_iface *iface, void *ctx) { @@ -206,7 +208,7 @@ } --- a/src/ap/wps_hostapd.c +++ b/src/ap/wps_hostapd.c -@@ -275,7 +275,7 @@ static void wps_reload_config(void *eloo +@@ -315,7 +315,7 @@ static void wps_reload_config(void *eloo wpa_printf(MSG_DEBUG, "WPS: Reload configuration data"); if (iface->interfaces == NULL || diff --git a/package/network/services/hostapd/patches/800-dfs-enter-DFS-state-if-no-available-channel-is-found.patch b/package/network/services/hostapd/patches/800-dfs-enter-DFS-state-if-no-available-channel-is-found.patch new file mode 100644 index 0000000000..3e4638d7ff --- /dev/null +++ b/package/network/services/hostapd/patches/800-dfs-enter-DFS-state-if-no-available-channel-is-found.patch @@ -0,0 +1,37 @@ +From cefc52e6b93731c713f1bba1cb5e7e92105b758b Mon Sep 17 00:00:00 2001 +From: David Bauer +Date: Fri, 3 Jul 2020 23:00:34 +0200 +Subject: [PATCH] dfs: enter DFS state if no available channel is found + +Previously hostapd would not stop transmitting when a DFS event was +detected and no available channel to switch to was available. + +Disable and re-enable the interface to enter DFS state. This way, TX +does not happen until the kernel notifies hostapd about the NOP +expiring. + +Signed-off-by: David Bauer +--- + src/ap/dfs.c | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +--- a/src/ap/dfs.c ++++ b/src/ap/dfs.c +@@ -1086,8 +1086,15 @@ static int hostapd_dfs_start_channel_swi + &oper_centr_freq_seg0_idx, + &oper_centr_freq_seg1_idx, + &skip_radar); +- if (!channel) +- return err; ++ if (!channel) { ++ /* ++ * Toggle interface state to enter DFS state ++ * until NOP is finished. ++ */ ++ hostapd_disable_iface(iface); ++ hostapd_enable_iface(iface); ++ return 0; ++ } + if (!skip_radar) { + iface->freq = channel->freq; + iface->conf->channel = channel->chan; diff --git a/package/network/services/hostapd/patches/800-usleep.patch b/package/network/services/hostapd/patches/800-usleep.patch deleted file mode 100644 index 6d90e6f64c..0000000000 --- a/package/network/services/hostapd/patches/800-usleep.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 39042d7f7c4997af55474ebe4513c81f00732837 Mon Sep 17 00:00:00 2001 -From: Rosen Penev -Date: Sat, 24 Aug 2019 15:01:16 -0700 -Subject: os_sleep: Use nanosleep for POSIX versions 2008 and higher - -uClibc-ng optionally disabled deprecated POSIX functions like usleep, -causing compilation failures. This switches to nanosleep while retaining -support for older libcs that do not support nanosleep. - -Signed-off-by: Rosen Penev ---- - src/utils/os_internal.c | 6 ++++++ - src/utils/os_unix.c | 6 ++++++ - 2 files changed, 12 insertions(+) - ---- a/src/utils/os_internal.c -+++ b/src/utils/os_internal.c -@@ -25,10 +25,16 @@ - - void os_sleep(os_time_t sec, os_time_t usec) - { -+#if defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200809L) -+ const struct timespec req = { sec, usec * 1000 }; -+ -+ nanosleep(&req, NULL); -+#else - if (sec) - sleep(sec); - if (usec) - usleep(usec); -+#endif - } - - ---- a/src/utils/os_unix.c -+++ b/src/utils/os_unix.c -@@ -50,10 +50,16 @@ struct os_alloc_trace { - - void os_sleep(os_time_t sec, os_time_t usec) - { -+#if defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200809L) -+ const struct timespec req = { sec, usec * 1000 }; -+ -+ nanosleep(&req, NULL); -+#else - if (sec) - sleep(sec); - if (usec) - usleep(usec); -+#endif - } - - diff --git a/package/network/services/hostapd/patches/801-P2P-Fix-copying-of-secondary-device-types-for-P2P-gr.patch b/package/network/services/hostapd/patches/801-P2P-Fix-copying-of-secondary-device-types-for-P2P-gr.patch new file mode 100644 index 0000000000..944f7d71c9 --- /dev/null +++ b/package/network/services/hostapd/patches/801-P2P-Fix-copying-of-secondary-device-types-for-P2P-gr.patch @@ -0,0 +1,33 @@ +From 947272febe24a8f0ea828b5b2f35f13c3821901e Mon Sep 17 00:00:00 2001 +From: Jouni Malinen +Date: Mon, 9 Nov 2020 11:43:12 +0200 +Subject: [PATCH] P2P: Fix copying of secondary device types for P2P group + client + +Parsing and copying of WPS secondary device types list was verifying +that the contents is not too long for the internal maximum in the case +of WPS messages, but similar validation was missing from the case of P2P +group information which encodes this information in a different +attribute. This could result in writing beyond the memory area assigned +for these entries and corrupting memory within an instance of struct +p2p_device. This could result in invalid operations and unexpected +behavior when trying to free pointers from that corrupted memory. + +Credit to OSS-Fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=27269 +Fixes: e57ae6e19edf ("P2P: Keep track of secondary device types for peers") +Signed-off-by: Jouni Malinen +--- + src/p2p/p2p.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/src/p2p/p2p.c ++++ b/src/p2p/p2p.c +@@ -453,6 +453,8 @@ static void p2p_copy_client_info(struct + dev->info.config_methods = cli->config_methods; + os_memcpy(dev->info.pri_dev_type, cli->pri_dev_type, 8); + dev->info.wps_sec_dev_type_list_len = 8 * cli->num_sec_dev_types; ++ if (dev->info.wps_sec_dev_type_list_len > WPS_SEC_DEV_TYPE_MAX_LEN) ++ dev->info.wps_sec_dev_type_list_len = WPS_SEC_DEV_TYPE_MAX_LEN; + os_memcpy(dev->info.wps_sec_dev_type_list, cli->sec_dev_types, + dev->info.wps_sec_dev_type_list_len); + } diff --git a/package/network/services/hostapd/src/src/ap/ubus.c b/package/network/services/hostapd/src/src/ap/ubus.c index aeea310594..d03b848f94 100644 --- a/package/network/services/hostapd/src/src/ap/ubus.c +++ b/package/network/services/hostapd/src/src/ap/ubus.c @@ -108,6 +108,54 @@ void hostapd_ubus_free_iface(struct hostapd_iface *iface) 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_send_procd_event(char *bssname, char *event) +{ + char *name, *s; + uint32_t id; + void *v; + + if (!ctx || ubus_lookup_id(ctx, "service", &id)) + return; + + if (asprintf(&name, "hostapd.%s.%s", bssname, event) < 0) + return; + + blob_buf_init(&b, 0); + + s = blobmsg_alloc_string_buffer(&b, "type", strlen(name) + 1); + sprintf(s, "%s", name); + blobmsg_add_string_buffer(&b); + + v = blobmsg_open_table(&b, "data"); + blobmsg_close_table(&b, v); + + ubus_invoke(ctx, id, "event", b.head, NULL, NULL, 1000); + + free(name); +} + +static void hostapd_send_shared_event(struct ubus_object *obj, char *bssname, char *event) +{ + hostapd_send_procd_event(bssname, event); + hostapd_notify_ubus(obj, bssname, event); +} + static void hostapd_bss_del_ban(void *eloop_data, void *user_ctx) { @@ -152,7 +200,79 @@ hostapd_bss_reload(struct ubus_context *ctx, struct ubus_object *obj, struct blob_attr *msg) { struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj); - return hostapd_reload_config(hapd->iface, 1); + int ret = hostapd_reload_config(hapd->iface, 1); + + hostapd_send_shared_event(&hapd->iface->interfaces->ubus, hapd->conf->iface, "reload"); + return ret; +} + + +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 @@ -161,6 +281,7 @@ hostapd_bss_get_clients(struct ubus_context *ctx, struct ubus_object *obj, 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]; @@ -203,6 +324,31 @@ hostapd_bss_get_clients(struct ubus_context *ctx, struct ubus_object *obj, 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); @@ -226,6 +372,45 @@ hostapd_bss_get_features(struct ubus_context *ctx, struct ubus_object *obj, 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; + struct os_reltime now; + char phy_name[17]; + char mac_buf[20]; + + blob_buf_init(&b, 0); + blobmsg_add_string(&b, "status", hostapd_state_text(hapd->iface->state)); + blobmsg_add_u32(&b, "freq", hapd->iface->freq); + + snprintf(phy_name, 17, "%s", hapd->iface->phy); + blobmsg_add_string(&b, "phy", phy_name); + + /* 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 @@ -344,6 +529,7 @@ hostapd_bss_list_bans(struct ubus_context *ctx, struct ubus_object *obj, 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, @@ -360,6 +546,53 @@ hostapd_bss_wps_start(struct ubus_context *ctx, struct ubus_object *obj, 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, @@ -375,6 +608,7 @@ hostapd_bss_wps_cancel(struct ubus_context *ctx, struct ubus_object *obj, return 0; } +#endif /* CONFIG_WPS */ static int hostapd_bss_update_beacon(struct ubus_context *ctx, struct ubus_object *obj, @@ -424,6 +658,10 @@ hostapd_config_add(struct ubus_context *ctx, struct ubus_object *obj, if (hostapd_add_iface(interfaces, buf)) return UBUS_STATUS_INVALID_ARGUMENT; + blob_buf_init(&b, 0); + blobmsg_add_u32(&b, "pid", getpid()); + ubus_send_reply(ctx, req, b.head); + return UBUS_STATUS_OK; } @@ -799,7 +1037,6 @@ hostapd_rrm_nr_set(struct ubus_context *ctx, struct ubus_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 ret = 0; int rem; hostapd_rrm_nr_enable(hapd); @@ -813,32 +1050,47 @@ hostapd_rrm_nr_set(struct ubus_context *ctx, struct ubus_object *obj, struct wpa_ssid_value ssid; struct wpabuf *data; u8 bssid[ETH_ALEN]; - char *s; + 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; - s = blobmsg_get_string(tb[0]); - if (hwaddr_aton(s, bssid)) - goto invalid; - - s = blobmsg_get_string(tb[1]); - ssid.ssid_len = strlen(s); - if (ssid.ssid_len > sizeof(ssid.ssid)) - goto invalid; - - memcpy(&ssid, s, ssid.ssid_len); - data = wpabuf_parse_bin(blobmsg_get_string(tb[2])); + /* 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); wpabuf_free(data); continue; invalid: - ret = UBUS_STATUS_INVALID_ARGUMENT; + return UBUS_STATUS_INVALID_ARGUMENT; } return 0; @@ -1022,7 +1274,7 @@ hostapd_wnm_disassoc_imminent(struct ubus_context *ctx, struct ubus_object *obj, if (tb[WNM_DISASSOC_ABRIDGED] && blobmsg_get_bool(tb[WNM_DISASSOC_ABRIDGED])) req_mode |= WNM_BSS_TM_REQ_ABRIDGED; - if (wnm_send_bss_tm_req(hapd, sta, req_mode, duration, 0, NULL, + if (wnm_send_bss_tm_req(hapd, sta, req_mode, duration, duration, NULL, NULL, nr, nr_len, NULL, 0)) return UBUS_STATUS_UNKNOWN_ERROR; @@ -1033,10 +1285,14 @@ hostapd_wnm_disassoc_imminent(struct ubus_context *ctx, struct ubus_object *obj, static const struct ubus_method bss_methods[] = { UBUS_METHOD_NOARG("reload", hostapd_bss_reload), UBUS_METHOD_NOARG("get_clients", hostapd_bss_get_clients), + UBUS_METHOD_NOARG("get_status", hostapd_bss_get_status), UBUS_METHOD("del_client", hostapd_bss_del_client, del_policy), 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 @@ -1086,6 +1342,8 @@ void hostapd_ubus_add_bss(struct hostapd_data *hapd) obj->n_methods = bss_object_type.n_methods; ret = ubus_add_object(ctx, obj); hostapd_ubus_ref_inc(); + + hostapd_send_shared_event(&hapd->iface->interfaces->ubus, hapd->conf->iface, "add"); } void hostapd_ubus_free_bss(struct hostapd_data *hapd) @@ -1096,6 +1354,8 @@ void hostapd_ubus_free_bss(struct hostapd_data *hapd) if (!ctx) return; + hostapd_send_shared_event(&hapd->iface->interfaces->ubus, hapd->conf->iface, "remove"); + if (obj->id) { ubus_remove_object(ctx, obj); hostapd_ubus_ref_dec(); 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 abebecb570..c7fccad413 100644 --- a/package/network/services/hostapd/src/src/utils/build_features.h +++ b/package/network/services/hostapd/src/src/utils/build_features.h @@ -15,14 +15,16 @@ static inline int has_feature(const char *feat) if (!strcmp(feat, "11ac")) return 1; #endif +#ifdef CONFIG_IEEE80211AX + if (!strcmp(feat, "11ax")) + return 1; +#endif #ifdef CONFIG_IEEE80211R if (!strcmp(feat, "11r")) return 1; #endif -#ifdef CONFIG_IEEE80211W if (!strcmp(feat, "11w")) return 1; -#endif #ifdef CONFIG_ACS if (!strcmp(feat, "acs")) return 1; @@ -38,6 +40,18 @@ static inline int has_feature(const char *feat) #ifdef CONFIG_SUITEB192 if (!strcmp(feat, "suiteb192")) return 1; +#endif +#ifdef CONFIG_WEP + if (!strcmp(feat, "wep")) + return 1; +#endif +#ifdef CONFIG_HS20 + if (!strcmp(feat, "hs20")) + return 1; +#endif +#ifdef CONFIG_WPS + if (!strcmp(feat, "wps")) + return 1; #endif return 0; } diff --git a/package/network/services/hostapd/src/wpa_supplicant/ubus.c b/package/network/services/hostapd/src/wpa_supplicant/ubus.c index 4bb92a7b66..16a68c5073 100644 --- a/package/network/services/hostapd/src/wpa_supplicant/ubus.c +++ b/package/network/services/hostapd/src/wpa_supplicant/ubus.c @@ -264,6 +264,10 @@ wpas_config_add(struct ubus_context *ctx, struct ubus_object *obj, if (!wpa_supplicant_add_iface(global, iface, NULL)) return UBUS_STATUS_INVALID_ARGUMENT; + blob_buf_init(&b, 0); + blobmsg_add_u32(&b, "pid", getpid()); + ubus_send_reply(ctx, req, b.head); + return UBUS_STATUS_OK; } diff --git a/package/network/utils/iw/Makefile b/package/network/utils/iw/Makefile index 7abf93e01e..6db9aaf105 100644 --- a/package/network/utils/iw/Makefile +++ b/package/network/utils/iw/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=iw -PKG_VERSION:=5.4 +PKG_VERSION:=5.9 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/software/network/iw -PKG_HASH:=a2469f677088d7b1070a7fbb28f3c747041697e8f6ec70783339cb1bc27a395f +PKG_HASH:=293a07109aeb7e36267cf59e3ce52857e9ffae3a6666eb8ac77894b1839fe1f2 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=GPL-2.0 diff --git a/package/network/utils/iw/patches/001-nl80211_h_sync.patch b/package/network/utils/iw/patches/001-nl80211_h_sync.patch index 6b65f61846..c944e02ba6 100644 --- a/package/network/utils/iw/patches/001-nl80211_h_sync.patch +++ b/package/network/utils/iw/patches/001-nl80211_h_sync.patch @@ -1,8 +1,8 @@ --- a/nl80211.h +++ b/nl80211.h -@@ -2373,6 +2373,9 @@ enum nl80211_commands { - * the allowed channel bandwidth configurations. (u8 attribute) - * Defined by IEEE P802.11ay/D4.0 section 9.4.2.251, Table 13. +@@ -2527,6 +2527,9 @@ enum nl80211_commands { + * override mask. Used with NL80211_ATTR_S1G_CAPABILITY in + * NL80211_CMD_ASSOCIATE or NL80211_CMD_CONNECT. * + * @NL80211_ATTR_WIPHY_ANTENNA_GAIN: Configured antenna gain. Used to reduce + * transmit power to stay within regulatory limits. u32, dBi. @@ -10,32 +10,12 @@ * @NUM_NL80211_ATTR: total number of nl80211_attrs available * @NL80211_ATTR_MAX: highest attribute number currently defined * @__NL80211_ATTR_AFTER_LAST: internal use -@@ -2835,6 +2838,8 @@ enum nl80211_attrs { - NL80211_ATTR_WIPHY_EDMG_CHANNELS, - NL80211_ATTR_WIPHY_EDMG_BW_CONFIG, +@@ -3016,6 +3019,8 @@ enum nl80211_attrs { + NL80211_ATTR_S1G_CAPABILITY, + NL80211_ATTR_S1G_CAPABILITY_MASK, + NL80211_ATTR_WIPHY_ANTENNA_GAIN, + /* add attributes here, update the policy in nl80211.c */ __NL80211_ATTR_AFTER_LAST, -@@ -5484,6 +5489,10 @@ enum nl80211_feature_flags { - * @NL80211_EXT_FEATURE_SAE_OFFLOAD: Device wants to do SAE authentication in - * station mode (SAE password is passed as part of the connect command). - * -+ * @NL80211_EXT_FEATURE_AQL: The driver supports the Airtime Queue Limit (AQL) -+ * feature, which prevents bufferbloat by using the expected transmission -+ * time to limit the amount of data buffered in the hardware. -+ * - * @NUM_NL80211_EXT_FEATURES: number of extended features. - * @MAX_NL80211_EXT_FEATURES: highest extended feature index. - */ -@@ -5529,6 +5538,8 @@ enum nl80211_ext_feature_index { - NL80211_EXT_FEATURE_EXT_KEY_ID, - NL80211_EXT_FEATURE_STA_TX_PWR, - NL80211_EXT_FEATURE_SAE_OFFLOAD, -+ NL80211_EXT_FEATURE_VLAN_OFFLOAD, -+ NL80211_EXT_FEATURE_AQL, - - /* add new features before the definition below */ - NUM_NL80211_EXT_FEATURES, diff --git a/package/network/utils/iw/patches/200-reduce_size.patch b/package/network/utils/iw/patches/200-reduce_size.patch index 58613d59a0..af30876012 100644 --- a/package/network/utils/iw/patches/200-reduce_size.patch +++ b/package/network/utils/iw/patches/200-reduce_size.patch @@ -1,6 +1,6 @@ --- a/event.c +++ b/event.c -@@ -699,6 +699,7 @@ static int print_event(struct nl_msg *ms +@@ -944,6 +944,7 @@ static int print_event(struct nl_msg *ms } switch (gnlh->cmd) { @@ -8,15 +8,15 @@ case NL80211_CMD_NEW_WIPHY: printf("renamed to %s\n", nla_get_string(tb[NL80211_ATTR_WIPHY_NAME])); break; -@@ -734,6 +735,7 @@ static int print_event(struct nl_msg *ms +@@ -979,6 +980,7 @@ static int print_event(struct nl_msg *ms case NL80211_CMD_SCHED_SCAN_RESULTS: printf("got scheduled scan results\n"); break; +#endif + case NL80211_CMD_WIPHY_REG_CHANGE: case NL80211_CMD_REG_CHANGE: - printf("regulatory domain change: "); - -@@ -812,6 +814,7 @@ static int print_event(struct nl_msg *ms + if (gnlh->cmd == NL80211_CMD_WIPHY_REG_CHANGE) +@@ -1061,6 +1063,7 @@ static int print_event(struct nl_msg *ms mac_addr_n2a(macbuf, nla_data(tb[NL80211_ATTR_MAC])); printf("del station %s\n", macbuf); break; @@ -24,10 +24,10 @@ case NL80211_CMD_JOIN_IBSS: mac_addr_n2a(macbuf, nla_data(tb[NL80211_ATTR_MAC])); printf("IBSS %s joined\n", macbuf); -@@ -989,9 +992,9 @@ static int print_event(struct nl_msg *ms - parse_nan_match(tb); +@@ -1254,9 +1257,9 @@ static int print_event(struct nl_msg *ms + case NL80211_CMD_CH_SWITCH_NOTIFY: + parse_ch_switch_notify(tb, gnlh->cmd); break; - } +#endif default: - printf("unknown event %d (%s)\n", @@ -38,23 +38,7 @@ --- a/info.c +++ b/info.c -@@ -164,6 +164,7 @@ static int print_phy_handler(struct nl_m - tb_band[NL80211_BAND_ATTR_VHT_MCS_SET]) - print_vht_info(nla_get_u32(tb_band[NL80211_BAND_ATTR_VHT_CAPA]), - nla_data(tb_band[NL80211_BAND_ATTR_VHT_MCS_SET])); -+#ifdef IW_FULL - if (tb_band[NL80211_BAND_ATTR_IFTYPE_DATA]) { - struct nlattr *nl_iftype; - int rem_band; -@@ -171,6 +172,7 @@ static int print_phy_handler(struct nl_m - nla_for_each_nested(nl_iftype, tb_band[NL80211_BAND_ATTR_IFTYPE_DATA], rem_band) - print_he_info(nl_iftype); - } -+#endif - if (tb_band[NL80211_BAND_ATTR_FREQS]) { - if (!band_had_freq) { - printf("\t\tFrequencies:\n"); -@@ -213,6 +215,7 @@ next: +@@ -216,6 +216,7 @@ next: } } @@ -62,7 +46,7 @@ if (tb_band[NL80211_BAND_ATTR_RATES]) { printf("\t\tBitrates (non-HT):\n"); nla_for_each_nested(nl_rate, tb_band[NL80211_BAND_ATTR_RATES], rem_rate) { -@@ -229,6 +232,7 @@ next: +@@ -232,6 +233,7 @@ next: printf("\n"); } } @@ -70,7 +54,7 @@ } } -@@ -294,6 +298,7 @@ next: +@@ -297,6 +299,7 @@ next: printf("\tCoverage class: %d (up to %dm)\n", coverage, 450 * coverage); } @@ -78,7 +62,7 @@ if (tb_msg[NL80211_ATTR_CIPHER_SUITES]) { int num = nla_len(tb_msg[NL80211_ATTR_CIPHER_SUITES]) / sizeof(__u32); int i; -@@ -305,6 +310,7 @@ next: +@@ -308,6 +311,7 @@ next: cipher_name(ciphers[i])); } } @@ -86,7 +70,7 @@ if (tb_msg[NL80211_ATTR_WIPHY_ANTENNA_AVAIL_TX] && tb_msg[NL80211_ATTR_WIPHY_ANTENNA_AVAIL_RX]) -@@ -324,11 +330,13 @@ next: +@@ -327,11 +331,13 @@ next: printf("\t\t * %s\n", iftype_name(nla_type(nl_mode))); } @@ -100,7 +84,7 @@ if (tb_msg[NL80211_ATTR_INTERFACE_COMBINATIONS]) { struct nlattr *nl_combi; -@@ -425,6 +433,7 @@ broken_combination: +@@ -428,6 +434,7 @@ broken_combination: printf("\tinterface combinations are not supported\n"); } @@ -108,7 +92,7 @@ if (tb_msg[NL80211_ATTR_SUPPORTED_COMMANDS]) { printf("\tSupported commands:\n"); nla_for_each_nested(nl_cmd, tb_msg[NL80211_ATTR_SUPPORTED_COMMANDS], rem_cmd) -@@ -522,6 +531,7 @@ broken_combination: +@@ -525,6 +532,7 @@ broken_combination: printf("\t\t * wake up on TCP connection\n"); } } @@ -116,7 +100,7 @@ if (tb_msg[NL80211_ATTR_ROAM_SUPPORT]) printf("\tDevice supports roaming.\n"); -@@ -560,6 +570,7 @@ broken_combination: +@@ -563,6 +571,7 @@ broken_combination: } } @@ -124,7 +108,7 @@ if (tb_msg[NL80211_ATTR_FEATURE_FLAGS]) { unsigned int features = nla_get_u32(tb_msg[NL80211_ATTR_FEATURE_FLAGS]); -@@ -624,6 +635,7 @@ broken_combination: +@@ -627,6 +636,7 @@ broken_combination: if (features & NL80211_FEATURE_ND_RANDOM_MAC_ADDR) printf("\tDevice supports randomizing MAC-addr in net-detect scans.\n"); } @@ -132,7 +116,7 @@ if (tb_msg[NL80211_ATTR_TDLS_SUPPORT]) printf("\tDevice supports T-DLS.\n"); -@@ -732,6 +744,7 @@ TOPLEVEL(list, NULL, NL80211_CMD_GET_WIP +@@ -762,6 +772,7 @@ TOPLEVEL(list, NULL, NL80211_CMD_GET_WIP "List all wireless devices and their capabilities."); TOPLEVEL(phy, NULL, NL80211_CMD_GET_WIPHY, NLM_F_DUMP, CIB_NONE, handle_info, NULL); @@ -140,7 +124,7 @@ static int handle_commands(struct nl80211_state *state, struct nl_msg *msg, int argc, char **argv, enum id_input id) { -@@ -743,6 +756,7 @@ static int handle_commands(struct nl8021 +@@ -773,6 +784,7 @@ static int handle_commands(struct nl8021 } TOPLEVEL(commands, NULL, NL80211_CMD_GET_WIPHY, 0, CIB_NONE, handle_commands, "list all known commands and their decimal & hex value"); @@ -150,7 +134,7 @@ { --- a/scan.c +++ b/scan.c -@@ -1195,6 +1195,9 @@ static void print_ht_op(const uint8_t ty +@@ -1297,6 +1297,9 @@ static void print_ht_op(const uint8_t ty printf("\t\t * secondary channel offset: %s\n", ht_secondary_offset[data[1] & 0x3]); printf("\t\t * STA channel width: %s\n", sta_chan_width[(data[1] & 0x4)>>2]); @@ -160,7 +144,7 @@ printf("\t\t * RIFS: %d\n", (data[1] & 0x8)>>3); printf("\t\t * HT protection: %s\n", protection[data[2] & 0x3]); printf("\t\t * non-GF present: %d\n", (data[2] & 0x4) >> 2); -@@ -1522,6 +1525,14 @@ static void print_ie(const struct ie_pri +@@ -1707,6 +1710,14 @@ static void print_ie(const struct ie_pri static const struct ie_print ieprinters[] = { [0] = { "SSID", print_ssid, 0, 32, BIT(PRINT_SCAN) | BIT(PRINT_LINK), }, @@ -175,12 +159,15 @@ [1] = { "Supported rates", print_supprates, 0, 255, BIT(PRINT_SCAN), }, [3] = { "DS Parameter set", print_ds, 1, 1, BIT(PRINT_SCAN), }, [5] = { "TIM", print_tim, 4, 255, BIT(PRINT_SCAN), }, -@@ -1531,21 +1542,15 @@ static const struct ie_print ieprinters[ +@@ -1716,26 +1727,20 @@ static const struct ie_print ieprinters[ [32] = { "Power constraint", print_powerconstraint, 1, 1, BIT(PRINT_SCAN), }, [35] = { "TPC report", print_tpcreport, 2, 2, BIT(PRINT_SCAN), }, [42] = { "ERP", print_erp, 1, 255, BIT(PRINT_SCAN), }, - [45] = { "HT capabilities", print_ht_capa, 26, 26, BIT(PRINT_SCAN), }, [47] = { "ERP D4.0", print_erp, 1, 255, BIT(PRINT_SCAN), }, + [51] = { "AP Channel Report", print_ap_channel_report, 1, 255, BIT(PRINT_SCAN), }, + [59] = { "Supported operating classes", print_supp_op_classes, 1, 255, BIT(PRINT_SCAN), }, + [66] = { "Measurement Pilot Transmission", print_measurement_pilot_tx, 1, 255, BIT(PRINT_SCAN), }, [74] = { "Overlapping BSS scan params", print_obss_scan_params, 14, 255, BIT(PRINT_SCAN), }, - [61] = { "HT operation", print_ht_op, 22, 22, BIT(PRINT_SCAN), }, - [62] = { "Secondary Channel Offset", print_secchan_offs, 1, 1, BIT(PRINT_SCAN), }, @@ -188,17 +175,19 @@ - [192] = { "VHT operation", print_vht_oper, 5, 255, BIT(PRINT_SCAN), }, - [48] = { "RSN", print_rsn, 2, 255, BIT(PRINT_SCAN), }, [50] = { "Extended supported rates", print_supprates, 0, 255, BIT(PRINT_SCAN), }, + [70] = { "RM enabled capabilities", print_rm_enabled_capabilities, 5, 5, BIT(PRINT_SCAN), }, [113] = { "MESH Configuration", print_mesh_conf, 7, 7, BIT(PRINT_SCAN), }, - [114] = { "MESH ID", print_ssid, 0, 32, BIT(PRINT_SCAN) | BIT(PRINT_LINK), }, [127] = { "Extended capabilities", print_capabilities, 0, 255, BIT(PRINT_SCAN), }, [107] = { "802.11u Interworking", print_interworking, 0, 255, BIT(PRINT_SCAN), }, [108] = { "802.11u Advertisement", print_11u_advert, 0, 255, BIT(PRINT_SCAN), }, - [111] = { "802.11u Roaming Consortium", print_11u_rcon, 0, 255, BIT(PRINT_SCAN), }, + [111] = { "802.11u Roaming Consortium", print_11u_rcon, 2, 255, BIT(PRINT_SCAN), }, + [195] = { "Transmit Power Envelope", print_tx_power_envelope, 2, 5, BIT(PRINT_SCAN), }, +#endif }; static void print_wifi_wpa(const uint8_t type, uint8_t len, const uint8_t *data, -@@ -2024,6 +2029,7 @@ void print_ies(unsigned char *ie, int ie +@@ -2279,6 +2284,7 @@ void print_ies(unsigned char *ie, int ie ieprinters[ie[0]].flags & BIT(ptype)) { print_ie(&ieprinters[ie[0]], ie[0], ie[1], ie + 2, &ie_buffer); @@ -206,7 +195,7 @@ } else if (ie[0] == 221 /* vendor */) { print_vendor(ie[1], ie + 2, unknown, ptype); } else if (unknown) { -@@ -2033,6 +2039,7 @@ void print_ies(unsigned char *ie, int ie +@@ -2288,6 +2294,7 @@ void print_ies(unsigned char *ie, int ie for (i=0; i [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz] [beacons ] [block-tx]\n" -@@ -727,3 +730,4 @@ COMMAND(switch, freq, - "Switch the operating channel by sending a channel switch announcement (CSA)."); - COMMAND(switch, channel, " [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz] [beacons ] [block-tx]", - NL80211_CMD_CHANNEL_SWITCH, 0, CIB_NETDEV, handle_chan, NULL); +@@ -990,3 +993,4 @@ COMMAND(set, tidconf, "[peer PKG_LICENSE:=GPL-2.0 @@ -25,6 +25,8 @@ PKG_CONFIG_DEPENDS := \ CONFIG_PACKAGE_kmod-brcm-wl-mimo \ CONFIG_PACKAGE_kmod-cfg80211 +IWINFO_ABI_VERSION:=20210106 + include $(INCLUDE_DIR)/package.mk @@ -33,7 +35,7 @@ define Package/libiwinfo CATEGORY:=Libraries TITLE:=Generalized Wireless Information Library (iwinfo) DEPENDS:=+PACKAGE_kmod-cfg80211:libnl-tiny +libuci +libubus - ABI_VERSION:=20200105 + ABI_VERSION:=$(IWINFO_ABI_VERSION) endef define Package/libiwinfo/description @@ -86,21 +88,23 @@ MAKE_FLAGS += \ FPIC="$(FPIC)" \ CFLAGS="$(TARGET_CFLAGS)" \ LDFLAGS="$(TARGET_LDFLAGS)" \ - BACKENDS="$(IWINFO_BACKENDS)" + BACKENDS="$(IWINFO_BACKENDS)" \ + SOVERSION="$(IWINFO_ABI_VERSION)" define Build/InstallDev $(INSTALL_DIR) $(1)/usr/include/iwinfo $(CP) $(PKG_BUILD_DIR)/include/iwinfo.h $(1)/usr/include/ $(CP) $(PKG_BUILD_DIR)/include/iwinfo/* $(1)/usr/include/iwinfo/ $(INSTALL_DIR) $(1)/usr/lib - $(INSTALL_BIN) $(PKG_BUILD_DIR)/libiwinfo.so $(1)/usr/lib/libiwinfo.so + $(CP) $(PKG_BUILD_DIR)/libiwinfo.so* $(1)/usr/lib/ $(INSTALL_DIR) $(1)/usr/lib/lua $(INSTALL_BIN) $(PKG_BUILD_DIR)/iwinfo.so $(1)/usr/lib/lua/iwinfo.so endef define Package/libiwinfo/install $(INSTALL_DIR) $(1)/usr/lib - $(INSTALL_BIN) $(PKG_BUILD_DIR)/libiwinfo.so $(1)/usr/lib/libiwinfo.so + $(INSTALL_BIN) $(PKG_BUILD_DIR)/libiwinfo.so.$(IWINFO_ABI_VERSION) $(1)/usr/lib/libiwinfo.so.$(IWINFO_ABI_VERSION) + $(LN) libiwinfo.so.$(IWINFO_ABI_VERSION) $(1)/usr/lib/libiwinfo.so $(INSTALL_DIR) $(1)/usr/share/libiwinfo $(INSTALL_DATA) $(PKG_BUILD_DIR)/hardware.txt $(1)/usr/share/libiwinfo/hardware.txt endef diff --git a/package/system/rpcd/Makefile b/package/system/rpcd/Makefile index 8791cb03e0..10017dffc9 100644 --- a/package/system/rpcd/Makefile +++ b/package/system/rpcd/Makefile @@ -12,15 +12,16 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/rpcd.git -PKG_SOURCE_DATE:=2020-05-26 -PKG_SOURCE_VERSION:=7be1f17138f19d1d7a86e0c27b3662d3643ff296 +PKG_SOURCE_DATE:=2021-01-06 +PKG_SOURCE_VERSION:=ea7f4717f8b210a8fa491d288ff99ef74409dbff PKG_MAINTAINER:=Jo-Philipp Wich -PKG_MIRROR_HASH:=b427b2be8ebd486edbc88f6e789d1890cbdda1b4f04dcfcc8751f568c3a82674 +PKG_MIRROR_HASH:=905deb3db4b222188d1c126f05428126d389b88d61d2dc1e22e81a617724c7a8 PKG_LICENSE:=ISC PKG_LICENSE_FILES:= PKG_BUILD_PARALLEL:=1 +PKG_ASLR_PIE_REGULAR:=1 include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/cmake.mk