blob: 2419734550edd100d2c014e1d8015980e80457e5 [file] [log] [blame]
developer8d77be32022-10-20 15:08:25 +08001From 6385f7196ddd1e05c4ea089e8076ab9f62794ac8 Mon Sep 17 00:00:00 2001
2From: Peter Chiu <chui-hao.chiu@mediatek.com>
3Date: Thu, 20 Oct 2022 10:55:22 +0800
4Subject: [PATCH] master: mac80211: generate hostapd setting from ap cap
5
6Change-Id: Iaae41c39b7d5c80470ea3e0ac58ac115bfe746ae
7---
8 .../files/lib/netifd/wireless/mac80211.sh | 3 ---
9 .../kernel/mac80211/files/lib/wifi/mac80211.sh | 15 ++++++++++++++-
10 2 files changed, 14 insertions(+), 4 deletions(-)
11
developer20d67712022-03-02 14:09:32 +080012diff --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 +080013index ed280521..a0550057 100644
developer20d67712022-03-02 14:09:32 +080014--- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
15+++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
developer8d77be32022-10-20 15:08:25 +080016@@ -144,9 +144,6 @@ mac80211_hostapd_setup_base() {
17 json_get_values ht_capab_list ht_capab
developer20d67712022-03-02 14:09:32 +080018 json_get_values channel_list channels
19
20- [ "$auto_channel" = 0 ] && [ -z "$channel_list" ] && \
21- channel_list="$channel"
22-
developer9b3248d2022-07-06 00:44:05 +080023 [ "$min_tx_power" -gt 0 ] && append base_cfg "min_tx_power=$min_tx_power"
developer20d67712022-03-02 14:09:32 +080024
developer9b3248d2022-07-06 00:44:05 +080025 set_default noscan 0
developer9b3248d2022-07-06 00:44:05 +080026diff --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 +080027index 3ecd9322..438bf929 100644
developere2597ba2022-06-24 13:09:16 +080028--- a/package/kernel/mac80211/files/lib/wifi/mac80211.sh
29+++ b/package/kernel/mac80211/files/lib/wifi/mac80211.sh
developer8d77be32022-10-20 15:08:25 +080030@@ -120,6 +120,13 @@ get_band_defaults() {
developere2597ba2022-06-24 13:09:16 +080031 mode_band="$band"
32 channel="$chan"
33 htmode="$mode"
34+ if [ "$band" = "6g" ]
35+ then
36+ encryption=sae
37+ key=12345678
38+ else
39+ encryption=none
40+ fi
41 done
42 }
43
developer8d77be32022-10-20 15:08:25 +080044@@ -162,6 +169,8 @@ detect_mac80211() {
developere2597ba2022-06-24 13:09:16 +080045 channel=""
46 htmode=""
47 ht_capab=""
48+ encryption=""
49+ key=""
50
51 get_band_defaults "$dev"
52
developer8d77be32022-10-20 15:08:25 +080053@@ -206,8 +215,12 @@ detect_mac80211() {
54 set wireless.default_${name}.network=lan
55 set wireless.default_${name}.mode=ap
56 set wireless.default_${name}.ssid=OpenWrt
57- set wireless.default_${name}.encryption=none
58+ set wireless.default_${name}.encryption=${encryption}
59+
developere2597ba2022-06-24 13:09:16 +080060 EOF
61+ [ -n "$key" ] && {
developer8d77be32022-10-20 15:08:25 +080062+ uci -q set wireless.default_${name}.key=${key}
developere2597ba2022-06-24 13:09:16 +080063+ }
64 uci -q commit wireless
developer8d77be32022-10-20 15:08:25 +080065 done
66 }
developer20d67712022-03-02 14:09:32 +080067--
developer8d77be32022-10-20 15:08:25 +0800682.18.0
developer20d67712022-03-02 14:09:32 +080069