[][MAC80211][WiFi7][Misc][Fix patch fail]

[Description]
Fix patch fail

[Release-log]
N/A

Change-Id: Id98cafedf1bd588d5a7228502f35fc8496a87c1c
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/8854051
diff --git a/autobuild_mac80211_release/0001-wifi7-mac80211-generate-hostapd-setting-from-ap-cap.patch b/autobuild_mac80211_release/0001-wifi7-mac80211-generate-hostapd-setting-from-ap-cap.patch
index f77b6a2..4f03685 100644
--- a/autobuild_mac80211_release/0001-wifi7-mac80211-generate-hostapd-setting-from-ap-cap.patch
+++ b/autobuild_mac80211_release/0001-wifi7-mac80211-generate-hostapd-setting-from-ap-cap.patch
@@ -1,16 +1,16 @@
 diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile
-index 17e0d945..c73238a2 100644
+index 566cfdd..6a14118 100644
 --- a/package/kernel/mac80211/Makefile
 +++ b/package/kernel/mac80211/Makefile
-@@ -20,6 +20,7 @@ PKG_SOURCE:=backports-$(PKG_VERSION).tar.xz
- PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/backports-$(PKG_VERSION)
+@@ -22,6 +22,7 @@ PKG_SOURCE:=backports-$(PKG_VERSION).tar.xz
+ PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(if $(BUILD_VARIANT),$(PKG_NAME)-$(BUILD_VARIANT)/)backports-$(PKG_VERSION)
  PKG_BUILD_PARALLEL:=1
  
 +SOURCE_PATH:=./src
  PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  
  PKG_DRIVERS = \
-@@ -72,6 +73,10 @@ config-y:= \
+@@ -80,6 +81,10 @@ config-y:= \
  	WLAN_VENDOR_ST \
  	WLAN_VENDOR_TI \
  	WLAN_VENDOR_ZYDAS \
@@ -19,9 +19,9 @@
 +	MAC80211_STA_DEBUG \
 +	MAC80211_HT_DEBUG \
  
- config-$(call config_package,cfg80211) += CFG80211
+ config-$(call config_package,cfg80211,$(ALL_VARIANTS)) += CFG80211
  config-$(CONFIG_PACKAGE_CFG80211_TESTMODE) += NL80211_TESTMODE
-@@ -297,6 +302,7 @@ define Build/Prepare
+@@ -305,6 +310,7 @@ define Build/Prepare
  	mkdir -p $(PKG_BUILD_DIR)
  	$(PKG_UNPACK)
  	$(Build/Patch)
@@ -29,1098 +29,1092 @@
  	rm -rf \
  		$(PKG_BUILD_DIR)/include/linux/ssb \
  		$(PKG_BUILD_DIR)/include/linux/bcma \
-diff --git a/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh b/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh
-index 6572999f..5e44e663 100644
---- a/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh
-+++ b/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh
-@@ -29,10 +29,12 @@ drv_mac80211_init_device_config() {
- 	config_add_string path phy 'macaddr:macaddr'
- 	config_add_string tx_burst
- 	config_add_string distance
-+	config_add_int mbssid mu_onoff sr_enable sr_enhanced rnr obss_interval
- 	config_add_int beacon_int chanbw frag rts
- 	config_add_int rxantenna txantenna txpower min_tx_power
- 	config_add_int num_global_macaddr multiple_bssid
- 	config_add_boolean noscan ht_coex acs_exclude_dfs background_radar
-+	config_add_boolean noscan ht_coex acs_exclude_dfs background_radar background_cert_mode
- 	config_add_array ht_capab
- 	config_add_array channels
- 	config_add_array scan_list
-@@ -55,7 +57,10 @@ drv_mac80211_init_device_config() {
- 		he_spr_sr_control \
- 		he_spr_psr_enabled \
- 		he_bss_color_enabled \
--		he_twt_required
-+		he_twt_required \
-+		he_twt_responder \
-+		etxbfen \
-+		itxbfen
- 	config_add_int \
- 		beamformer_antennas \
- 		beamformee_antennas \
-@@ -142,13 +147,11 @@ mac80211_hostapd_setup_base() {
- 	[ -n "$acs_exclude_dfs" ] && [ "$acs_exclude_dfs" -gt 0 ] &&
- 		append base_cfg "acs_exclude_dfs=1" "$N"
- 
--	json_get_vars noscan ht_coex min_tx_power:0 tx_burst
-+	json_get_vars noscan ht_coex min_tx_power:0 tx_burst mbssid mu_onoff rnr obss_interval
-+	json_get_vars etxbfen:1 itxbfen:0
- 	json_get_values ht_capab_list ht_capab
- 	json_get_values channel_list channels
+diff --git a/package/network/config/wifi-scripts/files/lib/netifd/hostapd.sh b/package/network/config/wifi-scripts/files/lib/netifd/hostapd.sh
+index 763702e..3537e3a 100644
+--- a/package/network/config/wifi-scripts/files/lib/netifd/hostapd.sh
++++ b/package/network/config/wifi-scripts/files/lib/netifd/hostapd.sh
+@@ -60,7 +60,14 @@ hostapd_append_wpa_key_mgmt() {
+ 			append wpa_key_mgmt "WPA-EAP-SHA256"
+ 		;;
+ 		sae)
+-			append wpa_key_mgmt "SAE"
++			case "$encryption" in
++			*sae-ext*)
++				append wpa_key_mgmt "SAE-EXT-KEY"
++			;;
++			*)
++				append wpa_key_mgmt "SAE"
++			;;
++			esac
+ 			[ "${ieee80211r:-0}" -gt 0 ] && append wpa_key_mgmt "FT-SAE"
+ 		;;
+ 		psk-sae)
+@@ -119,6 +126,7 @@ hostapd_common_add_device_config() {
+ 	config_add_int rts_threshold
+ 	config_add_int rssi_reject_assoc_rssi
+ 	config_add_int rssi_ignore_probe_request
++	config_add_int rssi_reject_assoc_timeout
+ 	config_add_int maxassoc
  
--	[ "$auto_channel" = 0 ] && [ -z "$channel_list" ] && \
--		channel_list="$channel"
--
- 	[ "$min_tx_power" -gt 0 ] && append base_cfg "min_tx_power=$min_tx_power" "$N"
+ 	config_add_string acs_chan_bias
+@@ -231,8 +239,10 @@ hostapd_prepare_device_config() {
+ 		hostapd_add_rate brlist "$br"
+ 	done
  
- 	set_default noscan 0
-@@ -162,21 +165,42 @@ mac80211_hostapd_setup_base() {
- 	ieee80211n=1
- 	ht_capab=
- 	case "$htmode" in
--		VHT20|HT20|HE20) ;;
--		HT40*|VHT40|VHT80|VHT160|HE40|HE80|HE160)
-+		VHT20|HT20|HE20|EHT20) ;;
-+		HT40*|VHT40|VHT80|VHT160|HE40*|HE80|HE160|EHT40*|EHT80|EHT160|EHT320*)
- 			case "$hwmode" in
- 				a)
- 					case "$(( (($channel / 4) + $chan_ofs) % 2 ))" in
- 						1) ht_capab="[HT40+]";;
- 						0) ht_capab="[HT40-]";;
- 					esac
-+					case "$htmode" in
-+						HT40-|HE40-|EHT40-)
-+							if [ "$auto_channel" -gt 0 ]; then
-+								ht_capab="[HT40-]"
-+							fi
-+						;;
-+					esac
- 				;;
- 				*)
- 					case "$htmode" in
--						HT40+) ht_capab="[HT40+]";;
--						HT40-) ht_capab="[HT40-]";;
-+						HT40+|HE40+|EHT40+)
-+							if [ "$channel" -gt 9 ]; then
-+								echo "Could not set the center freq with this HT mode setting"
-+								return 1
-+							else
-+								ht_capab="[HT40+]"
-+							fi
-+						;;
-+						HT40-|HE40-|EHT40-)
-+							if [ "$channel" -lt 5 -a "$auto_channel" -eq 0 ]; then
-+								echo "Could not set the center freq with this HT mode setting"
-+								return 1
-+							else
-+								ht_capab="[HT40-]"
-+							fi
-+						;;
- 						*)
--							if [ "$channel" -lt 7 ]; then
-+							if [ "$channel" -lt 7 -o "$auto_channel" -gt 0 ]; then
- 								ht_capab="[HT40+]"
- 							else
- 								ht_capab="[HT40-]"
-@@ -185,7 +209,6 @@ mac80211_hostapd_setup_base() {
- 					esac
- 				;;
- 			esac
--			[ "$auto_channel" -gt 0 ] && ht_capab="[HT40+]"
- 		;;
- 		*) ieee80211n= ;;
- 	esac
-@@ -196,6 +219,11 @@ mac80211_hostapd_setup_base() {
- 		set_default ht_coex 0
- 		append base_cfg "ht_coex=$ht_coex" "$N"
++	json_get_vars rssi_reject_assoc_timeout
+ 	[ -n "$rssi_reject_assoc_rssi" ] && append base_cfg "rssi_reject_assoc_rssi=$rssi_reject_assoc_rssi" "$N"
+ 	[ -n "$rssi_ignore_probe_request" ] && append base_cfg "rssi_ignore_probe_request=$rssi_ignore_probe_request" "$N"
++	[ -n "$rssi_reject_assoc_timeout" ] && append base_cfg "rssi_reject_assoc_timeout=$rssi_reject_assoc_timeout" "$N"
+ 	[ -n "$beacon_rate" ] && append base_cfg "beacon_rate=$beacon_rate" "$N"
+ 	[ -n "$rlist" ] && append base_cfg "supported_rates=$rlist" "$N"
+ 	[ -n "$brlist" ] && append base_cfg "basic_rates=$brlist" "$N"
+@@ -383,6 +393,25 @@ hostapd_common_add_bss_config() {
+ 	config_add_string fils_dhcp
  
-+		[ "$ht_coex" -eq 1 ] && {
-+			set_default obss_interval 300
-+			append base_cfg "obss_interval=$obss_interval" "$N"
-+		}
+ 	config_add_int ocv
 +
- 		json_get_vars \
- 			ldpc:1 \
- 			greenfield:0 \
-@@ -207,7 +235,7 @@ mac80211_hostapd_setup_base() {
- 			dsss_cck_40:1
++	config_add_int disable_eht
++	config_add_int disable_he
++	config_add_int disable_vht
++	config_add_int disable_ht
++
++	config_add_boolean beacon_prot interworking
++
++	config_add_int unsol_bcast_probe_resp_interval
++	config_add_int fils_discovery_min_interval
++	config_add_int fils_discovery_max_interval
++	config_add_boolean rnr
++
++	config_add_array sae_groups
++	config_add_array owe_groups
++	config_add_array pairwise
++	config_add_string group_cipher
++	config_add_string group_mgmt_cipher
++
+ }
  
- 		ht_cap_mask=0
--		for cap in $(iw phy "$phy" info | grep 'Capabilities:' | cut -d: -f2); do
-+		for cap in $(iw phy "$phy" info | grep 'Capabilities: 0x' | cut -d: -f2); do
- 			ht_cap_mask="$(($ht_cap_mask | $cap))"
- 		done
+ hostapd_set_vlan_file() {
+@@ -447,11 +476,11 @@ append_iw_nai_realm() {
+ }
  
-@@ -238,8 +266,8 @@ mac80211_hostapd_setup_base() {
+ append_iw_venue_name() {
+-	append bss_conf "venue_name=$1" "$N"
++	[ -n "$1" ] && append bss_conf "venue_name=$1" "$N"
+ }
  
- 	idx="$channel"
- 	case "$htmode" in
--		VHT20|HE20) enable_ac=1;;
--		VHT40|HE40)
-+		VHT20|HE20|EHT20) enable_ac=1;;
-+		VHT40|HE40|EHT40)
- 			case "$(( (($channel / 4) + $chan_ofs) % 2 ))" in
- 				1) idx=$(($channel + 2));;
- 				0) idx=$(($channel - 2));;
-@@ -247,7 +275,7 @@ mac80211_hostapd_setup_base() {
- 			enable_ac=1
- 			vht_center_seg0=$idx
- 		;;
--		VHT80|HE80)
-+		VHT80|HE80|EHT80)
- 			case "$(( (($channel / 4) + $chan_ofs) % 4 ))" in
- 				1) idx=$(($channel + 6));;
- 				2) idx=$(($channel + 2));;
-@@ -258,7 +286,7 @@ mac80211_hostapd_setup_base() {
- 			vht_oper_chwidth=1
- 			vht_center_seg0=$idx
- 		;;
--		VHT160|HE160)
-+		VHT160|HE160|EHT160)
- 			if [ "$band" = "6g" ]; then
- 				case "$channel" in
- 					1|5|9|13|17|21|25|29) idx=15;;
-@@ -273,23 +301,64 @@ mac80211_hostapd_setup_base() {
- 				case "$channel" in
- 					36|40|44|48|52|56|60|64) idx=50;;
- 					100|104|108|112|116|120|124|128) idx=114;;
-+					149|153|157|161|165|169|173|177) idx=163;;
- 				esac
- 			fi
- 			enable_ac=1
- 			vht_oper_chwidth=2
- 			vht_center_seg0=$idx
- 		;;
-+		EHT320*)
-+			case "$channel" in
-+				1|5|9|13|17|21|25|29) idx=31;;
-+				33|37|41|45|49|53|57|61| \
-+				65|69|73|77|81|85|89|93) idx=63;;
-+				97|101|105|109|113|117|121|125| \
-+				129|133|137|141|145|149|153|157) idx=127;;
-+				161|165|169|173|177|181|185|189| \
-+				193|197|201|205|209|213|217|221) idx=191;;
-+			esac
-+			if [[ "$htmode" = "EHT320-1" && "$channel" -ge "193" ]] ||
-+			   [[ "$htmode" = "EHT320-2" && "$channel" -le "29" ]]; then
-+				echo "Could not set the center freq with this EHT setting"
-+				return 1
-+			elif [[ "$htmode" = "EHT320-1" && "$channel" -ge "33" ]]; then
-+				if [ "$channel" -gt $idx ]; then
-+					idx=$(($idx + 32))
-+				else
-+					idx=$(($idx - 32))
-+				fi
-+			fi
-+			vht_oper_chwidth=2
-+			if [ "$channel" -gt $idx ]; then
-+				vht_center_seg0=$(($idx + 16))
-+			else
-+				vht_center_seg0=$(($idx - 16))
-+			fi
-+			eht_oper_chwidth=9
-+			eht_oper_centr_freq_seg0_idx=$idx
+ append_iw_venue_url() {
+-	append bss_conf "venue_url=$1" "$N"
++	[ -n "$1" ] && append bss_conf "venue_url=$1" "$N"
+ }
+ 
+ append_hs20_oper_friendly_name() {
+@@ -569,7 +598,8 @@ hostapd_set_bss_options() {
+ 		ppsk airtime_bss_weight airtime_bss_limit airtime_sta_weight \
+ 		multicast_to_unicast_all proxy_arp per_sta_vif \
+ 		eap_server eap_user_file ca_cert server_cert private_key private_key_passwd server_id \
+-		vendor_elements fils ocv
++		vendor_elements fils ocv unsol_bcast_probe_resp_interval fils_discovery_min_interval \
++		fils_discovery_max_interval rnr group_cipher group_mgmt_cipher
+ 
+ 	set_default fils 0
+ 	set_default isolate 0
+@@ -796,6 +826,36 @@ hostapd_set_bss_options() {
+ 	local auth_algs="$((($auth_mode_shared << 1) | $auth_mode_open))"
+ 	append bss_conf "auth_algs=${auth_algs:-1}" "$N"
+ 	append bss_conf "wpa=$wpa" "$N"
 +
-+			case $htmode in
-+				EHT320-1) eht_bw320_offset=1;;
-+				EHT320-2) eht_bw320_offset=2;;
-+				EHT320) eht_bw320_offset=0;;
-+			esac
-+		;;
- 	esac
- 	[ "$band" = "5g" ] && {
--		json_get_vars background_radar:0
-+		json_get_vars \
-+			background_radar:0 \
-+			background_cert_mode:0 \
++	json_get_values pairwise pairwise
++	json_get_vars group_cipher
++	if [ -n "$pairwise" ]; then
++		case "$pairwise" in
++			*tkip+aes|*tkip+ccmp|*aes+tkip|*ccmp+tkip)
++				wpa_cipher="CCMP TKIP"
++			;;
++			*ccmp256)
++				wpa_cipher="CCMP-256"
++			;;
++			*aes|*ccmp)
++				wpa_cipher="CCMP"
++			;;
++			*tkip)
++				wpa_cipher="TKIP"
++			;;
++			*gcmp256)
++				wpa_cipher="GCMP-256"
++			;;
++			*gcmp)
++				wpa_cipher="GCMP"
++			;;
++			*)
++				wpa_cipher=""
++			;;
++		esac
++	fi
++	[ -n "$wpa_cipher" ] && wpa_pairwise="$wpa_cipher"
++
+ 	[ -n "$wpa_pairwise" ] && append bss_conf "wpa_pairwise=$wpa_pairwise" "$N"
  
