diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c index e4b72a8fa..b05f3d0a0 100644 --- a/wpa_supplicant/scan.c +++ b/wpa_supplicant/scan.c @@ -420,29 +420,6 @@ wpa_supplicant_build_filter_ssids(struct wpa_config *conf, size_t *num_ssids) } -#ifdef CONFIG_P2P -static bool is_6ghz_supported(struct wpa_supplicant *wpa_s) -{ - struct hostapd_channel_data *chnl; - int i, j; - - for (i = 0; i < wpa_s->hw.num_modes; i++) { - if (wpa_s->hw.modes[i].mode == HOSTAPD_MODE_IEEE80211A) { - chnl = wpa_s->hw.modes[i].channels; - for (j = 0; j < wpa_s->hw.modes[i].num_channels; j++) { - if (chnl[j].flag & HOSTAPD_CHAN_DISABLED) - continue; - if (is_6ghz_freq(chnl[j].freq)) - return true; - } - } - } - - return false; -} -#endif /* CONFIG_P2P */ - - static void wpa_supplicant_optimize_freqs( struct wpa_supplicant *wpa_s, struct wpa_driver_scan_params *params) { @@ -1555,7 +1532,7 @@ scan: } } - if (!params.freqs && is_6ghz_supported(wpa_s) && + if (!params.freqs && wpas_is_6ghz_supported(wpa_s, true) && (wpa_s->p2p_in_invitation || wpa_s->p2p_in_provisioning)) wpas_p2p_scan_freqs(wpa_s, ¶ms, true); #endif /* CONFIG_P2P */ diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index d769dbd09..f288f3fa1 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -7118,6 +7118,7 @@ static int wpa_supplicant_init_iface(struct wpa_supplicant *wpa_s, wpa_s->hw_capab == CAPAB_NO_HT_VHT) wpa_s->hw_capab = CAPAB_HT; } + wpa_s->support_6ghz = wpas_is_6ghz_supported(wpa_s, false); } capa_res = wpa_drv_get_capa(wpa_s, &capa); @@ -9245,3 +9246,25 @@ int wpa_drv_send_action(struct wpa_supplicant *wpa_s, unsigned int freq, return wpa_s->driver->send_action(wpa_s->drv_priv, freq, wait, dst, src, bssid, data, data_len, no_cck); } + + +bool wpas_is_6ghz_supported(struct wpa_supplicant *wpa_s, bool only_enabled) +{ + struct hostapd_channel_data *chnl; + int i, j; + + for (i = 0; i < wpa_s->hw.num_modes; i++) { + if (wpa_s->hw.modes[i].mode == HOSTAPD_MODE_IEEE80211A) { + chnl = wpa_s->hw.modes[i].channels; + for (j = 0; j < wpa_s->hw.modes[i].num_channels; j++) { + if (only_enabled && + (chnl[j].flag & HOSTAPD_CHAN_DISABLED)) + continue; + if (is_6ghz_freq(chnl[j].freq)) + return true; + } + } + } + + return false; +} diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h index a7d748ca9..89f078ca0 100644 --- a/wpa_supplicant/wpa_supplicant_i.h +++ b/wpa_supplicant/wpa_supplicant_i.h @@ -1566,6 +1566,7 @@ struct wpa_supplicant { unsigned int enable_dscp_policy_capa:1; unsigned int connection_dscp:1; unsigned int wait_for_dscp_req:1; + bool support_6ghz; struct wpa_signal_info last_signal_info; @@ -1959,6 +1960,7 @@ int wpas_pasn_deauthenticate(struct wpa_supplicant *wpa_s, const u8 *own_addr, void wpas_pasn_auth_trigger(struct wpa_supplicant *wpa_s, struct pasn_auth *pasn_auth); void wpas_pasn_auth_work_done(struct wpa_supplicant *wpa_s, int status); +bool wpas_is_6ghz_supported(struct wpa_supplicant *wpa_s, bool only_enabled); bool wpa_is_non_eht_scs_traffic_desc_supported(struct wpa_bss *bss);