From c93b14ca7adee18e364ef9dff45cf5b64db4ff62 Mon Sep 17 00:00:00 2001 From: Sharadanand Karanjkar Date: Tue, 9 Nov 2021 19:58:43 +0100 Subject: [PATCH] hostapd: Added control for multiple_bssid and ema Re-enabling "multiple_bssid" and "ema". Fixes: WIFI-5732 Signed-off-by: Sharadanand Karanjkar --- feeds/wifi-ax/hostapd/files/hostapd.sh | 8 ++++++-- .../mac80211/files/lib/netifd/wireless/mac80211.sh | 12 +++++++++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/feeds/wifi-ax/hostapd/files/hostapd.sh b/feeds/wifi-ax/hostapd/files/hostapd.sh index 608f532f1..a1d0801dd 100644 --- a/feeds/wifi-ax/hostapd/files/hostapd.sh +++ b/feeds/wifi-ax/hostapd/files/hostapd.sh @@ -114,7 +114,7 @@ hostapd_common_add_device_config() { config_add_int airtime_mode - config_add_boolean rnr_beacon he_co_locate + config_add_boolean multiple_bssid rnr_beacon he_co_locate ema hostapd_add_log_config } @@ -127,7 +127,7 @@ hostapd_prepare_device_config() { json_get_vars country country3 country_ie beacon_int:100 dtim_period:2 doth require_mode legacy_rates \ acs_chan_bias local_pwr_constraint spectrum_mgmt_required airtime_mode cell_density \ rts_threshold beacon_rate rssi_reject_assoc_rssi rssi_ignore_probe_request maxassoc \ - he_co_locate rnr_beacon + multiple_bssid he_co_locate rnr_beacon ema hostapd_set_log_options base_cfg @@ -139,6 +139,8 @@ hostapd_prepare_device_config() { set_default cell_density 0 set_default he_co_locate 0 set_default rnr_beacon 0 + set_default multiple_bssid 0 + set_default ema 0 [ -n "$country" ] && { append base_cfg "country_code=$country" "$N" @@ -233,6 +235,8 @@ hostapd_prepare_device_config() { [ -n "$maxassoc" ] && append base_cfg "iface_max_num_sta=$maxassoc" "$N" [ "$rnr_beacon" -gt 0 ] && append base_cfg "rnr_beacon=$rnr_beacon" "$N" [ "$he_co_locate" -gt 0 ] && append base_cfg "he_co_locate=$he_co_locate" "$N" + [ "$multiple_bssid" -gt 0 ] && append base_cfg "multiple_bssid=$multiple_bssid" "$N" + [ "$ema" -gt 0 ] && append base_cfg "ema=$ema" "$N" json_get_values opts hostapd_options for val in $opts; do diff --git a/feeds/wifi-ax/mac80211/files/lib/netifd/wireless/mac80211.sh b/feeds/wifi-ax/mac80211/files/lib/netifd/wireless/mac80211.sh index a25e4ff9b..120ad3bc6 100644 --- a/feeds/wifi-ax/mac80211/files/lib/netifd/wireless/mac80211.sh +++ b/feeds/wifi-ax/mac80211/files/lib/netifd/wireless/mac80211.sh @@ -499,6 +499,7 @@ mac80211_get_addr() { mac80211_generate_mac() { local phy="$1" + local multiple_bssid="$2" local id="${macidx:-0}" local ref="$(cat /sys/class/ieee80211/${phy}/macaddress)" @@ -522,7 +523,10 @@ mac80211_generate_mac() { local mask6=$6 local oIFS="$IFS"; IFS=":"; set -- $ref; IFS="$oIFS" - + [ "$multiple_bssid" -eq 1 ] && { + printf "02:%s:%s:%s:%s:%02x" $b1 $2 $3 $4 $5 $macidx + return + } macidx=$(($id + 1)) local use_global=0 @@ -635,6 +639,7 @@ mac80211_iw_interface_add() { } mac80211_prepare_vif() { + local multiple_bssid=$1 json_select config json_get_vars ifname mode ssid wds powersave macaddr enable wpa_psk_file vlan_file @@ -648,7 +653,7 @@ mac80211_prepare_vif() { json_select .. [ -n "$macaddr" ] || { - macaddr="$(mac80211_generate_mac $phy)" + macaddr="$(mac80211_generate_mac $phy $multiple_bssid)" macidx="$(($macidx + 1))" } @@ -1017,6 +1022,7 @@ drv_mac80211_setup() { txpower antenna_gain \ rxantenna txantenna \ frag rts beacon_int:100 htmode \ + multiple_bssid:0 \ num_global_macaddr json_get_values basic_rate_list basic_rate json_get_values scan_list scan_list @@ -1111,7 +1117,7 @@ drv_mac80211_setup() { mac80211_prepare_iw_htmode for_each_interface "sta adhoc mesh monitor" mac80211_prepare_vif NEWAPLIST= - for_each_interface "ap" mac80211_prepare_vif + for_each_interface "ap" mac80211_prepare_vif ${multiple_bssid} NEW_MD5=$(test -e "${hostapd_conf_file}" && md5sum ${hostapd_conf_file}) OLD_MD5=$(uci -q -P /var/state get wireless._${phy}.md5) if [ "${NEWAPLIST}" != "${OLDAPLIST}" ]; then