blob: 0314194c2d9db31bc7f92c01718b74a8fbbbb228 [file] [log] [blame]
developerce9e5092022-11-10 22:41:59 +08001diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile
developer5ad89862023-08-24 08:17:27 +08002index 8ecbe30..44af0c7 100644
developerce9e5092022-11-10 22:41:59 +08003--- a/package/kernel/mac80211/Makefile
4+++ b/package/kernel/mac80211/Makefile
developer5ad89862023-08-24 08:17:27 +08005@@ -19,6 +19,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 = \
developer5ad89862023-08-24 08:17:27 +080013@@ -71,6 +72,11 @@ 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 \
developer5ad89862023-08-24 08:17:27 +080021+ MAC80211_PS_DEBUG \
developer6ec8e342022-11-21 18:47:15 +080022
23 config-$(call config_package,cfg80211) += CFG80211
24 config-$(CONFIG_PACKAGE_CFG80211_TESTMODE) += NL80211_TESTMODE
developer5ad89862023-08-24 08:17:27 +080025@@ -296,6 +302,8 @@ define Build/Prepare
developer356ecec2022-11-14 10:25:04 +080026 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
developerda1bac72023-09-19 10:32:47 +080035index ed28052..13cde50 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
developer0ba09b62023-03-10 18:43:49 +080038@@ -27,6 +27,7 @@ drv_mac80211_init_device_config() {
39
40 config_add_string path phy 'macaddr:macaddr'
41 config_add_string tx_burst
developer61604c82023-09-04 14:43:31 +080042+ config_add_int mbssid mu_onoff sr_enable sr_enhanced rnr obss_interval
developer0ba09b62023-03-10 18:43:49 +080043 config_add_string distance
44 config_add_int beacon_int chanbw frag rts
45 config_add_int rxantenna txantenna antenna_gain txpower min_tx_power
developer785b6502023-04-19 18:31:11 +080046@@ -53,7 +54,10 @@ drv_mac80211_init_device_config() {
47 he_spr_sr_control \
48 he_spr_psr_enabled \
49 he_bss_color_enabled \
50- he_twt_required
51+ he_twt_required \
52+ he_twt_responder \
53+ etxbfen \
54+ itxbfen
55 config_add_int \
56 beamformer_antennas \
57 beamformee_antennas \
58@@ -140,13 +144,11 @@ mac80211_hostapd_setup_base() {
developer0ba09b62023-03-10 18:43:49 +080059 [ -n "$acs_exclude_dfs" ] && [ "$acs_exclude_dfs" -gt 0 ] &&
60 append base_cfg "acs_exclude_dfs=1" "$N"
61
62- json_get_vars noscan ht_coex min_tx_power:0 tx_burst
developer61604c82023-09-04 14:43:31 +080063+ json_get_vars noscan ht_coex min_tx_power:0 tx_burst mbssid mu_onoff rnr obss_interval
developer2c4f7e82023-05-11 19:56:55 +080064+ json_get_vars etxbfen:1 itxbfen:0
developer8d77be32022-10-20 15:08:25 +080065 json_get_values ht_capab_list ht_capab
developer20d67712022-03-02 14:09:32 +080066 json_get_values channel_list channels
67
68- [ "$auto_channel" = 0 ] && [ -z "$channel_list" ] && \
69- channel_list="$channel"
70-
developer9b3248d2022-07-06 00:44:05 +080071 [ "$min_tx_power" -gt 0 ] && append base_cfg "min_tx_power=$min_tx_power"
developer20d67712022-03-02 14:09:32 +080072
developer9b3248d2022-07-06 00:44:05 +080073 set_default noscan 0
developerda1bac72023-09-19 10:32:47 +080074@@ -160,21 +162,42 @@ mac80211_hostapd_setup_base() {
developer785b6502023-04-19 18:31:11 +080075 ieee80211n=1
76 ht_capab=
77 case "$htmode" in
78- VHT20|HT20|HE20) ;;
79- HT40*|VHT40|VHT80|VHT160|HE40|HE80|HE160)
80+ VHT20|HT20|HE20|EHT20) ;;
developerbe3cf972023-04-27 09:58:26 +080081+ HT40*|VHT40|VHT80|VHT160|HE40*|HE80|HE160|EHT40*|EHT80|EHT160|EHT320*)
developer785b6502023-04-19 18:31:11 +080082 case "$hwmode" in
83 a)
84 case "$(( (($channel / 4) + $chan_ofs) % 2 ))" in
developerda1bac72023-09-19 10:32:47 +080085 1) ht_capab="[HT40+]";;
86 0) ht_capab="[HT40-]";;
87 esac
88+ case "$htmode" in
89+ HT40-|HE40-|EHT40-)
90+ if [ "$auto_channel" -gt 0 ]; then
91+ ht_capab="[HT40-]"
92+ fi
93+ ;;
94+ esac
developerbe3cf972023-04-27 09:58:26 +080095 ;;
96 *)
97 case "$htmode" in
98- HT40+) ht_capab="[HT40+]";;
99- HT40-) ht_capab="[HT40-]";;
100+ HT40+|HE40+|EHT40+)
101+ if [ "$channel" -gt 9 ]; then
102+ echo "Could not set the center freq with this HT mode setting"
103+ return 1
104+ else
105+ ht_capab="[HT40+]"
106+ fi
107+ ;;
108+ HT40-|HE40-|EHT40-)
developerda1bac72023-09-19 10:32:47 +0800109+ if [ "$channel" -lt 5 -a "$auto_channel" -eq 0 ]; then
developerbe3cf972023-04-27 09:58:26 +0800110+ echo "Could not set the center freq with this HT mode setting"
111+ return 1
112+ else
113+ ht_capab="[HT40-]"
114+ fi
115+ ;;
116 *)
developerda1bac72023-09-19 10:32:47 +0800117- if [ "$channel" -lt 7 ]; then
118+ if [ "$channel" -lt 7 -o "$auto_channel" -gt 0 ]; then
developerbe3cf972023-04-27 09:58:26 +0800119 ht_capab="[HT40+]"
developerda1bac72023-09-19 10:32:47 +0800120 else
121 ht_capab="[HT40-]"
122@@ -183,7 +206,6 @@ mac80211_hostapd_setup_base() {
123 esac
124 ;;
125 esac
126- [ "$auto_channel" -gt 0 ] && ht_capab="[HT40+]"
127 ;;
128 *) ieee80211n= ;;
129 esac
130@@ -193,6 +215,10 @@ mac80211_hostapd_setup_base() {
developer61604c82023-09-04 14:43:31 +0800131
132 set_default ht_coex 0
133 append base_cfg "ht_coex=$ht_coex" "$N"
134+ [ "$ht_coex" -eq 1 ] && {
135+ set_default obss_interval 300
136+ append base_cfg "obss_interval=$obss_interval" "$N"
137+ }
138
139 json_get_vars \
140 ldpc:1 \
developerda1bac72023-09-19 10:32:47 +0800141@@ -205,7 +231,7 @@ mac80211_hostapd_setup_base() {
developer785b6502023-04-19 18:31:11 +0800142 dsss_cck_40:1
143
144 ht_cap_mask=0
145- for cap in $(iw phy "$phy" info | grep 'Capabilities:' | cut -d: -f2); do
146+ for cap in $(iw phy "$phy" info | grep 'Capabilities: 0x' | cut -d: -f2); do
147 ht_cap_mask="$(($ht_cap_mask | $cap))"
148 done
149
developerda1bac72023-09-19 10:32:47 +0800150@@ -236,8 +262,8 @@ mac80211_hostapd_setup_base() {
developer785b6502023-04-19 18:31:11 +0800151
152 idx="$channel"
153 case "$htmode" in
154- VHT20|HE20) enable_ac=1;;
155- VHT40|HE40)
156+ VHT20|HE20|EHT20) enable_ac=1;;
157+ VHT40|HE40|EHT40)
158 case "$(( (($channel / 4) + $chan_ofs) % 2 ))" in
159 1) idx=$(($channel + 2));;
160 0) idx=$(($channel - 2));;
developerda1bac72023-09-19 10:32:47 +0800161@@ -245,7 +271,7 @@ mac80211_hostapd_setup_base() {
developer785b6502023-04-19 18:31:11 +0800162 enable_ac=1
163 vht_center_seg0=$idx
164 ;;
165- VHT80|HE80)
166+ VHT80|HE80|EHT80)
167 case "$(( (($channel / 4) + $chan_ofs) % 4 ))" in
168 1) idx=$(($channel + 6));;
169 2) idx=$(($channel + 2));;
developerda1bac72023-09-19 10:32:47 +0800170@@ -256,7 +282,7 @@ mac80211_hostapd_setup_base() {
developer785b6502023-04-19 18:31:11 +0800171 vht_oper_chwidth=1
172 vht_center_seg0=$idx
173 ;;
174- VHT160|HE160)
175+ VHT160|HE160|EHT160)
176 if [ "$band" = "6g" ]; then
177 case "$channel" in
178 1|5|9|13|17|21|25|29) idx=15;;
developerda1bac72023-09-19 10:32:47 +0800179@@ -271,12 +297,43 @@ mac80211_hostapd_setup_base() {
developeradd8de62023-05-02 16:25:52 +0800180 case "$channel" in
181 36|40|44|48|52|56|60|64) idx=50;;
182 100|104|108|112|116|120|124|128) idx=114;;
183+ 149|153|157|161|165|169|173|177) idx=163;;
184 esac
185 fi
186 enable_ac=1
developer785b6502023-04-19 18:31:11 +0800187 vht_oper_chwidth=2
188 vht_center_seg0=$idx
189 ;;
190+ EHT320*)
191+ case "$channel" in
192+ 1|5|9|13|17|21|25|29) idx=31;;
193+ 33|37|41|45|49|53|57|61| \
194+ 65|69|73|77|81|85|89|93) idx=63;;
195+ 97|101|105|109|113|117|121|125| \
196+ 129|133|137|141|145|149|153|157) idx=127;;
197+ 161|165|169|173|177|181|185|189| \
198+ 193|197|201|205|209|213|217|221) idx=191;;
199+ esac
200+ if [[ "$htmode" = "EHT320-1" && "$channel" -ge "193" ]] ||
201+ [[ "$htmode" = "EHT320-2" && "$channel" -le "29" ]]; then
202+ echo "Could not set the center freq with this EHT setting"
203+ return 1
204+ elif [[ "$htmode" = "EHT320-1" && "$channel" -ge "33" ]]; then
205+ if [ "$channel" -gt $idx ]; then
206+ idx=$(($idx + 32))
207+ else
208+ idx=$(($idx - 32))
209+ fi
210+ fi
211+ vht_oper_chwidth=2
212+ if [ "$channel" -gt $idx ]; then
213+ vht_center_seg0=$(($idx + 16))
214+ else
215+ vht_center_seg0=$(($idx - 16))
216+ fi
217+ eht_oper_chwidth=9
218+ eht_oper_centr_freq_seg0_idx=$idx
219+ ;;
220 esac
221 [ "$band" = "5g" ] && {
222 json_get_vars background_radar:0
developerda1bac72023-09-19 10:32:47 +0800223@@ -286,8 +343,9 @@ mac80211_hostapd_setup_base() {
developer785b6502023-04-19 18:31:11 +0800224 [ "$band" = "6g" ] && {
225 op_class=
226 case "$htmode" in
227- HE20) op_class=131;;
228- HE*) op_class=$((132 + $vht_oper_chwidth))
229+ HE20|EHT20) op_class=131;;
230+ EHT320*) op_class=137;;
231+ HE*|EHT*) op_class=$((132 + $vht_oper_chwidth))
232 esac
233 [ -n "$op_class" ] && append base_cfg "op_class=$op_class" "$N"
234 }
developerda1bac72023-09-19 10:32:47 +0800235@@ -315,7 +373,6 @@ mac80211_hostapd_setup_base() {
developer8b04dfd2022-12-07 16:29:19 +0800236 vht_link_adapt:3 \
237 vht160:2
238
239- set_default tx_burst 2.0
240 append base_cfg "ieee80211ac=1" "$N"
241 vht_cap=0
242 for cap in $(iw phy "$phy" info | awk -F "[()]" '/VHT Capabilities/ { print $2 }'); do
developerda1bac72023-09-19 10:32:47 +0800243@@ -329,6 +386,12 @@ mac80211_hostapd_setup_base() {
developer785b6502023-04-19 18:31:11 +0800244 [ "$rx_stbc" -lt "$cap_rx_stbc" ] && cap_rx_stbc="$rx_stbc"
245 vht_cap="$(( ($vht_cap & ~(0x700)) | ($cap_rx_stbc << 8) ))"
246
247+ [ "$etxbfen" -eq 0 ] && {
248+ su_beamformer=0
249+ su_beamformee=0
250+ mu_beamformer=0
251+ }
252+
253 mac80211_add_capabilities vht_capab $vht_cap \
254 RXLDPC:0x10::$rxldpc \
255 SHORT-GI-80:0x20::$short_gi_80 \
developerda1bac72023-09-19 10:32:47 +0800256@@ -410,7 +473,7 @@ mac80211_hostapd_setup_base() {
developer785b6502023-04-19 18:31:11 +0800257 # 802.11ax
258 enable_ax=0
259 case "$htmode" in
260- HE*) enable_ax=1 ;;
261+ HE*|EHT*) enable_ax=1 ;;
262 esac
263
264 if [ "$enable_ax" != "0" ]; then
developerda1bac72023-09-19 10:32:47 +0800265@@ -419,10 +482,11 @@ mac80211_hostapd_setup_base() {
developer785b6502023-04-19 18:31:11 +0800266 he_su_beamformee:1 \
267 he_mu_beamformer:1 \
268 he_twt_required:0 \
269+ he_twt_responder \
270 he_spr_sr_control:3 \
271 he_spr_psr_enabled:0 \
272 he_spr_non_srg_obss_pd_max_offset:0 \
273- he_bss_color:128 \
274+ he_bss_color \
275 he_bss_color_enabled:1
276
277 he_phy_cap=$(iw phy "$phy" info | sed -n '/HE Iftypes: AP/,$p' | awk -F "[()]" '/HE PHY Capabilities/ { print $2 }' | head -1)
developerda1bac72023-09-19 10:32:47 +0800278@@ -436,6 +500,11 @@ mac80211_hostapd_setup_base() {
developer785b6502023-04-19 18:31:11 +0800279 append base_cfg "he_oper_centr_freq_seg0_idx=$vht_center_seg0" "$N"
280 }
281
282+ [ "$etxbfen" -eq 0 ] && {
283+ he_su_beamformer=0
284+ he_mu_beamformer=0
285+ }
286+
287 mac80211_add_he_capabilities \
288 he_su_beamformer:${he_phy_cap:6:2}:0x80:$he_su_beamformer \
289 he_su_beamformee:${he_phy_cap:8:2}:0x1:$he_su_beamformee \
developerda1bac72023-09-19 10:32:47 +0800290@@ -443,7 +512,14 @@ mac80211_hostapd_setup_base() {
developer785b6502023-04-19 18:31:11 +0800291 he_spr_psr_enabled:${he_phy_cap:14:2}:0x1:$he_spr_psr_enabled \
292 he_twt_required:${he_mac_cap:0:2}:0x6:$he_twt_required
293
294+ if [ -n "$he_twt_responder" ]; then
295+ append base_cfg "he_twt_responder=$he_twt_responder" "$N"
296+ fi
297 if [ "$he_bss_color_enabled" -gt 0 ]; then
developer830efa72023-05-18 19:32:48 +0800298+ if !([ "$he_bss_color" -gt 0 ] && [ "$he_bss_color" -le 64 ]); then
developer785b6502023-04-19 18:31:11 +0800299+ rand=$(head -n 1 /dev/urandom | tr -dc 0-9 | head -c 2)
300+ he_bss_color=$((rand % 63 + 1))
301+ fi
302 append base_cfg "he_bss_color=$he_bss_color" "$N"
303 [ "$he_spr_non_srg_obss_pd_max_offset" -gt 0 ] && { \
304 append base_cfg "he_spr_non_srg_obss_pd_max_offset=$he_spr_non_srg_obss_pd_max_offset" "$N"
developerda1bac72023-09-19 10:32:47 +0800305@@ -484,12 +560,47 @@ mac80211_hostapd_setup_base() {
developer8b04dfd2022-12-07 16:29:19 +0800306 append base_cfg "he_mu_edca_ac_vo_timer=255" "$N"
307 fi
308
developer18015ad2023-07-13 13:18:19 +0800309+ set_default tx_burst 2
developer8b04dfd2022-12-07 16:29:19 +0800310+
developer785b6502023-04-19 18:31:11 +0800311+ # 802.11be
312+ enable_be=0
313+ case "$htmode" in
314+ EHT*) enable_be=1 ;;
315+ esac
316+
317+ if [ "$enable_be" != "0" ]; then
318+ append base_cfg "ieee80211be=1" "$N"
319+ if [ "$etxbfen" -eq 0 ]; then
320+ append base_cfg "eht_su_beamformee=1" "$N"
321+ else
322+ append base_cfg "eht_su_beamformer=1" "$N"
323+ append base_cfg "eht_su_beamformee=1" "$N"
324+ append base_cfg "eht_mu_beamformer=1" "$N"
325+ fi
326+ [ "$hwmode" = "a" ] && {
327+ case $htmode in
328+ EHT320*)
329+ append base_cfg "eht_oper_chwidth=$eht_oper_chwidth" "$N"
330+ append base_cfg "eht_oper_centr_freq_seg0_idx=$eht_oper_centr_freq_seg0_idx" "$N"
331+ ;;
332+ *)
333+ append base_cfg "eht_oper_chwidth=$vht_oper_chwidth" "$N"
334+ append base_cfg "eht_oper_centr_freq_seg0_idx=$vht_center_seg0" "$N"
335+ ;;
336+ esac
337+ }
338+ fi
339+
developer8b04dfd2022-12-07 16:29:19 +0800340 hostapd_prepare_device_config "$hostapd_conf_file" nl80211
341 cat >> "$hostapd_conf_file" <<EOF
342 ${channel:+channel=$channel}
developer0ba09b62023-03-10 18:43:49 +0800343 ${channel_list:+chanlist=$channel_list}
344 ${hostapd_noscan:+noscan=1}
345 ${tx_burst:+tx_queue_data2_burst=$tx_burst}
346+${mbssid:+mbssid=$mbssid}
developer785b6502023-04-19 18:31:11 +0800347+${mu_onoff:+mu_onoff=$mu_onoff}
348+${itxbfen:+ibf_enable=$itxbfen}
developer2c6592a2023-07-21 11:20:56 +0800349+${rnr:+rnr=$rnr}
developer0ba09b62023-03-10 18:43:49 +0800350 $base_cfg
351
352 EOF
developerda1bac72023-09-19 10:32:47 +0800353@@ -517,7 +628,7 @@ mac80211_hostapd_setup_bss() {
developer093e1a32023-02-24 16:10:53 +0800354 append hostapd_cfg "wds_sta=1" "$N"
355 [ -n "$wds_bridge" ] && append hostapd_cfg "wds_bridge=$wds_bridge" "$N"
356 }
357- [ "$staidx" -gt 0 -o "$start_disabled" -eq 1 ] && append hostapd_cfg "start_disabled=1" "$N"
358+ [ "$start_disabled" -eq 1 ] && append hostapd_cfg "start_disabled=1" "$N"
359
360 cat >> /var/run/hostapd-$phy.conf <<EOF
361 $hostapd_cfg
developerda1bac72023-09-19 10:32:47 +0800362@@ -527,6 +638,31 @@ ${max_listen_int:+max_listen_interval=$max_listen_int}
developer0ba09b62023-03-10 18:43:49 +0800363 EOF
364 }
365
366+mac80211_generate_mbssid_mac() {
367+ local phy="$1"
368+ local transmitted_bssid="$2"
developer1952bcd2023-06-20 20:14:37 +0800369+ local id="${mbssidx:-0}"
developer0ba09b62023-03-10 18:43:49 +0800370+
371+ local ref="$(cat /sys/class/ieee80211/${phy}/macaddress)"
developer0ba09b62023-03-10 18:43:49 +0800372+
373+ if [ -z "$transmitted_bssid" ]; then
374+ transmitted_bssid=$ref
375+ fi
376+
377+ if [ $id -eq 0 ]; then
378+ echo "$transmitted_bssid"
379+ return
380+ fi
381+
382+ local oIFS="$IFS"; IFS=":"; set -- $transmitted_bssid; IFS="$oIFS"
383+
384+ # Calculate nontransmitted bssid
developer0ba09b62023-03-10 18:43:49 +0800385+ b6="0x$6"
386+ ref_b6=$(($b6 % $max_mbssid))
developer1952bcd2023-06-20 20:14:37 +0800387+ b6=$(($b6 - $ref_b6 + ($ref_b6 + $id) % $max_mbssid))
developer0ba09b62023-03-10 18:43:49 +0800388+ printf "%s:%s:%s:%s:%s:%02x" $1 $2 $3 $4 $5 $b6
389+}
390+
391 mac80211_get_addr() {
392 local phy="$1"
393 local idx="$(($2 + 1))"
developerda1bac72023-09-19 10:32:47 +0800394@@ -757,7 +893,19 @@ mac80211_prepare_vif() {
developer0ba09b62023-03-10 18:43:49 +0800395
396 json_select ..
397
398- if [ -z "$macaddr" ]; then
developerd2fbd572023-06-19 19:48:25 +0800399+ if [ "$mbssid" -gt 0 ] && [ "$mode" == "ap" ]; then
developer1952bcd2023-06-20 20:14:37 +0800400+ [ "$mbssidx" -eq 0 ] && {
401+ if [ -z $macaddr ]; then
402+ transmitted_bssid="$(mac80211_generate_mac $phy)"
403+ else
404+ # uci set mac address
405+ transmitted_bssid=$macaddr
406+ fi
407+ macidx="$(($macidx + 1))"
developer0ba09b62023-03-10 18:43:49 +0800408+ }
409+ macaddr="$(mac80211_generate_mbssid_mac $phy $transmitted_bssid)"
developer1952bcd2023-06-20 20:14:37 +0800410+ mbssidx="$(($mbssidx + 1))"
developer0ba09b62023-03-10 18:43:49 +0800411+ elif [ -z "$macaddr" ]; then
412 macaddr="$(mac80211_generate_mac $phy)"
413 macidx="$(($macidx + 1))"
414 elif [ "$macaddr" = 'random' ]; then
developerda1bac72023-09-19 10:32:47 +0800415@@ -1058,6 +1206,9 @@ mac80211_setup_vif() {
developerf0de14b2022-12-14 23:07:34 +0800416
417 json_select ..
418 [ -n "$failed" ] || wireless_add_vif "$name" "$ifname"
419+
420+ echo "Setup SMP Affinity"
421+ /sbin/smp-mt76.sh
422 }
423
424 get_freq() {
developerda1bac72023-09-19 10:32:47 +0800425@@ -1122,6 +1273,10 @@ drv_mac80211_cleanup() {
developer0ba09b62023-03-10 18:43:49 +0800426 hostapd_common_cleanup
427 }
428
429+mac80211_count_ap() {
430+ total_num_ap=$(($total_num_ap + 1))
431+}
432+
433 drv_mac80211_setup() {
434 json_select config
435 json_get_vars \
developerda1bac72023-09-19 10:32:47 +0800436@@ -1129,7 +1284,8 @@ drv_mac80211_setup() {
developer74503112023-06-29 17:34:49 +0800437 country chanbw distance \
438 txpower antenna_gain \
439 rxantenna txantenna \
440- frag rts beacon_int:100 htmode
441+ frag rts beacon_int:100 htmode \
442+ sr_enable sr_enhanced
443 json_get_values basic_rate_list basic_rate
444 json_get_values scan_list scan_list
445 json_select ..
developerda1bac72023-09-19 10:32:47 +0800446@@ -1180,6 +1336,7 @@ drv_mac80211_setup() {
developer1952bcd2023-06-20 20:14:37 +0800447 no_ap=1
448 macidx=0
449 staidx=0
450+ mbssidx=0
451
452 [ -n "$chanbw" ] && {
453 for file in /sys/kernel/debug/ieee80211/$phy/ath9k*/chanbw /sys/kernel/debug/ieee80211/$phy/ath5k/bwmode; do
developerda1bac72023-09-19 10:32:47 +0800454@@ -1219,6 +1376,16 @@ drv_mac80211_setup() {
developer0ba09b62023-03-10 18:43:49 +0800455 for_each_interface "sta adhoc mesh" mac80211_set_noscan
456 [ -n "$has_ap" ] && mac80211_hostapd_setup_base "$phy"
457
458+ total_num_ap=0
459+ max_mbssid=1
460+ for_each_interface "ap" mac80211_count_ap
461+ total_num_ap=$(($total_num_ap - 1))
462+ while [ $total_num_ap -gt 0 ]
463+ do
464+ total_num_ap=$(($total_num_ap >> 1))
465+ max_mbssid=$(($max_mbssid << 1))
466+ done
467+
468 mac80211_prepare_iw_htmode
469 for_each_interface "sta adhoc mesh monitor" mac80211_prepare_vif
470 NEWAPLIST=
developerda1bac72023-09-19 10:32:47 +0800471@@ -1251,6 +1418,14 @@ drv_mac80211_setup() {
developerad1f3172023-05-02 11:10:08 +0800472 if [ "$no_reload" != "0" ]; then
473 add_ap=1
474 ubus wait_for hostapd
475+
476+ # each phy sleeps different times to prevent for ubus race condition.
477+ if [ "$phy" = "phy1" ]; then
478+ sleep 1;
479+ elif [ "$phy" = "phy2" ]; then
480+ sleep 2;
481+ fi
482+
483 local hostapd_res="$(ubus call hostapd config_add "{\"iface\":\"$primary_ap\", \"config\":\"${hostapd_conf_file}\"}")"
484 ret="$?"
485 [ "$ret" != 0 -o -z "$hostapd_res" ] && {
developerda1bac72023-09-19 10:32:47 +0800486@@ -1266,6 +1441,9 @@ drv_mac80211_setup() {
developer74503112023-06-29 17:34:49 +0800487 [ "${add_ap}" = 1 ] && sleep 1
488 for_each_interface "ap" mac80211_setup_vif
489
490+ [ -n "$sr_enable" ] && echo "$sr_enable" > /sys/kernel/debug/ieee80211/$phy/mt76/sr_enable
491+ [ -n "$sr_enhanced" ] && echo "$sr_enhanced" > /sys/kernel/debug/ieee80211/$phy/mt76/sr_enhanced_enable
492+
493 NEWSPLIST=
494 NEWUMLIST=
495
developer9b3248d2022-07-06 00:44:05 +0800496diff --git a/package/kernel/mac80211/files/lib/wifi/mac80211.sh b/package/kernel/mac80211/files/lib/wifi/mac80211.sh
developerf7aff422023-11-14 11:11:34 +0800497index 3ecd932..e8c7743 100644
developere2597ba2022-06-24 13:09:16 +0800498--- a/package/kernel/mac80211/files/lib/wifi/mac80211.sh
499+++ b/package/kernel/mac80211/files/lib/wifi/mac80211.sh
developer20ce7bd2023-05-20 13:25:14 +0800500@@ -60,6 +60,9 @@ BEGIN {
developer785b6502023-04-19 18:31:11 +0800501 if (vht && band != "1:") mode="VHT80"
502 if (he) mode="HE80"
503 if (he && band == "1:") mode="HE20"
developer20ce7bd2023-05-20 13:25:14 +0800504+ if (eht && band == "2:") mode="EHT160"
505+ if (eht && band == "4:") mode="EHT320"
developer785b6502023-04-19 18:31:11 +0800506+ if (eht && band == "1:") mode="EHT20"
507 sub("\\[", "", channel)
508 sub("\\]", "", channel)
509 bands = bands band channel ":" mode " "
developer20ce7bd2023-05-20 13:25:14 +0800510@@ -73,6 +76,7 @@ $1 == "Band" {
developer785b6502023-04-19 18:31:11 +0800511 vht = ""
512 ht = ""
513 he = ""
514+ eht = ""
515 }
516
517 $0 ~ "Capabilities:" {
developer20ce7bd2023-05-20 13:25:14 +0800518@@ -87,6 +91,18 @@ $0 ~ "HE Iftypes" {
developer785b6502023-04-19 18:31:11 +0800519 he=1
520 }
521
522+$0 ~ "EHT Iftypes" {
523+ eht=1
524+}
525+
developer20ce7bd2023-05-20 13:25:14 +0800526+$0 ~ / *HE MAC Capabilities \(0x000000000000\)/ {
527+ he=0
528+}
529+
530+$0 ~ / *EHT MAC Capabilities \(0x0000\)/ {
531+ eht=0
532+}
533+
developer785b6502023-04-19 18:31:11 +0800534 $1 == "*" && $3 == "MHz" && $0 !~ /disabled/ && band && !channel {
535 channel = $4
536 }
developerf7aff422023-11-14 11:11:34 +0800537@@ -120,6 +136,20 @@ get_band_defaults() {
developere2597ba2022-06-24 13:09:16 +0800538 mode_band="$band"
539 channel="$chan"
540 htmode="$mode"
541+ if [ "$band" = "6g" ]
542+ then
543+ encryption=sae
544+ key=12345678
developer20ce7bd2023-05-20 13:25:14 +0800545+ sae_pwe=2
546+ ieee80211w=2
developeradbb45b2023-06-09 14:43:01 +0800547+ channel=37
548+ mbssid=1
developerf7aff422023-11-14 11:11:34 +0800549+ mbo=1
developere2597ba2022-06-24 13:09:16 +0800550+ else
developer659b07e2023-05-25 12:34:13 +0800551+ noscan=1
developere2597ba2022-06-24 13:09:16 +0800552+ encryption=none
developer2c6592a2023-07-21 11:20:56 +0800553+ rnr=1
developere2597ba2022-06-24 13:09:16 +0800554+ fi
555 done
556 }
557
developerf7aff422023-11-14 11:11:34 +0800558@@ -153,6 +183,10 @@ detect_mac80211() {
developer785b6502023-04-19 18:31:11 +0800559
560 json_load_file /etc/board.json
561
562+ # generate random bytes for macaddr
563+ rand=$(hexdump -C /dev/urandom | head -n 1 &)
564+ killall hexdump
565+
566 for _dev in /sys/class/ieee80211/*; do
567 [ -e "$_dev" ] || continue
568
developerf7aff422023-11-14 11:11:34 +0800569@@ -162,6 +196,13 @@ detect_mac80211() {
developere2597ba2022-06-24 13:09:16 +0800570 channel=""
571 htmode=""
572 ht_capab=""
573+ encryption=""
developer659b07e2023-05-25 12:34:13 +0800574+ noscan=""
developere2597ba2022-06-24 13:09:16 +0800575+ key=""
developer09257932023-05-09 13:41:30 +0800576+ sae_pwe=""
developer20ce7bd2023-05-20 13:25:14 +0800577+ ieee80211w=""
developeradbb45b2023-06-09 14:43:01 +0800578+ mbssid=""
developer2c6592a2023-07-21 11:20:56 +0800579+ rnr=""
developere2597ba2022-06-24 13:09:16 +0800580
581 get_band_defaults "$dev"
582
developerf7aff422023-11-14 11:11:34 +0800583@@ -192,6 +233,14 @@ detect_mac80211() {
developer785b6502023-04-19 18:31:11 +0800584 ;;
585 esac
586
developer212c0d82023-07-13 19:41:47 +0800587+ macaddr=""
developer1325ba72023-06-26 13:43:31 +0800588+ if (dmesg | grep -q "eeprom load fail"); then
developer1952bcd2023-06-20 20:14:37 +0800589+ for i in $(seq 2 3); do
590+ macaddr=${macaddr}:$(echo $rand | cut -d ' ' -f $i)
591+ done
592+ macaddr="00:0$(($devidx - 1)):55:66${macaddr}"
developer1952bcd2023-06-20 20:14:37 +0800593+ fi
developer785b6502023-04-19 18:31:11 +0800594+
595 uci -q batch <<-EOF
596 set wireless.${name}=wifi-device
597 set wireless.${name}.type=mac80211
developerf7aff422023-11-14 11:11:34 +0800598@@ -199,15 +248,43 @@ detect_mac80211() {
developer09257932023-05-09 13:41:30 +0800599 set wireless.${name}.channel=${channel}
600 set wireless.${name}.band=${mode_band}
601 set wireless.${name}.htmode=$htmode
602- set wireless.${name}.disabled=1
developer20ce7bd2023-05-20 13:25:14 +0800603+ set wireless.${name}.country='US'
developer659b07e2023-05-25 12:34:13 +0800604+ set wireless.${name}.noscan=${noscan}
developer09257932023-05-09 13:41:30 +0800605+ set wireless.${name}.disabled=0
developeradbb45b2023-06-09 14:43:01 +0800606+EOF
607+ [ -n "$mbssid" ] && {
608+ uci -q set wireless.${name}.mbssid=${mbssid}
609+ }
developer2c6592a2023-07-21 11:20:56 +0800610+ [ -n "$rnr" ] && {
611+ uci -q set wireless.${name}.rnr=${rnr}
612+ }
developer09257932023-05-09 13:41:30 +0800613
developeradbb45b2023-06-09 14:43:01 +0800614+ uci -q batch <<-EOF
developer09257932023-05-09 13:41:30 +0800615 set wireless.default_${name}=wifi-iface
616 set wireless.default_${name}.device=${name}
developer8d77be32022-10-20 15:08:25 +0800617 set wireless.default_${name}.network=lan
618 set wireless.default_${name}.mode=ap
developer09257932023-05-09 13:41:30 +0800619- set wireless.default_${name}.ssid=OpenWrt
developer8d77be32022-10-20 15:08:25 +0800620- set wireless.default_${name}.encryption=none
developer09257932023-05-09 13:41:30 +0800621+ set wireless.default_${name}.ssid=OpenWrt-${mode_band}
developer8d77be32022-10-20 15:08:25 +0800622+ set wireless.default_${name}.encryption=${encryption}
developere2597ba2022-06-24 13:09:16 +0800623 EOF
developer212c0d82023-07-13 19:41:47 +0800624+
625+ # calibrated board will use eeprom macaddress, not ramdom address
626+ [ -n "$macaddr" ] && {
627+ uci -q set wireless.default_${name}.macaddr=${macaddr}
628+ }
629+
developere2597ba2022-06-24 13:09:16 +0800630+ [ -n "$key" ] && {
developer8d77be32022-10-20 15:08:25 +0800631+ uci -q set wireless.default_${name}.key=${key}
developere2597ba2022-06-24 13:09:16 +0800632+ }
developer09257932023-05-09 13:41:30 +0800633+ [ -n "$sae_pwe" ] && {
634+ uci -q set wireless.default_${name}.sae_pwe=${sae_pwe}
635+ }
developer20ce7bd2023-05-20 13:25:14 +0800636+ [ -n "$ieee80211w" ] && {
637+ uci -q set wireless.default_${name}.ieee80211w=${ieee80211w}
638+ }
developerf7aff422023-11-14 11:11:34 +0800639+ [ -n "$mbo" ] && {
640+ uci -q set wireless.default_${name}.mbo=${mbo}
641+ }
developere2597ba2022-06-24 13:09:16 +0800642 uci -q commit wireless
developer8d77be32022-10-20 15:08:25 +0800643 done
644 }
developer85839fe2023-02-23 10:32:51 +0800645diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh
developer945ed992023-10-25 15:01:32 +0800646index 28bd210..3bdf3c0 100644
developer85839fe2023-02-23 10:32:51 +0800647--- a/package/network/services/hostapd/files/hostapd.sh
648+++ b/package/network/services/hostapd/files/hostapd.sh
developer74503112023-06-29 17:34:49 +0800649@@ -60,7 +60,14 @@ hostapd_append_wpa_key_mgmt() {
650 [ "${ieee80211w:-0}" -gt 0 ] && append wpa_key_mgmt "WPA-EAP-SHA256"
651 ;;
652 sae)
653- append wpa_key_mgmt "SAE"
654+ case "$encryption" in
655+ *sae-ext*)
656+ append wpa_key_mgmt "SAE-EXT-KEY"
657+ ;;
658+ *)
659+ append wpa_key_mgmt "SAE"
660+ ;;
661+ esac
662 [ "${ieee80211r:-0}" -gt 0 ] && append wpa_key_mgmt "FT-SAE"
663 ;;
664 psk-sae)
665@@ -115,6 +122,7 @@ hostapd_common_add_device_config() {
666 config_add_int rts_threshold
667 config_add_int rssi_reject_assoc_rssi
668 config_add_int rssi_ignore_probe_request
669+ config_add_int rssi_reject_assoc_timeout
670 config_add_int maxassoc
671
672 config_add_string acs_chan_bias
developer5ad89862023-08-24 08:17:27 +0800673@@ -225,8 +233,10 @@ hostapd_prepare_device_config() {
developer74503112023-06-29 17:34:49 +0800674 hostapd_add_rate brlist "$br"
675 done
676
677+ json_get_vars rssi_reject_assoc_timeout
678 [ -n "$rssi_reject_assoc_rssi" ] && append base_cfg "rssi_reject_assoc_rssi=$rssi_reject_assoc_rssi" "$N"
679 [ -n "$rssi_ignore_probe_request" ] && append base_cfg "rssi_ignore_probe_request=$rssi_ignore_probe_request" "$N"
680+ [ -n "$rssi_reject_assoc_timeout" ] && append base_cfg "rssi_reject_assoc_timeout=$rssi_reject_assoc_timeout" "$N"
681 [ -n "$beacon_rate" ] && append base_cfg "beacon_rate=$beacon_rate" "$N"
682 [ -n "$rlist" ] && append base_cfg "supported_rates=$rlist" "$N"
683 [ -n "$brlist" ] && append base_cfg "basic_rates=$brlist" "$N"
developer5ad89862023-08-24 08:17:27 +0800684@@ -376,6 +386,24 @@ hostapd_common_add_bss_config() {
developer82408892023-03-27 15:09:00 +0800685 config_add_string fils_dhcp
686
687 config_add_int ocv
688+
689+ config_add_int disable_eht
690+ config_add_int disable_he
691+ config_add_int disable_vht
692+ config_add_int disable_ht
developer813f5d72023-03-28 17:44:38 +0800693+
developerf166f542023-05-25 14:40:30 +0800694+ config_add_boolean beacon_prot interworking
developer74503112023-06-29 17:34:49 +0800695+
696+ config_add_int unsol_bcast_probe_resp_interval
697+ config_add_int fils_discovery_min_interval
698+ config_add_int fils_discovery_max_interval
699+ config_add_boolean rnr
700+
701+ config_add_array sae_groups
702+ config_add_array owe_groups
703+ config_add_array pairwise
704+ config_add_string group_cipher
705+
developer82408892023-03-27 15:09:00 +0800706 }
707
708 hostapd_set_vlan_file() {
developer5ad89862023-08-24 08:17:27 +0800709@@ -440,11 +468,11 @@ append_iw_nai_realm() {
developerf166f542023-05-25 14:40:30 +0800710 }
711
712 append_iw_venue_name() {
713- append bss_conf "venue_name=$1" "$N"
714+ [ -n "$1" ] && append bss_conf "venue_name=$1" "$N"
715 }
716
717 append_iw_venue_url() {
718- append bss_conf "venue_url=$1" "$N"
719+ [ -n "$1" ] && append bss_conf "venue_url=$1" "$N"
720 }
721
722 append_hs20_oper_friendly_name() {
developer5ad89862023-08-24 08:17:27 +0800723@@ -562,7 +590,8 @@ hostapd_set_bss_options() {
developer74503112023-06-29 17:34:49 +0800724 ppsk airtime_bss_weight airtime_bss_limit airtime_sta_weight \
725 multicast_to_unicast_all proxy_arp per_sta_vif \
726 eap_server eap_user_file ca_cert server_cert private_key private_key_passwd server_id \
727- vendor_elements fils ocv
728+ vendor_elements fils ocv unsol_bcast_probe_resp_interval fils_discovery_min_interval \
729+ fils_discovery_max_interval rnr group_cipher
730
731 set_default fils 0
732 set_default isolate 0
developer945ed992023-10-25 15:01:32 +0800733@@ -790,6 +819,36 @@ hostapd_set_bss_options() {
developer74503112023-06-29 17:34:49 +0800734 local auth_algs="$((($auth_mode_shared << 1) | $auth_mode_open))"
735 append bss_conf "auth_algs=${auth_algs:-1}" "$N"
736 append bss_conf "wpa=$wpa" "$N"
737+
738+ json_get_values pairwise pairwise
developer945ed992023-10-25 15:01:32 +0800739+ json_get_vars group_cipher
developer9097e5e2023-07-19 10:22:24 +0800740+ if [ -n "$pairwise" ]; then
741+ case "$pairwise" in
742+ *tkip+aes|*tkip+ccmp|*aes+tkip|*ccmp+tkip)
743+ wpa_cipher="CCMP TKIP"
744+ ;;
745+ *ccmp256)
746+ wpa_cipher="CCMP-256"
747+ ;;
748+ *aes|*ccmp)
749+ wpa_cipher="CCMP"
750+ ;;
751+ *tkip)
752+ wpa_cipher="TKIP"
753+ ;;
754+ *gcmp256)
755+ wpa_cipher="GCMP-256"
756+ ;;
757+ *gcmp)
758+ wpa_cipher="GCMP"
759+ ;;
760+ *)
761+ wpa_cipher=""
762+ ;;
763+ esac
764+ fi
developer74503112023-06-29 17:34:49 +0800765+ [ -n "$wpa_cipher" ] && wpa_pairwise="$wpa_cipher"
766+
767 [ -n "$wpa_pairwise" ] && append bss_conf "wpa_pairwise=$wpa_pairwise" "$N"
768
769 set_default wps_pushbutton 0
developer945ed992023-10-25 15:01:32 +0800770@@ -841,7 +900,7 @@ hostapd_set_bss_options() {
developerda723192023-05-22 19:46:10 +0800771 }
772
773 append bss_conf "ssid=$ssid" "$N"
774- [ -n "$network_bridge" ] && append bss_conf "bridge=$network_bridge${N}wds_bridge=" "$N"
775+ [ -n "$network_bridge" ] && append bss_conf "bridge=$network_bridge${N}wds_bridge=$network_bridge" "$N"
776 [ -n "$network_ifname" ] && append bss_conf "snoop_iface=$network_ifname" "$N"
777 [ -n "$iapp_interface" ] && {
778 local ifname
developer945ed992023-10-25 15:01:32 +0800779@@ -954,6 +1013,8 @@ hostapd_set_bss_options() {
developer74503112023-06-29 17:34:49 +0800780 fi
781
782 if [ "$wpa" -ge "2" ]; then
783+ json_get_values sae_groups sae_groups
784+ json_get_values owe_groups owe_groups
785 if [ -n "$network_bridge" -a "$rsn_preauth" = 1 ]; then
786 set_default auth_cache 1
787 append bss_conf "rsn_preauth=1" "$N"
developer945ed992023-10-25 15:01:32 +0800788@@ -972,17 +1033,42 @@ hostapd_set_bss_options() {
developer74503112023-06-29 17:34:49 +0800789 append bss_conf "okc=$auth_cache" "$N"
790 [ "$auth_cache" = 0 -a "$fils" = 0 ] && append bss_conf "disable_pmksa_caching=1" "$N"
791
792+ [ -z "$group_cipher" ] && group_cipher="$wpa_cipher"
793+
794+ if [ -n "$sae_groups" -o -n "$owe_groups" ]; then
795+ case "$auth_type" in
796+ sae*)
797+ append bss_conf "sae_groups=$sae_groups" "$N"
798+ append bss_conf "group_cipher=$group_cipher" "$N"
799+ ;;
800+ owe)
801+ append bss_conf "owe_groups=$owe_groups" "$N"
802+ append bss_conf "group_cipher=$group_cipher" "$N"
803+ ;;
804+ esac
805+ fi
806+
developer813f5d72023-03-28 17:44:38 +0800807 # RSN -> allow management frame protection
808 case "$ieee80211w" in
809 [012])
810- json_get_vars ieee80211w_mgmt_cipher ieee80211w_max_timeout ieee80211w_retry_timeout
811+ json_get_vars ieee80211w_mgmt_cipher ieee80211w_max_timeout ieee80211w_retry_timeout beacon_prot
812 append bss_conf "ieee80211w=$ieee80211w" "$N"
813 [ "$ieee80211w" -gt "0" ] && {
developer74503112023-06-29 17:34:49 +0800814+ case "$group_cipher" in
815+ CCMP*)
816+ ieee80211w_mgmt_cipher="AES-128-CMAC"
817+ ;;
818+ GCMP-256)
819+ [[ "$encryption" != "*owe*" ]] && ieee80211w_mgmt_cipher="BIP-GMAC-256"
820+ ;;
821+ esac
developer813f5d72023-03-28 17:44:38 +0800822 if [ "$auth_type" = "eap192" ]; then
developer74503112023-06-29 17:34:49 +0800823 append bss_conf "group_mgmt_cipher=BIP-GMAC-256" "$N"
developer813f5d72023-03-28 17:44:38 +0800824 else
825 append bss_conf "group_mgmt_cipher=${ieee80211w_mgmt_cipher:-AES-128-CMAC}" "$N"
826 fi
827+ [ -n "$beacon_prot" ] && \
828+ append bss_conf "beacon_prot=$beacon_prot" "$N"
829 [ -n "$ieee80211w_max_timeout" ] && \
830 append bss_conf "assoc_sa_query_max_timeout=$ieee80211w_max_timeout" "$N"
831 [ -n "$ieee80211w_retry_timeout" ] && \
developer945ed992023-10-25 15:01:32 +0800832@@ -1047,9 +1133,10 @@ hostapd_set_bss_options() {
developerf166f542023-05-25 14:40:30 +0800833 json_get_vars iw_roaming_consortium iw_domain_name iw_anqp_3gpp_cell_net iw_nai_realm
834 json_get_vars iw_anqp_elem iw_qos_map_set iw_ipaddr_type_availability iw_gas_address3
835 json_get_vars iw_venue_name iw_venue_url
836+ json_get_vars interworking
837
838 set_default iw_enabled 0
839- if [ "$iw_enabled" = "1" ]; then
840+ if [ "$iw_enabled" = "1" ] || [ "$interworking" = "1" ]; then
841 append bss_conf "interworking=1" "$N"
842 set_default iw_internet 1
843 set_default iw_asra 0
developer945ed992023-10-25 15:01:32 +0800844@@ -1156,6 +1243,22 @@ hostapd_set_bss_options() {
developer74503112023-06-29 17:34:49 +0800845 append bss_conf "$val" "$N"
846 done
847
848+ if [ "$unsol_bcast_probe_resp_interval" -gt 0 ]; then
849+ append bss_conf "unsol_bcast_probe_resp_interval=$unsol_bcast_probe_resp_interval" "$N"
850+ fi
851+
852+ if [ -n "$fils_discovery_min_interval" ]; then
853+ append bss_conf "fils_discovery_min_interval=$fils_discovery_min_interval" "$N"
854+ fi
855+
856+ if [ -n "$fils_discovery_max_interval" ]; then
857+ append bss_conf "fils_discovery_max_interval=$fils_discovery_max_interval" "$N"
858+ fi
859+
860+ if [ -n "$rnr" ]; then
861+ append bss_conf "rnr=$rnr" "$N"
862+ fi
863+
864 bss_md5sum="$(echo $bss_conf | md5sum | cut -d" " -f1)"
865 append bss_conf "config_id=$bss_md5sum" "$N"
866
developer945ed992023-10-25 15:01:32 +0800867@@ -1246,6 +1349,7 @@ wpa_supplicant_prepare_interface() {
developer18015ad2023-07-13 13:18:19 +0800868 country_str="country=$country"
869 }
870
developer2cf3f4c2023-07-24 16:58:25 +0800871+ local tx_queue_data2_burst="tx_queue_data2_burst=0"
developer18015ad2023-07-13 13:18:19 +0800872 multiap_flag_file="${_config}.is_multiap"
873 if [ "$multi_ap" = "1" ]; then
874 touch "$multiap_flag_file"
developer945ed992023-10-25 15:01:32 +0800875@@ -1257,6 +1361,7 @@ wpa_supplicant_prepare_interface() {
developer18015ad2023-07-13 13:18:19 +0800876 ${scan_list:+freq_list=$scan_list}
877 $ap_scan
878 $country_str
879+$tx_queue_data2_burst
880 EOF
881 return 0
882 }
developer945ed992023-10-25 15:01:32 +0800883@@ -1528,12 +1633,39 @@ wpa_supplicant_add_network() {
developer74503112023-06-29 17:34:49 +0800884 ;;
885 esac
886
developerbb29b5e2023-07-25 20:41:04 +0800887- [ "$wpa_cipher" = GCMP ] && {
888- append network_data "pairwise=GCMP" "$N$T"
889- append network_data "group=GCMP" "$N$T"
890- }
developer74503112023-06-29 17:34:49 +0800891+ json_get_values pairwise pairwise
developer945ed992023-10-25 15:01:32 +0800892+ json_get_vars group_cipher
developer9097e5e2023-07-19 10:22:24 +0800893+ if [ -n "$pairwise" ]; then
894+ case "$pairwise" in
895+ *tkip+aes|*tkip+ccmp|*aes+tkip|*ccmp+tkip)
896+ wpa_cipher="CCMP TKIP"
897+ ;;
898+ *ccmp256)
899+ wpa_cipher="CCMP-256"
900+ ;;
901+ *aes|*ccmp)
902+ wpa_cipher="CCMP"
903+ ;;
904+ *tkip)
905+ wpa_cipher="TKIP"
906+ ;;
907+ *gcmp256)
908+ wpa_cipher="GCMP-256"
909+ ;;
910+ *gcmp)
911+ wpa_cipher="GCMP"
912+ ;;
913+ *)
914+ wpa_cipher=""
915+ ;;
916+ esac
917+ fi
developer74503112023-06-29 17:34:49 +0800918+ [ -n "$wpa_cipher" ] && wpa_pairwise="$wpa_cipher"
developer74503112023-06-29 17:34:49 +0800919
920 [ "$mode" = mesh ] || {
921+ json_get_values sae_groups sae_groups
922+ json_get_values owe_groups owe_groups
923+
924 case "$wpa" in
925 1)
926 append network_data "proto=WPA" "$N$T"
developer945ed992023-10-25 15:01:32 +0800927@@ -1543,12 +1675,48 @@ wpa_supplicant_add_network() {
developer74503112023-06-29 17:34:49 +0800928 ;;
929 esac
930
931+ [ -n "$wpa_pairwise" ] && append network_data "pairwise=$wpa_pairwise" "$N$T"
932+ [ -z "$group_cipher" ] && group_cipher="$wpa_cipher"
933+
934+ if [ -n "$sae_groups" -o -n "$owe_groups" ]; then
935+ case "$auth_type" in
936+ sae*)
937+ echo "sae_groups=$sae_groups" >> "$_config"
938+ append network_data "group=$group_cipher" "$N$T"
939+ ;;
940+ owe)
941+ append network_data "owe_group=$owe_groups" "$N$T"
942+ append network_data "group=$group_cipher" "$N$T"
943+ ;;
944+ esac
945+ fi
946+
947+ # RSN -> allow management frame protection
948 case "$ieee80211w" in
949 [012])
950- [ "$wpa" -ge 2 ] && append network_data "ieee80211w=$ieee80211w" "$N$T"
951+ json_get_vars ieee80211w_mgmt_cipher ieee80211w_max_timeout ieee80211w_retry_timeout beacon_prot
952+ append network_data "ieee80211w=$ieee80211w" "$N$T"
953+ [ "$ieee80211w" -gt "0" ] && {
954+ case "$group_cipher" in
955+ CCMP*)
956+ ieee80211w_mgmt_cipher="AES-128-CMAC"
957+ ;;
958+ GCMP-256)
959+ [[ "$encryption" != "*owe*" ]] && ieee80211w_mgmt_cipher="BIP-GMAC-256"
960+ ;;
961+ esac
962+ if [ "$auth_type" = "eap192" ]; then
963+ append network_data "group_mgmt=BIP-GMAC-256" "$N$T"
964+ else
965+ append network_data "group_mgmt=${ieee80211w_mgmt_cipher:-AES-128-CMAC}" "$N$T"
966+ fi
967+ [ -n "$beacon_prot" ] && \
968+ append network_data "beacon_prot=$beacon_prot" "$N$T"
969+ }
970 ;;
971 esac
972 }
973+
974 [ -n "$bssid" ] && append network_data "bssid=$bssid" "$N$T"
975 [ -n "$beacon_int" ] && append network_data "beacon_int=$beacon_int" "$N$T"
976
developer945ed992023-10-25 15:01:32 +0800977@@ -1559,6 +1727,20 @@ wpa_supplicant_add_network() {
developer82408892023-03-27 15:09:00 +0800978 [ -n "$bssid_blacklist" ] && append network_data "bssid_blacklist=$bssid_blacklist" "$N$T"
979 [ -n "$bssid_whitelist" ] && append network_data "bssid_whitelist=$bssid_whitelist" "$N$T"
980
981+ local disable_eht
982+ local disable_he
983+ local disable_vht
984+ local disable_ht
985+ json_get_vars disable_eht
986+ json_get_vars disable_he
987+ json_get_vars disable_vht
988+ json_get_vars disable_ht
989+
990+ [ -n "$disable_eht" ] && append network_data "disable_eht=$disable_eht" "$N$T"
991+ [ -n "$disable_he" ] && append network_data "disable_he=$disable_he" "$N$T"
992+ [ -n "$disable_vht" ] && append network_data "disable_vht=$disable_vht" "$N$T"
993+ [ -n "$disable_ht" ] && append network_data "disable_ht=$disable_ht" "$N$T"
994+
995 [ -n "$basic_rate" ] && {
996 local br rate_list=
997 for br in $basic_rate; do
developer945ed992023-10-25 15:01:32 +0800998@@ -1573,6 +1755,11 @@ wpa_supplicant_add_network() {
developer85839fe2023-02-23 10:32:51 +0800999 append network_data "mcast_rate=$mc_rate" "$N$T"
1000 }
1001
1002+ if [ "$auth_type" = "sae" ]; then
1003+ json_get_vars sae_pwe sae_pwe
1004+ [ -n "$sae_pwe" ] && echo "sae_pwe=$sae_pwe" >> "$_config"
1005+ fi
1006+
1007 if [ "$key_mgmt" = "WPS" ]; then
1008 echo "wps_cred_processing=1" >> "$_config"
1009 else