- 		[ "$background_radar" -eq 1 ] && append base_cfg "enable_background_radar=1" "$N"
-+		[ "$background_cert_mode" -eq 1 ] && append base_cfg "background_radar_mode=1" "$N"
- 	}
- 	[ "$band" = "6g" ] && {
- 		op_class=
- 		case "$htmode" in
--			HE20) op_class=131;;
--			HE*) op_class=$((132 + $vht_oper_chwidth))
-+			HE20|EHT20) op_class=131;;
-+			EHT320*) op_class=137;;
-+			HE*|EHT*) op_class=$((132 + $vht_oper_chwidth))
- 		esac
- 		[ -n "$op_class" ] && append base_cfg "op_class=$op_class" "$N"
+ 	set_default wps_pushbutton 0
+@@ -847,7 +907,7 @@ hostapd_set_bss_options() {
  	}
-@@ -317,7 +386,6 @@ mac80211_hostapd_setup_base() {
- 			vht_link_adapt:3 \
- 			vht160:2
  
--		set_default tx_burst 2.0
- 		append base_cfg "ieee80211ac=1" "$N"
- 		vht_cap=0
- 		for cap in $(iw phy "$phy" info | awk -F "[()]" '/VHT Capabilities/ { print $2 }'); do
-@@ -336,6 +404,12 @@ mac80211_hostapd_setup_base() {
- 			short_gi_160=0
- 		}
+ 	append bss_conf "ssid=$ssid" "$N"
+-	[ -n "$network_bridge" ] && append bss_conf "bridge=$network_bridge${N}wds_bridge=" "$N"
++	[ -n "$network_bridge" ] && append bss_conf "bridge=$network_bridge${N}wds_bridge=$network_bridge" "$N"
+ 	[ -n "$network_ifname" ] && append bss_conf "snoop_iface=$network_ifname" "$N"
+ 	[ -n "$iapp_interface" ] && {
+ 		local ifname
+@@ -912,6 +972,8 @@ hostapd_set_bss_options() {
+ 	fi
  
-+		[ "$etxbfen" -eq 0 ] && {
-+			su_beamformer=0
-+			su_beamformee=0
-+			mu_beamformer=0
-+		}
-+
- 		mac80211_add_capabilities vht_capab $vht_cap \
- 			RXLDPC:0x10::$rxldpc \
- 			SHORT-GI-80:0x20::$short_gi_80 \
-@@ -417,7 +491,7 @@ mac80211_hostapd_setup_base() {
- 	# 802.11ax
- 	enable_ax=0
- 	case "$htmode" in
--		HE*) enable_ax=1 ;;
-+		HE*|EHT*) enable_ax=1 ;;
- 	esac
+ 	if [ "$wpa" -ge "2" ]; then
++		json_get_values sae_groups sae_groups
++		json_get_values owe_groups owe_groups
+ 		if [ "$ieee80211r" -gt "0" ]; then
+ 			json_get_vars mobility_domain ft_psk_generate_local ft_over_ds reassociation_deadline
  
- 	if [ "$enable_ax" != "0" ]; then
-@@ -426,10 +500,11 @@ mac80211_hostapd_setup_base() {
- 			he_su_beamformee:1 \
- 			he_mu_beamformer:1 \
- 			he_twt_required:0 \
-+			he_twt_responder \
- 			he_spr_sr_control:3 \
- 			he_spr_psr_enabled:0 \
- 			he_spr_non_srg_obss_pd_max_offset:0 \
--			he_bss_color:128 \
-+			he_bss_color \
- 			he_bss_color_enabled:1
+@@ -984,17 +1046,52 @@ hostapd_set_bss_options() {
+ 		append bss_conf "okc=$auth_cache" "$N"
+ 		[ "$auth_cache" = 0 -a "$fils" = 0 ] && append bss_conf "disable_pmksa_caching=1" "$N"
+ 
++		[ -z "$group_cipher" ] && group_cipher="$wpa_cipher"
++
++		if [ -n "$sae_groups" -o -n "$owe_groups" ]; then
++			case "$auth_type" in
++			sae*)
++				append bss_conf "sae_groups=$sae_groups" "$N"
++				append bss_conf "group_cipher=$group_cipher" "$N"
++			;;
++			owe)
++				append bss_conf "owe_groups=$owe_groups" "$N"
++				append bss_conf "group_cipher=$group_cipher" "$N"
++			;;
++			esac
++		fi
++
+ 		# RSN -> allow management frame protection
+ 		case "$ieee80211w" in
+ 			[012])
+-				json_get_vars ieee80211w_mgmt_cipher ieee80211w_max_timeout ieee80211w_retry_timeout
++				json_get_vars ieee80211w_mgmt_cipher ieee80211w_max_timeout ieee80211w_retry_timeout beacon_prot
+ 				append bss_conf "ieee80211w=$ieee80211w" "$N"
+ 				[ "$ieee80211w" -gt "0" ] && {
++					if [ -z "$group_mgmt_cipher" ]; then
++						case "$group_cipher" in
++						CCMP-256)
++							ieee80211w_mgmt_cipher="BIP-CMAC-256"
++						;;
++						CCMP)
++							ieee80211w_mgmt_cipher="AES-128-CMAC"
++						;;
++						GCMP-256)
++							ieee80211w_mgmt_cipher="BIP-GMAC-256"
++						;;
++						GCMP)
++							ieee80211w_mgmt_cipher="BIP-GMAC-128"
++						;;
++						esac
++					else
++						ieee80211w_mgmt_cipher="$group_mgmt_cipher"
++					fi
+ 					if [ "$auth_type" = "eap192" ]; then
+ 						append bss_conf "group_mgmt_cipher=BIP-GMAC-256" "$N"
+ 					else
+ 						append bss_conf "group_mgmt_cipher=${ieee80211w_mgmt_cipher:-AES-128-CMAC}" "$N"
+ 					fi
++					[ -n "$beacon_prot" ] && \
++						append bss_conf "beacon_prot=$beacon_prot" "$N"
+ 					[ -n "$ieee80211w_max_timeout" ] && \
+ 						append bss_conf "assoc_sa_query_max_timeout=$ieee80211w_max_timeout" "$N"
+ 					[ -n "$ieee80211w_retry_timeout" ] && \
+@@ -1059,9 +1156,10 @@ hostapd_set_bss_options() {
+ 	json_get_vars iw_roaming_consortium iw_domain_name iw_anqp_3gpp_cell_net iw_nai_realm
+ 	json_get_vars iw_anqp_elem iw_qos_map_set iw_ipaddr_type_availability iw_gas_address3
+ 	json_get_vars iw_venue_name iw_venue_url
++	json_get_vars interworking
  
- 		he_phy_cap=$(iw phy "$phy" info | sed -n '/HE Iftypes: AP/,$p' | awk -F "[()]" '/HE PHY Capabilities/ { print $2 }' | head -1)
-@@ -443,6 +518,11 @@ mac80211_hostapd_setup_base() {
- 			append base_cfg "he_oper_centr_freq_seg0_idx=$vht_center_seg0" "$N"
- 		}
+ 	set_default iw_enabled 0
+-	if [ "$iw_enabled" = "1" ]; then
++	if [ "$iw_enabled" = "1" ] || [ "$interworking" = "1" ]; then
+ 		append bss_conf "interworking=1" "$N"
+ 		set_default iw_internet 1
+ 		set_default iw_asra 0
+@@ -1168,6 +1266,22 @@ hostapd_set_bss_options() {
+ 		append bss_conf "$val" "$N"
+ 	done
  
-+		[ "$etxbfen" -eq 0 ] && {
-+			he_su_beamformer=0
-+			he_mu_beamformer=0
-+		}
++	if [ "$unsol_bcast_probe_resp_interval" -gt 0 ]; then
++		append bss_conf "unsol_bcast_probe_resp_interval=$unsol_bcast_probe_resp_interval" "$N"
++	fi
 +
- 		mac80211_add_he_capabilities \
- 			he_su_beamformer:${he_phy_cap:6:2}:0x80:$he_su_beamformer \
- 			he_su_beamformee:${he_phy_cap:8:2}:0x1:$he_su_beamformee \
-@@ -450,7 +530,14 @@ mac80211_hostapd_setup_base() {
- 			he_spr_psr_enabled:${he_phy_cap:14:2}:0x1:$he_spr_psr_enabled \
- 			he_twt_required:${he_mac_cap:0:2}:0x6:$he_twt_required
- 
-+		if [ -n "$he_twt_responder" ]; then
-+			append base_cfg "he_twt_responder=$he_twt_responder" "$N"
-+		fi
- 		if [ "$he_bss_color_enabled" -gt 0 ]; then
-+			if !([ "$he_bss_color" -gt 0 ] && [ "$he_bss_color" -le 64 ]); then
-+				rand=$(head -n 1 /dev/urandom | tr -dc 0-9 | head -c 2)
-+				he_bss_color=$((rand % 63 + 1))
-+			fi
- 			append base_cfg "he_bss_color=$he_bss_color" "$N"
- 			[ "$he_spr_non_srg_obss_pd_max_offset" -gt 0 ] && { \
- 				append base_cfg "he_spr_non_srg_obss_pd_max_offset=$he_spr_non_srg_obss_pd_max_offset" "$N"
-@@ -469,26 +556,58 @@ mac80211_hostapd_setup_base() {
- 		append base_cfg "he_mu_edca_qos_info_q_ack=0" "$N"
- 		append base_cfg "he_mu_edca_qos_info_queue_request=0" "$N"
- 		append base_cfg "he_mu_edca_qos_info_txop_request=0" "$N"
--		append base_cfg "he_mu_edca_ac_be_aifsn=8" "$N"
-+		append base_cfg "he_mu_edca_ac_be_aifsn=0" "$N"
- 		append base_cfg "he_mu_edca_ac_be_aci=0" "$N"
- 		append base_cfg "he_mu_edca_ac_be_ecwmin=9" "$N"
- 		append base_cfg "he_mu_edca_ac_be_ecwmax=10" "$N"
--		append base_cfg "he_mu_edca_ac_be_timer=255" "$N"
--		append base_cfg "he_mu_edca_ac_bk_aifsn=15" "$N"
-+		append base_cfg "he_mu_edca_ac_be_timer=3" "$N"
-+		append base_cfg "he_mu_edca_ac_bk_aifsn=0" "$N"
- 		append base_cfg "he_mu_edca_ac_bk_aci=1" "$N"
- 		append base_cfg "he_mu_edca_ac_bk_ecwmin=9" "$N"
- 		append base_cfg "he_mu_edca_ac_bk_ecwmax=10" "$N"
--		append base_cfg "he_mu_edca_ac_bk_timer=255" "$N"
-+		append base_cfg "he_mu_edca_ac_bk_timer=3" "$N"
- 		append base_cfg "he_mu_edca_ac_vi_ecwmin=5" "$N"
- 		append base_cfg "he_mu_edca_ac_vi_ecwmax=7" "$N"
--		append base_cfg "he_mu_edca_ac_vi_aifsn=5" "$N"
-+		append base_cfg "he_mu_edca_ac_vi_aifsn=0" "$N"
- 		append base_cfg "he_mu_edca_ac_vi_aci=2" "$N"
--		append base_cfg "he_mu_edca_ac_vi_timer=255" "$N"
--		append base_cfg "he_mu_edca_ac_vo_aifsn=5" "$N"
-+		append base_cfg "he_mu_edca_ac_vi_timer=3" "$N"
-+		append base_cfg "he_mu_edca_ac_vo_aifsn=0" "$N"
- 		append base_cfg "he_mu_edca_ac_vo_aci=3" "$N"
- 		append base_cfg "he_mu_edca_ac_vo_ecwmin=5" "$N"
- 		append base_cfg "he_mu_edca_ac_vo_ecwmax=7" "$N"
--		append base_cfg "he_mu_edca_ac_vo_timer=255" "$N"
-+		append base_cfg "he_mu_edca_ac_vo_timer=3" "$N"
++	if [ -n "$fils_discovery_min_interval" ]; then
++		append bss_conf "fils_discovery_min_interval=$fils_discovery_min_interval" "$N"
 +	fi
 +
-+	set_default tx_burst 2
++	if [ -n "$fils_discovery_max_interval" ]; then
++		append bss_conf "fils_discovery_max_interval=$fils_discovery_max_interval" "$N"
++	fi
 +
-+	# 802.11be
-+	enable_be=0
-+	case "$htmode" in
-+		EHT*) enable_be=1 ;;
-+	esac
++	if [ -n "$rnr" ]; then
++		append bss_conf "rnr=$rnr" "$N"
++	fi
 +
-+	if [ "$enable_be" != "0" ]; then
-+		append base_cfg "ieee80211be=1" "$N"
-+		if [ "$etxbfen" -eq 0 ]; then
-+			append base_cfg "eht_su_beamformee=1" "$N"
-+		else
-+			append base_cfg "eht_su_beamformer=1" "$N"
-+			append base_cfg "eht_su_beamformee=1" "$N"
-+			append base_cfg "eht_mu_beamformer=1" "$N"
-+		fi
-+		[ "$hwmode" = "a" ] && {
-+			case $htmode in
-+				EHT320*)
-+					append base_cfg "eht_oper_chwidth=$eht_oper_chwidth" "$N"
-+					append base_cfg "eht_oper_centr_freq_seg0_idx=$eht_oper_centr_freq_seg0_idx" "$N"
-+					append base_cfg "eht_bw320_offset=$eht_bw320_offset" "$N"
-+				;;
-+				*)
-+					append base_cfg "eht_oper_chwidth=$vht_oper_chwidth" "$N"
-+					append base_cfg "eht_oper_centr_freq_seg0_idx=$vht_center_seg0" "$N"
-+				;;
-+			esac
-+		}
- 	fi
- 
- 	hostapd_prepare_device_config "$hostapd_conf_file" nl80211
-@@ -497,6 +616,10 @@ ${channel:+channel=$channel}
- ${channel_list:+chanlist=$channel_list}
- ${hostapd_noscan:+noscan=1}
- ${tx_burst:+tx_queue_data2_burst=$tx_burst}
-+${mbssid:+mbssid=$mbssid}
-+${mu_onoff:+mu_onoff=$mu_onoff}
-+${itxbfen:+ibf_enable=$itxbfen}
-+${rnr:+rnr=$rnr}
- ${multiple_bssid:+mbssid=$multiple_bssid}
- #num_global_macaddr=$num_global_macaddr
- $base_cfg
-@@ -524,7 +647,7 @@ mac80211_hostapd_setup_bss() {
- 		append hostapd_cfg "wds_sta=1" "$N"
- 		[ -n "$wds_bridge" ] && append hostapd_cfg "wds_bridge=$wds_bridge" "$N"
+ 	append "$var" "$bss_conf" "$N"
+ 	return 0
+ }
+@@ -1255,6 +1369,7 @@ wpa_supplicant_prepare_interface() {
+ 		country_str="country=$country"
  	}
--	[ "$staidx" -gt 0 -o "$start_disabled" -eq 1 ] && append hostapd_cfg "start_disabled=1" "$N"
-+	[ "$start_disabled" -eq 1 ] && append hostapd_cfg "start_disabled=1" "$N"
  
- 	cat >> /var/run/hostapd-$phy.conf <<EOF
- $hostapd_cfg
-@@ -535,6 +658,31 @@ ${max_listen_int:+max_listen_interval=$max_listen_int}
++	local tx_queue_data2_burst="tx_queue_data2_burst=0"
+ 	multiap_flag_file="${_config}.is_multiap"
+ 	if [ "$multi_ap" = "1" ]; then
+ 		touch "$multiap_flag_file"
+@@ -1266,6 +1381,7 @@ wpa_supplicant_prepare_interface() {
+ ${scan_list:+freq_list=$scan_list}
+ $ap_scan
+ $country_str
++$tx_queue_data2_burst
  EOF
+ 	return 0
  }
+@@ -1537,12 +1653,39 @@ wpa_supplicant_add_network() {
+ 		;;
+ 	esac
+ 
+-	[ "$wpa_cipher" = GCMP ] && {
+-		append network_data "pairwise=GCMP" "$N$T"
+-		append network_data "group=GCMP" "$N$T"
+-	}
++	json_get_values pairwise pairwise
++	json_get_vars group_cipher group_mgmt_cipher
++	if [ -n "$pairwise" ]; then
++		case "$pairwise" in
++			*tkip+aes|*tkip+ccmp|*aes+tkip|*ccmp+tkip)
++				wpa_cipher="CCMP TKIP"
++			;;
++			*ccmp256)
++				wpa_cipher="CCMP-256"
++			;;
++			*aes|*ccmp)
++				wpa_cipher="CCMP"
++			;;
++			*tkip)
++				wpa_cipher="TKIP"
++			;;
++			*gcmp256)
++				wpa_cipher="GCMP-256"
++			;;
++			*gcmp)
++				wpa_cipher="GCMP"
++			;;
++			*)
++				wpa_cipher=""
++			;;
++		esac
++	fi
++	[ -n "$wpa_cipher" ] && wpa_pairwise="$wpa_cipher"
+ 
+ 	[ "$mode" = mesh ] || {
++		json_get_values sae_groups sae_groups
++		json_get_values owe_groups owe_groups
++
+ 		case "$wpa" in
+ 			1)
+ 				append network_data "proto=WPA" "$N$T"
+@@ -1552,12 +1695,58 @@ wpa_supplicant_add_network() {
+ 			;;
+ 		esac
+ 
++		[ -n "$wpa_pairwise" ] && append network_data "pairwise=$wpa_pairwise" "$N$T"
++		[ -z "$group_cipher" ] && group_cipher="$wpa_cipher"
++
++		if [ -n "$sae_groups" -o -n "$owe_groups" ]; then
++			case "$auth_type" in
++			sae*)
++				echo "sae_groups=$sae_groups" >> "$_config"
++				append network_data "group=$group_cipher" "$N$T"
++			;;
++			owe)
++				append network_data "owe_group=$owe_groups" "$N$T"
++				append network_data "group=$group_cipher" "$N$T"
++			;;
++			esac
++		fi
++
++		# RSN -> allow management frame protection
+ 		case "$ieee80211w" in
+ 			[012])
+-				[ "$wpa" -ge 2 ] && append network_data "ieee80211w=$ieee80211w" "$N$T"
++				json_get_vars ieee80211w_mgmt_cipher ieee80211w_max_timeout ieee80211w_retry_timeout beacon_prot
++				append network_data "ieee80211w=$ieee80211w" "$N$T"
++				[ "$ieee80211w" -gt "0" ] && {
++					if [ -z "$group_mgmt_cipher" ]; then
++						case "$group_cipher" in
++						CCMP-256)
++							ieee80211w_mgmt_cipher="BIP-CMAC-256"
++						;;
++						CCMP)
++							ieee80211w_mgmt_cipher="AES-128-CMAC"
++						;;
++						GCMP-256)
++							ieee80211w_mgmt_cipher="BIP-GMAC-256"
++						;;
++						GCMP)
++							ieee80211w_mgmt_cipher="BIP-GMAC-128"
++						;;
++						esac
++					else
++						ieee80211w_mgmt_cipher="$group_mgmt_cipher"
++					fi
++					if [ "$auth_type" = "eap192" ]; then
++						append network_data "group_mgmt=BIP-GMAC-256" "$N$T"
++					else
++						append network_data "group_mgmt=${ieee80211w_mgmt_cipher:-AES-128-CMAC}" "$N$T"
++					fi
++					[ -n "$beacon_prot" ] && \
++						append network_data "beacon_prot=$beacon_prot" "$N$T"
++				}
+ 			;;
+ 		esac
+ 	}
++
+ 	[ -n "$bssid" ] && append network_data "bssid=$bssid" "$N$T"
+ 	[ -n "$beacon_int" ] && append network_data "beacon_int=$beacon_int" "$N$T"
+ 
+@@ -1568,6 +1757,20 @@ wpa_supplicant_add_network() {
+ 	[ -n "$bssid_blacklist" ] && append network_data "bssid_blacklist=$bssid_blacklist" "$N$T"
+ 	[ -n "$bssid_whitelist" ] && append network_data "bssid_whitelist=$bssid_whitelist" "$N$T"
  
-+mac80211_generate_mbssid_mac() {
-+	local phy="$1"
-+	local transmitted_bssid="$2"
-+	local id="${mbssidx:-0}"
-+
-+	local ref="$(cat /sys/class/ieee80211/${phy}/macaddress)"
++        local disable_eht
++        local disable_he
++        local disable_vht
++        local disable_ht
++        json_get_vars disable_eht
++        json_get_vars disable_he
++        json_get_vars disable_vht
++        json_get_vars disable_ht
 +
-+	if [ -z "$transmitted_bssid" ]; then
-+		transmitted_bssid=$ref
-+	fi
++        [ -n "$disable_eht" ] && append network_data "disable_eht=$disable_eht" "$N$T"
++        [ -n "$disable_he" ] && append network_data "disable_he=$disable_he" "$N$T"
++        [ -n "$disable_vht" ] && append network_data "disable_vht=$disable_vht" "$N$T"
++        [ -n "$disable_ht" ] && append network_data "disable_ht=$disable_ht" "$N$T"
 +
-+	if [ $id -eq 0 ]; then
-+		echo "$transmitted_bssid"
-+		return
+ 	[ -n "$basic_rate" ] && {
+ 		local br rate_list=
+ 		for br in $basic_rate; do
+@@ -1582,6 +1785,11 @@ wpa_supplicant_add_network() {
+ 		append network_data "mcast_rate=$mc_rate" "$N$T"
+ 	}
+ 
++	if [ "$auth_type" = "sae" ]; then
++		json_get_vars sae_pwe sae_pwe
++		[ -n "$sae_pwe" ] && echo "sae_pwe=$sae_pwe" >> "$_config"
 +	fi
 +
-+	local oIFS="$IFS"; IFS=":"; set -- $transmitted_bssid; IFS="$oIFS"
-+
-+	# Calculate nontransmitted bssid
-+	b6="0x$6"
-+	ref_b6=$(($b6 % $max_mbssid))
-+	b6=$(($b6 - $ref_b6 + ($ref_b6 + $id) % $max_mbssid))
-+	printf "%s:%s:%s:%s:%s:%02x" $1 $2 $3 $4 $5 $b6
-+}
-+
- mac80211_get_addr() {
- 	local phy="$1"
- 	local idx="$(($2 + 1))"
-@@ -658,7 +806,19 @@ mac80211_prepare_vif() {
- 	json_add_string _ifname "$ifname"
+ 	if [ "$key_mgmt" = "WPS" ]; then
+ 		echo "wps_cred_processing=1" >> "$_config"
+ 	else
+diff --git a/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh b/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh
+index bc59c30..66bdf5c 100755
+--- a/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh
++++ b/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh
+@@ -29,10 +29,12 @@ drv_mac80211_init_device_config() {
+ 	config_add_string path phy 'macaddr:macaddr'
+ 	config_add_string tx_burst
+ 	config_add_string distance
++	config_add_int mbssid mu_onoff sr_enable sr_enhanced rnr obss_interval
+ 	config_add_int beacon_int chanbw frag rts
+ 	config_add_int rxantenna txantenna txpower min_tx_power
+ 	config_add_int num_global_macaddr multiple_bssid
+ 	config_add_boolean noscan ht_coex acs_exclude_dfs background_radar
++	config_add_boolean noscan ht_coex acs_exclude_dfs background_radar background_cert_mode
+ 	config_add_array ht_capab
+ 	config_add_array channels
+ 	config_add_array scan_list
+@@ -55,7 +57,10 @@ drv_mac80211_init_device_config() {
+ 		he_spr_sr_control \
+ 		he_spr_psr_enabled \
+ 		he_bss_color_enabled \
+-		he_twt_required
++		he_twt_required \
++		he_twt_responder \
++		etxbfen \
++		itxbfen
+ 	config_add_int \
+ 		beamformer_antennas \
+ 		beamformee_antennas \
+@@ -142,13 +147,11 @@ mac80211_hostapd_setup_base() {
+ 	[ -n "$acs_exclude_dfs" ] && [ "$acs_exclude_dfs" -gt 0 ] &&
+ 		append base_cfg "acs_exclude_dfs=1" "$N"
  
- 	default_macaddr=
--	if [ -z "$macaddr" ]; then
-+	if [ "$mbssid" -gt 0 ] && [ "$mode" == "ap" ]; then
-+		[ "$mbssidx" -eq 0 ] && {
-+			if [ -z $macaddr ]; then
-+				transmitted_bssid="$(mac80211_generate_mac $phy)"
-+			else
-+				# uci set mac address
-+				transmitted_bssid=$macaddr
-+			fi
-+			macidx="$(($macidx + 1))"
-+		}
-+		macaddr="$(mac80211_generate_mbssid_mac $phy $transmitted_bssid)"
-+		mbssidx="$(($mbssidx + 1))"
-+	elif [ -z "$macaddr" ]; then
- 		macaddr="$(mac80211_generate_mac $phy)"
- 		macidx="$(($macidx + 1))"
- 		default_macaddr=1
-@@ -916,12 +1076,28 @@ wpa_supplicant_set_config() {
- }
+-	json_get_vars noscan ht_coex min_tx_power:0 tx_burst
++	json_get_vars noscan ht_coex min_tx_power:0 tx_burst mbssid mu_onoff rnr obss_interval
++	json_get_vars etxbfen:1 itxbfen:0
+ 	json_get_values ht_capab_list ht_capab
+ 	json_get_values channel_list channels
  
- hostapd_set_config() {
-+
-+	if [ "$inconsistent_country" -eq 1 ]; then
-+		echo "ERROR: Please use the same country for all the radios."
-+		wireless_setup_failed HOSTAPD_START_FAILED
-+		drv_mac80211_teardown
-+		return
-+	fi
-+
- 	[ -n "$hostapd_ctrl" ] || {
- 		ubus_call hostapd config_set '{ "phy": "'"$phy"'", "config": "", "prev_config": "'"${hostapd_conf_file}.prev"'" }' > /dev/null
- 		return 0;
- 	}
+-	[ "$auto_channel" = 0 ] && [ -z "$channel_list" ] && \
+-		channel_list="$channel"
+-
+ 	[ "$min_tx_power" -gt 0 ] && append base_cfg "min_tx_power=$min_tx_power" "$N"
  
- 	ubus wait_for hostapd
+ 	set_default noscan 0
+@@ -162,21 +165,42 @@ mac80211_hostapd_setup_base() {
+ 	ieee80211n=1
+ 	ht_capab=
+ 	case "$htmode" in
+-		VHT20|HT20|HE20) ;;
+-		HT40*|VHT40|VHT80|VHT160|HE40|HE80|HE160)
++		VHT20|HT20|HE20|EHT20) ;;
++		HT40*|VHT40|VHT80|VHT160|HE40*|HE80|HE160|EHT40*|EHT80|EHT160|EHT320*)
+ 			case "$hwmode" in
+ 				a)
+ 					case "$(( (($channel / 4) + $chan_ofs) % 2 ))" in
+ 						1) ht_capab="[HT40+]";;
+ 						0) ht_capab="[HT40-]";;
+ 					esac
++					case "$htmode" in
++						HT40-|HE40-|EHT40-)
++							if [ "$auto_channel" -gt 0 ]; then
++								ht_capab="[HT40-]"
++							fi
++						;;
++					esac
+ 				;;
+ 				*)
+ 					case "$htmode" in
+-						HT40+) ht_capab="[HT40+]";;
+-						HT40-) ht_capab="[HT40-]";;
++						HT40+|HE40+|EHT40+)
++							if [ "$channel" -gt 9 ]; then
++								echo "Could not set the center freq with this HT mode setting"
++								return 1
++							else
++								ht_capab="[HT40+]"
++							fi
++						;;
++						HT40-|HE40-|EHT40-)
++							if [ "$channel" -lt 5 -a "$auto_channel" -eq 0 ]; then
++								echo "Could not set the center freq with this HT mode setting"
++								return 1
++							else
++								ht_capab="[HT40-]"
++							fi
++						;;
+ 						*)
+-							if [ "$channel" -lt 7 ]; then
++							if [ "$channel" -lt 7 -o "$auto_channel" -gt 0 ]; then
+ 								ht_capab="[HT40+]"
+ 							else
+ 								ht_capab="[HT40-]"
+@@ -185,7 +209,6 @@ mac80211_hostapd_setup_base() {
+ 					esac
+ 				;;
+ 			esac
+-			[ "$auto_channel" -gt 0 ] && ht_capab="[HT40+]"
+ 		;;
+ 		*) ieee80211n= ;;
+ 	esac
+@@ -196,6 +219,11 @@ mac80211_hostapd_setup_base() {
+ 		set_default ht_coex 0
+ 		append base_cfg "ht_coex=$ht_coex" "$N"
+ 
++		[ "$ht_coex" -eq 1 ] && {
++			set_default obss_interval 300
++			append base_cfg "obss_interval=$obss_interval" "$N"
++		}
 +
-+	# each phy sleeps different times to prevent for ubus race condition.
-+	if [ "$phy" = "phy1" ]; then
-+		sleep 3;
-+	elif [ "$phy" = "phy2" ]; then
-+		sleep 6;
-+	fi
+ 		json_get_vars \
+ 			ldpc:1 \
+ 			greenfield:0 \
+@@ -207,7 +235,7 @@ mac80211_hostapd_setup_base() {
+ 			dsss_cck_40:1
+ 
+ 		ht_cap_mask=0
+-		for cap in $(iw phy "$phy" info | grep 'Capabilities:' | cut -d: -f2); do
++		for cap in $(iw phy "$phy" info | grep 'Capabilities: 0x' | cut -d: -f2); do
+ 			ht_cap_mask="$(($ht_cap_mask | $cap))"
+ 		done
+ 
+@@ -238,8 +266,8 @@ mac80211_hostapd_setup_base() {
+ 
+ 	idx="$channel"
+ 	case "$htmode" in
+-		VHT20|HE20) enable_ac=1;;
+-		VHT40|HE40)
++		VHT20|HE20|EHT20) enable_ac=1;;
++		VHT40|HE40|EHT40)
+ 			case "$(( (($channel / 4) + $chan_ofs) % 2 ))" in
+ 				1) idx=$(($channel + 2));;
+ 				0) idx=$(($channel - 2));;
+@@ -247,7 +275,7 @@ mac80211_hostapd_setup_base() {
+ 			enable_ac=1
+ 			vht_center_seg0=$idx
+ 		;;
+-		VHT80|HE80)
++		VHT80|HE80|EHT80)
+ 			case "$(( (($channel / 4) + $chan_ofs) % 4 ))" in
+ 				1) idx=$(($channel + 6));;
+ 				2) idx=$(($channel + 2));;
+@@ -258,7 +286,7 @@ mac80211_hostapd_setup_base() {
+ 			vht_oper_chwidth=1
+ 			vht_center_seg0=$idx
+ 		;;
+-		VHT160|HE160)
++		VHT160|HE160|EHT160)
+ 			if [ "$band" = "6g" ]; then
+ 				case "$channel" in
+ 					1|5|9|13|17|21|25|29) idx=15;;
+@@ -280,17 +308,57 @@ mac80211_hostapd_setup_base() {
+ 			vht_oper_chwidth=2
+ 			vht_center_seg0=$idx
+ 		;;
++		EHT320*)
++			case "$channel" in
++				1|5|9|13|17|21|25|29) idx=31;;
++				33|37|41|45|49|53|57|61| \
++				65|69|73|77|81|85|89|93) idx=63;;
++				97|101|105|109|113|117|121|125| \
++				129|133|137|141|145|149|153|157) idx=127;;
++				161|165|169|173|177|181|185|189| \
++				193|197|201|205|209|213|217|221) idx=191;;
++			esac
++			if [[ "$htmode" = "EHT320-1" && "$channel" -ge "193" ]] ||
++			   [[ "$htmode" = "EHT320-2" && "$channel" -le "29" ]]; then
++				echo "Could not set the center freq with this EHT setting"
++				return 1
++			elif [[ "$htmode" = "EHT320-1" && "$channel" -ge "33" ]]; then
++				if [ "$channel" -gt $idx ]; then
++					idx=$(($idx + 32))
++				else
++					idx=$(($idx - 32))
++				fi
++			fi
++			vht_oper_chwidth=2
++			if [ "$channel" -gt $idx ]; then
++				vht_center_seg0=$(($idx + 16))
++			else
++				vht_center_seg0=$(($idx - 16))
++			fi
++			eht_oper_chwidth=9
++			eht_oper_centr_freq_seg0_idx=$idx
 +
