blob: 7566015327d4e1464fbe024a9586c072cd61cf42 [file] [log] [blame]
developerce9e5092022-11-10 22:41:59 +08001diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile
developer93607dd2023-08-30 04:53:00 +08002index a7472ee..f06c889 100644
developerce9e5092022-11-10 22:41:59 +08003--- a/package/kernel/mac80211/Makefile
4+++ b/package/kernel/mac80211/Makefile
developerad1f3172023-05-02 11:10:08 +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 = \
developerad1f3172023-05-02 11:10:08 +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
developerad1f3172023-05-02 11:10:08 +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
developer93607dd2023-08-30 04:53:00 +080034index 3b88af4..b6624c3 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
developer93607dd2023-08-30 04:53:00 +080037@@ -25,9 +25,10 @@ drv_mac80211_init_device_config() {
developer0ba09b62023-03-10 18:43:49 +080038 config_add_string path phy 'macaddr:macaddr'
39 config_add_string tx_burst
developer0ba09b62023-03-10 18:43:49 +080040 config_add_string distance
developer93607dd2023-08-30 04:53:00 +080041+ config_add_int mbssid mu_onoff sr_enable sr_enhanced rnr obss_interval
developer0ba09b62023-03-10 18:43:49 +080042 config_add_int beacon_int chanbw frag rts
developer93607dd2023-08-30 04:53:00 +080043 config_add_int rxantenna txantenna txpower min_tx_power
developer75c99f42023-09-04 11:28:21 +080044- config_add_boolean noscan ht_coex acs_exclude_dfs background_radar
45+ config_add_boolean noscan ht_coex acs_exclude_dfs background_radar background_cert_mode
46 config_add_array ht_capab
47 config_add_array channels
48 config_add_array scan_list
developer24684862023-08-02 08:10:38 +080049@@ -50,7 +51,10 @@ drv_mac80211_init_device_config() {
developer785b6502023-04-19 18:31:11 +080050 he_spr_sr_control \
51 he_spr_psr_enabled \
52 he_bss_color_enabled \
53- he_twt_required
54+ he_twt_required \
55+ he_twt_responder \
56+ etxbfen \
57+ itxbfen
58 config_add_int \
59 beamformer_antennas \
60 beamformee_antennas \
developer24684862023-08-02 08:10:38 +080061@@ -137,13 +141,11 @@ mac80211_hostapd_setup_base() {
developer0ba09b62023-03-10 18:43:49 +080062 [ -n "$acs_exclude_dfs" ] && [ "$acs_exclude_dfs" -gt 0 ] &&
63 append base_cfg "acs_exclude_dfs=1" "$N"
64
65- json_get_vars noscan ht_coex min_tx_power:0 tx_burst
developer93607dd2023-08-30 04:53:00 +080066+ json_get_vars noscan ht_coex min_tx_power:0 tx_burst mbssid mu_onoff rnr obss_interval
developer2c4f7e82023-05-11 19:56:55 +080067+ json_get_vars etxbfen:1 itxbfen:0
developer8d77be32022-10-20 15:08:25 +080068 json_get_values ht_capab_list ht_capab
developer20d67712022-03-02 14:09:32 +080069 json_get_values channel_list channels
70
71- [ "$auto_channel" = 0 ] && [ -z "$channel_list" ] && \
72- channel_list="$channel"
73-
developer9b3248d2022-07-06 00:44:05 +080074 [ "$min_tx_power" -gt 0 ] && append base_cfg "min_tx_power=$min_tx_power"
developer20d67712022-03-02 14:09:32 +080075
developer9b3248d2022-07-06 00:44:05 +080076 set_default noscan 0
developer24684862023-08-02 08:10:38 +080077@@ -157,8 +159,8 @@ mac80211_hostapd_setup_base() {
developer785b6502023-04-19 18:31:11 +080078 ieee80211n=1
79 ht_capab=
80 case "$htmode" in
81- VHT20|HT20|HE20) ;;
82- HT40*|VHT40|VHT80|VHT160|HE40|HE80|HE160)
83+ VHT20|HT20|HE20|EHT20) ;;
developerbe3cf972023-04-27 09:58:26 +080084+ HT40*|VHT40|VHT80|VHT160|HE40*|HE80|HE160|EHT40*|EHT80|EHT160|EHT320*)
developer785b6502023-04-19 18:31:11 +080085 case "$hwmode" in
86 a)
87 case "$(( (($channel / 4) + $chan_ofs) % 2 ))" in
developer24684862023-08-02 08:10:38 +080088@@ -168,8 +170,22 @@ mac80211_hostapd_setup_base() {
developerbe3cf972023-04-27 09:58:26 +080089 ;;
90 *)
91 case "$htmode" in
92- HT40+) ht_capab="[HT40+]";;
93- HT40-) ht_capab="[HT40-]";;
94+ HT40+|HE40+|EHT40+)
95+ if [ "$channel" -gt 9 ]; then
96+ echo "Could not set the center freq with this HT mode setting"
97+ return 1
98+ else
99+ ht_capab="[HT40+]"
100+ fi
101+ ;;
102+ HT40-|HE40-|EHT40-)
103+ if [ "$channel" -lt 5 ]; then
104+ echo "Could not set the center freq with this HT mode setting"
105+ return 1
106+ else
107+ ht_capab="[HT40-]"
108+ fi
109+ ;;
110 *)
111 if [ "$channel" -lt 7 ]; then
112 ht_capab="[HT40+]"
developer93607dd2023-08-30 04:53:00 +0800113@@ -191,6 +207,11 @@ mac80211_hostapd_setup_base() {
114 set_default ht_coex 0
115 append base_cfg "ht_coex=$ht_coex" "$N"
116
117+ [ "$ht_coex" -eq 1 ] && {
118+ set_default obss_interval 300
119+ append base_cfg "obss_interval=$obss_interval" "$N"
120+ }
121+
122 json_get_vars \
123 ldpc:1 \
124 greenfield:0 \
125@@ -202,7 +223,7 @@ mac80211_hostapd_setup_base() {
developer785b6502023-04-19 18:31:11 +0800126 dsss_cck_40:1
127
128 ht_cap_mask=0
129- for cap in $(iw phy "$phy" info | grep 'Capabilities:' | cut -d: -f2); do
130+ for cap in $(iw phy "$phy" info | grep 'Capabilities: 0x' | cut -d: -f2); do
131 ht_cap_mask="$(($ht_cap_mask | $cap))"
132 done
133
developer93607dd2023-08-30 04:53:00 +0800134@@ -233,8 +254,8 @@ mac80211_hostapd_setup_base() {
developer785b6502023-04-19 18:31:11 +0800135
136 idx="$channel"
137 case "$htmode" in
138- VHT20|HE20) enable_ac=1;;
139- VHT40|HE40)
140+ VHT20|HE20|EHT20) enable_ac=1;;
141+ VHT40|HE40|EHT40)
142 case "$(( (($channel / 4) + $chan_ofs) % 2 ))" in
143 1) idx=$(($channel + 2));;
144 0) idx=$(($channel - 2));;
developer93607dd2023-08-30 04:53:00 +0800145@@ -242,7 +263,7 @@ mac80211_hostapd_setup_base() {
developer785b6502023-04-19 18:31:11 +0800146 enable_ac=1
147 vht_center_seg0=$idx
148 ;;
149- VHT80|HE80)
150+ VHT80|HE80|EHT80)
151 case "$(( (($channel / 4) + $chan_ofs) % 4 ))" in
152 1) idx=$(($channel + 6));;
153 2) idx=$(($channel + 2));;
developer93607dd2023-08-30 04:53:00 +0800154@@ -253,7 +274,7 @@ mac80211_hostapd_setup_base() {
developer785b6502023-04-19 18:31:11 +0800155 vht_oper_chwidth=1
156 vht_center_seg0=$idx
157 ;;
158- VHT160|HE160)
159+ VHT160|HE160|EHT160)
160 if [ "$band" = "6g" ]; then
161 case "$channel" in
162 1|5|9|13|17|21|25|29) idx=15;;
developer93607dd2023-08-30 04:53:00 +0800163@@ -268,23 +289,58 @@ mac80211_hostapd_setup_base() {
developeradd8de62023-05-02 16:25:52 +0800164 case "$channel" in
165 36|40|44|48|52|56|60|64) idx=50;;
166 100|104|108|112|116|120|124|128) idx=114;;
167+ 149|153|157|161|165|169|173|177) idx=163;;
168 esac
169 fi
170 enable_ac=1
developer785b6502023-04-19 18:31:11 +0800171 vht_oper_chwidth=2
172 vht_center_seg0=$idx
173 ;;
174+ EHT320*)
175+ case "$channel" in
176+ 1|5|9|13|17|21|25|29) idx=31;;
177+ 33|37|41|45|49|53|57|61| \
178+ 65|69|73|77|81|85|89|93) idx=63;;
179+ 97|101|105|109|113|117|121|125| \
180+ 129|133|137|141|145|149|153|157) idx=127;;
181+ 161|165|169|173|177|181|185|189| \
182+ 193|197|201|205|209|213|217|221) idx=191;;
183+ esac
184+ if [[ "$htmode" = "EHT320-1" && "$channel" -ge "193" ]] ||
185+ [[ "$htmode" = "EHT320-2" && "$channel" -le "29" ]]; then
186+ echo "Could not set the center freq with this EHT setting"
187+ return 1
188+ elif [[ "$htmode" = "EHT320-1" && "$channel" -ge "33" ]]; then
189+ if [ "$channel" -gt $idx ]; then
190+ idx=$(($idx + 32))
191+ else
192+ idx=$(($idx - 32))
193+ fi
194+ fi
195+ vht_oper_chwidth=2
196+ if [ "$channel" -gt $idx ]; then
197+ vht_center_seg0=$(($idx + 16))
198+ else
199+ vht_center_seg0=$(($idx - 16))
200+ fi
201+ eht_oper_chwidth=9
202+ eht_oper_centr_freq_seg0_idx=$idx
203+ ;;
204 esac
205 [ "$band" = "5g" ] && {
developer75c99f42023-09-04 11:28:21 +0800206- json_get_vars background_radar:0
207+ json_get_vars \
208+ background_radar:0 \
209+ background_cert_mode:0 \
210
211 [ "$background_radar" -eq 1 ] && append base_cfg "enable_background_radar=1" "$N"
212+ [ "$background_cert_mode" -eq 1 ] && append base_cfg "background_radar_mode=1" "$N"
213 }
developer785b6502023-04-19 18:31:11 +0800214 [ "$band" = "6g" ] && {
215 op_class=
216 case "$htmode" in
217- HE20) op_class=131;;
218- HE*) op_class=$((132 + $vht_oper_chwidth))
219+ HE20|EHT20) op_class=131;;
220+ EHT320*) op_class=137;;
221+ HE*|EHT*) op_class=$((132 + $vht_oper_chwidth))
222 esac
223 [ -n "$op_class" ] && append base_cfg "op_class=$op_class" "$N"
224 }
developer93607dd2023-08-30 04:53:00 +0800225@@ -312,7 +368,6 @@ mac80211_hostapd_setup_base() {
developer8b04dfd2022-12-07 16:29:19 +0800226 vht_link_adapt:3 \
227 vht160:2
228
229- set_default tx_burst 2.0
230 append base_cfg "ieee80211ac=1" "$N"
231 vht_cap=0
232 for cap in $(iw phy "$phy" info | awk -F "[()]" '/VHT Capabilities/ { print $2 }'); do
developer93607dd2023-08-30 04:53:00 +0800233@@ -326,6 +381,12 @@ mac80211_hostapd_setup_base() {
developer785b6502023-04-19 18:31:11 +0800234 [ "$rx_stbc" -lt "$cap_rx_stbc" ] && cap_rx_stbc="$rx_stbc"
235 vht_cap="$(( ($vht_cap & ~(0x700)) | ($cap_rx_stbc << 8) ))"
236
237+ [ "$etxbfen" -eq 0 ] && {
238+ su_beamformer=0
239+ su_beamformee=0
240+ mu_beamformer=0
241+ }
242+
243 mac80211_add_capabilities vht_capab $vht_cap \
244 RXLDPC:0x10::$rxldpc \
245 SHORT-GI-80:0x20::$short_gi_80 \
developer93607dd2023-08-30 04:53:00 +0800246@@ -407,7 +468,7 @@ mac80211_hostapd_setup_base() {
developer785b6502023-04-19 18:31:11 +0800247 # 802.11ax
248 enable_ax=0
249 case "$htmode" in
250- HE*) enable_ax=1 ;;
251+ HE*|EHT*) enable_ax=1 ;;
252 esac
253
254 if [ "$enable_ax" != "0" ]; then
developer93607dd2023-08-30 04:53:00 +0800255@@ -416,10 +477,11 @@ mac80211_hostapd_setup_base() {
developer785b6502023-04-19 18:31:11 +0800256 he_su_beamformee:1 \
257 he_mu_beamformer:1 \
258 he_twt_required:0 \
259+ he_twt_responder \
260 he_spr_sr_control:3 \
261 he_spr_psr_enabled:0 \
262 he_spr_non_srg_obss_pd_max_offset:0 \
263- he_bss_color:128 \
264+ he_bss_color \
265 he_bss_color_enabled:1
266
267 he_phy_cap=$(iw phy "$phy" info | sed -n '/HE Iftypes: AP/,$p' | awk -F "[()]" '/HE PHY Capabilities/ { print $2 }' | head -1)
developer93607dd2023-08-30 04:53:00 +0800268@@ -433,6 +495,11 @@ mac80211_hostapd_setup_base() {
developer785b6502023-04-19 18:31:11 +0800269 append base_cfg "he_oper_centr_freq_seg0_idx=$vht_center_seg0" "$N"
270 }
271
272+ [ "$etxbfen" -eq 0 ] && {
273+ he_su_beamformer=0
274+ he_mu_beamformer=0
275+ }
276+
277 mac80211_add_he_capabilities \
278 he_su_beamformer:${he_phy_cap:6:2}:0x80:$he_su_beamformer \
279 he_su_beamformee:${he_phy_cap:8:2}:0x1:$he_su_beamformee \
developer93607dd2023-08-30 04:53:00 +0800280@@ -440,7 +507,14 @@ mac80211_hostapd_setup_base() {
developer785b6502023-04-19 18:31:11 +0800281 he_spr_psr_enabled:${he_phy_cap:14:2}:0x1:$he_spr_psr_enabled \
282 he_twt_required:${he_mac_cap:0:2}:0x6:$he_twt_required
283
284+ if [ -n "$he_twt_responder" ]; then
285+ append base_cfg "he_twt_responder=$he_twt_responder" "$N"
286+ fi
287 if [ "$he_bss_color_enabled" -gt 0 ]; then
developer830efa72023-05-18 19:32:48 +0800288+ if !([ "$he_bss_color" -gt 0 ] && [ "$he_bss_color" -le 64 ]); then
developer785b6502023-04-19 18:31:11 +0800289+ rand=$(head -n 1 /dev/urandom | tr -dc 0-9 | head -c 2)
290+ he_bss_color=$((rand % 63 + 1))
291+ fi
292 append base_cfg "he_bss_color=$he_bss_color" "$N"
293 [ "$he_spr_non_srg_obss_pd_max_offset" -gt 0 ] && { \
294 append base_cfg "he_spr_non_srg_obss_pd_max_offset=$he_spr_non_srg_obss_pd_max_offset" "$N"
developer93607dd2023-08-30 04:53:00 +0800295@@ -459,34 +533,69 @@ mac80211_hostapd_setup_base() {
developer619eaa32023-08-29 13:33:51 +0800296 append base_cfg "he_mu_edca_qos_info_q_ack=0" "$N"
297 append base_cfg "he_mu_edca_qos_info_queue_request=0" "$N"
298 append base_cfg "he_mu_edca_qos_info_txop_request=0" "$N"
299- append base_cfg "he_mu_edca_ac_be_aifsn=8" "$N"
300+ append base_cfg "he_mu_edca_ac_be_aifsn=0" "$N"
301 append base_cfg "he_mu_edca_ac_be_aci=0" "$N"
302 append base_cfg "he_mu_edca_ac_be_ecwmin=9" "$N"
303 append base_cfg "he_mu_edca_ac_be_ecwmax=10" "$N"
304 append base_cfg "he_mu_edca_ac_be_timer=255" "$N"
305- append base_cfg "he_mu_edca_ac_bk_aifsn=15" "$N"
306+ append base_cfg "he_mu_edca_ac_bk_aifsn=0" "$N"
307 append base_cfg "he_mu_edca_ac_bk_aci=1" "$N"
308 append base_cfg "he_mu_edca_ac_bk_ecwmin=9" "$N"
309 append base_cfg "he_mu_edca_ac_bk_ecwmax=10" "$N"
310 append base_cfg "he_mu_edca_ac_bk_timer=255" "$N"
311 append base_cfg "he_mu_edca_ac_vi_ecwmin=5" "$N"
312 append base_cfg "he_mu_edca_ac_vi_ecwmax=7" "$N"
313- append base_cfg "he_mu_edca_ac_vi_aifsn=5" "$N"
314+ append base_cfg "he_mu_edca_ac_vi_aifsn=0" "$N"
315 append base_cfg "he_mu_edca_ac_vi_aci=2" "$N"
316 append base_cfg "he_mu_edca_ac_vi_timer=255" "$N"
317- append base_cfg "he_mu_edca_ac_vo_aifsn=5" "$N"
318+ append base_cfg "he_mu_edca_ac_vo_aifsn=0" "$N"
319 append base_cfg "he_mu_edca_ac_vo_aci=3" "$N"
320 append base_cfg "he_mu_edca_ac_vo_ecwmin=5" "$N"
321 append base_cfg "he_mu_edca_ac_vo_ecwmax=7" "$N"
developer8b04dfd2022-12-07 16:29:19 +0800322 append base_cfg "he_mu_edca_ac_vo_timer=255" "$N"
323 fi
324
developer18015ad2023-07-13 13:18:19 +0800325+ set_default tx_burst 2
developer8b04dfd2022-12-07 16:29:19 +0800326+
developer785b6502023-04-19 18:31:11 +0800327+ # 802.11be
328+ enable_be=0
329+ case "$htmode" in
330+ EHT*) enable_be=1 ;;
331+ esac
332+
333+ if [ "$enable_be" != "0" ]; then
334+ append base_cfg "ieee80211be=1" "$N"
335+ if [ "$etxbfen" -eq 0 ]; then
336+ append base_cfg "eht_su_beamformee=1" "$N"
337+ else
338+ append base_cfg "eht_su_beamformer=1" "$N"
339+ append base_cfg "eht_su_beamformee=1" "$N"
340+ append base_cfg "eht_mu_beamformer=1" "$N"
341+ fi
342+ [ "$hwmode" = "a" ] && {
343+ case $htmode in
344+ EHT320*)
345+ append base_cfg "eht_oper_chwidth=$eht_oper_chwidth" "$N"
346+ append base_cfg "eht_oper_centr_freq_seg0_idx=$eht_oper_centr_freq_seg0_idx" "$N"
347+ ;;
348+ *)
349+ append base_cfg "eht_oper_chwidth=$vht_oper_chwidth" "$N"
350+ append base_cfg "eht_oper_centr_freq_seg0_idx=$vht_center_seg0" "$N"
351+ ;;
352+ esac
353+ }
354+ fi
355+
developer8b04dfd2022-12-07 16:29:19 +0800356 hostapd_prepare_device_config "$hostapd_conf_file" nl80211
357 cat >> "$hostapd_conf_file" <<EOF
358 ${channel:+channel=$channel}
developer0ba09b62023-03-10 18:43:49 +0800359 ${channel_list:+chanlist=$channel_list}
360 ${hostapd_noscan:+noscan=1}
361 ${tx_burst:+tx_queue_data2_burst=$tx_burst}
362+${mbssid:+mbssid=$mbssid}
developer785b6502023-04-19 18:31:11 +0800363+${mu_onoff:+mu_onoff=$mu_onoff}
364+${itxbfen:+ibf_enable=$itxbfen}
developer2c6592a2023-07-21 11:20:56 +0800365+${rnr:+rnr=$rnr}
developer0ba09b62023-03-10 18:43:49 +0800366 $base_cfg
367
368 EOF
developer93607dd2023-08-30 04:53:00 +0800369@@ -512,7 +621,7 @@ mac80211_hostapd_setup_bss() {
developer093e1a32023-02-24 16:10:53 +0800370 append hostapd_cfg "wds_sta=1" "$N"
371 [ -n "$wds_bridge" ] && append hostapd_cfg "wds_bridge=$wds_bridge" "$N"
372 }
373- [ "$staidx" -gt 0 -o "$start_disabled" -eq 1 ] && append hostapd_cfg "start_disabled=1" "$N"
374+ [ "$start_disabled" -eq 1 ] && append hostapd_cfg "start_disabled=1" "$N"
375
376 cat >> /var/run/hostapd-$phy.conf <<EOF
377 $hostapd_cfg
developer93607dd2023-08-30 04:53:00 +0800378@@ -522,6 +631,31 @@ ${max_listen_int:+max_listen_interval=$max_listen_int}
developer0ba09b62023-03-10 18:43:49 +0800379 EOF
380 }
381
382+mac80211_generate_mbssid_mac() {
383+ local phy="$1"
384+ local transmitted_bssid="$2"
developer1952bcd2023-06-20 20:14:37 +0800385+ local id="${mbssidx:-0}"
developer0ba09b62023-03-10 18:43:49 +0800386+
387+ local ref="$(cat /sys/class/ieee80211/${phy}/macaddress)"
developer0ba09b62023-03-10 18:43:49 +0800388+
389+ if [ -z "$transmitted_bssid" ]; then
390+ transmitted_bssid=$ref
391+ fi
392+
393+ if [ $id -eq 0 ]; then
394+ echo "$transmitted_bssid"
395+ return
396+ fi
397+
398+ local oIFS="$IFS"; IFS=":"; set -- $transmitted_bssid; IFS="$oIFS"
399+
400+ # Calculate nontransmitted bssid
developer0ba09b62023-03-10 18:43:49 +0800401+ b6="0x$6"
402+ ref_b6=$(($b6 % $max_mbssid))
developer1952bcd2023-06-20 20:14:37 +0800403+ b6=$(($b6 - $ref_b6 + ($ref_b6 + $id) % $max_mbssid))
developer0ba09b62023-03-10 18:43:49 +0800404+ printf "%s:%s:%s:%s:%s:%02x" $1 $2 $3 $4 $5 $b6
405+}
406+
407 mac80211_get_addr() {
408 local phy="$1"
409 local idx="$(($2 + 1))"
developer93607dd2023-08-30 04:53:00 +0800410@@ -684,7 +818,19 @@ mac80211_prepare_vif() {
developer24684862023-08-02 08:10:38 +0800411 set_default powersave 0
412 json_add_string _ifname "$ifname"
developer0ba09b62023-03-10 18:43:49 +0800413
414- if [ -z "$macaddr" ]; then
developerd2fbd572023-06-19 19:48:25 +0800415+ if [ "$mbssid" -gt 0 ] && [ "$mode" == "ap" ]; then
developer1952bcd2023-06-20 20:14:37 +0800416+ [ "$mbssidx" -eq 0 ] && {
417+ if [ -z $macaddr ]; then
418+ transmitted_bssid="$(mac80211_generate_mac $phy)"
419+ else
420+ # uci set mac address
421+ transmitted_bssid=$macaddr
422+ fi
423+ macidx="$(($macidx + 1))"
developer0ba09b62023-03-10 18:43:49 +0800424+ }
425+ macaddr="$(mac80211_generate_mbssid_mac $phy $transmitted_bssid)"
developer1952bcd2023-06-20 20:14:37 +0800426+ mbssidx="$(($mbssidx + 1))"
developer0ba09b62023-03-10 18:43:49 +0800427+ elif [ -z "$macaddr" ]; then
428 macaddr="$(mac80211_generate_mac $phy)"
429 macidx="$(($macidx + 1))"
430 elif [ "$macaddr" = 'random' ]; then
developer93607dd2023-08-30 04:53:00 +0800431@@ -946,6 +1092,14 @@ hostapd_set_config() {
developer24684862023-08-02 08:10:38 +0800432 }
433
434 ubus wait_for hostapd
435+
436+ # each phy sleeps different times to prevent for ubus race condition.
437+ if [ "$phy" = "phy1" ]; then
438+ sleep 1;
439+ elif [ "$phy" = "phy2" ]; then
440+ sleep 2;
441+ fi
442+
443 local hostapd_res="$(ubus call hostapd config_set "{ \"phy\": \"$phy\", \"config\":\"${hostapd_conf_file}\", \"prev_config\": \"${hostapd_conf_file}.prev\"}")"
444 ret="$?"
445 [ "$ret" != 0 -o -z "$hostapd_res" ] && {
developer93607dd2023-08-30 04:53:00 +0800446@@ -1022,6 +1176,9 @@ mac80211_setup_vif() {
developerf0de14b2022-12-14 23:07:34 +0800447
448 json_select ..
449 [ -n "$failed" ] || wireless_add_vif "$name" "$ifname"
450+
451+ echo "Setup SMP Affinity"
452+ /sbin/smp-mt76.sh
453 }
454
455 get_freq() {
developer93607dd2023-08-30 04:53:00 +0800456@@ -1073,6 +1230,10 @@ mac80211_reset_config() {
developer24684862023-08-02 08:10:38 +0800457 wdev_tool "$phy" '{}'
developer0ba09b62023-03-10 18:43:49 +0800458 }
459
460+mac80211_count_ap() {
461+ total_num_ap=$(($total_num_ap + 1))
462+}
463+
464 drv_mac80211_setup() {
465 json_select config
466 json_get_vars \
developer93607dd2023-08-30 04:53:00 +0800467@@ -1080,7 +1241,8 @@ drv_mac80211_setup() {
developer74503112023-06-29 17:34:49 +0800468 country chanbw distance \
developer93607dd2023-08-30 04:53:00 +0800469 txpower \
developer74503112023-06-29 17:34:49 +0800470 rxantenna txantenna \
471- frag rts beacon_int:100 htmode
472+ frag rts beacon_int:100 htmode \
473+ sr_enable sr_enhanced
474 json_get_values basic_rate_list basic_rate
475 json_get_values scan_list scan_list
476 json_select ..
developer93607dd2023-08-30 04:53:00 +0800477@@ -1115,6 +1277,7 @@ drv_mac80211_setup() {
developer24684862023-08-02 08:10:38 +0800478
developer1952bcd2023-06-20 20:14:37 +0800479 macidx=0
480 staidx=0
481+ mbssidx=0
482
483 [ -n "$chanbw" ] && {
484 for file in /sys/kernel/debug/ieee80211/$phy/ath9k*/chanbw /sys/kernel/debug/ieee80211/$phy/ath5k/bwmode; do
developer93607dd2023-08-30 04:53:00 +0800485@@ -1163,6 +1326,16 @@ drv_mac80211_setup() {
developer24684862023-08-02 08:10:38 +0800486
487 wpa_supplicant_init_config
developer0ba09b62023-03-10 18:43:49 +0800488
489+ total_num_ap=0
490+ max_mbssid=1
491+ for_each_interface "ap" mac80211_count_ap
492+ total_num_ap=$(($total_num_ap - 1))
493+ while [ $total_num_ap -gt 0 ]
494+ do
495+ total_num_ap=$(($total_num_ap >> 1))
496+ max_mbssid=$(($max_mbssid << 1))
497+ done
498+
499 mac80211_prepare_iw_htmode
developer24684862023-08-02 08:10:38 +0800500 active_ifnames=
501 for_each_interface "ap sta adhoc mesh monitor" mac80211_prepare_vif
developer93607dd2023-08-30 04:53:00 +0800502@@ -1171,6 +1344,9 @@ drv_mac80211_setup() {
developer24684862023-08-02 08:10:38 +0800503 [ -x /usr/sbin/wpa_supplicant ] && wpa_supplicant_set_config "$phy"
504 [ -x /usr/sbin/hostapd ] && hostapd_set_config "$phy"
developer74503112023-06-29 17:34:49 +0800505
506+ [ -n "$sr_enable" ] && echo "$sr_enable" > /sys/kernel/debug/ieee80211/$phy/mt76/sr_enable
507+ [ -n "$sr_enhanced" ] && echo "$sr_enhanced" > /sys/kernel/debug/ieee80211/$phy/mt76/sr_enhanced_enable
508+
developer24684862023-08-02 08:10:38 +0800509 [ -x /usr/sbin/wpa_supplicant ] && wpa_supplicant_start "$phy"
developer74503112023-06-29 17:34:49 +0800510
developer24684862023-08-02 08:10:38 +0800511 json_set_namespace wdev_uc prev
developer9b3248d2022-07-06 00:44:05 +0800512diff --git a/package/kernel/mac80211/files/lib/wifi/mac80211.sh b/package/kernel/mac80211/files/lib/wifi/mac80211.sh
developer93607dd2023-08-30 04:53:00 +0800513index e24a2a6..da3ee8c 100644
developere2597ba2022-06-24 13:09:16 +0800514--- a/package/kernel/mac80211/files/lib/wifi/mac80211.sh
515+++ b/package/kernel/mac80211/files/lib/wifi/mac80211.sh
developer20ce7bd2023-05-20 13:25:14 +0800516@@ -60,6 +60,9 @@ BEGIN {
developer785b6502023-04-19 18:31:11 +0800517 if (vht && band != "1:") mode="VHT80"
518 if (he) mode="HE80"
519 if (he && band == "1:") mode="HE20"
developer20ce7bd2023-05-20 13:25:14 +0800520+ if (eht && band == "2:") mode="EHT160"
521+ if (eht && band == "4:") mode="EHT320"
developer785b6502023-04-19 18:31:11 +0800522+ if (eht && band == "1:") mode="EHT20"
523 sub("\\[", "", channel)
524 sub("\\]", "", channel)
525 bands = bands band channel ":" mode " "
developer20ce7bd2023-05-20 13:25:14 +0800526@@ -73,6 +76,7 @@ $1 == "Band" {
developer785b6502023-04-19 18:31:11 +0800527 vht = ""
528 ht = ""
529 he = ""
530+ eht = ""
531 }
532
533 $0 ~ "Capabilities:" {
developer20ce7bd2023-05-20 13:25:14 +0800534@@ -87,6 +91,18 @@ $0 ~ "HE Iftypes" {
developer785b6502023-04-19 18:31:11 +0800535 he=1
536 }
537
538+$0 ~ "EHT Iftypes" {
539+ eht=1
540+}
541+
developer20ce7bd2023-05-20 13:25:14 +0800542+$0 ~ / *HE MAC Capabilities \(0x000000000000\)/ {
543+ he=0
544+}
545+
546+$0 ~ / *EHT MAC Capabilities \(0x0000\)/ {
547+ eht=0
548+}
549+
developer785b6502023-04-19 18:31:11 +0800550 $1 == "*" && $3 == "MHz" && $0 !~ /disabled/ && band && !channel {
551 channel = $4
552 }
developer75c99f42023-09-04 11:28:21 +0800553@@ -120,6 +136,25 @@ get_band_defaults() {
developere2597ba2022-06-24 13:09:16 +0800554 mode_band="$band"
555 channel="$chan"
556 htmode="$mode"
557+ if [ "$band" = "6g" ]
558+ then
559+ encryption=sae
560+ key=12345678
developer20ce7bd2023-05-20 13:25:14 +0800561+ sae_pwe=2
562+ ieee80211w=2
developeradbb45b2023-06-09 14:43:01 +0800563+ channel=37
564+ mbssid=1
developer75c99f42023-09-04 11:28:21 +0800565+ elif [ "$band" = "5g" ]
566+ then
567+ noscan=1
568+ encryption=none
569+ rnr=1
570+ background_radar=1
developere2597ba2022-06-24 13:09:16 +0800571+ else
developer659b07e2023-05-25 12:34:13 +0800572+ noscan=1
developere2597ba2022-06-24 13:09:16 +0800573+ encryption=none
developer2c6592a2023-07-21 11:20:56 +0800574+ rnr=1
developere2597ba2022-06-24 13:09:16 +0800575+ fi
576 done
577 }
578
developer75c99f42023-09-04 11:28:21 +0800579@@ -153,6 +188,10 @@ detect_mac80211() {
developer785b6502023-04-19 18:31:11 +0800580
581 json_load_file /etc/board.json
582
583+ # generate random bytes for macaddr
584+ rand=$(hexdump -C /dev/urandom | head -n 1 &)
585+ killall hexdump
586+
587 for _dev in /sys/class/ieee80211/*; do
588 [ -e "$_dev" ] || continue
589
developer75c99f42023-09-04 11:28:21 +0800590@@ -162,6 +201,14 @@ detect_mac80211() {
developere2597ba2022-06-24 13:09:16 +0800591 channel=""
592 htmode=""
593 ht_capab=""
594+ encryption=""
developer659b07e2023-05-25 12:34:13 +0800595+ noscan=""
developere2597ba2022-06-24 13:09:16 +0800596+ key=""
developer09257932023-05-09 13:41:30 +0800597+ sae_pwe=""
developer20ce7bd2023-05-20 13:25:14 +0800598+ ieee80211w=""
developeradbb45b2023-06-09 14:43:01 +0800599+ mbssid=""
developer2c6592a2023-07-21 11:20:56 +0800600+ rnr=""
developer75c99f42023-09-04 11:28:21 +0800601+ background_radar=""
developere2597ba2022-06-24 13:09:16 +0800602
603 get_band_defaults "$dev"
604
developer75c99f42023-09-04 11:28:21 +0800605@@ -196,6 +243,14 @@ detect_mac80211() {
developer785b6502023-04-19 18:31:11 +0800606 ;;
607 esac
608
developer212c0d82023-07-13 19:41:47 +0800609+ macaddr=""
developer1325ba72023-06-26 13:43:31 +0800610+ if (dmesg | grep -q "eeprom load fail"); then
developer1952bcd2023-06-20 20:14:37 +0800611+ for i in $(seq 2 3); do
612+ macaddr=${macaddr}:$(echo $rand | cut -d ' ' -f $i)
613+ done
614+ macaddr="00:0$(($devidx - 1)):55:66${macaddr}"
developer1952bcd2023-06-20 20:14:37 +0800615+ fi
developer785b6502023-04-19 18:31:11 +0800616+
617 uci -q batch <<-EOF
618 set wireless.${name}=wifi-device
619 set wireless.${name}.type=mac80211
developer75c99f42023-09-04 11:28:21 +0800620@@ -203,15 +258,43 @@ detect_mac80211() {
developer09257932023-05-09 13:41:30 +0800621 set wireless.${name}.channel=${channel}
622 set wireless.${name}.band=${mode_band}
623 set wireless.${name}.htmode=$htmode
624- set wireless.${name}.disabled=1
developer20ce7bd2023-05-20 13:25:14 +0800625+ set wireless.${name}.country='US'
developer659b07e2023-05-25 12:34:13 +0800626+ set wireless.${name}.noscan=${noscan}
developer09257932023-05-09 13:41:30 +0800627+ set wireless.${name}.disabled=0
developeradbb45b2023-06-09 14:43:01 +0800628+EOF
629+ [ -n "$mbssid" ] && {
630+ uci -q set wireless.${name}.mbssid=${mbssid}
631+ }
developer2c6592a2023-07-21 11:20:56 +0800632+ [ -n "$rnr" ] && {
633+ uci -q set wireless.${name}.rnr=${rnr}
634+ }
developer75c99f42023-09-04 11:28:21 +0800635+ [ -n "$background_radar" ] && {
636+ uci -q set wireless.${name}.background_radar=${background_radar}
637+ }
developer09257932023-05-09 13:41:30 +0800638
developeradbb45b2023-06-09 14:43:01 +0800639+ uci -q batch <<-EOF
developer09257932023-05-09 13:41:30 +0800640 set wireless.default_${name}=wifi-iface
641 set wireless.default_${name}.device=${name}
developer8d77be32022-10-20 15:08:25 +0800642 set wireless.default_${name}.network=lan
643 set wireless.default_${name}.mode=ap
developer09257932023-05-09 13:41:30 +0800644- set wireless.default_${name}.ssid=OpenWrt
developer8d77be32022-10-20 15:08:25 +0800645- set wireless.default_${name}.encryption=none
developer09257932023-05-09 13:41:30 +0800646+ set wireless.default_${name}.ssid=OpenWrt-${mode_band}
developer8d77be32022-10-20 15:08:25 +0800647+ set wireless.default_${name}.encryption=${encryption}
developere2597ba2022-06-24 13:09:16 +0800648 EOF
developer212c0d82023-07-13 19:41:47 +0800649+
650+ # calibrated board will use eeprom macaddress, not ramdom address
651+ [ -n "$macaddr" ] && {
652+ uci -q set wireless.default_${name}.macaddr=${macaddr}
653+ }
654+
developere2597ba2022-06-24 13:09:16 +0800655+ [ -n "$key" ] && {
developer8d77be32022-10-20 15:08:25 +0800656+ uci -q set wireless.default_${name}.key=${key}
developere2597ba2022-06-24 13:09:16 +0800657+ }
developer09257932023-05-09 13:41:30 +0800658+ [ -n "$sae_pwe" ] && {
659+ uci -q set wireless.default_${name}.sae_pwe=${sae_pwe}
660+ }
developer20ce7bd2023-05-20 13:25:14 +0800661+ [ -n "$ieee80211w" ] && {
662+ uci -q set wireless.default_${name}.ieee80211w=${ieee80211w}
663+ }
developere2597ba2022-06-24 13:09:16 +0800664 uci -q commit wireless
developer8d77be32022-10-20 15:08:25 +0800665 done
666 }
developer85839fe2023-02-23 10:32:51 +0800667diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh
developer93607dd2023-08-30 04:53:00 +0800668index a0945fd..192bf6c 100644
developer85839fe2023-02-23 10:32:51 +0800669--- a/package/network/services/hostapd/files/hostapd.sh
670+++ b/package/network/services/hostapd/files/hostapd.sh
developer74503112023-06-29 17:34:49 +0800671@@ -60,7 +60,14 @@ hostapd_append_wpa_key_mgmt() {
developer93607dd2023-08-30 04:53:00 +0800672 append wpa_key_mgmt "WPA-EAP-SHA256"
developer74503112023-06-29 17:34:49 +0800673 ;;
674 sae)
675- append wpa_key_mgmt "SAE"
676+ case "$encryption" in
677+ *sae-ext*)
678+ append wpa_key_mgmt "SAE-EXT-KEY"
679+ ;;
680+ *)
681+ append wpa_key_mgmt "SAE"
682+ ;;
683+ esac
684 [ "${ieee80211r:-0}" -gt 0 ] && append wpa_key_mgmt "FT-SAE"
685 ;;
686 psk-sae)
developer93607dd2023-08-30 04:53:00 +0800687@@ -119,6 +126,7 @@ hostapd_common_add_device_config() {
developer74503112023-06-29 17:34:49 +0800688 config_add_int rts_threshold
689 config_add_int rssi_reject_assoc_rssi
690 config_add_int rssi_ignore_probe_request
691+ config_add_int rssi_reject_assoc_timeout
692 config_add_int maxassoc
693
694 config_add_string acs_chan_bias
developer93607dd2023-08-30 04:53:00 +0800695@@ -231,8 +239,10 @@ hostapd_prepare_device_config() {
developer74503112023-06-29 17:34:49 +0800696 hostapd_add_rate brlist "$br"
697 done
698
699+ json_get_vars rssi_reject_assoc_timeout
700 [ -n "$rssi_reject_assoc_rssi" ] && append base_cfg "rssi_reject_assoc_rssi=$rssi_reject_assoc_rssi" "$N"
701 [ -n "$rssi_ignore_probe_request" ] && append base_cfg "rssi_ignore_probe_request=$rssi_ignore_probe_request" "$N"
702+ [ -n "$rssi_reject_assoc_timeout" ] && append base_cfg "rssi_reject_assoc_timeout=$rssi_reject_assoc_timeout" "$N"
703 [ -n "$beacon_rate" ] && append base_cfg "beacon_rate=$beacon_rate" "$N"
704 [ -n "$rlist" ] && append base_cfg "supported_rates=$rlist" "$N"
705 [ -n "$brlist" ] && append base_cfg "basic_rates=$brlist" "$N"
developer93607dd2023-08-30 04:53:00 +0800706@@ -383,6 +393,24 @@ hostapd_common_add_bss_config() {
developer82408892023-03-27 15:09:00 +0800707 config_add_string fils_dhcp
708
709 config_add_int ocv
710+
711+ config_add_int disable_eht
712+ config_add_int disable_he
713+ config_add_int disable_vht
714+ config_add_int disable_ht
developer813f5d72023-03-28 17:44:38 +0800715+
developerf166f542023-05-25 14:40:30 +0800716+ config_add_boolean beacon_prot interworking
developer74503112023-06-29 17:34:49 +0800717+
718+ config_add_int unsol_bcast_probe_resp_interval
719+ config_add_int fils_discovery_min_interval
720+ config_add_int fils_discovery_max_interval
721+ config_add_boolean rnr
722+
723+ config_add_array sae_groups
724+ config_add_array owe_groups
725+ config_add_array pairwise
726+ config_add_string group_cipher
727+
developer82408892023-03-27 15:09:00 +0800728 }
729
730 hostapd_set_vlan_file() {
developer93607dd2023-08-30 04:53:00 +0800731@@ -447,11 +475,11 @@ append_iw_nai_realm() {
developerf166f542023-05-25 14:40:30 +0800732 }
733
734 append_iw_venue_name() {
735- append bss_conf "venue_name=$1" "$N"
736+ [ -n "$1" ] && append bss_conf "venue_name=$1" "$N"
737 }
738
739 append_iw_venue_url() {
740- append bss_conf "venue_url=$1" "$N"
741+ [ -n "$1" ] && append bss_conf "venue_url=$1" "$N"
742 }
743
744 append_hs20_oper_friendly_name() {
developer93607dd2023-08-30 04:53:00 +0800745@@ -569,7 +597,8 @@ hostapd_set_bss_options() {
developer74503112023-06-29 17:34:49 +0800746 ppsk airtime_bss_weight airtime_bss_limit airtime_sta_weight \
747 multicast_to_unicast_all proxy_arp per_sta_vif \
748 eap_server eap_user_file ca_cert server_cert private_key private_key_passwd server_id \
749- vendor_elements fils ocv
750+ vendor_elements fils ocv unsol_bcast_probe_resp_interval fils_discovery_min_interval \
751+ fils_discovery_max_interval rnr group_cipher
752
753 set_default fils 0
754 set_default isolate 0
developer93607dd2023-08-30 04:53:00 +0800755@@ -797,6 +826,35 @@ hostapd_set_bss_options() {
developer74503112023-06-29 17:34:49 +0800756 local auth_algs="$((($auth_mode_shared << 1) | $auth_mode_open))"
757 append bss_conf "auth_algs=${auth_algs:-1}" "$N"
758 append bss_conf "wpa=$wpa" "$N"
759+
760+ json_get_values pairwise pairwise
developer9097e5e2023-07-19 10:22:24 +0800761+ if [ -n "$pairwise" ]; then
762+ case "$pairwise" in
763+ *tkip+aes|*tkip+ccmp|*aes+tkip|*ccmp+tkip)
764+ wpa_cipher="CCMP TKIP"
765+ ;;
766+ *ccmp256)
767+ wpa_cipher="CCMP-256"
768+ ;;
769+ *aes|*ccmp)
770+ wpa_cipher="CCMP"
771+ ;;
772+ *tkip)
773+ wpa_cipher="TKIP"
774+ ;;
775+ *gcmp256)
776+ wpa_cipher="GCMP-256"
777+ ;;
778+ *gcmp)
779+ wpa_cipher="GCMP"
780+ ;;
781+ *)
782+ wpa_cipher=""
783+ ;;
784+ esac
785+ fi
developer74503112023-06-29 17:34:49 +0800786+ [ -n "$wpa_cipher" ] && wpa_pairwise="$wpa_cipher"
787+
788 [ -n "$wpa_pairwise" ] && append bss_conf "wpa_pairwise=$wpa_pairwise" "$N"
789
790 set_default wps_pushbutton 0
developer93607dd2023-08-30 04:53:00 +0800791@@ -848,7 +906,7 @@ hostapd_set_bss_options() {
developerda723192023-05-22 19:46:10 +0800792 }
793
794 append bss_conf "ssid=$ssid" "$N"
795- [ -n "$network_bridge" ] && append bss_conf "bridge=$network_bridge${N}wds_bridge=" "$N"
796+ [ -n "$network_bridge" ] && append bss_conf "bridge=$network_bridge${N}wds_bridge=$network_bridge" "$N"
797 [ -n "$network_ifname" ] && append bss_conf "snoop_iface=$network_ifname" "$N"
798 [ -n "$iapp_interface" ] && {
799 local ifname
developer93607dd2023-08-30 04:53:00 +0800800@@ -963,6 +1021,8 @@ hostapd_set_bss_options() {
developer74503112023-06-29 17:34:49 +0800801 fi
802
803 if [ "$wpa" -ge "2" ]; then
804+ json_get_values sae_groups sae_groups
805+ json_get_values owe_groups owe_groups
806 if [ -n "$network_bridge" -a "$rsn_preauth" = 1 ]; then
807 set_default auth_cache 1
808 append bss_conf "rsn_preauth=1" "$N"
developer93607dd2023-08-30 04:53:00 +0800809@@ -981,17 +1041,42 @@ hostapd_set_bss_options() {
developer74503112023-06-29 17:34:49 +0800810 append bss_conf "okc=$auth_cache" "$N"
811 [ "$auth_cache" = 0 -a "$fils" = 0 ] && append bss_conf "disable_pmksa_caching=1" "$N"
812
813+ [ -z "$group_cipher" ] && group_cipher="$wpa_cipher"
814+
815+ if [ -n "$sae_groups" -o -n "$owe_groups" ]; then
816+ case "$auth_type" in
817+ sae*)
818+ append bss_conf "sae_groups=$sae_groups" "$N"
819+ append bss_conf "group_cipher=$group_cipher" "$N"
820+ ;;
821+ owe)
822+ append bss_conf "owe_groups=$owe_groups" "$N"
823+ append bss_conf "group_cipher=$group_cipher" "$N"
824+ ;;
825+ esac
826+ fi
827+
developer813f5d72023-03-28 17:44:38 +0800828 # RSN -> allow management frame protection
829 case "$ieee80211w" in
830 [012])
831- json_get_vars ieee80211w_mgmt_cipher ieee80211w_max_timeout ieee80211w_retry_timeout
832+ json_get_vars ieee80211w_mgmt_cipher ieee80211w_max_timeout ieee80211w_retry_timeout beacon_prot
833 append bss_conf "ieee80211w=$ieee80211w" "$N"
834 [ "$ieee80211w" -gt "0" ] && {
developer74503112023-06-29 17:34:49 +0800835+ case "$group_cipher" in
836+ CCMP*)
837+ ieee80211w_mgmt_cipher="AES-128-CMAC"
838+ ;;
839+ GCMP-256)
840+ [[ "$encryption" != "*owe*" ]] && ieee80211w_mgmt_cipher="BIP-GMAC-256"
841+ ;;
842+ esac
developer813f5d72023-03-28 17:44:38 +0800843 if [ "$auth_type" = "eap192" ]; then
developer74503112023-06-29 17:34:49 +0800844 append bss_conf "group_mgmt_cipher=BIP-GMAC-256" "$N"
developer813f5d72023-03-28 17:44:38 +0800845 else
846 append bss_conf "group_mgmt_cipher=${ieee80211w_mgmt_cipher:-AES-128-CMAC}" "$N"
847 fi
848+ [ -n "$beacon_prot" ] && \
849+ append bss_conf "beacon_prot=$beacon_prot" "$N"
850 [ -n "$ieee80211w_max_timeout" ] && \
851 append bss_conf "assoc_sa_query_max_timeout=$ieee80211w_max_timeout" "$N"
852 [ -n "$ieee80211w_retry_timeout" ] && \
developer93607dd2023-08-30 04:53:00 +0800853@@ -1056,9 +1141,10 @@ hostapd_set_bss_options() {
developerf166f542023-05-25 14:40:30 +0800854 json_get_vars iw_roaming_consortium iw_domain_name iw_anqp_3gpp_cell_net iw_nai_realm
855 json_get_vars iw_anqp_elem iw_qos_map_set iw_ipaddr_type_availability iw_gas_address3
856 json_get_vars iw_venue_name iw_venue_url
857+ json_get_vars interworking
858
859 set_default iw_enabled 0
860- if [ "$iw_enabled" = "1" ]; then
861+ if [ "$iw_enabled" = "1" ] || [ "$interworking" = "1" ]; then
862 append bss_conf "interworking=1" "$N"
863 set_default iw_internet 1
864 set_default iw_asra 0
developer93607dd2023-08-30 04:53:00 +0800865@@ -1165,6 +1251,22 @@ hostapd_set_bss_options() {
developer74503112023-06-29 17:34:49 +0800866 append bss_conf "$val" "$N"
867 done
868
869+ if [ "$unsol_bcast_probe_resp_interval" -gt 0 ]; then
870+ append bss_conf "unsol_bcast_probe_resp_interval=$unsol_bcast_probe_resp_interval" "$N"
871+ fi
872+
873+ if [ -n "$fils_discovery_min_interval" ]; then
874+ append bss_conf "fils_discovery_min_interval=$fils_discovery_min_interval" "$N"
875+ fi
876+
877+ if [ -n "$fils_discovery_max_interval" ]; then
878+ append bss_conf "fils_discovery_max_interval=$fils_discovery_max_interval" "$N"
879+ fi
880+
881+ if [ -n "$rnr" ]; then
882+ append bss_conf "rnr=$rnr" "$N"
883+ fi
884+
developer5b3b7a92023-08-12 03:41:52 +0800885 append "$var" "$bss_conf" "$N"
886 return 0
887 }
developer93607dd2023-08-30 04:53:00 +0800888@@ -1252,6 +1354,7 @@ wpa_supplicant_prepare_interface() {
developer18015ad2023-07-13 13:18:19 +0800889 country_str="country=$country"
890 }
891
developer2cf3f4c2023-07-24 16:58:25 +0800892+ local tx_queue_data2_burst="tx_queue_data2_burst=0"
developer18015ad2023-07-13 13:18:19 +0800893 multiap_flag_file="${_config}.is_multiap"
894 if [ "$multi_ap" = "1" ]; then
895 touch "$multiap_flag_file"
developer93607dd2023-08-30 04:53:00 +0800896@@ -1263,6 +1366,7 @@ wpa_supplicant_prepare_interface() {
developer18015ad2023-07-13 13:18:19 +0800897 ${scan_list:+freq_list=$scan_list}
898 $ap_scan
899 $country_str
900+$tx_queue_data2_burst
901 EOF
902 return 0
903 }
developer93607dd2023-08-30 04:53:00 +0800904@@ -1534,12 +1638,38 @@ wpa_supplicant_add_network() {
developer74503112023-06-29 17:34:49 +0800905 ;;
906 esac
907
developerbb29b5e2023-07-25 20:41:04 +0800908- [ "$wpa_cipher" = GCMP ] && {
909- append network_data "pairwise=GCMP" "$N$T"
910- append network_data "group=GCMP" "$N$T"
911- }
developer74503112023-06-29 17:34:49 +0800912+ json_get_values pairwise pairwise
developer9097e5e2023-07-19 10:22:24 +0800913+ if [ -n "$pairwise" ]; then
914+ case "$pairwise" in
915+ *tkip+aes|*tkip+ccmp|*aes+tkip|*ccmp+tkip)
916+ wpa_cipher="CCMP TKIP"
917+ ;;
918+ *ccmp256)
919+ wpa_cipher="CCMP-256"
920+ ;;
921+ *aes|*ccmp)
922+ wpa_cipher="CCMP"
923+ ;;
924+ *tkip)
925+ wpa_cipher="TKIP"
926+ ;;
927+ *gcmp256)
928+ wpa_cipher="GCMP-256"
929+ ;;
930+ *gcmp)
931+ wpa_cipher="GCMP"
932+ ;;
933+ *)
934+ wpa_cipher=""
935+ ;;
936+ esac
937+ fi
developer74503112023-06-29 17:34:49 +0800938+ [ -n "$wpa_cipher" ] && wpa_pairwise="$wpa_cipher"
developer74503112023-06-29 17:34:49 +0800939
940 [ "$mode" = mesh ] || {
941+ json_get_values sae_groups sae_groups
942+ json_get_values owe_groups owe_groups
943+
944 case "$wpa" in
945 1)
946 append network_data "proto=WPA" "$N$T"
developer93607dd2023-08-30 04:53:00 +0800947@@ -1549,12 +1679,48 @@ wpa_supplicant_add_network() {
developer74503112023-06-29 17:34:49 +0800948 ;;
949 esac
950
951+ [ -n "$wpa_pairwise" ] && append network_data "pairwise=$wpa_pairwise" "$N$T"
952+ [ -z "$group_cipher" ] && group_cipher="$wpa_cipher"
953+
954+ if [ -n "$sae_groups" -o -n "$owe_groups" ]; then
955+ case "$auth_type" in
956+ sae*)
957+ echo "sae_groups=$sae_groups" >> "$_config"
958+ append network_data "group=$group_cipher" "$N$T"
959+ ;;
960+ owe)
961+ append network_data "owe_group=$owe_groups" "$N$T"
962+ append network_data "group=$group_cipher" "$N$T"
963+ ;;
964+ esac
965+ fi
966+
967+ # RSN -> allow management frame protection
968 case "$ieee80211w" in
969 [012])
970- [ "$wpa" -ge 2 ] && append network_data "ieee80211w=$ieee80211w" "$N$T"
971+ json_get_vars ieee80211w_mgmt_cipher ieee80211w_max_timeout ieee80211w_retry_timeout beacon_prot
972+ append network_data "ieee80211w=$ieee80211w" "$N$T"
973+ [ "$ieee80211w" -gt "0" ] && {
974+ case "$group_cipher" in
975+ CCMP*)
976+ ieee80211w_mgmt_cipher="AES-128-CMAC"
977+ ;;
978+ GCMP-256)
979+ [[ "$encryption" != "*owe*" ]] && ieee80211w_mgmt_cipher="BIP-GMAC-256"
980+ ;;
981+ esac
982+ if [ "$auth_type" = "eap192" ]; then
983+ append network_data "group_mgmt=BIP-GMAC-256" "$N$T"
984+ else
985+ append network_data "group_mgmt=${ieee80211w_mgmt_cipher:-AES-128-CMAC}" "$N$T"
986+ fi
987+ [ -n "$beacon_prot" ] && \
988+ append network_data "beacon_prot=$beacon_prot" "$N$T"
989+ }
990 ;;
991 esac
992 }
993+
994 [ -n "$bssid" ] && append network_data "bssid=$bssid" "$N$T"
995 [ -n "$beacon_int" ] && append network_data "beacon_int=$beacon_int" "$N$T"
996
developer93607dd2023-08-30 04:53:00 +0800997@@ -1565,6 +1731,20 @@ wpa_supplicant_add_network() {
developer82408892023-03-27 15:09:00 +0800998 [ -n "$bssid_blacklist" ] && append network_data "bssid_blacklist=$bssid_blacklist" "$N$T"
999 [ -n "$bssid_whitelist" ] && append network_data "bssid_whitelist=$bssid_whitelist" "$N$T"
1000
1001+ local disable_eht
1002+ local disable_he
1003+ local disable_vht
1004+ local disable_ht
1005+ json_get_vars disable_eht
1006+ json_get_vars disable_he
1007+ json_get_vars disable_vht
1008+ json_get_vars disable_ht
1009+
1010+ [ -n "$disable_eht" ] && append network_data "disable_eht=$disable_eht" "$N$T"
1011+ [ -n "$disable_he" ] && append network_data "disable_he=$disable_he" "$N$T"
1012+ [ -n "$disable_vht" ] && append network_data "disable_vht=$disable_vht" "$N$T"
1013+ [ -n "$disable_ht" ] && append network_data "disable_ht=$disable_ht" "$N$T"
1014+
1015 [ -n "$basic_rate" ] && {
1016 local br rate_list=
1017 for br in $basic_rate; do
developer93607dd2023-08-30 04:53:00 +08001018@@ -1579,6 +1759,11 @@ wpa_supplicant_add_network() {
developer85839fe2023-02-23 10:32:51 +08001019 append network_data "mcast_rate=$mc_rate" "$N$T"
1020 }
1021
1022+ if [ "$auth_type" = "sae" ]; then
1023+ json_get_vars sae_pwe sae_pwe
1024+ [ -n "$sae_pwe" ] && echo "sae_pwe=$sae_pwe" >> "$_config"
1025+ fi
1026+
1027 if [ "$key_mgmt" = "WPS" ]; then
1028 echo "wps_cred_processing=1" >> "$_config"
1029 else