~ubuntu-branches/ubuntu/utopic/wpasupplicant/utopic

« back to all changes in this revision

Viewing changes to wpa_supplicant/scan.c

  • Committer: Bazaar Package Importer
  • Author(s): Kel Modderman
  • Date: 2010-02-27 11:30:53 UTC
  • mfrom: (5.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20100227113053-axxieaw3hmuqbqls
Tags: 0.6.10-2
* Switch to source format 3.0 (quilt), drop quilt build dependency
  and remove '--with quilt' from dh command in debian/rules.
* Fix "FTBFS on kfreebsd-gnu" with addition of 21_kfreebsd.patch.
  Thanks to work by Stefan Lippers-Hollmann and Petr Salinger.
  (Closes: #480572)
* Disable experimental feature CONFIG_IEEE80211W (management frame
  protection) due to it not being supported by any driver but ath9k
  and it generating ioctl errors which cause much concern among users
  for little to no benefit.
* Add traling blank line to debian/NEWS to assist apt-listchanges as
  per lintian advice.
* Cherry pick 30_cfg80211_association_optimisation.patch from upstream
  git. Add cfg80211-specific optimization to avoid silly behavior.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
#include "wpa_supplicant_i.h"
21
21
#include "mlme.h"
22
22
#include "wps_supplicant.h"
 
23
#include "ctrl_iface_dbus.h"
23
24
 
24
25
 
25
26
static void wpa_supplicant_gen_assoc_event(struct wpa_supplicant *wpa_s)
65
66
}
66
67
#endif /* CONFIG_WPS */
67
68
 
 
69
 
 
70
int wpa_supplicant_enabled_networks(struct wpa_config *conf)
 
71
{
 
72
        struct wpa_ssid *ssid = conf->ssid;
 
73
        while (ssid) {
 
74
                if (!ssid->disabled)
 
75
                        return 1;
 
76
                ssid = ssid->next;
 
77
        }
 
78
        return 0;
 
79
}
 
80
 
 
81
 
68
82
static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx)
69
83
{
70
84
        struct wpa_supplicant *wpa_s = eloop_ctx;
71
85
        struct wpa_ssid *ssid;
72
 
        int enabled, scan_req = 0, ret;
 
86
        int scan_req = 0, ret;
73
87
        struct wpabuf *wps_ie = NULL;
74
88
        const u8 *extra_ie = NULL;
75
89
        size_t extra_ie_len = 0;
78
92
        enum wps_request_type req_type = WPS_REQ_ENROLLEE_INFO;
79
93
#endif /* CONFIG_WPS */
80
94
 
81
 
        if (wpa_s->disconnected && !wpa_s->scan_req)
 
95
        if (wpa_s->disconnected && !wpa_s->scan_req) {
 
96
                wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED);
82
97
                return;
83
 
 
84
 
        enabled = 0;
85
 
        ssid = wpa_s->conf->ssid;
86
 
        while (ssid) {
87
 
                if (!ssid->disabled) {
88
 
                        enabled++;
89
 
                        break;
90
 
                }
91
 
                ssid = ssid->next;
92
98
        }
93
 
        if (!enabled && !wpa_s->scan_req) {
 
99
 
 
100
        if (!wpa_supplicant_enabled_networks(wpa_s->conf) &&
 
101
            !wpa_s->scan_req) {
94
102
                wpa_printf(MSG_DEBUG, "No enabled networks - do not scan");
95
103
                wpa_supplicant_set_state(wpa_s, WPA_INACTIVE);
96
104
                return;
189
197
        }
190
198
#endif /* CONFIG_WPS */
191
199
 
 
200
        wpa_supplicant_notify_scanning(wpa_s, 1);
 
201
 
192
202
        if (wpa_s->use_client_mlme) {
193
203
                ieee80211_sta_set_probe_req_ie(wpa_s, extra_ie, extra_ie_len);
194
204
                ret = ieee80211_sta_req_scan(wpa_s, ssid ? ssid->ssid : NULL,
203
213
 
204
214
        if (ret) {
205
215
                wpa_printf(MSG_WARNING, "Failed to initiate AP scan.");
 
216
                wpa_supplicant_notify_scanning(wpa_s, 0);
206
217
                wpa_supplicant_req_scan(wpa_s, 10, 0);
207
218
        } else
208
219
                wpa_s->scan_runs++;
261
272
        wpa_msg(wpa_s, MSG_DEBUG, "Cancelling scan request");
262
273
        eloop_cancel_timeout(wpa_supplicant_scan, wpa_s, NULL);
263
274
}
 
275
 
 
276
 
 
277
void wpa_supplicant_notify_scanning(struct wpa_supplicant *wpa_s,
 
278
                                    int scanning)
 
279
{
 
280
        if (wpa_s->scanning != scanning) {
 
281
                wpa_s->scanning = scanning;
 
282
                wpa_supplicant_dbus_notify_scanning(wpa_s);
 
283
        }
 
284
}
 
285