~ubuntu-branches/ubuntu/maverick/wpasupplicant/maverick

« back to all changes in this revision

Viewing changes to wpa_supplicant/wpa_supplicant.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:
385
385
        ieee80211_sta_deinit(wpa_s);
386
386
 
387
387
        wpas_wps_deinit(wpa_s);
 
388
 
 
389
        wpabuf_free(wpa_s->pending_eapol_rx);
 
390
        wpa_s->pending_eapol_rx = NULL;
388
391
}
389
392
 
390
393
 
418
421
        wpa_drv_set_key(wpa_s, WPA_ALG_NONE, bcast, 1, 0, NULL, 0, NULL, 0);
419
422
        wpa_drv_set_key(wpa_s, WPA_ALG_NONE, bcast, 2, 0, NULL, 0, NULL, 0);
420
423
        wpa_drv_set_key(wpa_s, WPA_ALG_NONE, bcast, 3, 0, NULL, 0, NULL, 0);
 
424
#ifdef CONFIG_IEEE80211W
 
425
        wpa_drv_set_key(wpa_s, WPA_ALG_NONE, bcast, 4, 0, NULL, 0, NULL, 0);
 
426
        wpa_drv_set_key(wpa_s, WPA_ALG_NONE, bcast, 5, 0, NULL, 0, NULL, 0);
 
427
#endif /* CONFIG_IEEE80211W */
421
428
        if (addr) {
422
429
                wpa_drv_set_key(wpa_s, WPA_ALG_NONE, addr, 0, 0, NULL, 0, NULL,
423
430
                                0);
475
482
                   wpa_supplicant_state_txt(wpa_s->wpa_state),
476
483
                   wpa_supplicant_state_txt(state));
477
484
 
 
485
        if (state != WPA_SCANNING)
 
486
                wpa_supplicant_notify_scanning(wpa_s, 0);
 
487
 
478
488
        wpa_supplicant_dbus_notify_state_change(wpa_s, state,
479
489
                                                wpa_s->wpa_state);
480
490
 
1226
1236
                                   int reason_code)
1227
1237
{
1228
1238
        u8 *addr = NULL;
1229
 
        wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED);
1230
1239
        if (!is_zero_ether_addr(wpa_s->bssid)) {
1231
1240
                if (wpa_s->use_client_mlme)
1232
1241
                        ieee80211_sta_deauthenticate(wpa_s, reason_code);
1236
1245
                addr = wpa_s->bssid;
1237
1246
        }
1238
1247
        wpa_clear_keys(wpa_s, addr);
 
1248
        wpa_supplicant_mark_disassoc(wpa_s);
1239
1249
        wpa_s->current_ssid = NULL;
1240
1250
        wpa_sm_set_config(wpa_s->wpa, NULL);
1241
1251
        eapol_sm_notify_config(wpa_s->eapol, NULL, NULL);
1242
 
        eapol_sm_notify_portEnabled(wpa_s->eapol, FALSE);
1243
 
        eapol_sm_notify_portValid(wpa_s->eapol, FALSE);
1244
1252
}
1245
1253
 
1246
1254
 
1471
1479
        if (name == NULL) {
1472
1480
                /* default to first driver in the list */
1473
1481
                wpa_s->driver = wpa_supplicant_drivers[0];
 
1482
                wpa_s->global_drv_priv = wpa_s->global->drv_priv[0];
1474
1483
                return 0;
1475
1484
        }
1476
1485
 
1477
1486
        for (i = 0; wpa_supplicant_drivers[i]; i++) {
1478
1487
                if (os_strcmp(name, wpa_supplicant_drivers[i]->name) == 0) {
1479
1488
                        wpa_s->driver = wpa_supplicant_drivers[i];
 
1489
                        wpa_s->global_drv_priv = wpa_s->global->drv_priv[i];
1480
1490
                        return 0;
1481
1491
                }
1482
1492
        }
1494
1504
        wpa_printf(MSG_DEBUG, "RX EAPOL from " MACSTR, MAC2STR(src_addr));
1495
1505
        wpa_hexdump(MSG_MSGDUMP, "RX EAPOL", buf, len);
1496
1506
 
 
1507
        if (wpa_s->wpa_state < WPA_ASSOCIATED) {
 
1508
                /*
 
1509
                 * There is possible race condition between receiving the
 
1510
                 * association event and the EAPOL frame since they are coming
 
1511
                 * through different paths from the driver. In order to avoid
 
1512
                 * issues in trying to process the EAPOL frame before receiving
 
1513
                 * association information, lets queue it for processing until
 
1514
                 * the association event is received.
 
1515
                 */
 
1516
                wpa_printf(MSG_DEBUG, "Not associated - Delay processing of "
 
1517
                           "received EAPOL frame");
 
1518
                wpabuf_free(wpa_s->pending_eapol_rx);
 
1519
                wpa_s->pending_eapol_rx = wpabuf_alloc_copy(buf, len);
 
1520
                if (wpa_s->pending_eapol_rx) {
 
1521
                        os_get_time(&wpa_s->pending_eapol_rx_time);
 
1522
                        os_memcpy(wpa_s->pending_eapol_rx_src, src_addr,
 
1523
                                  ETH_ALEN);
 
1524
                }
 
1525
                return;
 
1526
        }
 
1527
 
1497
1528
        if (wpa_s->key_mgmt == WPA_KEY_MGMT_NONE) {
1498
1529
                wpa_printf(MSG_DEBUG, "Ignored received EAPOL frame since "
1499
1530
                           "no key management is configured");
1915
1946
        if (wpa_s == NULL)
1916
1947
                return NULL;
1917
1948
 
 
1949
        wpa_s->global = global;
 
1950
 
1918
1951
        if (wpa_supplicant_init_iface(wpa_s, iface) ||
1919
1952
            wpa_supplicant_init_iface2(wpa_s)) {
1920
1953
                wpa_printf(MSG_DEBUG, "Failed to add interface %s",
1924
1957
                return NULL;
1925
1958
        }
1926
1959
 
1927
 
        wpa_s->global = global;
1928
 
 
1929
1960
        /* Register the interface with the dbus control interface */
1930
1961
        if (wpas_dbus_register_iface(wpa_s)) {
1931
1962
                wpa_supplicant_deinit_iface(wpa_s);
1932
1963
                os_free(wpa_s);
1933
1964
                return NULL;
1934
1965
        }
1935
 
                
 
1966
 
1936
1967
        wpa_s->next = global->ifaces;
1937
1968
        global->ifaces = wpa_s;
1938
1969
 
2016
2047
                return NULL;
2017
2048
 
2018
2049
        wpa_debug_open_file(params->wpa_debug_file_path);
 
2050
        if (params->wpa_debug_syslog)
 
2051
                wpa_debug_open_syslog();
2019
2052
 
2020
2053
        ret = eap_peer_register_methods();
2021
2054
        if (ret) {
2166
2199
        os_free(global->params.ctrl_interface);
2167
2200
 
2168
2201
        os_free(global);
 
2202
        wpa_debug_close_syslog();
2169
2203
        wpa_debug_close_file();
2170
2204
}