blob: 17fab3bd33fe142fdcbea0096cadecd7a9a541d5 [file] [log] [blame]
developer356ecec2022-11-14 10:25:04 +08001From ed69c1fdd2d70538644460e299d5772a5528f3d9 Mon Sep 17 00:00:00 2001
2From: Peter Chiu <chui-hao.chiu@mediatek.com>
3Date: Mon, 14 Nov 2022 14:44:47 +0800
4Subject: [PATCH] master mac80211 generate hostapd setting from ap cap
5
6Change-Id: I22cef6b7e1a99b1d589270c136a2e74e7a385e79
7---
8 package/kernel/mac80211/Makefile | 3 +++
9 .../files/lib/netifd/wireless/mac80211.sh | 3 ---
10 .../kernel/mac80211/files/lib/wifi/mac80211.sh | 15 ++++++++++++++-
11 3 files changed, 17 insertions(+), 4 deletions(-)
12
developerce9e5092022-11-10 22:41:59 +080013diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile
developer356ecec2022-11-14 10:25:04 +080014index ec35bf67..ea7bf6e9 100644
developerce9e5092022-11-10 22:41:59 +080015--- a/package/kernel/mac80211/Makefile
16+++ b/package/kernel/mac80211/Makefile
17@@ -19,6 +19,7 @@ PKG_SOURCE:=backports-$(PKG_VERSION).tar.xz
18 PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/backports-$(PKG_VERSION)
19 PKG_BUILD_PARALLEL:=1
developer356ecec2022-11-14 10:25:04 +080020
developerce9e5092022-11-10 22:41:59 +080021+SOURCE_PATH:=./src
22 PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
developer356ecec2022-11-14 10:25:04 +080023
developerce9e5092022-11-10 22:41:59 +080024 PKG_DRIVERS = \
developer356ecec2022-11-14 10:25:04 +080025@@ -296,6 +297,8 @@ define Build/Prepare
26 mkdir -p $(PKG_BUILD_DIR)
27 $(PKG_UNPACK)
28 $(Build/Patch)
29+ $(CP) $(SOURCE_PATH)/net $(PKG_BUILD_DIR) 2>/dev/null || :
30+ $(CP) $(SOURCE_PATH)/include $(PKG_BUILD_DIR) 2>/dev/null || :
31 rm -rf \
32 $(PKG_BUILD_DIR)/include/linux/ssb \
33 $(PKG_BUILD_DIR)/include/linux/bcma \
developer20d67712022-03-02 14:09:32 +080034diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
developer8d77be32022-10-20 15:08:25 +080035index ed280521..a0550057 100644
developer20d67712022-03-02 14:09:32 +080036--- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
37+++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
developer8d77be32022-10-20 15:08:25 +080038@@ -144,9 +144,6 @@ mac80211_hostapd_setup_base() {
39 json_get_values ht_capab_list ht_capab
developer20d67712022-03-02 14:09:32 +080040 json_get_values channel_list channels
41
42- [ "$auto_channel" = 0 ] && [ -z "$channel_list" ] && \
43- channel_list="$channel"
44-
developer9b3248d2022-07-06 00:44:05 +080045 [ "$min_tx_power" -gt 0 ] && append base_cfg "min_tx_power=$min_tx_power"
developer20d67712022-03-02 14:09:32 +080046
developer9b3248d2022-07-06 00:44:05 +080047 set_default noscan 0
developer9b3248d2022-07-06 00:44:05 +080048diff --git a/package/kernel/mac80211/files/lib/wifi/mac80211.sh b/package/kernel/mac80211/files/lib/wifi/mac80211.sh
developer8d77be32022-10-20 15:08:25 +080049index 3ecd9322..438bf929 100644
developere2597ba2022-06-24 13:09:16 +080050--- a/package/kernel/mac80211/files/lib/wifi/mac80211.sh
51+++ b/package/kernel/mac80211/files/lib/wifi/mac80211.sh
developer8d77be32022-10-20 15:08:25 +080052@@ -120,6 +120,13 @@ get_band_defaults() {
developere2597ba2022-06-24 13:09:16 +080053 mode_band="$band"
54 channel="$chan"
55 htmode="$mode"
56+ if [ "$band" = "6g" ]
57+ then
58+ encryption=sae
59+ key=12345678
60+ else
61+ encryption=none
62+ fi
63 done
64 }
65
developer8d77be32022-10-20 15:08:25 +080066@@ -162,6 +169,8 @@ detect_mac80211() {
developere2597ba2022-06-24 13:09:16 +080067 channel=""
68 htmode=""
69 ht_capab=""
70+ encryption=""
71+ key=""
72
73 get_band_defaults "$dev"
74
developer8d77be32022-10-20 15:08:25 +080075@@ -206,8 +215,12 @@ detect_mac80211() {
76 set wireless.default_${name}.network=lan
77 set wireless.default_${name}.mode=ap
78 set wireless.default_${name}.ssid=OpenWrt
79- set wireless.default_${name}.encryption=none
80+ set wireless.default_${name}.encryption=${encryption}
81+
developere2597ba2022-06-24 13:09:16 +080082 EOF
83+ [ -n "$key" ] && {
developer8d77be32022-10-20 15:08:25 +080084+ uci -q set wireless.default_${name}.key=${key}
developere2597ba2022-06-24 13:09:16 +080085+ }
86 uci -q commit wireless
developer8d77be32022-10-20 15:08:25 +080087 done
88 }
developer20d67712022-03-02 14:09:32 +080089--
developer8d77be32022-10-20 15:08:25 +0800902.18.0
developer20d67712022-03-02 14:09:32 +080091