blob: 540dff6b9f791c06d88bd31231f15334b4a7da45 [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
developer5ad89862023-08-24 08:17:27 +080035index ed28052..13c385f 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
developer2c6592a2023-07-21 11:20:56 +080042+ config_add_int mbssid mu_onoff sr_enable sr_enhanced rnr
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
developer2c6592a2023-07-21 11:20:56 +080063+ json_get_vars noscan ht_coex min_tx_power:0 tx_burst mbssid mu_onoff rnr
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
developer785b6502023-04-19 18:31:11 +080074@@ -160,8 +162,8 @@ mac80211_hostapd_setup_base() {
75 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
developerbe3cf972023-04-27 09:58:26 +080085@@ -171,8 +173,22 @@ mac80211_hostapd_setup_base() {
86 ;;
87 *)
88 case "$htmode" in
89- HT40+) ht_capab="[HT40+]";;
90- HT40-) ht_capab="[HT40-]";;
91+ HT40+|HE40+|EHT40+)
92+ if [ "$channel" -gt 9 ]; then
93+ echo "Could not set the center freq with this HT mode setting"
94+ return 1
95+ else
96+ ht_capab="[HT40+]"
97+ fi
98+ ;;
99+ HT40-|HE40-|EHT40-)
100+ if [ "$channel" -lt 5 ]; then
101+ echo "Could not set the center freq with this HT mode setting"
102+ return 1
103+ else
104+ ht_capab="[HT40-]"
105+ fi
106+ ;;
107 *)
108 if [ "$channel" -lt 7 ]; then
109 ht_capab="[HT40+]"
110@@ -205,7 +221,7 @@ mac80211_hostapd_setup_base() {
developer785b6502023-04-19 18:31:11 +0800111 dsss_cck_40:1
112
113 ht_cap_mask=0
114- for cap in $(iw phy "$phy" info | grep 'Capabilities:' | cut -d: -f2); do
115+ for cap in $(iw phy "$phy" info | grep 'Capabilities: 0x' | cut -d: -f2); do
116 ht_cap_mask="$(($ht_cap_mask | $cap))"
117 done
118
developerbe3cf972023-04-27 09:58:26 +0800119@@ -236,8 +252,8 @@ mac80211_hostapd_setup_base() {
developer785b6502023-04-19 18:31:11 +0800120
121 idx="$channel"
122 case "$htmode" in
123- VHT20|HE20) enable_ac=1;;
124- VHT40|HE40)
125+ VHT20|HE20|EHT20) enable_ac=1;;
126+ VHT40|HE40|EHT40)
127 case "$(( (($channel / 4) + $chan_ofs) % 2 ))" in
128 1) idx=$(($channel + 2));;
129 0) idx=$(($channel - 2));;
developerbe3cf972023-04-27 09:58:26 +0800130@@ -245,7 +261,7 @@ mac80211_hostapd_setup_base() {
developer785b6502023-04-19 18:31:11 +0800131 enable_ac=1
132 vht_center_seg0=$idx
133 ;;
134- VHT80|HE80)
135+ VHT80|HE80|EHT80)
136 case "$(( (($channel / 4) + $chan_ofs) % 4 ))" in
137 1) idx=$(($channel + 6));;
138 2) idx=$(($channel + 2));;
developerbe3cf972023-04-27 09:58:26 +0800139@@ -256,7 +272,7 @@ mac80211_hostapd_setup_base() {
developer785b6502023-04-19 18:31:11 +0800140 vht_oper_chwidth=1
141 vht_center_seg0=$idx
142 ;;
143- VHT160|HE160)
144+ VHT160|HE160|EHT160)
145 if [ "$band" = "6g" ]; then
146 case "$channel" in
147 1|5|9|13|17|21|25|29) idx=15;;
developeradd8de62023-05-02 16:25:52 +0800148@@ -271,12 +287,43 @@ mac80211_hostapd_setup_base() {
149 case "$channel" in
150 36|40|44|48|52|56|60|64) idx=50;;
151 100|104|108|112|116|120|124|128) idx=114;;
152+ 149|153|157|161|165|169|173|177) idx=163;;
153 esac
154 fi
155 enable_ac=1
developer785b6502023-04-19 18:31:11 +0800156 vht_oper_chwidth=2
157 vht_center_seg0=$idx
158 ;;
159+ EHT320*)
160+ case "$channel" in
161+ 1|5|9|13|17|21|25|29) idx=31;;
162+ 33|37|41|45|49|53|57|61| \
163+ 65|69|73|77|81|85|89|93) idx=63;;
164+ 97|101|105|109|113|117|121|125| \
165+ 129|133|137|141|145|149|153|157) idx=127;;
166+ 161|165|169|173|177|181|185|189| \
167+ 193|197|201|205|209|213|217|221) idx=191;;
168+ esac
169+ if [[ "$htmode" = "EHT320-1" && "$channel" -ge "193" ]] ||
170+ [[ "$htmode" = "EHT320-2" && "$channel" -le "29" ]]; then
171+ echo "Could not set the center freq with this EHT setting"
172+ return 1
173+ elif [[ "$htmode" = "EHT320-1" && "$channel" -ge "33" ]]; then
174+ if [ "$channel" -gt $idx ]; then
175+ idx=$(($idx + 32))
176+ else
177+ idx=$(($idx - 32))
178+ fi
179+ fi
180+ vht_oper_chwidth=2
181+ if [ "$channel" -gt $idx ]; then
182+ vht_center_seg0=$(($idx + 16))
183+ else
184+ vht_center_seg0=$(($idx - 16))
185+ fi
186+ eht_oper_chwidth=9
187+ eht_oper_centr_freq_seg0_idx=$idx
188+ ;;
189 esac
190 [ "$band" = "5g" ] && {
191 json_get_vars background_radar:0
developeradd8de62023-05-02 16:25:52 +0800192@@ -286,8 +333,9 @@ mac80211_hostapd_setup_base() {
developer785b6502023-04-19 18:31:11 +0800193 [ "$band" = "6g" ] && {
194 op_class=
195 case "$htmode" in
196- HE20) op_class=131;;
197- HE*) op_class=$((132 + $vht_oper_chwidth))
198+ HE20|EHT20) op_class=131;;
199+ EHT320*) op_class=137;;
200+ HE*|EHT*) op_class=$((132 + $vht_oper_chwidth))
201 esac
202 [ -n "$op_class" ] && append base_cfg "op_class=$op_class" "$N"
203 }
developeradd8de62023-05-02 16:25:52 +0800204@@ -315,7 +363,6 @@ mac80211_hostapd_setup_base() {
developer8b04dfd2022-12-07 16:29:19 +0800205 vht_link_adapt:3 \
206 vht160:2
207
208- set_default tx_burst 2.0
209 append base_cfg "ieee80211ac=1" "$N"
210 vht_cap=0
211 for cap in $(iw phy "$phy" info | awk -F "[()]" '/VHT Capabilities/ { print $2 }'); do
developeradd8de62023-05-02 16:25:52 +0800212@@ -329,6 +376,12 @@ mac80211_hostapd_setup_base() {
developer785b6502023-04-19 18:31:11 +0800213 [ "$rx_stbc" -lt "$cap_rx_stbc" ] && cap_rx_stbc="$rx_stbc"
214 vht_cap="$(( ($vht_cap & ~(0x700)) | ($cap_rx_stbc << 8) ))"
215
216+ [ "$etxbfen" -eq 0 ] && {
217+ su_beamformer=0
218+ su_beamformee=0
219+ mu_beamformer=0
220+ }
221+
222 mac80211_add_capabilities vht_capab $vht_cap \
223 RXLDPC:0x10::$rxldpc \
224 SHORT-GI-80:0x20::$short_gi_80 \
developeradd8de62023-05-02 16:25:52 +0800225@@ -410,7 +463,7 @@ mac80211_hostapd_setup_base() {
developer785b6502023-04-19 18:31:11 +0800226 # 802.11ax
227 enable_ax=0
228 case "$htmode" in
229- HE*) enable_ax=1 ;;
230+ HE*|EHT*) enable_ax=1 ;;
231 esac
232
233 if [ "$enable_ax" != "0" ]; then
developeradd8de62023-05-02 16:25:52 +0800234@@ -419,10 +472,11 @@ mac80211_hostapd_setup_base() {
developer785b6502023-04-19 18:31:11 +0800235 he_su_beamformee:1 \
236 he_mu_beamformer:1 \
237 he_twt_required:0 \
238+ he_twt_responder \
239 he_spr_sr_control:3 \
240 he_spr_psr_enabled:0 \
241 he_spr_non_srg_obss_pd_max_offset:0 \
242- he_bss_color:128 \
243+ he_bss_color \
244 he_bss_color_enabled:1
245
246 he_phy_cap=$(iw phy "$phy" info | sed -n '/HE Iftypes: AP/,$p' | awk -F "[()]" '/HE PHY Capabilities/ { print $2 }' | head -1)
developeradd8de62023-05-02 16:25:52 +0800247@@ -436,6 +490,11 @@ mac80211_hostapd_setup_base() {
developer785b6502023-04-19 18:31:11 +0800248 append base_cfg "he_oper_centr_freq_seg0_idx=$vht_center_seg0" "$N"
249 }
250
251+ [ "$etxbfen" -eq 0 ] && {
252+ he_su_beamformer=0
253+ he_mu_beamformer=0
254+ }
255+
256 mac80211_add_he_capabilities \
257 he_su_beamformer:${he_phy_cap:6:2}:0x80:$he_su_beamformer \
258 he_su_beamformee:${he_phy_cap:8:2}:0x1:$he_su_beamformee \
developeradd8de62023-05-02 16:25:52 +0800259@@ -443,7 +502,14 @@ mac80211_hostapd_setup_base() {
developer785b6502023-04-19 18:31:11 +0800260 he_spr_psr_enabled:${he_phy_cap:14:2}:0x1:$he_spr_psr_enabled \
261 he_twt_required:${he_mac_cap:0:2}:0x6:$he_twt_required
262
263+ if [ -n "$he_twt_responder" ]; then
264+ append base_cfg "he_twt_responder=$he_twt_responder" "$N"
265+ fi
266 if [ "$he_bss_color_enabled" -gt 0 ]; then
developer830efa72023-05-18 19:32:48 +0800267+ if !([ "$he_bss_color" -gt 0 ] && [ "$he_bss_color" -le 64 ]); then
developer785b6502023-04-19 18:31:11 +0800268+ rand=$(head -n 1 /dev/urandom | tr -dc 0-9 | head -c 2)
269+ he_bss_color=$((rand % 63 + 1))
270+ fi
271 append base_cfg "he_bss_color=$he_bss_color" "$N"
272 [ "$he_spr_non_srg_obss_pd_max_offset" -gt 0 ] && { \
273 append base_cfg "he_spr_non_srg_obss_pd_max_offset=$he_spr_non_srg_obss_pd_max_offset" "$N"
developer2c6592a2023-07-21 11:20:56 +0800274@@ -484,12 +550,47 @@ mac80211_hostapd_setup_base() {
developer8b04dfd2022-12-07 16:29:19 +0800275 append base_cfg "he_mu_edca_ac_vo_timer=255" "$N"
276 fi
277
developer18015ad2023-07-13 13:18:19 +0800278+ set_default tx_burst 2
developer8b04dfd2022-12-07 16:29:19 +0800279+
developer785b6502023-04-19 18:31:11 +0800280+ # 802.11be
281+ enable_be=0
282+ case "$htmode" in
283+ EHT*) enable_be=1 ;;
284+ esac
285+
286+ if [ "$enable_be" != "0" ]; then
287+ append base_cfg "ieee80211be=1" "$N"
288+ if [ "$etxbfen" -eq 0 ]; then
289+ append base_cfg "eht_su_beamformee=1" "$N"
290+ else
291+ append base_cfg "eht_su_beamformer=1" "$N"
292+ append base_cfg "eht_su_beamformee=1" "$N"
293+ append base_cfg "eht_mu_beamformer=1" "$N"
294+ fi
295+ [ "$hwmode" = "a" ] && {
296+ case $htmode in
297+ EHT320*)
298+ append base_cfg "eht_oper_chwidth=$eht_oper_chwidth" "$N"
299+ append base_cfg "eht_oper_centr_freq_seg0_idx=$eht_oper_centr_freq_seg0_idx" "$N"
300+ ;;
301+ *)
302+ append base_cfg "eht_oper_chwidth=$vht_oper_chwidth" "$N"
303+ append base_cfg "eht_oper_centr_freq_seg0_idx=$vht_center_seg0" "$N"
304+ ;;
305+ esac
306+ }
307+ fi
308+
developer8b04dfd2022-12-07 16:29:19 +0800309 hostapd_prepare_device_config "$hostapd_conf_file" nl80211
310 cat >> "$hostapd_conf_file" <<EOF
311 ${channel:+channel=$channel}
developer0ba09b62023-03-10 18:43:49 +0800312 ${channel_list:+chanlist=$channel_list}
313 ${hostapd_noscan:+noscan=1}
314 ${tx_burst:+tx_queue_data2_burst=$tx_burst}
315+${mbssid:+mbssid=$mbssid}
developer785b6502023-04-19 18:31:11 +0800316+${mu_onoff:+mu_onoff=$mu_onoff}
317+${itxbfen:+ibf_enable=$itxbfen}
developer2c6592a2023-07-21 11:20:56 +0800318+${rnr:+rnr=$rnr}
developer0ba09b62023-03-10 18:43:49 +0800319 $base_cfg
320
321 EOF
developer2c6592a2023-07-21 11:20:56 +0800322@@ -517,7 +618,7 @@ mac80211_hostapd_setup_bss() {
developer093e1a32023-02-24 16:10:53 +0800323 append hostapd_cfg "wds_sta=1" "$N"
324 [ -n "$wds_bridge" ] && append hostapd_cfg "wds_bridge=$wds_bridge" "$N"
325 }
326- [ "$staidx" -gt 0 -o "$start_disabled" -eq 1 ] && append hostapd_cfg "start_disabled=1" "$N"
327+ [ "$start_disabled" -eq 1 ] && append hostapd_cfg "start_disabled=1" "$N"
328
329 cat >> /var/run/hostapd-$phy.conf <<EOF
330 $hostapd_cfg
developer2c6592a2023-07-21 11:20:56 +0800331@@ -527,6 +628,31 @@ ${max_listen_int:+max_listen_interval=$max_listen_int}
developer0ba09b62023-03-10 18:43:49 +0800332 EOF
333 }
334
335+mac80211_generate_mbssid_mac() {
336+ local phy="$1"
337+ local transmitted_bssid="$2"
developer1952bcd2023-06-20 20:14:37 +0800338+ local id="${mbssidx:-0}"
developer0ba09b62023-03-10 18:43:49 +0800339+
340+ local ref="$(cat /sys/class/ieee80211/${phy}/macaddress)"
developer0ba09b62023-03-10 18:43:49 +0800341+
342+ if [ -z "$transmitted_bssid" ]; then
343+ transmitted_bssid=$ref
344+ fi
345+
346+ if [ $id -eq 0 ]; then
347+ echo "$transmitted_bssid"
348+ return
349+ fi
350+
351+ local oIFS="$IFS"; IFS=":"; set -- $transmitted_bssid; IFS="$oIFS"
352+
353+ # Calculate nontransmitted bssid
developer0ba09b62023-03-10 18:43:49 +0800354+ b6="0x$6"
355+ ref_b6=$(($b6 % $max_mbssid))
developer1952bcd2023-06-20 20:14:37 +0800356+ b6=$(($b6 - $ref_b6 + ($ref_b6 + $id) % $max_mbssid))
developer0ba09b62023-03-10 18:43:49 +0800357+ printf "%s:%s:%s:%s:%s:%02x" $1 $2 $3 $4 $5 $b6
358+}
359+
360 mac80211_get_addr() {
361 local phy="$1"
362 local idx="$(($2 + 1))"
developer2c6592a2023-07-21 11:20:56 +0800363@@ -757,7 +883,19 @@ mac80211_prepare_vif() {
developer0ba09b62023-03-10 18:43:49 +0800364
365 json_select ..
366
367- if [ -z "$macaddr" ]; then
developerd2fbd572023-06-19 19:48:25 +0800368+ if [ "$mbssid" -gt 0 ] && [ "$mode" == "ap" ]; then
developer1952bcd2023-06-20 20:14:37 +0800369+ [ "$mbssidx" -eq 0 ] && {
370+ if [ -z $macaddr ]; then
371+ transmitted_bssid="$(mac80211_generate_mac $phy)"
372+ else
373+ # uci set mac address
374+ transmitted_bssid=$macaddr
375+ fi
376+ macidx="$(($macidx + 1))"
developer0ba09b62023-03-10 18:43:49 +0800377+ }
378+ macaddr="$(mac80211_generate_mbssid_mac $phy $transmitted_bssid)"
developer1952bcd2023-06-20 20:14:37 +0800379+ mbssidx="$(($mbssidx + 1))"
developer0ba09b62023-03-10 18:43:49 +0800380+ elif [ -z "$macaddr" ]; then
381 macaddr="$(mac80211_generate_mac $phy)"
382 macidx="$(($macidx + 1))"
383 elif [ "$macaddr" = 'random' ]; then
developer2c6592a2023-07-21 11:20:56 +0800384@@ -1058,6 +1196,9 @@ mac80211_setup_vif() {
developerf0de14b2022-12-14 23:07:34 +0800385
386 json_select ..
387 [ -n "$failed" ] || wireless_add_vif "$name" "$ifname"
388+
389+ echo "Setup SMP Affinity"
390+ /sbin/smp-mt76.sh
391 }
392
393 get_freq() {
developer2c6592a2023-07-21 11:20:56 +0800394@@ -1122,6 +1263,10 @@ drv_mac80211_cleanup() {
developer0ba09b62023-03-10 18:43:49 +0800395 hostapd_common_cleanup
396 }
397
398+mac80211_count_ap() {
399+ total_num_ap=$(($total_num_ap + 1))
400+}
401+
402 drv_mac80211_setup() {
403 json_select config
404 json_get_vars \
developer2c6592a2023-07-21 11:20:56 +0800405@@ -1129,7 +1274,8 @@ drv_mac80211_setup() {
developer74503112023-06-29 17:34:49 +0800406 country chanbw distance \
407 txpower antenna_gain \
408 rxantenna txantenna \
409- frag rts beacon_int:100 htmode
410+ frag rts beacon_int:100 htmode \
411+ sr_enable sr_enhanced
412 json_get_values basic_rate_list basic_rate
413 json_get_values scan_list scan_list
414 json_select ..
developer2c6592a2023-07-21 11:20:56 +0800415@@ -1180,6 +1326,7 @@ drv_mac80211_setup() {
developer1952bcd2023-06-20 20:14:37 +0800416 no_ap=1
417 macidx=0
418 staidx=0
419+ mbssidx=0
420
421 [ -n "$chanbw" ] && {
422 for file in /sys/kernel/debug/ieee80211/$phy/ath9k*/chanbw /sys/kernel/debug/ieee80211/$phy/ath5k/bwmode; do
developer2c6592a2023-07-21 11:20:56 +0800423@@ -1219,6 +1366,16 @@ drv_mac80211_setup() {
developer0ba09b62023-03-10 18:43:49 +0800424 for_each_interface "sta adhoc mesh" mac80211_set_noscan
425 [ -n "$has_ap" ] && mac80211_hostapd_setup_base "$phy"
426
427+ total_num_ap=0
428+ max_mbssid=1
429+ for_each_interface "ap" mac80211_count_ap
430+ total_num_ap=$(($total_num_ap - 1))
431+ while [ $total_num_ap -gt 0 ]
432+ do
433+ total_num_ap=$(($total_num_ap >> 1))
434+ max_mbssid=$(($max_mbssid << 1))
435+ done
436+
437 mac80211_prepare_iw_htmode
438 for_each_interface "sta adhoc mesh monitor" mac80211_prepare_vif
439 NEWAPLIST=
developer2c6592a2023-07-21 11:20:56 +0800440@@ -1251,6 +1408,14 @@ drv_mac80211_setup() {
developerad1f3172023-05-02 11:10:08 +0800441 if [ "$no_reload" != "0" ]; then
442 add_ap=1
443 ubus wait_for hostapd
444+
445+ # each phy sleeps different times to prevent for ubus race condition.
446+ if [ "$phy" = "phy1" ]; then
447+ sleep 1;
448+ elif [ "$phy" = "phy2" ]; then
449+ sleep 2;
450+ fi
451+
452 local hostapd_res="$(ubus call hostapd config_add "{\"iface\":\"$primary_ap\", \"config\":\"${hostapd_conf_file}\"}")"
453 ret="$?"
454 [ "$ret" != 0 -o -z "$hostapd_res" ] && {
developer2c6592a2023-07-21 11:20:56 +0800455@@ -1266,6 +1431,9 @@ drv_mac80211_setup() {
developer74503112023-06-29 17:34:49 +0800456 [ "${add_ap}" = 1 ] && sleep 1
457 for_each_interface "ap" mac80211_setup_vif
458
459+ [ -n "$sr_enable" ] && echo "$sr_enable" > /sys/kernel/debug/ieee80211/$phy/mt76/sr_enable
460+ [ -n "$sr_enhanced" ] && echo "$sr_enhanced" > /sys/kernel/debug/ieee80211/$phy/mt76/sr_enhanced_enable
461+
462 NEWSPLIST=
463 NEWUMLIST=
464
developer9b3248d2022-07-06 00:44:05 +0800465diff --git a/package/kernel/mac80211/files/lib/wifi/mac80211.sh b/package/kernel/mac80211/files/lib/wifi/mac80211.sh
developer5ad89862023-08-24 08:17:27 +0800466index 3ecd932..69ecbbf 100644
developere2597ba2022-06-24 13:09:16 +0800467--- a/package/kernel/mac80211/files/lib/wifi/mac80211.sh
468+++ b/package/kernel/mac80211/files/lib/wifi/mac80211.sh
developer20ce7bd2023-05-20 13:25:14 +0800469@@ -60,6 +60,9 @@ BEGIN {
developer785b6502023-04-19 18:31:11 +0800470 if (vht && band != "1:") mode="VHT80"
471 if (he) mode="HE80"
472 if (he && band == "1:") mode="HE20"
developer20ce7bd2023-05-20 13:25:14 +0800473+ if (eht && band == "2:") mode="EHT160"
474+ if (eht && band == "4:") mode="EHT320"
developer785b6502023-04-19 18:31:11 +0800475+ if (eht && band == "1:") mode="EHT20"
476 sub("\\[", "", channel)
477 sub("\\]", "", channel)
478 bands = bands band channel ":" mode " "
developer20ce7bd2023-05-20 13:25:14 +0800479@@ -73,6 +76,7 @@ $1 == "Band" {
developer785b6502023-04-19 18:31:11 +0800480 vht = ""
481 ht = ""
482 he = ""
483+ eht = ""
484 }
485
486 $0 ~ "Capabilities:" {
developer20ce7bd2023-05-20 13:25:14 +0800487@@ -87,6 +91,18 @@ $0 ~ "HE Iftypes" {
developer785b6502023-04-19 18:31:11 +0800488 he=1
489 }
490
491+$0 ~ "EHT Iftypes" {
492+ eht=1
493+}
494+
developer20ce7bd2023-05-20 13:25:14 +0800495+$0 ~ / *HE MAC Capabilities \(0x000000000000\)/ {
496+ he=0
497+}
498+
499+$0 ~ / *EHT MAC Capabilities \(0x0000\)/ {
500+ eht=0
501+}
502+
developer785b6502023-04-19 18:31:11 +0800503 $1 == "*" && $3 == "MHz" && $0 !~ /disabled/ && band && !channel {
504 channel = $4
505 }
developer2c6592a2023-07-21 11:20:56 +0800506@@ -120,6 +136,19 @@ get_band_defaults() {
developere2597ba2022-06-24 13:09:16 +0800507 mode_band="$band"
508 channel="$chan"
509 htmode="$mode"
510+ if [ "$band" = "6g" ]
511+ then
512+ encryption=sae
513+ key=12345678
developer20ce7bd2023-05-20 13:25:14 +0800514+ sae_pwe=2
515+ ieee80211w=2
developeradbb45b2023-06-09 14:43:01 +0800516+ channel=37
517+ mbssid=1
developere2597ba2022-06-24 13:09:16 +0800518+ else
developer659b07e2023-05-25 12:34:13 +0800519+ noscan=1
developere2597ba2022-06-24 13:09:16 +0800520+ encryption=none
developer2c6592a2023-07-21 11:20:56 +0800521+ rnr=1
developere2597ba2022-06-24 13:09:16 +0800522+ fi
523 done
524 }
525
developer2c6592a2023-07-21 11:20:56 +0800526@@ -153,6 +182,10 @@ detect_mac80211() {
developer785b6502023-04-19 18:31:11 +0800527
528 json_load_file /etc/board.json
529
530+ # generate random bytes for macaddr
531+ rand=$(hexdump -C /dev/urandom | head -n 1 &)
532+ killall hexdump
533+
534 for _dev in /sys/class/ieee80211/*; do
535 [ -e "$_dev" ] || continue
536
developer2c6592a2023-07-21 11:20:56 +0800537@@ -162,6 +195,13 @@ detect_mac80211() {
developere2597ba2022-06-24 13:09:16 +0800538 channel=""
539 htmode=""
540 ht_capab=""
541+ encryption=""
developer659b07e2023-05-25 12:34:13 +0800542+ noscan=""
developere2597ba2022-06-24 13:09:16 +0800543+ key=""
developer09257932023-05-09 13:41:30 +0800544+ sae_pwe=""
developer20ce7bd2023-05-20 13:25:14 +0800545+ ieee80211w=""
developeradbb45b2023-06-09 14:43:01 +0800546+ mbssid=""
developer2c6592a2023-07-21 11:20:56 +0800547+ rnr=""
developere2597ba2022-06-24 13:09:16 +0800548
549 get_band_defaults "$dev"
550
developer5ad89862023-08-24 08:17:27 +0800551@@ -192,6 +232,14 @@ detect_mac80211() {
developer785b6502023-04-19 18:31:11 +0800552 ;;
553 esac
554
developer212c0d82023-07-13 19:41:47 +0800555+ macaddr=""
developer1325ba72023-06-26 13:43:31 +0800556+ if (dmesg | grep -q "eeprom load fail"); then
developer1952bcd2023-06-20 20:14:37 +0800557+ for i in $(seq 2 3); do
558+ macaddr=${macaddr}:$(echo $rand | cut -d ' ' -f $i)
559+ done
560+ macaddr="00:0$(($devidx - 1)):55:66${macaddr}"
developer1952bcd2023-06-20 20:14:37 +0800561+ fi
developer785b6502023-04-19 18:31:11 +0800562+
563 uci -q batch <<-EOF
564 set wireless.${name}=wifi-device
565 set wireless.${name}.type=mac80211
developer5ad89862023-08-24 08:17:27 +0800566@@ -199,15 +247,40 @@ detect_mac80211() {
developer09257932023-05-09 13:41:30 +0800567 set wireless.${name}.channel=${channel}
568 set wireless.${name}.band=${mode_band}
569 set wireless.${name}.htmode=$htmode
570- set wireless.${name}.disabled=1
developer20ce7bd2023-05-20 13:25:14 +0800571+ set wireless.${name}.country='US'
developer659b07e2023-05-25 12:34:13 +0800572+ set wireless.${name}.noscan=${noscan}
developer09257932023-05-09 13:41:30 +0800573+ set wireless.${name}.disabled=0
developeradbb45b2023-06-09 14:43:01 +0800574+EOF
575+ [ -n "$mbssid" ] && {
576+ uci -q set wireless.${name}.mbssid=${mbssid}
577+ }
developer2c6592a2023-07-21 11:20:56 +0800578+ [ -n "$rnr" ] && {
579+ uci -q set wireless.${name}.rnr=${rnr}
580+ }
developer09257932023-05-09 13:41:30 +0800581
developeradbb45b2023-06-09 14:43:01 +0800582+ uci -q batch <<-EOF
developer09257932023-05-09 13:41:30 +0800583 set wireless.default_${name}=wifi-iface
584 set wireless.default_${name}.device=${name}
developer8d77be32022-10-20 15:08:25 +0800585 set wireless.default_${name}.network=lan
586 set wireless.default_${name}.mode=ap
developer09257932023-05-09 13:41:30 +0800587- set wireless.default_${name}.ssid=OpenWrt
developer8d77be32022-10-20 15:08:25 +0800588- set wireless.default_${name}.encryption=none
developer09257932023-05-09 13:41:30 +0800589+ set wireless.default_${name}.ssid=OpenWrt-${mode_band}
developer8d77be32022-10-20 15:08:25 +0800590+ set wireless.default_${name}.encryption=${encryption}
developere2597ba2022-06-24 13:09:16 +0800591 EOF
developer212c0d82023-07-13 19:41:47 +0800592+
593+ # calibrated board will use eeprom macaddress, not ramdom address
594+ [ -n "$macaddr" ] && {
595+ uci -q set wireless.default_${name}.macaddr=${macaddr}
596+ }
597+
developere2597ba2022-06-24 13:09:16 +0800598+ [ -n "$key" ] && {
developer8d77be32022-10-20 15:08:25 +0800599+ uci -q set wireless.default_${name}.key=${key}
developere2597ba2022-06-24 13:09:16 +0800600+ }
developer09257932023-05-09 13:41:30 +0800601+ [ -n "$sae_pwe" ] && {
602+ uci -q set wireless.default_${name}.sae_pwe=${sae_pwe}
603+ }
developer20ce7bd2023-05-20 13:25:14 +0800604+ [ -n "$ieee80211w" ] && {
605+ uci -q set wireless.default_${name}.ieee80211w=${ieee80211w}
606+ }
developere2597ba2022-06-24 13:09:16 +0800607 uci -q commit wireless
developer8d77be32022-10-20 15:08:25 +0800608 done
609 }
developer85839fe2023-02-23 10:32:51 +0800610diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh
developer5ad89862023-08-24 08:17:27 +0800611index 28bd210..dc315da 100644
developer85839fe2023-02-23 10:32:51 +0800612--- a/package/network/services/hostapd/files/hostapd.sh
613+++ b/package/network/services/hostapd/files/hostapd.sh
developer74503112023-06-29 17:34:49 +0800614@@ -60,7 +60,14 @@ hostapd_append_wpa_key_mgmt() {
615 [ "${ieee80211w:-0}" -gt 0 ] && append wpa_key_mgmt "WPA-EAP-SHA256"
616 ;;
617 sae)
618- append wpa_key_mgmt "SAE"
619+ case "$encryption" in
620+ *sae-ext*)
621+ append wpa_key_mgmt "SAE-EXT-KEY"
622+ ;;
623+ *)
624+ append wpa_key_mgmt "SAE"
625+ ;;
626+ esac
627 [ "${ieee80211r:-0}" -gt 0 ] && append wpa_key_mgmt "FT-SAE"
628 ;;
629 psk-sae)
630@@ -115,6 +122,7 @@ hostapd_common_add_device_config() {
631 config_add_int rts_threshold
632 config_add_int rssi_reject_assoc_rssi
633 config_add_int rssi_ignore_probe_request
634+ config_add_int rssi_reject_assoc_timeout
635 config_add_int maxassoc
636
637 config_add_string acs_chan_bias
developer5ad89862023-08-24 08:17:27 +0800638@@ -225,8 +233,10 @@ hostapd_prepare_device_config() {
developer74503112023-06-29 17:34:49 +0800639 hostapd_add_rate brlist "$br"
640 done
641
642+ json_get_vars rssi_reject_assoc_timeout
643 [ -n "$rssi_reject_assoc_rssi" ] && append base_cfg "rssi_reject_assoc_rssi=$rssi_reject_assoc_rssi" "$N"
644 [ -n "$rssi_ignore_probe_request" ] && append base_cfg "rssi_ignore_probe_request=$rssi_ignore_probe_request" "$N"
645+ [ -n "$rssi_reject_assoc_timeout" ] && append base_cfg "rssi_reject_assoc_timeout=$rssi_reject_assoc_timeout" "$N"
646 [ -n "$beacon_rate" ] && append base_cfg "beacon_rate=$beacon_rate" "$N"
647 [ -n "$rlist" ] && append base_cfg "supported_rates=$rlist" "$N"
648 [ -n "$brlist" ] && append base_cfg "basic_rates=$brlist" "$N"
developer5ad89862023-08-24 08:17:27 +0800649@@ -376,6 +386,24 @@ hostapd_common_add_bss_config() {
developer82408892023-03-27 15:09:00 +0800650 config_add_string fils_dhcp
651
652 config_add_int ocv
653+
654+ config_add_int disable_eht
655+ config_add_int disable_he
656+ config_add_int disable_vht
657+ config_add_int disable_ht
developer813f5d72023-03-28 17:44:38 +0800658+
developerf166f542023-05-25 14:40:30 +0800659+ config_add_boolean beacon_prot interworking
developer74503112023-06-29 17:34:49 +0800660+
661+ config_add_int unsol_bcast_probe_resp_interval
662+ config_add_int fils_discovery_min_interval
663+ config_add_int fils_discovery_max_interval
664+ config_add_boolean rnr
665+
666+ config_add_array sae_groups
667+ config_add_array owe_groups
668+ config_add_array pairwise
669+ config_add_string group_cipher
670+
developer82408892023-03-27 15:09:00 +0800671 }
672
673 hostapd_set_vlan_file() {
developer5ad89862023-08-24 08:17:27 +0800674@@ -440,11 +468,11 @@ append_iw_nai_realm() {
developerf166f542023-05-25 14:40:30 +0800675 }
676
677 append_iw_venue_name() {
678- append bss_conf "venue_name=$1" "$N"
679+ [ -n "$1" ] && append bss_conf "venue_name=$1" "$N"
680 }
681
682 append_iw_venue_url() {
683- append bss_conf "venue_url=$1" "$N"
684+ [ -n "$1" ] && append bss_conf "venue_url=$1" "$N"
685 }
686
687 append_hs20_oper_friendly_name() {
developer5ad89862023-08-24 08:17:27 +0800688@@ -562,7 +590,8 @@ hostapd_set_bss_options() {
developer74503112023-06-29 17:34:49 +0800689 ppsk airtime_bss_weight airtime_bss_limit airtime_sta_weight \
690 multicast_to_unicast_all proxy_arp per_sta_vif \
691 eap_server eap_user_file ca_cert server_cert private_key private_key_passwd server_id \
692- vendor_elements fils ocv
693+ vendor_elements fils ocv unsol_bcast_probe_resp_interval fils_discovery_min_interval \
694+ fils_discovery_max_interval rnr group_cipher
695
696 set_default fils 0
697 set_default isolate 0
developer5ad89862023-08-24 08:17:27 +0800698@@ -790,6 +819,35 @@ hostapd_set_bss_options() {
developer74503112023-06-29 17:34:49 +0800699 local auth_algs="$((($auth_mode_shared << 1) | $auth_mode_open))"
700 append bss_conf "auth_algs=${auth_algs:-1}" "$N"
701 append bss_conf "wpa=$wpa" "$N"
702+
703+ json_get_values pairwise pairwise
developer9097e5e2023-07-19 10:22:24 +0800704+ if [ -n "$pairwise" ]; then
705+ case "$pairwise" in
706+ *tkip+aes|*tkip+ccmp|*aes+tkip|*ccmp+tkip)
707+ wpa_cipher="CCMP TKIP"
708+ ;;
709+ *ccmp256)
710+ wpa_cipher="CCMP-256"
711+ ;;
712+ *aes|*ccmp)
713+ wpa_cipher="CCMP"
714+ ;;
715+ *tkip)
716+ wpa_cipher="TKIP"
717+ ;;
718+ *gcmp256)
719+ wpa_cipher="GCMP-256"
720+ ;;
721+ *gcmp)
722+ wpa_cipher="GCMP"
723+ ;;
724+ *)
725+ wpa_cipher=""
726+ ;;
727+ esac
728+ fi
developer74503112023-06-29 17:34:49 +0800729+ [ -n "$wpa_cipher" ] && wpa_pairwise="$wpa_cipher"
730+
731 [ -n "$wpa_pairwise" ] && append bss_conf "wpa_pairwise=$wpa_pairwise" "$N"
732
733 set_default wps_pushbutton 0
developer5ad89862023-08-24 08:17:27 +0800734@@ -841,7 +899,7 @@ hostapd_set_bss_options() {
developerda723192023-05-22 19:46:10 +0800735 }
736
737 append bss_conf "ssid=$ssid" "$N"
738- [ -n "$network_bridge" ] && append bss_conf "bridge=$network_bridge${N}wds_bridge=" "$N"
739+ [ -n "$network_bridge" ] && append bss_conf "bridge=$network_bridge${N}wds_bridge=$network_bridge" "$N"
740 [ -n "$network_ifname" ] && append bss_conf "snoop_iface=$network_ifname" "$N"
741 [ -n "$iapp_interface" ] && {
742 local ifname
developer5ad89862023-08-24 08:17:27 +0800743@@ -954,6 +1012,8 @@ hostapd_set_bss_options() {
developer74503112023-06-29 17:34:49 +0800744 fi
745
746 if [ "$wpa" -ge "2" ]; then
747+ json_get_values sae_groups sae_groups
748+ json_get_values owe_groups owe_groups
749 if [ -n "$network_bridge" -a "$rsn_preauth" = 1 ]; then
750 set_default auth_cache 1
751 append bss_conf "rsn_preauth=1" "$N"
developer5ad89862023-08-24 08:17:27 +0800752@@ -972,17 +1032,42 @@ hostapd_set_bss_options() {
developer74503112023-06-29 17:34:49 +0800753 append bss_conf "okc=$auth_cache" "$N"
754 [ "$auth_cache" = 0 -a "$fils" = 0 ] && append bss_conf "disable_pmksa_caching=1" "$N"
755
756+ [ -z "$group_cipher" ] && group_cipher="$wpa_cipher"
757+
758+ if [ -n "$sae_groups" -o -n "$owe_groups" ]; then
759+ case "$auth_type" in
760+ sae*)
761+ append bss_conf "sae_groups=$sae_groups" "$N"
762+ append bss_conf "group_cipher=$group_cipher" "$N"
763+ ;;
764+ owe)
765+ append bss_conf "owe_groups=$owe_groups" "$N"
766+ append bss_conf "group_cipher=$group_cipher" "$N"
767+ ;;
768+ esac
769+ fi
770+
developer813f5d72023-03-28 17:44:38 +0800771 # RSN -> allow management frame protection
772 case "$ieee80211w" in
773 [012])
774- json_get_vars ieee80211w_mgmt_cipher ieee80211w_max_timeout ieee80211w_retry_timeout
775+ json_get_vars ieee80211w_mgmt_cipher ieee80211w_max_timeout ieee80211w_retry_timeout beacon_prot
776 append bss_conf "ieee80211w=$ieee80211w" "$N"
777 [ "$ieee80211w" -gt "0" ] && {
developer74503112023-06-29 17:34:49 +0800778+ case "$group_cipher" in
779+ CCMP*)
780+ ieee80211w_mgmt_cipher="AES-128-CMAC"
781+ ;;
782+ GCMP-256)
783+ [[ "$encryption" != "*owe*" ]] && ieee80211w_mgmt_cipher="BIP-GMAC-256"
784+ ;;
785+ esac
developer813f5d72023-03-28 17:44:38 +0800786 if [ "$auth_type" = "eap192" ]; then
developer74503112023-06-29 17:34:49 +0800787 append bss_conf "group_mgmt_cipher=BIP-GMAC-256" "$N"
developer813f5d72023-03-28 17:44:38 +0800788 else
789 append bss_conf "group_mgmt_cipher=${ieee80211w_mgmt_cipher:-AES-128-CMAC}" "$N"
790 fi
791+ [ -n "$beacon_prot" ] && \
792+ append bss_conf "beacon_prot=$beacon_prot" "$N"
793 [ -n "$ieee80211w_max_timeout" ] && \
794 append bss_conf "assoc_sa_query_max_timeout=$ieee80211w_max_timeout" "$N"
795 [ -n "$ieee80211w_retry_timeout" ] && \
developer5ad89862023-08-24 08:17:27 +0800796@@ -1047,9 +1132,10 @@ hostapd_set_bss_options() {
developerf166f542023-05-25 14:40:30 +0800797 json_get_vars iw_roaming_consortium iw_domain_name iw_anqp_3gpp_cell_net iw_nai_realm
798 json_get_vars iw_anqp_elem iw_qos_map_set iw_ipaddr_type_availability iw_gas_address3
799 json_get_vars iw_venue_name iw_venue_url
800+ json_get_vars interworking
801
802 set_default iw_enabled 0
803- if [ "$iw_enabled" = "1" ]; then
804+ if [ "$iw_enabled" = "1" ] || [ "$interworking" = "1" ]; then
805 append bss_conf "interworking=1" "$N"
806 set_default iw_internet 1
807 set_default iw_asra 0
developer5ad89862023-08-24 08:17:27 +0800808@@ -1156,6 +1242,22 @@ hostapd_set_bss_options() {
developer74503112023-06-29 17:34:49 +0800809 append bss_conf "$val" "$N"
810 done
811
812+ if [ "$unsol_bcast_probe_resp_interval" -gt 0 ]; then
813+ append bss_conf "unsol_bcast_probe_resp_interval=$unsol_bcast_probe_resp_interval" "$N"
814+ fi
815+
816+ if [ -n "$fils_discovery_min_interval" ]; then
817+ append bss_conf "fils_discovery_min_interval=$fils_discovery_min_interval" "$N"
818+ fi
819+
820+ if [ -n "$fils_discovery_max_interval" ]; then
821+ append bss_conf "fils_discovery_max_interval=$fils_discovery_max_interval" "$N"
822+ fi
823+
824+ if [ -n "$rnr" ]; then
825+ append bss_conf "rnr=$rnr" "$N"
826+ fi
827+
828 bss_md5sum="$(echo $bss_conf | md5sum | cut -d" " -f1)"
829 append bss_conf "config_id=$bss_md5sum" "$N"
830
developer5ad89862023-08-24 08:17:27 +0800831@@ -1246,6 +1348,7 @@ wpa_supplicant_prepare_interface() {
developer18015ad2023-07-13 13:18:19 +0800832 country_str="country=$country"
833 }
834
developer2cf3f4c2023-07-24 16:58:25 +0800835+ local tx_queue_data2_burst="tx_queue_data2_burst=0"
developer18015ad2023-07-13 13:18:19 +0800836 multiap_flag_file="${_config}.is_multiap"
837 if [ "$multi_ap" = "1" ]; then
838 touch "$multiap_flag_file"
developer5ad89862023-08-24 08:17:27 +0800839@@ -1257,6 +1360,7 @@ wpa_supplicant_prepare_interface() {
developer18015ad2023-07-13 13:18:19 +0800840 ${scan_list:+freq_list=$scan_list}
841 $ap_scan
842 $country_str
843+$tx_queue_data2_burst
844 EOF
845 return 0
846 }
developer5ad89862023-08-24 08:17:27 +0800847@@ -1528,12 +1632,38 @@ wpa_supplicant_add_network() {
developer74503112023-06-29 17:34:49 +0800848 ;;
849 esac
850
developerbb29b5e2023-07-25 20:41:04 +0800851- [ "$wpa_cipher" = GCMP ] && {
852- append network_data "pairwise=GCMP" "$N$T"
853- append network_data "group=GCMP" "$N$T"
854- }
developer74503112023-06-29 17:34:49 +0800855+ json_get_values pairwise pairwise
developer9097e5e2023-07-19 10:22:24 +0800856+ if [ -n "$pairwise" ]; then
857+ case "$pairwise" in
858+ *tkip+aes|*tkip+ccmp|*aes+tkip|*ccmp+tkip)
859+ wpa_cipher="CCMP TKIP"
860+ ;;
861+ *ccmp256)
862+ wpa_cipher="CCMP-256"
863+ ;;
864+ *aes|*ccmp)
865+ wpa_cipher="CCMP"
866+ ;;
867+ *tkip)
868+ wpa_cipher="TKIP"
869+ ;;
870+ *gcmp256)
871+ wpa_cipher="GCMP-256"
872+ ;;
873+ *gcmp)
874+ wpa_cipher="GCMP"
875+ ;;
876+ *)
877+ wpa_cipher=""
878+ ;;
879+ esac
880+ fi
developer74503112023-06-29 17:34:49 +0800881+ [ -n "$wpa_cipher" ] && wpa_pairwise="$wpa_cipher"
developer74503112023-06-29 17:34:49 +0800882
883 [ "$mode" = mesh ] || {
884+ json_get_values sae_groups sae_groups
885+ json_get_values owe_groups owe_groups
886+
887 case "$wpa" in
888 1)
889 append network_data "proto=WPA" "$N$T"
developer5ad89862023-08-24 08:17:27 +0800890@@ -1543,12 +1673,48 @@ wpa_supplicant_add_network() {
developer74503112023-06-29 17:34:49 +0800891 ;;
892 esac
893
894+ [ -n "$wpa_pairwise" ] && append network_data "pairwise=$wpa_pairwise" "$N$T"
895+ [ -z "$group_cipher" ] && group_cipher="$wpa_cipher"
896+
897+ if [ -n "$sae_groups" -o -n "$owe_groups" ]; then
898+ case "$auth_type" in
899+ sae*)
900+ echo "sae_groups=$sae_groups" >> "$_config"
901+ append network_data "group=$group_cipher" "$N$T"
902+ ;;
903+ owe)
904+ append network_data "owe_group=$owe_groups" "$N$T"
905+ append network_data "group=$group_cipher" "$N$T"
906+ ;;
907+ esac
908+ fi
909+
910+ # RSN -> allow management frame protection
911 case "$ieee80211w" in
912 [012])
913- [ "$wpa" -ge 2 ] && append network_data "ieee80211w=$ieee80211w" "$N$T"
914+ json_get_vars ieee80211w_mgmt_cipher ieee80211w_max_timeout ieee80211w_retry_timeout beacon_prot
915+ append network_data "ieee80211w=$ieee80211w" "$N$T"
916+ [ "$ieee80211w" -gt "0" ] && {
917+ case "$group_cipher" in
918+ CCMP*)
919+ ieee80211w_mgmt_cipher="AES-128-CMAC"
920+ ;;
921+ GCMP-256)
922+ [[ "$encryption" != "*owe*" ]] && ieee80211w_mgmt_cipher="BIP-GMAC-256"
923+ ;;
924+ esac
925+ if [ "$auth_type" = "eap192" ]; then
926+ append network_data "group_mgmt=BIP-GMAC-256" "$N$T"
927+ else
928+ append network_data "group_mgmt=${ieee80211w_mgmt_cipher:-AES-128-CMAC}" "$N$T"
929+ fi
930+ [ -n "$beacon_prot" ] && \
931+ append network_data "beacon_prot=$beacon_prot" "$N$T"
932+ }
933 ;;
934 esac
935 }
936+
937 [ -n "$bssid" ] && append network_data "bssid=$bssid" "$N$T"
938 [ -n "$beacon_int" ] && append network_data "beacon_int=$beacon_int" "$N$T"
939
developer5ad89862023-08-24 08:17:27 +0800940@@ -1559,6 +1725,20 @@ wpa_supplicant_add_network() {
developer82408892023-03-27 15:09:00 +0800941 [ -n "$bssid_blacklist" ] && append network_data "bssid_blacklist=$bssid_blacklist" "$N$T"
942 [ -n "$bssid_whitelist" ] && append network_data "bssid_whitelist=$bssid_whitelist" "$N$T"
943
944+ local disable_eht
945+ local disable_he
946+ local disable_vht
947+ local disable_ht
948+ json_get_vars disable_eht
949+ json_get_vars disable_he
950+ json_get_vars disable_vht
951+ json_get_vars disable_ht
952+
953+ [ -n "$disable_eht" ] && append network_data "disable_eht=$disable_eht" "$N$T"
954+ [ -n "$disable_he" ] && append network_data "disable_he=$disable_he" "$N$T"
955+ [ -n "$disable_vht" ] && append network_data "disable_vht=$disable_vht" "$N$T"
956+ [ -n "$disable_ht" ] && append network_data "disable_ht=$disable_ht" "$N$T"
957+
958 [ -n "$basic_rate" ] && {
959 local br rate_list=
960 for br in $basic_rate; do
developer5ad89862023-08-24 08:17:27 +0800961@@ -1573,6 +1753,11 @@ wpa_supplicant_add_network() {
developer85839fe2023-02-23 10:32:51 +0800962 append network_data "mcast_rate=$mc_rate" "$N$T"
963 }
964
965+ if [ "$auth_type" = "sae" ]; then
966+ json_get_vars sae_pwe sae_pwe
967+ [ -n "$sae_pwe" ] && echo "sae_pwe=$sae_pwe" >> "$_config"
968+ fi
969+
970 if [ "$key_mgmt" = "WPS" ]; then
971 echo "wps_cred_processing=1" >> "$_config"
972 else