]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
WNM: Optimize a single BSS transition management candidate scan
authorJouni Malinen <jouni@qca.qualcomm.com>
Fri, 26 Feb 2016 15:16:35 +0000 (17:16 +0200)
committerJouni Malinen <j@w1.fi>
Fri, 26 Feb 2016 15:19:20 +0000 (17:19 +0200)
If the BSS Transition Management Request frame includes only a single
candidate and we need to scan for the BSS to get up-to-date information,
use a scan for the known BSSID instead of wildcard BSSID. In addition,
set the SSID in the scan if it is known based on old scan results in the
BSS table. This removes unnecessary Probe Response frames when we are
interested in results from only a single BSS.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
wpa_supplicant/scan.c
wpa_supplicant/wnm_sta.c
wpa_supplicant/wpa_supplicant_i.h

index c925cad114b867745db32a3f38c7fe23404fb086..2ce3929ed88a13e53b4a637b2a8d760e34c346ad 100644 (file)
@@ -1006,6 +1006,27 @@ ssid_list_set:
                }
        }
 
+       if (!is_zero_ether_addr(wpa_s->next_scan_bssid)) {
+               struct wpa_bss *bss;
+
+               params.bssid = wpa_s->next_scan_bssid;
+               bss = wpa_bss_get_bssid_latest(wpa_s, params.bssid);
+               if (bss && bss->ssid_len && params.num_ssids == 1 &&
+                   params.ssids[0].ssid_len == 0) {
+                       params.ssids[0].ssid = bss->ssid;
+                       params.ssids[0].ssid_len = bss->ssid_len;
+                       wpa_dbg(wpa_s, MSG_DEBUG,
+                               "Scan a previously specified BSSID " MACSTR
+                               " and SSID %s",
+                               MAC2STR(params.bssid),
+                               wpa_ssid_txt(bss->ssid, bss->ssid_len));
+               } else {
+                       wpa_dbg(wpa_s, MSG_DEBUG,
+                               "Scan a previously specified BSSID " MACSTR,
+                               MAC2STR(params.bssid));
+               }
+       }
+
        scan_params = &params;
 
 scan:
@@ -1066,6 +1087,8 @@ scan:
 #ifdef CONFIG_INTERWORKING
                wpa_s->interworking_fast_assoc_tried = 0;
 #endif /* CONFIG_INTERWORKING */
+               if (params.bssid)
+                       os_memset(wpa_s->next_scan_bssid, 0, ETH_ALEN);
        }
 }
 
index 0dc41dca2193d9dd5b1d0993581899549a2adf7c..4da912426650c907059f651fa17c655b5079dd03 100644 (file)
@@ -1148,6 +1148,14 @@ static void ieee802_11_rx_bss_trans_mgmt_req(struct wpa_supplicant *wpa_s,
                }
 
                wnm_set_scan_freqs(wpa_s);
+               if (wpa_s->wnm_num_neighbor_report == 1) {
+                       os_memcpy(wpa_s->next_scan_bssid,
+                                 wpa_s->wnm_neighbor_report_elements[0].bssid,
+                                 ETH_ALEN);
+                       wpa_printf(MSG_DEBUG,
+                                  "WNM: Scan only for a specific BSSID since there is only a single candidate "
+                                  MACSTR, MAC2STR(wpa_s->next_scan_bssid));
+               }
                wpa_supplicant_req_scan(wpa_s, 0, 0);
        } else if (reply) {
                enum bss_trans_mgmt_status_code status;
index 0e3e42a5ecff16c37ee97e6c4884c6298f83a662..14a724589f0c4118692fb80b3fac9ae8d864e101 100644 (file)
@@ -640,6 +640,7 @@ struct wpa_supplicant {
 #define MAX_SCAN_ID 16
        int scan_id[MAX_SCAN_ID];
        unsigned int scan_id_count;
+       u8 next_scan_bssid[ETH_ALEN];
 
        struct wpa_ssid_value *ssids_from_scan_req;
        unsigned int num_ssids_from_scan_req;