From: Tianfeng Ren Date: Wed, 26 Mar 2025 05:42:02 +0000 (+0530) Subject: ACS: Validate 6 GHz AP criteria before ACS X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=02a8d40c9ffb2987c291ea96cf7be7c012b359a3;p=thirdparty%2Fhostap.git ACS: Validate 6 GHz AP criteria before ACS Ensure that the 6 GHz AP criteria (RSN parameters) are met before selecting the ACS candidate channels. Currently, hostapd includes 6 GHz channels as ACS candidates. However, if the BSS configuration does not comply with 6 GHz AP criteria, ACS might inadvertently start an 6 GHz AP with configuration that does not meet RSN configuration requirements for the 6 GHz band. Add a validation step to check 6 GHz AP criteria before ACS candidates channel selection. Signed-off-by: Tianfeng Ren --- diff --git a/src/ap/ap_config.c b/src/ap/ap_config.c index 52808c59b..bbf8a7ba8 100644 --- a/src/ap/ap_config.c +++ b/src/ap/ap_config.c @@ -1198,7 +1198,7 @@ static bool hostapd_sae_pk_password_without_pk(struct hostapd_bss_config *bss) #endif /* CONFIG_SAE_PK */ -static bool hostapd_config_check_bss_6g(struct hostapd_bss_config *bss) +bool hostapd_config_check_bss_6g(struct hostapd_bss_config *bss) { if (bss->wpa != WPA_PROTO_RSN) { wpa_printf(MSG_ERROR, diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h index 02eb4b6fb..af0d785be 100644 --- a/src/ap/ap_config.h +++ b/src/ap/ap_config.h @@ -1399,5 +1399,6 @@ 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); +bool hostapd_config_check_bss_6g(struct hostapd_bss_config *bss); #endif /* HOSTAPD_CONFIG_H */ diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c index 213342636..b2e930de9 100644 --- a/src/ap/ap_drv_ops.c +++ b/src/ap/ap_drv_ops.c @@ -1151,6 +1151,9 @@ void hostapd_get_hw_mode_any_channels(struct hostapd_data *hapd, { int i; bool is_no_ir = false; + bool allow_6g_acs = hostapd_config_check_bss_6g(hapd->conf) && + (hapd->iface->conf->ieee80211ax || + hapd->iface->conf->ieee80211be); for (i = 0; i < mode->num_channels; i++) { struct hostapd_channel_data *chan = &mode->channels[i]; @@ -1171,8 +1174,7 @@ void hostapd_get_hw_mode_any_channels(struct hostapd_data *hapd, if (is_6ghz_freq(chan->freq) && ((hapd->iface->conf->acs_exclude_6ghz_non_psc && !is_6ghz_psc_frequency(chan->freq)) || - (!hapd->iface->conf->ieee80211ax && - !hapd->iface->conf->ieee80211be))) + !allow_6g_acs)) continue; if ((!(chan->flag & HOSTAPD_CHAN_DISABLED) || allow_disabled) && !(hapd->iface->conf->acs_exclude_dfs &&