5a7e10f6b78134a47d7aad0466404e66a9ae4914
[openwrt.git] / package / hostapd / patches / 310-scan_ssid.patch
1 --- a/wpa_supplicant/scan.c
2 +++ b/wpa_supplicant/scan.c
3 @@ -215,6 +215,7 @@ static void wpa_supplicant_scan(void *el
4         enum wps_request_type req_type = WPS_REQ_ENROLLEE_INFO;
5  #endif /* CONFIG_WPS */
6         struct wpa_driver_scan_params params;
7 +       int scan_ssid_all = 1;
8         size_t max_ssids;
9  
10         if (wpa_s->disconnected && !wpa_s->scan_req) {
11 @@ -275,6 +276,16 @@ static void wpa_supplicant_scan(void *el
12             wpa_s->wpa_state == WPA_INACTIVE)
13                 wpa_supplicant_set_state(wpa_s, WPA_SCANNING);
14  
15 +       /* check if all configured ssids should be scanned directly */
16 +       ssid = wpa_s->conf->ssid;
17 +       while (ssid) {
18 +               if (!ssid->scan_ssid) {
19 +                       scan_ssid_all = 0;
20 +                       break;
21 +               }
22 +               ssid = ssid->next;
23 +       }
24 +
25         /* Find the starting point from which to continue scanning */
26         ssid = wpa_s->conf->ssid;
27         if (wpa_s->prev_scan_ssid != WILDCARD_SSID_SCAN) {
28 @@ -336,6 +347,9 @@ static void wpa_supplicant_scan(void *el
29                 int_array_sort_unique(params.freqs);
30         }
31  
32 +       if (scan_ssid_all && !ssid)
33 +               ssid = wpa_s->conf->ssid;
34 +
35         if (ssid) {
36                 wpa_s->prev_scan_ssid = ssid;
37                 if (max_ssids > 1) {