- 	local hostapd_res="$(ubus_call hostapd config_set "{ \"phy\": \"$phy\", \"config\":\"${hostapd_conf_file}\", \"prev_config\": \"${hostapd_conf_file}.prev\"}")"
- 	ret="$?"
- 	[ "$ret" != 0 -o -z "$hostapd_res" ] && {
-@@ -999,6 +1175,9 @@ mac80211_setup_vif() {
++			case $htmode in
++				EHT320-1) eht_bw320_offset=1;;
++				EHT320-2) eht_bw320_offset=2;;
++				EHT320) eht_bw320_offset=0;;
++			esac
++		;;
+ 	esac
+ 	[ "$band" = "5g" ] && {
+-		json_get_vars background_radar:0
++		json_get_vars \
++			background_radar:0 \
++			background_cert_mode:0 \
  
- 	json_select ..
- 	[ -n "$failed" ] || wireless_add_vif "$name" "$ifname"
-+
-+	echo "Setup SMP Affinity"
-+	/sbin/smp-mt76.sh
- }
+ 		[ "$background_radar" -eq 1 ] && append base_cfg "enable_background_radar=1" "$N"
++		[ "$background_cert_mode" -eq 1 ] && append base_cfg "background_radar_mode=1" "$N"
+ 	}
+ 	[ "$band" = "6g" ] && {
+ 		op_class=
+ 		case "$htmode" in
+-			HE20) op_class=131;;
+-			HE*) op_class=$((132 + $vht_oper_chwidth))
++			HE20|EHT20) op_class=131;;
++			EHT320*) op_class=137;;
++			HE*|EHT*) op_class=$((132 + $vht_oper_chwidth))
+ 		esac
+ 		[ -n "$op_class" ] && append base_cfg "op_class=$op_class" "$N"
+ 	}
+@@ -318,7 +386,6 @@ mac80211_hostapd_setup_base() {
+ 			vht_link_adapt:3 \
+ 			vht160:2
  
- get_freq() {
-@@ -1050,6 +1229,25 @@ mac80211_reset_config() {
- 	wdev_tool "$phy" set_config '{}'
- }
+-		set_default tx_burst 2.0
+ 		append base_cfg "ieee80211ac=1" "$N"
+ 		vht_cap=0
+ 		for cap in $(iw phy "$phy" info | awk -F "[()]" '/VHT Capabilities/ { print $2 }'); do
+@@ -337,6 +404,12 @@ mac80211_hostapd_setup_base() {
+ 			short_gi_160=0
+ 		}
  
-+mac80211_count_ap() {
-+	total_num_ap=$(($total_num_ap + 1))
-+}
-+
-+country_consistent_check() {
-+	local i
-+	inconsistent_country=0
-+	country_list="$(cat /etc/config/wireless | grep country | cut -d ' ' -f3 | tr -s "'\n" ' ')"
-+	for i in $country_list
-+	do
-+		ret="$(echo $country_list | awk '{print ($2 == "" || $1 == $2)}')"
-+		[ $ret = '0' ] && {
-+			inconsistent_country=1
-+			return
++		[ "$etxbfen" -eq 0 ] && {
++			su_beamformer=0
++			su_beamformee=0
++			mu_beamformer=0
 +		}
-+		country_list="$(echo $country_list | sed -r 's/[A-Z]{2}( )*//')"
-+	done
-+}
 +
- drv_mac80211_setup() {
- 	json_select config
- 	json_get_vars \
-@@ -1058,7 +1256,8 @@ drv_mac80211_setup() {
- 		txpower \
- 		rxantenna txantenna \
- 		frag rts beacon_int:100 htmode \
--		num_global_macaddr:1 multiple_bssid
-+		num_global_macaddr:1 multiple_bssid \
-+		sr_enable sr_enhanced
- 	json_get_values basic_rate_list basic_rate
- 	json_get_values scan_list scan_list
- 	json_select ..
-@@ -1093,6 +1292,7 @@ drv_mac80211_setup() {
- 
- 	macidx=0
- 	staidx=0
-+	mbssidx=0
- 
- 	[ -n "$chanbw" ] && {
- 		for file in /sys/kernel/debug/ieee80211/$phy/ath9k*/chanbw /sys/kernel/debug/ieee80211/$phy/ath5k/bwmode; do
-@@ -1141,14 +1341,29 @@ drv_mac80211_setup() {
- 
- 	wpa_supplicant_init_config
+ 		mac80211_add_capabilities vht_capab $vht_cap \
+ 			RXLDPC:0x10::$rxldpc \
+ 			SHORT-GI-80:0x20::$short_gi_80 \
+@@ -418,7 +491,7 @@ mac80211_hostapd_setup_base() {
+ 	# 802.11ax
+ 	enable_ax=0
+ 	case "$htmode" in
+-		HE*) enable_ax=1 ;;
++		HE*|EHT*) enable_ax=1 ;;
+ 	esac
  
-+	total_num_ap=0
-+	max_mbssid=1
-+	for_each_interface "ap" mac80211_count_ap
-+	total_num_ap=$(($total_num_ap - 1))
-+	while [ $total_num_ap -gt 0 ]
-+	do
-+		total_num_ap=$(($total_num_ap >> 1))
-+		max_mbssid=$(($max_mbssid << 1))
-+	done
-+
- 	mac80211_prepare_iw_htmode
- 	active_ifnames=
- 	for_each_interface "ap sta adhoc mesh monitor" mac80211_prepare_vif
- 	for_each_interface "ap sta adhoc mesh monitor" mac80211_setup_vif
+ 	if [ "$enable_ax" != "0" ]; then
+@@ -427,10 +500,11 @@ mac80211_hostapd_setup_base() {
+ 			he_su_beamformee:1 \
+ 			he_mu_beamformer:1 \
+ 			he_twt_required:0 \
++			he_twt_responder \
+ 			he_spr_sr_control:3 \
+ 			he_spr_psr_enabled:0 \
+ 			he_spr_non_srg_obss_pd_max_offset:0 \
+-			he_bss_color:128 \
++			he_bss_color \
+ 			he_bss_color_enabled:1
  
-+	country_consistent_check
-+
- 	[ -x /usr/sbin/wpa_supplicant ] && wpa_supplicant_set_config "$phy"
- 	[ -x /usr/sbin/hostapd ] && hostapd_set_config "$phy"
+ 		he_phy_cap=$(iw phy "$phy" info | sed -n '/HE Iftypes: .*AP/,$p' | awk -F "[()]" '/HE PHY Capabilities/ { print $2 }' | head -1)
+@@ -444,6 +518,11 @@ mac80211_hostapd_setup_base() {
+ 			append base_cfg "he_oper_centr_freq_seg0_idx=$vht_center_seg0" "$N"
+ 		}
  
-+	[ -n "$sr_enable" ] && echo "$sr_enable" > /sys/kernel/debug/ieee80211/$phy/mt76/sr_enable
-+	[ -n "$sr_enhanced" ] && echo "$sr_enhanced" > /sys/kernel/debug/ieee80211/$phy/mt76/sr_enhanced_enable
++		[ "$etxbfen" -eq 0 ] && {
++			he_su_beamformer=0
++			he_mu_beamformer=0
++		}
 +
- 	[ -x /usr/sbin/wpa_supplicant ] && wpa_supplicant_start "$phy"
- 
- 	json_set_namespace wdev_uc prev
-diff --git a/package/network/config/wifi-scripts/files/lib/wifi/mac80211.sh b/package/network/config/wifi-scripts/files/lib/wifi/mac80211.sh
-index e24a2a63..58a0c9ff 100644
---- a/package/network/config/wifi-scripts/files/lib/wifi/mac80211.sh
-+++ b/package/network/config/wifi-scripts/files/lib/wifi/mac80211.sh
-@@ -60,6 +60,9 @@ BEGIN {
- 		if (vht && band != "1:") mode="VHT80"
- 		if (he) mode="HE80"
- 		if (he && band == "1:") mode="HE20"
-+		if (eht && band == "2:") mode="EHT160"
-+		if (eht && band == "4:") mode="EHT320"
-+		if (eht && band == "1:") mode="EHT20"
-                 sub("\\[", "", channel)
-                 sub("\\]", "", channel)
-                 bands = bands band channel ":" mode " "
-@@ -73,6 +76,7 @@ $1 == "Band" {
- 	vht = ""
- 	ht = ""
- 	he = ""
-+	eht = ""
- }
- 
- $0 ~ "Capabilities:" {
-@@ -87,6 +91,18 @@ $0 ~ "HE Iftypes" {
- 	he=1
- }
+ 		mac80211_add_he_capabilities \
+ 			he_su_beamformer:${he_phy_cap:6:2}:0x80:$he_su_beamformer \
+ 			he_su_beamformee:${he_phy_cap:8:2}:0x1:$he_su_beamformee \
+@@ -451,7 +530,14 @@ mac80211_hostapd_setup_base() {
+ 			he_spr_psr_enabled:${he_phy_cap:14:2}:0x1:$he_spr_psr_enabled \
+ 			he_twt_required:${he_mac_cap:0:2}:0x6:$he_twt_required
  
-+$0 ~ "EHT Iftypes" {
-+	eht=1
-+}
-+
-+$0 ~ / *HE MAC Capabilities \(0x000000000000\)/ {
-+	he=0
-+}
++		if [ -n "$he_twt_responder" ]; then
++			append base_cfg "he_twt_responder=$he_twt_responder" "$N"
++		fi
+ 		if [ "$he_bss_color_enabled" -gt 0 ]; then
++			if !([ "$he_bss_color" -gt 0 ] && [ "$he_bss_color" -le 64 ]); then
++				rand=$(head -n 1 /dev/urandom | tr -dc 0-9 | head -c 2)
++				he_bss_color=$((rand % 63 + 1))
++			fi
+ 			append base_cfg "he_bss_color=$he_bss_color" "$N"
+ 			[ "$he_spr_non_srg_obss_pd_max_offset" -gt 0 ] && { \
+ 				append base_cfg "he_spr_non_srg_obss_pd_max_offset=$he_spr_non_srg_obss_pd_max_offset" "$N"
+@@ -470,26 +556,58 @@ mac80211_hostapd_setup_base() {
+ 		append base_cfg "he_mu_edca_qos_info_q_ack=0" "$N"
+ 		append base_cfg "he_mu_edca_qos_info_queue_request=0" "$N"
+ 		append base_cfg "he_mu_edca_qos_info_txop_request=0" "$N"
+-		append base_cfg "he_mu_edca_ac_be_aifsn=8" "$N"
++		append base_cfg "he_mu_edca_ac_be_aifsn=0" "$N"
+ 		append base_cfg "he_mu_edca_ac_be_aci=0" "$N"
+ 		append base_cfg "he_mu_edca_ac_be_ecwmin=9" "$N"
+ 		append base_cfg "he_mu_edca_ac_be_ecwmax=10" "$N"
+-		append base_cfg "he_mu_edca_ac_be_timer=255" "$N"
+-		append base_cfg "he_mu_edca_ac_bk_aifsn=15" "$N"
++		append base_cfg "he_mu_edca_ac_be_timer=3" "$N"
++		append base_cfg "he_mu_edca_ac_bk_aifsn=0" "$N"
+ 		append base_cfg "he_mu_edca_ac_bk_aci=1" "$N"
+ 		append base_cfg "he_mu_edca_ac_bk_ecwmin=9" "$N"
+ 		append base_cfg "he_mu_edca_ac_bk_ecwmax=10" "$N"
+-		append base_cfg "he_mu_edca_ac_bk_timer=255" "$N"
++		append base_cfg "he_mu_edca_ac_bk_timer=3" "$N"
+ 		append base_cfg "he_mu_edca_ac_vi_ecwmin=5" "$N"
+ 		append base_cfg "he_mu_edca_ac_vi_ecwmax=7" "$N"
+-		append base_cfg "he_mu_edca_ac_vi_aifsn=5" "$N"
++		append base_cfg "he_mu_edca_ac_vi_aifsn=0" "$N"
+ 		append base_cfg "he_mu_edca_ac_vi_aci=2" "$N"
+-		append base_cfg "he_mu_edca_ac_vi_timer=255" "$N"
+-		append base_cfg "he_mu_edca_ac_vo_aifsn=5" "$N"
++		append base_cfg "he_mu_edca_ac_vi_timer=3" "$N"
++		append base_cfg "he_mu_edca_ac_vo_aifsn=0" "$N"
+ 		append base_cfg "he_mu_edca_ac_vo_aci=3" "$N"
+ 		append base_cfg "he_mu_edca_ac_vo_ecwmin=5" "$N"
+ 		append base_cfg "he_mu_edca_ac_vo_ecwmax=7" "$N"
+-		append base_cfg "he_mu_edca_ac_vo_timer=255" "$N"
++		append base_cfg "he_mu_edca_ac_vo_timer=3" "$N"
++	fi
 +
-+$0 ~ / *EHT MAC Capabilities \(0x0000\)/ {
-+	eht=0
-+}
++	set_default tx_burst 2
 +
- $1 == "*" && $3 == "MHz" && $0 !~ /disabled/ && band && !channel {
-         channel = $4
- }
-@@ -120,6 +136,26 @@ get_band_defaults() {
- 		mode_band="$band"
- 		channel="$chan"
- 		htmode="$mode"
-+		if [ "$band" = "6g" ]
-+		then
-+			encryption=sae
-+			key=12345678
-+			sae_pwe=2
-+			ieee80211w=2
-+			channel=37
-+			mbssid=1
-+			mbo=1
-+		elif [ "$band" = "5g" ]
-+		then
-+			noscan=1
-+			encryption=none
-+			rnr=1
-+			background_radar=1
++	# 802.11be
++	enable_be=0
++	case "$htmode" in
++		EHT*) enable_be=1 ;;
++	esac
++
++	if [ "$enable_be" != "0" ]; then
++		append base_cfg "ieee80211be=1" "$N"
++		if [ "$etxbfen" -eq 0 ]; then
++			append base_cfg "eht_su_beamformee=1" "$N"
 +		else
-+			noscan=1
-+			encryption=none
-+			rnr=1
++			append base_cfg "eht_su_beamformer=1" "$N"
++			append base_cfg "eht_su_beamformee=1" "$N"
++			append base_cfg "eht_mu_beamformer=1" "$N"
 +		fi
- 	done
- }
++		[ "$hwmode" = "a" ] && {
++			case $htmode in
++				EHT320*)
++					append base_cfg "eht_oper_chwidth=$eht_oper_chwidth" "$N"
++					append base_cfg "eht_oper_centr_freq_seg0_idx=$eht_oper_centr_freq_seg0_idx" "$N"
++					append base_cfg "eht_bw320_offset=$eht_bw320_offset" "$N"
++				;;
++				*)
++					append base_cfg "eht_oper_chwidth=$vht_oper_chwidth" "$N"
++					append base_cfg "eht_oper_centr_freq_seg0_idx=$vht_center_seg0" "$N"
++				;;
++			esac
++		}
+ 	fi
  
-@@ -153,6 +189,10 @@ detect_mac80211() {
+ 	hostapd_prepare_device_config "$hostapd_conf_file" nl80211
+@@ -498,6 +616,10 @@ ${channel:+channel=$channel}
+ ${channel_list:+chanlist=$channel_list}
+ ${hostapd_noscan:+noscan=1}
+ ${tx_burst:+tx_queue_data2_burst=$tx_burst}
++${mbssid:+mbssid=$mbssid}
++${mu_onoff:+mu_onoff=$mu_onoff}
++${itxbfen:+ibf_enable=$itxbfen}
++${rnr:+rnr=$rnr}
+ ${multiple_bssid:+mbssid=$multiple_bssid}
+ #num_global_macaddr=$num_global_macaddr
+ $base_cfg
+@@ -525,7 +647,7 @@ mac80211_hostapd_setup_bss() {
+ 		append hostapd_cfg "wds_sta=1" "$N"
+ 		[ -n "$wds_bridge" ] && append hostapd_cfg "wds_bridge=$wds_bridge" "$N"
+ 	}
+-	[ "$staidx" -gt 0 -o "$start_disabled" -eq 1 ] && append hostapd_cfg "start_disabled=1" "$N"
++	[ "$start_disabled" -eq 1 ] && append hostapd_cfg "start_disabled=1" "$N"
  
- 	json_load_file /etc/board.json
+ 	cat >> /var/run/hostapd-$phy.conf <<EOF
+ $hostapd_cfg
+@@ -536,6 +658,31 @@ ${max_listen_int:+max_listen_interval=$max_listen_int}
+ EOF
+ }
  
-+	# generate random bytes for macaddr
-+	rand=$(hexdump -C /dev/urandom | head -n 1 &)
-+	killall hexdump
++mac80211_generate_mbssid_mac() {
++	local phy="$1"
++	local transmitted_bssid="$2"
++	local id="${mbssidx:-0}"
 +
- 	for _dev in /sys/class/ieee80211/*; do
- 		[ -e "$_dev" ] || continue
- 
-@@ -162,6 +202,14 @@ detect_mac80211() {
- 		channel=""
- 		htmode=""
- 		ht_capab=""
-+		encryption=""
-+		noscan=""
-+		key=""
-+		sae_pwe=""
-+		ieee80211w=""
-+		mbssid=""
-+		rnr=""
-+		background_radar=""
- 
- 		get_band_defaults "$dev"
- 
-@@ -196,6 +244,19 @@ detect_mac80211() {
- 				;;
- 		esac
- 
-+		macaddr=""
-+		if (dmesg | grep -q "eeprom load fail"); then
-+			for i in $(seq 2 3); do
-+				macaddr=${macaddr}:$(echo $rand | cut -d ' ' -f $i)
-+			done
-+			macaddr="00:0$(($devidx - 1)):55:66${macaddr}"
-+		fi
++	local ref="$(cat /sys/class/ieee80211/${phy}/macaddress)"
 +
-+		tx_burst=""
-+		if (lspci | grep -q "7992"); then
-+			tx_burst=0.0
-+		fi
++	if [ -z "$transmitted_bssid" ]; then
++		transmitted_bssid=$ref
++	fi
 +
- 		uci -q batch <<-EOF
- 			set wireless.${name}=wifi-device
- 			set wireless.${name}.type=mac80211
-@@ -203,15 +264,49 @@ detect_mac80211() {
- 			set wireless.${name}.channel=${channel}
- 			set wireless.${name}.band=${mode_band}
- 			set wireless.${name}.htmode=$htmode
--			set wireless.${name}.disabled=1
-+			set wireless.${name}.country='US'
-+			set wireless.${name}.noscan=${noscan}
-+			set wireless.${name}.disabled=0
-+EOF
-+		[ -n "$mbssid" ] && {
-+			uci -q set wireless.${name}.mbssid=${mbssid}
-+		}
-+		[ -n "$rnr" ] && {
-+			uci -q set wireless.${name}.rnr=${rnr}
-+		}
-+		[ -n "$background_radar" ] && {
-+			uci -q set wireless.${name}.background_radar=${background_radar}
-+		}
-+		[ -n "$tx_burst" ] && {
-+			uci -q set wireless.${name}.tx_burst=${tx_burst}
-+		}
- 
-+		uci -q batch <<-EOF
- 			set wireless.default_${name}=wifi-iface
- 			set wireless.default_${name}.device=${name}
- 			set wireless.default_${name}.network=lan
- 			set wireless.default_${name}.mode=ap
--			set wireless.default_${name}.ssid=OpenWrt
--			set wireless.default_${name}.encryption=none
-+			set wireless.default_${name}.ssid=OpenWrt-${mode_band}
-+			set wireless.default_${name}.encryption=${encryption}
- EOF
++	if [ $id -eq 0 ]; then
++		echo "$transmitted_bssid"
++		return
++	fi
 +
-+		# calibrated board will use eeprom macaddress, not ramdom address
-+		[ -n "$macaddr" ] && {
-+			uci -q set wireless.default_${name}.macaddr=${macaddr}
-+		}
++	local oIFS="$IFS"; IFS=":"; set -- $transmitted_bssid; IFS="$oIFS"
 +
-+		[ -n "$key" ] && {
-+			uci -q set wireless.default_${name}.key=${key}
-+		}
-+		[ -n "$sae_pwe" ] && {
-+			uci -q set wireless.default_${name}.sae_pwe=${sae_pwe}
-+		}
-+		[ -n "$ieee80211w" ] && {
-+			uci -q set wireless.default_${name}.ieee80211w=${ieee80211w}
-+		}
-+		[ -n "$mbo" ] && {
-+			uci -q set wireless.default_${name}.mbo=${mbo}
++	# Calculate nontransmitted bssid
++	b6="0x$6"
++	ref_b6=$(($b6 % $max_mbssid))
++	b6=$(($b6 - $ref_b6 + ($ref_b6 + $id) % $max_mbssid))
++	printf "%s:%s:%s:%s:%s:%02x" $1 $2 $3 $4 $5 $b6
++}
++
+ mac80211_get_addr() {
+ 	local phy="$1"
+ 	local idx="$(($2 + 1))"
+@@ -659,7 +806,19 @@ mac80211_prepare_vif() {
+ 	json_add_string _ifname "$ifname"
+ 
+ 	default_macaddr=
+-	if [ -z "$macaddr" ]; then
++	if [ "$mbssid" -gt 0 ] && [ "$mode" == "ap" ]; then
++		[ "$mbssidx" -eq 0 ] && {
++			if [ -z $macaddr ]; then
++				transmitted_bssid="$(mac80211_generate_mac $phy)"
++			else
++				# uci set mac address
++				transmitted_bssid=$macaddr
++			fi
++			macidx="$(($macidx + 1))"
 +		}
- 		uci -q commit wireless
- 	done
++		macaddr="$(mac80211_generate_mbssid_mac $phy $transmitted_bssid)"
++		mbssidx="$(($mbssidx + 1))"
++	elif [ -z "$macaddr" ]; then
+ 		macaddr="$(mac80211_generate_mac $phy)"
+ 		macidx="$(($macidx + 1))"
+ 		default_macaddr=1
+@@ -917,12 +1076,28 @@ wpa_supplicant_set_config() {
  }
-diff --git a/package/network/config/wifi-scripts/files/lib/netifd/hostapd.sh b/package/network/config/wifi-scripts/files/lib/netifd/hostapd.sh
-index 271c1f7b..80b95116 100644
---- a/package/network/config/wifi-scripts/files/lib/netifd/hostapd.sh
-+++ b/package/network/config/wifi-scripts/files/lib/netifd/hostapd.sh
-@@ -60,7 +60,14 @@ hostapd_append_wpa_key_mgmt() {
- 			append wpa_key_mgmt "WPA-EAP-SHA256"
- 		;;
- 		sae)
--			append wpa_key_mgmt "SAE"
-+			case "$encryption" in
-+			*sae-ext*)
-+				append wpa_key_mgmt "SAE-EXT-KEY"
-+			;;
-+			*)
-+				append wpa_key_mgmt "SAE"
-+			;;
-+			esac
- 			[ "${ieee80211r:-0}" -gt 0 ] && append wpa_key_mgmt "FT-SAE"
- 		;;
- 		psk-sae)
-@@ -119,6 +126,7 @@ hostapd_common_add_device_config() {
- 	config_add_int rts_threshold
- 	config_add_int rssi_reject_assoc_rssi
- 	config_add_int rssi_ignore_probe_request
-+	config_add_int rssi_reject_assoc_timeout
- 	config_add_int maxassoc
- 
- 	config_add_string acs_chan_bias
-@@ -231,8 +239,10 @@ hostapd_prepare_device_config() {
- 		hostapd_add_rate brlist "$br"
- 	done
- 
-+	json_get_vars rssi_reject_assoc_timeout
- 	[ -n "$rssi_reject_assoc_rssi" ] && append base_cfg "rssi_reject_assoc_rssi=$rssi_reject_assoc_rssi" "$N"
- 	[ -n "$rssi_ignore_probe_request" ] && append base_cfg "rssi_ignore_probe_request=$rssi_ignore_probe_request" "$N"
-+	[ -n "$rssi_reject_assoc_timeout" ] && append base_cfg "rssi_reject_assoc_timeout=$rssi_reject_assoc_timeout" "$N"
- 	[ -n "$beacon_rate" ] && append base_cfg "beacon_rate=$beacon_rate" "$N"
- 	[ -n "$rlist" ] && append base_cfg "supported_rates=$rlist" "$N"
- 	[ -n "$brlist" ] && append base_cfg "basic_rates=$brlist" "$N"
-@@ -383,6 +393,25 @@ hostapd_common_add_bss_config() {
- 	config_add_string fils_dhcp
  
- 	config_add_int ocv
+ hostapd_set_config() {
 +
-+	config_add_int disable_eht
-+	config_add_int disable_he
-+	config_add_int disable_vht
-+	config_add_int disable_ht
++	if [ "$inconsistent_country" -eq 1 ]; then
++		echo "ERROR: Please use the same country for all the radios."
++		wireless_setup_failed HOSTAPD_START_FAILED
++		drv_mac80211_teardown
++		return
++	fi
 +
-+	config_add_boolean beacon_prot interworking
+ 	[ -n "$hostapd_ctrl" ] || {
+ 		ubus_call hostapd config_set '{ "phy": "'"$phy"'", "config": "", "prev_config": "'"${hostapd_conf_file}.prev"'" }' > /dev/null
+ 		return 0;
+ 	}
+ 
+ 	ubus wait_for hostapd
 +
-+	config_add_int unsol_bcast_probe_resp_interval
-+	config_add_int fils_discovery_min_interval
-+	config_add_int fils_discovery_max_interval
-+	config_add_boolean rnr
++	# each phy sleeps different times to prevent for ubus race condition.
++	if [ "$phy" = "phy1" ]; then
++		sleep 3;
++	elif [ "$phy" = "phy2" ]; then
++		sleep 6;
++	fi
 +
-+	config_add_array sae_groups
-+	config_add_array owe_groups
-+	config_add_array pairwise
-+	config_add_string group_cipher
-+	config_add_string group_mgmt_cipher
+ 	local hostapd_res="$(ubus_call hostapd config_set "{ \"phy\": \"$phy\", \"config\":\"${hostapd_conf_file}\", \"prev_config\": \"${hostapd_conf_file}.prev\"}")"
+ 	ret="$?"
+ 	[ "$ret" != 0 -o -z "$hostapd_res" ] && {
+@@ -1000,6 +1175,9 @@ mac80211_setup_vif() {
+ 
+ 	json_select ..
+ 	[ -n "$failed" ] || wireless_add_vif "$name" "$ifname"
 +
++	echo "Setup SMP Affinity"
++	/sbin/smp-mt76.sh
  }
  
- hostapd_set_vlan_file() {
-@@ -447,11 +476,11 @@ append_iw_nai_realm() {
+ get_freq() {
+@@ -1051,6 +1229,25 @@ mac80211_reset_config() {
+ 	wdev_tool "$phy" set_config '{}'
  }
  
- append_iw_venue_name() {
--	append bss_conf "venue_name=$1" "$N"
-+	[ -n "$1" ] && append bss_conf "venue_name=$1" "$N"
- }
++mac80211_count_ap() {
++	total_num_ap=$(($total_num_ap + 1))
++}
++
++country_consistent_check() {
++	local i
++	inconsistent_country=0
++	country_list="$(cat /etc/config/wireless | grep country | cut -d ' ' -f3 | tr -s "'\n" ' ')"
++	for i in $country_list
++	do
++		ret="$(echo $country_list | awk '{print ($2 == "" || $1 == $2)}')"
++		[ $ret = '0' ] && {
++			inconsistent_country=1
++			return
++		}
++		country_list="$(echo $country_list | sed -r 's/[A-Z]{2}( )*//')"
++	done
++}
++
+ drv_mac80211_setup() {
+ 	json_select config
+ 	json_get_vars \
+@@ -1059,7 +1256,8 @@ drv_mac80211_setup() {
+ 		txpower \
+ 		rxantenna txantenna \
+ 		frag rts beacon_int:100 htmode \
+-		num_global_macaddr:1 multiple_bssid
++		num_global_macaddr:1 multiple_bssid \
++		sr_enable sr_enhanced
+ 	json_get_values basic_rate_list basic_rate
+ 	json_get_values scan_list scan_list
+ 	json_select ..
+@@ -1094,6 +1292,7 @@ drv_mac80211_setup() {
  
- append_iw_venue_url() {
--	append bss_conf "venue_url=$1" "$N"
-+	[ -n "$1" ] && append bss_conf "venue_url=$1" "$N"
- }
+ 	macidx=0
+ 	staidx=0
++	mbssidx=0
  
- append_hs20_oper_friendly_name() {
-@@ -569,7 +598,8 @@ hostapd_set_bss_options() {
- 		ppsk airtime_bss_weight airtime_bss_limit airtime_sta_weight \
- 		multicast_to_unicast_all proxy_arp per_sta_vif \
- 		eap_server eap_user_file ca_cert server_cert private_key private_key_passwd server_id \
--		vendor_elements fils ocv
-+		vendor_elements fils ocv unsol_bcast_probe_resp_interval fils_discovery_min_interval \
-+		fils_discovery_max_interval rnr group_cipher group_mgmt_cipher
+ 	[ -n "$chanbw" ] && {
+ 		for file in /sys/kernel/debug/ieee80211/$phy/ath9k*/chanbw /sys/kernel/debug/ieee80211/$phy/ath5k/bwmode; do
+@@ -1142,14 +1341,29 @@ drv_mac80211_setup() {
  
- 	set_default fils 0
- 	set_default isolate 0
-@@ -796,6 +826,36 @@ hostapd_set_bss_options() {
- 	local auth_algs="$((($auth_mode_shared << 1) | $auth_mode_open))"
- 	append bss_conf "auth_algs=${auth_algs:-1}" "$N"
- 	append bss_conf "wpa=$wpa" "$N"
-+
-+	json_get_values pairwise pairwise
-+	json_get_vars group_cipher
-+	if [ -n "$pairwise" ]; then
-+		case "$pairwise" in
-+			*tkip+aes|*tkip+ccmp|*aes+tkip|*ccmp+tkip)
-+				wpa_cipher="CCMP TKIP"
-+			;;
-+			*ccmp256)
-+				wpa_cipher="CCMP-256"
-+			;;
-+			*aes|*ccmp)
-+				wpa_cipher="CCMP"
-+			;;
-+			*tkip)
-+				wpa_cipher="TKIP"
-+			;;
-+			*gcmp256)
-+				wpa_cipher="GCMP-256"
-+			;;
-+			*gcmp)
-+				wpa_cipher="GCMP"
-+			;;
-+			*)
-+				wpa_cipher=""
-+			;;
-+		esac
-+	fi
-+	[ -n "$wpa_cipher" ] && wpa_pairwise="$wpa_cipher"
+ 	wpa_supplicant_init_config
+ 
++	total_num_ap=0
++	max_mbssid=1
++	for_each_interface "ap" mac80211_count_ap
++	total_num_ap=$(($total_num_ap - 1))
++	while [ $total_num_ap -gt 0 ]
++	do
++		total_num_ap=$(($total_num_ap >> 1))
++		max_mbssid=$(($max_mbssid << 1))
++	done
 +
- 	[ -n "$wpa_pairwise" ] && append bss_conf "wpa_pairwise=$wpa_pairwise" "$N"
+ 	mac80211_prepare_iw_htmode
+ 	active_ifnames=
+ 	for_each_interface "ap sta adhoc mesh monitor" mac80211_prepare_vif
+ 	for_each_interface "ap sta adhoc mesh monitor" mac80211_setup_vif
  
- 	set_default wps_pushbutton 0
-@@ -847,7 +907,7 @@ hostapd_set_bss_options() {
- 	}
++	country_consistent_check
++
+ 	[ -x /usr/sbin/wpa_supplicant ] && wpa_supplicant_set_config "$phy"
+ 	[ -x /usr/sbin/hostapd ] && hostapd_set_config "$phy"
  
- 	append bss_conf "ssid=$ssid" "$N"
--	[ -n "$network_bridge" ] && append bss_conf "bridge=$network_bridge${N}wds_bridge=" "$N"
-+	[ -n "$network_bridge" ] && append bss_conf "bridge=$network_bridge${N}wds_bridge=$network_bridge" "$N"
- 	[ -n "$network_ifname" ] && append bss_conf "snoop_iface=$network_ifname" "$N"
- 	[ -n "$iapp_interface" ] && {
- 		local ifname
-@@ -912,6 +972,8 @@ hostapd_set_bss_options() {
- 	fi
++	[ -n "$sr_enable" ] && echo "$sr_enable" > /sys/kernel/debug/ieee80211/$phy/mt76/sr_enable
++	[ -n "$sr_enhanced" ] && echo "$sr_enhanced" > /sys/kernel/debug/ieee80211/$phy/mt76/sr_enhanced_enable
++
+ 	[ -x /usr/sbin/wpa_supplicant ] && wpa_supplicant_start "$phy"
  
- 	if [ "$wpa" -ge "2" ]; then
-+		json_get_values sae_groups sae_groups
-+		json_get_values owe_groups owe_groups
- 		if [ "$ieee80211r" -gt "0" ]; then
- 			json_get_vars mobility_domain ft_psk_generate_local ft_over_ds reassociation_deadline
+ 	json_set_namespace wdev_uc prev
+diff --git a/package/network/config/wifi-scripts/files/lib/wifi/mac80211.sh b/package/network/config/wifi-scripts/files/lib/wifi/mac80211.sh
+index e24a2a6..58a0c9f 100644
+--- a/package/network/config/wifi-scripts/files/lib/wifi/mac80211.sh
++++ b/package/network/config/wifi-scripts/files/lib/wifi/mac80211.sh
+@@ -60,6 +60,9 @@ BEGIN {
+ 		if (vht && band != "1:") mode="VHT80"
+ 		if (he) mode="HE80"
+ 		if (he && band == "1:") mode="HE20"
++		if (eht && band == "2:") mode="EHT160"
++		if (eht && band == "4:") mode="EHT320"
++		if (eht && band == "1:") mode="EHT20"
+                 sub("\\[", "", channel)
+                 sub("\\]", "", channel)
+                 bands = bands band channel ":" mode " "
+@@ -73,6 +76,7 @@ $1 == "Band" {
+ 	vht = ""
+ 	ht = ""
+ 	he = ""
++	eht = ""
+ }
  
-@@ -984,17 +1046,52 @@ hostapd_set_bss_options() {
- 		append bss_conf "okc=$auth_cache" "$N"
- 		[ "$auth_cache" = 0 -a "$fils" = 0 ] && append bss_conf "disable_pmksa_caching=1" "$N"
+ $0 ~ "Capabilities:" {
+@@ -87,6 +91,18 @@ $0 ~ "HE Iftypes" {
+ 	he=1
+ }
  
-+		[ -z "$group_cipher" ] && group_cipher="$wpa_cipher"
++$0 ~ "EHT Iftypes" {
++	eht=1
++}
 +
-+		if [ -n "$sae_groups" -o -n "$owe_groups" ]; then
-+			case "$auth_type" in
-+			sae*)
-+				append bss_conf "sae_groups=$sae_groups" "$N"
-+				append bss_conf "group_cipher=$group_cipher" "$N"
-+			;;
-+			owe)
-+				append bss_conf "owe_groups=$owe_groups" "$N"
-+				append bss_conf "group_cipher=$group_cipher" "$N"
-+			;;
-+			esac
-+		fi
++$0 ~ / *HE MAC Capabilities \(0x000000000000\)/ {
++	he=0
++}
 +
- 		# RSN -> allow management frame protection
- 		case "$ieee80211w" in
- 			[012])
--				json_get_vars ieee80211w_mgmt_cipher ieee80211w_max_timeout ieee80211w_retry_timeout
-+				json_get_vars ieee80211w_mgmt_cipher ieee80211w_max_timeout ieee80211w_retry_timeout beacon_prot
- 				append bss_conf "ieee80211w=$ieee80211w" "$N"
- 				[ "$ieee80211w" -gt "0" ] && {
-+					if [ -z "$group_mgmt_cipher" ]; then
-+						case "$group_cipher" in
-+						CCMP-256)
-+							ieee80211w_mgmt_cipher="BIP-CMAC-256"
-+						;;
-+						CCMP)
-+							ieee80211w_mgmt_cipher="AES-128-CMAC"
-+						;;
-+						GCMP-256)
-+							ieee80211w_mgmt_cipher="BIP-GMAC-256"
-+						;;
-+						GCMP)
-+							ieee80211w_mgmt_cipher="BIP-GMAC-128"
-+						;;
-+						esac
-+					else
-+						ieee80211w_mgmt_cipher="$group_mgmt_cipher"
-+					fi
- 					if [ "$auth_type" = "eap192" ]; then
- 						append bss_conf "group_mgmt_cipher=BIP-GMAC-256" "$N"
- 					else
- 						append bss_conf "group_mgmt_cipher=${ieee80211w_mgmt_cipher:-AES-128-CMAC}" "$N"
- 					fi
-+					[ -n "$beacon_prot" ] && \
-+						append bss_conf "beacon_prot=$beacon_prot" "$N"
- 					[ -n "$ieee80211w_max_timeout" ] && \
- 						append bss_conf "assoc_sa_query_max_timeout=$ieee80211w_max_timeout" "$N"
- 					[ -n "$ieee80211w_retry_timeout" ] && \
-@@ -1059,9 +1156,10 @@ hostapd_set_bss_options() {
- 	json_get_vars iw_roaming_consortium iw_domain_name iw_anqp_3gpp_cell_net iw_nai_realm
- 	json_get_vars iw_anqp_elem iw_qos_map_set iw_ipaddr_type_availability iw_gas_address3
- 	json_get_vars iw_venue_name iw_venue_url
-+	json_get_vars interworking
- 
- 	set_default iw_enabled 0
--	if [ "$iw_enabled" = "1" ]; then
-+	if [ "$iw_enabled" = "1" ] || [ "$interworking" = "1" ]; then
- 		append bss_conf "interworking=1" "$N"
- 		set_default iw_internet 1
- 		set_default iw_asra 0
-@@ -1168,6 +1266,22 @@ hostapd_set_bss_options() {
- 		append bss_conf "$val" "$N"
++$0 ~ / *EHT MAC Capabilities \(0x0000\)/ {
++	eht=0
++}
++
+ $1 == "*" && $3 == "MHz" && $0 !~ /disabled/ && band && !channel {
+         channel = $4
+ }
+@@ -120,6 +136,26 @@ get_band_defaults() {
+ 		mode_band="$band"
+ 		channel="$chan"
+ 		htmode="$mode"
++		if [ "$band" = "6g" ]
++		then
++			encryption=sae
++			key=12345678
++			sae_pwe=2
++			ieee80211w=2
++			channel=37
++			mbssid=1
++			mbo=1
++		elif [ "$band" = "5g" ]
++		then
++			noscan=1
++			encryption=none
++			rnr=1
++			background_radar=1
++		else
++			noscan=1
++			encryption=none
++			rnr=1
++		fi
  	done
- 
-+	if [ "$unsol_bcast_probe_resp_interval" -gt 0 ]; then
-+		append bss_conf "unsol_bcast_probe_resp_interval=$unsol_bcast_probe_resp_interval" "$N"
-+	fi
-+
-+	if [ -n "$fils_discovery_min_interval" ]; then
-+		append bss_conf "fils_discovery_min_interval=$fils_discovery_min_interval" "$N"
-+	fi
-+
-+	if [ -n "$fils_discovery_max_interval" ]; then
-+		append bss_conf "fils_discovery_max_interval=$fils_discovery_max_interval" "$N"
-+	fi
-+
-+	if [ -n "$rnr" ]; then
-+		append bss_conf "rnr=$rnr" "$N"
-+	fi
-+
- 	append "$var" "$bss_conf" "$N"
- 	return 0
  }
-@@ -1255,6 +1369,7 @@ wpa_supplicant_prepare_interface() {
- 		country_str="country=$country"
- 	}
  
-+	local tx_queue_data2_burst="tx_queue_data2_burst=0"
- 	multiap_flag_file="${_config}.is_multiap"
- 	if [ "$multi_ap" = "1" ]; then
- 		touch "$multiap_flag_file"
-@@ -1266,6 +1381,7 @@ wpa_supplicant_prepare_interface() {
- ${scan_list:+freq_list=$scan_list}
- $ap_scan
- $country_str
-+$tx_queue_data2_burst
- EOF
- 	return 0
- }
-@@ -1537,12 +1653,39 @@ wpa_supplicant_add_network() {
- 		;;
- 	esac
+@@ -153,6 +189,10 @@ detect_mac80211() {
  
--	[ "$wpa_cipher" = GCMP ] && {
--		append network_data "pairwise=GCMP" "$N$T"
--		append network_data "group=GCMP" "$N$T"
--	}
-+	json_get_values pairwise pairwise
-+	json_get_vars group_cipher group_mgmt_cipher
-+	if [ -n "$pairwise" ]; then
-+		case "$pairwise" in
-+			*tkip+aes|*tkip+ccmp|*aes+tkip|*ccmp+tkip)
-+				wpa_cipher="CCMP TKIP"
-+			;;
-+			*ccmp256)
-+				wpa_cipher="CCMP-256"
-+			;;
-+			*aes|*ccmp)
-+				wpa_cipher="CCMP"
-+			;;
-+			*tkip)
-+				wpa_cipher="TKIP"
-+			;;
-+			*gcmp256)
-+				wpa_cipher="GCMP-256"
-+			;;
-+			*gcmp)
-+				wpa_cipher="GCMP"
-+			;;
-+			*)
-+				wpa_cipher=""
-+			;;
-+		esac
-+	fi
-+	[ -n "$wpa_cipher" ] && wpa_pairwise="$wpa_cipher"
+ 	json_load_file /etc/board.json
  
- 	[ "$mode" = mesh ] || {
-+		json_get_values sae_groups sae_groups
-+		json_get_values owe_groups owe_groups
++	# generate random bytes for macaddr
++	rand=$(hexdump -C /dev/urandom | head -n 1 &)
++	killall hexdump
 +
- 		case "$wpa" in
- 			1)
- 				append network_data "proto=WPA" "$N$T"
-@@ -1552,12 +1695,58 @@ wpa_supplicant_add_network() {
- 			;;
+ 	for _dev in /sys/class/ieee80211/*; do
+ 		[ -e "$_dev" ] || continue
+ 
+@@ -162,6 +202,14 @@ detect_mac80211() {
+ 		channel=""
+ 		htmode=""
+ 		ht_capab=""
++		encryption=""
++		noscan=""
++		key=""
++		sae_pwe=""
++		ieee80211w=""
++		mbssid=""
++		rnr=""
++		background_radar=""
+ 
+ 		get_band_defaults "$dev"
+ 
+@@ -196,6 +244,19 @@ detect_mac80211() {
+ 				;;
  		esac
  
-+		[ -n "$wpa_pairwise" ] && append network_data "pairwise=$wpa_pairwise" "$N$T"
-+		[ -z "$group_cipher" ] && group_cipher="$wpa_cipher"
-+
-+		if [ -n "$sae_groups" -o -n "$owe_groups" ]; then
-+			case "$auth_type" in
-+			sae*)
-+				echo "sae_groups=$sae_groups" >> "$_config"
-+				append network_data "group=$group_cipher" "$N$T"
-+			;;
-+			owe)
-+				append network_data "owe_group=$owe_groups" "$N$T"
-+				append network_data "group=$group_cipher" "$N$T"
-+			;;
-+			esac
++		macaddr=""
++		if (dmesg | grep -q "eeprom load fail"); then
++			for i in $(seq 2 3); do
++				macaddr=${macaddr}:$(echo $rand | cut -d ' ' -f $i)
++			done
++			macaddr="00:0$(($devidx - 1)):55:66${macaddr}"
 +		fi
 +
-+		# RSN -> allow management frame protection
- 		case "$ieee80211w" in
- 			[012])
--				[ "$wpa" -ge 2 ] && append network_data "ieee80211w=$ieee80211w" "$N$T"
-+				json_get_vars ieee80211w_mgmt_cipher ieee80211w_max_timeout ieee80211w_retry_timeout beacon_prot
-+				append network_data "ieee80211w=$ieee80211w" "$N$T"
-+				[ "$ieee80211w" -gt "0" ] && {
-+					if [ -z "$group_mgmt_cipher" ]; then
-+						case "$group_cipher" in
-+						CCMP-256)
-+							ieee80211w_mgmt_cipher="BIP-CMAC-256"
-+						;;
-+						CCMP)
-+							ieee80211w_mgmt_cipher="AES-128-CMAC"
-+						;;
-+						GCMP-256)
-+							ieee80211w_mgmt_cipher="BIP-GMAC-256"
-+						;;
-+						GCMP)
-+							ieee80211w_mgmt_cipher="BIP-GMAC-128"
-+						;;
-+						esac
-+					else
-+						ieee80211w_mgmt_cipher="$group_mgmt_cipher"
-+					fi
-+					if [ "$auth_type" = "eap192" ]; then
-+						append network_data "group_mgmt=BIP-GMAC-256" "$N$T"
-+					else
-+						append network_data "group_mgmt=${ieee80211w_mgmt_cipher:-AES-128-CMAC}" "$N$T"
-+					fi
-+					[ -n "$beacon_prot" ] && \
-+						append network_data "beacon_prot=$beacon_prot" "$N$T"
-+				}
- 			;;
- 		esac
- 	}
++		tx_burst=""
++		if (lspci | grep -q "7992"); then
++			tx_burst=0.0
++		fi
 +
- 	[ -n "$bssid" ] && append network_data "bssid=$bssid" "$N$T"
- 	[ -n "$beacon_int" ] && append network_data "beacon_int=$beacon_int" "$N$T"
- 
-@@ -1568,6 +1757,20 @@ wpa_supplicant_add_network() {
- 	[ -n "$bssid_blacklist" ] && append network_data "bssid_blacklist=$bssid_blacklist" "$N$T"
- 	[ -n "$bssid_whitelist" ] && append network_data "bssid_whitelist=$bssid_whitelist" "$N$T"
+ 		uci -q batch <<-EOF
+ 			set wireless.${name}=wifi-device
+ 			set wireless.${name}.type=mac80211
+@@ -203,15 +264,49 @@ detect_mac80211() {
+ 			set wireless.${name}.channel=${channel}
+ 			set wireless.${name}.band=${mode_band}
+ 			set wireless.${name}.htmode=$htmode
+-			set wireless.${name}.disabled=1
++			set wireless.${name}.country='US'
++			set wireless.${name}.noscan=${noscan}
++			set wireless.${name}.disabled=0
++EOF
++		[ -n "$mbssid" ] && {
++			uci -q set wireless.${name}.mbssid=${mbssid}
++		}
++		[ -n "$rnr" ] && {
++			uci -q set wireless.${name}.rnr=${rnr}
++		}
++		[ -n "$background_radar" ] && {
++			uci -q set wireless.${name}.background_radar=${background_radar}
++		}
++		[ -n "$tx_burst" ] && {
++			uci -q set wireless.${name}.tx_burst=${tx_burst}
++		}
  
-+        local disable_eht
-+        local disable_he
-+        local disable_vht
-+        local disable_ht
-+        json_get_vars disable_eht
-+        json_get_vars disable_he
-+        json_get_vars disable_vht
-+        json_get_vars disable_ht
-+
-+        [ -n "$disable_eht" ] && append network_data "disable_eht=$disable_eht" "$N$T"
-+        [ -n "$disable_he" ] && append network_data "disable_he=$disable_he" "$N$T"
-+        [ -n "$disable_vht" ] && append network_data "disable_vht=$disable_vht" "$N$T"
-+        [ -n "$disable_ht" ] && append network_data "disable_ht=$disable_ht" "$N$T"
++		uci -q batch <<-EOF
+ 			set wireless.default_${name}=wifi-iface
+ 			set wireless.default_${name}.device=${name}
+ 			set wireless.default_${name}.network=lan
+ 			set wireless.default_${name}.mode=ap
+-			set wireless.default_${name}.ssid=OpenWrt
+-			set wireless.default_${name}.encryption=none
++			set wireless.default_${name}.ssid=OpenWrt-${mode_band}
++			set wireless.default_${name}.encryption=${encryption}
+ EOF
 +
- 	[ -n "$basic_rate" ] && {
- 		local br rate_list=
- 		for br in $basic_rate; do
-@@ -1582,6 +1785,11 @@ wpa_supplicant_add_network() {
- 		append network_data "mcast_rate=$mc_rate" "$N$T"
- 	}
- 
-+	if [ "$auth_type" = "sae" ]; then
-+		json_get_vars sae_pwe sae_pwe
-+		[ -n "$sae_pwe" ] && echo "sae_pwe=$sae_pwe" >> "$_config"
-+	fi
++		# calibrated board will use eeprom macaddress, not ramdom address
++		[ -n "$macaddr" ] && {
++			uci -q set wireless.default_${name}.macaddr=${macaddr}
++		}
 +
- 	if [ "$key_mgmt" = "WPS" ]; then
- 		echo "wps_cred_processing=1" >> "$_config"
- 	else
++		[ -n "$key" ] && {
++			uci -q set wireless.default_${name}.key=${key}
++		}
++		[ -n "$sae_pwe" ] && {
++			uci -q set wireless.default_${name}.sae_pwe=${sae_pwe}
++		}
++		[ -n "$ieee80211w" ] && {
++			uci -q set wireless.default_${name}.ieee80211w=${ieee80211w}
++		}
++		[ -n "$mbo" ] && {
++			uci -q set wireless.default_${name}.mbo=${mbo}
++		}
+ 		uci -q commit wireless
+ 	done
+ }
+