]> git.ipfire.org Git - thirdparty/hostap.git/blobdiff - wpa_supplicant/scan.c
Fix SELECT_NETWORK freq parameter
[thirdparty/hostap.git] / wpa_supplicant / scan.c
index 6099a36c5a14e7e69c9c043a13f04c48b9f8d46f..f3ff4cdd828b65d675547e4feef45801d02c532a 100644 (file)
@@ -1018,6 +1018,13 @@ ssid_list_set:
                wpa_s->manual_scan_freqs = NULL;
        }
 
+       if (params.freqs == NULL && wpa_s->select_network_scan_freqs) {
+               wpa_dbg(wpa_s, MSG_DEBUG,
+                       "Limit select_network scan to specified channels");
+               params.freqs = wpa_s->select_network_scan_freqs;
+               wpa_s->select_network_scan_freqs = NULL;
+       }
+
        if (params.freqs == NULL && wpa_s->next_scan_freqs) {
                wpa_dbg(wpa_s, MSG_DEBUG, "Optimize scan based on previously "
                        "generated frequency list");
@@ -1788,10 +1795,12 @@ struct wpabuf * wpa_scan_get_vendor_ie_multi(const struct wpa_scan_res *res,
  * This doc https://supportforums.cisco.com/docs/DOC-12954 says, "the general
  * rule of thumb is that any SNR above 20 is good." This one
  * http://www.cisco.com/en/US/tech/tk722/tk809/technologies_q_and_a_item09186a00805e9a96.shtml#qa23
- * recommends 25 as a minimum SNR for 54 Mbps data rate. 30 is chosen here as a
- * conservative value.
+ * recommends 25 as a minimum SNR for 54 Mbps data rate. The estimates used in
+ * scan_est_throughput() allow even smaller SNR values for the maximum rates
+ * (21 for 54 Mbps, 22 for VHT80 MCS9, 24 for HT40 and HT20 MCS7). Use 25 as a
+ * somewhat conservative value here.
  */
-#define GREAT_SNR 30
+#define GREAT_SNR 25
 
 #define IS_5GHZ(n) (n > 4000)
 
@@ -1839,10 +1848,12 @@ static int wpa_scan_result_compar(const void *a, const void *b)
        }
 
        /* if SNR is close, decide by max rate or frequency band */
-       if ((snr_a && snr_b && abs(snr_b - snr_a) < 5) ||
-           (wa->qual && wb->qual && abs(wb->qual - wa->qual) < 10)) {
+       if (snr_a && snr_b && abs(snr_b - snr_a) < 7) {
                if (wa->est_throughput != wb->est_throughput)
                        return wb->est_throughput - wa->est_throughput;
+       }
+       if ((snr_a && snr_b && abs(snr_b - snr_a) < 5) ||
+           (wa->qual && wb->qual && abs(wb->qual - wa->qual) < 10)) {
                if (IS_5GHZ(wa->freq) ^ IS_5GHZ(wb->freq))
                        return IS_5GHZ(wa->freq) ? -1 : 1;
        }