diff --git a/components/wpa_supplicant/esp_supplicant/src/esp_scan.c b/components/wpa_supplicant/esp_supplicant/src/esp_scan.c index b0192bb94b..0a7c27f8b4 100644 --- a/components/wpa_supplicant/esp_supplicant/src/esp_scan.c +++ b/components/wpa_supplicant/esp_supplicant/src/esp_scan.c @@ -166,7 +166,21 @@ int esp_handle_beacon_probe(u8 type, u8 *frame, size_t len, u8 *sender, return 0; } +#ifdef CONFIG_WNM +void get_scan_channel_bitmap(struct wpa_supplicant *wpa_s, wifi_scan_config_t *params) { + if (!wpa_s->wnm_num_neighbor_report) { + wpa_printf(MSG_DEBUG, "No Neighbor Report to gather scan channel list"); + return; + } + params->channel_bitmap.ghz_2_channels = 0; + for (int i = 0; i < wpa_s->wnm_num_neighbor_report; i++) { + struct neighbor_report *nei; + nei = &wpa_s->wnm_neighbor_report_elements[i]; + params->channel_bitmap.ghz_2_channels |= (1 << nei->channel_number); + } +} +#endif /*CONFIG_WNM*/ static int issue_scan(struct wpa_supplicant *wpa_s, struct wpa_driver_scan_params *scan_params) { @@ -217,7 +231,11 @@ static int issue_scan(struct wpa_supplicant *wpa_s, if (scan_params->channel) { params->channel = scan_params->channel; } - +#ifdef CONFIG_WNM + else { + get_scan_channel_bitmap(wpa_s, params); + } +#endif /*CONFIG_WNM*/ if (scan_params->duration) { params->scan_time.passive = scan_params->duration; params->scan_time.active.min = scan_params->duration; diff --git a/components/wpa_supplicant/src/utils/common.h b/components/wpa_supplicant/src/utils/common.h index efd34a3f02..655de8177a 100644 --- a/components/wpa_supplicant/src/utils/common.h +++ b/components/wpa_supplicant/src/utils/common.h @@ -479,3 +479,5 @@ void * __hide_aliasing_typecast(void *foo); #define IANA_SECP384R1 20 #define IANA_SECP521R1 21 #endif /* COMMON_H */ + +#define GHZ_24_MAX_CHANNEL_COUNT 14