hostapd-ax: update to ath11k-ed2 release

Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
John Crispin
2020-11-23 08:25:57 +01:00
parent 4abb8e181b
commit 6b7f1b9009
57 changed files with 6999 additions and 8521 deletions

View File

@@ -1,4 +1,5 @@
. /lib/functions/network.sh
. /lib/functions.sh
wpa_supplicant_add_rate() {
local var="$1"
@@ -44,6 +45,7 @@ hostapd_append_wpa_key_mgmt() {
append wpa_key_mgmt "WPA-$auth_type_l"
[ "${ieee80211r:-0}" -gt 0 ] && append wpa_key_mgmt "FT-${auth_type_l}"
[ "${ieee80211w:-0}" -gt 0 ] && append wpa_key_mgmt "WPA-${auth_type_l}-SHA256"
[ "${ieee80211ai:-0}" -gt 0 ] && append wpa_key_mgmt "FILS-SHA256"
;;
eap192)
append wpa_key_mgmt "WPA-EAP-SUITE-B-192"
@@ -70,6 +72,8 @@ hostapd_append_wpa_key_mgmt() {
append wpa_key_mgmt "OWE"
;;
esac
[ "$auth_osen" = "1" ] && append wpa_key_mgmt "OSEN"
}
hostapd_add_log_config() {
@@ -96,9 +100,11 @@ hostapd_common_add_device_config() {
config_add_string require_mode
config_add_boolean legacy_rates
config_add_string acs_chan_bias co_locate
config_add_string acs_chan_bias
config_add_array hostapd_options
config_add_boolean multiple_bssid rnr_beacon
config_add_int airtime_mode
config_add_boolean multiple_bssid rnr_beacon he_co_locate ema
hostapd_add_log_config
}
@@ -111,7 +117,8 @@ hostapd_prepare_device_config() {
local base_cfg=
json_get_vars country country_ie beacon_int:100 dtim_period:2 doth require_mode legacy_rates \
acs_chan_bias local_pwr_constraint spectrum_mgmt_required multiple_bssid co_locate
acs_chan_bias local_pwr_constraint spectrum_mgmt_required airtime_mode \
multiple_bssid he_co_locate rnr_beacon ema
hostapd_set_log_options base_cfg
@@ -119,8 +126,11 @@ hostapd_prepare_device_config() {
set_default spectrum_mgmt_required 0
set_default doth 1
set_default legacy_rates 1
set_default airtime_mode 0
set_default multiple_bssid 0
set_default rnr_beacon 1
set_default rnr_beacon 0
set_default he_co_locate 0
set_default ema 0
[ "$hwmode" = "b" ] && legacy_rates=1
@@ -136,7 +146,6 @@ hostapd_prepare_device_config() {
}
[ -n "$acs_chan_bias" ] && append base_cfg "acs_chan_bias=$acs_chan_bias" "$N"
[ -n "$co_locate" ] && append base_cfg "co_locate=$co_locate" "$N"
local brlist= br
json_get_values basic_rate_list basic_rate
@@ -168,6 +177,11 @@ hostapd_prepare_device_config() {
[ -n "$brlist" ] && append base_cfg "basic_rates=$brlist" "$N"
append base_cfg "beacon_int=$beacon_int" "$N"
append base_cfg "dtim_period=$dtim_period" "$N"
[ "$airtime_mode" -gt 0 ] && append base_cfg "airtime_mode=$airtime_mode" "$N"
[ "$multiple_bssid" -gt 0 ] && append base_cfg "multiple_bssid=$multiple_bssid" "$N"
[ "$rnr_beacon" -gt 0 ] && append base_cfg "rnr_beacon=$rnr_beacon" "$N"
[ "$ema" -gt 0 ] && append base_cfg "ema=$ema" "$N"
[ "$he_co_locate" -gt 0 ] && append base_cfg "he_co_locate=$he_co_locate" "$N"
json_get_values opts hostapd_options
for val in $opts; do
@@ -197,10 +211,11 @@ hostapd_common_add_bss_config() {
config_add_boolean rsn_preauth auth_cache
config_add_int ieee80211w
config_add_int ieee80211ai
config_add_int eapol_version
config_add_string 'auth_server:host' 'server:host'
config_add_string auth_secret
config_add_string auth_secret key
config_add_int 'auth_port:port' 'port:port'
config_add_string acct_server
@@ -238,12 +253,15 @@ hostapd_common_add_bss_config() {
config_add_string wps_device_type wps_device_name wps_manufacturer wps_pin
config_add_string multi_ap_backhaul_ssid multi_ap_backhaul_key
config_add_boolean ieee80211v wnm_sleep_mode bss_transition
config_add_boolean wnm_sleep_mode bss_transition
config_add_int time_advertisement
config_add_string time_zone
config_add_boolean ieee80211k rrm_neighbor_report rrm_beacon_report
config_add_boolean ftm_responder stationary_ap
config_add_string lci civic
config_add_boolean ieee80211r pmk_r1_push ft_psk_generate_local ft_over_ds
config_add_int r0_key_lifetime reassociation_deadline
config_add_string mobility_domain r1_key_holder
@@ -260,10 +278,44 @@ hostapd_common_add_bss_config() {
config_add_int mcast_rate
config_add_array basic_rate
config_add_array supported_rates
config_add_boolean sae_require_mfp
config_add_string 'owe_transition_bssid:macaddr' 'owe_transition_ssid:string'
config_add_boolean iw_enabled iw_internet iw_asra iw_esr iw_uesa
config_add_int iw_access_network_type iw_venue_group iw_venue_type
config_add_int iw_ipaddr_type_availability iw_gas_address3
config_add_string iw_hessid iw_network_auth_type iw_qos_map_set
config_add_array iw_roaming_consortium iw_domain_name iw_anqp_3gpp_cell_net iw_nai_realm
config_add_array iw_anqp_elem
config_add_int beacon_rate
config_add_int rssi_reject_assoc_rssi
config_add_int rssi_ignore_probe_request
config_add_boolean hs20 disable_dgaf osen
config_add_int anqp_domain_id
config_add_int hs20_deauth_req_timeout
config_add_array hs20_oper_friendly_name
config_add_array osu_provider
config_add_array operator_icon
config_add_array hs20_conn_capab
config_add_array roaming_consortium
config_add_array venue_name
config_add_array venue_url
config_add_array nai_realm
config_add_string osu_ssid hs20_wan_metrics hs20_operating_class hs20_t_c_filename hs20_t_c_timestamp
config_add_boolean interworking internet
config_add_int access_network_type asra esr uesa venue_group venue_type ipaddr_type_availability \
gas_address3
config_add_string hessid network_auth_type \
anqp_3gpp_cell_net anqp_elem domain_name qos_map_set hs20_t_c_server_url
config_add_array airtime_sta_weight
config_add_int airtime_bss_weight airtime_bss_limit
config_add_int rts_threshold
}
hostapd_set_vlan_file() {
@@ -299,6 +351,115 @@ hostapd_set_psk() {
for_each_station hostapd_set_psk_file ${ifname}
}
append_iw_roaming_consortium() {
[ -n "$1" ] && append bss_conf "roaming_consortium=$1" "$N"
}
append_iw_domain_name() {
if [ -z "$iw_domain_name_conf" ]; then
iw_domain_name_conf="$1"
else
iw_domain_name_conf="$iw_domain_name_conf,$1"
fi
}
append_iw_anqp_3gpp_cell_net() {
if [ -z "$iw_anqp_3gpp_cell_net_conf" ]; then
iw_anqp_3gpp_cell_net_conf="$1"
else
iw_anqp_3gpp_cell_net_conf="$iw_anqp_3gpp_cell_net_conf:$1"
fi
}
append_iw_anqp_elem() {
[ -n "$1" ] && append bss_conf "anqp_elem=$1" "$N"
}
append_iw_nai_realm() {
[ -n "$1" ] && append bss_conf "nai_realm=$1" "$N"
}
append_roaming_consortium() {
[ -n "$1" ] && append bss_conf "roaming_consortium=$1" "$N"
}
append_venue_name() {
[ -n "$1" ] && append bss_conf "venue_name=$1" "$N"
}
append_venue_url() {
[ -n "$1" ] && append bss_conf "venue_url=$1" "$N"
}
append_nai_realm() {
[ -n "$1" ] && append bss_conf "nai_realm=$1" "$N"
}
append_hs20_oper_friendly_name() {
[ -n "$1" ] && append bss_conf "hs20_oper_friendly_name=$1" "$N"
}
append_osu_provider_service_desc() {
[ -n "$1" ] && append bss_conf "osu_service_desc=$1" "$N"
}
append_hs20_icon() {
local width height lang type path
config_get width "$1" width
config_get height "$1" height
config_get lang "$1" lang
config_get type "$1" type
config_get path "$1" path
append bss_conf "hs20_icon=$width:$height:$lang:$type:$1:$path" "$N"
}
append_hs20_icons() {
config_load wireless
config_foreach append_hs20_icon hs20-icon
}
append_operator_icon() {
[ -n "$1" ] && append bss_conf "operator_icon=$1" "$N"
}
append_osu_icon() {
[ -n "$1" ] && append bss_conf "osu_icon=$1" "$N"
}
append_osu_provider() {
local cfgtype osu_server_uri osu_nai osu_nai2 osu_method_list
config_load wireless
config_get cfgtype "$1" TYPE
[ "$cfgtype" != "osu-provider" ] && return
append bss_conf "# provider $1" "$N"
config_get osu_server_uri "$1" osu_server_uri
config_get osu_nai "$1" osu_nai
config_get osu_nai2 "$1" osu_nai2
config_get osu_method_list "$1" osu_method
[ -n "$osu_server_uri" ] append bss_conf "osu_server_uri=$osu_server_uri" "$N"
[ -n "$osu_nai" ] append bss_conf "osu_nai=$osu_nai" "$N"
[ -n "$osu_nai2" ] append bss_conf "osu_nai2=$osu_nai2" "$N"
[ -n "$osu_method_list" ] append bss_conf "osu_method_list=$osu_method_list" "$N"
config_list_foreach "$1" osu_service_desc append_osu_provider_service_desc
config_list_foreach "$1" osu_friendly_name append_osu_friendly_name
config_list_foreach "$1" osu_icon append_osu_icon
append bss_conf "$N"
}
append_hs20_conn_capab() {
[ -n "$1" ] && append bss_conf "hs20_conn_capab=$1" "$N"
}
append_airtime_sta_weight() {
[ -n "$1" ] && append bss_conf "airtime_sta_weight=$1" "$N"
}
hostapd_set_bss_options() {
local var="$1"
local phy="$2"
@@ -316,10 +477,12 @@ hostapd_set_bss_options() {
wps_pushbutton wps_label ext_registrar wps_pbc_in_m1 wps_ap_setup_locked \
wps_independent wps_device_type wps_device_name wps_manufacturer wps_pin \
macfilter ssid utf8_ssid wmm uapsd hidden short_preamble rsn_preauth \
iapp_interface eapol_version dynamic_vlan ieee80211w nasid \
iapp_interface eapol_version dynamic_vlan ieee80211w ieee80211ai nasid \
acct_server acct_secret acct_port acct_interval \
bss_load_update_period chan_util_avg_period sae_require_mfp \
multi_ap multi_ap_backhaul_ssid multi_ap_backhaul_key
multi_ap multi_ap_backhaul_ssid multi_ap_backhaul_key \
airtime_bss_weight airtime_bss_limit airtime_sta_weight \
rssi_reject_assoc_rssi rssi_ignore_probe_request rts_threshold
set_default isolate 0
set_default maxassoc 0
@@ -337,6 +500,11 @@ hostapd_set_bss_options() {
set_default chan_util_avg_period 600
set_default utf8_ssid 1
set_default multi_ap 0
set_default airtime_bss_weight 0
set_default airtime_bss_limit 0
set_default rssi_reject_assoc_rssi 0
set_default rssi_ignore_probe_request 0
set_default rts_threshold -1
append bss_conf "ctrl_interface=/var/run/hostapd"
if [ "$isolate" -gt 0 ]; then
@@ -349,6 +517,10 @@ hostapd_set_bss_options() {
append bss_conf "ap_max_inactivity=$max_inactivity" "$N"
fi
[ "$airtime_bss_weight" -gt 0 ] && append bss_conf "airtime_bss_weight=$airtime_bss_weight" "$N"
[ "$airtime_bss_limit" -gt 0 ] && append bss_conf "airtime_bss_limit=$airtime_bss_limit" "$N"
json_for_each_item append_airtime_sta_weight airtime_sta_weight
append bss_conf "bss_load_update_period=$bss_load_update_period" "$N"
append bss_conf "chan_util_avg_period=$chan_util_avg_period" "$N"
append bss_conf "disassoc_low_ack=$disassoc_low_ack" "$N"
@@ -358,6 +530,9 @@ hostapd_set_bss_options() {
append bss_conf "uapsd_advertisement_enabled=$uapsd" "$N"
append bss_conf "utf8_ssid=$utf8_ssid" "$N"
append bss_conf "multi_ap=$multi_ap" "$N"
append bss_conf "rssi_reject_assoc_rssi=$rssi_reject_assoc_rssi" "$N"
append bss_conf "rssi_ignore_probe_request=$rssi_ignore_probe_request" "$N"
append bss_conf "rts_threshold=$rts_threshold" "$N"
[ "$tdls_prohibit" -gt 0 ] && append bss_conf "tdls_prohibit=$tdls_prohibit" "$N"
@@ -406,13 +581,13 @@ hostapd_set_bss_options() {
;;
psk|sae|psk-sae)
json_get_vars key wpa_psk_file
if [ ${#key} -lt 8 ]; then
if [ ${#key} -eq 64 ]; then
append bss_conf "wpa_psk=$key" "$N"
elif [ ${#key} -ge 8 ] && [ ${#key} -le 63 ]; then
append bss_conf "wpa_passphrase=$key" "$N"
elif [ -n "$key" ] || [ -z "$wpa_psk_file" ]; then
wireless_setup_vif_failed INVALID_WPA_PSK
return 1
elif [ ${#key} -eq 64 ]; then
append bss_conf "wpa_psk=$key" "$N"
else
append bss_conf "wpa_passphrase=$key" "$N"
fi
[ -z "$wpa_psk_file" ] && set_default wpa_psk_file /var/run/hostapd-$ifname.psk
[ -n "$wpa_psk_file" ] && {
@@ -532,30 +707,31 @@ hostapd_set_bss_options() {
append bss_conf "iapp_interface=$ifname" "$N"
}
json_get_vars ieee80211v
set_default ieee80211v 0
if [ "$ieee80211v" -eq "1" ]; then
json_get_vars time_advertisement time_zone wnm_sleep_mode bss_transition
json_get_vars time_advertisement time_zone wnm_sleep_mode bss_transition
set_default time_advertisement 0
set_default wnm_sleep_mode 0
set_default bss_transition 0
[ -n "$time_advertisement" ] && append bss_conf "time_advertisement=$time_advertisement" "$N"
[ -n "$time_zone" ] && append bss_conf "time_zone=$time_zone" "$N"
[ "$wnm_sleep_mode" -eq "1" ] && append bss_conf "wnm_sleep_mode=1" "$N"
[ "$bss_transition" -eq "1" ] && append bss_conf "bss_transition=1" "$N"
append bss_conf "time_advertisement=$time_advertisement" "$N"
[ -n "$time_zone" ] && append bss_conf "time_zone=$time_zone" "$N"
append bss_conf "wnm_sleep_mode=$wnm_sleep_mode" "$N"
append bss_conf "bss_transition=$bss_transition" "$N"
fi
json_get_vars ieee80211k
json_get_vars ieee80211k rrm_neighbor_report rrm_beacon_report
set_default ieee80211k 0
if [ "$ieee80211k" -eq "1" ]; then
json_get_vars rrm_neighbor_report rrm_beacon_report
set_default rrm_neighbor_report 1
set_default rrm_beacon_report 1
append bss_conf "rrm_neighbor_report=$rrm_neighbor_report" "$N"
append bss_conf "rrm_beacon_report=$rrm_beacon_report" "$N"
fi
[ "$rrm_neighbor_report" -eq "1" ] && append bss_conf "rrm_neighbor_report=1" "$N"
[ "$rrm_beacon_report" -eq "1" ] && append bss_conf "rrm_beacon_report=1" "$N"
json_get_vars ftm_responder stationary_ap lci civic
if [ "$ftm_responder" -eq "1" ]; then
iw phy "$phy" info | grep -q "ENABLE_FTM_RESPONDER" && {
append bss_conf "ftm_responder=1" "$N"
[ "$stationary_ap" -eq "1" ] && append bss_conf "stationary_ap=1" "$N"
[ -n "$lci" ] && append bss_conf "lci=$lci" "$N"
[ -n "$civic" ] && append bss_conf "lci=$civic" "$N"
}
fi
if [ "$wpa" -ge "1" ]; then
@@ -692,6 +868,110 @@ hostapd_set_bss_options() {
}
}
json_get_vars iw_enabled iw_internet iw_asra iw_esr iw_uesa iw_access_network_type
json_get_vars iw_hessid iw_venue_group iw_venue_type iw_network_auth_type
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
set_default iw_enabled 0
if [ "$iw_enabled" = "1" ]; then
append bss_conf "interworking=1" "$N"
set_default iw_internet 1
set_default iw_asra 0
set_default iw_esr 0
set_default iw_uesa 0
append bss_conf "internet=$iw_internet" "$N"
append bss_conf "asra=$iw_asra" "$N"
append bss_conf "esr=$iw_esr" "$N"
append bss_conf "uesa=$iw_uesa" "$N"
[ -n "$iw_access_network_type" ] && \
append bss_conf "access_network_type=$iw_access_network_type" "$N"
[ -n "$iw_hessid" ] && append bss_conf "hessid=$iw_hessid" "$N"
[ -n "$iw_venue_group" ] && \
append bss_conf "venue_group=$iw_venue_group" "$N"
[ -n "$iw_venue_type" ] && append bss_conf "venue_type=$iw_venue_type" "$N"
[ -n "$iw_network_auth_type" ] && \
append bss_conf "network_auth_type=$iw_network_auth_type" "$N"
[ -n "$iw_gas_address3" ] && append bss_conf "gas_address3=$iw_gas_address3" "$N"
[ -n "$iw_qos_map_set" ] && append bss_conf "qos_map_set=$iw_qos_map_set" "$N"
json_for_each_item append_iw_roaming_consortium iw_roaming_consortium
json_for_each_item append_iw_anqp_elem iw_anqp_elem
json_for_each_item append_iw_nai_realm iw_nai_realm
iw_domain_name_conf=
json_for_each_item append_iw_domain_name iw_domain_name
[ -n "$iw_domain_name_conf" ] && \
append bss_conf "domain_name=$iw_domain_name_conf" "$N"
iw_anqp_3gpp_cell_net_conf=
json_for_each_item append_iw_anqp_3gpp_cell_net iw_anqp_3gpp_cell_net
[ -n "$iw_anqp_3gpp_cell_net_conf" ] && \
append bss_conf "anqp_3gpp_cell_net=$iw_anqp_3gpp_cell_net_conf" "$N"
fi
local hs20 disable_dgaf osen anqp_domain_id hs20_deauth_req_timeout \
osu_ssid hs20_wan_metrics hs20_operating_class hs20_t_c_filename hs20_t_c_timestamp \
interworking internet access_network_type asra esr uesa venue_group venue_type \
ipaddr_type_availability gas_address3 hessid \
network_auth_type anqp_3gpp_cell_net domain_name anqp_elem qos_map_set \
hs20_t_c_server_url
json_get_vars hs20 disable_dgaf osen anqp_domain_id hs20_deauth_req_timeout \
osu_ssid hs20_wan_metrics hs20_operating_class hs20_t_c_filename hs20_t_c_timestamp \
interworking internet access_network_type asra esr uesa venue_group venue_type \
ipaddr_type_availability gas_address3 hessid \
network_auth_type anqp_3gpp_cell_net domain_name anqp_elem qos_map_set \
hs20_t_c_server_url
set_default hs20 0
set_default disable_dgaf $hs20
set_default osen 0
set_default anqp_domain_id 0
set_default hs20_deauth_req_timeout 60
if [ "$hs20" = "1" ]; then
append bss_conf "hs20=1" "$N"
append_hs20_icons
[ -n "$disable_dgaf"] && append bss_conf "disable_dgaf=$disable_dgaf" "$N"
[ -n "$osen"] && append bss_conf "osen=$osen" "$N"
[ -n "$anqp_domain_id"] && append bss_conf "anqp_domain_id=$anqp_domain_id" "$N"
[ -n "$hs20_deauth_req_timeout"] && append bss_conf "hs20_deauth_req_timeout=$hs20_deauth_req_timeout" "$N"
[ -n "$osu_ssid" ] && append bss_conf "osu_ssid=$osu_ssid" "$N"
[ -n "$hs20_wan_metrics" ] && append bss_conf "hs20_wan_metrics=$hs20_wan_metrics" "$N"
[ -n "$hs20_operating_class" ] && append bss_conf "hs20_operating_class=$hs20_operating_class" "$N"
[ -n "$hs20_t_c_filename" ] && append bss_conf "hs20_t_c_filename=$hs20_t_c_filename" "$N"
[ -n "$hs20_t_c_timestamp" ] && append bss_conf "hs20_t_c_timestamp=$hs20_t_c_timestamp" "$N"
json_for_each_item append_hs20_oper_friendly_name hs20_oper_friendly_name
json_for_each_item append_roaming_consortium roaming_consortium
json_for_each_item append_venue_name venue_name
json_for_each_item append_venue_url venue_url
json_for_each_item append_nai_realm nai_realm
json_for_each_item append_hs20_conn_capab hs20_conn_capab
json_for_each_item append_hs20_oper_friendly_name hs20_oper_friendly_name
json_for_each_item append_osu_provider osu_provider
json_for_each_item append_operator_icon operator_icon
[ -n "$interworking" ] && append bss_conf "interworking=$interworking" "$N"
[ -n "$internet" ] && append bss_conf "internet=$internet" "$N"
[ -n "$access_network_type" ] && append bss_conf "access_network_type=$access_network_type" "$N"
[ -n "$asra" ] && append bss_conf "asra=$asra" "$N"
[ -n "$esr" ] && append bss_conf "esr=$esr" "$N"
[ -n "$uesa" ] && append bss_conf "uesa=$uesa" "$N"
[ -n "$venue_group" ] && append bss_conf "venue_group=$venue_group" "$N"
[ -n "$venue_type" ] && append bss_conf "venue_type=$venue_type" "$N"
[ -n "$ipaddr_type_availability" ] && append bss_conf "ipaddr_type_availability=$ipaddr_type_availability" "$N"
[ -n "$gas_address3" ] && append bss_conf "gas_address3=$gas_address3" "$N"
[ -n "$hessid" ] && append bss_conf "hessid=$hessid" "$N"
[ -n "$network_auth_type" ] && append bss_conf "network_auth_type=$network_auth_type" "$N"
[ -n "$anqp_3gpp_cell_net" ] && append bss_conf "anqp_3gpp_cell_net=$anqp_3gpp_cell_net" "$N"
[ -n "$nai_realm" ] && append bss_conf "nai_realm=$nai_realm" "$N"
[ -n "$anqp_elem" ] && append bss_conf "anqp_elem=$anqp_elem" "$N"
[ -n "$qos_map_set" ] && append bss_conf "qos_map_set=$qos_map_set" "$N"
[ -n "$domain_name" ] && append bss_conf "domain_name=$domain_name" "$N"
[ -n "$hs20_t_c_server_url" ] && append bss_conf "hs20_t_c_server_url=$hs20_t_c_server_url" "$N"
fi
bss_md5sum=$(echo $bss_conf | md5sum | cut -d" " -f1)
append bss_conf "config_id=$bss_md5sum" "$N"
@@ -790,6 +1070,7 @@ wpa_supplicant_prepare_interface() {
fi
wpa_supplicant_teardown_interface "$ifname"
cat > "$_config" <<EOF
${scan_list:+freq_list=$scan_list}
$ap_scan
$country_str
EOF
@@ -813,7 +1094,7 @@ wpa_supplicant_set_fixed_freq() {
case "$htmode" in
VHT80|HE80) append network_data "max_oper_chwidth=1" "$N$T";;
VHT160|HE160) append network_data "max_oper_chwidth=2" "$N$T";;
VHT20|VHT40|HE20|HE40) append network_data "max_oper_chwidth=0" "$N$T";;
VHT20|HE20|VHT40|HE40) append network_data "max_oper_chwidth=0" "$N$T";;
*) append network_data "disable_vht=1" "$N$T";;
esac
}
@@ -1129,7 +1410,7 @@ wpa_supplicant_run() {
[ "$ret" != 0 ] && wireless_setup_vif_failed WPA_SUPPLICANT_FAILED
local supplicant_pid=$(ubus call service list '{"name": "hostapd"}' | jsonfilter -l 1 -e "@['hostapd'].instances['supplicant'].pid")
local supplicant_pid=$(ubus call service list '{"name": "wpad"}' | jsonfilter -l 1 -e "@['wpad'].instances['supplicant'].pid")
wireless_add_process "$supplicant_pid" "/usr/sbin/wpa_supplicant" 1
return $ret

View File

@@ -0,0 +1,37 @@
From cefc52e6b93731c713f1bba1cb5e7e92105b758b Mon Sep 17 00:00:00 2001
From: David Bauer <mail@david-bauer.net>
Date: Fri, 3 Jul 2020 23:00:34 +0200
Subject: [PATCH] dfs: enter DFS state if no available channel is found
Previously hostapd would not stop transmitting when a DFS event was
detected and no available channel to switch to was available.
Disable and re-enable the interface to enter DFS state. This way, TX
does not happen until the kernel notifies hostapd about the NOP
expiring.
Signed-off-by: David Bauer <mail@david-bauer.net>
---
src/ap/dfs.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
--- a/src/ap/dfs.c
+++ b/src/ap/dfs.c
@@ -1066,8 +1066,15 @@ static int hostapd_dfs_start_channel_swi
&oper_centr_freq_seg0_idx,
&oper_centr_freq_seg1_idx,
&skip_radar);
- if (!channel)
- return err;
+ if (!channel) {
+ /*
+ * Toggle interface state to enter DFS state
+ * until NOP is finished.
+ */
+ hostapd_disable_iface(iface);
+ hostapd_enable_iface(iface);
+ return 0;
+ }
if (!skip_radar) {
iface->freq = channel->freq;
iface->conf->channel = channel->chan;

View File

@@ -0,0 +1,68 @@
From e15b04870a7d7517a9b129d8d5cbebe6b8a25cb8 Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Wed, 29 Jul 2020 17:38:15 +0200
Subject: [PATCH 1/2] probe_request: ignore when rssi is too low
Signed-off-by: John Crispin <john@phrozen.org>
---
hostapd/config_file.c | 2 ++
src/ap/ap_config.c | 1 +
src/ap/ap_config.h | 1 +
src/ap/beacon.c | 4 ++++
4 files changed, 8 insertions(+)
diff --git a/hostapd/config_file.c b/hostapd/config_file.c
index 13396aad2..e0b182c8e 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -4454,6 +4454,8 @@ static int hostapd_config_fill(struct hostapd_config *conf,
conf->rssi_reject_assoc_rssi = atoi(pos);
} else if (os_strcmp(buf, "rssi_reject_assoc_timeout") == 0) {
conf->rssi_reject_assoc_timeout = atoi(pos);
+ } else if (os_strcmp(buf, "rssi_ignore_probe_request") == 0) {
+ conf->rssi_ignore_probe_request = atoi(pos);
} else if (os_strcmp(buf, "pbss") == 0) {
bss->pbss = atoi(pos);
} else if (os_strcmp(buf, "transition_disable") == 0) {
diff --git a/src/ap/ap_config.c b/src/ap/ap_config.c
index 56a4ac388..088bb831a 100644
--- a/src/ap/ap_config.c
+++ b/src/ap/ap_config.c
@@ -277,6 +277,7 @@ struct hostapd_config * hostapd_config_defaults(void)
conf->rssi_reject_assoc_rssi = 0;
conf->rssi_reject_assoc_timeout = 30;
+ conf->rssi_ignore_probe_request = 0;
#ifdef CONFIG_AIRTIME_POLICY
conf->airtime_update_interval = AIRTIME_DEFAULT_UPDATE_INTERVAL;
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
index 7fe418363..a69a8d324 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -1042,6 +1042,7 @@ struct hostapd_config {
int rssi_reject_assoc_rssi;
int rssi_reject_assoc_timeout;
+ int rssi_ignore_probe_request;
#ifdef CONFIG_AIRTIME_POLICY
enum {
diff --git a/src/ap/beacon.c b/src/ap/beacon.c
index ffb2e04d1..21fe04c2f 100644
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -829,6 +829,10 @@ void handle_probe_req(struct hostapd_data *hapd,
struct radius_sta rad_info;
struct hostapd_data *resp_bss = hapd;
+ if (hapd->iconf->rssi_ignore_probe_request && ssi_signal &&
+ ssi_signal < hapd->iconf->rssi_ignore_probe_request)
+ return;
+
if (len < IEEE80211_HDRLEN)
return;
ie = ((const u8 *) mgmt) + IEEE80211_HDRLEN;
--
2.25.1

View File

@@ -1,57 +0,0 @@
From 56f1a13e455787ba2172b471517db80a707f8ba5 Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Mon, 21 Sep 2020 13:38:53 +0200
Subject: [PATCH 807/813] co-located: add a config option to indicate co locate
A 6GHz BSS can be co-located with a 2/5GHz BSS. This option allows us to
indicate if this should be done.
Signed-off-by: John Crispin <john@phrozen.org>
---
hostapd/config_file.c | 2 ++
hostapd/hostapd.conf | 3 +++
src/ap/ap_config.h | 1 +
3 files changed, 6 insertions(+)
diff --git a/hostapd/config_file.c b/hostapd/config_file.c
index e66790303..9db6d159a 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -3552,6 +3552,8 @@ static int hostapd_config_fill(struct hostapd_config *conf,
conf->he_oper_centr_freq_seg0_idx = atoi(pos);
} else if (os_strcmp(buf, "he_oper_centr_freq_seg1_idx") == 0) {
conf->he_oper_centr_freq_seg1_idx = atoi(pos);
+ } else if (os_strcmp(buf, "he_co_locate") == 0) {
+ conf->he_co_locate = atoi(pos);
#endif /* CONFIG_IEEE80211AX */
} else if (os_strcmp(buf, "max_listen_interval") == 0) {
bss->max_listen_interval = atoi(pos);
diff --git a/hostapd/hostapd.conf b/hostapd/hostapd.conf
index 5fc4d5f86..280316c0c 100644
--- a/hostapd/hostapd.conf
+++ b/hostapd/hostapd.conf
@@ -571,6 +571,9 @@ wmm_ac_vo_acm=0
# Default: 1 (enabled)
#broadcast_deauth=1
+# Enable co-locate for a 6GHz radio
+#co_locate=0
+
##### IEEE 802.11n related configuration ######################################
# ieee80211n: Whether IEEE 802.11n (HT) is enabled
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
index bf7645d23..c811708fc 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -1031,6 +1031,7 @@ struct hostapd_config {
u8 he_oper_chwidth;
u8 he_oper_centr_freq_seg0_idx;
u8 he_oper_centr_freq_seg1_idx;
+ bool he_co_locate;
#endif /* CONFIG_IEEE80211AX */
/* VHT enable/disable config from CHAN_SWITCH */
--
2.25.1

View File

@@ -1,44 +0,0 @@
From 8d1c1437a9a3ccebcf575b1f92811bdff008c09c Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Mon, 21 Sep 2020 13:22:54 +0200
Subject: [PATCH 808/813] neighbor_db: set the co-locate bit
If the BSS is co-located, the corresponding bit needs to be set inside
bssid_info.
Signed-off-by: John Crispin <john@phrozen.org>
---
src/ap/neighbor_db.c | 3 +++
src/common/ieee802_11_defs.h | 2 ++
2 files changed, 5 insertions(+)
diff --git a/src/ap/neighbor_db.c b/src/ap/neighbor_db.c
index 01bf88623..3a4cdc004 100644
--- a/src/ap/neighbor_db.c
+++ b/src/ap/neighbor_db.c
@@ -260,6 +260,9 @@ void hostapd_neighbor_set_own_report(struct hostapd_data *hapd)
bssid_info |= NEI_REP_BSSID_INFO_HE;
}
+ if (hapd->iconf->he_co_locate)
+ bssid_info |= NEI_REP_BSSID_INFO_HE_CO_LOCATED;
+
/* TODO: Set NEI_REP_BSSID_INFO_MOBILITY_DOMAIN if MDE is set */
if (ieee80211_freq_to_channel_ext(hapd->iface->freq,
diff --git a/src/common/ieee802_11_defs.h b/src/common/ieee802_11_defs.h
index ec3a0613f..6c0eef885 100644
--- a/src/common/ieee802_11_defs.h
+++ b/src/common/ieee802_11_defs.h
@@ -2130,6 +2130,8 @@ enum phy_type {
#define NEI_REP_BSSID_INFO_VHT BIT(12)
#define NEI_REP_BSSID_INFO_FTM BIT(13)
#define NEI_REP_BSSID_INFO_HE BIT(14)
+#define NEI_REP_BSSID_INFO_HE_ER_BSS BIT(15)
+#define NEI_REP_BSSID_INFO_HE_CO_LOCATED BIT(16)
/*
* IEEE P802.11-REVmc/D5.0 Table 9-152 - HT/VHT Operation Information
--
2.25.1

View File

@@ -1,162 +0,0 @@
From 98367b8d78e1d55f98e745978cb92921028e5938 Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Mon, 21 Sep 2020 13:35:20 +0200
Subject: [PATCH 809/813] rrm: add handling for co-located BSS
A BSS shall include the neighbor entry of a co-located BSS upon an incoming
request.
Signed-off-by: John Crispin <john@phrozen.org>
---
src/ap/rrm.c | 117 ++++++++++++++++++++++++++++++++-------------------
1 file changed, 74 insertions(+), 43 deletions(-)
diff --git a/src/ap/rrm.c b/src/ap/rrm.c
index f2d5cd16e..c9d51dfa7 100644
--- a/src/ap/rrm.c
+++ b/src/ap/rrm.c
@@ -196,6 +196,63 @@ static size_t hostapd_neighbor_report_len(struct wpabuf *buf,
}
+static int hostapd_add_nei_report_entry(struct wpabuf *buf, struct hostapd_neighbor_entry *nr,
+ struct wpa_ssid_value *ssid, u8 lci,
+ u8 civic, u16 lci_max_age)
+{
+ u8 *msmt_token;
+ int send_lci;
+ size_t len;
+
+ if (ssid->ssid_len != nr->ssid.ssid_len ||
+ os_memcmp(ssid->ssid, nr->ssid.ssid, ssid->ssid_len) != 0)
+ return 0;
+
+ send_lci = (lci != 0) && hostapd_check_lci_age(nr, lci_max_age);
+ len = hostapd_neighbor_report_len(buf, nr, send_lci, civic);
+
+ if (len - 2 > 0xff) {
+ wpa_printf(MSG_DEBUG,
+ "NR entry for " MACSTR " exceeds 0xFF bytes",
+ MAC2STR(nr->bssid));
+ return 0;
+ }
+
+ if (len > wpabuf_tailroom(buf))
+ return -1;
+
+ wpabuf_put_u8(buf, WLAN_EID_NEIGHBOR_REPORT);
+ wpabuf_put_u8(buf, len - 2);
+ wpabuf_put_buf(buf, nr->nr);
+
+ if (send_lci && nr->lci) {
+ wpabuf_put_u8(buf, WLAN_EID_MEASURE_REPORT);
+ wpabuf_put_u8(buf, wpabuf_len(nr->lci));
+ /*
+ * Override measurement token - the first byte of the
+ * Measurement Report element.
+ */
+ msmt_token = wpabuf_put(buf, 0);
+ wpabuf_put_buf(buf, nr->lci);
+ *msmt_token = lci;
+ }
+
+ if (civic && nr->civic) {
+ wpabuf_put_u8(buf, WLAN_EID_MEASURE_REPORT);
+ wpabuf_put_u8(buf, wpabuf_len(nr->civic));
+ /*
+ * Override measurement token - the first byte of the
+ * Measurement Report element.
+ */
+ msmt_token = wpabuf_put(buf, 0);
+ wpabuf_put_buf(buf, nr->civic);
+ *msmt_token = civic;
+ }
+
+ return 0;
+}
+
+
static void hostapd_send_nei_report_resp(struct hostapd_data *hapd,
const u8 *addr, u8 dialog_token,
struct wpa_ssid_value *ssid, u8 lci,
@@ -203,7 +260,6 @@ static void hostapd_send_nei_report_resp(struct hostapd_data *hapd,
{
struct hostapd_neighbor_entry *nr;
struct wpabuf *buf;
- u8 *msmt_token;
/*
* The number and length of the Neighbor Report elements in a Neighbor
@@ -220,52 +276,27 @@ static void hostapd_send_nei_report_resp(struct hostapd_data *hapd,
dl_list_for_each(nr, &hapd->nr_db, struct hostapd_neighbor_entry,
list) {
- int send_lci;
- size_t len;
-
- if (ssid->ssid_len != nr->ssid.ssid_len ||
- os_memcmp(ssid->ssid, nr->ssid.ssid, ssid->ssid_len) != 0)
- continue;
-
- send_lci = (lci != 0) && hostapd_check_lci_age(nr, lci_max_age);
- len = hostapd_neighbor_report_len(buf, nr, send_lci, civic);
-
- if (len - 2 > 0xff) {
- wpa_printf(MSG_DEBUG,
- "NR entry for " MACSTR " exceeds 0xFF bytes",
- MAC2STR(nr->bssid));
- continue;
- }
-
- if (len > wpabuf_tailroom(buf))
+ if (hostapd_add_nei_report_entry(buf, nr, ssid, lci, civic, lci_max_age))
break;
+ }
- wpabuf_put_u8(buf, WLAN_EID_NEIGHBOR_REPORT);
- wpabuf_put_u8(buf, len - 2);
- wpabuf_put_buf(buf, nr->nr);
+ if (!hapd->iconf->he_co_locate) {
+ int i;
- if (send_lci && nr->lci) {
- wpabuf_put_u8(buf, WLAN_EID_MEASURE_REPORT);
- wpabuf_put_u8(buf, wpabuf_len(nr->lci));
- /*
- * Override measurement token - the first byte of the
- * Measurement Report element.
- */
- msmt_token = wpabuf_put(buf, 0);
- wpabuf_put_buf(buf, nr->lci);
- *msmt_token = lci;
- }
+ for (i = 0; i < hapd->iface->interfaces->count; i++) {
+ struct hostapd_iface *iface = hapd->iface->interfaces->iface[i];
+ int j;
+
+ if (iface == hapd->iface || !iface->conf->he_co_locate)
+ continue;
- if (civic && nr->civic) {
- wpabuf_put_u8(buf, WLAN_EID_MEASURE_REPORT);
- wpabuf_put_u8(buf, wpabuf_len(nr->civic));
- /*
- * Override measurement token - the first byte of the
- * Measurement Report element.
- */
- msmt_token = wpabuf_put(buf, 0);
- wpabuf_put_buf(buf, nr->civic);
- *msmt_token = civic;
+ for (j = 0; j < iface->num_bss; j++) {
+ nr = hostapd_neighbor_get(iface->bss[j], iface->bss[j]->own_addr, NULL);
+ if (!nr)
+ continue;
+ if (hostapd_add_nei_report_entry(buf, nr, ssid, lci, civic, lci_max_age))
+ break;
+ }
}
}
--
2.25.1

View File

@@ -0,0 +1,242 @@
--- a/src/ap/ubus.c
+++ b/src/ap/ubus.c
@@ -146,6 +146,49 @@ hostapd_bss_ban_client(struct hostapd_da
eloop_register_timeout(0, time * 1000, hostapd_bss_del_ban, ban, hapd);
}
+static void
+hostapd_bss_signal_check(void *eloop_data, void *user_ctx)
+/* This is called by an eloop timeout. All stations in the list are checked
+ * for signal level. This requires calling the driver, since hostapd doesn't
+ * see packets from a station once it is fully authorized.
+ * Stations with signal level below the threshold will be dropped.
+ */
+{
+ struct hostapd_data *hapd = user_ctx;
+ struct hostap_sta_driver_data data;
+ struct sta_info *sta, *sta_next;
+ u8 addr[ETH_ALEN]; /* Buffer the address for logging purposes, in case it is destroyed while dropping */
+ int strikes; /* same with strike count on this station. */
+ int num_sta = 0;
+ int num_drop = 0;
+ int signal;
+
+ for (sta = hapd->sta_list; sta; sta = sta_next) {
+ sta_next = sta->next;
+ memcpy(addr, sta->addr, ETH_ALEN);
+ if (!hostapd_drv_read_sta_data(hapd, &data, addr)) {
+ signal = data.signal;
+ num_sta++;
+ strikes = sta->sig_drop_strikes;
+ if (signal < hapd->conf->signal_stay_min) { /* signal bad. */
+ strikes = ++sta->sig_drop_strikes;
+ if (strikes >= hapd->conf->signal_strikes) { /* Struck out--, drop. */
+ hostapd_logger(hapd, addr, HOSTAPD_MODULE_IEEE80211, HOSTAPD_LEVEL_INFO,
+ "Deauthenticating client due to low signal strength %i", data.signal);
+ ap_sta_deauthenticate(hapd, sta, hapd->conf->signal_drop_reason);
+ num_drop++;
+ }
+ } else {
+ sta->sig_drop_strikes = 0; /* signal OK, reset the strike counter. */
+ strikes = 0;
+ }
+ }
+ }
+
+ eloop_register_timeout(hapd->conf->signal_poll_time, 0, hostapd_bss_signal_check, eloop_data, hapd);
+
+}
+
static int
hostapd_bss_reload(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
@@ -580,6 +623,70 @@ hostapd_vendor_elements(struct ubus_cont
return UBUS_STATUS_OK;
}
+enum {
+ SIGNAL_CONNECT,
+ SIGNAL_STAY,
+ SIGNAL_STRIKES,
+ SIGNAL_POLL,
+ SIGNAL_DROP_REASON,
+ __SIGNAL_SETTINGS_MAX
+};
+
+static const struct blobmsg_policy sig_policy[__SIGNAL_SETTINGS_MAX] = {
+ [SIGNAL_CONNECT] = {"connect", BLOBMSG_TYPE_INT32},
+ [SIGNAL_STAY] = {"stay", BLOBMSG_TYPE_INT32},
+ [SIGNAL_STRIKES] = {"strikes", BLOBMSG_TYPE_INT32},
+ [SIGNAL_POLL] = {"poll_time", BLOBMSG_TYPE_INT32},
+ [SIGNAL_DROP_REASON] = {"reason", BLOBMSG_TYPE_INT32}
+};
+
+static int
+hostapd_bss_set_signal(struct ubus_context *ctx, struct ubus_object *obj,
+ struct ubus_request_data *req, const char *method,
+ struct blob_attr *msg)
+{
+ struct blob_attr *tb[__SIGNAL_SETTINGS_MAX];
+ struct hostapd_data *hapd = get_hapd_from_object(obj);
+ int sig_stay;
+
+ blobmsg_parse(sig_policy, __SIGNAL_SETTINGS_MAX, tb, blob_data(msg), blob_len(msg));
+
+ if (!tb[SIGNAL_CONNECT])
+ return UBUS_STATUS_INVALID_ARGUMENT;
+ hapd->conf->signal_auth_min = blobmsg_get_u32(tb[SIGNAL_CONNECT]);
+ if (tb[SIGNAL_STAY]) {
+ sig_stay = blobmsg_get_u32(tb[SIGNAL_STAY]);
+ } else {
+ sig_stay = hapd->conf->signal_auth_min - 5; // Default is 5 dB lower to stay.
+ }
+ hapd->conf->signal_stay_min = sig_stay;
+ if (tb[SIGNAL_STRIKES]) {
+ hapd->conf->signal_strikes = blobmsg_get_u32(tb[SIGNAL_STRIKES]);
+ if (hapd->conf->signal_strikes < 1)
+ return UBUS_STATUS_INVALID_ARGUMENT;
+ } else {
+ hapd->conf->signal_strikes = 3;
+ }
+ if (tb[SIGNAL_POLL]) {
+ hapd->conf->signal_poll_time = blobmsg_get_u32(tb[SIGNAL_POLL]);
+ if (hapd->conf->signal_poll_time < 3)
+ return UBUS_STATUS_INVALID_ARGUMENT;
+ } else {
+ hapd->conf->signal_poll_time = 5;
+ }
+ if (tb[SIGNAL_DROP_REASON]) {
+ hapd->conf->signal_drop_reason = blobmsg_get_u32(tb[SIGNAL_DROP_REASON]);
+ if ((hapd->conf->signal_drop_reason < 1) || (hapd->conf->signal_drop_reason > 35)) // XXX -- look up real limit
+ return UBUS_STATUS_INVALID_ARGUMENT;
+ } else {
+ hapd->conf->signal_drop_reason = 3; // Local choice. 5 (AP too busy) is also a good one.
+ }
+ eloop_cancel_timeout(hostapd_bss_signal_check, ELOOP_ALL_CTX, ELOOP_ALL_CTX);
+ eloop_register_timeout(3, 0, hostapd_bss_signal_check, NULL, hapd); // Start up the poll timer.
+
+ return UBUS_STATUS_OK;
+}
+
static void
hostapd_rrm_print_nr(struct hostapd_neighbor_entry *nr)
{
@@ -1049,6 +1156,7 @@ static const struct ubus_method bss_meth
UBUS_METHOD_NOARG("rrm_nr_list", hostapd_rrm_nr_list),
UBUS_METHOD("rrm_nr_set", hostapd_rrm_nr_set, nr_set_policy),
UBUS_METHOD("rrm_beacon_req", hostapd_rrm_beacon_req, beacon_req_policy),
+ UBUS_METHOD("set_required_signal", hostapd_bss_set_signal, sig_policy),
#ifdef CONFIG_WNM_AP
UBUS_METHOD("wnm_disassoc_imminent", hostapd_wnm_disassoc_imminent, wnm_disassoc_policy),
#endif
@@ -1086,6 +1194,8 @@ void hostapd_ubus_add_bss(struct hostapd
obj->n_methods = bss_object_type.n_methods;
ret = ubus_add_object(ctx, obj);
hostapd_ubus_ref_inc();
+ if (hapd->conf->signal_stay_min > -128)
+ eloop_register_timeout(3, 0, hostapd_bss_signal_check, NULL, hapd); /* Start up the poll timer. */
}
void hostapd_ubus_free_bss(struct hostapd_data *hapd)
@@ -1174,6 +1284,15 @@ int hostapd_ubus_handle_event(struct hos
addr = req->mgmt_frame->sa;
else
addr = req->addr;
+ if (req->type < ARRAY_SIZE(types))
+ type = types[req->type];
+
+ if (req->ssi_signal && req->type != HOSTAPD_UBUS_PROBE_REQ) /* don't clutter the log with probes. */
+ hostapd_logger(hapd, addr, HOSTAPD_MODULE_IEEE80211, HOSTAPD_LEVEL_INFO, "%s request, signal %i %s",
+ type, req->ssi_signal,
+ (req->ssi_signal >= hapd->conf->signal_auth_min) ? "(Accepted)" : "(DENIED)");
+ if (req->ssi_signal && req->ssi_signal < hapd->conf->signal_auth_min)
+ return WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA;
ban = avl_find_element(&hapd->ubus.banned, addr, ban, avl);
if (ban)
@@ -1182,9 +1301,6 @@ int hostapd_ubus_handle_event(struct hos
if (!hapd->ubus.obj.has_subscribers)
return WLAN_STATUS_SUCCESS;
- if (req->type < ARRAY_SIZE(types))
- type = types[req->type];
-
blob_buf_init(&b, 0);
blobmsg_add_macaddr(&b, "address", addr);
if (req->mgmt_frame)
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -3322,6 +3322,24 @@ static int hostapd_config_fill(struct ho
return 1;
}
bss->send_probe_response = val;
+ } else if (os_strcmp(buf, "signal_connect") == 0) {
+ bss->signal_auth_min = atoi(pos);
+ } else if (os_strcmp(buf, "signal_stay") == 0) {
+ bss->signal_stay_min = atoi(pos);
+ } else if (os_strcmp(buf, "signal_poll_time") == 0) {
+ bss->signal_poll_time = atoi(pos);
+ if (bss->signal_poll_time < 3) {
+ wpa_printf(MSG_ERROR, "Line %d: invalid signal poll time", line);
+ return 1;
+ }
+ } else if (os_strcmp(buf, "signal_strikes") == 0) {
+ bss->signal_strikes = atoi(pos);
+ } else if (os_strcmp(buf, "signal_drop_reason") == 0) {
+ bss->signal_drop_reason = atoi(pos);
+ if (bss->signal_drop_reason < 1 || bss->signal_drop_reason > 54) {
+ wpa_printf(MSG_ERROR, "Line %d: invalid signal drop reason", line);
+ return 1;
+ }
} else if (os_strcmp(buf, "supported_rates") == 0) {
if (hostapd_parse_intlist(&conf->supported_rates, pos)) {
wpa_printf(MSG_ERROR, "Line %d: invalid rate list",
--- a/src/ap/ap_config.c
+++ b/src/ap/ap_config.c
@@ -94,6 +94,11 @@ void hostapd_config_defaults_bss(struct
bss->eapol_version = EAPOL_VERSION;
bss->max_listen_interval = 65535;
+ bss->signal_auth_min = -128; /* this is lower than any real signal, so all stations will be accepted */
+ bss->signal_stay_min = -128;
+ bss->signal_strikes = 3;
+ bss->signal_poll_time = 5;
+ bss->signal_drop_reason = 3; /* "Local choice" */
bss->pwd_group = 19; /* ECC: GF(p=256) */
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -351,7 +351,11 @@ struct hostapd_bss_config {
int wds_sta;
int isolate;
int start_disabled;
-
+ int signal_auth_min; /* Minimum signal a STA needs to authenticate */
+ int signal_stay_min; /* Minimum signal needed to stay connected. */
+ int signal_poll_time; /* Time in seconds between checks of connected STAs */
+ int signal_strikes; /* Number of consecutive times signal can be low before dropping the STA. */
+ int signal_drop_reason; /* IEEE802.11 reason code transmitted when dropping a STA. */
int auth_algs; /* bitfield of allowed IEEE 802.11 authentication
* algorithms, WPA_AUTH_ALG_{OPEN,SHARED,LEAP} */
--- a/src/ap/sta_info.c
+++ b/src/ap/sta_info.c
@@ -732,6 +732,7 @@ struct sta_info * ap_sta_add(struct host
sta_track_claim_taxonomy_info(hapd->iface, addr,
&sta->probe_ie_taxonomy);
#endif /* CONFIG_TAXONOMY */
+ sta->sig_drop_strikes = 0;
return sta;
}
--- a/src/ap/sta_info.h
+++ b/src/ap/sta_info.h
@@ -286,6 +286,7 @@ struct sta_info {
unsigned int airtime_weight;
struct os_reltime backlogged_until;
#endif /* CONFIG_AIRTIME_POLICY */
+ int sig_drop_strikes; /* Number of times signal was below threshold. */
};

View File

@@ -1,279 +0,0 @@
From de86c43e09f33ed0103e1dcdc661b662a96ee2cf Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Mon, 2 Nov 2020 16:05:03 +0100
Subject: [PATCH 813/813] rnr: add reduced neighbor reporting
The Reduced Neighbor Report (rnr) element contains channel and other
information related to neighbor APs. It is part of the OCE requirement.
Signed-off-by: John Crispin <john@phrozen.org>
---
hostapd/config_file.c | 2 +
hostapd/hostapd.conf | 3 +
src/ap/ap_config.h | 1 +
src/ap/beacon.c | 8 +++
src/ap/ieee802_11.c | 136 +++++++++++++++++++++++++++++++++++
src/ap/ieee802_11.h | 2 +
src/common/ieee802_11_defs.h | 14 ++++
7 files changed, 166 insertions(+)
Index: hostapd-2020-07-02-58b384f4/hostapd/config_file.c
===================================================================
--- hostapd-2020-07-02-58b384f4.orig/hostapd/config_file.c
+++ hostapd-2020-07-02-58b384f4/hostapd/config_file.c
@@ -4587,6 +4587,8 @@ static int hostapd_config_fill(struct ho
conf->multiple_bssid = atoi(pos);
} else if (os_strcmp(buf, "ema_beacon") == 0) {
conf->ema_beacon = atoi(pos);
+ } else if (os_strcmp(buf, "rnr_beacon") == 0) {
+ bss->rnr_beacon = atoi(pos);
} else {
wpa_printf(MSG_ERROR,
"Line %d: unknown configuration item '%s'",
Index: hostapd-2020-07-02-58b384f4/hostapd/hostapd.conf
===================================================================
--- hostapd-2020-07-02-58b384f4.orig/hostapd/hostapd.conf
+++ hostapd-2020-07-02-58b384f4/hostapd/hostapd.conf
@@ -2775,6 +2775,9 @@ own_ip_addr=127.0.0.1
# that allows sending of such data. Default: 0.
#stationary_ap=0
+# Enable reduced neighbour reporting (RNR)
+#rnr_beacon=0
+
##### Airtime policy configuration ###########################################
# Set the airtime policy operating mode:
Index: hostapd-2020-07-02-58b384f4/src/ap/ap_config.h
===================================================================
--- hostapd-2020-07-02-58b384f4.orig/src/ap/ap_config.h
+++ hostapd-2020-07-02-58b384f4/src/ap/ap_config.h
@@ -863,6 +863,7 @@ struct hostapd_bss_config {
u8 mka_psk_set;
#endif /* CONFIG_MACSEC */
char *config_id;
+ u8 rnr_beacon;
};
/**
Index: hostapd-2020-07-02-58b384f4/src/ap/beacon.c
===================================================================
--- hostapd-2020-07-02-58b384f4.orig/src/ap/beacon.c
+++ hostapd-2020-07-02-58b384f4/src/ap/beacon.c
@@ -477,6 +477,8 @@ static u8 * hostapd_gen_probe_resp(struc
buflen += hostapd_eid_dpp_cc_len(hapd);
if (hapd->iconf->multiple_bssid)
buflen += hostapd_eid_multiple_bssid_len(hapd);
+ if (hapd->conf->rnr_beacon)
+ buflen += hostapd_eid_reduced_neighbor_report_len(hapd, 1);
resp = os_zalloc(buflen);
if (resp == NULL)
@@ -635,6 +637,8 @@ static u8 * hostapd_gen_probe_resp(struc
pos = hostapd_eid_mbo(hapd, pos, (u8 *) resp + buflen - pos);
pos = hostapd_eid_owe_trans(hapd, pos, (u8 *) resp + buflen - pos);
pos = hostapd_eid_dpp_cc(hapd, pos, (u8 *) resp + buflen - pos);
+ if (hapd->conf->rnr_beacon)
+ pos = hostapd_eid_reduced_neighbor_report(hapd, pos, 1);
if (hapd->conf->vendor_elements) {
os_memcpy(pos, wpabuf_head(hapd->conf->vendor_elements),
@@ -1207,6 +1211,8 @@ int ieee802_11_build_ap_params(struct ho
tail_len += hostapd_mbo_ie_len(hapd);
tail_len += hostapd_eid_owe_trans_len(hapd);
tail_len += hostapd_eid_dpp_cc_len(hapd);
+ if (hapd->conf->rnr_beacon)
+ tail_len += hostapd_eid_reduced_neighbor_report_len(hapd, 0);
tailpos = tail = os_malloc(tail_len);
if (head == NULL || tail == NULL) {
@@ -1382,6 +1388,8 @@ int ieee802_11_build_ap_params(struct ho
tailpos = hostapd_eid_owe_trans(hapd, tailpos,
tail + tail_len - tailpos);
tailpos = hostapd_eid_dpp_cc(hapd, tailpos, tail + tail_len - tailpos);
+ if (hapd->conf->rnr_beacon)
+ tailpos = hostapd_eid_reduced_neighbor_report(hapd, tailpos, 1);
if (hapd->conf->vendor_elements) {
os_memcpy(tailpos, wpabuf_head(hapd->conf->vendor_elements),
Index: hostapd-2020-07-02-58b384f4/src/ap/ieee802_11.c
===================================================================
--- hostapd-2020-07-02-58b384f4.orig/src/ap/ieee802_11.c
+++ hostapd-2020-07-02-58b384f4/src/ap/ieee802_11.c
@@ -5773,4 +5773,140 @@ u8 * hostapd_eid_multiple_bssid(struct h
return eid;
}
+
+size_t hostapd_eid_reduced_neighbor_report_len(struct hostapd_data *hapd, bool probe_resp)
+{
+ size_t len = 0;
+ int i;
+
+ if (hapd->iface->num_bss > 1)
+ len += TBTT_HEADER_LENGTH + ((hapd->iface->num_bss - 1) * TBTT_INFO_LENGTH);
+ for (i = 0; i < hapd->iface->interfaces->count; i++) {
+ struct hostapd_iface *iface = hapd->iface->interfaces->iface[i];
+
+ if (iface == hapd->iface || !iface->conf->he_co_locate)
+ continue;
+
+ len += TBTT_HEADER_LENGTH + (iface->num_bss * TBTT_INFO_LENGTH);
+ }
+
+ if (!probe_resp && !dl_list_empty(&hapd->nr_db))
+ len += dl_list_len(&hapd->nr_db) * (TBTT_HEADER_LENGTH + TBTT_INFO_LENGTH);
+
+ return len;
+}
+
+
+static u8 *hostapd_eid_reduced_neighbor_report_iface(struct hostapd_data *hapd, u8 *eid, int *count)
+{
+ int tbtt_count = hapd->iface->num_bss;
+ u8 op_class, channel;
+ int i;
+
+ if (!(hapd->iface->drv_flags & WPA_DRIVER_FLAGS_AP_CSA) ||
+ !hapd->iface->freq)
+ return eid;
+
+ if (ieee80211_freq_to_channel_ext(hapd->iface->freq,
+ hapd->iconf->secondary_channel,
+ hostapd_get_oper_chwidth(hapd->iconf),
+ &op_class, &channel) ==
+ NUM_HOSTAPD_MODES)
+ return eid;
+
+ if (hapd->iface->conf->he_co_locate)
+ tbtt_count -= 1;
+ else
+ tbtt_count -= 2;
+
+ *eid++ = TBTT_INFO_COUNT(tbtt_count);
+ *eid++ = TBTT_INFO_LENGTH;
+ *eid++ = op_class;
+ *eid++ = hapd->iconf->channel;
+ for (i = 0; i < hapd->iface->num_bss; i++) {
+ u8 bss_param = 0;
+
+ if (hapd->iface->bss[i] == hapd && !hapd->iface->conf->he_co_locate)
+ continue;
+ *eid++ = TBTT_AP_OFFSET_UNKNOWN;
+ os_memcpy(eid, hapd->iface->bss[i]->own_addr, ETH_ALEN);
+ eid += 6;
+ os_memcpy(eid, &hapd->iface->bss[i]->conf->ssid.short_ssid, 4);
+ eid += 4;
+ if (hapd->iface->bss[i]->conf->ssid.short_ssid ==
+ hapd->conf->ssid.short_ssid)
+ bss_param |= TBTT_BSS_PARAM_SAME_SSID;
+ if (hapd->iconf->multiple_bssid)
+ bss_param |= TBTT_BSS_PARAM_MULTIPLE_BSSID;
+ if (!i && hapd->iconf->multiple_bssid && hapd->iface->conf->he_co_locate)
+ bss_param |= TBTT_BSS_PARAM_TRANSMITTED_BSSID;
+ if (hapd->iface->conf->he_co_locate)
+ bss_param |= TBTT_BSS_PARAM_CO_LOCATED;
+
+ *eid++ = bss_param;
+ *count += 1;
+ }
+
+ return eid;
+}
+
+
+static u8 *hostapd_eid_reduced_neighbor_report_nr_db(struct hostapd_data *hapd, u8 *eid, int *count)
+{
+ struct hostapd_neighbor_entry *nr;
+
+ dl_list_for_each(nr, &hapd->nr_db, struct hostapd_neighbor_entry,
+ list) {
+ if (!nr->nr || wpabuf_len(nr->nr) < 12)
+ continue;
+ if (nr->short_ssid == hapd->conf->ssid.short_ssid)
+ continue;
+ *eid++ = 0;
+ *eid++ = TBTT_INFO_LENGTH;
+ *eid++ = wpabuf_head_u8(nr->nr)[10];
+ *eid++ = wpabuf_head_u8(nr->nr)[11];
+ *eid++ = TBTT_AP_OFFSET_UNKNOWN;
+ os_memcpy(eid, nr->bssid, ETH_ALEN);
+ eid += 6;
+ os_memcpy(eid, &nr->short_ssid, 4);
+ eid += 4;
+ *eid++ = nr->bss_parameters;
+ *count += 1;
+ }
+
+ return eid;
+}
+
+u8 * hostapd_eid_reduced_neighbor_report(struct hostapd_data *hapd, u8 *eid, bool probe_resp)
+{
+ size_t len = hostapd_eid_reduced_neighbor_report_len(hapd, probe_resp);
+ int i, count = 0;
+
+ if (!len)
+ return eid;
+
+ *eid++ = WLAN_EID_REDUCED_NEIGHBOR_REPORT;
+ *eid++ = len;
+
+ if (hapd->iface->num_bss > 1)
+ eid = hostapd_eid_reduced_neighbor_report_iface(hapd, eid, &count);
+
+ for (i = 0; i < hapd->iface->interfaces->count; i++) {
+ struct hostapd_iface *iface = hapd->iface->interfaces->iface[i];
+
+ if (iface == hapd->iface || !iface->conf->he_co_locate)
+ continue;
+
+ eid = hostapd_eid_reduced_neighbor_report_iface(iface->bss[0], eid, &count);
+ }
+
+ if (!probe_resp)
+ hostapd_eid_reduced_neighbor_report_nr_db(hapd, eid, &count);
+
+ if (!count)
+ eid -= 2;
+
+ return eid;
+}
+
#endif /* CONFIG_NATIVE_WINDOWS */
Index: hostapd-2020-07-02-58b384f4/src/ap/ieee802_11.h
===================================================================
--- hostapd-2020-07-02-58b384f4.orig/src/ap/ieee802_11.h
+++ hostapd-2020-07-02-58b384f4/src/ap/ieee802_11.h
@@ -124,6 +124,8 @@ u8 * hostapd_eid_multiple_bssid(struct h
u8 is_beacon, u8 **eid_offsets, int *eid_count,
int eid_max);
int hostapd_eid_multiple_bssid_len(struct hostapd_data *hapd);
+u8 * hostapd_eid_reduced_neighbor_report(struct hostapd_data *hapd, u8 *eid, bool probe_resp);
+size_t hostapd_eid_reduced_neighbor_report_len(struct hostapd_data *hapd, bool probe_resp);
int auth_sae_init_committed(struct hostapd_data *hapd, struct sta_info *sta);
#ifdef CONFIG_SAE
Index: hostapd-2020-07-02-58b384f4/src/common/ieee802_11_defs.h
===================================================================
--- hostapd-2020-07-02-58b384f4.orig/src/common/ieee802_11_defs.h
+++ hostapd-2020-07-02-58b384f4/src/common/ieee802_11_defs.h
@@ -2352,4 +2352,18 @@ enum edmg_bw_config {
*/
#define DOT11BSS_COLOR_COLLISION_AP_PERIOD 50
+/* TBTT Information field defines */
+#define TBTT_HEADER_LENGTH 4
+#define TBTT_INFO_LENGTH 12
+#define TBTT_INFO_FILTERED_NEIGH_AP BIT(2)
+#define TBTT_INFO_COUNT(x) (((x) & 0xf) << 4)
+#define TBTT_AP_OFFSET_UNKNOWN 255
+#define TBTT_BSS_PARAM_OCT_RECOMMENDED BIT(0)
+#define TBTT_BSS_PARAM_SAME_SSID BIT(1)
+#define TBTT_BSS_PARAM_MULTIPLE_BSSID BIT(2)
+#define TBTT_BSS_PARAM_TRANSMITTED_BSSID BIT(3)
+#define TBTT_BSS_PARAM_MEMBER_CO_LOCATED_ESS BIT(4)
+#define TBTT_BSS_PARAM_20_TU_PROBE_RESP_ACTIVE BIT(5)
+#define TBTT_BSS_PARAM_CO_LOCATED BIT(6)
+
#endif /* IEEE802_11_DEFS_H */

View File

@@ -1,18 +0,0 @@
--- a/src/ap/ctrl_iface_ap.c
+++ b/src/ap/ctrl_iface_ap.c
@@ -739,6 +739,7 @@ int hostapd_ctrl_iface_status(struct hos
"secondary_channel=%d\n"
"ieee80211n=%d\n"
"ieee80211ac=%d\n"
+ "ieee80211ad=%d\n"
"ieee80211ax=%d\n"
"beacon_int=%u\n"
"dtim_period=%d\n",
@@ -750,6 +751,7 @@ int hostapd_ctrl_iface_status(struct hos
iface->conf->ieee80211n && !hapd->conf->disable_11n,
iface->conf->ieee80211ac &&
!hapd->conf->disable_11ac,
+ iface->conf->hw_mode == HOSTAPD_MODE_IEEE80211AD,
iface->conf->ieee80211ax,
iface->conf->beacon_int,
hapd->conf->dtim_period);

View File

@@ -1,62 +0,0 @@
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
@@ -3125,6 +3125,26 @@ static int hostapd_ctrl_iface_remove_nei
return hostapd_neighbor_remove(hapd, bssid, ssidp);
}
+static int hostapd_ctrl_iface_signal_monitor(struct hostapd_data *hapd,
+ char *cmd)
+{
+ const char *pos;
+ int threshold = 0, hysteresis = 0;
+
+ pos = os_strstr(cmd, "THRESHOLD=");
+ if (pos)
+ threshold = atoi(pos + 10);
+ pos = os_strstr(cmd, "HYSTERESIS=");
+ if (pos)
+ hysteresis = atoi(pos + 11);
+
+ if (hapd->driver->signal_monitor)
+ return hapd->driver->signal_monitor(hapd->drv_priv,
+ threshold, hysteresis);
+
+ return -1;
+}
+
static int hostapd_ctrl_driver_flags(struct hostapd_iface *iface, char *buf,
size_t buflen)
@@ -3768,6 +3788,9 @@ static int hostapd_ctrl_iface_receive_pr
if (radius_server_dac_request(hapd->radius_srv, buf + 12) < 0)
reply_len = -1;
#endif /* RADIUS_SERVER */
+ } else if (os_strncmp(buf, "SIGNAL_MONITOR", 14) == 0) {
+ if (hostapd_ctrl_iface_signal_monitor(hapd, buf + 14))
+ reply_len = -1;
} else if (os_strncmp(buf, "GET_CAPABILITY ", 15) == 0) {
reply_len = hostapd_ctrl_iface_get_capability(
hapd, buf + 15, reply, reply_size);
--- a/hostapd/hostapd_cli.c
+++ b/hostapd/hostapd_cli.c
@@ -1478,6 +1478,11 @@ static int hostapd_cli_cmd_deny_macacl(s
return hostapd_cli_cmd(ctrl, "DENY_ACL", 1, argc, argv);
}
+static int hostapd_cli_cmd_signal_monitor(struct wpa_ctrl *ctrl, int argc,
+ char *argv[])
+{
+ return hostapd_cli_cmd(ctrl, "SIGNAL_MONITOR", 0, argc, argv);
+}
static int hostapd_cli_cmd_poll_sta(struct wpa_ctrl *ctrl, int argc,
char *argv[])
@@ -1673,6 +1678,8 @@ static const struct hostapd_cli_cmd host
"=Add/Delete/Show/Clear deny MAC ACL" },
{ "poll_sta", hostapd_cli_cmd_poll_sta, hostapd_complete_stations,
"<addr> = poll a STA to check connectivity with a QoS null frame" },
+ { "signal_monitor", hostapd_cli_cmd_signal_monitor, NULL,
+ "= set signal monitor parameters" },
{ "req_beacon", hostapd_cli_cmd_req_beacon, NULL,
"<addr> [req_mode=] <measurement request hexdump> = send a Beacon report request to a station" },
{ "reload_wpa_psk", hostapd_cli_cmd_reload_wpa_psk, NULL,

View File

@@ -1,47 +0,0 @@
--- a/src/drivers/driver_nl80211_event.c
+++ b/src/drivers/driver_nl80211_event.c
@@ -1273,12 +1273,14 @@ static void nl80211_cqm_event(struct wpa
[NL80211_ATTR_CQM_TXE_PKTS] = { .type = NLA_U32 },
[NL80211_ATTR_CQM_TXE_INTVL] = { .type = NLA_U32 },
[NL80211_ATTR_CQM_BEACON_LOSS_EVENT] = { .type = NLA_FLAG },
+ [NL80211_ATTR_CQM_RSSI_LEVEL] = { .type = NLA_U32 },
};
struct nlattr *cqm[NL80211_ATTR_CQM_MAX + 1];
enum nl80211_cqm_rssi_threshold_event event;
union wpa_event_data ed;
struct wpa_signal_info sig;
- int res;
+ int res, rssi_level;
+ u8 *addr = NULL;
if (tb[NL80211_ATTR_CQM] == NULL ||
nla_parse_nested(cqm, NL80211_ATTR_CQM_MAX, tb[NL80211_ATTR_CQM],
@@ -1329,11 +1331,28 @@ static void nl80211_cqm_event(struct wpa
}
event = nla_get_u32(cqm[NL80211_ATTR_CQM_RSSI_THRESHOLD_EVENT]);
+ if (tb[NL80211_ATTR_MAC])
+ addr = nla_data(tb[NL80211_ATTR_MAC]);
+
+ rssi_level = (s32) nla_get_u32(cqm[NL80211_ATTR_CQM_RSSI_LEVEL]);
+
if (event == NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH) {
+ if (addr) {
+ wpa_msg(drv->ctx, MSG_INFO, "nl80211: CQM RSSI HIGH "
+ "event for "MACSTR " RSSI :%d", MAC2STR(addr),
+ rssi_level);
+ return;
+ }
wpa_printf(MSG_DEBUG, "nl80211: Connection quality monitor "
"event: RSSI high");
ed.signal_change.above_threshold = 1;
} else if (event == NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW) {
+ if (addr) {
+ wpa_msg(drv->ctx, MSG_INFO, "nl80211: CQM RSSI LOW "
+ "event for "MACSTR " RSSI :%d", MAC2STR(addr),
+ rssi_level);
+ return;
+ }
wpa_printf(MSG_DEBUG, "nl80211: Connection quality monitor "
"event: RSSI low");
ed.signal_change.above_threshold = 0;

View File

@@ -1,262 +0,0 @@
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
@@ -3145,6 +3145,25 @@ static int hostapd_ctrl_iface_signal_mon
return -1;
}
+static int hostapd_ctrl_iface_signal_txrate(struct hostapd_data *hapd,
+ char *cmd)
+{
+ char *pos;
+ unsigned int low_thold = 0, high_thold = 0;
+
+ pos = os_strstr(cmd, "LOW=");
+ if (pos)
+ low_thold = atoi(pos + 4);
+
+ pos = os_strstr(cmd, "HIGH=");
+ if (pos)
+ high_thold = atoi(pos + 5);
+
+ if (hapd->driver->signal_txrate)
+ return hapd->driver->signal_txrate(hapd->drv_priv, low_thold,
+ high_thold);
+ return -1;
+}
static int hostapd_ctrl_driver_flags(struct hostapd_iface *iface, char *buf,
size_t buflen)
@@ -3791,6 +3810,9 @@ static int hostapd_ctrl_iface_receive_pr
} else if (os_strncmp(buf, "SIGNAL_MONITOR", 14) == 0) {
if (hostapd_ctrl_iface_signal_monitor(hapd, buf + 14))
reply_len = -1;
+ } else if (os_strncmp(buf, "SIGNAL_TXRATE", 13) == 0) {
+ if (hostapd_ctrl_iface_signal_txrate(hapd, buf + 13))
+ reply_len = -1;
} else if (os_strncmp(buf, "GET_CAPABILITY ", 15) == 0) {
reply_len = hostapd_ctrl_iface_get_capability(
hapd, buf + 15, reply, reply_size);
--- a/hostapd/hostapd_cli.c
+++ b/hostapd/hostapd_cli.c
@@ -1505,6 +1505,12 @@ static int hostapd_cli_cmd_reload_wpa_ps
}
+static int hostapd_cli_cmd_signal_txrate(struct wpa_ctrl *ctrl, int argc,
+ char *argv[])
+{
+ return hostapd_cli_cmd(ctrl, "SIGNAL_TXRATE", 0, argc, argv);
+}
+
struct hostapd_cli_cmd {
const char *cmd;
int (*handler)(struct wpa_ctrl *ctrl, int argc, char *argv[]);
@@ -1680,6 +1686,9 @@ static const struct hostapd_cli_cmd host
"<addr> = poll a STA to check connectivity with a QoS null frame" },
{ "signal_monitor", hostapd_cli_cmd_signal_monitor, NULL,
"= set signal monitor parameters" },
+ { "signal_txrate", hostapd_cli_cmd_signal_txrate, NULL,
+ "= set signal tx rate parameters: signal_txrate "
+ "LOW=<> HIGH=<>" },
{ "req_beacon", hostapd_cli_cmd_req_beacon, NULL,
"<addr> [req_mode=] <measurement request hexdump> = send a Beacon report request to a station" },
{ "reload_wpa_psk", hostapd_cli_cmd_reload_wpa_psk, NULL,
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -4412,6 +4412,20 @@ struct wpa_driver_ops {
*/
int (*get_peer_inactive_time)(void *priv, const u8 *addr);
+ /**
+ * signal_txrate - Set signal monitoring parameters
+ * @priv: Private driver interface data
+ * @low_thold: Low threshold value for signal txrate events; 0 = disabled
+ * @high_thold: High threshold value for signal txrate events; 0 = disabled
+ * Returns: 0 on success, -1 on failure (or if not supported)
+ *
+ * This function can be used to configure monitoring of signal tx rate
+ * with the current AP. Whenever txrate drops below the low_thold
+ * or increases above high_thold.
+ */
+ int (*signal_txrate)(void *priv, const u32 low_thold,
+ u32 high_thold);
+
/**
* update_connect_params - Update the connection parameters
* @priv: Private driver interface data
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -8268,6 +8268,29 @@ static int nl80211_signal_monitor(void *
return send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL);
}
+static int nl80211_signal_txrate(void *priv, const u32 low_thold,
+ u32 high_thold)
+{
+ struct i802_bss *bss = priv;
+ struct wpa_driver_nl80211_data *drv = bss->drv;
+ struct nl_msg *msg;
+ struct nlattr *cqm;
+
+ if (!(msg = nl80211_bss_msg(bss, 0, NL80211_CMD_SET_CQM)) ||
+ !(cqm = nla_nest_start(msg, NL80211_ATTR_CQM)) ||
+ nla_put_u32(msg, NL80211_ATTR_CQM_LOW_TX_RATE_THOLD,
+ low_thold) ||
+ nla_put_u32(msg, NL80211_ATTR_CQM_HIGH_TX_RATE_THOLD,
+ high_thold)) {
+ nlmsg_free(msg);
+ wpa_printf(MSG_WARNING, "nl80211: Signal txrate returning");
+ return -1;
+ }
+
+ nla_nest_end(msg, cqm);
+
+ return send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL);
+}
static int get_channel_width(struct nl_msg *msg, void *arg)
{
@@ -11725,6 +11748,7 @@ const struct wpa_driver_ops wpa_driver_n
.deinit_p2p_cli = wpa_driver_nl80211_deinit_p2p_cli,
.resume = wpa_driver_nl80211_resume,
.signal_monitor = nl80211_signal_monitor,
+ .signal_txrate = nl80211_signal_txrate,
.signal_poll = nl80211_signal_poll,
.channel_info = nl80211_channel_info,
.set_param = nl80211_set_param,
--- a/src/drivers/driver_nl80211_event.c
+++ b/src/drivers/driver_nl80211_event.c
@@ -1274,12 +1274,15 @@ static void nl80211_cqm_event(struct wpa
[NL80211_ATTR_CQM_TXE_INTVL] = { .type = NLA_U32 },
[NL80211_ATTR_CQM_BEACON_LOSS_EVENT] = { .type = NLA_FLAG },
[NL80211_ATTR_CQM_RSSI_LEVEL] = { .type = NLA_U32 },
+ [NL80211_ATTR_CQM_TX_RATE_THRESHOLD_EVENT] =
+ { .type = NLA_U32 },
};
struct nlattr *cqm[NL80211_ATTR_CQM_MAX + 1];
- enum nl80211_cqm_rssi_threshold_event event;
+ enum nl80211_cqm_rssi_threshold_event rssi_event;
+ enum nl80211_cqm_tx_rate_threshold_event txrate_event;
union wpa_event_data ed;
struct wpa_signal_info sig;
- int res, rssi_level;
+ int res, rssi_level, txrate_level;
u8 *addr = NULL;
if (tb[NL80211_ATTR_CQM] == NULL ||
@@ -1324,19 +1327,41 @@ static void nl80211_cqm_event(struct wpa
return;
}
+ if (tb[NL80211_ATTR_MAC])
+ addr = nla_data(tb[NL80211_ATTR_MAC]);
+
+ if (cqm[NL80211_ATTR_CQM_TX_RATE_THRESHOLD_EVENT]) {
+ txrate_event =
+ nla_get_u32(cqm[NL80211_ATTR_CQM_TX_RATE_THRESHOLD_EVENT]);
+ txrate_level =
+ nla_get_u32(cqm[NL80211_ATTR_CQM_TX_RATE_LEVEL]);
+
+ if (txrate_event == NL80211_CQM_TX_RATE_THRESHOLD_EVENT_HIGH) {
+ wpa_msg(drv->ctx, MSG_INFO, "nl80211: CQM TXRATE HIGH "
+ "event for "MACSTR " txrate :%d",
+ MAC2STR(addr), txrate_level);
+ } else if (txrate_event ==
+ NL80211_CQM_TX_RATE_THRESHOLD_EVENT_LOW) {
+ wpa_msg(drv->ctx, MSG_INFO, "nl80211: CQM TXRATE LOW "
+ "event for "MACSTR " txrate :%d",
+ MAC2STR(addr), txrate_level);
+ } else {
+ wpa_msg(drv->ctx, MSG_INFO, "Unknown CQM TXRATE "
+ " threshold event :%d", txrate_event);
+ return;
+ }
+ }
+
if (cqm[NL80211_ATTR_CQM_RSSI_THRESHOLD_EVENT] == NULL) {
wpa_printf(MSG_DEBUG,
"nl80211: Not a CQM RSSI threshold event");
return;
}
- event = nla_get_u32(cqm[NL80211_ATTR_CQM_RSSI_THRESHOLD_EVENT]);
-
- if (tb[NL80211_ATTR_MAC])
- addr = nla_data(tb[NL80211_ATTR_MAC]);
+ rssi_event = nla_get_u32(cqm[NL80211_ATTR_CQM_RSSI_THRESHOLD_EVENT]);
rssi_level = (s32) nla_get_u32(cqm[NL80211_ATTR_CQM_RSSI_LEVEL]);
- if (event == NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH) {
+ if (rssi_event == NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH) {
if (addr) {
wpa_msg(drv->ctx, MSG_INFO, "nl80211: CQM RSSI HIGH "
"event for "MACSTR " RSSI :%d", MAC2STR(addr),
@@ -1346,7 +1371,7 @@ static void nl80211_cqm_event(struct wpa
wpa_printf(MSG_DEBUG, "nl80211: Connection quality monitor "
"event: RSSI high");
ed.signal_change.above_threshold = 1;
- } else if (event == NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW) {
+ } else if (rssi_event == NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW) {
if (addr) {
wpa_msg(drv->ctx, MSG_INFO, "nl80211: CQM RSSI LOW "
"event for "MACSTR " RSSI :%d", MAC2STR(addr),
@@ -1359,7 +1384,7 @@ static void nl80211_cqm_event(struct wpa
} else {
wpa_printf(MSG_DEBUG,
"nl80211: Unknown CQM RSSI threshold event: %d",
- event);
+ rssi_event);
return;
}
--- a/src/drivers/nl80211_copy.h
+++ b/src/drivers/nl80211_copy.h
@@ -4792,6 +4792,17 @@ enum nl80211_ps_state {
* loss event
* @NL80211_ATTR_CQM_RSSI_LEVEL: the RSSI value in dBm that triggered the
* RSSI threshold event.
+ * @NL80211_ATTR_CQM_LOW_TX_RATE_THOLD: TX_RATE threshold in Kbps. This value
+ * specifies the low threshold for the TX_RATE level at which an event will be
+ * sent. Zero to disable. Events will be sent when the TX_RATE value goes
+ * lesser than this threshold.
+ * @NL80211_ATTR_CQM_HIGH_TX_RATE_THOLD: TX RATE in Kbps. This value
+ * specifies the high threshold for the TX_RATE level at which an event will
+ * be sent. Zero to diable. Event will be sent when the TX_RATE values goes
+ * greater than this threshold.
+ * @NL80211_ATTR_CQM_TX_RATE_THRESHOLD_EVENT: TX_RATE threshold event
+ * @NL80211_ATTR_CQM_TX_RATE_LEVEL: the tx rate value in Kbps that triggered the
+ * TX_RATE threshold event.
* @__NL80211_ATTR_CQM_AFTER_LAST: internal
* @NL80211_ATTR_CQM_MAX: highest key attribute
*/
@@ -4806,7 +4817,10 @@ enum nl80211_attr_cqm {
NL80211_ATTR_CQM_TXE_INTVL,
NL80211_ATTR_CQM_BEACON_LOSS_EVENT,
NL80211_ATTR_CQM_RSSI_LEVEL,
-
+ NL80211_ATTR_CQM_LOW_TX_RATE_THOLD,
+ NL80211_ATTR_CQM_HIGH_TX_RATE_THOLD,
+ NL80211_ATTR_CQM_TX_RATE_THRESHOLD_EVENT,
+ NL80211_ATTR_CQM_TX_RATE_LEVEL,
/* keep last */
__NL80211_ATTR_CQM_AFTER_LAST,
NL80211_ATTR_CQM_MAX = __NL80211_ATTR_CQM_AFTER_LAST - 1
@@ -4820,13 +4834,17 @@ enum nl80211_attr_cqm {
* configured threshold
* @NL80211_CQM_RSSI_BEACON_LOSS_EVENT: (reserved, never sent)
*/
+
enum nl80211_cqm_rssi_threshold_event {
NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW,
NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH,
NL80211_CQM_RSSI_BEACON_LOSS_EVENT,
};
-
+enum nl80211_cqm_tx_rate_threshold_event {
+ NL80211_CQM_TX_RATE_THRESHOLD_EVENT_LOW = 1,
+ NL80211_CQM_TX_RATE_THRESHOLD_EVENT_HIGH,
+};
/**
* enum nl80211_tx_power_setting - TX power adjustment
* @NL80211_TX_POWER_AUTOMATIC: automatically determine transmit power

View File

@@ -93,10 +93,10 @@
static int hostapd_ctrl_iface_remove_neighbor(struct hostapd_data *hapd,
char *buf)
@@ -3813,6 +3899,10 @@ static int hostapd_ctrl_iface_receive_pr
} else if (os_strncmp(buf, "SIGNAL_TXRATE", 13) == 0) {
if (hostapd_ctrl_iface_signal_txrate(hapd, buf + 13))
@@ -3768,6 +3854,10 @@ static int hostapd_ctrl_iface_receive_pr
if (radius_server_dac_request(hapd->radius_srv, buf + 12) < 0)
reply_len = -1;
#endif /* RADIUS_SERVER */
+ } else if (os_strcmp(buf, "HT40_ALLOW_MAP") == 0) {
+ reply_len = hostapd_ctrl_iface_ht40_allow_map(hapd->iface,
+ reply,
@@ -119,10 +119,10 @@
#ifdef CONFIG_DPP
@@ -1689,6 +1695,8 @@ static const struct hostapd_cli_cmd host
{ "signal_txrate", hostapd_cli_cmd_signal_txrate, NULL,
"= set signal tx rate parameters: signal_txrate "
"LOW=<> HIGH=<>" },
@@ -1673,6 +1679,8 @@ static const struct hostapd_cli_cmd host
"=Add/Delete/Show/Clear deny MAC ACL" },
{ "poll_sta", hostapd_cli_cmd_poll_sta, hostapd_complete_stations,
"<addr> = poll a STA to check connectivity with a QoS null frame" },
+ { "ht40_allow_map", hostapd_cli_cmd_ht40_allow_map, NULL,
+ "= show ht40 allow map status" },
{ "req_beacon", hostapd_cli_cmd_req_beacon, NULL,

View File

@@ -13,7 +13,7 @@ Signed-off-by: Miles Hu <milehu@codeaurora.org>
--- a/src/ap/hw_features.c
+++ b/src/ap/hw_features.c
@@ -660,8 +660,59 @@ static int ieee80211ac_supported_vht_cap
@@ -660,8 +660,63 @@ static int ieee80211ac_supported_vht_cap
#ifdef CONFIG_IEEE80211AX
@@ -60,7 +60,11 @@ Signed-off-by: Miles Hu <milehu@codeaurora.org>
+ HE_PHYCAP_MU_BEAMFORMER_CAPAB_IDX,
+ conf->he_phy_capab.he_mu_beamformer);
+ HE_CAP_CHECK(hw->phy_cap, HE_PHYCAP_SPR_SR_CAPB,
+ HE_PHYCAP_SPR_SR_CAPB_IDX, conf->spr.sr_control);
+ HE_PHYCAP_SPR_SR_CAPB_IDX,
+ (!(conf->spr.sr_control & SPATIAL_REUSE_SRP_DISALLOWED) &&
+ (conf->spr.sr_control &
+ (SPATIAL_REUSE_NON_SRG_OFFSET_PRESENT |
+ SPATIAL_REUSE_SRG_INFORMATION_PRESENT))));
+
+ HE_CAP_CHECK2(hw->phy_cap, HE_PHYCAP_UL_MUMIMO_CAPB,
+ HE_PHYCAP_UL_MUMIMO_CAPB_IDX, HE_PHYCAP_UL_MUOFDMA_CAPB,

View File

@@ -169,30 +169,6 @@
int hostapd_switch_channel(struct hostapd_data *hapd,
struct csa_settings *settings);
void
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -580,6 +580,10 @@ static u8 * hostapd_gen_probe_resp(struc
}
#endif /* CONFIG_IEEE80211AX */
+ if ((hapd->iconf->ieee80211ac && !hapd->conf->disable_11ac) ||
+ hapd->iconf->ieee80211ax)
+ pos = hostapd_eid_wb_chsw_wrapper(hapd, pos);
+
#ifdef CONFIG_IEEE80211AC
if (hapd->conf->vendor_vht)
pos = hostapd_eid_vendor_vht(hapd, pos);
@@ -1317,6 +1321,10 @@ int ieee802_11_build_ap_params(struct ho
}
#endif /* CONFIG_IEEE80211AX */
+ if ((hapd->iconf->ieee80211ac && !hapd->conf->disable_11ac) ||
+ hapd->iconf->ieee80211ax)
+ tailpos = hostapd_eid_wb_chsw_wrapper(hapd, tailpos);
+
#ifdef CONFIG_IEEE80211AC
if (hapd->conf->vendor_vht)
tailpos = hostapd_eid_vendor_vht(hapd, tailpos);
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -4672,7 +4672,7 @@ static int nl80211_put_freq_params(struc

View File

@@ -65,6 +65,31 @@ Index: hostapd-2020-07-02-58b384f4/wpa_supplicant/wpa_supplicant.c
===================================================================
--- hostapd-2020-07-02-58b384f4.orig/wpa_supplicant/wpa_supplicant.c
+++ hostapd-2020-07-02-58b384f4/wpa_supplicant/wpa_supplicant.c
@@ -2480,17 +2480,17 @@ void ibss_mesh_setup_freq(struct wpa_sup
return;
/* Allow HE on 2.4 GHz without VHT: see nl80211_put_freq_params() */
+#ifdef CONFIG_HE_OVERRIDES
+ if (is_24ghz) {
+ if (ssid->disable_he)
+ freq->he_enabled = 0;
+ else
+ freq->he_enabled = mode->he_capab[ieee80211_mode].he_supported;
+#else
if (is_24ghz)
freq->he_enabled = mode->he_capab[ieee80211_mode].he_supported;
-#ifdef CONFIG_HE_OVERRIDES
- if (is_24ghz && ssid->disable_he)
- freq->he_enabled = 0;
#endif /* CONFIG_HE_OVERRIDES */
- /* Setup higher BW only for 5 GHz */
- if (mode->mode != HOSTAPD_MODE_IEEE80211A && !(ssid->noscan))
- return;
-
for (chan_idx = 0; chan_idx < mode->num_channels; chan_idx++) {
pri_chan = &mode->channels[chan_idx];
if (pri_chan->chan == channel)
@@ -2585,6 +2585,11 @@ void ibss_mesh_setup_freq(struct wpa_sup
wpa_scan_results_free(scan_res);

View File

@@ -1,39 +1,31 @@
Index: hostapd-2020-07-02-58b384f4/hostapd/config_file.c
===================================================================
--- hostapd-2020-07-02-58b384f4.orig/hostapd/config_file.c
+++ hostapd-2020-07-02-58b384f4/hostapd/config_file.c
@@ -3455,6 +3455,8 @@ static int hostapd_config_fill(struct ho
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -3444,6 +3444,8 @@ static int hostapd_config_fill(struct ho
conf->he_phy_capab.he_su_beamformee = atoi(pos);
} else if (os_strcmp(buf, "he_mu_beamformer") == 0) {
conf->he_phy_capab.he_mu_beamformer = atoi(pos);
+ } else if (os_strcmp(buf, "he_ul_mumimo") == 0) {
+ conf->he_phy_capab.he_ul_mumimo = atoi(pos);
} else if (os_strcmp(buf, "he_bss_color") == 0) {
conf->he_op.he_bss_color = atoi(pos);
if (conf->he_op.he_bss_color > 63)
Index: hostapd-2020-07-02-58b384f4/hostapd/hostapd.conf
===================================================================
--- hostapd-2020-07-02-58b384f4.orig/hostapd/hostapd.conf
+++ hostapd-2020-07-02-58b384f4/hostapd/hostapd.conf
@@ -801,7 +801,13 @@ wmm_ac_vo_acm=0
conf->he_op.he_bss_color = atoi(pos) & 0x3f;
conf->he_op.he_bss_color_disabled = 0;
--- a/hostapd/hostapd.conf
+++ b/hostapd/hostapd.conf
@@ -801,6 +801,12 @@ wmm_ac_vo_acm=0
# 1 = supported
#he_mu_beamformer=1
-# he_bss_color:
+#he_ul_mumimo: HE Uplink multiple user MIMO support
+# -1 or unspecified = Decided by firmware or underlying hardware(Default)
+# 0 = not supported
+# 1 = supported
+#he_mu_beamformer=1
+
+ # he_bss_color:
# 0 = disable
# 1-63 = pre-defined color
# 64+ = random color
Index: hostapd-2020-07-02-58b384f4/src/ap/ap_config.c
===================================================================
--- hostapd-2020-07-02-58b384f4.orig/src/ap/ap_config.c
+++ hostapd-2020-07-02-58b384f4/src/ap/ap_config.c
# he_bss_color: BSS color (1-63)
#he_bss_color=1
--- a/src/ap/ap_config.c
+++ b/src/ap/ap_config.c
@@ -265,6 +265,8 @@ struct hostapd_config * hostapd_config_d
HE_OPERATION_RTS_THRESHOLD_OFFSET;
/* Set default basic MCS/NSS set to single stream MCS 0-7 */
@@ -43,11 +35,9 @@ Index: hostapd-2020-07-02-58b384f4/src/ap/ap_config.c
conf->he_op.he_bss_color_disabled = 1;
conf->he_op.he_bss_color_partial = 0;
conf->he_op.he_bss_color = 1;
Index: hostapd-2020-07-02-58b384f4/src/ap/ap_config.h
===================================================================
--- hostapd-2020-07-02-58b384f4.orig/src/ap/ap_config.h
+++ hostapd-2020-07-02-58b384f4/src/ap/ap_config.h
@@ -878,6 +878,7 @@ struct he_phy_capabilities_info {
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -874,6 +874,7 @@ struct he_phy_capabilities_info {
bool he_su_beamformer;
bool he_su_beamformee;
bool he_mu_beamformer;
@@ -55,10 +45,8 @@ Index: hostapd-2020-07-02-58b384f4/src/ap/ap_config.h
};
/**
Index: hostapd-2020-07-02-58b384f4/src/ap/hw_features.c
===================================================================
--- hostapd-2020-07-02-58b384f4.orig/src/ap/hw_features.c
+++ hostapd-2020-07-02-58b384f4/src/ap/hw_features.c
--- a/src/ap/hw_features.c
+++ b/src/ap/hw_features.c
@@ -714,9 +714,10 @@ static int ieee80211ax_supported_he_capa
HE_CAP_CHECK(hw->phy_cap, HE_PHYCAP_SPR_SR_CAPB,
HE_PHYCAP_SPR_SR_CAPB_IDX, conf->spr.sr_control);
@@ -73,10 +61,8 @@ Index: hostapd-2020-07-02-58b384f4/src/ap/hw_features.c
HE_CAP_CHECK2(hw->mac_cap, HE_MACCAP_TWT_REQUESTER, HE_MACCAP_TWT_REQUESTER_IDX,
HE_MACCAP_TWT_RESPONDER, HE_MACCAP_TWT_RESPONDER_IDX,
Index: hostapd-2020-07-02-58b384f4/src/ap/ieee802_11_he.c
===================================================================
--- hostapd-2020-07-02-58b384f4.orig/src/ap/ieee802_11_he.c
+++ hostapd-2020-07-02-58b384f4/src/ap/ieee802_11_he.c
--- a/src/ap/ieee802_11_he.c
+++ b/src/ap/ieee802_11_he.c
@@ -151,6 +151,13 @@ u8 * hostapd_eid_he_capab(struct hostapd
cap->he_phy_capab_info[HE_PHYCAP_MU_BEAMFORMER_CAPAB_IDX] &=
~HE_PHYCAP_MU_BEAMFORMER_CAPAB;

View File

@@ -1,33 +0,0 @@
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -3466,7 +3466,30 @@ static int hostapd_fill_csa_settings(str
if (!iface || !iface->freq || hapd->csa_in_progress)
return -1;
+ if (settings->freq_params.bandwidth != 20)
+ hapd->iconf->ht_capab |= HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET;
+
switch (settings->freq_params.bandwidth) {
+ case 40:
+ /* If secondary channel offset is not provided as
+ * parameter, it will default to 0. If bw is 40,
+ * secondary channel offset needs to be set to -1/1
+ * to determine if center freq PLUS or MINUS
+ */
+
+ if (!settings->freq_params.sec_channel_offset) {
+ if (settings->freq_params.center_freq1 <
+ settings->freq_params.freq)
+ hapd->cs_freq_params.sec_channel_offset = -1;
+ else
+ hapd->cs_freq_params.sec_channel_offset = 1;
+
+ settings->freq_params.sec_channel_offset =
+ hapd->cs_freq_params.sec_channel_offset;
+ }
+
+ bandwidth = CHANWIDTH_USE_HT;
+ break;
case 80:
if (settings->freq_params.center_freq2)
bandwidth = CHANWIDTH_80P80MHZ;

View File

@@ -1,22 +1,24 @@
From 3d7534f5105287759d50e68158ce77e09ae10b5b Mon Sep 17 00:00:00 2001
From ed93959f61e103703d04b85351eed7a1c4fe644b Mon Sep 17 00:00:00 2001
From: Karthikeyan Kathirvel <kathirve@codeaurora.org>
Date: Tue, 7 Jul 2020 15:48:46 +0530
Date: Fri, 28 Aug 2020 14:16:10 +0530
Subject: [PATCH] hostapd: Fixed compilation warnings
Fixed uninitalized and unused variable warnings
Below warnings are fixed
1) ../src/rsn_supp/wpa.c:2693:12: error: 'wpa_key_mgmt_suite' defined
but not used [-Werror=unused-function]
static u32 wpa_key_mgmt_suite(struct wpa_sm *sm)
2) ../src/ap/wpa_auth.c:4449:21: error: 'wpa_bool_txt' defined but not
used [-Werror=unused-function]
static const char * wpa_bool_txt(int val)
3) Uninitialized warning has been fixed
Signed-off-by: Karthikeyan Kathirvel <kathirve@codeaurora.org>
Change-Id: I9e4e4ea928aa62213243a3d74d7b10d866d0875a
---
.../hostapd/patches/600-ubus_support.patch | 7 ++---
...on-to-test-RADAR-detection-probablity-in-.patch | 16 +++++-----
.../b00-012-hostapd-handle-rssi-cross-event.patch | 6 ++--
.../b00-013-hostap-add-signal-txrate-command.patch | 34 +++++++++++-----------
.../patches/c00-004-add-HE-cross-check.patch | 3 +-
.../patches/c00-011-hostapd-add-mbo-support.patch | 2 +-
.../hostapd/patches/d00-007-fixing-warning.patch | 28 ++++++++++++++++++
7 files changed, 61 insertions(+), 35 deletions(-)
create mode 100644 package/network/services/hostapd/patches/d00-007-fixing-warning.patch
src/ap/ieee802_11.c | 2 +-
src/ap/wpa_auth.c | 4 ++++
src/rsn_supp/wpa.c | 2 +-
3 files changed, 6 insertions(+), 2 deletions(-)
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -29,3 +31,53 @@ Change-Id: I9e4e4ea928aa62213243a3d74d7b10d866d0875a
const u8 *pos;
int left, i;
struct sta_info *sta;
--- a/src/ap/wpa_auth.c
+++ b/src/ap/wpa_auth.c
@@ -4446,12 +4446,13 @@ void wpa_gtk_rekey(struct wpa_authentica
}
+#ifdef CONFIG_CTRL_IFACE_MIB
+
static const char * wpa_bool_txt(int val)
{
return val ? "TRUE" : "FALSE";
}
-#ifdef CONFIG_CTRL_IFACE_MIB
#define RSN_SUITE "%02x-%02x-%02x-%d"
#define RSN_SUITE_ARG(s) \
--- a/src/rsn_supp/wpa.c
+++ b/src/rsn_supp/wpa.c
@@ -2689,7 +2689,7 @@ out:
}
-#ifdef CONFIG_CTRL_IFACE
+#if defined(CONFIG_CTRL_IFACE) && defined(CONFIG_CTRL_IFACE_MIB)
static u32 wpa_key_mgmt_suite(struct wpa_sm *sm)
{
switch (sm->key_mgmt) {
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -4855,7 +4855,7 @@ static int wpa_driver_nl80211_sta_add(vo
if (params->he_capab) {
wpa_hexdump(MSG_DEBUG, " * he_capab",
- params->he_capab, params->he_capab_len);
+ (u8 *) params->he_capab, params->he_capab_len);
if (nla_put(msg, NL80211_ATTR_HE_CAPABILITY,
params->he_capab_len, params->he_capab))
goto fail;
--- a/src/tls/tlsv1_client_ocsp.c
+++ b/src/tls/tlsv1_client_ocsp.c
@@ -322,7 +322,7 @@ tls_process_ocsp_responses(struct tlsv1_
{
struct asn1_hdr hdr;
const u8 *pos, *end;
- enum tls_ocsp_result res;
+ enum tls_ocsp_result res = TLS_OCSP_NO_RESPONSE;
pos = resp;
end = resp + len;

View File

@@ -1,11 +1,17 @@
From 5144ba29e5687818afcfacaadb0c31575a8315e6 Mon Sep 17 00:00:00 2001
From: Pradeep Kumar Chitrapu <pradeepc@codeaurora.org>
Date: Fri, 19 Jun 2020 14:46:54 -0700
Subject: [PATCH 2/2] hostapd: fix enable 40/80mhz bandwidth in 6Ghz
Subject: [PATCH] hostapd: fix enable 40/80mhz bandwidth in 6Ghz
Currently higher bandwidths are being rejected by hostapd for 6ghz
channels due to invalid sanity check. So fix that.
Also, currently 6GHz AP is setting unicast destination address
for probe response which need to be set to broadcast address
according to spec IEEE P802.11ax/D6.1. So fix that.
Make management frame protection required as default for 6Ghz band.
Signed-off-by: Pradeep Kumar Chitrapu <pradeepc@codeaurora.org>
---
src/common/hw_features_common.c | 2 +-
@@ -27,7 +33,7 @@ Signed-off-by: Pradeep Kumar Chitrapu <pradeepc@codeaurora.org>
return -1;
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -10677,7 +10677,8 @@ static int add_acs_ch_list(struct nl_msg
@@ -10654,7 +10654,8 @@ static int add_acs_ch_list(struct nl_msg
* compatibility.
*/
if (!(freq >= 2412 && freq <= 2484) &&
@@ -57,3 +63,173 @@ Signed-off-by: Pradeep Kumar Chitrapu <pradeepc@codeaurora.org>
return 0;
if (op_class->op_class >= 81 && op_class->op_class <= 84 && !freq2)
return 0;
--- a/src/ap/acs.c
+++ b/src/ap/acs.c
@@ -372,40 +372,44 @@ acs_survey_chan_interference_factor(stru
}
-static int acs_usable_ht40_chan(const struct hostapd_channel_data *chan)
+static int acs_usable_bw40_chan(const struct hostapd_channel_data *chan)
{
- const int allowed[] = { 36, 44, 52, 60, 100, 108, 116, 124, 132, 149,
- 157, 184, 192 };
+ const int allowed[] = { 5180, 5220, 5260, 5300, 5500, 5540, 5580, 5620, 5660, 5745,
+ 5785, 5955, 5995, 6035, 6075, 6115, 6155, 6195, 6235, 6275,
+ 6315, 6355, 6395, 6435, 6475, 6515, 6555, 6595, 6635, 6675,
+ 6715, 6755, 6795, 6835, 6875, 6915, 6955, 6995, 7035, 7075 };
unsigned int i;
for (i = 0; i < ARRAY_SIZE(allowed); i++)
- if (chan->chan == allowed[i])
+ if (chan->freq == allowed[i])
return 1;
return 0;
}
-static int acs_usable_vht80_chan(const struct hostapd_channel_data *chan)
+static int acs_usable_bw80_chan(const struct hostapd_channel_data *chan)
{
- const int allowed[] = { 36, 52, 100, 116, 132, 149 };
+ const int allowed[] = { 5180, 5260, 5550, 5580, 5660, 5680, 5955, 6035, 6115,
+ 6195, 6275, 6355, 6435, 6515, 6595, 6675, 6755, 6835,
+ 6915, 6995 };
unsigned int i;
for (i = 0; i < ARRAY_SIZE(allowed); i++)
- if (chan->chan == allowed[i])
+ if (chan->freq == allowed[i])
return 1;
return 0;
}
-static int acs_usable_vht160_chan(const struct hostapd_channel_data *chan)
+static int acs_usable_bw160_chan(const struct hostapd_channel_data *chan)
{
- const int allowed[] = { 36, 100 };
+ const int allowed[] = { 5180, 5500, 5955, 6115, 6275, 6435, 6595, 6755, 6915 };
unsigned int i;
for (i = 0; i < ARRAY_SIZE(allowed); i++)
- if (chan->chan == allowed[i])
+ if (chan->freq == allowed[i])
return 1;
return 0;
@@ -678,10 +682,11 @@ acs_find_ideal_chan_mode(struct hostapd_
/* HT40 on 5 GHz has a limited set of primary channels as per
* 11n Annex J */
if (mode->mode == HOSTAPD_MODE_IEEE80211A &&
- iface->conf->ieee80211n &&
- iface->conf->secondary_channel &&
- !acs_usable_ht40_chan(chan)) {
- wpa_printf(MSG_DEBUG, "ACS: Channel %d: not allowed as primary channel for HT40",
+ ((iface->conf->ieee80211n &&
+ iface->conf->secondary_channel) ||
+ is_6ghz_freq(chan->freq)) &&
+ !acs_usable_bw40_chan(chan)) {
+ wpa_printf(MSG_DEBUG, "ACS: Channel %d: not allowed as primary channel for 40MHz bandwidth",
chan->chan);
continue;
}
@@ -690,18 +695,18 @@ acs_find_ideal_chan_mode(struct hostapd_
(iface->conf->ieee80211ac || iface->conf->ieee80211ax)) {
if (hostapd_get_oper_chwidth(iface->conf) ==
CHANWIDTH_80MHZ &&
- !acs_usable_vht80_chan(chan)) {
+ !acs_usable_bw80_chan(chan)) {
wpa_printf(MSG_DEBUG,
- "ACS: Channel %d: not allowed as primary channel for VHT80",
+ "ACS: Channel %d: not allowed as primary channel for 80MHz bandwidth",
chan->chan);
continue;
}
if (hostapd_get_oper_chwidth(iface->conf) ==
CHANWIDTH_160MHZ &&
- !acs_usable_vht160_chan(chan)) {
+ !acs_usable_bw160_chan(chan)) {
wpa_printf(MSG_DEBUG,
- "ACS: Channel %d: not allowed as primary channel for VHT160",
+ "ACS: Channel %d: not allowed as primary channel for 160MHz bandwidth",
chan->chan);
continue;
}
@@ -832,16 +837,20 @@ acs_find_ideal_chan(struct hostapd_iface
u32 bw;
struct hostapd_hw_modes *mode;
- /* TODO: HT40- support */
+ if (is_6ghz_op_class(iface->conf->op_class)) {
+ bw = op_class_to_bandwidth(iface->conf->op_class);
+ n_chans = bw/20;
+ goto bw_selected;
+ }
+ /* TODO: HT40- support */
if (iface->conf->ieee80211n &&
iface->conf->secondary_channel == -1) {
wpa_printf(MSG_ERROR, "ACS: HT40- is not supported yet. Please try HT40+");
return NULL;
}
- if (iface->conf->ieee80211n &&
- iface->conf->secondary_channel)
+ if (iface->conf->ieee80211n && iface->conf->secondary_channel)
n_chans = 2;
if (iface->conf->ieee80211ac || iface->conf->ieee80211ax) {
@@ -857,6 +866,7 @@ acs_find_ideal_chan(struct hostapd_iface
bw = num_chan_to_bw(n_chans);
+bw_selected:
/* TODO: VHT/HE80+80. Update acs_adjust_center_freq() too. */
wpa_printf(MSG_DEBUG,
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -1689,6 +1689,10 @@ static int setup_interface2(struct hosta
ch_width = op_class_to_ch_width(iface->conf->op_class);
hostapd_set_oper_chwidth(iface->conf, ch_width);
+ if (!iface->conf->secondary_channel &&
+ op_class_to_bandwidth(iface->conf->op_class) >= 40)
+ iface->conf->secondary_channel =
+ (((iface->conf->channel - 1) / 4 ) % 2) ? -1 : 1 ;
}
ret = hostapd_select_hw_mode(iface);
diff --git a/src/ap/beacon.c b/src/ap/beacon.c
index 668d9094e28d..ff17b2f00e85 100644
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -486,8 +486,10 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd,
resp->frame_control = IEEE80211_FC(WLAN_FC_TYPE_MGMT,
WLAN_FC_STYPE_PROBE_RESP);
- if (req)
+ os_memset(resp->da, 0xff, ETH_ALEN);
+ if (req && !is_6ghz_op_class(hapd->iconf->op_class))
os_memcpy(resp->da, req->sa, ETH_ALEN);
+
os_memcpy(resp->sa, hapd->own_addr, ETH_ALEN);
os_memcpy(resp->bssid, hapd->own_addr, ETH_ALEN);
diff --git a/wpa_supplicant/mesh.c b/wpa_supplicant/mesh.c
index c1630d09a254..56f40edc0fdc 100644
--- a/wpa_supplicant/mesh.c
+++ b/wpa_supplicant/mesh.c
@@ -512,6 +512,8 @@ int wpa_supplicant_join_mesh(struct wpa_supplicant *wpa_s,
params->flags |= WPA_DRIVER_MESH_FLAG_SAE_AUTH;
params->flags |= WPA_DRIVER_MESH_FLAG_AMPE;
wpa_s->conf->user_mpm = 1;
+ if (is_6ghz_freq(ssid->frequency))
+ ssid->ieee80211w = MGMT_FRAME_PROTECTION_REQUIRED;
}
if (wpa_s->conf->user_mpm) {

View File

@@ -0,0 +1,233 @@
--- a/src/ap/drv_callbacks.c
+++ b/src/ap/drv_callbacks.c
@@ -1747,6 +1747,39 @@ static void hostapd_event_wds_sta_interf
ifname, MAC2STR(addr));
}
+static void hostapd_event_update_muedca_params(struct hostapd_data *hapd,
+ struct update_muedca *params)
+{
+ int i;
+ u8 updated_count;
+
+ /* Update current MU-EDCA parameters */
+ for (i = 0; i < 3; i++) {
+ hapd->iface->conf->he_mu_edca.he_mu_ac_be_param[i] =
+ params->he_mu_ac_be_param[i];
+ hapd->iface->conf->he_mu_edca.he_mu_ac_bk_param[i] =
+ params->he_mu_ac_bk_param[i];
+ hapd->iface->conf->he_mu_edca.he_mu_ac_vo_param[i] =
+ params->he_mu_ac_vo_param[i];
+ hapd->iface->conf->he_mu_edca.he_mu_ac_vi_param[i] =
+ params->he_mu_ac_vi_param[i];
+ }
+
+ /* Increment Parameter Set Update Count for MU-EDCA and WME EDCA only
+ * if any STA is connected
+ */
+ if (hapd->num_sta) {
+ updated_count = (hapd->iface->conf->he_mu_edca.he_qos_info + 1) & 0xf;
+ hapd->iface->conf->he_mu_edca.he_qos_info &= 0xf0;
+ hapd->iface->conf->he_mu_edca.he_qos_info |= updated_count;
+ hapd->parameter_set_count++;
+ }
+
+ /* Update beacon with updated MU-EDCA parameters */
+ if (ieee802_11_update_beacons(hapd->iface))
+ wpa_printf(MSG_DEBUG,
+ "Failed to update beacons with MU-EDCA parameters");
+}
#ifdef CONFIG_OWE
static int hostapd_notif_update_dh_ie(struct hostapd_data *hapd,
@@ -2055,6 +2088,9 @@ void hostapd_wpa_event(void *ctx, enum w
data->wds_sta_interface.ifname,
data->wds_sta_interface.sta_addr);
break;
+ case EVENT_UPDATE_MUEDCA_PARAMS:
+ hostapd_event_update_muedca_params(hapd, &data->update_muedca);
+ break;
default:
wpa_printf(MSG_DEBUG, "Unknown event %d", event);
break;
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -5052,6 +5052,15 @@ enum wpa_event_type {
* is required to provide more details of the frame.
*/
EVENT_UNPROT_BEACON,
+
+ /**
+ * EVENT_UPDATE_MUEDCA_PARAMS - Updated MU-EDCA parameters received
+ *
+ * This event is emitted when updated MU-EDCA parameters from driver
+ * are received. Updated MU-EDCA parameters need to be updated in
+ * beacon.
+ */
+ EVENT_UPDATE_MUEDCA_PARAMS,
};
@@ -5911,6 +5920,16 @@ union wpa_event_data {
struct unprot_beacon {
const u8 *sa;
} unprot_beacon;
+
+ /**
+ * struct update_muedca - Data for EVENT_UPDATE_MU_EDCA_PARAMS
+ */
+ struct update_muedca {
+ u8 he_mu_ac_be_param[3];
+ u8 he_mu_ac_bk_param[3];
+ u8 he_mu_ac_vi_param[3];
+ u8 he_mu_ac_vo_param[3];
+ } update_muedca;
};
/**
--- a/src/drivers/driver_nl80211_event.c
+++ b/src/drivers/driver_nl80211_event.c
@@ -2584,6 +2584,35 @@ static void nl80211_sta_opmode_change_ev
wpa_supplicant_event(drv->ctx, EVENT_STATION_OPMODE_CHANGED, &ed);
}
+static void nl80211_update_muedca_params_event(struct wpa_driver_nl80211_data *drv,
+ struct nlattr **tb)
+{
+ struct host_update_muedca {
+ u8 mu_qos_info;
+ u8 ac_be[3];
+ u8 ac_bk[3];
+ u8 ac_vi[3];
+ u8 ac_vo[3];
+ };
+
+ struct host_update_muedca *rx_muedca_params;
+ union wpa_event_data ed;
+ int i;
+
+ if (!tb[NL80211_ATTR_HE_MUEDCA_PARAMS])
+ return;
+
+ rx_muedca_params = nla_data(tb[NL80211_ATTR_HE_MUEDCA_PARAMS]);
+
+ for (i = 0; i< 3; i++) {
+ ed.update_muedca.he_mu_ac_be_param[i] = rx_muedca_params->ac_be[i];
+ ed.update_muedca.he_mu_ac_bk_param[i] = rx_muedca_params->ac_bk[i];
+ ed.update_muedca.he_mu_ac_vi_param[i] = rx_muedca_params->ac_vi[i];
+ ed.update_muedca.he_mu_ac_vo_param[i] = rx_muedca_params->ac_vo[i];
+ }
+
+ wpa_supplicant_event(drv->ctx, EVENT_UPDATE_MUEDCA_PARAMS, &ed);
+}
static void nl80211_control_port_frame(struct wpa_driver_nl80211_data *drv,
struct nlattr **tb)
@@ -2641,7 +2670,6 @@ nl80211_control_port_frame_tx_status(str
wpa_supplicant_event(drv->ctx, EVENT_EAPOL_TX_STATUS, &event);
}
-
static void do_process_drv_event(struct i802_bss *bss, int cmd,
struct nlattr **tb)
{
@@ -2869,6 +2897,9 @@ static void do_process_drv_event(struct
tb[NL80211_ATTR_ACK],
tb[NL80211_ATTR_COOKIE]);
break;
+ case NL80211_CMD_UPDATE_HE_MUEDCA_PARAMS:
+ nl80211_update_muedca_params_event(drv, tb);
+ break;
default:
wpa_dbg(drv->ctx, MSG_DEBUG, "nl80211: Ignored unknown event "
"(cmd=%d)", cmd);
--- a/src/drivers/nl80211_copy.h
+++ b/src/drivers/nl80211_copy.h
@@ -1170,6 +1170,11 @@
* includes the contents of the frame. %NL80211_ATTR_ACK flag is included
* if the recipient acknowledged the frame.
*
+ * @NL80211_CMD_UPDATE_HE_MUEDCA_PARAMS: Updated MU-EDCA parameters from driver.
+ * This event is used to update MU-EDCA parameters in Beacon frame, which
+ * were indicated by driver and now need to be reflected in
+ * Beacon frame.
+ *
* @NL80211_CMD_MAX: highest used command number
* @__NL80211_CMD_AFTER_LAST: internal use
*/
@@ -1400,6 +1405,7 @@ enum nl80211_commands {
NL80211_CMD_CONTROL_PORT_FRAME_TX_STATUS,
+ NL80211_CMD_UPDATE_HE_MUEDCA_PARAMS,
/* add new commands above here */
/* used to define NL80211_CMD_MAX below */
@@ -2505,6 +2511,9 @@ enum nl80211_commands {
* @NL80211_ATTR_HE_6GHZ_CAPABILITY: HE 6 GHz Band Capability element (from
* association request when used with NL80211_CMD_NEW_STATION).
*
+ * @NL80211_ATTR_HE_MUEDCA_PARAMS: MU-EDCA AC parameters for the
+ NL80211_CMD_UPDATE_HE_MUEDCA_PARAMS command.
+ *
* @NUM_NL80211_ATTR: total number of nl80211_attrs available
* @NL80211_ATTR_MAX: highest attribute number currently defined
* @__NL80211_ATTR_AFTER_LAST: internal use
@@ -2987,6 +2996,7 @@ enum nl80211_attrs {
NL80211_ATTR_HE_6GHZ_CAPABILITY,
+ NL80211_ATTR_HE_MUEDCA_PARAMS,
/* add attributes here, update the policy in nl80211.c */
__NL80211_ATTR_AFTER_LAST,
--- a/src/drivers/driver_common.c
+++ b/src/drivers/driver_common.c
@@ -90,6 +90,7 @@ const char * event_to_string(enum wpa_ev
E2S(WDS_STA_INTERFACE_STATUS);
E2S(UPDATE_DH);
E2S(UNPROT_BEACON);
+ E2S(UPDATE_MUEDCA_PARAMS);
}
return "UNKNOWN";
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -3541,6 +3541,10 @@ static int hostapd_fill_csa_settings(str
hapd->cs_count = settings->cs_count;
hapd->cs_block_tx = settings->block_tx;
+ /* reset MU-EDCA and WME EDCA parameter set count */
+ hapd->iface->conf->he_mu_edca.he_qos_info &= 0xfff0;
+ hapd->parameter_set_count = 0;
+
ret = hostapd_build_beacon_data(hapd, &settings->beacon_csa);
if (ret) {
free_beacon_data(&settings->beacon_after);
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
@@ -1471,6 +1471,11 @@ static int hostapd_ctrl_iface_set(struct
} else if (os_strncmp(cmd, "wme_ac_", 7) == 0 ||
os_strncmp(cmd, "wmm_ac_", 7) == 0) {
hapd->parameter_set_count++;
+ /* Incrementing MU-EDCA Parameter Set Update Count*/
+ hapd->iface->conf->he_mu_edca.he_qos_info =
+ hapd->iface->conf->he_mu_edca.he_qos_info & 0xf0 |
+ ((hapd->iface->conf->he_mu_edca.he_qos_info + 1) &
+ 0xf);
if (ieee802_11_update_beacons(hapd->iface))
wpa_printf(MSG_DEBUG,
"Failed to update beacons with WMM parameters");
--- a/src/ap/wmm.c
+++ b/src/ap/wmm.c
@@ -98,6 +98,10 @@ static void wmm_calc_regulatory_limit(st
os_memcpy(hapd->iface->prev_wmm, acp,
sizeof(hapd->iconf->wmm_ac_params));
hapd->parameter_set_count++;
+ /* Incrementing MU-EDCA Parameter Set Update Count*/
+ hapd->iface->conf->he_mu_edca.he_qos_info =
+ hapd->iface->conf->he_mu_edca.he_qos_info & 0xf0 |
+ ((hapd->iface->conf->he_mu_edca.he_qos_info + 1) & 0xf);
}
}

View File

@@ -0,0 +1,724 @@
Index: hostapd-2020-07-02-58b384f4/hostapd/config_file.c
===================================================================
--- hostapd-2020-07-02-58b384f4.orig/hostapd/config_file.c
+++ hostapd-2020-07-02-58b384f4/hostapd/config_file.c
@@ -3561,6 +3561,10 @@ static int hostapd_config_fill(struct ho
conf->he_oper_centr_freq_seg0_idx = atoi(pos);
} else if (os_strcmp(buf, "he_oper_centr_freq_seg1_idx") == 0) {
conf->he_oper_centr_freq_seg1_idx = atoi(pos);
+ } else if (os_strcmp(buf,
+ "unsol_bcast_probe_resp_interval") == 0) {
+ bss->unsol_bcast_probe_resp_interval =
+ (atoi(pos) > 20) ? 20 : atoi(pos);
#endif /* CONFIG_IEEE80211AX */
} else if (os_strcmp(buf, "max_listen_interval") == 0) {
bss->max_listen_interval = atoi(pos);
@@ -4369,6 +4373,10 @@ static int hostapd_config_fill(struct ho
bss->dhcp_server_port = atoi(pos);
} else if (os_strcmp(buf, "dhcp_relay_port") == 0) {
bss->dhcp_relay_port = atoi(pos);
+ } else if (os_strcmp(buf, "fils_discovery_min_interval") == 0) {
+ bss->fils_discovery_min_int = atoi(pos);
+ } else if (os_strcmp(buf, "fils_discovery_max_interval") == 0) {
+ bss->fils_discovery_max_int = atoi(pos);
#endif /* CONFIG_FILS */
} else if (os_strcmp(buf, "multicast_to_unicast") == 0) {
bss->multicast_to_unicast = atoi(pos);
Index: hostapd-2020-07-02-58b384f4/hostapd/hostapd.conf
===================================================================
--- hostapd-2020-07-02-58b384f4.orig/hostapd/hostapd.conf
+++ hostapd-2020-07-02-58b384f4/hostapd/hostapd.conf
@@ -873,6 +873,12 @@ wmm_ac_vo_acm=0
#he_spr_srg_obss_pd_min_offset
#he_spr_srg_obss_pd_max_offset
+# Unsolicited broadcast probe response transmission settings, 6GHz only.
+# If interval is set to non-zero, the AP schedules unsolicited
+# broadcast probe response frames for in-band discovery. Refer to
+# IEEE P802.11ax/D6.0 26.17.2.3.2, AP behavior for fast passive scanning.
+#unsol_bcast_probe_resp_interval=0(default) to 20 TUs.
+
##### IEEE 802.1X-2004 related configuration ##################################
# Require IEEE 802.1X authorization
@@ -1914,6 +1920,11 @@ own_ip_addr=127.0.0.1
# default: 30 TUs (= 30.72 milliseconds)
#fils_hlp_wait_time=30
+# FILS discovery transmission minimum and maximum packet interval settings.
+# If maximum interval is non-zero, the AP schedules FILS discovery transmission
+#fils_discovery_max_interval=0 to 10000 (in TUs).
+#fils_discovery_min_interval=0 to 10000 (in TUs).
+
# Transition Disable indication
# The AP can notify authenticated stations to disable transition mode in their
# network profiles when the network has completed transition steps, i.e., once
Index: hostapd-2020-07-02-58b384f4/src/ap/ap_config.c
===================================================================
--- hostapd-2020-07-02-58b384f4.orig/src/ap/ap_config.c
+++ hostapd-2020-07-02-58b384f4/src/ap/ap_config.c
@@ -131,6 +131,7 @@ void hostapd_config_defaults_bss(struct
bss->fils_hlp_wait_time = 30;
bss->dhcp_server_port = DHCP_SERVER_PORT;
bss->dhcp_relay_port = DHCP_SERVER_PORT;
+ bss->fils_discovery_min_int = 20;
#endif /* CONFIG_FILS */
bss->broadcast_deauth = 1;
@@ -1334,6 +1335,15 @@ static int hostapd_config_check_bss(stru
}
#endif /* CONFIG_SAE_PK */
+#ifdef CONFIG_FILS
+ if (bss->fils_discovery_max_int &&
+ bss->unsol_bcast_probe_resp_interval) {
+ wpa_printf(MSG_ERROR,
+ "Cannot enable both FILS discovery and unsolicited broadcast probe response at the same time");
+ return -1;
+ }
+#endif /* CONFIG_FILS */
+
return 0;
}
Index: hostapd-2020-07-02-58b384f4/src/ap/ap_config.h
===================================================================
--- hostapd-2020-07-02-58b384f4.orig/src/ap/ap_config.h
+++ hostapd-2020-07-02-58b384f4/src/ap/ap_config.h
@@ -735,6 +735,8 @@ struct hostapd_bss_config {
unsigned int fils_hlp_wait_time;
u16 dhcp_server_port;
u16 dhcp_relay_port;
+ u32 fils_discovery_min_int;
+ u32 fils_discovery_max_int;
#endif /* CONFIG_FILS */
int multicast_to_unicast;
@@ -868,6 +870,7 @@ struct hostapd_bss_config {
u8 mka_psk_set;
#endif /* CONFIG_MACSEC */
char *config_id;
+ u32 unsol_bcast_probe_resp_interval;
};
/**
Index: hostapd-2020-07-02-58b384f4/src/ap/beacon.c
===================================================================
--- hostapd-2020-07-02-58b384f4.orig/src/ap/beacon.c
+++ hostapd-2020-07-02-58b384f4/src/ap/beacon.c
@@ -1127,6 +1127,21 @@ static u8 * hostapd_probe_resp_offloads(
#endif /* NEED_AP_MLME */
+#ifdef CONFIG_IEEE80211AX
+/* Unsolicited broadcast probe response transmission, 6GHz only */
+static u8 *hostapd_unsol_bcast_probe_resp(struct hostapd_data *hapd,
+ struct wpa_driver_ap_params *params)
+{
+ if (!is_6ghz_op_class(hapd->iconf->op_class))
+ return NULL;
+
+ params->unsol_bcast_probe_resp_interval =
+ hapd->conf->unsol_bcast_probe_resp_interval;
+
+ return hostapd_gen_probe_resp(hapd, NULL, 0,
+ &params->unsol_bcast_probe_resp_tmpl_len);
+}
+#endif /* CONFIG_IEEE80211AX */
void sta_track_del(struct hostapd_sta_info *info)
{
@@ -1138,6 +1153,271 @@ void sta_track_del(struct hostapd_sta_in
}
+#ifdef CONFIG_FILS
+static u8 hostapd_fils_discovery_rsn(struct hostapd_data *hapd, u16 *cap,
+ u32 *suite_selector_ptr)
+{
+ const u8 *ie, *start;
+ u8 len;
+ u16 cnt;
+ u32 suite_selector = 0;
+
+ ie = hostapd_wpa_ie(hapd, WLAN_EID_RSN);
+ if (!ie || ie[1] < 6)
+ return 0;
+
+ len = ie[1];
+ start = &ie[2];
+ ie += 4;
+ do {
+ /* Group Data Cipher Suite Selector */
+ suite_selector = ie[3];
+ ie += 4;
+
+ /* Pairwise Cipher Suite Selector */
+ if ((ie - start) >= len)
+ break;
+ os_memcpy((u8 *) &cnt, ie, 2);
+ ie += 2;
+ if (cnt) {
+ suite_selector |= (((u32) ie[3]) << 12);
+ ie += (4 * cnt);
+ }
+
+ /* AKM Cipher Suite Selector */
+ if ((ie - start) >= len)
+ break;
+ os_memcpy((u8 *) &cnt, ie, 2);
+ ie += 2;
+ if (cnt) {
+ suite_selector |= (((u32) ie[3]) << 18);
+ ie += (4 * cnt);
+ }
+
+ /* RSN capabilities */
+ if ((ie - start) >= len)
+ break;
+ os_memcpy((u8 *) cap, ie, 2);
+ ie += 2;
+
+ /* Group Management Cipher Suite Selector */
+ if ((ie - start) < len)
+ suite_selector |= (((u32) ie[3]) << 6);
+ } while (0);
+
+ *suite_selector_ptr = suite_selector;
+ return 1;
+}
+
+
+u16 hostapd_fils_discovery_cap(struct hostapd_data *hapd)
+{
+ u16 cap_info = 0, nss_mask = 0x0003;
+ u8 nss = 0, chwidth = 0;
+ int i;
+
+ cap_info = FILS_DISCOVERY_CAP_ESS |
+ (hapd->conf->wpa ? FILS_DISCOVERY_CAP_PRIVACY : 0) |
+ (hapd->iconf->multiple_bssid ?
+ FILS_DISCOVERY_CAP_MULTIPLE_BSSID_PRESENT : 0);
+
+ if (is_6ghz_op_class(hapd->iconf->op_class)) {
+ cap_info |= (FILS_DISCOVERY_CAP_PHY_INDEX_HE <<
+ FILS_DISCOVERY_CAP_PHY_INDEX_SHIFT);
+
+ switch (hapd->iconf->op_class) {
+ case 132:
+ chwidth = FILS_DISCOVERY_CAP_BSS_CHWIDTH_40;
+ break;
+ case 133:
+ chwidth = FILS_DISCOVERY_CAP_BSS_CHWIDTH_80;
+ break;
+ case 134:
+ case 135:
+ chwidth = FILS_DISCOVERY_CAP_BSS_CHWIDTH_160_8080;
+ break;
+ }
+ } else {
+ switch (hostapd_get_oper_chwidth(hapd->iconf)) {
+ case CHANWIDTH_80P80MHZ:
+ case CHANWIDTH_160MHZ:
+ chwidth = FILS_DISCOVERY_CAP_BSS_CHWIDTH_160_8080;
+ break;
+ case CHANWIDTH_80MHZ:
+ chwidth = FILS_DISCOVERY_CAP_BSS_CHWIDTH_80;
+ break;
+ case CHANWIDTH_USE_HT:
+ if (hapd->iconf->secondary_channel)
+ chwidth = FILS_DISCOVERY_CAP_BSS_CHWIDTH_40;
+ break;
+ }
+
+ if (hapd->iconf->ieee80211ax) {
+#ifdef CONFIG_IEEE80211AX
+ cap_info |= (FILS_DISCOVERY_CAP_PHY_INDEX_HE <<
+ FILS_DISCOVERY_CAP_PHY_INDEX_SHIFT);
+#endif /* CONFIG_IEEE80211AX */
+ } else if (hapd->conf->vendor_vht) {
+#ifdef CONFIG_IEEE80211AC
+ cap_info |= (FILS_DISCOVERY_CAP_PHY_INDEX_VHT <<
+ FILS_DISCOVERY_CAP_PHY_INDEX_SHIFT);
+#endif /* CONFIG_IEEE80211AC */
+ } else if (hapd->iconf->ieee80211n &&
+ !hapd->conf->disable_11n) {
+ cap_info |= (FILS_DISCOVERY_CAP_PHY_INDEX_HT <<
+ FILS_DISCOVERY_CAP_PHY_INDEX_SHIFT);
+ }
+ }
+
+ cap_info |= (chwidth << FILS_DISCOVERY_CAP_BSS_CHWIDTH_SHIFT);
+
+ for (i = 0; i < 8; i++) {
+ if ((hapd->iconf->he_op.he_basic_mcs_nss_set & nss_mask) !=
+ nss_mask)
+ nss++;
+ nss_mask = nss_mask << 2;
+ }
+ if (nss > 4)
+ cap_info |= (4 << FILS_DISCOVERY_CAP_NSS_SHIFT);
+ else
+ cap_info |= ((nss - 1) << FILS_DISCOVERY_CAP_NSS_SHIFT);
+
+ /* TODO: FILS minimum rate */
+ return cap_info;
+}
+
+
+static u8 * hostapd_gen_fils_discovery(struct hostapd_data *hapd, u32 *len)
+{
+ struct ieee80211_mgmt *head;
+ const u8 *mobility_domain;
+ u8 *pos, *length_pos, rsn = 0, buf[200], buf_len;
+ u16 frm_cntl = 0, rsn_cap = 0;
+ u32 suite_selectors = 0, total_len;
+
+#define FILS_DISOVERY_TMPL_HEAD_LEN 26
+#define FILS_DISOVERY_TMPL_MIN_LEN 19
+
+ total_len = FILS_DISOVERY_TMPL_HEAD_LEN + FILS_DISOVERY_TMPL_MIN_LEN;
+
+ /* FILS discovery frame control: 2 bytes */
+ frm_cntl = (sizeof(hapd->conf->ssid.short_ssid) - 1) |
+ FILS_DISCOVERY_FRM_CNTL_CAP_PRESENT |
+ FILS_DISCOVERY_FRM_CNTL_SHORT_SSID_PRESENT |
+ FILS_DISCOVERY_FRM_CNTL_LENGTH_PRESENT;
+
+ /* Check for optional subfields and calculate length */
+ rsn = hostapd_fils_discovery_rsn(hapd, &rsn_cap, &suite_selectors);
+ if (rsn) {
+ frm_cntl |= FILS_DISCOVERY_FRM_CNTL_RSN_INFO_PRESENT;
+ total_len += 5;
+ }
+
+ mobility_domain = hostapd_wpa_ie(hapd, WLAN_EID_MOBILITY_DOMAIN);
+ if (mobility_domain) {
+ frm_cntl |= FILS_DISCOVERY_FRM_CNTL_MOBILITY_DOMAIN_PRESENT;
+ total_len += 3;
+ }
+
+ total_len += hostapd_eid_reduced_neighbor_report_len(hapd);
+
+ pos = hostapd_eid_fils_indic(hapd, buf, 0);
+ buf_len = pos - buf;
+ total_len += buf_len;
+
+ head = os_zalloc(total_len);
+ if (!head)
+ return NULL;
+
+ head->frame_control = IEEE80211_FC(WLAN_FC_TYPE_MGMT,
+ WLAN_FC_STYPE_ACTION);
+ os_memset(head->da, 0xff, ETH_ALEN);
+ os_memcpy(head->sa, hapd->own_addr, ETH_ALEN);
+ os_memcpy(head->bssid, hapd->own_addr, ETH_ALEN);
+
+ head->u.action.category = WLAN_ACTION_PUBLIC;
+ head->u.action.u.public_action.action = WLAN_PA_FILS_DISCOVERY;
+
+ pos = &head->u.action.u.public_action.variable[0];
+ *((u16 *) pos) = host_to_le16(frm_cntl);
+ pos += 2;
+
+ /* hardware or low-level driver will setup timestamp */
+ pos += 8;
+
+ /* Beacon interval */
+ *((u16 *) pos) = host_to_le16(hapd->iconf->beacon_int);
+ pos += 2;
+
+ /* Short SSID */
+ *((u32 *) pos) = host_to_le32(hapd->conf->ssid.short_ssid);
+ pos += sizeof(hapd->conf->ssid.short_ssid);
+
+ /* Store position of FILS discovery information element length field */
+ length_pos = pos++;
+
+ /* FD Capability : total 2 bytes */
+ *((u16 *) pos) = host_to_le16(hostapd_fils_discovery_cap(hapd));
+ pos += 2;
+
+ /* RSN */
+ if (frm_cntl & FILS_DISCOVERY_FRM_CNTL_RSN_INFO_PRESENT) {
+ os_memcpy(pos, &rsn_cap, 2);
+ os_memcpy(&pos[2], &suite_selectors, 3);
+ pos += 5;
+ }
+
+ /* Mobility Domain */
+ if (frm_cntl & FILS_DISCOVERY_FRM_CNTL_MOBILITY_DOMAIN_PRESENT) {
+ os_memcpy(pos, &mobility_domain[2], 3);
+ pos += 3;
+ }
+
+ /* Fill the FILS discovery information element length */
+ *length_pos = pos - (length_pos + 1);
+
+ /* Reduced Neighbor Report element */
+ pos = hostapd_eid_reduced_neighbor_report(hapd, pos);
+
+ /* FILS indication element */
+ if (buf_len) {
+ os_memcpy(pos, buf, buf_len);
+ pos += buf_len;
+ }
+
+ *len = pos - (u8 *) head;
+ return ((u8 *) head);
+}
+
+
+/* Configure FILS discovery transmission */
+static u8 * hostapd_fils_discovery(struct hostapd_data *hapd,
+ struct wpa_driver_ap_params *params)
+{
+ if (hapd->iconf->multiple_bssid && hapd != hapd->iface->bss[0])
+ return NULL;
+
+#define VALID_INTERVAL(x,y) { x = (x > y) ? y : x; }
+
+ params->fils_discovery_max_int = hapd->conf->fils_discovery_max_int;
+ if (is_6ghz_op_class(hapd->iconf->op_class))
+ VALID_INTERVAL(params->fils_discovery_max_int,
+ FILS_DISCOVERY_MAX_INTERVAL_6GHZ);
+
+ params->fils_discovery_min_int = hapd->conf->fils_discovery_min_int;
+ VALID_INTERVAL(params->fils_discovery_min_int,
+ params->fils_discovery_max_int);
+#undef VALID_INTERVAL
+
+ if (params->fils_discovery_max_int)
+ return hostapd_gen_fils_discovery(hapd,
+ &params->fils_discovery_tmpl_len);
+
+ return NULL;
+}
+#endif /* CONFIG_FILS */
+
+
int ieee802_11_build_ap_params(struct hostapd_data *hapd,
struct wpa_driver_ap_params *params)
{
@@ -1475,6 +1755,14 @@ void ieee802_11_free_ap_params(struct wp
params->head = NULL;
os_free(params->proberesp);
params->proberesp = NULL;
+#ifdef CONFIG_FILS
+ os_free(params->fils_discovery_tmpl);
+ params->fils_discovery_tmpl = NULL;
+#endif /* CONFIG_FILS */
+#ifdef CONFIG_IEEE80211AX
+ os_free(params->unsol_bcast_probe_resp_tmpl);
+ params->unsol_bcast_probe_resp_tmpl = NULL;
+#endif /* CONFIG_IEEE80211AX */
}
@@ -1514,9 +1802,15 @@ int ieee802_11_set_beacon(struct hostapd
params.he_bss_color = hapd->iface->conf->he_op.he_bss_color;
params.twt_responder = hostapd_get_he_twt_responder(hapd,
IEEE80211_MODE_AP);
+ params.unsol_bcast_probe_resp_tmpl =
+ hostapd_unsol_bcast_probe_resp(hapd, &params);
#endif /* CONFIG_IEEE80211AX */
hapd->reenable_beacon = 0;
+#ifdef CONFIG_FILS
+ params.fils_discovery_tmpl = hostapd_fils_discovery(hapd, &params);
+#endif /* CONFIG_FILS */
+
if (cmode &&
hostapd_set_freq_params(&freq, iconf->hw_mode, iface->freq,
iconf->channel, iconf->enable_edmg,
Index: hostapd-2020-07-02-58b384f4/src/common/ieee802_11_defs.h
===================================================================
--- hostapd-2020-07-02-58b384f4.orig/src/common/ieee802_11_defs.h
+++ hostapd-2020-07-02-58b384f4/src/common/ieee802_11_defs.h
@@ -2350,4 +2350,40 @@ enum edmg_bw_config {
/* DPP Public Action frame identifiers - OUI_WFA */
#define DPP_OUI_TYPE 0x1A
+/**
+ * IEEE Std 802.11ai-2016 9.6.8.36 FILS Discovery frame format,
+ * Figure 9-687b - FILS Discovery Frame Control subfield format
+ */
+#define FILS_DISCOVERY_FRM_CNTL_CAP_PRESENT ((u16)BIT(5))
+#define FILS_DISCOVERY_FRM_CNTL_SHORT_SSID_PRESENT ((u16)BIT(6))
+#define FILS_DISCOVERY_FRM_CNTL_AP_CSN_PRESENT ((u16)BIT(7))
+#define FILS_DISCOVERY_FRM_CNTL_ANO_PRESENT ((u16)BIT(8))
+#define FILS_DISCOVERY_FRM_CNTL_FREQ_SEG1_PRESENT ((u16)BIT(9))
+#define FILS_DISCOVERY_FRM_CNTL_PRI_CHAN_PRESENT ((u16)BIT(10))
+#define FILS_DISCOVERY_FRM_CNTL_RSN_INFO_PRESENT ((u16)BIT(11))
+#define FILS_DISCOVERY_FRM_CNTL_LENGTH_PRESENT ((u16)BIT(12))
+#define FILS_DISCOVERY_FRM_CNTL_MOBILITY_DOMAIN_PRESENT ((u16)BIT(13))
+
+/**
+ * IEEE Std 802.11ai-2016 9.6.8.36 FILS Discovery frame format,
+ * Figure 9-687c - FD Capability subfield format
+ */
+#define FILS_DISCOVERY_CAP_ESS BIT(0)
+#define FILS_DISCOVERY_CAP_PRIVACY BIT(1)
+#define FILS_DISCOVERY_CAP_MULTIPLE_BSSID_PRESENT BIT(9)
+#define FILS_DISCOVERY_CAP_BSS_CHWIDTH_20 0
+#define FILS_DISCOVERY_CAP_BSS_CHWIDTH_40 1
+#define FILS_DISCOVERY_CAP_BSS_CHWIDTH_80 2
+#define FILS_DISCOVERY_CAP_BSS_CHWIDTH_160_8080 3
+#define FILS_DISCOVERY_CAP_BSS_CHWIDTH_SHIFT 2
+#define FILS_DISCOVERY_CAP_NSS_SHIFT 5
+#define FILS_DISCOVERY_CAP_PHY_INDEX_SHIFT 10
+#define FILS_DISCOVERY_CAP_PHY_INDEX_HT 2
+#define FILS_DISCOVERY_CAP_PHY_INDEX_VHT 3
+
+/**
+ * IEEE P802.11ax/D6.0 26.17.2.3.2, AP behavior for fast passive scanning
+ */
+#define FILS_DISCOVERY_CAP_PHY_INDEX_HE 4
+#define FILS_DISCOVERY_MAX_INTERVAL_6GHZ 20
#endif /* IEEE802_11_DEFS_H */
Index: hostapd-2020-07-02-58b384f4/src/drivers/driver.h
===================================================================
--- hostapd-2020-07-02-58b384f4.orig/src/drivers/driver.h
+++ hostapd-2020-07-02-58b384f4/src/drivers/driver.h
@@ -1518,6 +1518,41 @@ struct wpa_driver_ap_params {
* twt_responder - Whether Target Wait Time responder is enabled
*/
int twt_responder;
+
+ /**
+ * FILS discovery minimum interval
+ */
+ u32 fils_discovery_min_int;
+
+ /**
+ * FILS discovery maximum interval
+ */
+ u32 fils_discovery_max_int;
+
+ /**
+ * FILS discovery template data
+ */
+ u8 *fils_discovery_tmpl;
+
+ /**
+ * FILS discovery template length
+ */
+ size_t fils_discovery_tmpl_len;
+
+ /**
+ * Unsolicited broadcast probe response interval
+ */
+ u32 unsol_bcast_probe_resp_interval;
+
+ /**
+ * Unsolicited broadcast probe response template data
+ */
+ u8 *unsol_bcast_probe_resp_tmpl;
+
+ /**
+ * Unsolicited broadcast probe response template length
+ */
+ size_t unsol_bcast_probe_resp_tmpl_len;
};
struct wpa_driver_mesh_bss_params {
Index: hostapd-2020-07-02-58b384f4/src/drivers/driver_nl80211.c
===================================================================
--- hostapd-2020-07-02-58b384f4.orig/src/drivers/driver_nl80211.c
+++ hostapd-2020-07-02-58b384f4/src/drivers/driver_nl80211.c
@@ -4255,7 +4255,6 @@ static int nl80211_put_beacon_rate(struc
return 0;
}
-
static int nl80211_set_multicast_to_unicast(struct i802_bss *bss,
int multicast_to_unicast)
{
@@ -4302,6 +4301,75 @@ static int nl80211_set_multicast_to_unic
}
+#ifdef CONFIG_FILS
+static int nl80211_fils_discovery(struct i802_bss *bss, struct nl_msg *msg,
+ struct wpa_driver_ap_params *params)
+{
+ struct nlattr *attr;
+
+ attr = nla_nest_start(msg, NL80211_ATTR_FILS_DISCOVERY);
+ if (!attr)
+ return -1;
+
+ if (nla_put_u32(msg, NL80211_FILS_DISCOVERY_INT_MIN,
+ params->fils_discovery_min_int) ||
+ nla_put_u32(msg, NL80211_FILS_DISCOVERY_INT_MAX,
+ params->fils_discovery_max_int)) {
+ wpa_printf(MSG_ERROR,
+ "nl80211: Failed to build FILS discovery msg for %s\n",
+ bss->ifname);
+ return -1;
+ }
+
+ if (params->fils_discovery_tmpl &&
+ nla_put(msg, NL80211_FILS_DISCOVERY_TMPL,
+ params->fils_discovery_tmpl_len,
+ params->fils_discovery_tmpl)) {
+ wpa_printf(MSG_ERROR,
+ "nl80211: Failed to build FILS discovery msg for %s\n",
+ bss->ifname);
+ return -1;
+ }
+
+ nla_nest_end(msg, attr);
+ return 0;
+}
+#endif /* CONFIG_FILS */
+
+#ifdef CONFIG_IEEE80211AX
+static int nl80211_unsol_bcast_probe_resp(struct i802_bss *bss,
+ struct nl_msg *msg,
+ struct wpa_driver_ap_params *params)
+{
+ struct nlattr *attr;
+
+ attr = nla_nest_start(msg, NL80211_ATTR_UNSOL_BCAST_PROBE_RESP);
+ if (!attr)
+ return -1;
+
+ if (nla_put_u32(msg, NL80211_UNSOL_BCAST_PROBE_RESP_INT,
+ params->unsol_bcast_probe_resp_interval)) {
+ wpa_printf(MSG_ERROR,
+ "nl80211: Failed to build unsolicited broadcast probe response msg for %s\n",
+ bss->ifname);
+ return -1;
+ }
+
+ if (params->unsol_bcast_probe_resp_tmpl &&
+ nla_put(msg, NL80211_UNSOL_BCAST_PROBE_RESP_TMPL,
+ params->unsol_bcast_probe_resp_tmpl_len,
+ params->unsol_bcast_probe_resp_tmpl)) {
+ wpa_printf(MSG_ERROR,
+ "nl80211: Failed to build unsolicited broadcast probe response msg for %s\n",
+ bss->ifname);
+ return -1;
+ }
+
+ nla_nest_end(msg, attr);
+ return 0;
+}
+#endif /* CONFIG_IEEE80211AX */
+
static int wpa_driver_nl80211_set_ap(void *priv,
struct wpa_driver_ap_params *params)
{
@@ -4560,8 +4628,18 @@ static int wpa_driver_nl80211_set_ap(voi
if (nla_put_flag(msg, NL80211_ATTR_TWT_RESPONDER))
goto fail;
}
+
+ ret = nl80211_unsol_bcast_probe_resp(bss, msg, params);
+ if (ret < 0)
+ goto fail;
#endif /* CONFIG_IEEE80211AX */
+#ifdef CONFIG_FILS
+ ret = nl80211_fils_discovery(bss, msg, params);
+ if (ret < 0)
+ goto fail;
+#endif /* CONFIG_FILS */
+
ret = send_and_recv_msgs_owner(drv, msg, get_connect_handle(bss), 1,
NULL, NULL, NULL, NULL);
if (ret) {
Index: hostapd-2020-07-02-58b384f4/src/drivers/nl80211_copy.h
===================================================================
--- hostapd-2020-07-02-58b384f4.orig/src/drivers/nl80211_copy.h
+++ hostapd-2020-07-02-58b384f4/src/drivers/nl80211_copy.h
@@ -2514,6 +2514,14 @@ enum nl80211_commands {
* @NL80211_ATTR_HE_MUEDCA_PARAMS: MU-EDCA AC parameters for the
NL80211_CMD_UPDATE_HE_MUEDCA_PARAMS command.
*
+ * @NL80211_ATTR_FILS_DISCOVERY: Optional parameter to configure FILS
+ * discovery. It is a nested attribute, see
+ * &enum nl80211_fils_discovery_attributes.
+ *
+ * @NL80211_ATTR_UNSOL_BCAST_PROBE_RESP: Optional parameter to configure
+ * unsolicited broadcast probe response. It is a nested attribute, see
+ * &enum nl80211_unsol_bcast_probe_resp_attributes.
+ *
* @NUM_NL80211_ATTR: total number of nl80211_attrs available
* @NL80211_ATTR_MAX: highest attribute number currently defined
* @__NL80211_ATTR_AFTER_LAST: internal use
@@ -2997,6 +3005,11 @@ enum nl80211_attrs {
NL80211_ATTR_HE_6GHZ_CAPABILITY,
NL80211_ATTR_HE_MUEDCA_PARAMS,
+
+ NL80211_ATTR_FILS_DISCOVERY,
+
+ NL80211_ATTR_UNSOL_BCAST_PROBE_RESP,
+
/* add attributes here, update the policy in nl80211.c */
__NL80211_ATTR_AFTER_LAST,
@@ -6936,4 +6949,61 @@ enum nl80211_iftype_akm_attributes {
NL80211_IFTYPE_AKM_ATTR_MAX = __NL80211_IFTYPE_AKM_ATTR_LAST - 1,
};
+/**
+ * enum nl80211_fils_discovery_attributes - FILS discovery configuration
+ * from IEEE Std 802.11ai-2016, Annex C.3 MIB detail.
+ *
+ * @__NL80211_FILS_DISCOVERY_INVALID: Invalid
+ *
+ * @NL80211_FILS_DISCOVERY_INT_MIN: Minimum packet interval (u32, TU).
+ * Allowed range: 0..10000 (TU = Time Unit)
+ * @NL80211_FILS_DISCOVERY_INT_MAX: Maximum packet interval (u32, TU).
+ * Allowed range: 0..10000 (TU = Time Unit)
+ * @NL80211_FILS_DISCOVERY_TMPL: Optional FILS discovery template.
+ * It has contents of IEEE Std 802.11ai-2016 9.6.8.36 FILS discovery frame
+ * (Figure 9-687a).
+ * It may include 6GHz specific data specified in IEEE P802.11ax/D6.0,
+ * 9.6.7.36 FILS Discovery frame format.
+ *
+ * @__NL80211_FILS_DISCOVERY_LAST: Internal
+ * @NL80211_FILS_DISCOVERY_MAX: highest attribute
+ */
+enum nl80211_fils_discovery_attributes {
+ __NL80211_FILS_DISCOVERY_INVALID,
+
+ NL80211_FILS_DISCOVERY_INT_MIN,
+ NL80211_FILS_DISCOVERY_INT_MAX,
+ NL80211_FILS_DISCOVERY_TMPL,
+
+ /* keep last */
+ __NL80211_FILS_DISCOVERY_LAST,
+ NL80211_FILS_DISCOVERY_MAX = __NL80211_FILS_DISCOVERY_LAST - 1
+};
+
+/**
+ * enum nl80211_unsol_bcast_probe_resp_attributes - Unsolicited broadcast probe
+ * response configuration. Applicable only in 6GHz.
+ *
+ * @__NL80211_UNSOL_BCAST_PROBE_RESP_INVALID: Invalid
+ *
+ * @NL80211_UNSOL_BCAST_PROBE_RESP_INT: Maximum packet interval (u32, TU).
+ * Allowed range: 0..20 (TU = Time Unit). IEEE P802.11ax/D6.0
+ * 26.17.2.3.2 (AP behavior for fast passive scanning.
+ * @NL80211_UNSOL_BCAST_PROBE_RESP_TMPL: Unsolicited broadcast probe response
+ * frame template (binary).
+ *
+ * @__NL80211_UNSOL_BCAST_PROBE_RESP_LAST: Internal
+ * @NL80211_UNSOL_BCAST_PROBE_RESP_MAX: highest attribute
+ */
+enum nl80211_unsol_bcast_probe_resp_attributes {
+ __NL80211_UNSOL_BCAST_PROBE_RESP_INVALID,
+
+ NL80211_UNSOL_BCAST_PROBE_RESP_INT,
+ NL80211_UNSOL_BCAST_PROBE_RESP_TMPL,
+
+ /* keep last */
+ __NL80211_UNSOL_BCAST_PROBE_RESP_LAST,
+ NL80211_UNSOL_BCAST_PROBE_RESP_MAX =
+ __NL80211_UNSOL_BCAST_PROBE_RESP_LAST - 1
+};
#endif /* __LINUX_NL80211_H */

View File

@@ -1,76 +1,154 @@
From 23c244c8ab916b04c5ecfc3572e5368e3d5edf13 Mon Sep 17 00:00:00 2001
From be8312cd122fbe35e45173d23e936fa1b76e56e8 Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Fri, 9 Oct 2020 12:47:53 +0200
Subject: [PATCH 800/813] multiple_bssid: add support
Date: Wed, 3 Jun 2020 16:32:11 +0200
Subject: [PATCH 1/7] multiple_bssid: add the config file
Add support for multiple bssid. In order to be able to do EMA HW offloading
inside the kernel, we need to send the multiple bssid elemets inside a
dedicated nl80211 arreibute.
This patch adds a new config option to enable this feature.
Changes in V4
* make the patch work with the latest mac80211 series
Signed-off-by: Aloka Dixit <alokad@codeaurora.org>
Signed-off-by: John Crispin <john@phrozen.org>
---
hostapd/config_file.c | 4 ++
hostapd/ctrl_iface.c | 3 +
src/ap/ap_config.h | 3 +
src/ap/beacon.c | 37 +++++++++-
src/ap/hostapd.c | 20 ++++++
src/ap/hostapd.h | 2 +
src/ap/ieee802_11.c | 132 ++++++++++++++++++++++++++++++++++-
src/ap/ieee802_11.h | 5 ++
src/ap/ieee802_11_shared.c | 2 +
src/common/ieee802_11_defs.h | 3 +
src/drivers/driver.h | 42 +++++++++++
src/drivers/driver_nl80211.c | 32 ++++++++-
src/drivers/nl80211_copy.h | 19 +++++
13 files changed, 299 insertions(+), 5 deletions(-)
hostapd/config_file.c | 2 ++
src/ap/ap_config.h | 2 ++
2 files changed, 4 insertions(+)
Index: hostapd-2020-07-02-58b384f4/hostapd/config_file.c
===================================================================
--- hostapd-2020-07-02-58b384f4.orig/hostapd/config_file.c
+++ hostapd-2020-07-02-58b384f4/hostapd/config_file.c
@@ -4571,6 +4571,10 @@ static int hostapd_config_fill(struct ho
@@ -4587,6 +4587,8 @@ static int hostapd_config_fill(struct ho
}
bss->mka_psk_set |= MKA_PSK_SET_CKN;
#endif /* CONFIG_MACSEC */
+ } else if (os_strcmp(buf, "multiple_bssid") == 0) {
+ conf->multiple_bssid = atoi(pos);
+ } else if (os_strcmp(buf, "ema_beacon") == 0) {
+ conf->ema_beacon = atoi(pos);
} else {
wpa_printf(MSG_ERROR,
"Line %d: unknown configuration item '%s'",
Index: hostapd-2020-07-02-58b384f4/hostapd/ctrl_iface.c
===================================================================
--- hostapd-2020-07-02-58b384f4.orig/hostapd/ctrl_iface.c
+++ hostapd-2020-07-02-58b384f4/hostapd/ctrl_iface.c
@@ -2729,6 +2729,9 @@ static int hostapd_ctrl_iface_chan_switc
* submitting multi-BSS CSA requests? */
return ret;
}
+
+ if (iface->bss[i]->iconf->multiple_bssid)
+ break;
}
return 0;
Index: hostapd-2020-07-02-58b384f4/src/ap/ap_config.h
===================================================================
--- hostapd-2020-07-02-58b384f4.orig/src/ap/ap_config.h
+++ hostapd-2020-07-02-58b384f4/src/ap/ap_config.h
@@ -991,6 +991,9 @@ struct hostapd_config {
@@ -1001,6 +1001,8 @@ struct hostapd_config {
u8 vht_oper_centr_freq_seg1_idx;
u8 ht40_plus_minus_allowed;
+ u8 multiple_bssid;
+ u8 ema_beacon;
+
/* Use driver-generated interface addresses when adding multiple BSSs */
u8 use_driver_iface_addr;
Index: hostapd-2020-07-02-58b384f4/src/ap/hostapd.c
===================================================================
--- hostapd-2020-07-02-58b384f4.orig/src/ap/hostapd.c
+++ hostapd-2020-07-02-58b384f4/src/ap/hostapd.c
@@ -87,6 +87,26 @@ int hostapd_for_each_interface(struct ha
}
+int hostapd_get_bss_index(struct hostapd_data *hapd)
+{
+ size_t i;
+
+ for (i = 1; i < hapd->iface->num_bss; i++)
+ if (hapd->iface->bss[i] == hapd)
+ return i;
+ return 0;
+}
+
+
+struct hostapd_data * hostapd_get_primary_bss(struct hostapd_data *hapd)
+{
+ if (hapd->iconf->multiple_bssid)
+ return hapd->iface->bss[0];
+
+ return hapd;
+}
+
+
void hostapd_reconfig_encryption(struct hostapd_data *hapd)
{
if (hapd->wpa_auth)
@@ -1182,6 +1202,13 @@ static int hostapd_setup_bss(struct host
if (!first || first == -1) {
u8 *addr = hapd->own_addr;
+ int multiple_bssid_non_transmitted = false;
+ const char *multiple_bssid_parent = NULL;
+
+ if (hapd->iconf->multiple_bssid) {
+ multiple_bssid_non_transmitted = true;
+ multiple_bssid_parent = hapd->iface->bss[0]->conf->iface;
+ }
if (!is_zero_ether_addr(conf->bssid)) {
/* Allocate the configured BSSID. */
@@ -1209,7 +1236,7 @@ static int hostapd_setup_bss(struct host
conf->iface, addr, hapd,
&hapd->drv_priv, force_ifname, if_addr,
conf->bridge[0] ? conf->bridge : NULL,
- first == -1)) {
+ first == -1, multiple_bssid_non_transmitted, multiple_bssid_parent)) {
wpa_printf(MSG_ERROR, "Failed to add BSS (BSSID="
MACSTR ")", MAC2STR(hapd->own_addr));
hapd->interface_added = 0;
Index: hostapd-2020-07-02-58b384f4/src/ap/hostapd.h
===================================================================
--- hostapd-2020-07-02-58b384f4.orig/src/ap/hostapd.h
+++ hostapd-2020-07-02-58b384f4/src/ap/hostapd.h
@@ -598,6 +598,8 @@ struct hostapd_iface {
int hostapd_for_each_interface(struct hapd_interfaces *interfaces,
int (*cb)(struct hostapd_iface *iface,
void *ctx), void *ctx);
+int hostapd_get_bss_index(struct hostapd_data *hapd);
+struct hostapd_data * hostapd_get_primary_bss(struct hostapd_data *hapd);
int hostapd_reload_config(struct hostapd_iface *iface, int reconf);
void hostapd_reconfig_encryption(struct hostapd_data *hapd);
struct hostapd_data *
Index: hostapd-2020-07-02-58b384f4/src/ap/ap_drv_ops.c
===================================================================
--- hostapd-2020-07-02-58b384f4.orig/src/ap/ap_drv_ops.c
+++ hostapd-2020-07-02-58b384f4/src/ap/ap_drv_ops.c
@@ -321,7 +321,7 @@ int hostapd_vlan_if_add(struct hostapd_d
char force_ifname[IFNAMSIZ];
u8 if_addr[ETH_ALEN];
return hostapd_if_add(hapd, WPA_IF_AP_VLAN, ifname, hapd->own_addr,
- NULL, NULL, force_ifname, if_addr, NULL, 0);
+ NULL, NULL, force_ifname, if_addr, NULL, 0, 0, NULL);
}
@@ -497,13 +497,15 @@ int hostapd_set_ssid(struct hostapd_data
int hostapd_if_add(struct hostapd_data *hapd, enum wpa_driver_if_type type,
const char *ifname, const u8 *addr, void *bss_ctx,
void **drv_priv, char *force_ifname, u8 *if_addr,
- const char *bridge, int use_existing)
+ const char *bridge, int use_existing,
+ int multi_bssid_mode, const char *multi_bssid_parent)
{
if (hapd->driver == NULL || hapd->driver->if_add == NULL)
return -1;
return hapd->driver->if_add(hapd->drv_priv, type, ifname, addr,
bss_ctx, drv_priv, force_ifname, if_addr,
- bridge, use_existing, 1);
+ bridge, use_existing, 1,
+ multi_bssid_mode, multi_bssid_parent);
}
Index: hostapd-2020-07-02-58b384f4/src/ap/ap_drv_ops.h
===================================================================
--- hostapd-2020-07-02-58b384f4.orig/src/ap/ap_drv_ops.h
+++ hostapd-2020-07-02-58b384f4/src/ap/ap_drv_ops.h
@@ -54,7 +54,8 @@ int hostapd_set_ssid(struct hostapd_data
int hostapd_if_add(struct hostapd_data *hapd, enum wpa_driver_if_type type,
const char *ifname, const u8 *addr, void *bss_ctx,
void **drv_priv, char *force_ifname, u8 *if_addr,
- const char *bridge, int use_existing);
+ const char *bridge, int use_existin,
+ int multi_bssid_mode, const char *multi_bssid_parent);
int hostapd_if_remove(struct hostapd_data *hapd, enum wpa_driver_if_type type,
const char *ifname);
int hostapd_set_ieee8021x(struct hostapd_data *hapd,
Index: hostapd-2020-07-02-58b384f4/src/ap/beacon.c
===================================================================
--- hostapd-2020-07-02-58b384f4.orig/src/ap/beacon.c
@@ -103,7 +181,7 @@ Index: hostapd-2020-07-02-58b384f4/src/ap/beacon.c
resp = os_zalloc(buflen);
if (resp == NULL)
@@ -527,6 +532,9 @@ static u8 * hostapd_gen_probe_resp(struc
@@ -529,6 +534,9 @@ static u8 * hostapd_gen_probe_resp(struc
pos = hostapd_eid_rm_enabled_capab(hapd, pos, epos - pos);
pos = hostapd_get_mde(hapd, pos, epos - pos);
@@ -113,7 +191,7 @@ Index: hostapd-2020-07-02-58b384f4/src/ap/beacon.c
/* eCSA IE */
csa_pos = hostapd_eid_ecsa(hapd, pos);
if (csa_pos != pos)
@@ -824,6 +832,10 @@ void handle_probe_req(struct hostapd_dat
@@ -826,6 +834,10 @@ void handle_probe_req(struct hostapd_dat
.elems = &elems,
};
@@ -124,7 +202,7 @@ Index: hostapd-2020-07-02-58b384f4/src/ap/beacon.c
if (len < IEEE80211_HDRLEN)
return;
ie = ((const u8 *) mgmt) + IEEE80211_HDRLEN;
@@ -1073,7 +1085,7 @@ void handle_probe_req(struct hostapd_dat
@@ -1075,7 +1087,7 @@ void handle_probe_req(struct hostapd_dat
hapd->cs_c_off_ecsa_proberesp;
}
@@ -133,18 +211,18 @@ Index: hostapd-2020-07-02-58b384f4/src/ap/beacon.c
csa_offs_len ? csa_offs : NULL,
csa_offs_len, 0);
@@ -1473,6 +1485,8 @@ void ieee802_11_free_ap_params(struct wp
@@ -1755,6 +1767,8 @@ void ieee802_11_free_ap_params(struct wp
params->head = NULL;
os_free(params->proberesp);
params->proberesp = NULL;
+ os_free(params->multiple_bssid_ies);
+ params->multiple_bssid_ies = NULL;
}
@@ -1513,6 +1527,25 @@ int ieee802_11_set_beacon(struct hostapd
params.twt_responder = hostapd_get_he_twt_responder(hapd,
IEEE80211_MODE_AP);
#ifdef CONFIG_FILS
os_free(params->fils_discovery_tmpl);
params->fils_discovery_tmpl = NULL;
@@ -1805,6 +1819,22 @@ int ieee802_11_set_beacon(struct hostapd
params.unsol_bcast_probe_resp_tmpl =
hostapd_unsol_bcast_probe_resp(hapd, &params);
#endif /* CONFIG_IEEE80211AX */
+ if (hapd->iconf->multiple_bssid) {
+ int len = hostapd_eid_multiple_bssid_len(hapd);
@@ -152,9 +230,6 @@ Index: hostapd-2020-07-02-58b384f4/src/ap/beacon.c
+
+ params.multiple_bssid_index = hostapd_get_bss_index(hapd);
+ params.multiple_bssid_count = iface->num_bss;
+ params.ema_beacon = hapd->iconf->ema_beacon;
+ if (hapd != hapd->iface->bss[0])
+ params.multiple_bssid_parent = hapd->iface->bss[0]->conf->iface;
+ params.multiple_bssid_ies = os_zalloc(len);
+ if (params.multiple_bssid_ies == NULL)
+ goto fail;
@@ -167,51 +242,287 @@ Index: hostapd-2020-07-02-58b384f4/src/ap/beacon.c
+ }
hapd->reenable_beacon = 0;
if (cmode &&
Index: hostapd-2020-07-02-58b384f4/src/ap/hostapd.c
#ifdef CONFIG_FILS
Index: hostapd-2020-07-02-58b384f4/src/drivers/driver.h
===================================================================
--- hostapd-2020-07-02-58b384f4.orig/src/ap/hostapd.c
+++ hostapd-2020-07-02-58b384f4/src/ap/hostapd.c
@@ -87,6 +87,26 @@ int hostapd_for_each_interface(struct ha
--- hostapd-2020-07-02-58b384f4.orig/src/drivers/driver.h
+++ hostapd-2020-07-02-58b384f4/src/drivers/driver.h
@@ -1222,6 +1222,8 @@ struct wowlan_triggers {
u8 rfkill_release;
};
+#define MULTIPLE_BSSID_IE_MAX 8
+
struct wpa_driver_ap_params {
/**
* head - Beacon head from IEEE 802.11 header to IEs before TIM IE
@@ -1553,6 +1555,41 @@ struct wpa_driver_ap_params {
* Unsolicited broadcast probe response template length
*/
size_t unsol_bcast_probe_resp_tmpl_len;
+
+ /**
+ * multiple_bssid_non_transmitted - Is this a non transmitted BSS
+ */
+ int multiple_bssid_non_transmitted;
+
+ /**
+ * multiple_bssid_index - The index of this BSS in the group
+ */
+ unsigned int multiple_bssid_index;
+
+ /**
+ * multiple_bssid_count - The number of BSSs in the group
+ */
+ unsigned int multiple_bssid_count;
+
+ /**
+ * multiple_bssid_ies - This buffer contains all of the IEs
+ */
+ u8 *multiple_bssid_ies;
+
+ /**
+ * multiple_bssid_ie_len - The IE buffer length
+ */
+ int multiple_bssid_ie_len;
+
+ /**
+ * multiple_bssid_ie_offsets - The offsets to the IEs inside multiple_bssid_ies
+ */
+ u8 *multiple_bssid_ie_offsets[MULTIPLE_BSSID_IE_MAX];
+
+ /**
+ * multiple_bssid_ie_count - The the number of offsets inside multiple_bssid_ie_offsets
+ */
+ int multiple_bssid_ie_count;
};
struct wpa_driver_mesh_bss_params {
@@ -3294,7 +3331,8 @@ struct wpa_driver_ops {
int (*if_add)(void *priv, enum wpa_driver_if_type type,
const char *ifname, const u8 *addr, void *bss_ctx,
void **drv_priv, char *force_ifname, u8 *if_addr,
- const char *bridge, int use_existing, int setup_ap);
+ const char *bridge, int use_existing, int setup_ap,
+ int multi_bssid_mode, const char *multi_bssid_parent);
/**
* if_remove - Remove a virtual interface
Index: hostapd-2020-07-02-58b384f4/wpa_supplicant/driver_i.h
===================================================================
--- hostapd-2020-07-02-58b384f4.orig/wpa_supplicant/driver_i.h
+++ hostapd-2020-07-02-58b384f4/wpa_supplicant/driver_i.h
@@ -444,7 +444,7 @@ static inline int wpa_drv_if_add(struct
if (wpa_s->driver->if_add)
return wpa_s->driver->if_add(wpa_s->drv_priv, type, ifname,
addr, bss_ctx, NULL, force_ifname,
- if_addr, bridge, 0, 0);
+ if_addr, bridge, 0, 0, 0, NULL);
return -1;
}
+int hostapd_get_bss_index(struct hostapd_data *hapd)
+{
+ size_t i;
+
+ for (i = 1; i < hapd->iface->num_bss; i++)
+ if (hapd->iface->bss[i] == hapd)
+ return i;
+ return 0;
+}
+
+
+struct hostapd_data * hostapd_get_primary_bss(struct hostapd_data *hapd)
+{
+ if (hapd->iconf->multiple_bssid)
+ return hapd->iface->bss[0];
+
+ return hapd;
+}
+
+
void hostapd_reconfig_encryption(struct hostapd_data *hapd)
{
if (hapd->wpa_auth)
Index: hostapd-2020-07-02-58b384f4/src/ap/hostapd.h
Index: hostapd-2020-07-02-58b384f4/src/drivers/driver_nl80211.c
===================================================================
--- hostapd-2020-07-02-58b384f4.orig/src/ap/hostapd.h
+++ hostapd-2020-07-02-58b384f4/src/ap/hostapd.h
@@ -598,6 +598,8 @@ struct hostapd_iface {
int hostapd_for_each_interface(struct hapd_interfaces *interfaces,
int (*cb)(struct hostapd_iface *iface,
void *ctx), void *ctx);
+int hostapd_get_bss_index(struct hostapd_data *hapd);
+struct hostapd_data * hostapd_get_primary_bss(struct hostapd_data *hapd);
int hostapd_reload_config(struct hostapd_iface *iface, int reconf);
void hostapd_reconfig_encryption(struct hostapd_data *hapd);
struct hostapd_data *
--- hostapd-2020-07-02-58b384f4.orig/src/drivers/driver_nl80211.c
+++ hostapd-2020-07-02-58b384f4/src/drivers/driver_nl80211.c
@@ -4640,6 +4640,27 @@ static int wpa_driver_nl80211_set_ap(voi
goto fail;
#endif /* CONFIG_FILS */
+ if (params->multiple_bssid_count) {
+ nla_put_u8(msg, NL80211_ATTR_MULTIPLE_BSSID_INDEX,
+ params->multiple_bssid_index);
+ nla_put_u8(msg, NL80211_ATTR_MULTIPLE_BSSID_COUNT,
+ params->multiple_bssid_count);
+ }
+
+ if (params->multiple_bssid_ie_len) {
+ struct nlattr *ies = nla_nest_start(msg, NL80211_ATTR_MULTIPLE_BSSID_IES);
+ u8 **offs = params->multiple_bssid_ie_offsets;
+ int i;
+
+ for (i = 0; i < params->multiple_bssid_ie_count - 1; i++)
+ nla_put(msg, i + 1,
+ offs[i + 1] - offs[i], offs[i]);
+ nla_put(msg, i + 1,
+ *offs + params->multiple_bssid_ie_len - offs[i],
+ offs[i]);
+ nla_nest_end(msg, ies);
+ }
+
ret = send_and_recv_msgs_owner(drv, msg, get_connect_handle(bss), 1,
NULL, NULL, NULL, NULL);
if (ret) {
@@ -5232,13 +5253,13 @@ const char * nl80211_iftype_str(enum nl8
}
}
-
static int nl80211_create_iface_once(struct wpa_driver_nl80211_data *drv,
const char *ifname,
enum nl80211_iftype iftype,
const u8 *addr, int wds,
int (*handler)(struct nl_msg *, void *),
- void *arg)
+ void *arg, int multiple_bssid_non_transmitted,
+ const char *multiple_bssid_parent)
{
struct nl_msg *msg;
int ifidx;
@@ -5267,6 +5288,17 @@ static int nl80211_create_iface_once(str
goto fail;
}
+ if (multiple_bssid_non_transmitted) {
+ if (!multiple_bssid_parent)
+ goto fail;
+ ifidx = if_nametoindex(multiple_bssid_parent);
+ if (ifidx <= 0)
+ goto fail;
+ nla_put_flag(msg, NL80211_ATTR_MULTIPLE_BSSID_NON_TRANSMITTING);
+ nla_put_u32(msg, NL80211_ATTR_MULTIPLE_BSSID_PARENT,
+ ifidx);
+ }
+
/*
* Tell cfg80211 that the interface belongs to the socket that created
* it, and the interface should be deleted when the socket is closed.
@@ -5320,12 +5352,15 @@ int nl80211_create_iface(struct wpa_driv
const char *ifname, enum nl80211_iftype iftype,
const u8 *addr, int wds,
int (*handler)(struct nl_msg *, void *),
- void *arg, int use_existing)
+ void *arg, int use_existing,
+ int multiple_bssid_non_transmitted,
+ const char *multiple_bssid_parent)
{
int ret;
ret = nl80211_create_iface_once(drv, ifname, iftype, addr, wds, handler,
- arg);
+ arg, multiple_bssid_non_transmitted,
+ multiple_bssid_parent);
/* if error occurred and interface exists already */
if (ret == -ENFILE && if_nametoindex(ifname)) {
@@ -5351,7 +5386,9 @@ int nl80211_create_iface(struct wpa_driv
/* Try to create the interface again */
ret = nl80211_create_iface_once(drv, ifname, iftype, addr,
- wds, handler, arg);
+ wds, handler, arg,
+ multiple_bssid_non_transmitted,
+ multiple_bssid_parent);
}
if (ret >= 0 && is_p2p_net_interface(iftype)) {
@@ -7331,7 +7368,7 @@ static int i802_set_wds_sta(void *priv,
if (!if_nametoindex(name)) {
if (nl80211_create_iface(drv, name,
NL80211_IFTYPE_AP_VLAN,
- bss->addr, 1, NULL, NULL, 0) <
+ bss->addr, 1, NULL, NULL, 0, 0, NULL) <
0)
return -1;
if (bridge_ifname &&
@@ -7678,7 +7715,9 @@ static int wpa_driver_nl80211_if_add(voi
void *bss_ctx, void **drv_priv,
char *force_ifname, u8 *if_addr,
const char *bridge, int use_existing,
- int setup_ap)
+ int setup_ap,
+ int multiple_bssid_non_transmitted,
+ const char *multiple_bssid_parent)
{
enum nl80211_iftype nlmode;
struct i802_bss *bss = priv;
@@ -7695,7 +7734,8 @@ static int wpa_driver_nl80211_if_add(voi
os_memset(&p2pdev_info, 0, sizeof(p2pdev_info));
ifidx = nl80211_create_iface(drv, ifname, nlmode, addr,
0, nl80211_wdev_handler,
- &p2pdev_info, use_existing);
+ &p2pdev_info, use_existing,
+ 0, NULL);
if (!p2pdev_info.wdev_id_set || ifidx != 0) {
wpa_printf(MSG_ERROR, "nl80211: Failed to create a P2P Device interface %s",
ifname);
@@ -7711,7 +7751,9 @@ static int wpa_driver_nl80211_if_add(voi
(long long unsigned int) p2pdev_info.wdev_id);
} else {
ifidx = nl80211_create_iface(drv, ifname, nlmode, addr,
- 0, NULL, NULL, use_existing);
+ 0, NULL, NULL, use_existing,
+ multiple_bssid_non_transmitted,
+ multiple_bssid_parent);
if (use_existing && ifidx == -ENFILE) {
added = 0;
ifidx = if_nametoindex(ifname);
Index: hostapd-2020-07-02-58b384f4/src/drivers/driver_nl80211.h
===================================================================
--- hostapd-2020-07-02-58b384f4.orig/src/drivers/driver_nl80211.h
+++ hostapd-2020-07-02-58b384f4/src/drivers/driver_nl80211.h
@@ -240,7 +240,9 @@ int nl80211_create_iface(struct wpa_driv
const char *ifname, enum nl80211_iftype iftype,
const u8 *addr, int wds,
int (*handler)(struct nl_msg *, void *),
- void *arg, int use_existing);
+ void *arg, int use_existing,
+ int multi_bssid_mode,
+ const char *multi_bssid_parent);
void nl80211_remove_iface(struct wpa_driver_nl80211_data *drv, int ifidx);
unsigned int nl80211_get_assoc_freq(struct wpa_driver_nl80211_data *drv);
int nl80211_get_assoc_ssid(struct wpa_driver_nl80211_data *drv, u8 *ssid);
Index: hostapd-2020-07-02-58b384f4/src/drivers/driver_nl80211_monitor.c
===================================================================
--- hostapd-2020-07-02-58b384f4.orig/src/drivers/driver_nl80211_monitor.c
+++ hostapd-2020-07-02-58b384f4/src/drivers/driver_nl80211_monitor.c
@@ -381,7 +381,7 @@ int nl80211_create_monitor_interface(str
drv->monitor_ifidx =
nl80211_create_iface(drv, buf, NL80211_IFTYPE_MONITOR, NULL,
- 0, NULL, NULL, 0);
+ 0, NULL, NULL, 0, 0, NULL);
if (drv->monitor_ifidx == -EOPNOTSUPP) {
/*
Index: hostapd-2020-07-02-58b384f4/src/drivers/nl80211_copy.h
===================================================================
--- hostapd-2020-07-02-58b384f4.orig/src/drivers/nl80211_copy.h
+++ hostapd-2020-07-02-58b384f4/src/drivers/nl80211_copy.h
@@ -2522,6 +2522,20 @@ enum nl80211_commands {
* unsolicited broadcast probe response. It is a nested attribute, see
* &enum nl80211_unsol_bcast_probe_resp_attributes.
*
+ * @NL80211_ATTR_MULTIPLE_BSSID_NON_TRANSMITTING: Set the Non-Transmitted flag for this
+ * BSSIDs beacon.
+ *
+ * @NL80211_ATTR_MULTIPLE_BSSID_PARENT: If this is a Non-Transmitted BSSID, define
+ * the parent (transmitting) interface.
+ *
+ * @NL80211_ATTR_MULTIPLE_BSSID_INDEX: The index of this BSS inside the multi bssid
+ * element.
+ *
+ * @NL80211_ATTR_MULTIPLE_BSSID_COUNT: The number of BSSs inside the multi bssid element.
+ *
+ * @NL80211_ATTR_MULTIPLE_BSSID_IES: The Elements that describe our multiple BSS group.
+ * these get passed separately as the kernel might need to split them up for EMA VAP.
+ *
* @NUM_NL80211_ATTR: total number of nl80211_attrs available
* @NL80211_ATTR_MAX: highest attribute number currently defined
* @__NL80211_ATTR_AFTER_LAST: internal use
@@ -3010,6 +3024,12 @@ enum nl80211_attrs {
NL80211_ATTR_UNSOL_BCAST_PROBE_RESP,
+ NL80211_ATTR_MULTIPLE_BSSID_NON_TRANSMITTING,
+ NL80211_ATTR_MULTIPLE_BSSID_PARENT,
+ NL80211_ATTR_MULTIPLE_BSSID_INDEX,
+ NL80211_ATTR_MULTIPLE_BSSID_COUNT,
+ NL80211_ATTR_MULTIPLE_BSSID_IES,
+
/* add attributes here, update the policy in nl80211.c */
__NL80211_ATTR_AFTER_LAST,
Index: hostapd-2020-07-02-58b384f4/src/ap/ieee802_11.c
===================================================================
--- hostapd-2020-07-02-58b384f4.orig/src/ap/ieee802_11.c
@@ -246,7 +557,7 @@ Index: hostapd-2020-07-02-58b384f4/src/ap/ieee802_11.c
hostapd_logger(hapd, mgmt->sa, HOSTAPD_MODULE_IEEE80211,
HOSTAPD_LEVEL_INFO, "No room for more AIDs");
resp = WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA;
@@ -5645,4 +5650,127 @@ u8 * hostapd_eid_wb_chsw_wrapper(struct
@@ -5645,4 +5650,117 @@ u8 * hostapd_eid_wb_chsw_wrapper(struct
return eid;
}
@@ -299,7 +610,7 @@ Index: hostapd-2020-07-02-58b384f4/src/ap/ieee802_11.c
+
+ for (i = *count; i < hapd->iface->num_bss; i++) {
+ struct hostapd_data *bss = hapd->iface->bss[i];
+ u8 *bss_size_offset, *index_size_offset, *pos = eid, *rsn;
+ u8 *bss_size_offset, *index_size_offset, *pos = eid;
+ u16 capab_info;
+
+ *eid++ = WLAN_EID_SUBELEMENT_NONTRANSMITTED_BSSID_PROFILE;
@@ -325,17 +636,7 @@ Index: hostapd-2020-07-02-58b384f4/src/ap/ieee802_11.c
+ }
+ *index_size_offset = (eid - index_size_offset) - 1;
+
+ rsn = hostapd_get_rsne(bss, eid, end - eid);
+ if (rsn == eid) {
+ /* add RSN non-inheritance IE */
+ *eid++ = WLAN_EID_EXTENSION;
+ *eid++ = 3;
+ *eid++ = WLAN_EID_EXT_NON_INHERITANCE;
+ *eid++ = 1;
+ *eid++ = WLAN_EID_RSN;
+ } else {
+ eid = rsn;
+ }
+ eid = hostapd_get_rsne(bss, eid, end - eid);
+ *bss_size_offset = (eid - bss_size_offset) - 1;
+
+ if ((eid - size_offset) - 1 > 255) {
@@ -378,37 +679,25 @@ Index: hostapd-2020-07-02-58b384f4/src/ap/ieee802_11.h
===================================================================
--- hostapd-2020-07-02-58b384f4.orig/src/ap/ieee802_11.h
+++ hostapd-2020-07-02-58b384f4/src/ap/ieee802_11.h
@@ -119,6 +119,10 @@ u8 * hostapd_eid_time_zone(struct hostap
@@ -119,7 +119,10 @@ u8 * hostapd_eid_time_zone(struct hostap
int hostapd_update_time_adv(struct hostapd_data *hapd);
void hostapd_client_poll_ok(struct hostapd_data *hapd, const u8 *addr);
u8 * hostapd_eid_bss_max_idle_period(struct hostapd_data *hapd, u8 *eid);
-
+u8 * hostapd_eid_multiple_bssid(struct hostapd_data *hapd, u8 *eid, u8 *end,
+ u8 is_beacon, u8 **eid_offsets, int *eid_count,
+ int eid_max);
+int hostapd_eid_multiple_bssid_len(struct hostapd_data *hapd);
int auth_sae_init_committed(struct hostapd_data *hapd, struct sta_info *sta);
#ifdef CONFIG_SAE
@@ -194,5 +198,6 @@ int get_tx_parameters(struct sta_info *s
void sae_clear_retransmit_timer(struct hostapd_data *hapd,
@@ -197,5 +200,6 @@ int get_tx_parameters(struct sta_info *s
void auth_sae_process_commit(void *eloop_ctx, void *user_ctx);
u8 * hostapd_eid_rsnxe(struct hostapd_data *hapd, u8 *eid, size_t len);
+u8 * hostapd_get_rsne(struct hostapd_data *hapd, u8 *pos, size_t len);
#endif /* IEEE802_11_H */
Index: hostapd-2020-07-02-58b384f4/src/ap/ieee802_11_shared.c
===================================================================
--- hostapd-2020-07-02-58b384f4.orig/src/ap/ieee802_11_shared.c
+++ hostapd-2020-07-02-58b384f4/src/ap/ieee802_11_shared.c
@@ -356,6 +356,8 @@ static void hostapd_ext_capab_byte(struc
*pos |= 0x02; /* Bit 17 - WNM-Sleep Mode */
if (hapd->conf->bss_transition)
*pos |= 0x08; /* Bit 19 - BSS Transition */
+ if (hapd->iconf->multiple_bssid)
+ *pos |= 0x40; /* Bit 22 - Multiple BSSID */
break;
case 3: /* Bits 24-31 */
#ifdef CONFIG_WNM_AP
Index: hostapd-2020-07-02-58b384f4/src/common/ieee802_11_defs.h
===================================================================
--- hostapd-2020-07-02-58b384f4.orig/src/common/ieee802_11_defs.h
@@ -422,121 +711,16 @@ Index: hostapd-2020-07-02-58b384f4/src/common/ieee802_11_defs.h
/* Element ID Extension (EID 255) values */
#define WLAN_EID_EXT_ASSOC_DELAY_INFO 1
#define WLAN_EID_EXT_FILS_REQ_PARAMS 2
@@ -474,6 +476,7 @@
#define WLAN_EID_EXT_HE_MU_EDCA_PARAMS 38
#define WLAN_EID_EXT_SPATIAL_REUSE 39
#define WLAN_EID_EXT_OCV_OCI 54
+#define WLAN_EID_EXT_NON_INHERITANCE 56
#define WLAN_EID_EXT_SHORT_SSID_LIST 58
#define WLAN_EID_EXT_HE_6GHZ_BAND_CAP 59
#define WLAN_EID_EXT_EDMG_CAPABILITIES 61
Index: hostapd-2020-07-02-58b384f4/src/drivers/driver.h
Index: hostapd-2020-07-02-58b384f4/src/ap/ieee802_11_shared.c
===================================================================
--- hostapd-2020-07-02-58b384f4.orig/src/drivers/driver.h
+++ hostapd-2020-07-02-58b384f4/src/drivers/driver.h
@@ -1216,6 +1216,8 @@ struct wowlan_triggers {
u8 rfkill_release;
};
+#define MULTIPLE_BSSID_IE_MAX 8
+
struct wpa_driver_ap_params {
/**
* head - Beacon head from IEEE 802.11 header to IEs before TIM IE
@@ -1512,6 +1514,46 @@ struct wpa_driver_ap_params {
* twt_responder - Whether Target Wait Time responder is enabled
*/
int twt_responder;
+
+ /**
+ * multiple_bssid_parent - The transmitting iface
+ */
+ const char *multiple_bssid_parent;
+
+ /**
+ * multiple_bssid_index - The index of this BSS in the group
+ */
+ unsigned int multiple_bssid_index;
+
+ /**
+ * multiple_bssid_count - The number of BSSs in the group
+ */
+ unsigned int multiple_bssid_count;
+
+ /**
+ * multiple_bssid_ies - This buffer contains all of the IEs
+ */
+ u8 *multiple_bssid_ies;
+
+ /**
+ * multiple_bssid_ie_len - The IE buffer length
+ */
+ int multiple_bssid_ie_len;
+
+ /**
+ * multiple_bssid_ie_offsets - The offsets to the IEs inside multiple_bssid_ies
+ */
+ u8 *multiple_bssid_ie_offsets[MULTIPLE_BSSID_IE_MAX];
+
+ /**
+ * multiple_bssid_ie_count - The the number of offsets inside multiple_bssid_ie_offsets
+ */
+ int multiple_bssid_ie_count;
+
+ /**
+ * ema_beacon - should the multiple_bssid beacons be sent out in EMA mode
+ */
+ int ema_beacon;
};
struct wpa_driver_mesh_bss_params {
Index: hostapd-2020-07-02-58b384f4/src/drivers/driver_nl80211.c
===================================================================
--- hostapd-2020-07-02-58b384f4.orig/src/drivers/driver_nl80211.c
+++ hostapd-2020-07-02-58b384f4/src/drivers/driver_nl80211.c
@@ -4562,6 +4562,37 @@ static int wpa_driver_nl80211_set_ap(voi
}
#endif /* CONFIG_IEEE80211AX */
+ if (params->multiple_bssid_count) {
+ nla_put_u8(msg, NL80211_ATTR_MULTIPLE_BSSID_INDEX,
+ params->multiple_bssid_index);
+ nla_put_u8(msg, NL80211_ATTR_MULTIPLE_BSSID_COUNT,
+ params->multiple_bssid_count);
+ if (params->ema_beacon)
+ nla_put_flag(msg, NL80211_ATTR_MULTIPLE_BSSID_EMA);
+ }
+
+ if (params->multiple_bssid_parent) {
+ int ifidx = if_nametoindex(params->multiple_bssid_parent);
+ if (ifidx <= 0)
+ goto fail;
+ nla_put_u32(msg, NL80211_ATTR_MULTIPLE_BSSID_PARENT,
+ ifidx);
+ }
+
+ if (params->multiple_bssid_ie_len) {
+ struct nlattr *ies = nla_nest_start(msg, NL80211_ATTR_MULTIPLE_BSSID_IES);
+ u8 **offs = params->multiple_bssid_ie_offsets;
+ int i;
+
+ for (i = 0; i < params->multiple_bssid_ie_count - 1; i++)
+ nla_put(msg, i + 1,
+ offs[i + 1] - offs[i], offs[i]);
+ nla_put(msg, i + 1,
+ *offs + params->multiple_bssid_ie_len - offs[i],
+ offs[i]);
+ nla_nest_end(msg, ies);
+ }
+
ret = send_and_recv_msgs_owner(drv, msg, get_connect_handle(bss), 1,
NULL, NULL, NULL, NULL);
if (ret) {
@@ -5154,7 +5185,6 @@ const char * nl80211_iftype_str(enum nl8
}
}
-
static int nl80211_create_iface_once(struct wpa_driver_nl80211_data *drv,
const char *ifname,
enum nl80211_iftype iftype,
--- hostapd-2020-07-02-58b384f4.orig/src/ap/ieee802_11_shared.c
+++ hostapd-2020-07-02-58b384f4/src/ap/ieee802_11_shared.c
@@ -356,6 +356,8 @@ static void hostapd_ext_capab_byte(struc
*pos |= 0x02; /* Bit 17 - WNM-Sleep Mode */
if (hapd->conf->bss_transition)
*pos |= 0x08; /* Bit 19 - BSS Transition */
+ if (hapd->iconf->multiple_bssid)
+ *pos |= 0x40; /* Bit 22 - Multiple BSSID */
break;
case 3: /* Bits 24-31 */
#ifdef CONFIG_WNM_AP

View File

@@ -1,7 +1,7 @@
From 35e8a6d7f2ae34a1df281e3349cebee4d1a1b045 Mon Sep 17 00:00:00 2001
From 96900cbc6ec0fa1af02458f7700301cbb1b56ca3 Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Thu, 18 Jun 2020 17:21:53 +0200
Subject: [PATCH 810/813] rnr: move crc32 generation to config load time
Date: Wed, 24 Jun 2020 15:12:09 +0200
Subject: [PATCH 1/4] RNR: move crc32 generation to config load time
During config reload the short_ssid was getting flushed. Move the
generation into the config loading code.
@@ -13,7 +13,7 @@ Signed-off-by: John Crispin <john@phrozen.org>
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/hostapd/config_file.c b/hostapd/config_file.c
index 9db6d159a..d7aa85e72 100644
index 38d1dd7ac4ed..95cd779ec8a0 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -13,6 +13,7 @@
@@ -38,7 +38,7 @@ index 9db6d159a..d7aa85e72 100644
size_t slen;
char *str = wpa_config_parse_string(pos, &slen);
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
index 1992b38d6..f51083a23 100644
index a23e05e556e9..bbb2c642bd19 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -13,7 +13,6 @@
@@ -49,7 +49,7 @@ index 1992b38d6..f51083a23 100644
#include "common/ieee802_11_defs.h"
#include "common/wpa_ctrl.h"
#include "common/hw_features_common.h"
@@ -1244,12 +1243,6 @@ static int hostapd_setup_bss(struct hostapd_data *hapd, int first)
@@ -1247,12 +1246,6 @@ static int hostapd_setup_bss(struct hostapd_data *hapd, int first)
os_memcpy(conf->ssid.ssid, ssid, conf->ssid.ssid_len);
}
@@ -63,5 +63,4 @@ index 1992b38d6..f51083a23 100644
wpa_printf(MSG_DEBUG, "Using interface %s with hwaddr " MACSTR
" and ssid \"%s\"",
--
2.25.1
2.17.1

View File

@@ -1,12 +1,12 @@
From 9eba95a674dc7e65fd6c4ba34eb1ed9db1d2dafa Mon Sep 17 00:00:00 2001
From ce618acbef40f8a411e7458f3fece26930b538d0 Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Thu, 18 Jun 2020 17:35:42 +0200
Subject: [PATCH 811/813] rnr: add bss_parameters to the neighbor_db
Date: Thu, 16 Jul 2020 17:05:45 -0700
Subject: [PATCH 2/4] RNR: add bss_parameters to the neighbor_db
P802.11ax/D4.0 9.4.2.170 (Reduced Neighbor Report element) described this
field used inside reduced neighbor reports. It holds info about multiple
bssid and 6G co-location which was not present in the existing neighbor
reports.
P802.11ax/D4.0 9.4.2.170 (Reduced Neighbor Report element) described
this field used inside reduced neighbor reports. It holds info about
multiple ssid and 6G co-location which was not present in the
existing neighbor reports.
Signed-off-by: John Crispin <john@phrozen.org>
---
@@ -17,10 +17,10 @@ Signed-off-by: John Crispin <john@phrozen.org>
4 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
index f99849771..00b20a349 100644
index 0a5712e33305..f61210d5e282 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
@@ -3006,6 +3006,7 @@ static int hostapd_ctrl_iface_set_neighbor(struct hostapd_data *hapd, char *buf)
@@ -3004,6 +3004,7 @@ static int hostapd_ctrl_iface_set_neighbor(struct hostapd_data *hapd, char *buf)
u8 bssid[ETH_ALEN];
struct wpabuf *nr, *lci = NULL, *civic = NULL;
int stationary = 0;
@@ -28,7 +28,7 @@ index f99849771..00b20a349 100644
char *tmp;
int ret;
@@ -3090,9 +3091,22 @@ static int hostapd_ctrl_iface_set_neighbor(struct hostapd_data *hapd, char *buf)
@@ -3088,9 +3089,22 @@ static int hostapd_ctrl_iface_set_neighbor(struct hostapd_data *hapd, char *buf)
if (os_strstr(buf, "stat"))
stationary = 1;
@@ -53,10 +53,10 @@ index f99849771..00b20a349 100644
wpabuf_free(nr);
wpabuf_free(lci);
diff --git a/src/ap/hostapd.h b/src/ap/hostapd.h
index 19dcd1b51..a9050ebac 100644
index cab845714135..e7eacd235fa5 100644
--- a/src/ap/hostapd.h
+++ b/src/ap/hostapd.h
@@ -138,6 +138,7 @@ struct hostapd_neighbor_entry {
@@ -139,6 +139,7 @@ struct hostapd_neighbor_entry {
/* LCI update time */
struct os_time lci_date;
int stationary;
@@ -65,7 +65,7 @@ index 19dcd1b51..a9050ebac 100644
struct hostapd_sae_commit_queue {
diff --git a/src/ap/neighbor_db.c b/src/ap/neighbor_db.c
index 3a4cdc004..eaf0650f1 100644
index 97840681247b..4f8233c78bf3 100644
--- a/src/ap/neighbor_db.c
+++ b/src/ap/neighbor_db.c
@@ -120,7 +120,8 @@ hostapd_neighbor_add(struct hostapd_data *hapd)
@@ -86,7 +86,7 @@ index 3a4cdc004..eaf0650f1 100644
return 0;
@@ -314,7 +316,7 @@ void hostapd_neighbor_set_own_report(struct hostapd_data *hapd)
@@ -329,7 +331,7 @@ void hostapd_neighbor_set_own_report(struct hostapd_data *hapd)
wpabuf_put_u8(nr, center_freq2_idx);
hostapd_neighbor_set(hapd, hapd->own_addr, &ssid, nr, hapd->iconf->lci,
@@ -96,7 +96,7 @@ index 3a4cdc004..eaf0650f1 100644
wpabuf_free(nr);
#endif /* NEED_AP_MLME */
diff --git a/src/ap/neighbor_db.h b/src/ap/neighbor_db.h
index bed0a2f5f..992671b62 100644
index f15ea1aa411d..2b20d8920018 100644
--- a/src/ap/neighbor_db.h
+++ b/src/ap/neighbor_db.h
@@ -17,7 +17,8 @@ int hostapd_neighbor_show(struct hostapd_data *hapd, char *buf, size_t buflen);
@@ -107,8 +107,7 @@ index bed0a2f5f..992671b62 100644
+ const struct wpabuf *civic, int stationary,
+ u8 bss_parameters);
void hostapd_neighbor_set_own_report(struct hostapd_data *hapd);
int hostapd_neighbor_remove(struct hostapd_data *hapd, const u8 *bssid,
const struct wpa_ssid_value *ssid);
int hostapd_prepare_neighbor_buf(struct hostapd_data *hapd,
const u8 *bssid, struct wpabuf *nrbuf);
--
2.25.1
2.17.1

View File

@@ -1,9 +1,9 @@
From 09978262c7d7d3d23b51afbbace502e6178c7c87 Mon Sep 17 00:00:00 2001
From 1e28f602d70af2cc2c956d9bb41f09a248f5150f Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Thu, 18 Jun 2020 18:16:25 +0200
Subject: [PATCH 812/813] rnr: add short_ssid to neighbor_db entries
Date: Wed, 24 Jun 2020 15:12:11 +0200
Subject: [PATCH 3/4] RNR: add short_ssid to neighbor_db entries
The rnr IE requires this field.
The RNR IE requires this field.
Signed-off-by: John Crispin <john@phrozen.org>
---
@@ -12,10 +12,10 @@ Signed-off-by: John Crispin <john@phrozen.org>
2 files changed, 3 insertions(+)
diff --git a/src/ap/hostapd.h b/src/ap/hostapd.h
index a9050ebac..72cb8bd4f 100644
index e7eacd235fa5..16ffeeb4ac82 100644
--- a/src/ap/hostapd.h
+++ b/src/ap/hostapd.h
@@ -139,6 +139,7 @@ struct hostapd_neighbor_entry {
@@ -140,6 +140,7 @@ struct hostapd_neighbor_entry {
struct os_time lci_date;
int stationary;
u8 bss_parameters;
@@ -24,7 +24,7 @@ index a9050ebac..72cb8bd4f 100644
struct hostapd_sae_commit_queue {
diff --git a/src/ap/neighbor_db.c b/src/ap/neighbor_db.c
index eaf0650f1..b042b1daf 100644
index 4f8233c78bf3..06f6691342a0 100644
--- a/src/ap/neighbor_db.c
+++ b/src/ap/neighbor_db.c
@@ -10,6 +10,7 @@
@@ -44,5 +44,4 @@ index eaf0650f1..b042b1daf 100644
entry->nr = wpabuf_dup(nr);
if (!entry->nr)
--
2.25.1
2.17.1

View File

@@ -0,0 +1,200 @@
From: John Crispin <john@phrozen.org>
Date: Thu, 16 Jul 2020 17:31:40 -0700
Subject: [PATCH 4/4] RNR: add reduced neighbor reporting
The Reduced Neighbor Report (RNR) element contains channel and other
information related to neighbor APs. It is part of the OCE requirement.
Fix bssid field in RNR when there are multiple BSS.
Signed-off-by: John Crispin <john@phrozen.org>
Signed-off-by: Pradeep Kumar Chitrapu <pradeepc@codeaurora.org>
---
hostapd/config_file.c | 2 +
hostapd/hostapd.conf | 3 ++
src/ap/ap_config.h | 1 +
src/ap/beacon.c | 2 +
src/ap/ieee802_11.c | 89 ++++++++++++++++++++++++++++++++++++
src/ap/ieee802_11.h | 2 +
src/common/ieee802_11_defs.h | 14 ++++++
7 files changed, 113 insertions(+)
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -4592,6 +4592,8 @@ static int hostapd_config_fill(struct ho
#endif /* CONFIG_MACSEC */
} else if (os_strcmp(buf, "multiple_bssid") == 0) {
conf->multiple_bssid = atoi(pos);
+ } else if (os_strcmp(buf, "rnr_beacon") == 0) {
+ bss->rnr_beacon = atoi(pos);
} else {
wpa_printf(MSG_ERROR,
"Line %d: unknown configuration item '%s'",
--- a/hostapd/hostapd.conf
+++ b/hostapd/hostapd.conf
@@ -2786,6 +2786,9 @@ own_ip_addr=127.0.0.1
# that allows sending of such data. Default: 0.
#stationary_ap=0
+# Enable reduced neighbour reporting (RNR)
+#rnr_beacon=0
+
##### Airtime policy configuration ###########################################
# Set the airtime policy operating mode:
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -869,6 +869,7 @@ struct hostapd_bss_config {
#endif /* CONFIG_MACSEC */
u32 unsol_bcast_probe_resp_interval;
+ u8 rnr_beacon;
};
/**
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -1475,6 +1475,7 @@ int ieee802_11_build_ap_params(struct ho
tail_len += hostapd_mbo_ie_len(hapd);
tail_len += hostapd_eid_owe_trans_len(hapd);
tail_len += hostapd_eid_dpp_cc_len(hapd);
+ tail_len += hostapd_eid_reduced_neighbor_report_len(hapd);
tailpos = tail = os_malloc(tail_len);
if (head == NULL || tail == NULL) {
@@ -1648,6 +1649,7 @@ int ieee802_11_build_ap_params(struct ho
tailpos = hostapd_eid_owe_trans(hapd, tailpos,
tail + tail_len - tailpos);
tailpos = hostapd_eid_dpp_cc(hapd, tailpos, tail + tail_len - tailpos);
+ tailpos = hostapd_eid_reduced_neighbor_report(hapd, tailpos);
if (hapd->conf->vendor_elements) {
os_memcpy(tailpos, wpabuf_head(hapd->conf->vendor_elements),
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -5762,4 +5762,93 @@ u8 * hostapd_eid_multiple_bssid(struct h
return eid;
}
+
+size_t hostapd_eid_reduced_neighbor_report_len(struct hostapd_data *hapd)
+{
+ size_t len = 0;
+
+ if (hapd->iface->num_bss > 1)
+ len += TBTT_HEADER_LENGTH + ((hapd->iface->num_bss - 1) * TBTT_INFO_LENGTH);
+ if (!dl_list_empty(&hapd->nr_db))
+ len += dl_list_len(&hapd->nr_db) * (TBTT_HEADER_LENGTH + TBTT_INFO_LENGTH);
+
+ return len;
+}
+
+
+u8 * hostapd_eid_reduced_neighbor_report(struct hostapd_data *hapd, u8 *eid)
+{
+ size_t len = hostapd_eid_reduced_neighbor_report_len(hapd);
+ struct hostapd_neighbor_entry *nr;
+ int i, count = 0;
+
+ if (!len)
+ return eid;
+
+ *eid++ = WLAN_EID_REDUCED_NEIGHBOR_REPORT;
+ *eid++ = len;
+
+ if (hapd->iface->num_bss > 1) {
+ u8 op_class, channel;
+
+ if (!(hapd->iface->drv_flags & WPA_DRIVER_FLAGS_AP_CSA) ||
+ !hapd->iface->freq)
+ goto nr_db;
+
+ if (ieee80211_freq_to_channel_ext(hapd->iface->freq,
+ hapd->iconf->secondary_channel,
+ hostapd_get_oper_chwidth(hapd->iconf),
+ &op_class, &channel) ==
+ NUM_HOSTAPD_MODES)
+ goto nr_db;
+
+ *eid++ = TBTT_INFO_COUNT(hapd->iface->num_bss - 2);
+ *eid++ = TBTT_INFO_LENGTH;
+ *eid++ = op_class;
+ *eid++ = hapd->iconf->channel;
+ for (i = 0; i < hapd->iface->num_bss; i++) {
+ u8 bss_param = 0;
+
+ if (hapd->iface->bss[i] == hapd)
+ continue;
+ *eid++ = TBTT_AP_OFFSET_UNKNOWN;
+ os_memcpy(eid, hapd->iface->bss[i]->conf->bssid, ETH_ALEN);
+ eid += 6;
+ os_memcpy(eid, &hapd->iface->bss[i]->conf->ssid.short_ssid, 4);
+ eid += 4;
+ if (hapd->iface->bss[i]->conf->ssid.short_ssid ==
+ hapd->conf->ssid.short_ssid)
+ bss_param |= TBTT_BSS_PARAM_SAME_SSID;
+ if (hapd->iconf->multiple_bssid)
+ bss_param |= TBTT_BSS_PARAM_MULTIPLE_BSSID;
+ *eid++ = bss_param;
+ count++;
+ }
+ }
+
+nr_db:
+ dl_list_for_each(nr, &hapd->nr_db, struct hostapd_neighbor_entry,
+ list) {
+ if (!nr->nr || wpabuf_len(nr->nr) < 12)
+ continue;
+ if (nr->short_ssid == hapd->conf->ssid.short_ssid)
+ continue;
+ *eid++ = 0;
+ *eid++ = TBTT_INFO_LENGTH;
+ *eid++ = wpabuf_head_u8(nr->nr)[10];
+ *eid++ = wpabuf_head_u8(nr->nr)[11];
+ *eid++ = TBTT_AP_OFFSET_UNKNOWN;
+ os_memcpy(eid, nr->bssid, ETH_ALEN);
+ eid += 6;
+ os_memcpy(eid, &nr->short_ssid, 4);
+ eid += 4;
+ *eid++ = nr->bss_parameters;
+ count++;
+ }
+
+ if (!count)
+ eid -= 2;
+ return eid;
+}
+
#endif /* CONFIG_NATIVE_WINDOWS */
--- a/src/ap/ieee802_11.h
+++ b/src/ap/ieee802_11.h
@@ -123,6 +123,8 @@ u8 * hostapd_eid_multiple_bssid(struct h
u8 is_beacon, u8 **eid_offsets, int *eid_count,
int eid_max);
int hostapd_eid_multiple_bssid_len(struct hostapd_data *hapd);
+u8 * hostapd_eid_reduced_neighbor_report(struct hostapd_data *hapd, u8 *eid);
+size_t hostapd_eid_reduced_neighbor_report_len(struct hostapd_data *hapd);
int auth_sae_init_committed(struct hostapd_data *hapd, struct sta_info *sta);
#ifdef CONFIG_SAE
void sae_clear_retransmit_timer(struct hostapd_data *hapd,
--- a/src/common/ieee802_11_defs.h
+++ b/src/common/ieee802_11_defs.h
@@ -2387,4 +2387,18 @@ enum edmg_bw_config {
*/
#define FILS_DISCOVERY_CAP_PHY_INDEX_HE 4
#define FILS_DISCOVERY_MAX_INTERVAL_6GHZ 20
+
+/* TBTT Information field defines */
+#define TBTT_HEADER_LENGTH 4
+#define TBTT_INFO_LENGTH 12
+#define TBTT_INFO_FILTERED_NEIGH_AP BIT(2)
+#define TBTT_INFO_COUNT(x) (((x) & 0xf) << 4)
+#define TBTT_AP_OFFSET_UNKNOWN 255
+#define TBTT_BSS_PARAM_OCT_RECOMMENDED BIT(0)
+#define TBTT_BSS_PARAM_SAME_SSID BIT(1)
+#define TBTT_BSS_PARAM_MULTIPLE_BSSID BIT(2)
+#define TBTT_BSS_PARAM_TRANSMITTED_BSSID BIT(3)
+#define TBTT_BSS_PARAM_CO_LOCATED_ESS BIT(4)
+#define TBTT_BSS_PARAM_20_TU_PROBE_RESP_ACTIVE BIT(5)
+
#endif /* IEEE802_11_DEFS_H */

View File

@@ -1,14 +1,12 @@
Index: hostapd-2020-07-02-58b384f4/src/drivers/driver_nl80211.c
===================================================================
--- hostapd-2020-07-02-58b384f4.orig/src/drivers/driver_nl80211.c
+++ hostapd-2020-07-02-58b384f4/src/drivers/driver_nl80211.c
@@ -4886,6 +4886,14 @@ static int wpa_driver_nl80211_sta_add(vo
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -4960,6 +4960,14 @@ static int wpa_driver_nl80211_sta_add(vo
goto fail;
}
+ if (params->he_6ghz_capab) {
+ wpa_hexdump(MSG_DEBUG, " * he_6ghz_capab",
+ params->he_6ghz_capab, sizeof(*params->he_6ghz_capab));
+ (u8 *) params->he_6ghz_capab, sizeof(*params->he_6ghz_capab));
+ if (nla_put(msg, NL80211_ATTR_HE_6GHZ_CAPABILITY,
+ sizeof(*params->he_6ghz_capab), params->he_6ghz_capab))
+ goto fail;
@@ -17,24 +15,8 @@ Index: hostapd-2020-07-02-58b384f4/src/drivers/driver_nl80211.c
if (params->ext_capab) {
wpa_hexdump(MSG_DEBUG, " * ext_capab",
params->ext_capab, params->ext_capab_len);
Index: hostapd-2020-07-02-58b384f4/src/ap/hostapd.c
===================================================================
--- hostapd-2020-07-02-58b384f4.orig/src/ap/hostapd.c
+++ hostapd-2020-07-02-58b384f4/src/ap/hostapd.c
@@ -1766,6 +1766,9 @@ static int setup_interface2(struct hosta
ch_width = op_class_to_ch_width(iface->conf->op_class);
hostapd_set_oper_chwidth(iface->conf, ch_width);
+ if (is_6ghz_op_class(iface->conf->op_class) && !iface->conf->secondary_channel &&
+ center_idx_to_bw_6ghz(iface->conf->he_oper_centr_freq_seg0_idx))
+ iface->conf->secondary_channel = (((iface->conf->channel - 1) / 4 ) % 2) ? -1 : 1 ;
}
ret = hostapd_select_hw_mode(iface);
Index: hostapd-2020-07-02-58b384f4/src/common/ieee802_11_common.c
===================================================================
--- hostapd-2020-07-02-58b384f4.orig/src/common/ieee802_11_common.c
+++ hostapd-2020-07-02-58b384f4/src/common/ieee802_11_common.c
--- a/src/common/ieee802_11_common.c
+++ b/src/common/ieee802_11_common.c
@@ -884,6 +884,7 @@ enum hostapd_hw_mode ieee80211_freq_to_c
u8 *op_class, u8 *channel)
{

View File

@@ -0,0 +1,62 @@
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -563,7 +563,6 @@ static u8 * hostapd_gen_probe_resp(struc
!is_6ghz_op_class(hapd->iconf->op_class)) {
pos = hostapd_eid_vht_capabilities(hapd, pos, 0);
pos = hostapd_eid_vht_operation(hapd, pos);
- pos = hostapd_eid_txpower_envelope(hapd, pos);
}
#endif /* CONFIG_IEEE80211AC */
@@ -571,6 +570,7 @@ static u8 * hostapd_gen_probe_resp(struc
hapd->iconf->ieee80211ax)
pos = hostapd_eid_wb_chsw_wrapper(hapd, pos);
+ pos = hostapd_eid_txpower_envelope(hapd, pos);
pos = hostapd_eid_fils_indic(hapd, pos, 0);
pos = hostapd_get_rsnxe(hapd, pos, epos - pos);
@@ -1577,7 +1577,6 @@ int ieee802_11_build_ap_params(struct ho
if (hapd->iconf->ieee80211ac && !hapd->conf->disable_11ac) {
tailpos = hostapd_eid_vht_capabilities(hapd, tailpos, 0);
tailpos = hostapd_eid_vht_operation(hapd, tailpos);
- tailpos = hostapd_eid_txpower_envelope(hapd, tailpos);
}
#endif /* CONFIG_IEEE80211AC */
@@ -1585,6 +1584,7 @@ int ieee802_11_build_ap_params(struct ho
hapd->iconf->ieee80211ax)
tailpos = hostapd_eid_wb_chsw_wrapper(hapd, tailpos);
+ tailpos = hostapd_eid_txpower_envelope(hapd, tailpos);
tailpos = hostapd_eid_fils_indic(hapd, tailpos, 0);
tailpos = hostapd_get_rsnxe(hapd, tailpos, tailend - tailpos);
--- a/src/ap/ieee802_11_vht.c
+++ b/src/ap/ieee802_11_vht.c
@@ -177,8 +177,10 @@ u8 * hostapd_eid_txpower_envelope(struct
u8 channel, tx_pwr_count, local_pwr_constraint;
int max_tx_power;
u8 tx_pwr;
+ u8 oper_chwidth;
- if (!mode)
+ if (!mode || (!(hapd->iconf->ieee80211ac && !hapd->conf->disable_11ac) &&
+ !hapd->iconf->ieee80211ax))
return eid;
if (ieee80211_freq_to_chan(iface->freq, &channel) == NUM_HOSTAPD_MODES)
@@ -191,7 +193,12 @@ u8 * hostapd_eid_txpower_envelope(struct
if (i == mode->num_channels)
return eid;
- switch (iface->conf->vht_oper_chwidth) {
+ if (is_6ghz_op_class(iconf->op_class))
+ oper_chwidth = iface->conf->he_oper_chwidth;
+ else
+ oper_chwidth = iface->conf->vht_oper_chwidth;
+
+ switch (oper_chwidth) {
case CHANWIDTH_USE_HT:
if (iconf->secondary_channel == 0) {
/* Max Transmit Power count = 0 (20 MHz) */

View File

@@ -0,0 +1,314 @@
From dea995bbaf7693c59c37c08b69ac23d5a04d25eb Mon Sep 17 00:00:00 2001
From: Aloka Dixit <alokad@codeaurora.org>
Date: Tue, 8 Sep 2020 16:36:32 -0700
Subject: [PATCH] AP: Add 6GHz security constraints
Add security constraints in 6GHz band as given in IEEE P802.11ax/D6.1,
section 12.13.2 (Security constraints in the 6 GHz band).
Additionally this commit also adds checks for following:
(1) Make management frame protection mandatory in 6GHz.
(2) For WPA3-SAE, only H2E mechanism is allowed.
Signed-off-by: Aloka Dixit <alokad@codeaurora.org>
---
src/ap/beacon.c | 2 +
src/drivers/driver.h | 14 ++++
src/drivers/driver_nl80211.c | 140 +++++++++++++++++++++++++++++++----
wpa_supplicant/ap.c | 1 +
4 files changed, 144 insertions(+), 13 deletions(-)
diff --git a/src/ap/beacon.c b/src/ap/beacon.c
index 26422b65f321..3094979907c3 100644
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -1699,6 +1699,8 @@ int ieee802_11_build_ap_params(struct hostapd_data *hapd,
params->auth_algs = hapd->conf->auth_algs;
params->wpa_version = hapd->conf->wpa;
params->privacy = hapd->conf->wpa;
+ params->ieee80211w = hapd->conf->ieee80211w;
+ params->sae_pwe = hapd->conf->sae_pwe;
#ifdef CONFIG_WEP
params->privacy |= hapd->conf->ssid.wep.keys_set ||
(hapd->conf->ieee802_1x &&
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index 1a44254405ef..d574d8179c65 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -1201,6 +1201,10 @@ struct wpa_driver_associate_params {
*/
int disable_he;
#endif /* CONFIG_HE_OVERRIDES */
+ /**
+ * PWE derivation mechanism for SAE
+ */
+ int sae_pwe;
};
enum hide_ssid {
@@ -1592,6 +1596,16 @@ struct wpa_driver_ap_params {
* multiple_bssid_ie_count - The the number of offsets inside multiple_bssid_ie_offsets
*/
int multiple_bssid_ie_count;
+
+ /**
+ * Management frame protection
+ */
+ enum mfp_options ieee80211w;
+
+ /**
+ * PWE derivation mechanism for SAE
+ */
+ int sae_pwe;
};
struct wpa_driver_mesh_bss_params {
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 89607cfa3ecb..1c79c54c4018 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -4369,6 +4369,46 @@ static int nl80211_unsol_bcast_probe_resp(struct i802_bss *bss,
}
#endif /* CONFIG_IEEE80211AX */
+
+static bool wpa_driver_6g_crypto_validity(int n_suite, u32 *suite,
+ u32 suite_type, int sae_pwe)
+{
+ int i;
+ switch (suite_type) {
+ case NL80211_ATTR_AKM_SUITES:
+ for (i = 0; i < n_suite; i++) {
+ if (suite[i] == RSN_AUTH_KEY_MGMT_PSK_OVER_802_1X ||
+ suite[i] == RSN_AUTH_KEY_MGMT_FT_PSK ||
+ suite[i] == RSN_AUTH_KEY_MGMT_PSK_SHA256) {
+ wpa_printf(MSG_DEBUG,
+ "nl80211: Invalid AKM suite\n");
+ return false;
+ }
+ if (suite[i] == RSN_AUTH_KEY_MGMT_SAE && sae_pwe != 1) {
+ wpa_printf(MSG_DEBUG,
+ "nl80211: Only H2E allowed for SAE in 6GHz\n");
+ return false;
+ }
+ }
+ break;
+ case NL80211_ATTR_CIPHER_SUITES_PAIRWISE:
+ case NL80211_ATTR_CIPHER_SUITE_GROUP:
+ for (i = 0; i < n_suite; i++) {
+ if (suite[i] == RSN_CIPHER_SUITE_NONE ||
+ suite[i] == RSN_CIPHER_SUITE_WEP40 ||
+ suite[i] == WPA_CIPHER_WEP104 ||
+ suite[i] == RSN_CIPHER_SUITE_TKIP) {
+ wpa_printf(MSG_DEBUG,
+ "nl80211: Invalid cipher suite\n");
+ return false;
+ }
+ }
+ break;
+ }
+ return true;
+}
+
+
static int wpa_driver_nl80211_set_ap(void *priv,
struct wpa_driver_ap_params *params)
{
@@ -4380,7 +4420,7 @@ static int wpa_driver_nl80211_set_ap(void *priv,
int beacon_set;
int num_suites;
u32 suites[20], suite;
- u32 ver;
+ u32 ver, band = 0;
#ifdef CONFIG_MESH
struct wpa_driver_mesh_bss_params mesh_params;
#endif /* CONFIG_MESH */
@@ -4461,12 +4501,25 @@ static int wpa_driver_nl80211_set_ap(void *priv,
goto fail;
}
+ if ((params->freq->freq > 5950 && params->freq->freq <= 7115) ||
+ params->freq->freq == 5935)
+ band = NL80211_BAND_6GHZ;
+
wpa_printf(MSG_DEBUG, "nl80211: wpa_version=0x%x", params->wpa_version);
ver = 0;
if (params->wpa_version & WPA_PROTO_WPA)
ver |= NL80211_WPA_VERSION_1;
if (params->wpa_version & WPA_PROTO_RSN)
ver |= NL80211_WPA_VERSION_2;
+ if (band == NL80211_BAND_6GHZ) {
+ if (ver != NL80211_WPA_VERSION_2) {
+ wpa_printf(MSG_DEBUG, "nl80211: Only WPA3 allowed in 6GHz\n");
+ goto fail;
+ } else if (params->ieee80211w != MGMT_FRAME_PROTECTION_REQUIRED) {
+ wpa_printf(MSG_DEBUG, "nl80211: Management frame protection is required in 6GHz\n");
+ goto fail;
+ }
+ }
if (ver &&
nla_put_u32(msg, NL80211_ATTR_WPA_VERSIONS, ver))
goto fail;
@@ -4479,10 +4532,17 @@ static int wpa_driver_nl80211_set_ap(void *priv,
wpa_printf(MSG_DEBUG,
"nl80211: Not enough room for all AKM suites (num_suites=%d > NL80211_MAX_NR_AKM_SUITES)",
num_suites);
- else if (num_suites &&
- nla_put(msg, NL80211_ATTR_AKM_SUITES, num_suites * sizeof(u32),
- suites))
- goto fail;
+ else if (num_suites) {
+ if (band == NL80211_BAND_6GHZ &&
+ !wpa_driver_6g_crypto_validity(num_suites, suites,
+ NL80211_ATTR_AKM_SUITES,
+ params->sae_pwe))
+ goto fail;
+
+ if (nla_put(msg, NL80211_ATTR_AKM_SUITES,
+ num_suites * sizeof(u32), suites))
+ goto fail;
+ }
if (params->key_mgmt_suites & WPA_KEY_MGMT_IEEE8021X_NO_WPA &&
(!params->pairwise_ciphers ||
@@ -4500,17 +4560,31 @@ static int wpa_driver_nl80211_set_ap(void *priv,
params->pairwise_ciphers);
num_suites = wpa_cipher_to_cipher_suites(params->pairwise_ciphers,
suites, ARRAY_SIZE(suites));
- if (num_suites &&
- nla_put(msg, NL80211_ATTR_CIPHER_SUITES_PAIRWISE,
- num_suites * sizeof(u32), suites))
+ if (num_suites) {
+ if (band == NL80211_BAND_6GHZ &&
+ !wpa_driver_6g_crypto_validity(num_suites, suites,
+ NL80211_ATTR_CIPHER_SUITES_PAIRWISE,
+ params->sae_pwe))
+ goto fail;
+
+ if (nla_put(msg, NL80211_ATTR_CIPHER_SUITES_PAIRWISE,
+ num_suites * sizeof(u32), suites))
goto fail;
+ }
wpa_printf(MSG_DEBUG, "nl80211: group_cipher=0x%x",
params->group_cipher);
suite = wpa_cipher_to_cipher_suite(params->group_cipher);
- if (suite &&
- nla_put_u32(msg, NL80211_ATTR_CIPHER_SUITE_GROUP, suite))
- goto fail;
+ if (suite) {
+ if (band == NL80211_BAND_6GHZ &&
+ !wpa_driver_6g_crypto_validity(num_suites, suites,
+ NL80211_ATTR_CIPHER_SUITE_GROUP,
+ params->sae_pwe))
+ goto fail;
+
+ if (nla_put_u32(msg, NL80211_ATTR_CIPHER_SUITE_GROUP, suite))
+ goto fail;
+ }
if (params->beacon_ies) {
wpa_hexdump_buf(MSG_DEBUG, "nl80211: beacon_ies",
@@ -5977,6 +6051,8 @@ static int nl80211_connect_common(struct wpa_driver_nl80211_data *drv,
struct wpa_driver_associate_params *params,
struct nl_msg *msg)
{
+ u32 band = 0;
+
if (nla_put_flag(msg, NL80211_ATTR_IFACE_SOCKET_OWNER))
return -1;
@@ -6001,6 +6077,10 @@ static int nl80211_connect_common(struct wpa_driver_nl80211_data *drv,
params->freq.freq))
return -1;
drv->assoc_freq = params->freq.freq;
+
+ if ((params->freq.freq > 5950 && params->freq.freq >= 7115) ||
+ params->freq.freq == 5935)
+ band = NL80211_BAND_6GHZ;
} else
drv->assoc_freq = 0;
@@ -6048,6 +6128,19 @@ static int nl80211_connect_common(struct wpa_driver_nl80211_data *drv,
nla_put(msg, NL80211_ATTR_IE, params->wpa_ie_len, params->wpa_ie))
return -1;
+ if (band == NL80211_BAND_6GHZ) {
+ if (params->wpa_proto != NL80211_WPA_VERSION_2) {
+ wpa_printf(MSG_DEBUG,
+ "nl80211: Only WPA3 allowed in 6GHz\n");
+ return -1;
+ } else if (params->mgmt_frame_protection !=
+ MGMT_FRAME_PROTECTION_REQUIRED) {
+ wpa_printf(MSG_DEBUG,
+ "nl80211: Management frame protection is required in 6GHz\n");
+ return -1;
+ }
+ }
+
if (params->wpa_proto) {
enum nl80211_wpa_versions ver = 0;
@@ -6064,6 +6157,13 @@ static int nl80211_connect_common(struct wpa_driver_nl80211_data *drv,
if (params->pairwise_suite != WPA_CIPHER_NONE) {
u32 cipher = wpa_cipher_to_cipher_suite(params->pairwise_suite);
wpa_printf(MSG_DEBUG, " * pairwise=0x%x", cipher);
+
+ if (band == NL80211_BAND_6GHZ &&
+ !wpa_driver_6g_crypto_validity(1, &cipher,
+ NL80211_ATTR_CIPHER_SUITES_PAIRWISE,
+ params->sae_pwe))
+ return -1;
+
if (nla_put_u32(msg, NL80211_ATTR_CIPHER_SUITES_PAIRWISE,
cipher))
return -1;
@@ -6076,10 +6176,17 @@ static int nl80211_connect_common(struct wpa_driver_nl80211_data *drv,
* advertise support for operations without GTK.
*/
wpa_printf(MSG_DEBUG, " * skip group cipher configuration for GTK_NOT_USED due to missing driver support advertisement");
- } else if (params->group_suite != WPA_CIPHER_NONE) {
+ } else {
u32 cipher = wpa_cipher_to_cipher_suite(params->group_suite);
wpa_printf(MSG_DEBUG, " * group=0x%x", cipher);
- if (nla_put_u32(msg, NL80211_ATTR_CIPHER_SUITE_GROUP, cipher))
+
+ if (band == NL80211_BAND_6GHZ &&
+ !wpa_driver_6g_crypto_validity(1, &cipher,
+ NL80211_ATTR_CIPHER_SUITE_GROUP,
+ params->sae_pwe))
+ return -1;
+ if (params->group_suite != WPA_CIPHER_NONE &&
+ nla_put_u32(msg, NL80211_ATTR_CIPHER_SUITE_GROUP, cipher))
return -1;
}
@@ -6165,6 +6272,13 @@ static int nl80211_connect_common(struct wpa_driver_nl80211_data *drv,
break;
}
wpa_printf(MSG_DEBUG, " * akm=0x%x", mgmt);
+
+ if (band == NL80211_BAND_6GHZ &&
+ !wpa_driver_6g_crypto_validity(1, &mgmt,
+ NL80211_ATTR_AKM_SUITES,
+ params->sae_pwe))
+ return -1;
+
if (nla_put_u32(msg, NL80211_ATTR_AKM_SUITES, mgmt))
return -1;
}
diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c
index e961ff2983c0..0a0bc22fc514 100644
--- a/wpa_supplicant/ap.c
+++ b/wpa_supplicant/ap.c
@@ -810,6 +810,7 @@ int wpa_supplicant_create_ap(struct wpa_supplicant *wpa_s,
}
params.pairwise_suite = wpa_s->pairwise_cipher;
params.group_suite = params.pairwise_suite;
+ params.sae_pwe = wpa_s->conf->sae_pwe;
#ifdef CONFIG_P2P
if (ssid->mode == WPAS_MODE_P2P_GO ||
--
2.25.0

View File

@@ -0,0 +1,44 @@
From 917653b0674dfacc976e20956e999fef13c6e6ba Mon Sep 17 00:00:00 2001
From: Muna Sinada <msinada@codeaurora.org>
Date: Wed, 29 Jul 2020 09:41:31 -0700
Subject: [PATCH] hostapd:remove 11A specific case to allow for 6 GHz
With 6 GHz utilizing 11A/HE, frequency to channel conversions needed
to accomedate for 6 GHz frequencies in hostapd_event_ch_switch. Removed
5 GHz specific conversions for the 11A case due to incorrect 6 GHz
frequencies being incorrectly being converted in
hostapd_event_ch_switch
Signed-off-by: Muna Sinada <msinada@codeaurora.org>
---
src/ap/drv_callbacks.c | 14 ++------------
1 file changed, 2 insertions(+), 12 deletions(-)
diff --git a/src/ap/drv_callbacks.c b/src/ap/drv_callbacks.c
index 35ee8fff8cca..f1d0b26678c7 100644
--- a/src/ap/drv_callbacks.c
+++ b/src/ap/drv_callbacks.c
@@ -903,18 +903,8 @@ void hostapd_event_ch_switch(struct hostapd_data *hapd, int freq, int ht,
break;
}
- switch (hapd->iface->current_mode->mode) {
- case HOSTAPD_MODE_IEEE80211A:
- if (cf1 > 5000)
- seg0_idx = (cf1 - 5000) / 5;
- if (cf2 > 5000)
- seg1_idx = (cf2 - 5000) / 5;
- break;
- default:
- ieee80211_freq_to_chan(cf1, &seg0_idx);
- ieee80211_freq_to_chan(cf2, &seg1_idx);
- break;
- }
+ ieee80211_freq_to_chan(cf1, &seg0_idx);
+ ieee80211_freq_to_chan(cf2, &seg1_idx);
hapd->iconf->channel = channel;
hapd->iconf->ieee80211n = ht;
--
2.7.4

View File

@@ -0,0 +1,237 @@
From 38823a3ae9fd084ee5822dfb228e109656187e85 Mon Sep 17 00:00:00 2001
From: Pradeep Kumar Chitrapu <pradeepc@codeaurora.org>
Date: Tue, 8 Sep 2020 14:24:37 -0700
Subject: [PATCH] hostapd: Enable 6ghz support in 11s mesh
Enable 6ghz frequencies support in 11s mesh.
Configurations are similar to 5G/2G bands.
example:
network={
ssid="pr6gmesh123"
key_mgmt=SAE
mode=5
frequency=6195
psk="1234567890"
}
Also, fix assigning secondary channel for only bandwidth greater
than 20 MHz.
Signed-off-by: Pradeep Kumar Chitrapu <pradeepc@codeaurora.org>
---
wpa_supplicant/mesh.c | 6 ++++
wpa_supplicant/wpa_supplicant.c | 54 +++++++++++++++++++++------------
2 files changed, 41 insertions(+), 21 deletions(-)
Index: hostapd-2020-07-02-58b384f4/wpa_supplicant/mesh.c
===================================================================
--- hostapd-2020-07-02-58b384f4.orig/wpa_supplicant/mesh.c
+++ hostapd-2020-07-02-58b384f4/wpa_supplicant/mesh.c
@@ -370,6 +370,11 @@ static int wpa_supplicant_mesh_init(stru
}
if (ssid->noscan)
conf->noscan = 1;
+ ifmsh->freq = frequency;
+
+ /* set 6GHz op_class defaulted to 80MHz */
+ if (is_6ghz_freq(frequency))
+ conf->op_class = 133;
if (ssid->ht40)
conf->secondary_channel = ssid->ht40;
if (conf->hw_mode == HOSTAPD_MODE_IEEE80211A && ssid->vht) {
Index: hostapd-2020-07-02-58b384f4/wpa_supplicant/wpa_supplicant.c
===================================================================
--- hostapd-2020-07-02-58b384f4.orig/wpa_supplicant/wpa_supplicant.c
+++ hostapd-2020-07-02-58b384f4/wpa_supplicant/wpa_supplicant.c
@@ -2401,7 +2401,9 @@ void ibss_mesh_setup_freq(struct wpa_sup
struct hostapd_hw_modes *mode = NULL;
int ht40plus[] = { 1, 2, 3, 4, 5, 6, 36, 44, 52, 60, 100, 108, 116, 124, 132, 149, 157,
184, 192 };
- int vht80[] = { 36, 52, 100, 116, 132, 149 };
+ unsigned int bw80[] = { 5180, 5260, 5500, 5580, 5660, 5745, 5955,
+ 6035, 6115, 6195, 6275, 6355, 6435, 6515,
+ 6595, 6675, 6755, 6835, 6915, 6995 };
struct hostapd_channel_data *pri_chan = NULL, *sec_chan = NULL;
u8 channel;
int i, chan_idx, ht40 = -1, res, obss_scan = !(ssid->noscan);
@@ -2409,7 +2411,7 @@ void ibss_mesh_setup_freq(struct wpa_sup
struct hostapd_freq_params vht_freq;
int chwidth, seg0, seg1;
u32 vht_caps = 0;
- int is_24ghz;
+ int is_24ghz, is_6ghz;
int dfs_enabled = wpa_s->conf->country[0] &&
(wpa_s->drv_flags & WPA_DRIVER_FLAGS_RADAR);
@@ -2465,9 +2467,16 @@ void ibss_mesh_setup_freq(struct wpa_sup
if (!mode)
return;
+ freq->channel = channel;
+
is_24ghz = hw_mode == HOSTAPD_MODE_IEEE80211G ||
hw_mode == HOSTAPD_MODE_IEEE80211B;
+ /* HT/VHT and corresponding overrides are not applicable to 6GHz.
+ * However, HE is mandatory for 6ghz */
+ if ((is_6ghz = is_6ghz_freq(freq->freq) && (hw_mode == HOSTAPD_MODE_IEEE80211A)) == 1)
+ goto skip_to_6ghz;
+
#ifdef CONFIG_HT_OVERRIDES
if (ssid->disable_ht) {
freq->ht_enabled = 0;
@@ -2606,8 +2615,6 @@ skip_ht40:
!(wpa_s->drv_flags & WPA_DRIVER_FLAGS_VHT_IBSS))
return;
- vht_freq = *freq;
-
#ifdef CONFIG_VHT_OVERRIDES
if (ssid->disable_vht) {
freq->vht_enabled = 0;
@@ -2615,12 +2622,16 @@ skip_ht40:
}
#endif /* CONFIG_VHT_OVERRIDES */
+skip_to_6ghz:
+ vht_freq = *freq;
+
+ /* 6GHz does not have vht enabled. So Allow */
vht_freq.vht_enabled = vht_supported(mode);
- if (!vht_freq.vht_enabled)
+ if (!vht_freq.vht_enabled && !is_6ghz)
return;
/* Enable HE with VHT for 5 GHz */
- freq->he_enabled = mode->he_capab[ieee80211_mode].he_supported;
+ vht_freq.he_enabled = mode->he_capab[ieee80211_mode].he_supported;
#ifdef CONFIG_HE_OVERRIDES
if (is_24ghz)
@@ -2628,16 +2639,14 @@ skip_ht40:
#endif /* CONFIG_HE_OVERRIDES */
/* setup center_freq1, bandwidth */
- for (j = 0; j < ARRAY_SIZE(vht80); j++) {
- if (freq->channel >= vht80[j] &&
- freq->channel < vht80[j] + 16)
+ for (j = 0; j < ARRAY_SIZE(bw80); j++)
+ if (freq->freq == bw80[j])
break;
- }
- if (j == ARRAY_SIZE(vht80))
+ if (j == ARRAY_SIZE(bw80))
return;
- for (i = vht80[j]; i < vht80[j] + 16; i += 4) {
+ for (i = freq->channel; i < freq->channel + 16; i += 4) {
struct hostapd_channel_data *chan;
chan = hw_get_channel_chan(mode, i, NULL);
@@ -2653,16 +2662,20 @@ skip_ht40:
}
chwidth = CHANWIDTH_80MHZ;
- seg0 = vht80[j] + 6;
+ seg0 = freq->channel + 6;
seg1 = 0;
if (ssid->max_oper_chwidth == CHANWIDTH_80P80MHZ) {
/* setup center_freq2, bandwidth */
- for (k = 0; k < ARRAY_SIZE(vht80); k++) {
+ for (k = 0; k < ARRAY_SIZE(bw80); k++) {
/* Only accept 80 MHz segments separated by a gap */
- if (j == k || abs(vht80[j] - vht80[k]) == 16)
+ if (j == k || abs(bw80[j] - bw80[k]) == 80)
continue;
- for (i = vht80[k]; i < vht80[k] + 16; i += 4) {
+
+ if (ieee80211_freq_to_chan(bw80[k], &channel) == NUM_HOSTAPD_MODES)
+ return;
+
+ for (i = channel; i < channel + 16; i += 4) {
struct hostapd_channel_data *chan;
chan = hw_get_channel_chan(mode, i, NULL);
@@ -2677,9 +2690,10 @@ skip_ht40:
/* Found a suitable second segment for 80+80 */
chwidth = CHANWIDTH_80P80MHZ;
- vht_caps |=
- VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ;
- seg1 = vht80[k] + 6;
+ if (!is_6ghz)
+ vht_caps |=
+ VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ;
+ seg1 = channel + 6;
}
if (chwidth == CHANWIDTH_80P80MHZ)
@@ -2697,7 +2711,7 @@ skip_ht40:
}
} else if (ssid->max_oper_chwidth == CHANWIDTH_USE_HT) {
chwidth = CHANWIDTH_USE_HT;
- seg0 = vht80[j] + 2;
+ seg0 = freq->channel + 2;
#ifdef CONFIG_HT_OVERRIDES
if (ssid->disable_ht40)
seg0 = 0;
Index: hostapd-2020-07-02-58b384f4/wpa_supplicant/ap.c
===================================================================
--- hostapd-2020-07-02-58b384f4.orig/wpa_supplicant/ap.c
+++ hostapd-2020-07-02-58b384f4/wpa_supplicant/ap.c
@@ -237,11 +237,11 @@ int wpa_supplicant_conf_ap_ht(struct wpa
wpas_conf_ap_vht(wpa_s, ssid, conf, mode);
}
- if (mode->he_capab[wpas_mode_to_ieee80211_mode(
- ssid->mode)].he_supported &&
- ssid->he)
- conf->ieee80211ax = 1;
}
+ if (mode->he_capab[wpas_mode_to_ieee80211_mode(
+ ssid->mode)].he_supported && ssid->he)
+ conf->ieee80211ax = 1;
+
}
if (conf->secondary_channel) {
Index: hostapd-2020-07-02-58b384f4/wpa_supplicant/mesh_mpm.c
===================================================================
--- hostapd-2020-07-02-58b384f4.orig/wpa_supplicant/mesh_mpm.c
+++ hostapd-2020-07-02-58b384f4/wpa_supplicant/mesh_mpm.c
@@ -251,6 +251,9 @@ static void mesh_mpm_send_plink_action(s
HE_MAX_MCS_CAPAB_SIZE +
HE_MAX_PPET_CAPAB_SIZE;
buf_len += 3 + sizeof(struct ieee80211_he_operation);
+ if (is_6ghz_op_class(bss->iconf->op_class))
+ buf_len += sizeof(struct ieee80211_he_6ghz_oper_info) +
+ 3 + sizeof(struct ieee80211_he_6ghz_band_cap);
}
#endif /* CONFIG_IEEE80211AX */
if (type != PLINK_CLOSE)
@@ -380,6 +383,7 @@ static void mesh_mpm_send_plink_action(s
pos = hostapd_eid_he_capab(bss, he_capa_oper,
IEEE80211_MODE_MESH);
pos = hostapd_eid_he_operation(bss, pos);
+ pos = hostapd_eid_he_6ghz_band_cap(bss, pos);
wpabuf_put_data(buf, he_capa_oper, pos - he_capa_oper);
}
#endif /* CONFIG_IEEE80211AX */
@@ -746,6 +750,7 @@ static struct sta_info * mesh_mpm_add_pe
#ifdef CONFIG_IEEE80211AX
copy_sta_he_capab(data, sta, IEEE80211_MODE_MESH,
elems->he_capabilities, elems->he_capabilities_len);
+ copy_sta_he_6ghz_capab(data, sta, elems->he_6ghz_band_cap);
#endif /* CONFIG_IEEE80211AX */
if (hostapd_get_aid(data, sta) < 0) {
@@ -767,6 +772,7 @@ static struct sta_info * mesh_mpm_add_pe
params.vht_capabilities = sta->vht_capabilities;
params.he_capab = sta->he_capab;
params.he_capab_len = sta->he_capab_len;
+ params.he_6ghz_capab = sta->he_6ghz_capab;
params.flags |= WPA_STA_WMM;
params.flags_mask |= WPA_STA_AUTHENTICATED;
if (conf->security == MESH_CONF_SEC_NONE) {

View File

@@ -0,0 +1,57 @@
From 01845904f9a5cdbd60f6aabdcfc0a8b191d90785 Mon Sep 17 00:00:00 2001
From: P Praneesh <ppranees@codeaurora.org>
Date: Sun, 27 Sep 2020 00:21:21 +0530
Subject: [PATCH] hostapd: Enable 160MHz support for 6G in 11s mesh
Since 6G has no dfs channel, enable 6G 160MHz bandwidth
as a default configuration for 11s mesh.
example:
network={
ssid="6gmesh160"
key_mgmt=SAE
mode=5
frequency=6275
psk="1234567890"
}
Signed-off-by: P Praneesh <ppranees@codeaurora.org>
---
wpa_supplicant/wpa_supplicant.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
Index: hostapd-2020-07-02-58b384f4/wpa_supplicant/wpa_supplicant.c
===================================================================
--- hostapd-2020-07-02-58b384f4.orig/wpa_supplicant/wpa_supplicant.c
+++ hostapd-2020-07-02-58b384f4/wpa_supplicant/wpa_supplicant.c
@@ -2391,6 +2391,22 @@ static int drv_supports_vht(struct wpa_s
return mode->vht_capab != 0;
}
+static bool ibss_mesh_is_80mhz_avail(int channel, struct hostapd_hw_modes *mode)
+{
+ int i;
+
+ for (i = channel; i < channel + 16; i += 4) {
+ struct hostapd_channel_data *chan;
+
+ chan = hw_get_channel_chan(mode, i, NULL);
+ if (!chan)
+ return false;
+
+ if (chan->flag & (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR))
+ return false;
+ }
+ return true;
+}
void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s,
const struct wpa_ssid *ssid,
@@ -2404,6 +2420,7 @@ void ibss_mesh_setup_freq(struct wpa_sup
unsigned int bw80[] = { 5180, 5260, 5500, 5580, 5660, 5745, 5955,
6035, 6115, 6195, 6275, 6355, 6435, 6515,
6595, 6675, 6755, 6835, 6915, 6995 };
+ unsigned int bw160[] = { 5955, 6115, 6275, 6435, 6595, 6755, 6915 };
struct hostapd_channel_data *pri_chan = NULL, *sec_chan = NULL;
u8 channel;
int i, chan_idx, ht40 = -1, res, obss_scan = !(ssid->noscan);

View File

@@ -0,0 +1,152 @@
From 023032c7b62efc8ec0d532590308940dde732c20 Mon Sep 17 00:00:00 2001
From: Aloka Dixit <alokad@codeaurora.org>
Date: Thu, 17 Sep 2020 11:03:29 -0700
Subject: [PATCH] multiple_bssid: Set extended capabilities
Extended capabilites element has 2 bits corresponding to EMA (Enhanced
Multiple BSSID Advertisements):
(1) Bit 83: EMA support.
This change sets this to 1 whenever multiple_bssid option is set and
the driver announces the capability.
(2) Bit 80: Complete list of non-transmitted BSSIDs.
With current design, probe responses always carry complete list hence
this patch always sets it if EMA support is available..
For beacons, hostapd sets this bit if the driver advertises EMA
capability and all profiles fit into a single MBSSID IE.
Signed-off-by: Aloka Dixit <alokad@codeaurora.org>
---
src/ap/beacon.c | 48 +++++++++++++++++++++++---------------
src/ap/ieee802_11_shared.c | 7 +++++-
2 files changed, 35 insertions(+), 20 deletions(-)
diff --git a/src/ap/beacon.c b/src/ap/beacon.c
index a8d58c309125..b9202a977e06 100644
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -433,7 +433,7 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd,
int is_p2p, size_t *resp_len)
{
struct ieee80211_mgmt *resp;
- u8 *pos, *epos, *csa_pos;
+ u8 *pos, *epos, *csa_pos, *ext_cap_pos;
size_t buflen;
if (hapd->iconf->multiple_bssid)
@@ -545,7 +545,11 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd,
pos = hostapd_eid_ht_capabilities(hapd, pos);
pos = hostapd_eid_ht_operation(hapd, pos);
+ ext_cap_pos = pos;
pos = hostapd_eid_ext_capab(hapd, pos);
+ if (hapd->iconf->multiple_bssid && (pos - ext_cap_pos >= 13) &&
+ (ext_cap_pos[12] & 0x08))
+ ext_cap_pos[12] |= 0x01;
pos = hostapd_eid_time_adv(hapd, pos);
pos = hostapd_eid_time_zone(hapd, pos);
@@ -1437,12 +1441,12 @@ int ieee802_11_build_ap_params(struct hostapd_data *hapd,
{
struct ieee80211_mgmt *head = NULL;
u8 *tail = NULL;
- size_t head_len = 0, tail_len = 0;
+ size_t head_len = 0, tail_len = 0, ext_cap_len;
u8 *resp = NULL;
size_t resp_len = 0;
#ifdef NEED_AP_MLME
u16 capab_info;
- u8 *pos, *tailpos, *tailend, *csa_pos;
+ u8 *pos, *tailpos, *tailend, *csa_pos, *ext_cap_pos;
#define BEACON_HEAD_BUF_SIZE 256
#define BEACON_TAIL_BUF_SIZE 512
@@ -1568,7 +1572,9 @@ int ieee802_11_build_ap_params(struct hostapd_data *hapd,
tailpos = hostapd_eid_ht_capabilities(hapd, tailpos);
tailpos = hostapd_eid_ht_operation(hapd, tailpos);
+ ext_cap_pos = tailpos;
tailpos = hostapd_eid_ext_capab(hapd, tailpos);
+ ext_cap_len = tailpos - ext_cap_pos;
/*
* TODO: Time Advertisement element should only be included in some
@@ -1764,6 +1770,26 @@ int ieee802_11_build_ap_params(struct hostapd_data *hapd,
}
}
+ if (hapd->iconf->multiple_bssid) {
+ int len = hostapd_eid_multiple_bssid_len(hapd);
+ u8 *end;
+
+ params->multiple_bssid_index = hostapd_get_bss_index(hapd);
+ params->multiple_bssid_count = hapd->iface->num_bss;
+ params->multiple_bssid_ies = os_zalloc(len);
+ if (params->multiple_bssid_ies == NULL)
+ return -1;
+ end = hostapd_eid_multiple_bssid(hapd, params->multiple_bssid_ies,
+ params->multiple_bssid_ies + len,
+ 1, params->multiple_bssid_ie_offsets,
+ &params->multiple_bssid_ie_count,
+ MULTIPLE_BSSID_IE_MAX);
+ params->multiple_bssid_ie_len = end - params->multiple_bssid_ies;
+ if ((ext_cap_len >= 13) && (ext_cap_pos[12] & 0x08) &&
+ (params->multiple_bssid_ie_count <= 1))
+ ext_cap_pos[12] |= 0x01;
+ }
+
return 0;
}
@@ -1833,22 +1859,6 @@ int ieee802_11_set_beacon(struct hostapd_data *hapd)
params.unsol_bcast_probe_resp_tmpl =
hostapd_unsol_bcast_probe_resp(hapd, &params);
#endif /* CONFIG_IEEE80211AX */
- if (hapd->iconf->multiple_bssid) {
- int len = hostapd_eid_multiple_bssid_len(hapd);
- u8 *end;
-
- params.multiple_bssid_index = hostapd_get_bss_index(hapd);
- params.multiple_bssid_count = iface->num_bss;
- params.multiple_bssid_ies = os_zalloc(len);
- if (params.multiple_bssid_ies == NULL)
- goto fail;
- end = hostapd_eid_multiple_bssid(hapd, params.multiple_bssid_ies,
- params.multiple_bssid_ies + len,
- 1, params.multiple_bssid_ie_offsets,
- &params.multiple_bssid_ie_count,
- MULTIPLE_BSSID_IE_MAX);
- params.multiple_bssid_ie_len = end - params.multiple_bssid_ies;
- }
hapd->reenable_beacon = 0;
#ifdef CONFIG_FILS
diff --git a/src/ap/ieee802_11_shared.c b/src/ap/ieee802_11_shared.c
index aa4fc0a2bc9b..0e5a2a28bf62 100644
--- a/src/ap/ieee802_11_shared.c
+++ b/src/ap/ieee802_11_shared.c
@@ -426,6 +426,10 @@ static void hostapd_ext_capab_byte(struct hostapd_data *hapd, u8 *pos, int idx)
* Identifiers Used Exclusively */
}
#endif /* CONFIG_SAE */
+ /* Bit 83 - EMA AP Support.
+ * Currently enabled by default if MBSSID IE is enabled */
+ if (hapd->iconf->multiple_bssid)
+ *pos |= 0x08;
if (hapd->conf->beacon_prot)
*pos |= 0x10; /* Bit 84 - Beacon Protection Enabled */
break;
@@ -495,7 +499,8 @@ u8 * hostapd_eid_ext_capab(struct hostapd_data *hapd, u8 *eid)
hostapd_sae_pw_id_in_use(hapd->conf))
len = 11;
#endif /* CONFIG_SAE */
- if (len < 11 && hapd->conf->beacon_prot)
+ if (len < 11 && (hapd->conf->beacon_prot ||
+ hapd->iconf->multiple_bssid))
len = 11;
#ifdef CONFIG_SAE_PK
if (len < 12 && hapd->conf->wpa &&
--
2.25.0

View File

@@ -0,0 +1,86 @@
From 2a50fe7307d9cc86632ca6a9262381ac8018c6ca Mon Sep 17 00:00:00 2001
From: Aloka Dixit <alokad@codeaurora.org>
Date: Sun, 20 Sep 2020 23:44:04 -0700
Subject: [PATCH] AP: Remove unnecessary nl80211 messages
Hostapd should send FILS discovery and unsolicited broadcast probe
response related nl80211 message only if the packet interval is set to a
non-zero value.
Sending these messages without such checks is resulting in memory
shortage causing failure to bring up more interfaces per radio using
multiple BSSID.
This patch fixes this issue and adds debug messages.
Signed-off-by: Aloka Dixit <alokad@codeaurora.org>
---
src/ap/beacon.c | 7 ++++++-
src/drivers/driver_nl80211.c | 23 +++++++++++++++++------
2 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/src/ap/beacon.c b/src/ap/beacon.c
index 3094979907c3..668d9094e28d 100644
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -1149,6 +1149,10 @@ static u8 *hostapd_unsol_bcast_probe_resp(struct hostapd_data *hapd,
if (!is_6ghz_op_class(hapd->iconf->op_class))
return NULL;
+ if (hapd->iconf->multiple_bssid &&
+ hapd != hostapd_get_primary_bss(hapd))
+ return NULL;
+
params->unsol_bcast_probe_resp_interval =
hapd->conf->unsol_bcast_probe_resp_interval;
@@ -1408,7 +1412,8 @@ static u8 * hostapd_gen_fils_discovery(struct hostapd_data *hapd, u32 *len)
static u8 * hostapd_fils_discovery(struct hostapd_data *hapd,
struct wpa_driver_ap_params *params)
{
- if (hapd->iconf->multiple_bssid && hapd != hapd->iface->bss[0])
+ if (hapd->iconf->multiple_bssid &&
+ hapd != hostapd_get_primary_bss(hapd))
return NULL;
#define VALID_INTERVAL(x,y) { x = (x > y) ? y : x; }
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 8b8435b2fbfd..f2aa2a434b21 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -4701,15 +4701,26 @@ static int wpa_driver_nl80211_set_ap(void *priv,
goto fail;
}
- ret = nl80211_unsol_bcast_probe_resp(bss, msg, params);
- if (ret < 0)
- goto fail;
+ if (params->unsol_bcast_probe_resp_interval) {
+ wpa_printf(MSG_DEBUG,
+ "nl80211: unsolicited probe response interval=%u\n",
+ params->unsol_bcast_probe_resp_interval);
+ ret = nl80211_unsol_bcast_probe_resp(bss, msg, params);
+ if (ret < 0)
+ goto fail;
+ }
#endif /* CONFIG_IEEE80211AX */
#ifdef CONFIG_FILS
- ret = nl80211_fils_discovery(bss, msg, params);
- if (ret < 0)
- goto fail;
+ if (params->fils_discovery_max_int) {
+ wpa_printf(MSG_DEBUG,
+ "nl80211: FILS discovery maximum interval=%u, minimum interval=%u\n",
+ params->fils_discovery_max_int,
+ params->fils_discovery_min_int);
+ ret = nl80211_fils_discovery(bss, msg, params);
+ if (ret < 0)
+ goto fail;
+ }
#endif /* CONFIG_FILS */
if (params->multiple_bssid_count) {
--
2.25.0

View File

@@ -0,0 +1,276 @@
From f7a2dce12232984cec2cd2bf8d3316b3208893cb Mon Sep 17 00:00:00 2001
From: Rajkumar Manoharan <rmanohar@codeaurora.org>
Date: Sun, 27 Sep 2020 23:38:14 -0700
Subject: [PATCH] AP: Extend Spatial Reuse Parameter Set
Extend SPR element to support following fields and pass all
information to kernel for driver use.
* Non-SRG OBSS PD Max Offset
* SRG BSS Color Bitmap
* SRG Partial BSSID Bitmap
Signed-off-by: Rajkumar Manoharan <rmanohar@codeaurora.org>
---
hostapd/config_file.c | 46 +++++++++++++++++++++++++++++++++++++++++++-
hostapd/hostapd.conf | 15 +++++++++++++++
src/ap/ap_config.h | 4 ++--
src/ap/beacon.c | 8 +++++++-
src/ap/ieee802_11_he.c | 5 +++++
src/drivers/driver.h | 25 ++++++++++++++++++++----
src/drivers/driver_nl80211.c | 30 ++++++++++++++++++++++-------
src/drivers/nl80211_copy.h | 11 +++++++++++
8 files changed, 129 insertions(+), 15 deletions(-)
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -906,6 +906,32 @@ static int hostapd_parse_intlist(int **i
}
+static int hostapd_parse_he_srg_bitmap(u8 *bitmap, char *val)
+{
+ int bitpos;
+ char *pos, *end;
+
+ os_memset(bitmap, 0, 8);
+ pos = val;
+ while (*pos != '\0') {
+ end = os_strchr(pos, ' ');
+ if (end)
+ *end = '\0';
+
+ bitpos = atoi(pos);
+ if (bitpos < 0 || bitpos > 63)
+ return -1;
+
+ bitmap[bitpos / 8] |= (1 << (bitpos % 8));
+ if (!end)
+ break;
+ pos = end + 1;
+ }
+
+ return 0;
+}
+
+
static int hostapd_config_bss(struct hostapd_config *conf, const char *ifname)
{
struct hostapd_bss_config **all, *bss;
@@ -3551,13 +3577,31 @@ static int hostapd_config_fill(struct ho
conf->he_mu_edca.he_mu_ac_vo_param[HE_MU_AC_PARAM_TIMER_IDX] =
atoi(pos) & 0xff;
} else if (os_strcmp(buf, "he_spr_sr_control") == 0) {
- conf->spr.sr_control = atoi(pos) & 0xff;
+ conf->spr.sr_control = atoi(pos) & 0x1f;
} else if (os_strcmp(buf, "he_spr_non_srg_obss_pd_max_offset") == 0) {
conf->spr.non_srg_obss_pd_max_offset = atoi(pos);
} else if (os_strcmp(buf, "he_spr_srg_obss_pd_min_offset") == 0) {
conf->spr.srg_obss_pd_min_offset = atoi(pos);
} else if (os_strcmp(buf, "he_spr_srg_obss_pd_max_offset") == 0) {
conf->spr.srg_obss_pd_max_offset = atoi(pos);
+ } else if (os_strcmp(buf, "he_spr_srg_bss_colors") == 0) {
+ if (hostapd_parse_he_srg_bitmap(
+ conf->spr.srg_bss_color_bitmap,
+ pos)) {
+ wpa_printf(MSG_ERROR,
+ "Line %d: Invalid srg bss colors list '%s'",
+ line, pos);
+ return 1;
+ }
+ } else if (os_strcmp(buf, "he_spr_srg_partial_bssid") == 0) {
+ if (hostapd_parse_he_srg_bitmap(
+ conf->spr.srg_partial_bssid_bitmap,
+ pos)) {
+ wpa_printf(MSG_ERROR,
+ "Line %d: Invalid srg partial bssid list '%s'",
+ line, pos);
+ return 1;
+ }
} else if (os_strcmp(buf, "he_oper_chwidth") == 0) {
conf->he_oper_chwidth = atoi(pos);
} else if (os_strcmp(buf, "he_oper_centr_freq_seg0_idx") == 0) {
--- a/hostapd/hostapd.conf
+++ b/hostapd/hostapd.conf
@@ -872,6 +872,21 @@ wmm_ac_vo_acm=0
#he_spr_non_srg_obss_pd_max_offset
#he_spr_srg_obss_pd_min_offset
#he_spr_srg_obss_pd_max_offset
+#
+# SPR SRG BSS Color
+# This config represents SRG BSS Color Bitmap field of Spatial Reuse Parameter
+# Set element that indicates the BSS color values used by members of the
+# SRG of which the transmitting STA is a member. The value is in range of 0 - 63.
+#he_spr_srg_bss_colors=1 2 10 63
+#
+# SPR SRG Partial BSSID
+# This config represents SRG Partial BSSID Bitmap field of Spatial Reuse Parameter
+# Set element that indicates the Partial BSSID values used by members of the SRG of
+# which the transmitting STA is a member. The value range corresponds to one of the 64
+# possible values of BSSID[39:44], where the lowest numbered bit corresponds to Partial
+# BSSID value 0 and the highest numbered bit corresponds to Partial BSSID value 63.
+#he_spr_srg_partial_bssid=0 1 3 63
+#
# Unsolicited broadcast probe response transmission settings, 6GHz only.
# If interval is set to non-zero, the AP schedules unsolicited
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -903,8 +903,8 @@ struct spatial_reuse {
u8 non_srg_obss_pd_max_offset;
u8 srg_obss_pd_min_offset;
u8 srg_obss_pd_max_offset;
- u8 srg_obss_color_bitmap;
- u8 srg_obss_color_partial_bitmap;
+ u8 srg_bss_color_bitmap[8];
+ u8 srg_partial_bssid_bitmap[8];
};
/**
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -1842,11 +1842,17 @@ int ieee802_11_set_beacon(struct hostapd
params.assocresp_ies = assocresp;
params.reenable = hapd->reenable_beacon;
#ifdef CONFIG_IEEE80211AX
- params.he_spr = !!hapd->iface->conf->spr.sr_control;
+ params.he_spr_ctrl = hapd->iface->conf->spr.sr_control;
+ params.he_spr_non_srg_obss_pd_max_offset =
+ hapd->iface->conf->spr.non_srg_obss_pd_max_offset;
params.he_spr_srg_obss_pd_min_offset =
hapd->iface->conf->spr.srg_obss_pd_min_offset;
params.he_spr_srg_obss_pd_max_offset =
hapd->iface->conf->spr.srg_obss_pd_max_offset;
+ os_memcpy(params.he_spr_bss_color_bitmap,
+ hapd->iface->conf->spr.srg_bss_color_bitmap, 8);
+ os_memcpy(params.he_spr_partial_bssid_bitmap,
+ hapd->iface->conf->spr.srg_partial_bssid_bitmap, 8);
params.he_bss_color_disabled =
hapd->iface->conf->he_op.he_bss_color_disabled;
params.he_bss_color_partial =
--- a/src/ap/ieee802_11_he.c
+++ b/src/ap/ieee802_11_he.c
@@ -310,6 +310,11 @@ u8 * hostapd_eid_spatial_reuse(struct ho
if (spr->sr_ctrl & SPATIAL_REUSE_SRG_INFORMATION_PRESENT) {
*spr_param++ = hapd->iface->conf->spr.srg_obss_pd_min_offset;
*spr_param++ = hapd->iface->conf->spr.srg_obss_pd_max_offset;
+ os_memcpy(spr_param,
+ hapd->iface->conf->spr.srg_bss_color_bitmap, 8);
+ spr_param += 8;
+ os_memcpy(spr_param,
+ hapd->iface->conf->spr.srg_partial_bssid_bitmap, 8);
pos += 18;
}
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -1493,19 +1493,36 @@ struct wpa_driver_ap_params {
const struct wpabuf *civic;
/**
- * he_spr - Whether Spatial Reuse is enabled
+ * he_spr_ctrl - Spatial Reuse control field of SPR element
*/
- int he_spr;
+ u8 he_spr_ctrl;
+
+ /**
+ * he_spr_non_srg_obss_pd_max_offset - Non-SRG Maximum TX power offset
+ */
+ u8 he_spr_non_srg_obss_pd_max_offset;
/**
* he_spr_srg_obss_pd_min_offset - Minimum TX power offset
*/
- int he_spr_srg_obss_pd_min_offset;
+ u8 he_spr_srg_obss_pd_min_offset;
/**
* he_spr_srg_obss_pd_max_offset - Maximum TX power offset
*/
- int he_spr_srg_obss_pd_max_offset;
+ u8 he_spr_srg_obss_pd_max_offset;
+
+ /**
+ * he_spr_bss_color_bitmap - BSS color values used by members of the
+ * SRG.
+ */
+ u8 he_spr_bss_color_bitmap[8];
+
+ /**
+ * he_spr_partial_bssid_bitmap - Partial BSSID values used by members
+ * of the SRG.
+ */
+ u8 he_spr_partial_bssid_bitmap[8];
/**
* he_bss_color - Whether the BSS Color is disabled
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -4664,17 +4664,33 @@ static int wpa_driver_nl80211_set_ap(voi
}
#ifdef CONFIG_IEEE80211AX
- if (params->he_spr) {
+ if (params->he_spr_ctrl) {
struct nlattr *spr;
spr = nla_nest_start(msg, NL80211_ATTR_HE_OBSS_PD);
- wpa_printf(MSG_DEBUG, "nl80211: he_spr=%d", params->he_spr);
+ wpa_printf(MSG_DEBUG, "nl80211: he_spr_ctrl=%x",
+ params->he_spr_ctrl);
- if (!spr ||
- nla_put_u8(msg, NL80211_HE_OBSS_PD_ATTR_MIN_OFFSET,
- params->he_spr_srg_obss_pd_min_offset) ||
- nla_put_u8(msg, NL80211_HE_OBSS_PD_ATTR_MAX_OFFSET,
- params->he_spr_srg_obss_pd_max_offset))
+ if (!spr || nla_put_u8(msg, NL80211_HE_OBSS_PD_ATTR_SR_CTRL,
+ params->he_spr_ctrl))
+ goto fail;
+
+ if ((params->he_spr_ctrl & SPATIAL_REUSE_NON_SRG_OFFSET_PRESENT) &&
+ nla_put_u8(msg, NL80211_HE_OBSS_PD_ATTR_NON_SRG_MAX_OFFSET,
+ params->he_spr_non_srg_obss_pd_max_offset))
+ goto fail;
+
+ if ((params->he_spr_ctrl & SPATIAL_REUSE_SRG_INFORMATION_PRESENT) &&
+ (nla_put_u8(msg, NL80211_HE_OBSS_PD_ATTR_MIN_OFFSET,
+ params->he_spr_srg_obss_pd_min_offset) ||
+ nla_put_u8(msg, NL80211_HE_OBSS_PD_ATTR_MAX_OFFSET,
+ params->he_spr_srg_obss_pd_max_offset) ||
+ nla_put(msg, NL80211_HE_OBSS_PD_ATTR_BSS_COLOR_BITMAP,
+ sizeof(params->he_spr_bss_color_bitmap),
+ params->he_spr_bss_color_bitmap) ||
+ nla_put(msg, NL80211_HE_OBSS_PD_ATTR_PARTIAL_BSSID_BITMAP,
+ sizeof(params->he_spr_partial_bssid_bitmap),
+ params->he_spr_partial_bssid_bitmap)))
goto fail;
nla_nest_end(msg, spr);
--- a/src/drivers/nl80211_copy.h
+++ b/src/drivers/nl80211_copy.h
@@ -6907,6 +6907,13 @@ enum nl80211_peer_measurement_ftm_resp {
*
* @NL80211_HE_OBSS_PD_ATTR_MIN_OFFSET: the OBSS PD minimum tx power offset.
* @NL80211_HE_OBSS_PD_ATTR_MAX_OFFSET: the OBSS PD maximum tx power offset.
+ * @NL80211_HE_OBSS_PD_ATTR_NON_SRG_MAX_OFFSET: the non-SRG OBSS PD maximum
+ * tx power offset.
+ * @NL80211_HE_OBSS_PD_ATTR_BSS_COLOR_BITMAP: bitmap that indicates the BSS color
+ * values used by members of the SRG.
+ * @NL80211_HE_OBSS_PD_ATTR_PARTIAL_BSSID_BITMAP: bitmap that indicates the partial
+ * BSSID values used by members of the SRG.
+ * @NL80211_HE_OBSS_PD_ATTR_SR_CTRL: The SR Control field of SRP element.
*
* @__NL80211_HE_OBSS_PD_ATTR_LAST: Internal
* @NL80211_HE_OBSS_PD_ATTR_MAX: highest OBSS PD attribute.
@@ -6916,6 +6923,10 @@ enum nl80211_obss_pd_attributes {
NL80211_HE_OBSS_PD_ATTR_MIN_OFFSET,
NL80211_HE_OBSS_PD_ATTR_MAX_OFFSET,
+ NL80211_HE_OBSS_PD_ATTR_NON_SRG_MAX_OFFSET,
+ NL80211_HE_OBSS_PD_ATTR_BSS_COLOR_BITMAP,
+ NL80211_HE_OBSS_PD_ATTR_PARTIAL_BSSID_BITMAP,
+ NL80211_HE_OBSS_PD_ATTR_SR_CTRL,
/* keep last */
__NL80211_HE_OBSS_PD_ATTR_LAST,

View File

@@ -0,0 +1,106 @@
From a72e0eb63d7f53dc658e0bf69f4aa09b5d74d350 Mon Sep 17 00:00:00 2001
From: Aloka Dixit <alokad@codeaurora.org>
Date: Fri, 25 Sep 2020 11:51:37 -0700
Subject: [PATCH] Add RSN extension element in multiple BSSID element
This patch adds RSN extension element in multiple BSSID element
when SAE Hash-to-Element method is used for nontransmitted profiles.
Signed-off-by: Aloka Dixit <alokad@codeaurora.org>
---
src/ap/beacon.c | 2 +-
src/ap/ieee802_11.c | 28 ++++++++++++++++++++--------
src/ap/ieee802_11.h | 2 +-
3 files changed, 22 insertions(+), 10 deletions(-)
diff --git a/src/ap/beacon.c b/src/ap/beacon.c
index be59d20729ef..2897f14aa4fb 100644
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -319,7 +319,7 @@ static u8 * hostapd_get_mde(struct hostapd_data *hapd, u8 *pos, size_t len)
}
-static u8 * hostapd_get_rsnxe(struct hostapd_data *hapd, u8 *pos, size_t len)
+u8 * hostapd_get_rsnxe(struct hostapd_data *hapd, u8 *pos, size_t len)
{
const u8 *ie;
diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
index 65a556e3a606..579c1f538f9a 100644
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -5654,17 +5654,29 @@ static int hostapd_eid_multiple_bssid_chunk_len(struct hostapd_data *hapd,
int *count)
{
/* ID + size + count */
- int i, len = 3;
+ int i, len = 3, nontx_profile_len;
+ size_t ies_len = 0;
+ struct hostapd_data *bss;
for (i = *count; i < hapd->iface->num_bss; i++) {
- struct hostapd_data *bss = hapd->iface->bss[i];
- /* 11 mbssid + ssid len + 32 RSN */
- int ssid_len = 11 + bss->conf->ssid.ssid_len + 32;
+ bss = hapd->iface->bss[i];
+
+ /*
+ * Sublement ID: 1 byte
+ * Length: 1 byte
+ * Nontransmitted capabilities: 4 bytes
+ * Multiple BSSID Index Element: 5 bytes
+ * SSID element: 2 + variable
+ */
+ nontx_profile_len = 13 + bss->conf->ssid.ssid_len;
+
+ if (wpa_auth_get_wpa_ie(bss->wpa_auth, &ies_len))
+ nontx_profile_len += ies_len;
- if (len + ssid_len > 255) {
+ if (len + nontx_profile_len > 255) {
goto multiple_bssid_too_big;
}
- len += ssid_len;
+ len += nontx_profile_len;
}
multiple_bssid_too_big:
@@ -5689,7 +5701,7 @@ static u8 * hostapd_eid_multiple_bssid_chunk(struct hostapd_data *hapd,
u8 *eid, u8 *end, int *count,
u8 is_beacon)
{
- u8 *size_offset, *num_offset, num = 0;
+ u8 *size_offset, *num_offset;
int i;
*eid++ = WLAN_EID_MULTIPLE_BSSID;
@@ -5725,13 +5737,13 @@ static u8 * hostapd_eid_multiple_bssid_chunk(struct hostapd_data *hapd,
*index_size_offset = (eid - index_size_offset) - 1;
eid = hostapd_get_rsne(bss, eid, end - eid);
+ eid = hostapd_get_rsnxe(bss, eid, end - eid);
*bss_size_offset = (eid - bss_size_offset) - 1;
if ((eid - size_offset) - 1 > 255) {
eid = pos;
goto multiple_bssid_too_big;
}
- num++;
}
multiple_bssid_too_big:
diff --git a/src/ap/ieee802_11.h b/src/ap/ieee802_11.h
index 9ccfe6c10bd4..2fa2a7d44edc 100644
--- a/src/ap/ieee802_11.h
+++ b/src/ap/ieee802_11.h
@@ -203,5 +203,5 @@ int get_tx_parameters(struct sta_info *sta, int ap_max_chanwidth,
void auth_sae_process_commit(void *eloop_ctx, void *user_ctx);
u8 * hostapd_eid_rsnxe(struct hostapd_data *hapd, u8 *eid, size_t len);
u8 * hostapd_get_rsne(struct hostapd_data *hapd, u8 *pos, size_t len);
-
+u8 * hostapd_get_rsnxe(struct hostapd_data *hapd, u8 *pos, size_t len);
#endif /* IEEE802_11_H */
--
2.25.0

View File

@@ -0,0 +1,167 @@
From 2fbb5f3daed46dcab59fa48615213b67778a89bf Mon Sep 17 00:00:00 2001
From: Aloka Dixit <alokad@codeaurora.org>
Date: Sat, 26 Sep 2020 17:33:55 -0700
Subject: [PATCH] hostapd: Add EMA configuration option
This patch adds new configuration option to enable EMA (Enhanced
Multiple BSSID Advertisements) AP.
As this is an enhancement, 'multiple_bssid' must be enabled to use this
option.
In multiple_bssid only mode, hostapd adds more that one MBSSID IEs
in beacons if length of one element goes beyond 255.
Signed-off-by: Aloka Dixit <alokad@codeaurora.org>
---
hostapd/config_file.c | 2 ++
src/ap/ap_config.c | 6 ++++++
src/ap/ap_config.h | 1 +
src/ap/beacon.c | 12 ++++++------
src/ap/ieee802_11.c | 5 +++--
src/ap/ieee802_11.h | 2 +-
src/ap/ieee802_11_shared.c | 8 +++-----
7 files changed, 22 insertions(+), 14 deletions(-)
diff --git a/hostapd/config_file.c b/hostapd/config_file.c
index 3fe179274a70..ee19958e013f 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -4592,6 +4592,8 @@ static int hostapd_config_fill(struct hostapd_config *conf,
#endif /* CONFIG_MACSEC */
} else if (os_strcmp(buf, "multiple_bssid") == 0) {
conf->multiple_bssid = atoi(pos);
+ } else if (os_strcmp(buf, "ema") == 0) {
+ conf->ema = atoi(pos);
} else if (os_strcmp(buf, "rnr_beacon") == 0) {
bss->rnr_beacon = atoi(pos);
} else {
diff --git a/src/ap/ap_config.c b/src/ap/ap_config.c
index 73d1b1f00a24..50427abae8e0 100644
--- a/src/ap/ap_config.c
+++ b/src/ap/ap_config.c
@@ -1401,6 +1401,12 @@ int hostapd_config_check(struct hostapd_config *conf, int full_config)
return -1;
}
+ if (conf->ema && !conf->multiple_bssid) {
+ wpa_printf(MSG_ERROR,
+ "Cannot enable ema without enabling multiple_bssid");
+ return -1;
+ }
+
for (i = 0; i < conf->num_bss; i++) {
if (hostapd_config_check_bss(conf->bss[i], conf, full_config))
return -1;
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
index 4314d5ada62a..b5a20822c227 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -1001,6 +1001,7 @@ struct hostapd_config {
u8 ht40_plus_minus_allowed;
u8 multiple_bssid;
+ u8 ema;
/* Use driver-generated interface addresses when adding multiple BSSs */
u8 use_driver_iface_addr;
diff --git a/src/ap/beacon.c b/src/ap/beacon.c
index e29cd999bf21..3ee2f7c65ada 100644
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -533,7 +533,7 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd,
pos = hostapd_get_mde(hapd, pos, epos - pos);
if (hapd->iconf->multiple_bssid)
- pos = hostapd_eid_multiple_bssid(hapd, pos, epos, 0, NULL, 0, 0);
+ pos = hostapd_eid_multiple_bssid(hapd, pos, epos, 0, NULL, 0, 0, 0);
/* eCSA IE */
csa_pos = hostapd_eid_ecsa(hapd, pos);
@@ -547,8 +547,7 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd,
ext_cap_pos = pos;
pos = hostapd_eid_ext_capab(hapd, pos);
- if (hapd->iconf->multiple_bssid && (pos - ext_cap_pos >= 13) &&
- (ext_cap_pos[12] & 0x08))
+ if ((pos - ext_cap_pos >= 13) && (ext_cap_pos[12] & 0x08))
ext_cap_pos[12] |= 0x01;
pos = hostapd_eid_time_adv(hapd, pos);
@@ -1781,10 +1780,11 @@ int ieee802_11_build_ap_params(struct hostapd_data *hapd,
params->multiple_bssid_ies + len,
1, params->multiple_bssid_ie_offsets,
&params->multiple_bssid_ie_count,
- MULTIPLE_BSSID_IE_MAX);
+ MULTIPLE_BSSID_IE_MAX,
+ hapd->iconf->ema);
params->multiple_bssid_ie_len = end - params->multiple_bssid_ies;
- if ((ext_cap_len >= 13) && (ext_cap_pos[12] & 0x08) &&
- (params->multiple_bssid_ie_count <= 1))
+ if ((params->multiple_bssid_ie_count <= 1) &&
+ (ext_cap_len >= 13) && (ext_cap_pos[12] & 0x08))
ext_cap_pos[12] |= 0x01;
}
diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
index 65a556e3a606..4a6323bc623e 100644
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -5747,12 +5747,13 @@ multiple_bssid_too_big:
u8 * hostapd_eid_multiple_bssid(struct hostapd_data *hapd, u8 *eid, u8 *end,
u8 is_beacon, u8 **eid_offsets, int *eid_count,
- int eid_max)
+ int eid_max, u8 ema_beacon)
{
int count = 1;
while (count < hapd->iface->num_bss) {
- if (eid_offsets && *eid_count < eid_max) {
+ if (eid_offsets && eid_count && *eid_count < eid_max &&
+ (ema_beacon || count == 1)) {
eid_offsets[*eid_count] = eid;
*eid_count = *eid_count + 1;
}
diff --git a/src/ap/ieee802_11.h b/src/ap/ieee802_11.h
index 9ccfe6c10bd4..ff2595078869 100644
--- a/src/ap/ieee802_11.h
+++ b/src/ap/ieee802_11.h
@@ -121,7 +121,7 @@ void hostapd_client_poll_ok(struct hostapd_data *hapd, const u8 *addr);
u8 * hostapd_eid_bss_max_idle_period(struct hostapd_data *hapd, u8 *eid);
u8 * hostapd_eid_multiple_bssid(struct hostapd_data *hapd, u8 *eid, u8 *end,
u8 is_beacon, u8 **eid_offsets, int *eid_count,
- int eid_max);
+ int eid_max, u8 ema_beacon);
int hostapd_eid_multiple_bssid_len(struct hostapd_data *hapd);
u8 * hostapd_eid_reduced_neighbor_report(struct hostapd_data *hapd, u8 *eid);
size_t hostapd_eid_reduced_neighbor_report_len(struct hostapd_data *hapd);
diff --git a/src/ap/ieee802_11_shared.c b/src/ap/ieee802_11_shared.c
index 0e5a2a28bf62..0e0132a3a05e 100644
--- a/src/ap/ieee802_11_shared.c
+++ b/src/ap/ieee802_11_shared.c
@@ -426,9 +426,8 @@ static void hostapd_ext_capab_byte(struct hostapd_data *hapd, u8 *pos, int idx)
* Identifiers Used Exclusively */
}
#endif /* CONFIG_SAE */
- /* Bit 83 - EMA AP Support.
- * Currently enabled by default if MBSSID IE is enabled */
- if (hapd->iconf->multiple_bssid)
+ /* Bit 83 - EMA AP Support */
+ if (hapd->iconf->ema)
*pos |= 0x08;
if (hapd->conf->beacon_prot)
*pos |= 0x10; /* Bit 84 - Beacon Protection Enabled */
@@ -499,8 +498,7 @@ u8 * hostapd_eid_ext_capab(struct hostapd_data *hapd, u8 *eid)
hostapd_sae_pw_id_in_use(hapd->conf))
len = 11;
#endif /* CONFIG_SAE */
- if (len < 11 && (hapd->conf->beacon_prot ||
- hapd->iconf->multiple_bssid))
+ if (len < 11 && (hapd->conf->beacon_prot || hapd->iconf->ema))
len = 11;
#ifdef CONFIG_SAE_PK
if (len < 12 && hapd->conf->wpa &&
--
2.25.0

View File

@@ -0,0 +1,38 @@
From fbb47fb4bf673cc7d5c7b59a5c9cae5e1fea89eb Mon Sep 17 00:00:00 2001
From: Aloka Dixit <alokad@codeaurora.org>
Date: Tue, 29 Sep 2020 17:29:16 -0700
Subject: [PATCH] hostapd: Fix lowest association ID with multiple BSSID element
Association ID space is shared when multiple BSSID element is included
in beacons.
As per IEEE P802.11ax/D6.0, 11.1.3.8.5 Traffic advertisement in a
multiple BSSID set, the lowest association ID to be assigned to non-AP
station should be 2^n, where n is the maximum BSSID indicator of the
multiple BSSID set.
Example, if the set has 6 BSSes, the lowest association ID will be 8.
This patch sets the correct value which was incorrectly set to the number
BSSes in the multiple BSSID set.
Signed-off-by: Aloka Dixit <alokad@codeaurora.org>
---
src/ap/ieee802_11.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
index 65a556e3a606..a8ca9dcef0b5 100644
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -2718,7 +2718,7 @@ int hostapd_get_aid(struct hostapd_data *hapd, struct sta_info *sta)
return -1;
aid = i * 32 + j;
if (hapd->iconf->multiple_bssid)
- aid += hapd->iface->num_bss;
+ aid += pow(2, ceil(log2(hapd->iface->num_bss)));
else
aid += 1;
if (aid > 2007)
--
2.25.0

View File

@@ -0,0 +1,271 @@
From ed2cc4a481cf39c478459bd19836a926eea3ba32 Mon Sep 17 00:00:00 2001
From: Aloka Dixit <alokad@codeaurora.org>
Date: Sat, 3 Oct 2020 14:25:59 -0700
Subject: [PATCH] hostapd: Multiple BSSID DTIM setting
For EMA (Enhanced Multiple BSSID Advertisement) AP, nontransmitted
profiles should have DTIM value as a multiple of profile periodicity
as mentioned in IEEE P802.11ax/D7.0, 11.1.3.8.3 Discovery of a
nontransmitted BSSID profile.
This is to make sure that if there is a change in a profile, the next
beacon containing that profile will be the DTIM beacon.
The stations associated with the profile will be notified of the change
as soon as possible.
With existing design, the transmitted beacon is set before RSN
information element is formed for any nontransmitted profile hence the
beacon has these profiles with open encryption.
It also sets wrong profile periodicity until all profiles are up.
This patch fixes the issue by retrieving configurations for all
nontransmitted profiles before setting beacon for the transmitted
profile.
The profile periodicity is calculated before setting the beacon
and DTIM values are set to be the next multiple of profile periodicity.
Signed-off-by: Aloka Dixit <alokad@codeaurora.org>
---
src/ap/beacon.c | 1 +
src/ap/hostapd.c | 93 +++++++++++++++++++++++++++++++--------------
src/ap/ieee802_11.c | 47 ++++++++++++++++++++---
3 files changed, 108 insertions(+), 33 deletions(-)
diff --git a/src/ap/beacon.c b/src/ap/beacon.c
index f616cec5afde..f3862dbb17f1 100644
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -1788,6 +1788,7 @@ int ieee802_11_build_ap_params(struct hostapd_data *hapd,
if ((params->multiple_bssid_ie_count <= 1) &&
(ext_cap_len >= 13) && (ext_cap_pos[12] & 0x08))
ext_cap_pos[12] |= 0x01;
+ params->dtim_period = hapd->conf->dtim_period;
}
return 0;
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
index 6a9f617e0e04..54c954e74b37 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -1109,19 +1109,60 @@ static int db_table_create_radius_attributes(sqlite3 *db)
#endif /* CONFIG_NO_RADIUS */
+static int hostapd_set_beacon(struct hostapd_data *hapd)
+{
+ struct hostapd_bss_config *conf = hapd->conf;
+ int flush_old_stations = 1;
+
+#ifdef CONFIG_MESH
+ if ((hapd->conf->mesh & MESH_ENABLED) && hapd->iface->mconf == NULL)
+ flush_old_stations = 0;
+#endif /* CONFIG_MESH */
+
+ if (!conf->start_disabled && ieee802_11_set_beacon(hapd) < 0)
+ return -1;
+
+ if (flush_old_stations && !conf->start_disabled &&
+ conf->broadcast_deauth) {
+ u8 addr[ETH_ALEN];
+
+ /* Should any previously associated STA not have noticed that
+ * the AP had stopped and restarted, send one more
+ * deauthentication notification now that the AP is ready to
+ * operate. */
+ wpa_dbg(hapd->msg_ctx, MSG_DEBUG,
+ "Deauthenticate all stations at BSS start");
+ os_memset(addr, 0xff, ETH_ALEN);
+ hostapd_drv_sta_deauth(hapd, addr,
+ WLAN_REASON_PREV_AUTH_NOT_VALID);
+ }
+
+ if (hapd->wpa_auth && wpa_init_keys(hapd->wpa_auth) < 0)
+ return -1;
+
+ if (hapd->driver && hapd->driver->set_operstate)
+ hapd->driver->set_operstate(hapd->drv_priv, 1);
+
+ hostapd_ubus_add_bss(hapd);
+ return 0;
+}
/**
* hostapd_setup_bss - Per-BSS setup (initialization)
* @hapd: Pointer to BSS data
* @first: Whether this BSS is the first BSS of an interface; -1 = not first,
* but interface may exist
+ * @set_beacon: Whether beacon should be set. When MBSSID IE is enabled,
+ * information regarding all BSSes should be retrieved before setting
+ * beacons.
*
* This function is used to initialize all per-BSS data structures and
* resources. This gets called in a loop for each BSS when an interface is
* initialized. Most of the modules that are initialized here will be
* deinitialized in hostapd_cleanup().
*/
-static int hostapd_setup_bss(struct hostapd_data *hapd, int first)
+static int hostapd_setup_bss(struct hostapd_data *hapd, int first,
+ bool set_beacon)
{
struct hostapd_bss_config *conf = hapd->conf;
u8 ssid[SSID_MAX_LEN + 1];
@@ -1393,31 +1434,8 @@ static int hostapd_setup_bss(struct hostapd_data *hapd, int first)
return -1;
}
- if (!conf->start_disabled && ieee802_11_set_beacon(hapd) < 0)
- return -1;
-
- if (flush_old_stations && !conf->start_disabled &&
- conf->broadcast_deauth) {
- u8 addr[ETH_ALEN];
-
- /* Should any previously associated STA not have noticed that
- * the AP had stopped and restarted, send one more
- * deauthentication notification now that the AP is ready to
- * operate. */
- wpa_dbg(hapd->msg_ctx, MSG_DEBUG,
- "Deauthenticate all stations at BSS start");
- os_memset(addr, 0xff, ETH_ALEN);
- hostapd_drv_sta_deauth(hapd, addr,
- WLAN_REASON_PREV_AUTH_NOT_VALID);
- }
-
- if (hapd->wpa_auth && wpa_init_keys(hapd->wpa_auth) < 0)
- return -1;
-
- if (hapd->driver && hapd->driver->set_operstate)
- hapd->driver->set_operstate(hapd->drv_priv, 1);
-
- hostapd_ubus_add_bss(hapd);
+ if (set_beacon)
+ return hostapd_set_beacon(hapd);
return 0;
}
@@ -2109,7 +2127,8 @@ static int hostapd_setup_interface_complete_sync(struct hostapd_iface *iface,
hapd = iface->bss[j];
if (j)
os_memcpy(hapd->own_addr, prev_addr, ETH_ALEN);
- if (hostapd_setup_bss(hapd, j == 0)) {
+ if (hostapd_setup_bss(hapd, j == 0,
+ hapd->iconf->multiple_bssid? 0 : 1)) {
for (;;) {
hapd = iface->bss[j];
hostapd_bss_deinit_no_free(hapd);
@@ -2123,6 +2142,24 @@ static int hostapd_setup_interface_complete_sync(struct hostapd_iface *iface,
if (is_zero_ether_addr(hapd->conf->bssid))
prev_addr = hapd->own_addr;
}
+
+ if (hapd->iconf->multiple_bssid) {
+ for (j = 0; j < iface->num_bss; j++) {
+ hapd = iface->bss[j];
+ if (hostapd_set_beacon(hapd)) {
+ for (;;) {
+ hapd = iface->bss[j];
+ hostapd_bss_deinit_no_free(hapd);
+ hostapd_free_hapd_data(hapd);
+ if (j == 0)
+ break;
+ j--;
+ }
+ goto fail;
+ }
+ }
+ }
+
hapd = iface->bss[0];
hostapd_tx_queue_params(iface);
@@ -2989,7 +3026,7 @@ int hostapd_add_iface(struct hapd_interfaces *interfaces, char *buf)
if (start_ctrl_iface_bss(hapd) < 0 ||
(hapd_iface->state == HAPD_IFACE_ENABLED &&
- hostapd_setup_bss(hapd, -1))) {
+ hostapd_setup_bss(hapd, -1, 1))) {
hostapd_cleanup(hapd);
hapd_iface->bss[hapd_iface->num_bss - 1] = NULL;
hapd_iface->conf->num_bss--;
diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
index 74261ad7c0df..bb24bf91125a 100644
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -5699,7 +5699,7 @@ int hostapd_eid_multiple_bssid_len(struct hostapd_data *hapd)
static u8 * hostapd_eid_multiple_bssid_chunk(struct hostapd_data *hapd,
u8 *eid, u8 *end, int *count,
- u8 is_beacon)
+ u8 is_beacon, u8 *dtim_offset[])
{
u8 *size_offset, *num_offset;
int i;
@@ -5731,6 +5731,7 @@ static u8 * hostapd_eid_multiple_bssid_chunk(struct hostapd_data *hapd,
index_size_offset = eid++;
*eid++ = i;
if (is_beacon) {
+ dtim_offset[i] = eid;
*eid++ = bss->conf->dtim_period;
*eid++ = 0xFF;
}
@@ -5761,17 +5762,53 @@ u8 * hostapd_eid_multiple_bssid(struct hostapd_data *hapd, u8 *eid, u8 *end,
u8 is_beacon, u8 **eid_offsets, int *eid_count,
int eid_max, u8 ema_beacon)
{
- int count = 1;
+ int count = 1, dtim_period;
+ u8 remainder, **dtim_offset = NULL;
+ struct hostapd_bss_config *conf;
+ struct hostapd_iface *iface = hapd->iface;
+
+ if (eid_count &&
+ !(dtim_offset = os_zalloc(iface->num_bss * sizeof(eid))))
+ return eid;
- while (count < hapd->iface->num_bss) {
- if (eid_offsets && eid_count && *eid_count < eid_max &&
+ while (count < iface->num_bss) {
+ if (eid_offsets && eid_count && (*eid_count < eid_max) &&
(ema_beacon || count == 1)) {
eid_offsets[*eid_count] = eid;
*eid_count = *eid_count + 1;
}
eid = hostapd_eid_multiple_bssid_chunk(hapd, eid, end, &count,
- is_beacon);
+ is_beacon, dtim_offset);
}
+
+ if (!eid_count || !(*eid_count)) {
+ if (dtim_offset)
+ os_free(dtim_offset);
+ return eid;
+ }
+
+ do {
+ if (hapd != hostapd_get_primary_bss(hapd))
+ break;
+
+ for (count = 0; count < iface->num_bss; count++) {
+ conf = iface->bss[count]->conf;
+ dtim_period = conf->dtim_period;
+ remainder = dtim_period % (*eid_count);
+ if (remainder) {
+ conf->dtim_period += ((*eid_count) - remainder);
+ wpa_printf(MSG_DEBUG,
+ "Multiple BSSID: DTIM period changed from %d to %d for SSID %s\n",
+ dtim_period, conf->dtim_period,
+ conf->ssid.ssid);
+
+ if (count && dtim_offset[count])
+ *dtim_offset[count] = conf->dtim_period;
+ }
+ }
+ } while (0);
+
+ os_free(dtim_offset);
return eid;
}
--
2.25.0

View File

@@ -0,0 +1,58 @@
From 2fc69199a935c06c95f9b2766a4ec30208478720 Mon Sep 17 00:00:00 2001
From: Aloka Dixit <alokad@codeaurora.org>
Date: Wed, 30 Sep 2020 20:41:54 -0700
Subject: [PATCH] hostapd: Fix reduced neighbor report length
The function hostapd_eid_reduced_neighbor_report_len() doesn't include 2
bytes for the element ID and length fields which results in failure to
set beacon when more than basic features are enabled.
This patch fixes this error which was found after enabling radio
measurement capabilities.
Signed-off-by: Aloka Dixit <alokad@codeaurora.org>
---
src/ap/ieee802_11.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
index 65a556e3a606..806e8b02b732 100644
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -5771,6 +5771,8 @@ size_t hostapd_eid_reduced_neighbor_report_len(struct hostapd_data *hapd)
len += TBTT_HEADER_LENGTH + ((hapd->iface->num_bss - 1) * TBTT_INFO_LENGTH);
if (!dl_list_empty(&hapd->nr_db))
len += dl_list_len(&hapd->nr_db) * (TBTT_HEADER_LENGTH + TBTT_INFO_LENGTH);
+ if (len)
+ len += 2; /* Element ID and length */
return len;
}
@@ -5781,12 +5783,13 @@ u8 * hostapd_eid_reduced_neighbor_report(struct hostapd_data *hapd, u8 *eid)
size_t len = hostapd_eid_reduced_neighbor_report_len(hapd);
struct hostapd_neighbor_entry *nr;
int i, count = 0;
+ u8 *size_offset;
if (!len)
return eid;
*eid++ = WLAN_EID_REDUCED_NEIGHBOR_REPORT;
- *eid++ = len;
+ size_offset = eid++;
if (hapd->iface->num_bss > 1) {
u8 op_class, channel;
@@ -5848,6 +5851,9 @@ nr_db:
if (!count)
eid -= 2;
+ else
+ *size_offset = (eid - size_offset) - 1;
+
return eid;
}
--
2.25.0

View File

@@ -0,0 +1,262 @@
From 427d9ffc462dd1e76d03334d477864b7a33afc05 Mon Sep 17 00:00:00 2001
From: Aloka Dixit <alokad@codeaurora.org>
Date: Sat, 3 Oct 2020 15:41:11 -0700
Subject: [PATCH] hostapd: Hidden SSID support in multiple BSSID IE
Hidden nontransmitted BSSID profiles will be included in the beacons and
probe responses but SSID value will be removed or set to all zeros
depending on the configured value of 'ignore_broadcast_ssid'.
If complete profiles are omited, clients cannot stay connected to the AP.
For unicast probe requests with SSID set to a hidden nontransmitted BSSID
profile, complete SSID is included in the probe response.
This patch adds a new input parameter in related functions, pointer to
hostapd_data for nontransmitted profiles, to differentiate this case.
Signed-off-by: Aloka Dixit <alokad@codeaurora.org>
---
src/ap/beacon.c | 24 +++++++++++--------
src/ap/ieee802_11.c | 56 +++++++++++++++++++++++++++++++++------------
src/ap/ieee802_11.h | 7 ++++--
3 files changed, 62 insertions(+), 25 deletions(-)
diff --git a/src/ap/beacon.c b/src/ap/beacon.c
index f3862dbb17f1..808a2d939cbe 100644
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -432,12 +432,16 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd,
const struct ieee80211_mgmt *req,
int is_p2p, size_t *resp_len)
{
+ struct hostapd_data *hidden = NULL;
struct ieee80211_mgmt *resp;
u8 *pos, *epos, *csa_pos, *ext_cap_pos;
size_t buflen;
- if (hapd->iconf->multiple_bssid)
+ if (hapd->iconf->multiple_bssid &&
+ hapd != hostapd_get_primary_bss(hapd)) {
+ hidden = hapd;
hapd = hostapd_get_primary_bss(hapd);
+ }
#define MAX_PROBERESP_LEN 768
buflen = MAX_PROBERESP_LEN;
@@ -476,7 +480,7 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd,
buflen += hostapd_eid_owe_trans_len(hapd);
buflen += hostapd_eid_dpp_cc_len(hapd);
if (hapd->iconf->multiple_bssid)
- buflen += hostapd_eid_multiple_bssid_len(hapd);
+ buflen += hostapd_eid_multiple_bssid_len(hapd, hidden, 0);
resp = os_zalloc(buflen);
if (resp == NULL)
@@ -535,7 +539,8 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd,
pos = hostapd_get_mde(hapd, pos, epos - pos);
if (hapd->iconf->multiple_bssid)
- pos = hostapd_eid_multiple_bssid(hapd, pos, epos, 0, NULL, 0, 0, 0);
+ pos = hostapd_eid_multiple_bssid(hapd, hidden, pos, epos, 0,
+ NULL, 0, 0, 0);
/* eCSA IE */
csa_pos = hostapd_eid_ecsa(hapd, pos);
@@ -837,10 +842,6 @@ void handle_probe_req(struct hostapd_data *hapd,
.frame_info = fi,
};
- if (hapd->iconf->multiple_bssid &&
- hapd != hostapd_get_primary_bss(hapd))
- return;
-
if (len < IEEE80211_HDRLEN)
return;
ie = ((const u8 *) mgmt) + IEEE80211_HDRLEN;
@@ -1067,6 +1068,10 @@ void handle_probe_req(struct hostapd_data *hapd,
wpa_msg_ctrl(hapd->msg_ctx, MSG_INFO, RX_PROBE_REQUEST "sa=" MACSTR
" signal=%d", MAC2STR(mgmt->sa), ssi_signal);
+ if (hapd->iconf->multiple_bssid &&
+ hapd != hostapd_get_primary_bss(hapd) && res != EXACT_SSID_MATCH)
+ return;
+
resp = hostapd_gen_probe_resp(hapd, mgmt, elems.p2p != NULL,
&resp_len);
if (resp == NULL)
@@ -1770,7 +1775,7 @@ int ieee802_11_build_ap_params(struct hostapd_data *hapd,
}
if (hapd->iconf->multiple_bssid) {
- int len = hostapd_eid_multiple_bssid_len(hapd);
+ int len = hostapd_eid_multiple_bssid_len(hapd, NULL, 1);
u8 *end;
params->multiple_bssid_index = hostapd_get_bss_index(hapd);
@@ -1778,7 +1783,8 @@ int ieee802_11_build_ap_params(struct hostapd_data *hapd,
params->multiple_bssid_ies = os_zalloc(len);
if (params->multiple_bssid_ies == NULL)
return -1;
- end = hostapd_eid_multiple_bssid(hapd, params->multiple_bssid_ies,
+ end = hostapd_eid_multiple_bssid(hapd, NULL,
+ params->multiple_bssid_ies,
params->multiple_bssid_ies + len,
1, params->multiple_bssid_ie_offsets,
&params->multiple_bssid_ie_count,
diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
index 88c06d43d341..ffbadc535711 100644
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -5651,24 +5651,35 @@ u8 * hostapd_eid_wb_chsw_wrapper(struct hostapd_data *hapd, u8 *eid)
static int hostapd_eid_multiple_bssid_chunk_len(struct hostapd_data *hapd,
- int *count)
+ struct hostapd_data *hidden,
+ int *count,
+ u8 is_beacon)
{
/* ID + size + count */
int i, len = 3, nontx_profile_len;
size_t ies_len = 0;
struct hostapd_data *bss;
+ struct hostapd_bss_config *conf;
for (i = *count; i < hapd->iface->num_bss; i++) {
bss = hapd->iface->bss[i];
+ conf = bss->conf;
/*
* Sublement ID: 1 byte
* Length: 1 byte
* Nontransmitted capabilities: 4 bytes
- * Multiple BSSID Index Element: 5 bytes
- * SSID element: 2 + variable
+ * SSID element: 2 bytes
+ * Multiple BSSID Index Element: 3 bytes (+2 bytes in beacons)
*/
- nontx_profile_len = 13 + bss->conf->ssid.ssid_len;
+ nontx_profile_len = 11;
+
+ if (!conf->ignore_broadcast_ssid ||
+ conf->ignore_broadcast_ssid == 2 || bss == hidden)
+ nontx_profile_len += conf->ssid.ssid_len;
+
+ if (is_beacon)
+ nontx_profile_len += 2;
if (wpa_auth_get_wpa_ie(bss->wpa_auth, &ies_len))
nontx_profile_len += ies_len;
@@ -5686,21 +5697,27 @@ multiple_bssid_too_big:
}
-int hostapd_eid_multiple_bssid_len(struct hostapd_data *hapd)
+int hostapd_eid_multiple_bssid_len(struct hostapd_data *hapd,
+ struct hostapd_data *hidden,
+ u8 is_beacon)
{
int count = 1, len = 0;
while (count < hapd->iface->num_bss)
- len += hostapd_eid_multiple_bssid_chunk_len(hapd, &count);
+ len += hostapd_eid_multiple_bssid_chunk_len(hapd, hidden,
+ &count, is_beacon);
return len;
}
static u8 * hostapd_eid_multiple_bssid_chunk(struct hostapd_data *hapd,
+ struct hostapd_data *hidden,
u8 *eid, u8 *end, int *count,
u8 is_beacon, u8 *dtim_offset[])
{
+ struct hostapd_data *bss;
+ struct hostapd_bss_config *conf;
u8 *size_offset, *num_offset;
int i;
@@ -5709,7 +5726,8 @@ static u8 * hostapd_eid_multiple_bssid_chunk(struct hostapd_data *hapd,
num_offset = eid++;
for (i = *count; i < hapd->iface->num_bss; i++) {
- struct hostapd_data *bss = hapd->iface->bss[i];
+ bss = hapd->iface->bss[i];
+ conf = bss->conf;
u8 *bss_size_offset, *index_size_offset, *pos = eid;
u16 capab_info;
@@ -5723,16 +5741,24 @@ static u8 * hostapd_eid_multiple_bssid_chunk(struct hostapd_data *hapd,
eid += sizeof(capab_info);
*eid++ = WLAN_EID_SSID;
- *eid++ = bss->conf->ssid.ssid_len;
- os_memcpy(eid, bss->conf->ssid.ssid, bss->conf->ssid.ssid_len);
- eid += bss->conf->ssid.ssid_len;
+ if (!conf->ignore_broadcast_ssid || bss == hidden) {
+ *eid++ = conf->ssid.ssid_len;
+ os_memcpy(eid, conf->ssid.ssid, conf->ssid.ssid_len);
+ eid += conf->ssid.ssid_len;
+ } else if (conf->ignore_broadcast_ssid == 2) {
+ *eid++ = conf->ssid.ssid_len;
+ os_memset(eid, 0, conf->ssid.ssid_len);
+ eid += conf->ssid.ssid_len;
+ } else {
+ *eid++ = 0;
+ }
*eid++ = WLAN_EID_MULTIPLE_BSSID_INDEX;
index_size_offset = eid++;
*eid++ = i;
if (is_beacon) {
dtim_offset[i] = eid;
- *eid++ = bss->conf->dtim_period;
+ *eid++ = conf->dtim_period;
*eid++ = 0xFF;
}
*index_size_offset = (eid - index_size_offset) - 1;
@@ -5758,7 +5784,8 @@ multiple_bssid_too_big:
}
-u8 * hostapd_eid_multiple_bssid(struct hostapd_data *hapd, u8 *eid, u8 *end,
+u8 * hostapd_eid_multiple_bssid(struct hostapd_data *hapd,
+ struct hostapd_data *hidden, u8 *eid, u8 *end,
u8 is_beacon, u8 **eid_offsets, int *eid_count,
int eid_max, u8 ema_beacon)
{
@@ -5777,8 +5804,9 @@ u8 * hostapd_eid_multiple_bssid(struct hostapd_data *hapd, u8 *eid, u8 *end,
eid_offsets[*eid_count] = eid;
*eid_count = *eid_count + 1;
}
- eid = hostapd_eid_multiple_bssid_chunk(hapd, eid, end, &count,
- is_beacon, dtim_offset);
+ eid = hostapd_eid_multiple_bssid_chunk(hapd, hidden, eid, end,
+ &count, is_beacon,
+ dtim_offset);
}
if (!eid_count)
diff --git a/src/ap/ieee802_11.h b/src/ap/ieee802_11.h
index 9fbe89ed7c8e..1145210dbfc7 100644
--- a/src/ap/ieee802_11.h
+++ b/src/ap/ieee802_11.h
@@ -119,10 +119,13 @@ u8 * hostapd_eid_time_zone(struct hostapd_data *hapd, u8 *eid);
int hostapd_update_time_adv(struct hostapd_data *hapd);
void hostapd_client_poll_ok(struct hostapd_data *hapd, const u8 *addr);
u8 * hostapd_eid_bss_max_idle_period(struct hostapd_data *hapd, u8 *eid);
-u8 * hostapd_eid_multiple_bssid(struct hostapd_data *hapd, u8 *eid, u8 *end,
+u8 * hostapd_eid_multiple_bssid(struct hostapd_data *hapd,
+ struct hostapd_data *hidden, u8 *eid, u8 *end,
u8 is_beacon, u8 **eid_offsets, int *eid_count,
int eid_max, u8 ema_beacon);
-int hostapd_eid_multiple_bssid_len(struct hostapd_data *hapd);
+int hostapd_eid_multiple_bssid_len(struct hostapd_data *hapd,
+ struct hostapd_data *hidden,
+ u8 is_beacon);
u8 * hostapd_eid_reduced_neighbor_report(struct hostapd_data *hapd, u8 *eid);
size_t hostapd_eid_reduced_neighbor_report_len(struct hostapd_data *hapd);
int auth_sae_init_committed(struct hostapd_data *hapd, struct sta_info *sta);
--
2.25.0

View File

@@ -0,0 +1,659 @@
From 147810b51909c31fe9483190996190b6a89252fd Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Tue, 6 Oct 2020 15:03:13 -0700
Subject: [PATCH 1/4] co-located: add a config option to indicate co locate
A 6GHz BSS can be co-located with a 2/5GHz BSS. This option allows us to
indicate if this should be done.
Signed-off-by: John Crispin <john@phrozen.org>
---
hostapd/config_file.c | 2 ++
hostapd/hostapd.conf | 3 +++
src/ap/ap_config.h | 1 +
3 files changed, 6 insertions(+)
diff --git a/hostapd/config_file.c b/hostapd/config_file.c
index 0638b675bc34..18fc13569bc3 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -3612,6 +3612,8 @@ static int hostapd_config_fill(struct hostapd_config *conf,
"unsol_bcast_probe_resp_interval") == 0) {
bss->unsol_bcast_probe_resp_interval =
(atoi(pos) > 20) ? 20 : atoi(pos);
+ } else if (os_strcmp(buf, "he_co_locate") == 0) {
+ conf->he_co_locate = atoi(pos);
#endif /* CONFIG_IEEE80211AX */
} else if (os_strcmp(buf, "max_listen_interval") == 0) {
bss->max_listen_interval = atoi(pos);
diff --git a/hostapd/hostapd.conf b/hostapd/hostapd.conf
index d593bba97c83..48207af9b0b5 100644
--- a/hostapd/hostapd.conf
+++ b/hostapd/hostapd.conf
@@ -571,6 +571,9 @@ wmm_ac_vo_acm=0
# Default: 1 (enabled)
#broadcast_deauth=1
+# Enable co-locate for a 6GHz radio
+#co_locate=0
+
##### IEEE 802.11n related configuration ######################################
# ieee80211n: Whether IEEE 802.11n (HT) is enabled
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
index 440384136b74..0c1afced5cfe 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -1046,6 +1046,7 @@ struct hostapd_config {
u8 he_oper_chwidth;
u8 he_oper_centr_freq_seg0_idx;
u8 he_oper_centr_freq_seg1_idx;
+ bool he_co_locate;
#endif /* CONFIG_IEEE80211AX */
#ifdef CONFIG_IEEE80211AX
--
2.7.4
From 7624ae547dc5623a8e9e7d7e891b5968f73cf9db Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Tue, 6 Oct 2020 15:05:24 -0700
Subject: [PATCH 2/4] neighbor_db: set the co-locate bit
If the BSS is co-located, the corresponding bit needs to be set inside
bssid_info.
Signed-off-by: John Crispin <john@phrozen.org>
---
src/ap/neighbor_db.c | 3 +++
src/common/ieee802_11_defs.h | 2 ++
2 files changed, 5 insertions(+)
diff --git a/src/ap/neighbor_db.c b/src/ap/neighbor_db.c
index 06f6691342a0..2e63bebc5f13 100644
--- a/src/ap/neighbor_db.c
+++ b/src/ap/neighbor_db.c
@@ -282,6 +282,9 @@ void hostapd_neighbor_set_own_report(struct hostapd_data *hapd)
bssid_info |= NEI_REP_BSSID_INFO_HE;
}
+ if (hapd->iconf->he_co_locate)
+ bssid_info |= NEI_REP_BSSID_INFO_HE_CO_LOCATED;
+
/* TODO: Set NEI_REP_BSSID_INFO_MOBILITY_DOMAIN if MDE is set */
if (ieee80211_freq_to_channel_ext(hapd->iface->freq,
diff --git a/src/common/ieee802_11_defs.h b/src/common/ieee802_11_defs.h
index b7d0787280e9..94dd677b3308 100644
--- a/src/common/ieee802_11_defs.h
+++ b/src/common/ieee802_11_defs.h
@@ -2128,6 +2128,8 @@ enum phy_type {
#define NEI_REP_BSSID_INFO_VHT BIT(12)
#define NEI_REP_BSSID_INFO_FTM BIT(13)
#define NEI_REP_BSSID_INFO_HE BIT(14)
+#define NEI_REP_BSSID_INFO_HE_ER_BSS BIT(15)
+#define NEI_REP_BSSID_INFO_HE_CO_LOCATED BIT(16)
/*
* IEEE P802.11-REVmc/D5.0 Table 9-152 - HT/VHT Operation Information
--
2.7.4
From a2ec27dae137affda5f033c0dc26d3cf6a5ca6ed Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Mon, 21 Sep 2020 13:50:58 +0200
Subject: [PATCH 3/4] rrm: add handling for co-located BSS
A BSS shall include the neighbor entry of a co-located BSS upon an incoming
request.
Signed-off-by: John Crispin <john@phrozen.org>
---
src/ap/rrm.c | 117 +++++++++++++++++++++++++++++++++++++----------------------
1 file changed, 74 insertions(+), 43 deletions(-)
diff --git a/src/ap/rrm.c b/src/ap/rrm.c
index f2d5cd16e885..c9d51dfa7132 100644
--- a/src/ap/rrm.c
+++ b/src/ap/rrm.c
@@ -196,6 +196,63 @@ static size_t hostapd_neighbor_report_len(struct wpabuf *buf,
}
+static int hostapd_add_nei_report_entry(struct wpabuf *buf, struct hostapd_neighbor_entry *nr,
+ struct wpa_ssid_value *ssid, u8 lci,
+ u8 civic, u16 lci_max_age)
+{
+ u8 *msmt_token;
+ int send_lci;
+ size_t len;
+
+ if (ssid->ssid_len != nr->ssid.ssid_len ||
+ os_memcmp(ssid->ssid, nr->ssid.ssid, ssid->ssid_len) != 0)
+ return 0;
+
+ send_lci = (lci != 0) && hostapd_check_lci_age(nr, lci_max_age);
+ len = hostapd_neighbor_report_len(buf, nr, send_lci, civic);
+
+ if (len - 2 > 0xff) {
+ wpa_printf(MSG_DEBUG,
+ "NR entry for " MACSTR " exceeds 0xFF bytes",
+ MAC2STR(nr->bssid));
+ return 0;
+ }
+
+ if (len > wpabuf_tailroom(buf))
+ return -1;
+
+ wpabuf_put_u8(buf, WLAN_EID_NEIGHBOR_REPORT);
+ wpabuf_put_u8(buf, len - 2);
+ wpabuf_put_buf(buf, nr->nr);
+
+ if (send_lci && nr->lci) {
+ wpabuf_put_u8(buf, WLAN_EID_MEASURE_REPORT);
+ wpabuf_put_u8(buf, wpabuf_len(nr->lci));
+ /*
+ * Override measurement token - the first byte of the
+ * Measurement Report element.
+ */
+ msmt_token = wpabuf_put(buf, 0);
+ wpabuf_put_buf(buf, nr->lci);
+ *msmt_token = lci;
+ }
+
+ if (civic && nr->civic) {
+ wpabuf_put_u8(buf, WLAN_EID_MEASURE_REPORT);
+ wpabuf_put_u8(buf, wpabuf_len(nr->civic));
+ /*
+ * Override measurement token - the first byte of the
+ * Measurement Report element.
+ */
+ msmt_token = wpabuf_put(buf, 0);
+ wpabuf_put_buf(buf, nr->civic);
+ *msmt_token = civic;
+ }
+
+ return 0;
+}
+
+
static void hostapd_send_nei_report_resp(struct hostapd_data *hapd,
const u8 *addr, u8 dialog_token,
struct wpa_ssid_value *ssid, u8 lci,
@@ -203,7 +260,6 @@ static void hostapd_send_nei_report_resp(struct hostapd_data *hapd,
{
struct hostapd_neighbor_entry *nr;
struct wpabuf *buf;
- u8 *msmt_token;
/*
* The number and length of the Neighbor Report elements in a Neighbor
@@ -220,52 +276,27 @@ static void hostapd_send_nei_report_resp(struct hostapd_data *hapd,
dl_list_for_each(nr, &hapd->nr_db, struct hostapd_neighbor_entry,
list) {
- int send_lci;
- size_t len;
-
- if (ssid->ssid_len != nr->ssid.ssid_len ||
- os_memcmp(ssid->ssid, nr->ssid.ssid, ssid->ssid_len) != 0)
- continue;
-
- send_lci = (lci != 0) && hostapd_check_lci_age(nr, lci_max_age);
- len = hostapd_neighbor_report_len(buf, nr, send_lci, civic);
-
- if (len - 2 > 0xff) {
- wpa_printf(MSG_DEBUG,
- "NR entry for " MACSTR " exceeds 0xFF bytes",
- MAC2STR(nr->bssid));
- continue;
- }
-
- if (len > wpabuf_tailroom(buf))
+ if (hostapd_add_nei_report_entry(buf, nr, ssid, lci, civic, lci_max_age))
break;
+ }
- wpabuf_put_u8(buf, WLAN_EID_NEIGHBOR_REPORT);
- wpabuf_put_u8(buf, len - 2);
- wpabuf_put_buf(buf, nr->nr);
+ if (!hapd->iconf->he_co_locate) {
+ int i;
- if (send_lci && nr->lci) {
- wpabuf_put_u8(buf, WLAN_EID_MEASURE_REPORT);
- wpabuf_put_u8(buf, wpabuf_len(nr->lci));
- /*
- * Override measurement token - the first byte of the
- * Measurement Report element.
- */
- msmt_token = wpabuf_put(buf, 0);
- wpabuf_put_buf(buf, nr->lci);
- *msmt_token = lci;
- }
+ for (i = 0; i < hapd->iface->interfaces->count; i++) {
+ struct hostapd_iface *iface = hapd->iface->interfaces->iface[i];
+ int j;
+
+ if (iface == hapd->iface || !iface->conf->he_co_locate)
+ continue;
- if (civic && nr->civic) {
- wpabuf_put_u8(buf, WLAN_EID_MEASURE_REPORT);
- wpabuf_put_u8(buf, wpabuf_len(nr->civic));
- /*
- * Override measurement token - the first byte of the
- * Measurement Report element.
- */
- msmt_token = wpabuf_put(buf, 0);
- wpabuf_put_buf(buf, nr->civic);
- *msmt_token = civic;
+ for (j = 0; j < iface->num_bss; j++) {
+ nr = hostapd_neighbor_get(iface->bss[j], iface->bss[j]->own_addr, NULL);
+ if (!nr)
+ continue;
+ if (hostapd_add_nei_report_entry(buf, nr, ssid, lci, civic, lci_max_age))
+ break;
+ }
}
}
--
2.7.4
From 9e0865b8135bf1286c864ae3da601c40e3325153 Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Wed, 21 Oct 2020 11:47:22 -0700
Subject: [PATCH 4/4] rnr: add reduced neighbor reporting
The Reduced Neighbor Report (rnr) element contains channel and other
information related to neighbor APs. It is part of the OCE requirement.
Signed-off-by: John Crispin <john@phrozen.org>
Signed-off-by: Aloka Dixit <alokad@codeaurora.org>
Signed-off-by: Muna Sinada <msinada@codeaurora.org>
---
src/ap/beacon.c | 40 ++++++++--
src/ap/ieee802_11.c | 177 ++++++++++++++++++++++++++++++++-----------
src/ap/ieee802_11.h | 4 +-
src/common/ieee802_11_defs.h | 6 +-
4 files changed, 171 insertions(+), 56 deletions(-)
diff --git a/src/ap/beacon.c b/src/ap/beacon.c
index 808a2d939cbe..b6592f219e65 100644
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -481,6 +481,8 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd,
buflen += hostapd_eid_dpp_cc_len(hapd);
if (hapd->iconf->multiple_bssid)
buflen += hostapd_eid_multiple_bssid_len(hapd, hidden, 0);
+ if (hapd->conf->rnr_beacon)
+ buflen += hostapd_eid_reduced_neighbor_report_len(hapd, 1);
resp = os_zalloc(buflen);
if (resp == NULL)
@@ -639,6 +641,8 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd,
pos = hostapd_eid_mbo(hapd, pos, (u8 *) resp + buflen - pos);
pos = hostapd_eid_owe_trans(hapd, pos, (u8 *) resp + buflen - pos);
pos = hostapd_eid_dpp_cc(hapd, pos, (u8 *) resp + buflen - pos);
+ if (hapd->conf->rnr_beacon)
+ pos = hostapd_eid_reduced_neighbor_report(hapd, pos, 1);
if (hapd->conf->vendor_elements) {
os_memcpy(pos, wpabuf_head(hapd->conf->vendor_elements),
@@ -654,7 +658,8 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd,
enum ssid_match_result {
NO_SSID_MATCH,
EXACT_SSID_MATCH,
- WILDCARD_SSID_MATCH
+ WILDCARD_SSID_MATCH,
+ CO_LOCATED_SSID_MATCH
};
static enum ssid_match_result ssid_match(struct hostapd_data *hapd,
@@ -666,6 +671,7 @@ static enum ssid_match_result ssid_match(struct hostapd_data *hapd,
{
const u8 *pos, *end;
int wildcard = 0;
+ size_t i, j;
if (ssid_len == 0)
wildcard = 1;
@@ -699,6 +705,25 @@ static enum ssid_match_result ssid_match(struct hostapd_data *hapd,
}
}
+ /* Case of probe request from STA with SSID matching the SSID of a
+ * co-located AP
+ */
+ if (!wildcard && hapd->conf->rnr_beacon) {
+ for (i = 0; i < hapd->iface->interfaces->count; i++) {
+ struct hostapd_iface *iface = hapd->iface->interfaces->iface[i];
+
+ if (iface == hapd->iface || !iface->conf->he_co_locate)
+ continue;
+
+ struct hostapd_iface *iface2 = iface->bss[0]->iface;
+ for (j = 0; j < iface2->num_bss; j++){
+ if (ssid_len == iface2->bss[j]->conf->ssid.ssid_len &&
+ os_memcmp(ssid, iface2->bss[j]->conf->ssid.ssid, ssid_len) == 0)
+ return CO_LOCATED_SSID_MATCH;
+ }
+ }
+ }
+
return wildcard ? WILDCARD_SSID_MATCH : NO_SSID_MATCH;
}
@@ -1069,7 +1094,8 @@ void handle_probe_req(struct hostapd_data *hapd,
" signal=%d", MAC2STR(mgmt->sa), ssi_signal);
if (hapd->iconf->multiple_bssid &&
- hapd != hostapd_get_primary_bss(hapd) && res != EXACT_SSID_MATCH)
+ hapd != hostapd_get_primary_bss(hapd) &&
+ (res != EXACT_SSID_MATCH && res != CO_LOCATED_SSID_MATCH))
return;
resp = hostapd_gen_probe_resp(hapd, mgmt, elems.p2p != NULL,
@@ -1343,7 +1369,7 @@ static u8 * hostapd_gen_fils_discovery(struct hostapd_data *hapd, u32 *len)
total_len += 3;
}
- total_len += hostapd_eid_reduced_neighbor_report_len(hapd);
+ total_len += hostapd_eid_reduced_neighbor_report_len(hapd, 0);
pos = hostapd_eid_fils_indic(hapd, buf, 0);
buf_len = pos - buf;
@@ -1401,7 +1427,7 @@ static u8 * hostapd_gen_fils_discovery(struct hostapd_data *hapd, u32 *len)
*length_pos = pos - (length_pos + 1);
/* Reduced Neighbor Report element */
- pos = hostapd_eid_reduced_neighbor_report(hapd, pos);
+ pos = hostapd_eid_reduced_neighbor_report(hapd, pos, 0);
/* FILS indication element */
if (buf_len) {
@@ -1496,7 +1522,8 @@ int ieee802_11_build_ap_params(struct hostapd_data *hapd,
tail_len += hostapd_mbo_ie_len(hapd);
tail_len += hostapd_eid_owe_trans_len(hapd);
tail_len += hostapd_eid_dpp_cc_len(hapd);
- tail_len += hostapd_eid_reduced_neighbor_report_len(hapd);
+ if (hapd->conf->rnr_beacon)
+ tail_len += hostapd_eid_reduced_neighbor_report_len(hapd, 0);
tailpos = tail = os_malloc(tail_len);
if (head == NULL || tail == NULL) {
@@ -1668,7 +1695,8 @@ int ieee802_11_build_ap_params(struct hostapd_data *hapd,
tailpos = hostapd_eid_owe_trans(hapd, tailpos,
tail + tail_len - tailpos);
tailpos = hostapd_eid_dpp_cc(hapd, tailpos, tail + tail_len - tailpos);
- tailpos = hostapd_eid_reduced_neighbor_report(hapd, tailpos);
+ if (hapd->conf->rnr_beacon)
+ tailpos = hostapd_eid_reduced_neighbor_report(hapd, tailpos, 0);
if (hapd->conf->vendor_elements) {
os_memcpy(tailpos, wpabuf_head(hapd->conf->vendor_elements),
diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
index 9c0f38fc0bf1..3be299a477b9 100644
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -5841,14 +5841,45 @@ u8 * hostapd_eid_multiple_bssid(struct hostapd_data *hapd,
}
-size_t hostapd_eid_reduced_neighbor_report_len(struct hostapd_data *hapd)
+size_t hostapd_eid_reduced_neighbor_report_iface_len(struct hostapd_data *hapd,
+ struct hostapd_data *reporting_hapd)
{
size_t len = 0;
+ int i;
+ for (i = 0; i < hapd->iface->num_bss; i++) {
+ if (hapd->iface->bss[i] == reporting_hapd ||
+ hapd->iface->bss[i]->conf->ignore_broadcast_ssid)
+ continue;
+ len += TBTT_INFO_LENGTH;
+ }
+ return len;
+}
+
+
+size_t hostapd_eid_reduced_neighbor_report_len(struct hostapd_data *hapd, bool probe_resp)
+{
+ size_t len = 0;
+ int i;
if (hapd->iface->num_bss > 1)
- len += TBTT_HEADER_LENGTH + ((hapd->iface->num_bss - 1) * TBTT_INFO_LENGTH);
- if (!dl_list_empty(&hapd->nr_db))
+ len += (TBTT_HEADER_LENGTH +
+ hostapd_eid_reduced_neighbor_report_iface_len(hapd,
+ hapd));
+
+ for (i = 0; i < hapd->iface->interfaces->count; i++) {
+ struct hostapd_iface *iface = hapd->iface->interfaces->iface[i];
+
+ if (iface == hapd->iface || !iface->conf->he_co_locate)
+ continue;
+
+ len += (TBTT_HEADER_LENGTH +
+ hostapd_eid_reduced_neighbor_report_iface_len(iface->bss[0],
+ hapd));
+ }
+
+ if (!probe_resp && !dl_list_empty(&hapd->nr_db))
len += dl_list_len(&hapd->nr_db) * (TBTT_HEADER_LENGTH + TBTT_INFO_LENGTH);
+
if (len)
len += 2; /* Element ID and length */
@@ -5856,58 +5887,76 @@ size_t hostapd_eid_reduced_neighbor_report_len(struct hostapd_data *hapd)
}
-u8 * hostapd_eid_reduced_neighbor_report(struct hostapd_data *hapd, u8 *eid)
+static u8 *hostapd_eid_reduced_neighbor_report_iface(struct hostapd_data *hapd,
+ struct hostapd_data *reporting_hapd,
+ u8 *eid, int *count)
{
- size_t len = hostapd_eid_reduced_neighbor_report_len(hapd);
- struct hostapd_neighbor_entry *nr;
- int i, count = 0;
- u8 *size_offset;
+ u8 *eid_start = eid, *tbtt_count_pos;
+ u8 tbtt_count = 0;
+ u8 op_class, channel;
+ int i;
- if (!len)
+ if (!(hapd->iface->drv_flags & WPA_DRIVER_FLAGS_AP_CSA) ||
+ !hapd->iface->freq)
return eid;
- *eid++ = WLAN_EID_REDUCED_NEIGHBOR_REPORT;
- size_offset = eid++;
-
- if (hapd->iface->num_bss > 1) {
- u8 op_class, channel;
+ if (ieee80211_freq_to_channel_ext(hapd->iface->freq,
+ hapd->iconf->secondary_channel,
+ hostapd_get_oper_chwidth(hapd->iconf),
+ &op_class, &channel) ==
+ NUM_HOSTAPD_MODES)
+ return eid;
- if (!(hapd->iface->drv_flags & WPA_DRIVER_FLAGS_AP_CSA) ||
- !hapd->iface->freq)
- goto nr_db;
+ tbtt_count_pos = eid++;
+ *eid++ = TBTT_INFO_LENGTH;
+ *eid++ = op_class;
+ *eid++ = hapd->iconf->channel;
+ for (i = 0; i < hapd->iface->num_bss; i++) {
+ u8 bss_param = 0;
- if (ieee80211_freq_to_channel_ext(hapd->iface->freq,
- hapd->iconf->secondary_channel,
- hostapd_get_oper_chwidth(hapd->iconf),
- &op_class, &channel) ==
- NUM_HOSTAPD_MODES)
- goto nr_db;
+ if (hapd->iface->bss[i] == reporting_hapd ||
+ hapd->iface->bss[i]->conf->ignore_broadcast_ssid)
+ continue;
- *eid++ = TBTT_INFO_COUNT(hapd->iface->num_bss - 2);
- *eid++ = TBTT_INFO_LENGTH;
- *eid++ = op_class;
- *eid++ = hapd->iconf->channel;
- for (i = 0; i < hapd->iface->num_bss; i++) {
- u8 bss_param = 0;
-
- if (hapd->iface->bss[i] == hapd)
- continue;
- *eid++ = TBTT_AP_OFFSET_UNKNOWN;
- os_memcpy(eid, hapd->iface->bss[i]->conf->bssid, ETH_ALEN);
- eid += 6;
- os_memcpy(eid, &hapd->iface->bss[i]->conf->ssid.short_ssid, 4);
- eid += 4;
- if (hapd->iface->bss[i]->conf->ssid.short_ssid ==
- hapd->conf->ssid.short_ssid)
- bss_param |= TBTT_BSS_PARAM_SAME_SSID;
- if (hapd->iconf->multiple_bssid)
- bss_param |= TBTT_BSS_PARAM_MULTIPLE_BSSID;
- *eid++ = bss_param;
- count++;
+ *eid++ = TBTT_AP_OFFSET_UNKNOWN;
+ os_memcpy(eid, hapd->iface->bss[i]->conf->bssid, ETH_ALEN);
+ eid += 6;
+ os_memcpy(eid, &hapd->iface->bss[i]->conf->ssid.short_ssid, 4);
+ eid += 4;
+ if (hapd->iface->bss[i]->conf->ssid.short_ssid ==
+ reporting_hapd->conf->ssid.short_ssid)
+ bss_param |= TBTT_BSS_PARAM_SAME_SSID;
+
+ if (hapd->iconf->multiple_bssid && hapd->iface->num_bss > 1) {
+ bss_param |= TBTT_BSS_PARAM_MULTIPLE_BSSID;
+ if (hapd->iface->bss[i] == hostapd_get_primary_bss(hapd->iface->bss[i]))
+ bss_param |= TBTT_BSS_PARAM_TRANSMITTED_BSSID;
}
+ if (hapd->iface->bss[i]->iconf->he_co_locate)
+ bss_param |= TBTT_BSS_PARAM_CO_LOCATED;
+
+ if (hapd->iface->bss[i]->conf->unsol_bcast_probe_resp_interval)
+ bss_param |= TBTT_BSS_PARAM_20_TU_PROBE_RESP_ACTIVE;
+
+ *eid++ = bss_param;
+ /* Setting 20 MHz PSD */
+ *eid++ = TBTT_PSD_MAX_TXPOWER;
+ *count += 1;
+ tbtt_count++;
}
-nr_db:
+ if (tbtt_count == 0)
+ return eid_start;
+
+ *tbtt_count_pos = TBTT_INFO_COUNT(tbtt_count - 1);
+ return eid;
+}
+
+
+static u8 *hostapd_eid_reduced_neighbor_report_nr_db(struct hostapd_data *hapd, u8 *eid, int *count)
+{
+ struct hostapd_neighbor_entry *nr;
+
dl_list_for_each(nr, &hapd->nr_db, struct hostapd_neighbor_entry,
list) {
if (!nr->nr || wpabuf_len(nr->nr) < 12)
@@ -5924,9 +5973,45 @@ nr_db:
os_memcpy(eid, &nr->short_ssid, 4);
eid += 4;
*eid++ = nr->bss_parameters;
- count++;
+ /* setting 20 MHZ PSD */
+ *eid++ = TBTT_PSD_MAX_TXPOWER;
+ *count += 1;
}
+ return eid;
+}
+
+
+u8 * hostapd_eid_reduced_neighbor_report(struct hostapd_data *hapd, u8 *eid, bool probe_resp)
+{
+ size_t len = hostapd_eid_reduced_neighbor_report_len(hapd, probe_resp);
+ int i, count = 0;
+ u8 *size_offset;
+
+ if (!len)
+ return eid;
+
+ *eid++ = WLAN_EID_REDUCED_NEIGHBOR_REPORT;
+ size_offset = eid++;
+
+ if (hapd->iface->num_bss > 1)
+ eid = hostapd_eid_reduced_neighbor_report_iface(hapd, hapd,
+ eid, &count);
+
+ for (i = 0; i < hapd->iface->interfaces->count; i++) {
+ struct hostapd_iface *iface = hapd->iface->interfaces->iface[i];
+
+ if (iface == hapd->iface || !iface->conf->he_co_locate)
+ continue;
+
+ eid = hostapd_eid_reduced_neighbor_report_iface(iface->bss[0],
+ hapd, eid,
+ &count);
+ }
+
+ if (!probe_resp)
+ hostapd_eid_reduced_neighbor_report_nr_db(hapd, eid, &count);
+
if (!count)
eid -= 2;
else
diff --git a/src/ap/ieee802_11.h b/src/ap/ieee802_11.h
index 1145210dbfc7..2f45b615f15d 100644
--- a/src/ap/ieee802_11.h
+++ b/src/ap/ieee802_11.h
@@ -126,8 +126,8 @@ u8 * hostapd_eid_multiple_bssid(struct hostapd_data *hapd,
int hostapd_eid_multiple_bssid_len(struct hostapd_data *hapd,
struct hostapd_data *hidden,
u8 is_beacon);
-u8 * hostapd_eid_reduced_neighbor_report(struct hostapd_data *hapd, u8 *eid);
-size_t hostapd_eid_reduced_neighbor_report_len(struct hostapd_data *hapd);
+u8 * hostapd_eid_reduced_neighbor_report(struct hostapd_data *hapd, u8 *eid, bool probe_resp);
+size_t hostapd_eid_reduced_neighbor_report_len(struct hostapd_data *hapd, bool probe_resp);
int auth_sae_init_committed(struct hostapd_data *hapd, struct sta_info *sta);
#ifdef CONFIG_SAE
void sae_clear_retransmit_timer(struct hostapd_data *hapd,
diff --git a/src/common/ieee802_11_defs.h b/src/common/ieee802_11_defs.h
index 94dd677b3308..2ac497db067e 100644
--- a/src/common/ieee802_11_defs.h
+++ b/src/common/ieee802_11_defs.h
@@ -2393,7 +2393,7 @@ enum edmg_bw_config {
/* TBTT Information field defines */
#define TBTT_HEADER_LENGTH 4
-#define TBTT_INFO_LENGTH 12
+#define TBTT_INFO_LENGTH 13
#define TBTT_INFO_FILTERED_NEIGH_AP BIT(2)
#define TBTT_INFO_COUNT(x) (((x) & 0xf) << 4)
#define TBTT_AP_OFFSET_UNKNOWN 255
@@ -2401,7 +2401,9 @@ enum edmg_bw_config {
#define TBTT_BSS_PARAM_SAME_SSID BIT(1)
#define TBTT_BSS_PARAM_MULTIPLE_BSSID BIT(2)
#define TBTT_BSS_PARAM_TRANSMITTED_BSSID BIT(3)
-#define TBTT_BSS_PARAM_CO_LOCATED_ESS BIT(4)
+#define TBTT_BSS_PARAM_MEMBER_CO_LOCATED_ESS BIT(4)
#define TBTT_BSS_PARAM_20_TU_PROBE_RESP_ACTIVE BIT(5)
+#define TBTT_BSS_PARAM_CO_LOCATED BIT(6)
+#define TBTT_PSD_MAX_TXPOWER 255 /* dBm */
#endif /* IEEE802_11_DEFS_H */
--
2.7.4

View File

@@ -1,8 +1,7 @@
From c50e1c21882182fe8fa568204d831eb618d313c0 Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Wed, 17 Jun 2020 14:40:58 +0200
Subject: [PATCH 801/813] bss coloring: add support for handling collision
Subject: [PATCH V4 1/6] bss coloring: add support for handling collision
events and triggering CCA
Date: Wed, 26 Aug 2020 08:22:11 +0200
Add the core code for handling bss color collision events and triggering
CCA inside the kernel.
@@ -16,11 +15,9 @@ Signed-off-by: John Crispin <john@phrozen.org>
src/drivers/driver.h | 31 +++++++++
5 files changed, 184 insertions(+)
diff --git a/src/ap/ap_drv_ops.h b/src/ap/ap_drv_ops.h
index 5738c1c97..838d4c57a 100644
--- a/src/ap/ap_drv_ops.h
+++ b/src/ap/ap_drv_ops.h
@@ -298,6 +298,18 @@ static inline int hostapd_drv_switch_channel(struct hostapd_data *hapd,
@@ -299,6 +299,18 @@ static inline int hostapd_drv_switch_cha
return hapd->driver->switch_channel(hapd->drv_priv, settings);
}
@@ -39,11 +36,9 @@ index 5738c1c97..838d4c57a 100644
static inline int hostapd_drv_status(struct hostapd_data *hapd, char *buf,
size_t buflen)
{
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
index c442b82db..1992b38d6 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -66,6 +66,8 @@ static int setup_interface2(struct hostapd_iface *iface);
@@ -65,6 +65,8 @@ static int setup_interface2(struct hosta
static void channel_list_update_timeout(void *eloop_ctx, void *timeout_ctx);
static void hostapd_interface_setup_failure_handler(void *eloop_ctx,
void *timeout_ctx);
@@ -52,7 +47,7 @@ index c442b82db..1992b38d6 100644
int hostapd_for_each_interface(struct hapd_interfaces *interfaces,
@@ -476,6 +478,9 @@ static void hostapd_free_hapd_data(struct hostapd_data *hapd)
@@ -476,6 +478,9 @@ static void hostapd_free_hapd_data(struc
}
eloop_cancel_timeout(auth_sae_process_commit, hapd, NULL);
#endif /* CONFIG_SAE */
@@ -62,7 +57,7 @@ index c442b82db..1992b38d6 100644
}
@@ -3654,6 +3659,120 @@ hostapd_switch_channel_fallback(struct hostapd_iface *iface,
@@ -3698,6 +3703,119 @@ hostapd_switch_channel_fallback(struct h
hostapd_enable_iface(iface);
}
@@ -122,7 +117,7 @@ index c442b82db..1992b38d6 100644
+ return;
+
+ /* check if there has been a recent collision */
+ if (now.sec - hapd->last_color_collision.sec >= 10)
+ if (now.sec - hapd->last_color_collision.sec > 50)
+ return;
+
+ r = os_random() % HE_OPERATION_BSS_COLOR_MAX;
@@ -135,7 +130,6 @@ index c442b82db..1992b38d6 100644
+ /* there are no free colors so turn bss coloring off */
+ wpa_printf(MSG_INFO, "no free colors left, turning of BSS coloring");
+ hapd->iface->conf->he_op.he_bss_color_disabled = 1;
+ hapd->iface->conf->he_op.he_bss_color = 1;
+ for (b = 0; b < hapd->iface->num_bss; b++)
+ ieee802_11_set_beacon(hapd->iface->bss[b]);
+ return;
@@ -183,11 +177,9 @@ index c442b82db..1992b38d6 100644
#endif /* NEED_AP_MLME */
diff --git a/src/ap/hostapd.h b/src/ap/hostapd.h
index 44d2c6068..19dcd1b51 100644
--- a/src/ap/hostapd.h
+++ b/src/ap/hostapd.h
@@ -292,6 +292,16 @@ struct hostapd_data {
@@ -296,6 +296,16 @@ struct hostapd_data {
unsigned int cs_c_off_ecsa_beacon;
unsigned int cs_c_off_ecsa_proberesp;
@@ -204,7 +196,7 @@ index 44d2c6068..19dcd1b51 100644
#ifdef CONFIG_P2P
struct p2p_data *p2p;
struct p2p_group *p2p_group;
@@ -636,6 +646,12 @@ void hostapd_periodic_iface(struct hostapd_iface *iface);
@@ -642,6 +652,12 @@ void hostapd_periodic_iface(struct hosta
int hostapd_owe_trans_get_info(struct hostapd_data *hapd);
void hostapd_ocv_check_csa_sa_query(void *eloop_ctx, void *timeout_ctx);
@@ -217,11 +209,9 @@ index 44d2c6068..19dcd1b51 100644
/* utils.c */
int hostapd_register_probereq_cb(struct hostapd_data *hapd,
int (*cb)(void *ctx, const u8 *sa,
diff --git a/src/common/ieee802_11_defs.h b/src/common/ieee802_11_defs.h
index ebb98ed38..92d3c1d49 100644
--- a/src/common/ieee802_11_defs.h
+++ b/src/common/ieee802_11_defs.h
@@ -2266,6 +2266,7 @@ struct ieee80211_spatial_reuse {
@@ -2275,6 +2275,7 @@ struct ieee80211_spatial_reuse {
#define HE_OPERATION_BSS_COLOR_PARTIAL ((u32) BIT(30))
#define HE_OPERATION_BSS_COLOR_DISABLED ((u32) BIT(31))
#define HE_OPERATION_BSS_COLOR_OFFSET 24
@@ -229,9 +219,9 @@ index ebb98ed38..92d3c1d49 100644
/* Spatial Reuse defines */
#define SPATIAL_REUSE_SRP_DISALLOWED BIT(0)
@@ -2343,4 +2344,9 @@ enum edmg_bw_config {
/* DPP Public Action frame identifiers - OUI_WFA */
#define DPP_OUI_TYPE 0x1A
@@ -2402,4 +2403,9 @@ enum edmg_bw_config {
#define TBTT_BSS_PARAM_CO_LOCATED_ESS BIT(4)
#define TBTT_BSS_PARAM_20_TU_PROBE_RESP_ACTIVE BIT(5)
+/* IEEE802.11/D6.0 - 26.17.3.5.1
+ * the minimum default timeout between color collision and color change is defined as 50s
@@ -239,11 +229,9 @@ index ebb98ed38..92d3c1d49 100644
+#define DOT11BSS_COLOR_COLLISION_AP_PERIOD 50
+
#endif /* IEEE802_11_DEFS_H */
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index eca2ca3a4..2a2bc29db 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -2343,6 +2343,26 @@ struct csa_settings {
@@ -2400,6 +2400,26 @@ struct csa_settings {
u16 counter_offset_presp[2];
};
@@ -270,11 +258,10 @@ index eca2ca3a4..2a2bc29db 100644
/* TDLS peer capabilities for send_tdls_mgmt() */
enum tdls_peer_capability {
TDLS_PEER_HT = BIT(0),
@@ -3913,6 +3933,17 @@ struct wpa_driver_ops {
*/
@@ -3972,6 +3992,17 @@ struct wpa_driver_ops {
int (*switch_channel)(void *priv, struct csa_settings *settings);
+ /**
/**
+ * switch_color - Announce color switch and migrate the BSS to the
+ * given color
+ * @priv: Private driver interface data
@@ -285,9 +272,7 @@ index eca2ca3a4..2a2bc29db 100644
+ */
+ int (*switch_color)(void *priv, struct cca_settings *settings);
+
/**
+ /**
* add_tx_ts - Add traffic stream
* @priv: Private driver interface data
--
2.25.1
* @tsid: Traffic stream ID

View File

@@ -0,0 +1,46 @@
From aa394e37a56eaed0a575b8a1a34ebc31ca06af42 Mon Sep 17 00:00:00 2001
From: Nishant Pandey <nishpand@codeaurora.org>
Date: Tue, 22 Sep 2020 14:07:05 +0530
Subject: [PATCH] hostapd: Fix calling hostapd_disassoc_accept_mac in CLI
command
Calling hostapd_disassoc_accept_mac is not needed when we add mac
address to accept list and it is required to be called when any of
the mac address is deleted from accept mac list
Signed-off-by: Nishant Pandey <nishpand@codeaurora.org>
---
hostapd/ctrl_iface.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
index 584aee2..66c63a0 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
@@ -3709,16 +3709,16 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
eloop_terminate();
} else if (os_strncmp(buf, "ACCEPT_ACL ", 11) == 0) {
if (os_strncmp(buf + 11, "ADD_MAC ", 8) == 0) {
- if (!hostapd_ctrl_iface_acl_add_mac(
- &hapd->conf->accept_mac,
- &hapd->conf->num_accept_mac, buf + 19))
+ hostapd_ctrl_iface_acl_add_mac(
+ &hapd->conf->accept_mac,
+ &hapd->conf->num_accept_mac, buf + 19);
+ } else if (os_strncmp((buf + 11), "DEL_MAC ", 8) == 0) {
+ if (!hostapd_ctrl_iface_acl_del_mac(
+ &hapd->conf->accept_mac,
+ &hapd->conf->num_accept_mac, buf + 19))
hostapd_disassoc_accept_mac(hapd);
else
reply_len = -1;
- } else if (os_strncmp((buf + 11), "DEL_MAC ", 8) == 0) {
- hostapd_ctrl_iface_acl_del_mac(
- &hapd->conf->accept_mac,
- &hapd->conf->num_accept_mac, buf + 19);
} else if (os_strcmp(buf + 11, "SHOW") == 0) {
reply_len = hostapd_ctrl_iface_acl_show_mac(
hapd->conf->accept_mac,
--
2.7.4

View File

@@ -1,8 +1,8 @@
From 5bcdaaee4909e7f80d99ffa98a352fb313234fd9 Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Wed, 17 Jun 2020 14:37:31 +0200
Subject: [PATCH 802/813] bss_coloring: add the code required to generate the
Subject: [PATCH V4 2/6] bss_coloring: add the code required to generate the
CCA IE
Date: Wed, 26 Aug 2020 08:22:12 +0200
This IE is similar to the CSA one. It contains a counter and the target
color. Once the counter expired, the change to the new color happens.
@@ -16,7 +16,7 @@ Signed-off-by: John Crispin <john@phrozen.org>
4 files changed, 28 insertions(+)
diff --git a/src/ap/beacon.c b/src/ap/beacon.c
index 8a80dbe79..e67653853 100644
index c59842edc..b59e34623 100644
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -580,11 +580,17 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd,
@@ -91,7 +91,7 @@ index 85b714090..049ac7f0e 100644
+ return eid;
+}
diff --git a/src/common/ieee802_11_defs.h b/src/common/ieee802_11_defs.h
index 92d3c1d49..ec3a0613f 100644
index 5b834c5c8..16f517ac6 100644
--- a/src/common/ieee802_11_defs.h
+++ b/src/common/ieee802_11_defs.h
@@ -475,6 +475,7 @@
@@ -100,8 +100,5 @@ index 92d3c1d49..ec3a0613f 100644
#define WLAN_EID_EXT_SPATIAL_REUSE 39
+#define WLAN_EID_EXT_COLOR_CHANGE_ANNOUNCEMENT 42
#define WLAN_EID_EXT_OCV_OCI 54
#define WLAN_EID_EXT_NON_INHERITANCE 56
#define WLAN_EID_EXT_SHORT_SSID_LIST 58
--
2.25.1
#define WLAN_EID_EXT_HE_6GHZ_BAND_CAP 59

View File

@@ -0,0 +1,620 @@
From 171c96df407c45e94d1fe8afd44ca6cc3a191157 Mon Sep 17 00:00:00 2001
From: Nishant Pandey <nishpand@codeaurora.org>
Date: Tue, 22 Sep 2020 14:15:36 +0530
Subject: [PATCH] hostap: Move ACL configuration callback to generic
Move ACL configuration support callbacks to generic
place so that it can be utilized for mesh functionality.
No functional change as such made in this patch
Signed-off-by: Nishant Pandey <nishpand@codeaurora.org>
---
hostapd/config_file.c | 119 +-----------------------------------
hostapd/config_file.h | 5 --
hostapd/ctrl_iface.c | 111 ----------------------------------
src/ap/ctrl_iface_ap.c | 159 +++++++++++++++++++++++++++++++++++++++++++++++++
src/ap/ctrl_iface_ap.h | 10 ++++
src/ap/ieee802_11.c | 81 +++++++++++++++++++++++++
src/ap/ieee802_11.h | 9 +++
7 files changed, 260 insertions(+), 234 deletions(-)
diff --git a/hostapd/config_file.c b/hostapd/config_file.c
index 3fe1792..a81553b 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -23,6 +23,7 @@
#include "radius/radius_client.h"
#include "ap/wpa_auth.h"
#include "ap/ap_config.h"
+#include "ap/ieee802_11.h"
#include "config_file.h"
@@ -118,124 +119,6 @@ static int hostapd_config_read_vlan_file(struct hostapd_bss_config *bss,
#endif /* CONFIG_NO_VLAN */
-int hostapd_acl_comp(const void *a, const void *b)
-{
- const struct mac_acl_entry *aa = a;
- const struct mac_acl_entry *bb = b;
- return os_memcmp(aa->addr, bb->addr, sizeof(macaddr));
-}
-
-
-int hostapd_add_acl_maclist(struct mac_acl_entry **acl, int *num,
- int vlan_id, const u8 *addr)
-{
- struct mac_acl_entry *newacl;
-
- newacl = os_realloc_array(*acl, *num + 1, sizeof(**acl));
- if (!newacl) {
- wpa_printf(MSG_ERROR, "MAC list reallocation failed");
- return -1;
- }
-
- *acl = newacl;
- os_memcpy((*acl)[*num].addr, addr, ETH_ALEN);
- os_memset(&(*acl)[*num].vlan_id, 0, sizeof((*acl)[*num].vlan_id));
- (*acl)[*num].vlan_id.untagged = vlan_id;
- (*acl)[*num].vlan_id.notempty = !!vlan_id;
- (*num)++;
-
- return 0;
-}
-
-
-void hostapd_remove_acl_mac(struct mac_acl_entry **acl, int *num,
- const u8 *addr)
-{
- int i = 0;
-
- while (i < *num) {
- if (os_memcmp((*acl)[i].addr, addr, ETH_ALEN) == 0) {
- os_remove_in_array(*acl, *num, sizeof(**acl), i);
- (*num)--;
- } else {
- i++;
- }
- }
-}
-
-
-static int hostapd_config_read_maclist(const char *fname,
- struct mac_acl_entry **acl, int *num)
-{
- FILE *f;
- char buf[128], *pos;
- int line = 0;
- u8 addr[ETH_ALEN];
- int vlan_id;
-
- f = fopen(fname, "r");
- if (!f) {
- wpa_printf(MSG_ERROR, "MAC list file '%s' not found.", fname);
- return -1;
- }
-
- while (fgets(buf, sizeof(buf), f)) {
- int rem = 0;
-
- line++;
-
- if (buf[0] == '#')
- continue;
- pos = buf;
- while (*pos != '\0') {
- if (*pos == '\n') {
- *pos = '\0';
- break;
- }
- pos++;
- }
- if (buf[0] == '\0')
- continue;
- pos = buf;
- if (buf[0] == '-') {
- rem = 1;
- pos++;
- }
-
- if (hwaddr_aton(pos, addr)) {
- wpa_printf(MSG_ERROR, "Invalid MAC address '%s' at "
- "line %d in '%s'", pos, line, fname);
- fclose(f);
- return -1;
- }
-
- if (rem) {
- hostapd_remove_acl_mac(acl, num, addr);
- continue;
- }
- vlan_id = 0;
- pos = buf;
- while (*pos != '\0' && *pos != ' ' && *pos != '\t')
- pos++;
- while (*pos == ' ' || *pos == '\t')
- pos++;
- if (*pos != '\0')
- vlan_id = atoi(pos);
-
- if (hostapd_add_acl_maclist(acl, num, vlan_id, addr) < 0) {
- fclose(f);
- return -1;
- }
- }
-
- fclose(f);
-
- if (*acl)
- qsort(*acl, *num, sizeof(**acl), hostapd_acl_comp);
-
- return 0;
-}
-
#ifdef EAP_SERVER
diff --git a/hostapd/config_file.h b/hostapd/config_file.h
index 9830f5a..c98bdb6 100644
--- a/hostapd/config_file.h
+++ b/hostapd/config_file.h
@@ -13,10 +13,5 @@ struct hostapd_config * hostapd_config_read(const char *fname);
int hostapd_set_iface(struct hostapd_config *conf,
struct hostapd_bss_config *bss, const char *field,
char *value);
-int hostapd_acl_comp(const void *a, const void *b);
-int hostapd_add_acl_maclist(struct mac_acl_entry **acl, int *num,
- int vlan_id, const u8 *addr);
-void hostapd_remove_acl_mac(struct mac_acl_entry **acl, int *num,
- const u8 *addr);
#endif /* CONFIG_FILE_H */
diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
index 66c63a0..60e549f 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
@@ -1309,42 +1309,6 @@ static int hostapd_ctrl_iface_get_config(struct hostapd_data *hapd,
}
-static void hostapd_disassoc_accept_mac(struct hostapd_data *hapd)
-{
- struct sta_info *sta;
- struct vlan_description vlan_id;
-
- if (hapd->conf->macaddr_acl != DENY_UNLESS_ACCEPTED)
- return;
-
- for (sta = hapd->sta_list; sta; sta = sta->next) {
- if (!hostapd_maclist_found(hapd->conf->accept_mac,
- hapd->conf->num_accept_mac,
- sta->addr, &vlan_id) ||
- (vlan_id.notempty &&
- vlan_compare(&vlan_id, sta->vlan_desc)))
- ap_sta_disconnect(hapd, sta, sta->addr,
- WLAN_REASON_UNSPECIFIED);
- }
-}
-
-
-static void hostapd_disassoc_deny_mac(struct hostapd_data *hapd)
-{
- struct sta_info *sta;
- struct vlan_description vlan_id;
-
- for (sta = hapd->sta_list; sta; sta = sta->next) {
- if (hostapd_maclist_found(hapd->conf->deny_mac,
- hapd->conf->num_deny_mac, sta->addr,
- &vlan_id) &&
- (!vlan_id.notempty ||
- !vlan_compare(&vlan_id, sta->vlan_desc)))
- ap_sta_disconnect(hapd, sta, sta->addr,
- WLAN_REASON_UNSPECIFIED);
- }
-}
-
static int hostapd_ctrl_iface_set_band(struct hostapd_data *hapd,
const char *band)
@@ -3287,81 +3251,6 @@ static int hostapd_ctrl_driver_flags2(struct hostapd_iface *iface, char *buf,
return pos - buf;
}
-
-static int hostapd_ctrl_iface_acl_del_mac(struct mac_acl_entry **acl, int *num,
- const char *txtaddr)
-{
- u8 addr[ETH_ALEN];
- struct vlan_description vlan_id;
-
- if (!(*num))
- return 0;
-
- if (hwaddr_aton(txtaddr, addr))
- return -1;
-
- if (hostapd_maclist_found(*acl, *num, addr, &vlan_id))
- hostapd_remove_acl_mac(acl, num, addr);
-
- return 0;
-}
-
-
-static void hostapd_ctrl_iface_acl_clear_list(struct mac_acl_entry **acl,
- int *num)
-{
- while (*num)
- hostapd_remove_acl_mac(acl, num, (*acl)[0].addr);
-}
-
-
-static int hostapd_ctrl_iface_acl_show_mac(struct mac_acl_entry *acl, int num,
- char *buf, size_t buflen)
-{
- int i = 0, len = 0, ret = 0;
-
- if (!acl)
- return 0;
-
- while (i < num) {
- ret = os_snprintf(buf + len, buflen - len,
- MACSTR " VLAN_ID=%d\n",
- MAC2STR(acl[i].addr),
- acl[i].vlan_id.untagged);
- if (ret < 0 || (size_t) ret >= buflen - len)
- return len;
- i++;
- len += ret;
- }
- return len;
-}
-
-
-static int hostapd_ctrl_iface_acl_add_mac(struct mac_acl_entry **acl, int *num,
- const char *cmd)
-{
- u8 addr[ETH_ALEN];
- struct vlan_description vlan_id;
- int ret = 0, vlanid = 0;
- const char *pos;
-
- if (hwaddr_aton(cmd, addr))
- return -1;
-
- pos = os_strstr(cmd, "VLAN_ID=");
- if (pos)
- vlanid = atoi(pos + 8);
-
- if (!hostapd_maclist_found(*acl, *num, addr, &vlan_id)) {
- ret = hostapd_add_acl_maclist(acl, num, vlanid, addr);
- if (ret != -1 && *acl)
- qsort(*acl, *num, sizeof(**acl), hostapd_acl_comp);
- }
-
- return ret < 0 ? -1 : 0;
-}
-
-
static int hostapd_ctrl_iface_get_capability(struct hostapd_data *hapd,
const char *field, char *buf,
size_t buflen)
diff --git a/src/ap/ctrl_iface_ap.c b/src/ap/ctrl_iface_ap.c
index c9f5c1a..4a03ec4 100644
--- a/src/ap/ctrl_iface_ap.c
+++ b/src/ap/ctrl_iface_ap.c
@@ -24,6 +24,7 @@
#include "ap_drv_ops.h"
#include "mbo_ap.h"
#include "taxonomy.h"
+#include "ap/vlan.h"
#ifdef CONFIG_CTRL_IFACE_MIB
@@ -637,6 +638,164 @@ static int p2p_manager_disconnect(struct hostapd_data *hapd, u16 stype,
#endif /* CONFIG_P2P_MANAGER */
+int hostapd_add_acl_maclist(struct mac_acl_entry **acl, int *num,
+ int vlan_id, const u8 *addr)
+{
+ struct mac_acl_entry *newacl;
+
+ newacl = os_realloc_array(*acl, *num + 1, sizeof(**acl));
+ if (!newacl) {
+ wpa_printf(MSG_ERROR, "MAC list reallocation failed");
+ return -1;
+ }
+
+ *acl = newacl;
+ os_memcpy((*acl)[*num].addr, addr, ETH_ALEN);
+ os_memset(&(*acl)[*num].vlan_id, 0, sizeof((*acl)[*num].vlan_id));
+ (*acl)[*num].vlan_id.untagged = vlan_id;
+ (*acl)[*num].vlan_id.notempty = !!vlan_id;
+ (*num)++;
+
+ return 0;
+}
+
+
+void hostapd_remove_acl_mac(struct mac_acl_entry **acl, int *num,
+ const u8 *addr)
+{
+ int i = 0;
+
+ while (i < *num) {
+ if (os_memcmp((*acl)[i].addr, addr, ETH_ALEN) == 0) {
+ os_remove_in_array(*acl, *num, sizeof(**acl), i);
+ (*num)--;
+ } else {
+ i++;
+ }
+ }
+}
+
+int hostapd_disassoc_accept_mac(struct hostapd_data *hapd)
+{
+ struct sta_info *sta;
+ struct vlan_description vlan_id;
+
+ if (hapd->conf->macaddr_acl != DENY_UNLESS_ACCEPTED)
+ return 0;
+
+ for (sta = hapd->sta_list; sta; sta = sta->next) {
+ if (!hostapd_maclist_found(hapd->conf->accept_mac,
+ hapd->conf->num_accept_mac,
+ sta->addr, &vlan_id) ||
+ (vlan_id.notempty &&
+ vlan_compare(&vlan_id, sta->vlan_desc))) {
+#ifdef CONFIG_MESH
+ if (hapd->iface->mconf)
+ return 1;
+#endif /* CONFIG_MESH */
+ ap_sta_disconnect(hapd, sta, sta->addr,
+ WLAN_REASON_UNSPECIFIED);
+ }
+ }
+ return 0;
+}
+
+int hostapd_disassoc_deny_mac(struct hostapd_data *hapd)
+{
+ struct sta_info *sta;
+ struct vlan_description vlan_id;
+
+ for (sta = hapd->sta_list; sta; sta = sta->next) {
+ if (hostapd_maclist_found(hapd->conf->deny_mac,
+ hapd->conf->num_deny_mac, sta->addr,
+ &vlan_id) &&
+ (!vlan_id.notempty ||
+ !vlan_compare(&vlan_id, sta->vlan_desc))) {
+#ifdef CONFIG_MESH
+ if (hapd->iface->mconf)
+ return 1;
+#endif /* CONFIG_MESH */
+ ap_sta_disconnect(hapd, sta, sta->addr,
+ WLAN_REASON_UNSPECIFIED);
+ }
+ }
+
+ return 0;
+}
+
+int hostapd_ctrl_iface_acl_del_mac(struct mac_acl_entry **acl, int *num,
+ const char *txtaddr)
+{
+ u8 addr[ETH_ALEN];
+ struct vlan_description vlan_id;
+
+ if (!(*num))
+ return 0;
+
+ if (hwaddr_aton(txtaddr, addr))
+ return -1;
+
+ if (hostapd_maclist_found(*acl, *num, addr, &vlan_id))
+ hostapd_remove_acl_mac(acl, num, addr);
+
+ return 0;
+}
+
+
+void hostapd_ctrl_iface_acl_clear_list(struct mac_acl_entry **acl,
+ int *num)
+{
+ while (*num)
+ hostapd_remove_acl_mac(acl, num, (*acl)[0].addr);
+}
+
+
+int hostapd_ctrl_iface_acl_show_mac(struct mac_acl_entry *acl, int num,
+ char *buf, size_t buflen)
+{
+ int i = 0, len = 0, ret = 0;
+
+ if (!acl)
+ return 0;
+
+ while (i < num) {
+ ret = os_snprintf(buf + len, buflen - len,
+ MACSTR " VLAN_ID=%d\n",
+ MAC2STR(acl[i].addr),
+ acl[i].vlan_id.untagged);
+ if (ret < 0 || (size_t) ret >= buflen - len)
+ return len;
+ i++;
+ len += ret;
+ }
+ return len;
+}
+
+
+int hostapd_ctrl_iface_acl_add_mac(struct mac_acl_entry **acl, int *num,
+ const char *cmd)
+{
+ u8 addr[ETH_ALEN];
+ struct vlan_description vlan_id;
+ int ret = 0, vlanid = 0;
+ const char *pos;
+
+ if (hwaddr_aton(cmd, addr))
+ return -1;
+
+ pos = os_strstr(cmd, "VLAN_ID=");
+ if (pos)
+ vlanid = atoi(pos + 8);
+
+ if (!hostapd_maclist_found(*acl, *num, addr, &vlan_id)) {
+ ret = hostapd_add_acl_maclist(acl, num, vlanid, addr);
+ if (ret != -1 && *acl)
+ qsort(*acl, *num, sizeof(**acl), hostapd_acl_comp);
+ }
+
+ return ret < 0 ? -1 : 0;
+}
+
int hostapd_ctrl_iface_deauthenticate(struct hostapd_data *hapd,
const char *txtaddr)
{
diff --git a/src/ap/ctrl_iface_ap.h b/src/ap/ctrl_iface_ap.h
index d1dcebf..55f1c63 100644
--- a/src/ap/ctrl_iface_ap.h
+++ b/src/ap/ctrl_iface_ap.h
@@ -36,5 +36,15 @@ int hostapd_ctrl_iface_pmksa_add(struct hostapd_data *hapd, char *cmd);
int hostapd_ctrl_iface_pmksa_list_mesh(struct hostapd_data *hapd,
const u8 *addr, char *buf, size_t len);
void * hostapd_ctrl_iface_pmksa_create_entry(const u8 *aa, char *cmd);
+int hostapd_ctrl_iface_acl_add_mac(struct mac_acl_entry **acl, int *num,
+ const char *cmd);
+int hostapd_ctrl_iface_acl_show_mac(struct mac_acl_entry *acl, int num,
+ char *buf, size_t buflen);
+void hostapd_ctrl_iface_acl_clear_list(struct mac_acl_entry **acl,
+ int *num);
+int hostapd_ctrl_iface_acl_del_mac(struct mac_acl_entry **acl, int *num,
+ const char *txtaddr);
+int hostapd_disassoc_accept_mac(struct hostapd_data *hapd);
+int hostapd_disassoc_deny_mac(struct hostapd_data *hapd);
#endif /* CTRL_IFACE_AP_H */
diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
index 65a556e..0963b48 100644
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -5650,6 +5650,87 @@ u8 * hostapd_eid_wb_chsw_wrapper(struct hostapd_data *hapd, u8 *eid)
}
+int hostapd_acl_comp(const void *a, const void *b)
+{
+ const struct mac_acl_entry *aa = a;
+ const struct mac_acl_entry *bb = b;
+
+ return os_memcmp(aa->addr, bb->addr, sizeof(macaddr));
+}
+
+int hostapd_config_read_maclist(const char *fname,
+ struct mac_acl_entry **acl, int *num)
+{
+ FILE *f;
+ char buf[128], *pos;
+ int line = 0;
+ u8 addr[ETH_ALEN];
+ int vlan_id;
+
+ f = fopen(fname, "r");
+ if (!f) {
+ wpa_printf(MSG_ERROR, "MAC list file '%s' not found.", fname);
+ return -1;
+ }
+
+ while (fgets(buf, sizeof(buf), f)) {
+ int rem = 0;
+
+ line++;
+
+ if (buf[0] == '#')
+ continue;
+ pos = buf;
+ while (*pos != '\0') {
+ if (*pos == '\n') {
+ *pos = '\0';
+ break;
+ }
+ pos++;
+ }
+ if (buf[0] == '\0')
+ continue;
+ pos = buf;
+ if (buf[0] == '-') {
+ rem = 1;
+ pos++;
+ }
+
+ if (hwaddr_aton(pos, addr)) {
+ wpa_printf(MSG_ERROR, "Invalid MAC address '%s' at "
+ "line %d in '%s'", pos, line, fname);
+ fclose(f);
+ return -1;
+ }
+
+ if (rem) {
+ hostapd_remove_acl_mac(acl, num, addr);
+ continue;
+ }
+ vlan_id = 0;
+ pos = buf;
+ while (*pos != '\0' && *pos != ' ' && *pos != '\t')
+ pos++;
+ while (*pos == ' ' || *pos == '\t')
+ pos++;
+ if (*pos != '\0')
+ vlan_id = atoi(pos);
+
+ if (hostapd_add_acl_maclist(acl, num, vlan_id, addr) < 0) {
+ fclose(f);
+ return -1;
+ }
+ }
+
+ fclose(f);
+
+ if (*acl)
+ qsort(*acl, *num, sizeof(**acl), hostapd_acl_comp);
+
+ return 0;
+}
+
+
static int hostapd_eid_multiple_bssid_chunk_len(struct hostapd_data *hapd,
int *count)
{
diff --git a/src/ap/ieee802_11.h b/src/ap/ieee802_11.h
index 9ccfe6c..c02beae 100644
--- a/src/ap/ieee802_11.h
+++ b/src/ap/ieee802_11.h
@@ -18,6 +18,7 @@ struct ieee80211_vht_capabilities;
struct ieee80211_mgmt;
struct radius_sta;
enum ieee80211_op_mode;
+struct mac_acl_entry;
int ieee802_11_mgmt(struct hostapd_data *hapd, const u8 *buf, size_t len,
struct hostapd_frame_info *fi);
@@ -25,6 +26,14 @@ void ieee802_11_mgmt_cb(struct hostapd_data *hapd, const u8 *buf, size_t len,
u16 stype, int ok);
void hostapd_2040_coex_action(struct hostapd_data *hapd,
const struct ieee80211_mgmt *mgmt, size_t len);
+
+int hostapd_config_read_maclist(const char *fname,
+ struct mac_acl_entry **acl, int *num);
+int hostapd_acl_comp(const void *a, const void *b);
+int hostapd_add_acl_maclist(struct mac_acl_entry **acl, int *num,
+ int vlan_id, const u8 *addr);
+void hostapd_remove_acl_mac(struct mac_acl_entry **acl, int *num,
+ const u8 *addr);
#ifdef NEED_AP_MLME
int ieee802_11_get_mib(struct hostapd_data *hapd, char *buf, size_t buflen);
int ieee802_11_get_mib_sta(struct hostapd_data *hapd, struct sta_info *sta,
--
2.7.4

View File

@@ -0,0 +1,232 @@
From d3447cf20a26072d294cd74a8b3e5c676a7421e7 Mon Sep 17 00:00:00 2001
From: Nishant Pandey <nishpand@codeaurora.org>
Date: Tue, 22 Sep 2020 14:19:41 +0530
Subject: [PATCH] mesh: Add ACL logic support to mesh configuration
Extend AP-STA accept and deny acl list support to
mesh peer connection as well. Here mesh node uses
macaddr_acl value either ACCEPT_UNLESS_DENIED or
DENY_UNLESS_ACCEPTED.
Signed-off-by: Nishant Pandey <nishpand@codeaurora.org>
---
wpa_supplicant/config.c | 21 ++++++++++++++++++++-
wpa_supplicant/config_file.c | 6 ++++++
wpa_supplicant/config_ssid.h | 5 +++++
wpa_supplicant/mesh.c | 22 ++++++++++++++++++++++
wpa_supplicant/mesh_mpm.c | 15 +++++++++++++++
wpa_supplicant/wpa_supplicant.conf | 14 ++++++++++++++
6 files changed, 82 insertions(+), 1 deletion(-)
diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c
index aa9953b..aa6c493 100644
--- a/wpa_supplicant/config.c
+++ b/wpa_supplicant/config.c
@@ -20,7 +20,9 @@
#include "drivers/nl80211_copy.h"
#include "fst/fst.h"
#include "config.h"
-
+#ifdef CONFIG_MESH
+#include "ap/ap_config.h"
+#endif
#if !defined(CONFIG_CTRL_IFACE) && defined(CONFIG_NO_CONFIG_WRITE)
#define NO_CONFIG_WRITE
@@ -2656,6 +2658,9 @@ static const struct parse_data ssid_fields[] = {
{ INT(dot11MeshRetryTimeout) },
{ INT(dot11MeshConfirmTimeout) },
{ INT(dot11MeshHoldingTimeout) },
+ { STR(accept_mac_file) },
+ { STR(deny_mac_file) },
+ { INT(macaddr_acl) },
#endif /* CONFIG_MESH */
{ INT(wpa_ptk_rekey) },
{ INT_RANGE(wpa_deny_ptk0_rekey, 0, 2) },
@@ -2928,6 +2933,8 @@ void wpa_config_free_ssid(struct wpa_ssid *ssid)
os_free(ssid->p2p_client_list);
os_free(ssid->bssid_blacklist);
os_free(ssid->bssid_whitelist);
+ os_free(ssid->accept_mac_file);
+ os_free(ssid->deny_mac_file);
#ifdef CONFIG_HT_OVERRIDES
os_free(ssid->ht_mcs);
#endif /* CONFIG_HT_OVERRIDES */
@@ -3288,6 +3295,18 @@ int wpa_config_set(struct wpa_ssid *ssid, const char *var, const char *value,
}
ret = -1;
}
+#ifdef CONFIG_MESH
+ if (os_strcmp(var, "macaddr_acl") == 0) {
+ if (ssid->macaddr_acl != ACCEPT_UNLESS_DENIED &&
+ ssid->macaddr_acl != DENY_UNLESS_ACCEPTED) {
+ wpa_printf(MSG_ERROR,
+ "Line %d: unknown macaddr_acl %d",
+ line, ssid->macaddr_acl);
+ ret = -1;
+ }
+ }
+#endif
+
#ifdef CONFIG_SAE
if (os_strcmp(var, "ssid") == 0 ||
os_strcmp(var, "psk") == 0 ||
diff --git a/wpa_supplicant/config_file.c b/wpa_supplicant/config_file.c
index 21e77f8..b185fd5 100644
--- a/wpa_supplicant/config_file.c
+++ b/wpa_supplicant/config_file.c
@@ -18,6 +18,9 @@
#include "common.h"
#include "config.h"
#include "base64.h"
+#ifdef CONFIG_MESH
+#include "ap/ap_config.h"
+#endif
#include "uuid.h"
#include "common/ieee802_1x_defs.h"
#include "p2p/p2p.h"
@@ -913,6 +916,9 @@ static void wpa_config_write_network(FILE *f, struct wpa_ssid *ssid)
write_int(f, "mac_addr", ssid->mac_addr, -1);
#ifdef CONFIG_MESH
STR(mesh_basic_rates);
+ STR(accept_mac_file);
+ STR(deny_mac_file);
+ INT_DEF(macaddr_acl, ACCEPT_UNLESS_DENIED);
INT_DEF(dot11MeshMaxRetries, DEFAULT_MESH_MAX_RETRIES);
INT_DEF(dot11MeshRetryTimeout, DEFAULT_MESH_RETRY_TIMEOUT);
INT_DEF(dot11MeshConfirmTimeout, DEFAULT_MESH_CONFIRM_TIMEOUT);
diff --git a/wpa_supplicant/config_ssid.h b/wpa_supplicant/config_ssid.h
index 1fd94d8..1d9137e 100644
--- a/wpa_supplicant/config_ssid.h
+++ b/wpa_supplicant/config_ssid.h
@@ -546,6 +546,11 @@ struct wpa_ssid {
int dot11MeshConfirmTimeout; /* msec */
int dot11MeshHoldingTimeout; /* msec */
+ char *accept_mac_file;
+ char *deny_mac_file;
+ int macaddr_acl;
+
+
int ht;
int ht40;
diff --git a/wpa_supplicant/mesh.c b/wpa_supplicant/mesh.c
index c1630d0..176e922 100644
--- a/wpa_supplicant/mesh.c
+++ b/wpa_supplicant/mesh.c
@@ -15,6 +15,7 @@
#include "common/wpa_ctrl.h"
#include "ap/sta_info.h"
#include "ap/hostapd.h"
+#include "ap/ieee802_11_auth.h"
#include "ap/ieee802_11.h"
#include "config_ssid.h"
#include "config.h"
@@ -320,6 +321,17 @@ static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s,
ifmsh->bss[0]->dot11RSNASAERetransPeriod =
wpa_s->conf->dot11RSNASAERetransPeriod;
os_strlcpy(bss->conf->iface, wpa_s->ifname, sizeof(bss->conf->iface));
+ bss->conf->macaddr_acl = ssid->macaddr_acl;
+
+ if (ssid->accept_mac_file)
+ hostapd_config_read_maclist(ssid->accept_mac_file,
+ &bss->conf->accept_mac,
+ &bss->conf->num_accept_mac);
+
+ if (ssid->deny_mac_file)
+ hostapd_config_read_maclist(ssid->deny_mac_file,
+ &bss->conf->deny_mac,
+ &bss->conf->num_deny_mac);
mconf = mesh_config_create(wpa_s, ssid);
if (!mconf)
@@ -417,6 +429,16 @@ void wpa_mesh_notify_peer(struct wpa_supplicant *wpa_s, const u8 *addr,
const u8 *ies, size_t ie_len)
{
struct ieee802_11_elems elems;
+ int acl_res;
+ struct hostapd_data *data = wpa_s->ifmsh->bss[0];
+ struct radius_sta rad_info;
+
+ acl_res = hostapd_allowed_address(data, addr, NULL, 0, &rad_info, 0);
+ if (acl_res == HOSTAPD_ACL_REJECT) {
+ wpa_printf(MSG_ERROR, "Ignore new peer notification\n");
+ return;
+
+ }
wpa_msg(wpa_s, MSG_INFO,
"new peer notification for " MACSTR, MAC2STR(addr));
diff --git a/wpa_supplicant/mesh_mpm.c b/wpa_supplicant/mesh_mpm.c
index ea62abf..65bfa3a 100644
--- a/wpa_supplicant/mesh_mpm.c
+++ b/wpa_supplicant/mesh_mpm.c
@@ -16,6 +16,7 @@
#include "ap/hostapd.h"
#include "ap/sta_info.h"
#include "ap/ieee802_11.h"
+#include "ap/ieee802_11_auth.h"
#include "ap/wpa_auth.h"
#include "wpa_supplicant_i.h"
#include "driver_i.h"
@@ -1119,10 +1120,12 @@ void mesh_mpm_action_rx(struct wpa_supplicant *wpa_s,
enum plink_event event;
struct ieee802_11_elems elems;
struct mesh_peer_mgmt_ie peer_mgmt_ie;
+ struct radius_sta rad_info;
const u8 *ies;
size_t ie_len;
int ret;
u16 reason = 0;
+ int acl_res;
if (mgmt->u.action.category != WLAN_ACTION_SELF_PROTECTED)
return;
@@ -1170,6 +1173,18 @@ void mesh_mpm_action_rx(struct wpa_supplicant *wpa_s,
return;
}
if (action_field != PLINK_CLOSE) {
+ if (action_field != PLINK_CLOSE) {
+ acl_res = hostapd_allowed_address(hapd, mgmt->sa,
+ (const u8 *) mgmt,
+ len, &rad_info, 0);
+ if (acl_res == HOSTAPD_ACL_REJECT) {
+ wpa_printf(MSG_DEBUG,
+ "MPM: Ignore action frame\n");
+ return;
+
+ }
+ }
+
if (!elems.mesh_id || !elems.mesh_config) {
wpa_printf(MSG_DEBUG,
"MPM: No Mesh ID or Mesh Configuration element");
diff --git a/wpa_supplicant/wpa_supplicant.conf b/wpa_supplicant/wpa_supplicant.conf
index 4291244..674978a 100644
--- a/wpa_supplicant/wpa_supplicant.conf
+++ b/wpa_supplicant/wpa_supplicant.conf
@@ -150,6 +150,20 @@ ap_scan=1
# This timeout value is used in mesh STA to clean up inactive stations.
#mesh_max_inactivity=300
+# Mesh node address -based authentication
+# Please note that this kind of access control requires a driver that uses
+# wpa_supplicant to take care of management frame and mesh PLINK connection
+# processing and as such.
+# 0 = accept unless in deny list
+# 1 = deny unless in accept list
+macaddr_acl=0
+
+# Accept/deny lists are read from separate files (containing list of
+# MAC addresses, one per line). Use absolute path name to make sure that the
+# files can be read on SIGHUP configuration reloads.
+#accept_mac_file=/etc/hostapd.accept
+#deny_mac_file=/etc/hostapd.deny
+
# cert_in_cb - Whether to include a peer certificate dump in events
# This controls whether peer certificates for authentication server and
# its certificate chain are included in EAP peer certificate events. This is
--
2.7.4

View File

@@ -1,7 +1,7 @@
From fb8ecbc64dc2d85741605384e5e6515def0ca948 Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Wed, 17 Jun 2020 14:42:16 +0200
Subject: [PATCH 803/813] bss coloring: disable BSS color during CCA
Subject: [PATCH V4 3/6] bss coloring: disable BSS color during CCA
Date: Wed, 26 Aug 2020 08:22:13 +0200
While we are doing CCA the bss color disable bit inside the he oper field
needs to be set.
@@ -24,6 +24,3 @@ index 049ac7f0e..157f9e99a 100644
params |= HE_OPERATION_BSS_COLOR_DISABLED;
if (hapd->iface->conf->he_op.he_bss_color_partial)
params |= HE_OPERATION_BSS_COLOR_PARTIAL;
--
2.25.1

View File

@@ -1,8 +1,8 @@
From 528bfb6212177a206c6bb0800413c8012ef75799 Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Wed, 17 Jun 2020 14:40:31 +0200
Subject: [PATCH 804/813] bss coloring: add the switch_color handler to the
Subject: [PATCH V4 4/6] bss coloring: add the switch_color handler to the
nl80211 driver
Date: Wed, 26 Aug 2020 08:22:14 +0200
In order to start the CCA process we need to send NL80211_CMD_COLOR_CHANGE
to the kernel. This patch adds the required code.
@@ -12,11 +12,9 @@ Signed-off-by: John Crispin <john@phrozen.org>
src/drivers/driver_nl80211.c | 79 ++++++++++++++++++++++++++++++++++++
1 file changed, 79 insertions(+)
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index c648e46ae..36bff1de2 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -9614,6 +9614,82 @@ error:
@@ -9873,6 +9873,82 @@ error:
}
@@ -99,7 +97,7 @@ index c648e46ae..36bff1de2 100644
static int nl80211_add_ts(void *priv, u8 tsid, const u8 *addr,
u8 user_priority, u16 admitted_time)
{
@@ -11732,6 +11808,9 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
@@ -11992,6 +12068,9 @@ const struct wpa_driver_ops wpa_driver_n
.get_survey = wpa_driver_nl80211_get_survey,
.status = wpa_driver_nl80211_status,
.switch_channel = nl80211_switch_channel,
@@ -109,6 +107,51 @@ index c648e46ae..36bff1de2 100644
#ifdef ANDROID_P2P
.set_noa = wpa_driver_set_p2p_noa,
.get_noa = wpa_driver_get_p2p_noa,
--
2.25.1
--- a/src/drivers/nl80211_copy.h
+++ b/src/drivers/nl80211_copy.h
@@ -1406,6 +1406,13 @@ enum nl80211_commands {
NL80211_CMD_CONTROL_PORT_FRAME_TX_STATUS,
NL80211_CMD_UPDATE_HE_MUEDCA_PARAMS,
+
+ NL80211_CMD_OBSS_COLOR_COLLISION,
+
+ NL80211_CMD_COLOR_CHANGE,
+ NL80211_CMD_COLOR_CHANGE_ANNOUNCEMENT_STARTED,
+ NL80211_CMD_COLOR_CHANGE_ANNOUNCEMENT_ABORTED,
+ NL80211_CMD_COLOR_CHANGE_ANNOUNCEMENT_COMPLETED,
/* add new commands above here */
/* used to define NL80211_CMD_MAX below */
@@ -2842,8 +2849,8 @@ enum nl80211_attrs {
NL80211_ATTR_CH_SWITCH_COUNT,
NL80211_ATTR_CH_SWITCH_BLOCK_TX,
NL80211_ATTR_CSA_IES,
- NL80211_ATTR_CSA_C_OFF_BEACON,
- NL80211_ATTR_CSA_C_OFF_PRESP,
+ NL80211_ATTR_CNTDWN_OFFS_BEACON,
+ NL80211_ATTR_CNTDWN_OFFS_PRESP,
NL80211_ATTR_RXMGMT_FLAGS,
@@ -3030,6 +3037,11 @@ enum nl80211_attrs {
NL80211_ATTR_MULTIPLE_BSSID_COUNT,
NL80211_ATTR_MULTIPLE_BSSID_IES,
+ NL80211_ATTR_OBSS_COLOR_BITMAP,
+
+ NL80211_ATTR_COLOR_CHANGE_ANNOUNCEMENT_COUNT,
+ NL80211_ATTR_COLOR_CHANGE_ANNOUNCEMENT_COLOR,
+ NL80211_ATTR_COLOR_CHANGE_ANNOUNCEMENT_IES,
/* add attributes here, update the policy in nl80211.c */
__NL80211_ATTR_AFTER_LAST,
@@ -3042,6 +3054,8 @@ enum nl80211_attrs {
#define NL80211_ATTR_MESH_PARAMS NL80211_ATTR_MESH_CONFIG
#define NL80211_ATTR_IFACE_SOCKET_OWNER NL80211_ATTR_SOCKET_OWNER
#define NL80211_ATTR_SAE_DATA NL80211_ATTR_AUTH_DATA
+#define NL80211_ATTR_CSA_C_OFF_BEACON NL80211_ATTR_CNTDWN_OFFS_BEACON
+#define NL80211_ATTR_CSA_C_OFF_PRESP NL80211_ATTR_CNTDWN_OFFS_PRESP
/*
* Allow user space programs to use #ifdef on new attributes by defining them

View File

@@ -0,0 +1,310 @@
From 2173e65aa098ab130bfdbc9b9cfe8ac2fc2ae086 Mon Sep 17 00:00:00 2001
From: Nishant Pandey <nishpand@codeaurora.org>
Date: Tue, 22 Sep 2020 14:23:08 +0530
Subject: [PATCH] mesh: Dynamic MAC ACL management over control interface
Extend support to modify MAC ACL and displayed it through
new control interface
commands:
ACCEPT_ACL <subcmd> [argument]
DENY_ACL <subcmd> [argument]
subcmd: ADD_MAC <addr> |DEL_MAC <addr>|SHOW|CLEAR
Signed-off-by: Nishant Pandey <nishpand@codeaurora.org>
---
wpa_supplicant/ap.c | 68 +++++++++++++++++++++++++++++++++++++++++
wpa_supplicant/ap.h | 5 +++
wpa_supplicant/ctrl_iface.c | 45 +++++++++++++++++++++++++++
wpa_supplicant/events.c | 1 +
wpa_supplicant/mesh.c | 1 +
wpa_supplicant/wpa_cli.c | 19 ++++++++++++
wpa_supplicant/wpa_supplicant.c | 3 +-
wpa_supplicant/wps_supplicant.c | 2 ++
8 files changed, 143 insertions(+), 1 deletion(-)
diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c
index 0a0bc22..4756a28 100644
--- a/wpa_supplicant/ap.c
+++ b/wpa_supplicant/ap.c
@@ -6,6 +6,7 @@
* This software may be distributed under the terms of the BSD license.
* See README for more details.
*/
+#include <stdbool.h>
#include "utils/includes.h"
@@ -1609,6 +1610,73 @@ void wpas_ap_pmksa_cache_flush(struct wpa_supplicant *wpa_s)
hostapd_ctrl_iface_pmksa_flush(wpa_s->ifmsh->bss[0]);
}
+#ifdef CONFIG_MESH
+
+int wpas_ap_acl_del_mac(struct wpa_supplicant *wpa_s, char *buf, bool accept)
+{
+ struct hostapd_data *hapd = wpa_s->ifmsh->bss[0];
+
+ if (accept) {
+ if (!hostapd_ctrl_iface_acl_del_mac(&hapd->conf->accept_mac,
+ &hapd->conf->num_accept_mac,
+ buf))
+ if (hostapd_disassoc_accept_mac(hapd))
+ return 1;
+ }
+
+ return hostapd_ctrl_iface_acl_del_mac(&hapd->conf->deny_mac,
+ &hapd->conf->num_deny_mac,
+ buf);
+}
+
+int wpas_ap_acl_add_mac(struct wpa_supplicant *wpa_s, char *buf, bool accept)
+{
+ struct hostapd_data *hapd = wpa_s->ifmsh->bss[0];
+
+ if (accept) {
+ return hostapd_ctrl_iface_acl_add_mac(&hapd->conf->accept_mac,
+ &hapd->conf->num_accept_mac,
+ buf);
+ } else {
+ if (!hostapd_ctrl_iface_acl_add_mac(&hapd->conf->deny_mac,
+ &hapd->conf->num_deny_mac, buf)) {
+ if (hostapd_disassoc_deny_mac(hapd))
+ return 1;
+ return 0;
+ }
+ }
+
+ return -1;
+}
+
+int wpas_ap_acl_show_mac(struct wpa_supplicant *wpa_s, char *reply,
+ const int reply_size, bool accept)
+{
+ struct hostapd_data *hapd = wpa_s->ifmsh->bss[0];
+
+ if (accept)
+ return hostapd_ctrl_iface_acl_show_mac(
+ hapd->conf->accept_mac,
+ hapd->conf->num_accept_mac,
+ reply, reply_size);
+
+ return hostapd_ctrl_iface_acl_show_mac(
+ hapd->conf->deny_mac,
+ hapd->conf->num_deny_mac,
+ reply, reply_size);
+}
+
+void wpas_ap_deny_acl_clear_list(struct wpa_supplicant *wpa_s)
+{
+ struct hostapd_data *hapd = wpa_s->ifmsh->bss[0];
+
+
+ return hostapd_ctrl_iface_acl_clear_list(&hapd->conf->deny_mac,
+ &hapd->conf->num_deny_mac);
+}
+
+#endif /* CONFIG_MESH */
+
#ifdef CONFIG_PMKSA_CACHE_EXTERNAL
#ifdef CONFIG_MESH
diff --git a/wpa_supplicant/ap.h b/wpa_supplicant/ap.h
index 6c6e94c..340eb29 100644
--- a/wpa_supplicant/ap.h
+++ b/wpa_supplicant/ap.h
@@ -99,6 +99,11 @@ void wpas_ap_event_dfs_cac_aborted(struct wpa_supplicant *wpa_s,
struct dfs_event *radar);
void wpas_ap_event_dfs_cac_nop_finished(struct wpa_supplicant *wpa_s,
struct dfs_event *radar);
+int wpas_ap_acl_del_mac(struct wpa_supplicant *wpa_s, char *buf, bool accept);
+int wpas_ap_acl_add_mac(struct wpa_supplicant *wpa_s, char *buf, bool accept);
+int wpas_ap_acl_show_mac(struct wpa_supplicant *wpa_s, char *reply,
+ const int reply_size, bool accept);
+void wpas_ap_deny_acl_clear_list(struct wpa_supplicant *wpa_s);
void ap_periodic(struct wpa_supplicant *wpa_s);
diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index d769796..7e89bbc 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -5,6 +5,7 @@
* This software may be distributed under the terms of the BSD license.
* See README for more details.
*/
+#include <stdbool.h>
#include "utils/includes.h"
#ifdef CONFIG_TESTING_OPTIONS
@@ -3268,6 +3269,18 @@ static int wpa_supplicant_ctrl_iface_mesh_peer_remove(
return wpas_mesh_peer_remove(wpa_s, addr);
}
+static void wpas_ap_accept_acl_clear_list(struct wpa_supplicant *wpa_s)
+{
+ struct hostapd_data *hapd = wpa_s->ifmsh->bss[0];
+ struct mac_acl_entry **acl = &hapd->conf->accept_mac;
+ int *num = &hapd->conf->num_accept_mac;
+
+ while (*num) {
+ wpas_mesh_peer_remove(wpa_s, (*acl)[0].addr);
+ hostapd_remove_acl_mac(acl, num, (*acl)[0].addr);
+ }
+}
+
static int wpa_supplicant_ctrl_iface_mesh_peer_add(
struct wpa_supplicant *wpa_s, char *cmd)
@@ -10564,6 +10577,38 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s,
reply_len = -1;
#endif /* CONFIG_IBSS_RSN */
#ifdef CONFIG_MESH
+ } else if (os_strncmp(buf, "ACCEPT_ACL ", 11) == 0) {
+ if (os_strncmp(buf + 11, "ADD_MAC ", 8) == 0) {
+ wpas_ap_acl_add_mac(wpa_s, buf + 19, 1);
+ } else if (os_strncmp((buf + 11), "DEL_MAC ", 8) == 0) {
+ reply_len = wpas_ap_acl_del_mac(wpa_s, buf + 19, 1);
+ if (reply_len == 1)
+ wpa_supplicant_ctrl_iface_mesh_peer_remove(
+ wpa_s, buf + 19);
+ else if (reply_len)
+ reply_len = -1;
+ } else if (os_strcmp(buf + 11, "SHOW") == 0) {
+ reply_len = wpas_ap_acl_show_mac(wpa_s, reply,
+ reply_size, 1);
+ } else if (os_strcmp(buf + 11, "CLEAR") == 0) {
+ wpas_ap_accept_acl_clear_list(wpa_s);
+ }
+ } else if (os_strncmp(buf, "DENY_ACL ", 9) == 0) {
+ if (os_strncmp(buf + 9, "ADD_MAC ", 8) == 0) {
+ reply_len = wpas_ap_acl_add_mac(wpa_s, buf + 17, 0);
+ if (reply_len == 1)
+ wpa_supplicant_ctrl_iface_mesh_peer_remove(
+ wpa_s, buf + 17);
+ else if (reply_len)
+ reply_len = -1;
+ } else if (os_strncmp(buf + 9, "DEL_MAC ", 8) == 0) {
+ wpas_ap_acl_del_mac(wpa_s, buf + 17, 0);
+ } else if (os_strcmp(buf + 9, "SHOW") == 0) {
+ reply_len = wpas_ap_acl_show_mac(wpa_s, reply,
+ reply_size, 0);
+ } else if (os_strcmp(buf + 9, "CLEAR") == 0) {
+ wpas_ap_deny_acl_clear_list(wpa_s);
+ }
} else if (os_strncmp(buf, "MESH_INTERFACE_ADD ", 19) == 0) {
reply_len = wpa_supplicant_ctrl_iface_mesh_interface_add(
wpa_s, buf + 19, reply, reply_size);
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index 3041b81..505c92c 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -5,6 +5,7 @@
* This software may be distributed under the terms of the BSD license.
* See README for more details.
*/
+#include <stdbool.h>
#include "includes.h"
diff --git a/wpa_supplicant/mesh.c b/wpa_supplicant/mesh.c
index 176e922..e101b42 100644
--- a/wpa_supplicant/mesh.c
+++ b/wpa_supplicant/mesh.c
@@ -5,6 +5,7 @@
* This software may be distributed under the terms of the BSD license.
* See README for more details.
*/
+#include <stdbool.h>
#include "utils/includes.h"
diff --git a/wpa_supplicant/wpa_cli.c b/wpa_supplicant/wpa_cli.c
index 26d7df1..b32ebd8 100644
--- a/wpa_supplicant/wpa_cli.c
+++ b/wpa_supplicant/wpa_cli.c
@@ -2113,6 +2113,19 @@ static int wpa_cli_cmd_mesh_link_probe(struct wpa_ctrl *ctrl, int argc,
return wpa_cli_cmd(ctrl, "MESH_LINK_PROBE", 1, argc, argv);
}
+static int wpa_cli_cmd_accept_macacl(struct wpa_ctrl *ctrl, int argc,
+ char *argv[])
+{
+ return wpa_cli_cmd(ctrl, "ACCEPT_ACL", 1, argc, argv);
+}
+
+
+static int wpa_cli_cmd_deny_macacl(struct wpa_ctrl *ctrl, int argc,
+ char *argv[])
+{
+ return wpa_cli_cmd(ctrl, "DENY_ACL", 1, argc, argv);
+}
+
#endif /* CONFIG_MESH */
@@ -3508,6 +3521,12 @@ static const struct wpa_cli_cmd wpa_cli_commands[] = {
{ "mesh_link_probe", wpa_cli_cmd_mesh_link_probe, NULL,
cli_cmd_flag_none,
"<addr> [payload=<hex dump of payload>] = Probe a mesh link for a given peer by injecting a frame." },
+ { "accept_acl", wpa_cli_cmd_accept_macacl, NULL,
+ cli_cmd_flag_none,
+ "=Add/Delete/Show/Clear accept MAC ACL" },
+ { "deny_acl", wpa_cli_cmd_deny_macacl, NULL,
+ cli_cmd_flag_none,
+ "=Add/Delete/Show/Clear deny MAC ACL" },
#endif /* CONFIG_MESH */
#ifdef CONFIG_P2P
{ "p2p_find", wpa_cli_cmd_p2p_find, wpa_cli_complete_p2p_find,
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index 5cf0a51..e0df6c2 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -9,6 +9,7 @@
* %wpa_supplicant interfaces. In addition, this file contains number of
* functions for managing network connections.
*/
+#include <stdbool.h>
#include "includes.h"
#ifdef CONFIG_MATCH_IFACE
@@ -49,7 +50,6 @@
#include "ibss_rsn.h"
#include "sme.h"
#include "gas_query.h"
-#include "ap.h"
#include "p2p_supplicant.h"
#include "wifi_display.h"
#include "notify.h"
@@ -67,6 +67,7 @@
#include "ap/ap_config.h"
#include "ap/hostapd.h"
#endif /* CONFIG_MESH */
+#include "ap.h"
const char *const wpa_supplicant_version =
"wpa_supplicant v" VERSION_STR "\n"
diff --git a/wpa_supplicant/wps_supplicant.c b/wpa_supplicant/wps_supplicant.c
index b7680f0..df765e5 100644
--- a/wpa_supplicant/wps_supplicant.c
+++ b/wpa_supplicant/wps_supplicant.c
@@ -5,6 +5,7 @@
* This software may be distributed under the terms of the BSD license.
* See README for more details.
*/
+#include <stdbool.h>
#include "includes.h"
@@ -21,6 +22,7 @@
#include "eap_peer/eap.h"
#include "eapol_supp/eapol_supp_sm.h"
#include "rsn_supp/wpa.h"
+#include "ap/hostapd.h"
#include "wps/wps_attr_parse.h"
#include "config.h"
#include "wpa_supplicant_i.h"
--
2.7.4

View File

@@ -1,8 +1,8 @@
From 5d637bafbf774879983d146bbb9cb2b0c3ffffaa Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Wed, 17 Jun 2020 14:35:56 +0200
Subject: [PATCH 805/813] bss coloring: handle the collision and CCA events
Subject: [PATCH V4 5/6] bss coloring: handle the collision and CCA events
coming from the kernel
Date: Wed, 26 Aug 2020 08:22:15 +0200
This patch activates the functionality of the previous patches by handling
the actual events that will trigger the CCA process.
@@ -15,11 +15,9 @@ Signed-off-by: John Crispin <john@phrozen.org>
src/drivers/driver_nl80211_event.c | 64 +++++++++++++++++++++++++++++-
4 files changed, 138 insertions(+), 2 deletions(-)
diff --git a/src/ap/drv_callbacks.c b/src/ap/drv_callbacks.c
index 36678e7a3..f7d2b6ee5 100644
--- a/src/ap/drv_callbacks.c
+++ b/src/ap/drv_callbacks.c
@@ -43,7 +43,6 @@
@@ -44,7 +44,6 @@
#include "fils_hlp.h"
#include "neighbor_db.h"
@@ -27,10 +25,10 @@ index 36678e7a3..f7d2b6ee5 100644
#ifdef CONFIG_FILS
void hostapd_notify_assoc_fils_finish(struct hostapd_data *hapd,
struct sta_info *sta)
@@ -1722,6 +1721,39 @@ static void hostapd_event_wds_sta_interface_status(struct hostapd_data *hapd,
@@ -1781,6 +1780,39 @@ static void hostapd_event_update_muedca_
"Failed to update beacons with MU-EDCA parameters");
}
+#ifdef CONFIG_IEEE80211AX
+static void hostapd_event_bss_color_collision(struct hostapd_data *hapd,
+ u64 bitmap)
@@ -46,15 +44,15 @@ index 36678e7a3..f7d2b6ee5 100644
+{
+ switch (event) {
+ case EVENT_CCA_STARTED_NOTIFY:
+ wpa_printf(MSG_DEBUG, "CCA started on on %s", hapd->conf->iface);
+ wpa_printf(MSG_DEBUG, "CCA started on %s", hapd->conf->iface);
+ break;
+ case EVENT_CCA_NOTIFY:
+ wpa_printf(MSG_DEBUG, "CCA finished on on %s", hapd->conf->iface);
+ wpa_printf(MSG_DEBUG, "CCA finished on %s (new color: %d)", hapd->conf->iface, hapd->cca_color);
+ hapd->iface->conf->he_op.he_bss_color = hapd->cca_color;
+ hostapd_cleanup_cca_params(hapd);
+ break;
+ case EVENT_CCA_ABORTED_NOTIFY:
+ wpa_printf(MSG_DEBUG, "CCA aborted on on %s", hapd->conf->iface);
+ wpa_printf(MSG_DEBUG, "CCA aborted on %s for cca_color: %d", hapd->conf->iface, hapd->cca_color);
+ hostapd_cleanup_cca_params(hapd);
+ break;
+ default:
@@ -67,9 +65,9 @@ index 36678e7a3..f7d2b6ee5 100644
#ifdef CONFIG_OWE
static int hostapd_notif_update_dh_ie(struct hostapd_data *hapd,
const u8 *peer, const u8 *ie,
@@ -2028,6 +2060,17 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
data->wds_sta_interface.ifname,
data->wds_sta_interface.sta_addr);
@@ -2091,6 +2123,17 @@ void hostapd_wpa_event(void *ctx, enum w
case EVENT_UPDATE_MUEDCA_PARAMS:
hostapd_event_update_muedca_params(hapd, &data->update_muedca);
break;
+#ifdef CONFIG_IEEE80211AX
+ case EVENT_BSS_COLOR_COLLISION:
@@ -85,18 +83,16 @@ index 36678e7a3..f7d2b6ee5 100644
default:
wpa_printf(MSG_DEBUG, "Unknown event %d", event);
break;
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index 2a2bc29db..938245f50 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -5088,6 +5088,26 @@ enum wpa_event_type {
* is required to provide more details of the frame.
@@ -5165,6 +5165,26 @@ enum wpa_event_type {
* beacon.
*/
EVENT_UNPROT_BEACON,
EVENT_UPDATE_MUEDCA_PARAMS,
+
+ /**
+ * EVENT_BSS_COLOR_COLLISION - Notification of a BSS color collision
+ */
+ * EVENT_BSS_COLOR_COLLISION - Notification of a BSS color collision
+ */
+ EVENT_BSS_COLOR_COLLISION,
+
+ /**
@@ -116,10 +112,10 @@ index 2a2bc29db..938245f50 100644
};
@@ -5947,6 +5967,13 @@ union wpa_event_data {
struct unprot_beacon {
const u8 *sa;
} unprot_beacon;
@@ -6034,6 +6054,13 @@ union wpa_event_data {
u8 he_mu_ac_vi_param[3];
u8 he_mu_ac_vo_param[3];
} update_muedca;
+
+ /**
+ * struct bss_color_collision - Data for EVENT_BSS_COLOR_COLLISION
@@ -130,14 +126,12 @@ index 2a2bc29db..938245f50 100644
};
/**
diff --git a/src/drivers/driver_common.c b/src/drivers/driver_common.c
index a7ebe9566..0c0a23f09 100644
--- a/src/drivers/driver_common.c
+++ b/src/drivers/driver_common.c
@@ -90,6 +90,10 @@ const char * event_to_string(enum wpa_event_type event)
E2S(WDS_STA_INTERFACE_STATUS);
@@ -91,6 +91,10 @@ const char * event_to_string(enum wpa_ev
E2S(UPDATE_DH);
E2S(UNPROT_BEACON);
E2S(UPDATE_MUEDCA_PARAMS);
+ E2S(BSS_COLOR_COLLISION);
+ E2S(CCA_STARTED_NOTIFY);
+ E2S(CCA_ABORTED_NOTIFY);
@@ -145,11 +139,9 @@ index a7ebe9566..0c0a23f09 100644
}
return "UNKNOWN";
diff --git a/src/drivers/driver_nl80211_event.c b/src/drivers/driver_nl80211_event.c
index ce95e9cd3..00a39a4ba 100644
--- a/src/drivers/driver_nl80211_event.c
+++ b/src/drivers/driver_nl80211_event.c
@@ -145,7 +145,10 @@ static const char * nl80211_command_to_string(enum nl80211_commands cmd)
@@ -145,7 +145,10 @@ static const char * nl80211_command_to_s
C2S(NL80211_CMD_UPDATE_OWE_INFO)
C2S(NL80211_CMD_UNPROT_BEACON)
C2S(NL80211_CMD_CONTROL_PORT_FRAME_TX_STATUS)
@@ -161,8 +153,8 @@ index ce95e9cd3..00a39a4ba 100644
default:
return "NL80211_CMD_UNKNOWN";
}
@@ -2597,6 +2600,51 @@ nl80211_control_port_frame_tx_status(struct wpa_driver_nl80211_data *drv,
wpa_supplicant_event(drv->ctx, EVENT_EAPOL_TX_STATUS, &event);
@@ -2603,6 +2606,51 @@ static void nl80211_control_port_frame(s
}
}
+#ifdef CONFIG_IEEE80211AX
@@ -211,11 +203,11 @@ index ce95e9cd3..00a39a4ba 100644
+}
+#endif
static void do_process_drv_event(struct i802_bss *bss, int cmd,
struct nlattr **tb)
@@ -2825,6 +2873,20 @@ static void do_process_drv_event(struct i802_bss *bss, int cmd,
tb[NL80211_ATTR_ACK],
tb[NL80211_ATTR_COOKIE]);
static void
nl80211_control_port_frame_tx_status(struct wpa_driver_nl80211_data *drv,
@@ -2856,6 +2904,20 @@ static void do_process_drv_event(struct
case NL80211_CMD_UPDATE_HE_MUEDCA_PARAMS:
nl80211_update_muedca_params_event(drv, tb);
break;
+#ifdef CONFIG_IEEE80211AX
+ case NL80211_CMD_OBSS_COLOR_COLLISION:
@@ -234,6 +226,3 @@ index ce95e9cd3..00a39a4ba 100644
default:
wpa_dbg(drv->ctx, MSG_DEBUG, "nl80211: Ignored unknown event "
"(cmd=%d)", cmd);
--
2.25.1

View File

@@ -1,7 +1,7 @@
From fcf80c8a089674dc03c2db435aca8a76dbc11fe8 Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Wed, 24 Jun 2020 14:47:40 +0200
Subject: [PATCH 806/813] bss_coloring: allow using a random starting color
Subject: [PATCH V4 6/6] bss_coloring: allow using a random starting color
Date: Wed, 26 Aug 2020 08:22:16 +0200
Enhance the possible values for he_bss_color. Anything greater than 63 will
make hostapd choose a random color.
@@ -13,7 +13,7 @@ Signed-off-by: John Crispin <john@phrozen.org>
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/hostapd/config_file.c b/hostapd/config_file.c
index 9c1883d55..e66790303 100644
index 97ded78aa..6c1f629cf 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -3439,8 +3439,11 @@ static int hostapd_config_fill(struct hostapd_config *conf,
@@ -46,6 +46,3 @@ index 91ac96785..5fc4d5f86 100644
#he_bss_color=1
# he_bss_color_partial: BSS color AID equation
--
2.25.1

View File

@@ -0,0 +1,126 @@
From d0d7cc4647ecad26b7bf04e39a4e9403cab68a48 Mon Sep 17 00:00:00 2001
From: Karthikeyan Periyasamy <periyasa@codeaurora.org>
Date: Sat, 15 Aug 2020 18:47:26 +0530
Subject: [PATCH] hostapd: Add intelligence color choose in CCA
Gather color information of the neighbor APs and choose available
free color after go through the neighbor colors to minimise the color collision
Signed-off-by: Karthikeyan Periyasamy <periyasa@codeaurora.org>
---
src/ap/ap_list.c | 29 +++++++++++++++++++++++++
src/ap/ap_list.h | 7 ++++++
src/ap/hostapd.c | 66 +++++++++++++++++++++++++++++---------------------------
3 files changed, 70 insertions(+), 32 deletions(-)
--- a/src/ap/ap_list.c
+++ b/src/ap/ap_list.c
@@ -174,6 +174,7 @@ void ap_list_process_beacon(struct hosta
struct ap_info *ap;
int new_ap = 0;
int set_beacon = 0;
+ u32 he_operation;
if (iface->conf->ap_table_max_size < 1)
return;
@@ -210,6 +211,17 @@ void ap_list_process_beacon(struct hosta
else
ap->ht_support = 0;
+ if (iface->conf->ieee80211ax &&
+ elems->he_operation) {
+ he_operation = *(u32 *)elems->he_operation;
+
+ if (!(he_operation & HE_OPERATION_BSS_COLOR_DISABLED))
+ ap->color = (he_operation & HE_OPERATION_BSS_COLOR_MASK) >>
+ HE_OPERATION_BSS_COLOR_OFFSET;
+ else
+ ap->color = 0;
+ }
+
os_get_reltime(&ap->last_beacon);
if (!new_ap && ap != iface->ap_list) {
@@ -295,6 +307,21 @@ void ap_list_timer(struct hostapd_iface
ieee802_11_update_beacons(iface);
}
+u64 ap_list_get_color(struct hostapd_iface *iface)
+{
+ u64 used_color_bitmap = 0;
+ struct ap_info *ap;
+
+ if (!iface->ap_list)
+ return used_color_bitmap;
+
+ ap = iface->ap_list;
+ while (ap != NULL) {
+ used_color_bitmap |= (u64)1 << ap->color;
+ ap = ap->next;
+ }
+ return used_color_bitmap;
+}
int ap_list_init(struct hostapd_iface *iface)
{
--- a/src/ap/ap_list.h
+++ b/src/ap/ap_list.h
@@ -25,6 +25,7 @@ struct ap_info {
int channel;
int ht_support;
+ u8 color;
struct os_reltime last_beacon;
};
@@ -40,6 +41,7 @@ void ap_list_process_beacon(struct hosta
int ap_list_init(struct hostapd_iface *iface);
void ap_list_deinit(struct hostapd_iface *iface);
void ap_list_timer(struct hostapd_iface *iface);
+u64 ap_list_get_color(struct hostapd_iface *iface);
#else /* NEED_AP_MLME */
static inline int ap_list_init(struct hostapd_iface *iface)
{
@@ -53,6 +55,11 @@ static inline void ap_list_deinit(struct
static inline void ap_list_timer(struct hostapd_iface *iface)
{
}
+
+static u64 ap_list_get_color(struct hostapd_iface *iface)
+{
+ return 0;
+}
#endif /* NEED_AP_MLME */
#endif /* AP_LIST_H */
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -3757,6 +3757,7 @@ hostapd_switch_color_timeout_handler(voi
struct cca_settings settings;
struct os_time now;
int i, r, b, ret;
+ u64 neighbor_color;
if (os_get_time(&now))
return;
@@ -3765,11 +3766,16 @@ hostapd_switch_color_timeout_handler(voi
if (now.sec - hapd->last_color_collision.sec >= 10)
return;
- r = os_random() % HE_OPERATION_BSS_COLOR_MAX;
- for (i = 0; i < HE_OPERATION_BSS_COLOR_MAX; i++) {
- if (r && (hapd->color_collision_bitmap & (1 << r)) == 0)
+ neighbor_color = ap_list_get_color(hapd->iface);
+ neighbor_color |= hapd->color_collision_bitmap;
+
+ r = os_random() % HE_OPERATION_BSS_COLOR_MAX - 1;
+ r++;
+ for (i = 1; i < HE_OPERATION_BSS_COLOR_MAX; i++) {
+ if ((neighbor_color & (1 << r)) == 0)
break;
- r = (r + 1) % HE_OPERATION_BSS_COLOR_MAX;
+ r = r % HE_OPERATION_BSS_COLOR_MAX - 1;
+ r++;
}
if (i == HE_OPERATION_BSS_COLOR_MAX) {
/* there are no free colors so turn bss coloring off */

View File

@@ -0,0 +1,96 @@
From f2cc86f874e09b0b1d1247de98f1720aa51080d8 Mon Sep 17 00:00:00 2001
From: Lavanya Suresh <lavaks@codeaurora.org>
Date: Tue, 6 Oct 2020 21:37:04 +0530
Subject: [PATCH] hostapd: Add BCCA IE with countdown zero
During BCCA, BCCA IE with countdown zero has to be added
in the beacon in which new color is updated. Remove BCCA
IE in the beacon template after color change is
completed.
Signed-off-by: Lavanya Suresh <lavaks@codeaurora.org>
---
src/ap/drv_callbacks.c | 6 ++++++
src/ap/hostapd.c | 10 ++++++++--
src/ap/hostapd.h | 1 +
src/ap/ieee802_11_he.c | 2 +-
4 files changed, 16 insertions(+), 3 deletions(-)
--- a/src/ap/drv_callbacks.c
+++ b/src/ap/drv_callbacks.c
@@ -1793,14 +1793,29 @@ static void hostapd_event_bss_color_coll
static void hostapd_event_cca(struct hostapd_data *hapd, enum wpa_event_type event)
{
+ int b, err;
+
switch (event) {
case EVENT_CCA_STARTED_NOTIFY:
wpa_printf(MSG_DEBUG, "CCA started on %s", hapd->conf->iface);
break;
case EVENT_CCA_NOTIFY:
wpa_printf(MSG_DEBUG, "CCA finished on %s (new color: %d)", hapd->conf->iface, hapd->cca_color);
- hapd->iface->conf->he_op.he_bss_color = hapd->cca_color;
- hostapd_cleanup_cca_params(hapd);
+
+ for (b = 0; b < hapd->iface->num_bss; b++) {
+ if (hapd->iface->bss[b]->cca_color != 0) {
+ hapd->iface->conf->he_op.he_bss_color = hapd->iface->bss[b]->cca_color;
+ hapd->iface->bss[b]->cca_in_progress = 0;
+ err = ieee802_11_set_beacon(hapd->iface->bss[b]);
+ if (err) {
+ wpa_printf(MSG_ERROR, "Failed to remove BCCA IE");
+ hapd->iface->bss[b]->cca_in_progress = 1;
+ }
+ else
+ hostapd_cleanup_cca_params(hapd->iface->bss[b]);
+ }
+ }
+
break;
case EVENT_CCA_ABORTED_NOTIFY:
wpa_printf(MSG_DEBUG, "CCA aborted on %s for cca_color: %d", hapd->conf->iface, hapd->cca_color);
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -3727,12 +3727,18 @@ int hostapd_fill_cca_settings(struct hos
old_color = iface->conf->he_op.he_bss_color;
iface->conf->he_op.he_bss_color = hapd->cca_color;
+
+ settings->cca_count = hapd->cca_count;
+ settings->cca_color = hapd->cca_color;
+ hapd->cca_count = 0;
+ hapd->cca_zero_count = 1;
+
ret = hostapd_build_beacon_data(hapd, &settings->beacon_after);
iface->conf->he_op.he_bss_color = old_color;
- settings->cca_count = hapd->cca_count;
- settings->cca_color = hapd->cca_color,
+ hapd->cca_count = settings->cca_count;
hapd->cca_in_progress = 1;
+ hapd->cca_zero_count = 0;
ret = hostapd_build_beacon_data(hapd, &settings->beacon_cca);
if (ret) {
--- a/src/ap/hostapd.h
+++ b/src/ap/hostapd.h
@@ -298,6 +298,7 @@ struct hostapd_data {
#ifdef CONFIG_IEEE80211AX
int cca_in_progress;
+ int cca_zero_count;
u8 cca_count;
u8 cca_color;
unsigned int cca_c_off_beacon;
--- a/src/ap/ieee802_11_he.c
+++ b/src/ap/ieee802_11_he.c
@@ -491,7 +491,7 @@ int hostapd_get_he_twt_responder(struct
u8 * hostapd_eid_cca(struct hostapd_data *hapd, u8 *eid)
{
- if (!hapd->cca_in_progress)
+ if (!hapd->cca_in_progress && !hapd->cca_zero_count)
return eid;
*eid++ = WLAN_EID_EXTENSION;
*eid++ = 3;

View File

@@ -0,0 +1,77 @@
From 7c0383bf8883e2bad9c7beb47712105be38b5427 Mon Sep 17 00:00:00 2001
From: Lavanya Suresh <lavaks@codeaurora.org>
Date: Wed, 7 Oct 2020 13:29:03 +0530
Subject: [PATCH] hostapd: Check free colors periodically if no new color is
available
In case of collision, if all the colors are in use, start dot11APcollision
timer(50s) and check for new color after timeout.
Signed-off-by: Lavanya Suresh <lavaks@codeaurora.org>
---
src/ap/hostapd.c | 20 +++++++++++++++++---
src/ap/hostapd.h | 1 +
2 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
index 097db83..101178b 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -3766,11 +3766,12 @@ hostapd_switch_color_timeout_handler(void *eloop_data, void *user_ctx)
return;
/* check if there has been a recent collision */
- if (now.sec - hapd->last_color_collision.sec > 50)
+ if (now.sec - hapd->last_color_collision.sec > 50 && !hapd->no_free_color)
return;
neighbor_color = ap_list_get_color(hapd->iface);
- neighbor_color |= hapd->color_collision_bitmap;
+ if (!hapd->no_free_color)
+ neighbor_color |= hapd->color_collision_bitmap;
r = os_random() % HE_OPERATION_BSS_COLOR_MAX - 1;
r++;
@@ -3782,13 +3783,26 @@ hostapd_switch_color_timeout_handler(void *eloop_data, void *user_ctx)
}
if (i == HE_OPERATION_BSS_COLOR_MAX) {
/* there are no free colors so turn bss coloring off */
- wpa_printf(MSG_INFO, "no free colors left, turning of BSS coloring");
+ wpa_printf(MSG_INFO, "no free colors left, turning off BSS coloring");
hapd->iface->conf->he_op.he_bss_color_disabled = 1;
+ hapd->no_free_color = 1;
for (b = 0; b < hapd->iface->num_bss; b++)
ieee802_11_set_beacon(hapd->iface->bss[b]);
+
+ /* Enabling for next check after timeout*/
+ hapd->iface->conf->he_op.he_bss_color_disabled = 0;
+
+ /* start timer for DOT11BSS_COLOR_COLLISION_AP_PERIOD, and check free color on timeout */
+ if (!eloop_is_timeout_registered(hostapd_switch_color_timeout_handler, hapd, NULL))
+ eloop_register_timeout(DOT11BSS_COLOR_COLLISION_AP_PERIOD, 0,
+ hostapd_switch_color_timeout_handler, hapd, NULL);
+
return;
}
+ if (hapd->no_free_color)
+ hapd->no_free_color = 0;
+
for (b = 0; b < hapd->iface->num_bss; b++) {
struct hostapd_data *bss = hapd->iface->bss[b];
diff --git a/src/ap/hostapd.h b/src/ap/hostapd.h
index a229f80..1b3a87f 100644
--- a/src/ap/hostapd.h
+++ b/src/ap/hostapd.h
@@ -299,6 +299,7 @@ struct hostapd_data {
#ifdef CONFIG_IEEE80211AX
int cca_in_progress;
int cca_zero_count;
+ int no_free_color;
u8 cca_count;
u8 cca_color;
unsigned int cca_c_off_beacon;
--
2.7.4

File diff suppressed because it is too large Load Diff