blob: a7cd41f7a4e4ca0a5e50ff2373fe048ca103863d [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
developeree85b6b2023-12-22 18:33:35 +080035index ed28052..95ee503 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
developeree85b6b2023-12-22 18:33:35 +080046@@ -53,7 +54,12 @@ drv_mac80211_init_device_config() {
developer785b6502023-04-19 18:31:11 +080047 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 \
developeree85b6b2023-12-22 18:33:35 +080054+ itxbfen \
55+ lpi_enable \
56+ beacon_dup
developer785b6502023-04-19 18:31:11 +080057 config_add_int \
58 beamformer_antennas \
59 beamformee_antennas \
developeree85b6b2023-12-22 18:33:35 +080060@@ -64,7 +70,8 @@ drv_mac80211_init_device_config() {
61 rx_stbc \
62 tx_stbc \
63 he_bss_color \
64- he_spr_non_srg_obss_pd_max_offset
65+ he_spr_non_srg_obss_pd_max_offset \
66+ sku_idx
67 config_add_boolean \
68 ldpc \
69 greenfield \
70@@ -140,13 +147,11 @@ mac80211_hostapd_setup_base() {
developer0ba09b62023-03-10 18:43:49 +080071 [ -n "$acs_exclude_dfs" ] && [ "$acs_exclude_dfs" -gt 0 ] &&
72 append base_cfg "acs_exclude_dfs=1" "$N"
73
74- json_get_vars noscan ht_coex min_tx_power:0 tx_burst
developer61604c82023-09-04 14:43:31 +080075+ json_get_vars noscan ht_coex min_tx_power:0 tx_burst mbssid mu_onoff rnr obss_interval
developeree85b6b2023-12-22 18:33:35 +080076+ json_get_vars etxbfen:1 itxbfen:0 lpi_enable:0 sku_idx:0 beacon_dup:1
developer8d77be32022-10-20 15:08:25 +080077 json_get_values ht_capab_list ht_capab
developer20d67712022-03-02 14:09:32 +080078 json_get_values channel_list channels
79
80- [ "$auto_channel" = 0 ] && [ -z "$channel_list" ] && \
81- channel_list="$channel"
82-
developer9b3248d2022-07-06 00:44:05 +080083 [ "$min_tx_power" -gt 0 ] && append base_cfg "min_tx_power=$min_tx_power"
developer20d67712022-03-02 14:09:32 +080084
developer9b3248d2022-07-06 00:44:05 +080085 set_default noscan 0
developeree85b6b2023-12-22 18:33:35 +080086@@ -160,21 +165,42 @@ mac80211_hostapd_setup_base() {
developer785b6502023-04-19 18:31:11 +080087 ieee80211n=1
88 ht_capab=
89 case "$htmode" in
90- VHT20|HT20|HE20) ;;
91- HT40*|VHT40|VHT80|VHT160|HE40|HE80|HE160)
92+ VHT20|HT20|HE20|EHT20) ;;
developerbe3cf972023-04-27 09:58:26 +080093+ HT40*|VHT40|VHT80|VHT160|HE40*|HE80|HE160|EHT40*|EHT80|EHT160|EHT320*)
developer785b6502023-04-19 18:31:11 +080094 case "$hwmode" in
95 a)
96 case "$(( (($channel / 4) + $chan_ofs) % 2 ))" in
developerda1bac72023-09-19 10:32:47 +080097 1) ht_capab="[HT40+]";;
98 0) ht_capab="[HT40-]";;
99 esac
100+ case "$htmode" in
101+ HT40-|HE40-|EHT40-)
102+ if [ "$auto_channel" -gt 0 ]; then
103+ ht_capab="[HT40-]"
104+ fi
105+ ;;
106+ esac
developerbe3cf972023-04-27 09:58:26 +0800107 ;;
108 *)
109 case "$htmode" in
110- HT40+) ht_capab="[HT40+]";;
111- HT40-) ht_capab="[HT40-]";;
112+ HT40+|HE40+|EHT40+)
113+ if [ "$channel" -gt 9 ]; then
114+ echo "Could not set the center freq with this HT mode setting"
115+ return 1
116+ else
117+ ht_capab="[HT40+]"
118+ fi
119+ ;;
120+ HT40-|HE40-|EHT40-)
developerda1bac72023-09-19 10:32:47 +0800121+ if [ "$channel" -lt 5 -a "$auto_channel" -eq 0 ]; then
developerbe3cf972023-04-27 09:58:26 +0800122+ echo "Could not set the center freq with this HT mode setting"
123+ return 1
124+ else
125+ ht_capab="[HT40-]"
126+ fi
127+ ;;
128 *)
developerda1bac72023-09-19 10:32:47 +0800129- if [ "$channel" -lt 7 ]; then
130+ if [ "$channel" -lt 7 -o "$auto_channel" -gt 0 ]; then
developerbe3cf972023-04-27 09:58:26 +0800131 ht_capab="[HT40+]"
developerda1bac72023-09-19 10:32:47 +0800132 else
133 ht_capab="[HT40-]"
developeree85b6b2023-12-22 18:33:35 +0800134@@ -183,7 +209,6 @@ mac80211_hostapd_setup_base() {
developerda1bac72023-09-19 10:32:47 +0800135 esac
136 ;;
137 esac
138- [ "$auto_channel" -gt 0 ] && ht_capab="[HT40+]"
139 ;;
140 *) ieee80211n= ;;
141 esac
developeree85b6b2023-12-22 18:33:35 +0800142@@ -193,6 +218,10 @@ mac80211_hostapd_setup_base() {
developer61604c82023-09-04 14:43:31 +0800143
144 set_default ht_coex 0
145 append base_cfg "ht_coex=$ht_coex" "$N"
146+ [ "$ht_coex" -eq 1 ] && {
147+ set_default obss_interval 300
148+ append base_cfg "obss_interval=$obss_interval" "$N"
149+ }
150
151 json_get_vars \
152 ldpc:1 \
developeree85b6b2023-12-22 18:33:35 +0800153@@ -205,7 +234,7 @@ mac80211_hostapd_setup_base() {
developer785b6502023-04-19 18:31:11 +0800154 dsss_cck_40:1
155
156 ht_cap_mask=0
157- for cap in $(iw phy "$phy" info | grep 'Capabilities:' | cut -d: -f2); do
158+ for cap in $(iw phy "$phy" info | grep 'Capabilities: 0x' | cut -d: -f2); do
159 ht_cap_mask="$(($ht_cap_mask | $cap))"
160 done
161
developeree85b6b2023-12-22 18:33:35 +0800162@@ -236,8 +265,8 @@ mac80211_hostapd_setup_base() {
developer785b6502023-04-19 18:31:11 +0800163
164 idx="$channel"
165 case "$htmode" in
166- VHT20|HE20) enable_ac=1;;
167- VHT40|HE40)
168+ VHT20|HE20|EHT20) enable_ac=1;;
169+ VHT40|HE40|EHT40)
170 case "$(( (($channel / 4) + $chan_ofs) % 2 ))" in
171 1) idx=$(($channel + 2));;
172 0) idx=$(($channel - 2));;
developeree85b6b2023-12-22 18:33:35 +0800173@@ -245,7 +274,7 @@ mac80211_hostapd_setup_base() {
developer785b6502023-04-19 18:31:11 +0800174 enable_ac=1
175 vht_center_seg0=$idx
176 ;;
177- VHT80|HE80)
178+ VHT80|HE80|EHT80)
179 case "$(( (($channel / 4) + $chan_ofs) % 4 ))" in
180 1) idx=$(($channel + 6));;
181 2) idx=$(($channel + 2));;
developeree85b6b2023-12-22 18:33:35 +0800182@@ -256,7 +285,7 @@ mac80211_hostapd_setup_base() {
developer785b6502023-04-19 18:31:11 +0800183 vht_oper_chwidth=1
184 vht_center_seg0=$idx
185 ;;
186- VHT160|HE160)
187+ VHT160|HE160|EHT160)
188 if [ "$band" = "6g" ]; then
189 case "$channel" in
190 1|5|9|13|17|21|25|29) idx=15;;
developeree85b6b2023-12-22 18:33:35 +0800191@@ -271,12 +300,43 @@ mac80211_hostapd_setup_base() {
developeradd8de62023-05-02 16:25:52 +0800192 case "$channel" in
193 36|40|44|48|52|56|60|64) idx=50;;
194 100|104|108|112|116|120|124|128) idx=114;;
195+ 149|153|157|161|165|169|173|177) idx=163;;
196 esac
197 fi
198 enable_ac=1
developer785b6502023-04-19 18:31:11 +0800199 vht_oper_chwidth=2
200 vht_center_seg0=$idx
201 ;;
202+ EHT320*)
203+ case "$channel" in
204+ 1|5|9|13|17|21|25|29) idx=31;;
205+ 33|37|41|45|49|53|57|61| \
206+ 65|69|73|77|81|85|89|93) idx=63;;
207+ 97|101|105|109|113|117|121|125| \
208+ 129|133|137|141|145|149|153|157) idx=127;;
209+ 161|165|169|173|177|181|185|189| \
210+ 193|197|201|205|209|213|217|221) idx=191;;
211+ esac
212+ if [[ "$htmode" = "EHT320-1" && "$channel" -ge "193" ]] ||
213+ [[ "$htmode" = "EHT320-2" && "$channel" -le "29" ]]; then
214+ echo "Could not set the center freq with this EHT setting"
215+ return 1
216+ elif [[ "$htmode" = "EHT320-1" && "$channel" -ge "33" ]]; then
217+ if [ "$channel" -gt $idx ]; then
218+ idx=$(($idx + 32))
219+ else
220+ idx=$(($idx - 32))
221+ fi
222+ fi
223+ vht_oper_chwidth=2
224+ if [ "$channel" -gt $idx ]; then
225+ vht_center_seg0=$(($idx + 16))
226+ else
227+ vht_center_seg0=$(($idx - 16))
228+ fi
229+ eht_oper_chwidth=9
230+ eht_oper_centr_freq_seg0_idx=$idx
231+ ;;
232 esac
233 [ "$band" = "5g" ] && {
234 json_get_vars background_radar:0
developeree85b6b2023-12-22 18:33:35 +0800235@@ -286,8 +346,9 @@ mac80211_hostapd_setup_base() {
developer785b6502023-04-19 18:31:11 +0800236 [ "$band" = "6g" ] && {
237 op_class=
238 case "$htmode" in
239- HE20) op_class=131;;
240- HE*) op_class=$((132 + $vht_oper_chwidth))
241+ HE20|EHT20) op_class=131;;
242+ EHT320*) op_class=137;;
243+ HE*|EHT*) op_class=$((132 + $vht_oper_chwidth))
244 esac
245 [ -n "$op_class" ] && append base_cfg "op_class=$op_class" "$N"
246 }
developeree85b6b2023-12-22 18:33:35 +0800247@@ -315,7 +376,6 @@ mac80211_hostapd_setup_base() {
developer8b04dfd2022-12-07 16:29:19 +0800248 vht_link_adapt:3 \
249 vht160:2
250
251- set_default tx_burst 2.0
252 append base_cfg "ieee80211ac=1" "$N"
253 vht_cap=0
254 for cap in $(iw phy "$phy" info | awk -F "[()]" '/VHT Capabilities/ { print $2 }'); do
developeree85b6b2023-12-22 18:33:35 +0800255@@ -329,6 +389,12 @@ mac80211_hostapd_setup_base() {
developer785b6502023-04-19 18:31:11 +0800256 [ "$rx_stbc" -lt "$cap_rx_stbc" ] && cap_rx_stbc="$rx_stbc"
257 vht_cap="$(( ($vht_cap & ~(0x700)) | ($cap_rx_stbc << 8) ))"
258
259+ [ "$etxbfen" -eq 0 ] && {
260+ su_beamformer=0
261+ su_beamformee=0
262+ mu_beamformer=0
263+ }
264+
265 mac80211_add_capabilities vht_capab $vht_cap \
266 RXLDPC:0x10::$rxldpc \
267 SHORT-GI-80:0x20::$short_gi_80 \
developeree85b6b2023-12-22 18:33:35 +0800268@@ -410,7 +476,7 @@ mac80211_hostapd_setup_base() {
developer785b6502023-04-19 18:31:11 +0800269 # 802.11ax
270 enable_ax=0
271 case "$htmode" in
272- HE*) enable_ax=1 ;;
273+ HE*|EHT*) enable_ax=1 ;;
274 esac
275
276 if [ "$enable_ax" != "0" ]; then
developeree85b6b2023-12-22 18:33:35 +0800277@@ -419,10 +485,11 @@ mac80211_hostapd_setup_base() {
developer785b6502023-04-19 18:31:11 +0800278 he_su_beamformee:1 \
279 he_mu_beamformer:1 \
280 he_twt_required:0 \
281+ he_twt_responder \
282 he_spr_sr_control:3 \
283 he_spr_psr_enabled:0 \
284 he_spr_non_srg_obss_pd_max_offset:0 \
285- he_bss_color:128 \
286+ he_bss_color \
287 he_bss_color_enabled:1
288
289 he_phy_cap=$(iw phy "$phy" info | sed -n '/HE Iftypes: AP/,$p' | awk -F "[()]" '/HE PHY Capabilities/ { print $2 }' | head -1)
developeree85b6b2023-12-22 18:33:35 +0800290@@ -436,6 +503,11 @@ mac80211_hostapd_setup_base() {
developer785b6502023-04-19 18:31:11 +0800291 append base_cfg "he_oper_centr_freq_seg0_idx=$vht_center_seg0" "$N"
292 }
293
294+ [ "$etxbfen" -eq 0 ] && {
295+ he_su_beamformer=0
296+ he_mu_beamformer=0
297+ }
298+
299 mac80211_add_he_capabilities \
300 he_su_beamformer:${he_phy_cap:6:2}:0x80:$he_su_beamformer \
301 he_su_beamformee:${he_phy_cap:8:2}:0x1:$he_su_beamformee \
developeree85b6b2023-12-22 18:33:35 +0800302@@ -443,7 +515,14 @@ mac80211_hostapd_setup_base() {
developer785b6502023-04-19 18:31:11 +0800303 he_spr_psr_enabled:${he_phy_cap:14:2}:0x1:$he_spr_psr_enabled \
304 he_twt_required:${he_mac_cap:0:2}:0x6:$he_twt_required
305
306+ if [ -n "$he_twt_responder" ]; then
307+ append base_cfg "he_twt_responder=$he_twt_responder" "$N"
308+ fi
309 if [ "$he_bss_color_enabled" -gt 0 ]; then
developer830efa72023-05-18 19:32:48 +0800310+ if !([ "$he_bss_color" -gt 0 ] && [ "$he_bss_color" -le 64 ]); then
developer785b6502023-04-19 18:31:11 +0800311+ rand=$(head -n 1 /dev/urandom | tr -dc 0-9 | head -c 2)
312+ he_bss_color=$((rand % 63 + 1))
313+ fi
314 append base_cfg "he_bss_color=$he_bss_color" "$N"
315 [ "$he_spr_non_srg_obss_pd_max_offset" -gt 0 ] && { \
316 append base_cfg "he_spr_non_srg_obss_pd_max_offset=$he_spr_non_srg_obss_pd_max_offset" "$N"
developeree85b6b2023-12-22 18:33:35 +0800317@@ -484,12 +563,50 @@ mac80211_hostapd_setup_base() {
developer8b04dfd2022-12-07 16:29:19 +0800318 append base_cfg "he_mu_edca_ac_vo_timer=255" "$N"
319 fi
320
developer18015ad2023-07-13 13:18:19 +0800321+ set_default tx_burst 2
developer8b04dfd2022-12-07 16:29:19 +0800322+
developer785b6502023-04-19 18:31:11 +0800323+ # 802.11be
324+ enable_be=0
325+ case "$htmode" in
326+ EHT*) enable_be=1 ;;
327+ esac
328+
329+ if [ "$enable_be" != "0" ]; then
330+ append base_cfg "ieee80211be=1" "$N"
331+ if [ "$etxbfen" -eq 0 ]; then
332+ append base_cfg "eht_su_beamformee=1" "$N"
333+ else
334+ append base_cfg "eht_su_beamformer=1" "$N"
335+ append base_cfg "eht_su_beamformee=1" "$N"
336+ append base_cfg "eht_mu_beamformer=1" "$N"
337+ fi
338+ [ "$hwmode" = "a" ] && {
339+ case $htmode in
340+ EHT320*)
341+ append base_cfg "eht_oper_chwidth=$eht_oper_chwidth" "$N"
342+ append base_cfg "eht_oper_centr_freq_seg0_idx=$eht_oper_centr_freq_seg0_idx" "$N"
343+ ;;
344+ *)
345+ append base_cfg "eht_oper_chwidth=$vht_oper_chwidth" "$N"
346+ append base_cfg "eht_oper_centr_freq_seg0_idx=$vht_center_seg0" "$N"
347+ ;;
348+ esac
349+ }
350+ fi
351+
developer8b04dfd2022-12-07 16:29:19 +0800352 hostapd_prepare_device_config "$hostapd_conf_file" nl80211
353 cat >> "$hostapd_conf_file" <<EOF
354 ${channel:+channel=$channel}
developer0ba09b62023-03-10 18:43:49 +0800355 ${channel_list:+chanlist=$channel_list}
356 ${hostapd_noscan:+noscan=1}
357 ${tx_burst:+tx_queue_data2_burst=$tx_burst}
358+${mbssid:+mbssid=$mbssid}
developer785b6502023-04-19 18:31:11 +0800359+${mu_onoff:+mu_onoff=$mu_onoff}
360+${itxbfen:+ibf_enable=$itxbfen}
developeree85b6b2023-12-22 18:33:35 +0800361+${lpi_enable:+lpi_enable=$lpi_enable}
362+${sku_idx:+sku_idx=$sku_idx}
363+${beacon_dup:+beacon_dup=$beacon_dup}
developer2c6592a2023-07-21 11:20:56 +0800364+${rnr:+rnr=$rnr}
developer0ba09b62023-03-10 18:43:49 +0800365 $base_cfg
366
367 EOF
developeree85b6b2023-12-22 18:33:35 +0800368@@ -517,7 +634,7 @@ mac80211_hostapd_setup_bss() {
developer093e1a32023-02-24 16:10:53 +0800369 append hostapd_cfg "wds_sta=1" "$N"
370 [ -n "$wds_bridge" ] && append hostapd_cfg "wds_bridge=$wds_bridge" "$N"
371 }
372- [ "$staidx" -gt 0 -o "$start_disabled" -eq 1 ] && append hostapd_cfg "start_disabled=1" "$N"
373+ [ "$start_disabled" -eq 1 ] && append hostapd_cfg "start_disabled=1" "$N"
374
375 cat >> /var/run/hostapd-$phy.conf <<EOF
376 $hostapd_cfg
developeree85b6b2023-12-22 18:33:35 +0800377@@ -527,6 +644,31 @@ ${max_listen_int:+max_listen_interval=$max_listen_int}
developer0ba09b62023-03-10 18:43:49 +0800378 EOF
379 }
380
381+mac80211_generate_mbssid_mac() {
382+ local phy="$1"
383+ local transmitted_bssid="$2"
developer1952bcd2023-06-20 20:14:37 +0800384+ local id="${mbssidx:-0}"
developer0ba09b62023-03-10 18:43:49 +0800385+
386+ local ref="$(cat /sys/class/ieee80211/${phy}/macaddress)"
developer0ba09b62023-03-10 18:43:49 +0800387+
388+ if [ -z "$transmitted_bssid" ]; then
389+ transmitted_bssid=$ref
390+ fi
391+
392+ if [ $id -eq 0 ]; then
393+ echo "$transmitted_bssid"
394+ return
395+ fi
396+
397+ local oIFS="$IFS"; IFS=":"; set -- $transmitted_bssid; IFS="$oIFS"
398+
399+ # Calculate nontransmitted bssid
developer0ba09b62023-03-10 18:43:49 +0800400+ b6="0x$6"
401+ ref_b6=$(($b6 % $max_mbssid))
developer1952bcd2023-06-20 20:14:37 +0800402+ b6=$(($b6 - $ref_b6 + ($ref_b6 + $id) % $max_mbssid))
developer0ba09b62023-03-10 18:43:49 +0800403+ printf "%s:%s:%s:%s:%s:%02x" $1 $2 $3 $4 $5 $b6
404+}
405+
406 mac80211_get_addr() {
407 local phy="$1"
408 local idx="$(($2 + 1))"
developeree85b6b2023-12-22 18:33:35 +0800409@@ -757,7 +899,19 @@ mac80211_prepare_vif() {
developer0ba09b62023-03-10 18:43:49 +0800410
411 json_select ..
412
413- if [ -z "$macaddr" ]; then
developerd2fbd572023-06-19 19:48:25 +0800414+ if [ "$mbssid" -gt 0 ] && [ "$mode" == "ap" ]; then
developer1952bcd2023-06-20 20:14:37 +0800415+ [ "$mbssidx" -eq 0 ] && {
416+ if [ -z $macaddr ]; then
417+ transmitted_bssid="$(mac80211_generate_mac $phy)"
418+ else
419+ # uci set mac address
420+ transmitted_bssid=$macaddr
421+ fi
422+ macidx="$(($macidx + 1))"
developer0ba09b62023-03-10 18:43:49 +0800423+ }
424+ macaddr="$(mac80211_generate_mbssid_mac $phy $transmitted_bssid)"
developer1952bcd2023-06-20 20:14:37 +0800425+ mbssidx="$(($mbssidx + 1))"
developer0ba09b62023-03-10 18:43:49 +0800426+ elif [ -z "$macaddr" ]; then
427 macaddr="$(mac80211_generate_mac $phy)"
428 macidx="$(($macidx + 1))"
429 elif [ "$macaddr" = 'random' ]; then
developeree85b6b2023-12-22 18:33:35 +0800430@@ -1058,6 +1212,9 @@ mac80211_setup_vif() {
developerf0de14b2022-12-14 23:07:34 +0800431
432 json_select ..
433 [ -n "$failed" ] || wireless_add_vif "$name" "$ifname"
434+
435+ echo "Setup SMP Affinity"
436+ /sbin/smp-mt76.sh
437 }
438
439 get_freq() {
developeree85b6b2023-12-22 18:33:35 +0800440@@ -1122,6 +1279,25 @@ drv_mac80211_cleanup() {
developer0ba09b62023-03-10 18:43:49 +0800441 hostapd_common_cleanup
442 }
443
444+mac80211_count_ap() {
445+ total_num_ap=$(($total_num_ap + 1))
446+}
447+
developer6cfee682023-11-27 19:34:42 +0800448+country_consistent_check() {
449+ local i
450+ inconsistent_country=0
451+ country_list="$(cat /etc/config/wireless | grep country | cut -d ' ' -f3 | tr -s "'\n" ' ')"
452+ for i in $country_list
453+ do
454+ ret="$(echo $country_list | awk '{print ($2 == "" || $1 == $2)}')"
455+ [ $ret = '0' ] && {
456+ inconsistent_country=1
457+ return
458+ }
459+ country_list="$(echo $country_list | sed -r 's/[A-Z]{2}( )*//')"
460+ done
461+}
462+
developer0ba09b62023-03-10 18:43:49 +0800463 drv_mac80211_setup() {
464 json_select config
465 json_get_vars \
developeree85b6b2023-12-22 18:33:35 +0800466@@ -1129,7 +1305,8 @@ drv_mac80211_setup() {
developer74503112023-06-29 17:34:49 +0800467 country chanbw distance \
468 txpower antenna_gain \
469 rxantenna txantenna \
470- frag rts beacon_int:100 htmode
471+ frag rts beacon_int:100 htmode \
472+ sr_enable sr_enhanced
473 json_get_values basic_rate_list basic_rate
474 json_get_values scan_list scan_list
475 json_select ..
developeree85b6b2023-12-22 18:33:35 +0800476@@ -1180,6 +1357,7 @@ drv_mac80211_setup() {
developer1952bcd2023-06-20 20:14:37 +0800477 no_ap=1
478 macidx=0
479 staidx=0
480+ mbssidx=0
481
482 [ -n "$chanbw" ] && {
483 for file in /sys/kernel/debug/ieee80211/$phy/ath9k*/chanbw /sys/kernel/debug/ieee80211/$phy/ath5k/bwmode; do
developeree85b6b2023-12-22 18:33:35 +0800484@@ -1219,6 +1397,16 @@ drv_mac80211_setup() {
developer0ba09b62023-03-10 18:43:49 +0800485 for_each_interface "sta adhoc mesh" mac80211_set_noscan
486 [ -n "$has_ap" ] && mac80211_hostapd_setup_base "$phy"
487
488+ total_num_ap=0
489+ max_mbssid=1
490+ for_each_interface "ap" mac80211_count_ap
491+ total_num_ap=$(($total_num_ap - 1))
492+ while [ $total_num_ap -gt 0 ]
493+ do
494+ total_num_ap=$(($total_num_ap >> 1))
495+ max_mbssid=$(($max_mbssid << 1))
496+ done
497+
498 mac80211_prepare_iw_htmode
499 for_each_interface "sta adhoc mesh monitor" mac80211_prepare_vif
500 NEWAPLIST=
developeree85b6b2023-12-22 18:33:35 +0800501@@ -1249,8 +1437,22 @@ drv_mac80211_setup() {
developer6cfee682023-11-27 19:34:42 +0800502 }
503 fi
developerad1f3172023-05-02 11:10:08 +0800504 if [ "$no_reload" != "0" ]; then
developer6cfee682023-11-27 19:34:42 +0800505+ country_consistent_check
506+ if [ "$inconsistent_country" == "1" ]; then
507+ echo "ERROR: Please use the same country for all the radios."
508+ wireless_setup_failed HOSTAPD_START_FAILED
509+ return
510+ fi
developerad1f3172023-05-02 11:10:08 +0800511 add_ap=1
512 ubus wait_for hostapd
513+
514+ # each phy sleeps different times to prevent for ubus race condition.
515+ if [ "$phy" = "phy1" ]; then
516+ sleep 1;
517+ elif [ "$phy" = "phy2" ]; then
518+ sleep 2;
519+ fi
520+
521 local hostapd_res="$(ubus call hostapd config_add "{\"iface\":\"$primary_ap\", \"config\":\"${hostapd_conf_file}\"}")"
522 ret="$?"
523 [ "$ret" != 0 -o -z "$hostapd_res" ] && {
developeree85b6b2023-12-22 18:33:35 +0800524@@ -1266,6 +1468,9 @@ drv_mac80211_setup() {
developer74503112023-06-29 17:34:49 +0800525 [ "${add_ap}" = 1 ] && sleep 1
526 for_each_interface "ap" mac80211_setup_vif
527
528+ [ -n "$sr_enable" ] && echo "$sr_enable" > /sys/kernel/debug/ieee80211/$phy/mt76/sr_enable
529+ [ -n "$sr_enhanced" ] && echo "$sr_enhanced" > /sys/kernel/debug/ieee80211/$phy/mt76/sr_enhanced_enable
530+
531 NEWSPLIST=
532 NEWUMLIST=
533
developer9b3248d2022-07-06 00:44:05 +0800534diff --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 +0800535index 3ecd932..e8c7743 100644
developere2597ba2022-06-24 13:09:16 +0800536--- a/package/kernel/mac80211/files/lib/wifi/mac80211.sh
537+++ b/package/kernel/mac80211/files/lib/wifi/mac80211.sh
developer20ce7bd2023-05-20 13:25:14 +0800538@@ -60,6 +60,9 @@ BEGIN {
developer785b6502023-04-19 18:31:11 +0800539 if (vht && band != "1:") mode="VHT80"
540 if (he) mode="HE80"
541 if (he && band == "1:") mode="HE20"
developer20ce7bd2023-05-20 13:25:14 +0800542+ if (eht && band == "2:") mode="EHT160"
543+ if (eht && band == "4:") mode="EHT320"
developer785b6502023-04-19 18:31:11 +0800544+ if (eht && band == "1:") mode="EHT20"
545 sub("\\[", "", channel)
546 sub("\\]", "", channel)
547 bands = bands band channel ":" mode " "
developer20ce7bd2023-05-20 13:25:14 +0800548@@ -73,6 +76,7 @@ $1 == "Band" {
developer785b6502023-04-19 18:31:11 +0800549 vht = ""
550 ht = ""
551 he = ""
552+ eht = ""
553 }
554
555 $0 ~ "Capabilities:" {
developer20ce7bd2023-05-20 13:25:14 +0800556@@ -87,6 +91,18 @@ $0 ~ "HE Iftypes" {
developer785b6502023-04-19 18:31:11 +0800557 he=1
558 }
559
560+$0 ~ "EHT Iftypes" {
561+ eht=1
562+}
563+
developer20ce7bd2023-05-20 13:25:14 +0800564+$0 ~ / *HE MAC Capabilities \(0x000000000000\)/ {
565+ he=0
566+}
567+
568+$0 ~ / *EHT MAC Capabilities \(0x0000\)/ {
569+ eht=0
570+}
571+
developer785b6502023-04-19 18:31:11 +0800572 $1 == "*" && $3 == "MHz" && $0 !~ /disabled/ && band && !channel {
573 channel = $4
574 }
developerf7aff422023-11-14 11:11:34 +0800575@@ -120,6 +136,20 @@ get_band_defaults() {
developere2597ba2022-06-24 13:09:16 +0800576 mode_band="$band"
577 channel="$chan"
578 htmode="$mode"
579+ if [ "$band" = "6g" ]
580+ then
581+ encryption=sae
582+ key=12345678
developer20ce7bd2023-05-20 13:25:14 +0800583+ sae_pwe=2
584+ ieee80211w=2
developeradbb45b2023-06-09 14:43:01 +0800585+ channel=37
586+ mbssid=1
developerf7aff422023-11-14 11:11:34 +0800587+ mbo=1
developere2597ba2022-06-24 13:09:16 +0800588+ else
developer659b07e2023-05-25 12:34:13 +0800589+ noscan=1
developere2597ba2022-06-24 13:09:16 +0800590+ encryption=none
developer2c6592a2023-07-21 11:20:56 +0800591+ rnr=1
developere2597ba2022-06-24 13:09:16 +0800592+ fi
593 done
594 }
595
developerf7aff422023-11-14 11:11:34 +0800596@@ -153,6 +183,10 @@ detect_mac80211() {
developer785b6502023-04-19 18:31:11 +0800597
598 json_load_file /etc/board.json
599
600+ # generate random bytes for macaddr
601+ rand=$(hexdump -C /dev/urandom | head -n 1 &)
602+ killall hexdump
603+
604 for _dev in /sys/class/ieee80211/*; do
605 [ -e "$_dev" ] || continue
606
developerf7aff422023-11-14 11:11:34 +0800607@@ -162,6 +196,13 @@ detect_mac80211() {
developere2597ba2022-06-24 13:09:16 +0800608 channel=""
609 htmode=""
610 ht_capab=""
611+ encryption=""
developer659b07e2023-05-25 12:34:13 +0800612+ noscan=""
developere2597ba2022-06-24 13:09:16 +0800613+ key=""
developer09257932023-05-09 13:41:30 +0800614+ sae_pwe=""
developer20ce7bd2023-05-20 13:25:14 +0800615+ ieee80211w=""
developeradbb45b2023-06-09 14:43:01 +0800616+ mbssid=""
developer2c6592a2023-07-21 11:20:56 +0800617+ rnr=""
developere2597ba2022-06-24 13:09:16 +0800618
619 get_band_defaults "$dev"
620
developerf7aff422023-11-14 11:11:34 +0800621@@ -192,6 +233,14 @@ detect_mac80211() {
developer785b6502023-04-19 18:31:11 +0800622 ;;
623 esac
624
developer212c0d82023-07-13 19:41:47 +0800625+ macaddr=""
developer1325ba72023-06-26 13:43:31 +0800626+ if (dmesg | grep -q "eeprom load fail"); then
developer1952bcd2023-06-20 20:14:37 +0800627+ for i in $(seq 2 3); do
628+ macaddr=${macaddr}:$(echo $rand | cut -d ' ' -f $i)
629+ done
630+ macaddr="00:0$(($devidx - 1)):55:66${macaddr}"
developer1952bcd2023-06-20 20:14:37 +0800631+ fi
developer785b6502023-04-19 18:31:11 +0800632+
633 uci -q batch <<-EOF
634 set wireless.${name}=wifi-device
635 set wireless.${name}.type=mac80211
developerf7aff422023-11-14 11:11:34 +0800636@@ -199,15 +248,43 @@ detect_mac80211() {
developer09257932023-05-09 13:41:30 +0800637 set wireless.${name}.channel=${channel}
638 set wireless.${name}.band=${mode_band}
639 set wireless.${name}.htmode=$htmode
640- set wireless.${name}.disabled=1
developer20ce7bd2023-05-20 13:25:14 +0800641+ set wireless.${name}.country='US'
developer659b07e2023-05-25 12:34:13 +0800642+ set wireless.${name}.noscan=${noscan}
developer09257932023-05-09 13:41:30 +0800643+ set wireless.${name}.disabled=0
developeradbb45b2023-06-09 14:43:01 +0800644+EOF
645+ [ -n "$mbssid" ] && {
646+ uci -q set wireless.${name}.mbssid=${mbssid}
647+ }
developer2c6592a2023-07-21 11:20:56 +0800648+ [ -n "$rnr" ] && {
649+ uci -q set wireless.${name}.rnr=${rnr}
650+ }
developer09257932023-05-09 13:41:30 +0800651
developeradbb45b2023-06-09 14:43:01 +0800652+ uci -q batch <<-EOF
developer09257932023-05-09 13:41:30 +0800653 set wireless.default_${name}=wifi-iface
654 set wireless.default_${name}.device=${name}
developer8d77be32022-10-20 15:08:25 +0800655 set wireless.default_${name}.network=lan
656 set wireless.default_${name}.mode=ap
developer09257932023-05-09 13:41:30 +0800657- set wireless.default_${name}.ssid=OpenWrt
developer8d77be32022-10-20 15:08:25 +0800658- set wireless.default_${name}.encryption=none
developer09257932023-05-09 13:41:30 +0800659+ set wireless.default_${name}.ssid=OpenWrt-${mode_band}
developer8d77be32022-10-20 15:08:25 +0800660+ set wireless.default_${name}.encryption=${encryption}
developere2597ba2022-06-24 13:09:16 +0800661 EOF
developer212c0d82023-07-13 19:41:47 +0800662+
663+ # calibrated board will use eeprom macaddress, not ramdom address
664+ [ -n "$macaddr" ] && {
665+ uci -q set wireless.default_${name}.macaddr=${macaddr}
666+ }
667+
developere2597ba2022-06-24 13:09:16 +0800668+ [ -n "$key" ] && {
developer8d77be32022-10-20 15:08:25 +0800669+ uci -q set wireless.default_${name}.key=${key}
developere2597ba2022-06-24 13:09:16 +0800670+ }
developer09257932023-05-09 13:41:30 +0800671+ [ -n "$sae_pwe" ] && {
672+ uci -q set wireless.default_${name}.sae_pwe=${sae_pwe}
673+ }
developer20ce7bd2023-05-20 13:25:14 +0800674+ [ -n "$ieee80211w" ] && {
675+ uci -q set wireless.default_${name}.ieee80211w=${ieee80211w}
676+ }
developerf7aff422023-11-14 11:11:34 +0800677+ [ -n "$mbo" ] && {
678+ uci -q set wireless.default_${name}.mbo=${mbo}
679+ }
developere2597ba2022-06-24 13:09:16 +0800680 uci -q commit wireless
developer8d77be32022-10-20 15:08:25 +0800681 done
682 }
developer85839fe2023-02-23 10:32:51 +0800683diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh
developer875fbb72023-12-13 15:49:01 +0800684index 28bd210..0df9a6f 100644
developer85839fe2023-02-23 10:32:51 +0800685--- a/package/network/services/hostapd/files/hostapd.sh
686+++ b/package/network/services/hostapd/files/hostapd.sh
developer74503112023-06-29 17:34:49 +0800687@@ -60,7 +60,14 @@ hostapd_append_wpa_key_mgmt() {
688 [ "${ieee80211w:-0}" -gt 0 ] && append wpa_key_mgmt "WPA-EAP-SHA256"
689 ;;
690 sae)
691- append wpa_key_mgmt "SAE"
692+ case "$encryption" in
693+ *sae-ext*)
694+ append wpa_key_mgmt "SAE-EXT-KEY"
695+ ;;
696+ *)
697+ append wpa_key_mgmt "SAE"
698+ ;;
699+ esac
700 [ "${ieee80211r:-0}" -gt 0 ] && append wpa_key_mgmt "FT-SAE"
701 ;;
702 psk-sae)
703@@ -115,6 +122,7 @@ hostapd_common_add_device_config() {
704 config_add_int rts_threshold
705 config_add_int rssi_reject_assoc_rssi
706 config_add_int rssi_ignore_probe_request
707+ config_add_int rssi_reject_assoc_timeout
708 config_add_int maxassoc
709
710 config_add_string acs_chan_bias
developer5ad89862023-08-24 08:17:27 +0800711@@ -225,8 +233,10 @@ hostapd_prepare_device_config() {
developer74503112023-06-29 17:34:49 +0800712 hostapd_add_rate brlist "$br"
713 done
714
715+ json_get_vars rssi_reject_assoc_timeout
716 [ -n "$rssi_reject_assoc_rssi" ] && append base_cfg "rssi_reject_assoc_rssi=$rssi_reject_assoc_rssi" "$N"
717 [ -n "$rssi_ignore_probe_request" ] && append base_cfg "rssi_ignore_probe_request=$rssi_ignore_probe_request" "$N"
718+ [ -n "$rssi_reject_assoc_timeout" ] && append base_cfg "rssi_reject_assoc_timeout=$rssi_reject_assoc_timeout" "$N"
719 [ -n "$beacon_rate" ] && append base_cfg "beacon_rate=$beacon_rate" "$N"
720 [ -n "$rlist" ] && append base_cfg "supported_rates=$rlist" "$N"
721 [ -n "$brlist" ] && append base_cfg "basic_rates=$brlist" "$N"
developer875fbb72023-12-13 15:49:01 +0800722@@ -376,6 +386,25 @@ hostapd_common_add_bss_config() {
developer82408892023-03-27 15:09:00 +0800723 config_add_string fils_dhcp
724
725 config_add_int ocv
726+
727+ config_add_int disable_eht
728+ config_add_int disable_he
729+ config_add_int disable_vht
730+ config_add_int disable_ht
developer813f5d72023-03-28 17:44:38 +0800731+
developerf166f542023-05-25 14:40:30 +0800732+ config_add_boolean beacon_prot interworking
developer74503112023-06-29 17:34:49 +0800733+
734+ config_add_int unsol_bcast_probe_resp_interval
735+ config_add_int fils_discovery_min_interval
736+ config_add_int fils_discovery_max_interval
737+ config_add_boolean rnr
738+
739+ config_add_array sae_groups
740+ config_add_array owe_groups
741+ config_add_array pairwise
742+ config_add_string group_cipher
developer875fbb72023-12-13 15:49:01 +0800743+ config_add_string group_mgmt_cipher
developer74503112023-06-29 17:34:49 +0800744+
developer82408892023-03-27 15:09:00 +0800745 }
746
747 hostapd_set_vlan_file() {
developer875fbb72023-12-13 15:49:01 +0800748@@ -440,11 +469,11 @@ append_iw_nai_realm() {
developerf166f542023-05-25 14:40:30 +0800749 }
750
751 append_iw_venue_name() {
752- append bss_conf "venue_name=$1" "$N"
753+ [ -n "$1" ] && append bss_conf "venue_name=$1" "$N"
754 }
755
756 append_iw_venue_url() {
757- append bss_conf "venue_url=$1" "$N"
758+ [ -n "$1" ] && append bss_conf "venue_url=$1" "$N"
759 }
760
761 append_hs20_oper_friendly_name() {
developer875fbb72023-12-13 15:49:01 +0800762@@ -562,7 +591,8 @@ hostapd_set_bss_options() {
developer74503112023-06-29 17:34:49 +0800763 ppsk airtime_bss_weight airtime_bss_limit airtime_sta_weight \
764 multicast_to_unicast_all proxy_arp per_sta_vif \
765 eap_server eap_user_file ca_cert server_cert private_key private_key_passwd server_id \
766- vendor_elements fils ocv
767+ vendor_elements fils ocv unsol_bcast_probe_resp_interval fils_discovery_min_interval \
developer875fbb72023-12-13 15:49:01 +0800768+ fils_discovery_max_interval rnr group_cipher group_mgmt_cipher
developer74503112023-06-29 17:34:49 +0800769
770 set_default fils 0
771 set_default isolate 0
developer875fbb72023-12-13 15:49:01 +0800772@@ -790,6 +820,36 @@ hostapd_set_bss_options() {
developer74503112023-06-29 17:34:49 +0800773 local auth_algs="$((($auth_mode_shared << 1) | $auth_mode_open))"
774 append bss_conf "auth_algs=${auth_algs:-1}" "$N"
775 append bss_conf "wpa=$wpa" "$N"
776+
777+ json_get_values pairwise pairwise
developer945ed992023-10-25 15:01:32 +0800778+ json_get_vars group_cipher
developer9097e5e2023-07-19 10:22:24 +0800779+ if [ -n "$pairwise" ]; then
780+ case "$pairwise" in
781+ *tkip+aes|*tkip+ccmp|*aes+tkip|*ccmp+tkip)
782+ wpa_cipher="CCMP TKIP"
783+ ;;
784+ *ccmp256)
785+ wpa_cipher="CCMP-256"
786+ ;;
787+ *aes|*ccmp)
788+ wpa_cipher="CCMP"
789+ ;;
790+ *tkip)
791+ wpa_cipher="TKIP"
792+ ;;
793+ *gcmp256)
794+ wpa_cipher="GCMP-256"
795+ ;;
796+ *gcmp)
797+ wpa_cipher="GCMP"
798+ ;;
799+ *)
800+ wpa_cipher=""
801+ ;;
802+ esac
803+ fi
developer74503112023-06-29 17:34:49 +0800804+ [ -n "$wpa_cipher" ] && wpa_pairwise="$wpa_cipher"
805+
806 [ -n "$wpa_pairwise" ] && append bss_conf "wpa_pairwise=$wpa_pairwise" "$N"
807
808 set_default wps_pushbutton 0
developer875fbb72023-12-13 15:49:01 +0800809@@ -841,7 +901,7 @@ hostapd_set_bss_options() {
developerda723192023-05-22 19:46:10 +0800810 }
811
812 append bss_conf "ssid=$ssid" "$N"
813- [ -n "$network_bridge" ] && append bss_conf "bridge=$network_bridge${N}wds_bridge=" "$N"
814+ [ -n "$network_bridge" ] && append bss_conf "bridge=$network_bridge${N}wds_bridge=$network_bridge" "$N"
815 [ -n "$network_ifname" ] && append bss_conf "snoop_iface=$network_ifname" "$N"
816 [ -n "$iapp_interface" ] && {
817 local ifname
developer875fbb72023-12-13 15:49:01 +0800818@@ -954,6 +1014,8 @@ hostapd_set_bss_options() {
developer74503112023-06-29 17:34:49 +0800819 fi
820
821 if [ "$wpa" -ge "2" ]; then
822+ json_get_values sae_groups sae_groups
823+ json_get_values owe_groups owe_groups
824 if [ -n "$network_bridge" -a "$rsn_preauth" = 1 ]; then
825 set_default auth_cache 1
826 append bss_conf "rsn_preauth=1" "$N"
developer875fbb72023-12-13 15:49:01 +0800827@@ -972,17 +1034,52 @@ hostapd_set_bss_options() {
developer74503112023-06-29 17:34:49 +0800828 append bss_conf "okc=$auth_cache" "$N"
829 [ "$auth_cache" = 0 -a "$fils" = 0 ] && append bss_conf "disable_pmksa_caching=1" "$N"
830
831+ [ -z "$group_cipher" ] && group_cipher="$wpa_cipher"
832+
833+ if [ -n "$sae_groups" -o -n "$owe_groups" ]; then
834+ case "$auth_type" in
835+ sae*)
836+ append bss_conf "sae_groups=$sae_groups" "$N"
837+ append bss_conf "group_cipher=$group_cipher" "$N"
838+ ;;
839+ owe)
840+ append bss_conf "owe_groups=$owe_groups" "$N"
841+ append bss_conf "group_cipher=$group_cipher" "$N"
842+ ;;
843+ esac
844+ fi
845+
developer813f5d72023-03-28 17:44:38 +0800846 # RSN -> allow management frame protection
847 case "$ieee80211w" in
848 [012])
849- json_get_vars ieee80211w_mgmt_cipher ieee80211w_max_timeout ieee80211w_retry_timeout
850+ json_get_vars ieee80211w_mgmt_cipher ieee80211w_max_timeout ieee80211w_retry_timeout beacon_prot
851 append bss_conf "ieee80211w=$ieee80211w" "$N"
852 [ "$ieee80211w" -gt "0" ] && {
developer875fbb72023-12-13 15:49:01 +0800853+ if [ -z "$group_mgmt_cipher" ]; then
854+ case "$group_cipher" in
855+ CCMP-256)
856+ ieee80211w_mgmt_cipher="BIP-CMAC-256"
857+ ;;
858+ CCMP)
859+ ieee80211w_mgmt_cipher="AES-128-CMAC"
860+ ;;
861+ GCMP-256)
862+ ieee80211w_mgmt_cipher="BIP-GMAC-256"
863+ ;;
864+ GCMP)
865+ ieee80211w_mgmt_cipher="BIP-GMAC-128"
866+ ;;
867+ esac
868+ else
869+ ieee80211w_mgmt_cipher="$group_mgmt_cipher"
870+ fi
developer813f5d72023-03-28 17:44:38 +0800871 if [ "$auth_type" = "eap192" ]; then
developer74503112023-06-29 17:34:49 +0800872 append bss_conf "group_mgmt_cipher=BIP-GMAC-256" "$N"
developer813f5d72023-03-28 17:44:38 +0800873 else
874 append bss_conf "group_mgmt_cipher=${ieee80211w_mgmt_cipher:-AES-128-CMAC}" "$N"
875 fi
876+ [ -n "$beacon_prot" ] && \
877+ append bss_conf "beacon_prot=$beacon_prot" "$N"
878 [ -n "$ieee80211w_max_timeout" ] && \
879 append bss_conf "assoc_sa_query_max_timeout=$ieee80211w_max_timeout" "$N"
880 [ -n "$ieee80211w_retry_timeout" ] && \
developer875fbb72023-12-13 15:49:01 +0800881@@ -1047,9 +1144,10 @@ hostapd_set_bss_options() {
developerf166f542023-05-25 14:40:30 +0800882 json_get_vars iw_roaming_consortium iw_domain_name iw_anqp_3gpp_cell_net iw_nai_realm
883 json_get_vars iw_anqp_elem iw_qos_map_set iw_ipaddr_type_availability iw_gas_address3
884 json_get_vars iw_venue_name iw_venue_url
885+ json_get_vars interworking
886
887 set_default iw_enabled 0
888- if [ "$iw_enabled" = "1" ]; then
889+ if [ "$iw_enabled" = "1" ] || [ "$interworking" = "1" ]; then
890 append bss_conf "interworking=1" "$N"
891 set_default iw_internet 1
892 set_default iw_asra 0
developer875fbb72023-12-13 15:49:01 +0800893@@ -1156,6 +1254,22 @@ hostapd_set_bss_options() {
developer74503112023-06-29 17:34:49 +0800894 append bss_conf "$val" "$N"
895 done
896
897+ if [ "$unsol_bcast_probe_resp_interval" -gt 0 ]; then
898+ append bss_conf "unsol_bcast_probe_resp_interval=$unsol_bcast_probe_resp_interval" "$N"
899+ fi
900+
901+ if [ -n "$fils_discovery_min_interval" ]; then
902+ append bss_conf "fils_discovery_min_interval=$fils_discovery_min_interval" "$N"
903+ fi
904+
905+ if [ -n "$fils_discovery_max_interval" ]; then
906+ append bss_conf "fils_discovery_max_interval=$fils_discovery_max_interval" "$N"
907+ fi
908+
909+ if [ -n "$rnr" ]; then
910+ append bss_conf "rnr=$rnr" "$N"
911+ fi
912+
913 bss_md5sum="$(echo $bss_conf | md5sum | cut -d" " -f1)"
914 append bss_conf "config_id=$bss_md5sum" "$N"
915
developer875fbb72023-12-13 15:49:01 +0800916@@ -1246,6 +1360,7 @@ wpa_supplicant_prepare_interface() {
developer18015ad2023-07-13 13:18:19 +0800917 country_str="country=$country"
918 }
919
developer2cf3f4c2023-07-24 16:58:25 +0800920+ local tx_queue_data2_burst="tx_queue_data2_burst=0"
developer18015ad2023-07-13 13:18:19 +0800921 multiap_flag_file="${_config}.is_multiap"
922 if [ "$multi_ap" = "1" ]; then
923 touch "$multiap_flag_file"
developer875fbb72023-12-13 15:49:01 +0800924@@ -1257,6 +1372,7 @@ wpa_supplicant_prepare_interface() {
developer18015ad2023-07-13 13:18:19 +0800925 ${scan_list:+freq_list=$scan_list}
926 $ap_scan
927 $country_str
928+$tx_queue_data2_burst
929 EOF
930 return 0
931 }
developer875fbb72023-12-13 15:49:01 +0800932@@ -1528,12 +1644,39 @@ wpa_supplicant_add_network() {
developer74503112023-06-29 17:34:49 +0800933 ;;
934 esac
935
developerbb29b5e2023-07-25 20:41:04 +0800936- [ "$wpa_cipher" = GCMP ] && {
937- append network_data "pairwise=GCMP" "$N$T"
938- append network_data "group=GCMP" "$N$T"
939- }
developer74503112023-06-29 17:34:49 +0800940+ json_get_values pairwise pairwise
developer875fbb72023-12-13 15:49:01 +0800941+ json_get_vars group_cipher group_mgmt_cipher
developer9097e5e2023-07-19 10:22:24 +0800942+ if [ -n "$pairwise" ]; then
943+ case "$pairwise" in
944+ *tkip+aes|*tkip+ccmp|*aes+tkip|*ccmp+tkip)
945+ wpa_cipher="CCMP TKIP"
946+ ;;
947+ *ccmp256)
948+ wpa_cipher="CCMP-256"
949+ ;;
950+ *aes|*ccmp)
951+ wpa_cipher="CCMP"
952+ ;;
953+ *tkip)
954+ wpa_cipher="TKIP"
955+ ;;
956+ *gcmp256)
957+ wpa_cipher="GCMP-256"
958+ ;;
959+ *gcmp)
960+ wpa_cipher="GCMP"
961+ ;;
962+ *)
963+ wpa_cipher=""
964+ ;;
965+ esac
966+ fi
developer74503112023-06-29 17:34:49 +0800967+ [ -n "$wpa_cipher" ] && wpa_pairwise="$wpa_cipher"
developer74503112023-06-29 17:34:49 +0800968
969 [ "$mode" = mesh ] || {
970+ json_get_values sae_groups sae_groups
971+ json_get_values owe_groups owe_groups
972+
973 case "$wpa" in
974 1)
975 append network_data "proto=WPA" "$N$T"
developer875fbb72023-12-13 15:49:01 +0800976@@ -1543,12 +1686,58 @@ wpa_supplicant_add_network() {
developer74503112023-06-29 17:34:49 +0800977 ;;
978 esac
979
980+ [ -n "$wpa_pairwise" ] && append network_data "pairwise=$wpa_pairwise" "$N$T"
981+ [ -z "$group_cipher" ] && group_cipher="$wpa_cipher"
982+
983+ if [ -n "$sae_groups" -o -n "$owe_groups" ]; then
984+ case "$auth_type" in
985+ sae*)
986+ echo "sae_groups=$sae_groups" >> "$_config"
987+ append network_data "group=$group_cipher" "$N$T"
988+ ;;
989+ owe)
990+ append network_data "owe_group=$owe_groups" "$N$T"
991+ append network_data "group=$group_cipher" "$N$T"
992+ ;;
993+ esac
994+ fi
995+
996+ # RSN -> allow management frame protection
997 case "$ieee80211w" in
998 [012])
999- [ "$wpa" -ge 2 ] && append network_data "ieee80211w=$ieee80211w" "$N$T"
1000+ json_get_vars ieee80211w_mgmt_cipher ieee80211w_max_timeout ieee80211w_retry_timeout beacon_prot
1001+ append network_data "ieee80211w=$ieee80211w" "$N$T"
1002+ [ "$ieee80211w" -gt "0" ] && {
developer875fbb72023-12-13 15:49:01 +08001003+ if [ -z "$group_mgmt_cipher" ]; then
1004+ case "$group_cipher" in
1005+ CCMP-256)
1006+ ieee80211w_mgmt_cipher="BIP-CMAC-256"
1007+ ;;
1008+ CCMP)
1009+ ieee80211w_mgmt_cipher="AES-128-CMAC"
1010+ ;;
1011+ GCMP-256)
1012+ ieee80211w_mgmt_cipher="BIP-GMAC-256"
1013+ ;;
1014+ GCMP)
1015+ ieee80211w_mgmt_cipher="BIP-GMAC-128"
1016+ ;;
1017+ esac
1018+ else
1019+ ieee80211w_mgmt_cipher="$group_mgmt_cipher"
1020+ fi
developer74503112023-06-29 17:34:49 +08001021+ if [ "$auth_type" = "eap192" ]; then
1022+ append network_data "group_mgmt=BIP-GMAC-256" "$N$T"
1023+ else
1024+ append network_data "group_mgmt=${ieee80211w_mgmt_cipher:-AES-128-CMAC}" "$N$T"
1025+ fi
1026+ [ -n "$beacon_prot" ] && \
1027+ append network_data "beacon_prot=$beacon_prot" "$N$T"
1028+ }
1029 ;;
1030 esac
1031 }
1032+
1033 [ -n "$bssid" ] && append network_data "bssid=$bssid" "$N$T"
1034 [ -n "$beacon_int" ] && append network_data "beacon_int=$beacon_int" "$N$T"
1035
developer875fbb72023-12-13 15:49:01 +08001036@@ -1559,6 +1748,20 @@ wpa_supplicant_add_network() {
developer82408892023-03-27 15:09:00 +08001037 [ -n "$bssid_blacklist" ] && append network_data "bssid_blacklist=$bssid_blacklist" "$N$T"
1038 [ -n "$bssid_whitelist" ] && append network_data "bssid_whitelist=$bssid_whitelist" "$N$T"
1039
1040+ local disable_eht
1041+ local disable_he
1042+ local disable_vht
1043+ local disable_ht
1044+ json_get_vars disable_eht
1045+ json_get_vars disable_he
1046+ json_get_vars disable_vht
1047+ json_get_vars disable_ht
1048+
1049+ [ -n "$disable_eht" ] && append network_data "disable_eht=$disable_eht" "$N$T"
1050+ [ -n "$disable_he" ] && append network_data "disable_he=$disable_he" "$N$T"
1051+ [ -n "$disable_vht" ] && append network_data "disable_vht=$disable_vht" "$N$T"
1052+ [ -n "$disable_ht" ] && append network_data "disable_ht=$disable_ht" "$N$T"
1053+
1054 [ -n "$basic_rate" ] && {
1055 local br rate_list=
1056 for br in $basic_rate; do
developer875fbb72023-12-13 15:49:01 +08001057@@ -1573,6 +1776,11 @@ wpa_supplicant_add_network() {
developer85839fe2023-02-23 10:32:51 +08001058 append network_data "mcast_rate=$mc_rate" "$N$T"
1059 }
1060
1061+ if [ "$auth_type" = "sae" ]; then
1062+ json_get_vars sae_pwe sae_pwe
1063+ [ -n "$sae_pwe" ] && echo "sae_pwe=$sae_pwe" >> "$_config"
1064+ fi
1065+
1066 if [ "$key_mgmt" = "WPS" ]; then
1067 echo "wps_cred_processing=1" >> "$_config"
1068 else