blob: a8e85c0abfe1369f7ed6e4dd09b5199329c1b26d [file] [log] [blame]
developerce9e5092022-11-10 22:41:59 +08001diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile
developer785b6502023-04-19 18:31:11 +08002index 02cf715d..d878cb2a 100644
developerce9e5092022-11-10 22:41:59 +08003--- a/package/kernel/mac80211/Makefile
4+++ b/package/kernel/mac80211/Makefile
developerf0de14b2022-12-14 23:07:34 +08005@@ -20,6 +20,7 @@ PKG_SOURCE:=backports-$(PKG_VERSION).tar.xz
developerce9e5092022-11-10 22:41:59 +08006 PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/backports-$(PKG_VERSION)
7 PKG_BUILD_PARALLEL:=1
developer356ecec2022-11-14 10:25:04 +08008
developerce9e5092022-11-10 22:41:59 +08009+SOURCE_PATH:=./src
10 PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
developer356ecec2022-11-14 10:25:04 +080011
developerce9e5092022-11-10 22:41:59 +080012 PKG_DRIVERS = \
developerf0de14b2022-12-14 23:07:34 +080013@@ -72,6 +73,10 @@ config-y:= \
developer6ec8e342022-11-21 18:47:15 +080014 WLAN_VENDOR_ST \
15 WLAN_VENDOR_TI \
16 WLAN_VENDOR_ZYDAS \
17+ MAC80211_DEBUG_MENU \
18+ MAC80211_MLME_DEBUG \
19+ MAC80211_STA_DEBUG \
20+ MAC80211_HT_DEBUG \
21
22 config-$(call config_package,cfg80211) += CFG80211
23 config-$(CONFIG_PACKAGE_CFG80211_TESTMODE) += NL80211_TESTMODE
developerf0de14b2022-12-14 23:07:34 +080024@@ -297,6 +302,8 @@ define Build/Prepare
developer356ecec2022-11-14 10:25:04 +080025 mkdir -p $(PKG_BUILD_DIR)
26 $(PKG_UNPACK)
27 $(Build/Patch)
28+ $(CP) $(SOURCE_PATH)/net $(PKG_BUILD_DIR) 2>/dev/null || :
29+ $(CP) $(SOURCE_PATH)/include $(PKG_BUILD_DIR) 2>/dev/null || :
30 rm -rf \
31 $(PKG_BUILD_DIR)/include/linux/ssb \
32 $(PKG_BUILD_DIR)/include/linux/bcma \
developer20d67712022-03-02 14:09:32 +080033diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
developer785b6502023-04-19 18:31:11 +080034index 5aaba9af..ce30b61d 100644
developer20d67712022-03-02 14:09:32 +080035--- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
36+++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
developer0ba09b62023-03-10 18:43:49 +080037@@ -27,6 +27,7 @@ drv_mac80211_init_device_config() {
38
39 config_add_string path phy 'macaddr:macaddr'
40 config_add_string tx_burst
developer785b6502023-04-19 18:31:11 +080041+ config_add_int mbssid mu_onoff
developer0ba09b62023-03-10 18:43:49 +080042 config_add_string distance
43 config_add_int beacon_int chanbw frag rts
44 config_add_int rxantenna txantenna antenna_gain txpower min_tx_power
developer785b6502023-04-19 18:31:11 +080045@@ -53,7 +54,10 @@ drv_mac80211_init_device_config() {
46 he_spr_sr_control \
47 he_spr_psr_enabled \
48 he_bss_color_enabled \
49- he_twt_required
50+ he_twt_required \
51+ he_twt_responder \
52+ etxbfen \
53+ itxbfen
54 config_add_int \
55 beamformer_antennas \
56 beamformee_antennas \
57@@ -140,13 +144,11 @@ mac80211_hostapd_setup_base() {
developer0ba09b62023-03-10 18:43:49 +080058 [ -n "$acs_exclude_dfs" ] && [ "$acs_exclude_dfs" -gt 0 ] &&
59 append base_cfg "acs_exclude_dfs=1" "$N"
60
61- json_get_vars noscan ht_coex min_tx_power:0 tx_burst
developer785b6502023-04-19 18:31:11 +080062+ json_get_vars noscan ht_coex min_tx_power:0 tx_burst mbssid mu_onoff
63+ json_get_vars etxbfen:1 itxbfen:1
developer8d77be32022-10-20 15:08:25 +080064 json_get_values ht_capab_list ht_capab
developer20d67712022-03-02 14:09:32 +080065 json_get_values channel_list channels
66
67- [ "$auto_channel" = 0 ] && [ -z "$channel_list" ] && \
68- channel_list="$channel"
69-
developer9b3248d2022-07-06 00:44:05 +080070 [ "$min_tx_power" -gt 0 ] && append base_cfg "min_tx_power=$min_tx_power"
developer20d67712022-03-02 14:09:32 +080071
developer9b3248d2022-07-06 00:44:05 +080072 set_default noscan 0
developer785b6502023-04-19 18:31:11 +080073@@ -160,8 +162,8 @@ mac80211_hostapd_setup_base() {
74 ieee80211n=1
75 ht_capab=
76 case "$htmode" in
77- VHT20|HT20|HE20) ;;
78- HT40*|VHT40|VHT80|VHT160|HE40|HE80|HE160)
79+ VHT20|HT20|HE20|EHT20) ;;
80+ HT40*|VHT40|VHT80|VHT160|HE40|HE80|HE160|EHT40|EHT80|EHT160|EHT320*)
81 case "$hwmode" in
82 a)
83 case "$(( (($channel / 4) + $chan_ofs) % 2 ))" in
84@@ -205,7 +207,7 @@ mac80211_hostapd_setup_base() {
85 dsss_cck_40:1
86
87 ht_cap_mask=0
88- for cap in $(iw phy "$phy" info | grep 'Capabilities:' | cut -d: -f2); do
89+ for cap in $(iw phy "$phy" info | grep 'Capabilities: 0x' | cut -d: -f2); do
90 ht_cap_mask="$(($ht_cap_mask | $cap))"
91 done
92
93@@ -236,8 +238,8 @@ mac80211_hostapd_setup_base() {
94
95 idx="$channel"
96 case "$htmode" in
97- VHT20|HE20) enable_ac=1;;
98- VHT40|HE40)
99+ VHT20|HE20|EHT20) enable_ac=1;;
100+ VHT40|HE40|EHT40)
101 case "$(( (($channel / 4) + $chan_ofs) % 2 ))" in
102 1) idx=$(($channel + 2));;
103 0) idx=$(($channel - 2));;
104@@ -245,7 +247,7 @@ mac80211_hostapd_setup_base() {
105 enable_ac=1
106 vht_center_seg0=$idx
107 ;;
108- VHT80|HE80)
109+ VHT80|HE80|EHT80)
110 case "$(( (($channel / 4) + $chan_ofs) % 4 ))" in
111 1) idx=$(($channel + 6));;
112 2) idx=$(($channel + 2));;
113@@ -256,7 +258,7 @@ mac80211_hostapd_setup_base() {
114 vht_oper_chwidth=1
115 vht_center_seg0=$idx
116 ;;
117- VHT160|HE160)
118+ VHT160|HE160|EHT160)
119 if [ "$band" = "6g" ]; then
120 case "$channel" in
121 1|5|9|13|17|21|25|29) idx=15;;
122@@ -277,6 +279,36 @@ mac80211_hostapd_setup_base() {
123 vht_oper_chwidth=2
124 vht_center_seg0=$idx
125 ;;
126+ EHT320*)
127+ case "$channel" in
128+ 1|5|9|13|17|21|25|29) idx=31;;
129+ 33|37|41|45|49|53|57|61| \
130+ 65|69|73|77|81|85|89|93) idx=63;;
131+ 97|101|105|109|113|117|121|125| \
132+ 129|133|137|141|145|149|153|157) idx=127;;
133+ 161|165|169|173|177|181|185|189| \
134+ 193|197|201|205|209|213|217|221) idx=191;;
135+ esac
136+ if [[ "$htmode" = "EHT320-1" && "$channel" -ge "193" ]] ||
137+ [[ "$htmode" = "EHT320-2" && "$channel" -le "29" ]]; then
138+ echo "Could not set the center freq with this EHT setting"
139+ return 1
140+ elif [[ "$htmode" = "EHT320-1" && "$channel" -ge "33" ]]; then
141+ if [ "$channel" -gt $idx ]; then
142+ idx=$(($idx + 32))
143+ else
144+ idx=$(($idx - 32))
145+ fi
146+ fi
147+ vht_oper_chwidth=2
148+ if [ "$channel" -gt $idx ]; then
149+ vht_center_seg0=$(($idx + 16))
150+ else
151+ vht_center_seg0=$(($idx - 16))
152+ fi
153+ eht_oper_chwidth=9
154+ eht_oper_centr_freq_seg0_idx=$idx
155+ ;;
156 esac
157 [ "$band" = "5g" ] && {
158 json_get_vars background_radar:0
159@@ -286,8 +318,9 @@ mac80211_hostapd_setup_base() {
160 [ "$band" = "6g" ] && {
161 op_class=
162 case "$htmode" in
163- HE20) op_class=131;;
164- HE*) op_class=$((132 + $vht_oper_chwidth))
165+ HE20|EHT20) op_class=131;;
166+ EHT320*) op_class=137;;
167+ HE*|EHT*) op_class=$((132 + $vht_oper_chwidth))
168 esac
169 [ -n "$op_class" ] && append base_cfg "op_class=$op_class" "$N"
170 }
171@@ -315,7 +348,6 @@ mac80211_hostapd_setup_base() {
developer8b04dfd2022-12-07 16:29:19 +0800172 vht_link_adapt:3 \
173 vht160:2
174
175- set_default tx_burst 2.0
176 append base_cfg "ieee80211ac=1" "$N"
177 vht_cap=0
178 for cap in $(iw phy "$phy" info | awk -F "[()]" '/VHT Capabilities/ { print $2 }'); do
developer785b6502023-04-19 18:31:11 +0800179@@ -329,6 +361,12 @@ mac80211_hostapd_setup_base() {
180 [ "$rx_stbc" -lt "$cap_rx_stbc" ] && cap_rx_stbc="$rx_stbc"
181 vht_cap="$(( ($vht_cap & ~(0x700)) | ($cap_rx_stbc << 8) ))"
182
183+ [ "$etxbfen" -eq 0 ] && {
184+ su_beamformer=0
185+ su_beamformee=0
186+ mu_beamformer=0
187+ }
188+
189 mac80211_add_capabilities vht_capab $vht_cap \
190 RXLDPC:0x10::$rxldpc \
191 SHORT-GI-80:0x20::$short_gi_80 \
192@@ -410,7 +448,7 @@ mac80211_hostapd_setup_base() {
193 # 802.11ax
194 enable_ax=0
195 case "$htmode" in
196- HE*) enable_ax=1 ;;
197+ HE*|EHT*) enable_ax=1 ;;
198 esac
199
200 if [ "$enable_ax" != "0" ]; then
201@@ -419,10 +457,11 @@ mac80211_hostapd_setup_base() {
202 he_su_beamformee:1 \
203 he_mu_beamformer:1 \
204 he_twt_required:0 \
205+ he_twt_responder \
206 he_spr_sr_control:3 \
207 he_spr_psr_enabled:0 \
208 he_spr_non_srg_obss_pd_max_offset:0 \
209- he_bss_color:128 \
210+ he_bss_color \
211 he_bss_color_enabled:1
212
213 he_phy_cap=$(iw phy "$phy" info | sed -n '/HE Iftypes: AP/,$p' | awk -F "[()]" '/HE PHY Capabilities/ { print $2 }' | head -1)
214@@ -436,6 +475,11 @@ mac80211_hostapd_setup_base() {
215 append base_cfg "he_oper_centr_freq_seg0_idx=$vht_center_seg0" "$N"
216 }
217
218+ [ "$etxbfen" -eq 0 ] && {
219+ he_su_beamformer=0
220+ he_mu_beamformer=0
221+ }
222+
223 mac80211_add_he_capabilities \
224 he_su_beamformer:${he_phy_cap:6:2}:0x80:$he_su_beamformer \
225 he_su_beamformee:${he_phy_cap:8:2}:0x1:$he_su_beamformee \
226@@ -443,7 +487,14 @@ mac80211_hostapd_setup_base() {
227 he_spr_psr_enabled:${he_phy_cap:14:2}:0x1:$he_spr_psr_enabled \
228 he_twt_required:${he_mac_cap:0:2}:0x6:$he_twt_required
229
230+ if [ -n "$he_twt_responder" ]; then
231+ append base_cfg "he_twt_responder=$he_twt_responder" "$N"
232+ fi
233 if [ "$he_bss_color_enabled" -gt 0 ]; then
234+ if [ -z "$he_bss_color" ]; then
235+ rand=$(head -n 1 /dev/urandom | tr -dc 0-9 | head -c 2)
236+ he_bss_color=$((rand % 63 + 1))
237+ fi
238 append base_cfg "he_bss_color=$he_bss_color" "$N"
239 [ "$he_spr_non_srg_obss_pd_max_offset" -gt 0 ] && { \
240 append base_cfg "he_spr_non_srg_obss_pd_max_offset=$he_spr_non_srg_obss_pd_max_offset" "$N"
241@@ -484,12 +535,46 @@ mac80211_hostapd_setup_base() {
developer8b04dfd2022-12-07 16:29:19 +0800242 append base_cfg "he_mu_edca_ac_vo_timer=255" "$N"
243 fi
244
developer9851a292022-12-15 17:33:43 +0800245+ set_default tx_burst 5.9
developer8b04dfd2022-12-07 16:29:19 +0800246+
developer785b6502023-04-19 18:31:11 +0800247+ # 802.11be
248+ enable_be=0
249+ case "$htmode" in
250+ EHT*) enable_be=1 ;;
251+ esac
252+
253+ if [ "$enable_be" != "0" ]; then
254+ append base_cfg "ieee80211be=1" "$N"
255+ if [ "$etxbfen" -eq 0 ]; then
256+ append base_cfg "eht_su_beamformee=1" "$N"
257+ else
258+ append base_cfg "eht_su_beamformer=1" "$N"
259+ append base_cfg "eht_su_beamformee=1" "$N"
260+ append base_cfg "eht_mu_beamformer=1" "$N"
261+ fi
262+ [ "$hwmode" = "a" ] && {
263+ case $htmode in
264+ EHT320*)
265+ append base_cfg "eht_oper_chwidth=$eht_oper_chwidth" "$N"
266+ append base_cfg "eht_oper_centr_freq_seg0_idx=$eht_oper_centr_freq_seg0_idx" "$N"
267+ ;;
268+ *)
269+ append base_cfg "eht_oper_chwidth=$vht_oper_chwidth" "$N"
270+ append base_cfg "eht_oper_centr_freq_seg0_idx=$vht_center_seg0" "$N"
271+ ;;
272+ esac
273+ }
274+ fi
275+
developer8b04dfd2022-12-07 16:29:19 +0800276 hostapd_prepare_device_config "$hostapd_conf_file" nl80211
277 cat >> "$hostapd_conf_file" <<EOF
278 ${channel:+channel=$channel}
developer0ba09b62023-03-10 18:43:49 +0800279 ${channel_list:+chanlist=$channel_list}
280 ${hostapd_noscan:+noscan=1}
281 ${tx_burst:+tx_queue_data2_burst=$tx_burst}
282+${mbssid:+mbssid=$mbssid}
developer785b6502023-04-19 18:31:11 +0800283+${mu_onoff:+mu_onoff=$mu_onoff}
284+${itxbfen:+ibf_enable=$itxbfen}
developer0ba09b62023-03-10 18:43:49 +0800285 $base_cfg
286
287 EOF
developer785b6502023-04-19 18:31:11 +0800288@@ -517,7 +602,7 @@ mac80211_hostapd_setup_bss() {
developer093e1a32023-02-24 16:10:53 +0800289 append hostapd_cfg "wds_sta=1" "$N"
290 [ -n "$wds_bridge" ] && append hostapd_cfg "wds_bridge=$wds_bridge" "$N"
291 }
292- [ "$staidx" -gt 0 -o "$start_disabled" -eq 1 ] && append hostapd_cfg "start_disabled=1" "$N"
293+ [ "$start_disabled" -eq 1 ] && append hostapd_cfg "start_disabled=1" "$N"
294
295 cat >> /var/run/hostapd-$phy.conf <<EOF
296 $hostapd_cfg
developer785b6502023-04-19 18:31:11 +0800297@@ -527,6 +612,34 @@ ${max_listen_int:+max_listen_interval=$max_listen_int}
developer0ba09b62023-03-10 18:43:49 +0800298 EOF
299 }
300
301+mac80211_generate_mbssid_mac() {
302+ local phy="$1"
303+ local transmitted_bssid="$2"
304+ local id="${macidx:-0}"
305+
306+ local ref="$(cat /sys/class/ieee80211/${phy}/macaddress)"
307+ local mask="$(cat /sys/class/ieee80211/${phy}/address_mask)"
308+
309+ if [ -z "$transmitted_bssid" ]; then
310+ transmitted_bssid=$ref
311+ fi
312+
313+ if [ $id -eq 0 ]; then
314+ echo "$transmitted_bssid"
315+ return
316+ fi
317+
318+ local oIFS="$IFS"; IFS=":"; set -- $transmitted_bssid; IFS="$oIFS"
319+
320+ # Calculate nontransmitted bssid
321+ macidx=$(($id + 1))
322+ mbssid_idx=$(($macidx - 1))
323+ b6="0x$6"
324+ ref_b6=$(($b6 % $max_mbssid))
325+ b6=$(($b6 - $ref_b6 + ($ref_b6 + $mbssid_idx) % $max_mbssid))
326+ printf "%s:%s:%s:%s:%s:%02x" $1 $2 $3 $4 $5 $b6
327+}
328+
329 mac80211_get_addr() {
330 local phy="$1"
331 local idx="$(($2 + 1))"
developer785b6502023-04-19 18:31:11 +0800332@@ -757,7 +870,13 @@ mac80211_prepare_vif() {
developer0ba09b62023-03-10 18:43:49 +0800333
334 json_select ..
335
336- if [ -z "$macaddr" ]; then
337+ if [ "$mbssid" -gt 0 ]; then
338+ [ "$macidx" -eq 0 ] && {
339+ transmitted_bssid=$macaddr
340+ }
341+ macaddr="$(mac80211_generate_mbssid_mac $phy $transmitted_bssid)"
342+ macidx="$(($macidx + 1))"
343+ elif [ -z "$macaddr" ]; then
344 macaddr="$(mac80211_generate_mac $phy)"
345 macidx="$(($macidx + 1))"
346 elif [ "$macaddr" = 'random' ]; then
developer785b6502023-04-19 18:31:11 +0800347@@ -1058,6 +1177,9 @@ mac80211_setup_vif() {
developerf0de14b2022-12-14 23:07:34 +0800348
349 json_select ..
350 [ -n "$failed" ] || wireless_add_vif "$name" "$ifname"
351+
352+ echo "Setup SMP Affinity"
353+ /sbin/smp-mt76.sh
354 }
355
356 get_freq() {
developer785b6502023-04-19 18:31:11 +0800357@@ -1122,6 +1244,10 @@ drv_mac80211_cleanup() {
developer0ba09b62023-03-10 18:43:49 +0800358 hostapd_common_cleanup
359 }
360
361+mac80211_count_ap() {
362+ total_num_ap=$(($total_num_ap + 1))
363+}
364+
365 drv_mac80211_setup() {
366 json_select config
367 json_get_vars \
developer785b6502023-04-19 18:31:11 +0800368@@ -1219,6 +1345,16 @@ drv_mac80211_setup() {
developer0ba09b62023-03-10 18:43:49 +0800369 for_each_interface "sta adhoc mesh" mac80211_set_noscan
370 [ -n "$has_ap" ] && mac80211_hostapd_setup_base "$phy"
371
372+ total_num_ap=0
373+ max_mbssid=1
374+ for_each_interface "ap" mac80211_count_ap
375+ total_num_ap=$(($total_num_ap - 1))
376+ while [ $total_num_ap -gt 0 ]
377+ do
378+ total_num_ap=$(($total_num_ap >> 1))
379+ max_mbssid=$(($max_mbssid << 1))
380+ done
381+
382 mac80211_prepare_iw_htmode
383 for_each_interface "sta adhoc mesh monitor" mac80211_prepare_vif
384 NEWAPLIST=
developer9b3248d2022-07-06 00:44:05 +0800385diff --git a/package/kernel/mac80211/files/lib/wifi/mac80211.sh b/package/kernel/mac80211/files/lib/wifi/mac80211.sh
developer785b6502023-04-19 18:31:11 +0800386index e24a2a63..80cd298c 100644
developere2597ba2022-06-24 13:09:16 +0800387--- a/package/kernel/mac80211/files/lib/wifi/mac80211.sh
388+++ b/package/kernel/mac80211/files/lib/wifi/mac80211.sh
developer785b6502023-04-19 18:31:11 +0800389@@ -60,6 +60,8 @@ BEGIN {
390 if (vht && band != "1:") mode="VHT80"
391 if (he) mode="HE80"
392 if (he && band == "1:") mode="HE20"
393+ if (eht) mode="EHT80"
394+ if (eht && band == "1:") mode="EHT20"
395 sub("\\[", "", channel)
396 sub("\\]", "", channel)
397 bands = bands band channel ":" mode " "
398@@ -73,6 +75,7 @@ $1 == "Band" {
399 vht = ""
400 ht = ""
401 he = ""
402+ eht = ""
403 }
404
405 $0 ~ "Capabilities:" {
406@@ -87,6 +90,10 @@ $0 ~ "HE Iftypes" {
407 he=1
408 }
409
410+$0 ~ "EHT Iftypes" {
411+ eht=1
412+}
413+
414 $1 == "*" && $3 == "MHz" && $0 !~ /disabled/ && band && !channel {
415 channel = $4
416 }
417@@ -120,6 +127,13 @@ get_band_defaults() {
developere2597ba2022-06-24 13:09:16 +0800418 mode_band="$band"
419 channel="$chan"
420 htmode="$mode"
421+ if [ "$band" = "6g" ]
422+ then
423+ encryption=sae
424+ key=12345678
425+ else
426+ encryption=none
427+ fi
428 done
429 }
430
developer785b6502023-04-19 18:31:11 +0800431@@ -153,6 +167,10 @@ detect_mac80211() {
432
433 json_load_file /etc/board.json
434
435+ # generate random bytes for macaddr
436+ rand=$(hexdump -C /dev/urandom | head -n 1 &)
437+ killall hexdump
438+
439 for _dev in /sys/class/ieee80211/*; do
440 [ -e "$_dev" ] || continue
441
442@@ -162,6 +180,8 @@ detect_mac80211() {
developere2597ba2022-06-24 13:09:16 +0800443 channel=""
444 htmode=""
445 ht_capab=""
446+ encryption=""
447+ key=""
448
449 get_band_defaults "$dev"
450
developer785b6502023-04-19 18:31:11 +0800451@@ -196,6 +216,11 @@ detect_mac80211() {
452 ;;
453 esac
454
455+ macaddr=""
456+ for i in $(seq 2 3); do
457+ macaddr=${macaddr}:$(echo $rand | cut -d ' ' -f $i)
458+ done
459+
460 uci -q batch <<-EOF
461 set wireless.${name}=wifi-device
462 set wireless.${name}.type=mac80211
463@@ -210,8 +235,14 @@ detect_mac80211() {
developer8d77be32022-10-20 15:08:25 +0800464 set wireless.default_${name}.network=lan
465 set wireless.default_${name}.mode=ap
466 set wireless.default_${name}.ssid=OpenWrt
467- set wireless.default_${name}.encryption=none
468+ set wireless.default_${name}.encryption=${encryption}
469+
developer785b6502023-04-19 18:31:11 +0800470+ set wireless.default_${name}.macaddr=00:0$(($devidx - 1)):55:66${macaddr}
471+
developere2597ba2022-06-24 13:09:16 +0800472 EOF
473+ [ -n "$key" ] && {
developer8d77be32022-10-20 15:08:25 +0800474+ uci -q set wireless.default_${name}.key=${key}
developere2597ba2022-06-24 13:09:16 +0800475+ }
476 uci -q commit wireless
developer8d77be32022-10-20 15:08:25 +0800477 done
478 }
developer85839fe2023-02-23 10:32:51 +0800479diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh
developer813f5d72023-03-28 17:44:38 +0800480index 28bd2106..5e21d0d6 100644
developer85839fe2023-02-23 10:32:51 +0800481--- a/package/network/services/hostapd/files/hostapd.sh
482+++ b/package/network/services/hostapd/files/hostapd.sh
developer813f5d72023-03-28 17:44:38 +0800483@@ -376,6 +376,13 @@ hostapd_common_add_bss_config() {
developer82408892023-03-27 15:09:00 +0800484 config_add_string fils_dhcp
485
486 config_add_int ocv
487+
488+ config_add_int disable_eht
489+ config_add_int disable_he
490+ config_add_int disable_vht
491+ config_add_int disable_ht
developer813f5d72023-03-28 17:44:38 +0800492+
493+ config_add_boolean beacon_prot
developer82408892023-03-27 15:09:00 +0800494 }
495
496 hostapd_set_vlan_file() {
developer813f5d72023-03-28 17:44:38 +0800497@@ -975,7 +982,7 @@ hostapd_set_bss_options() {
498 # RSN -> allow management frame protection
499 case "$ieee80211w" in
500 [012])
501- json_get_vars ieee80211w_mgmt_cipher ieee80211w_max_timeout ieee80211w_retry_timeout
502+ json_get_vars ieee80211w_mgmt_cipher ieee80211w_max_timeout ieee80211w_retry_timeout beacon_prot
503 append bss_conf "ieee80211w=$ieee80211w" "$N"
504 [ "$ieee80211w" -gt "0" ] && {
505 if [ "$auth_type" = "eap192" ]; then
506@@ -983,6 +990,8 @@ hostapd_set_bss_options() {
507 else
508 append bss_conf "group_mgmt_cipher=${ieee80211w_mgmt_cipher:-AES-128-CMAC}" "$N"
509 fi
510+ [ -n "$beacon_prot" ] && \
511+ append bss_conf "beacon_prot=$beacon_prot" "$N"
512 [ -n "$ieee80211w_max_timeout" ] && \
513 append bss_conf "assoc_sa_query_max_timeout=$ieee80211w_max_timeout" "$N"
514 [ -n "$ieee80211w_retry_timeout" ] && \
515@@ -1559,6 +1568,20 @@ wpa_supplicant_add_network() {
developer82408892023-03-27 15:09:00 +0800516 [ -n "$bssid_blacklist" ] && append network_data "bssid_blacklist=$bssid_blacklist" "$N$T"
517 [ -n "$bssid_whitelist" ] && append network_data "bssid_whitelist=$bssid_whitelist" "$N$T"
518
519+ local disable_eht
520+ local disable_he
521+ local disable_vht
522+ local disable_ht
523+ json_get_vars disable_eht
524+ json_get_vars disable_he
525+ json_get_vars disable_vht
526+ json_get_vars disable_ht
527+
528+ [ -n "$disable_eht" ] && append network_data "disable_eht=$disable_eht" "$N$T"
529+ [ -n "$disable_he" ] && append network_data "disable_he=$disable_he" "$N$T"
530+ [ -n "$disable_vht" ] && append network_data "disable_vht=$disable_vht" "$N$T"
531+ [ -n "$disable_ht" ] && append network_data "disable_ht=$disable_ht" "$N$T"
532+
533 [ -n "$basic_rate" ] && {
534 local br rate_list=
535 for br in $basic_rate; do
developer813f5d72023-03-28 17:44:38 +0800536@@ -1573,6 +1596,11 @@ wpa_supplicant_add_network() {
developer85839fe2023-02-23 10:32:51 +0800537 append network_data "mcast_rate=$mc_rate" "$N$T"
538 }
539
540+ if [ "$auth_type" = "sae" ]; then
541+ json_get_vars sae_pwe sae_pwe
542+ [ -n "$sae_pwe" ] && echo "sae_pwe=$sae_pwe" >> "$_config"
543+ fi
544+
545 if [ "$key_mgmt" = "WPS" ]; then
546 echo "wps_cred_processing=1" >> "$_config"
547 else