diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c index 76d3d6566..c624c3c84 100644 --- a/wpa_supplicant/scan.c +++ b/wpa_supplicant/scan.c @@ -2047,6 +2047,8 @@ static int wpa_scan_result_compar(const void *a, const void *b) } if ((snr_a && snr_b && abs(snr_b - snr_a) < 5) || (wa->qual && wb->qual && abs(wb->qual - wa->qual) < 10)) { + if (is_6ghz_freq(wa->freq) ^ is_6ghz_freq(wb->freq)) + return is_6ghz_freq(wa->freq) ? -1 : 1; if (IS_5GHZ(wa->freq) ^ IS_5GHZ(wb->freq)) return IS_5GHZ(wa->freq) ? -1 : 1; } @@ -2207,9 +2209,10 @@ void filter_scan_res(struct wpa_supplicant *wpa_s, void scan_snr(struct wpa_scan_res *res) { if (res->flags & WPA_SCAN_NOISE_INVALID) { - res->noise = IS_5GHZ(res->freq) ? - DEFAULT_NOISE_FLOOR_5GHZ : - DEFAULT_NOISE_FLOOR_2GHZ; + res->noise = is_6ghz_freq(res->freq) ? + DEFAULT_NOISE_FLOOR_6GHZ : + (IS_5GHZ(res->freq) ? + DEFAULT_NOISE_FLOOR_5GHZ : DEFAULT_NOISE_FLOOR_2GHZ); } if (res->flags & WPA_SCAN_LEVEL_DBM) { diff --git a/wpa_supplicant/scan.h b/wpa_supplicant/scan.h index bcf3838b0..d1780eb09 100644 --- a/wpa_supplicant/scan.h +++ b/wpa_supplicant/scan.h @@ -16,6 +16,7 @@ */ #define DEFAULT_NOISE_FLOOR_2GHZ (-89) #define DEFAULT_NOISE_FLOOR_5GHZ (-92) +#define DEFAULT_NOISE_FLOOR_6GHZ (-92) /* * Channels with a great SNR can operate at full rate. What is a great SNR? @@ -30,7 +31,7 @@ #define GREAT_SNR 25 #define IS_2P4GHZ(n) (n >= 2412 && n <= 2484) -#define IS_5GHZ(n) (n > 4000) +#define IS_5GHZ(n) (n > 4000 && n < 5895) int wpa_supplicant_enabled_networks(struct wpa_supplicant *wpa_s); void wpa_supplicant_req_scan(struct wpa_supplicant *wpa_s, int sec, int usec);