hostapd: Fix internal crypto build without TLS
[wpasupplicant] / wpa_supplicant / sme.c
index 370f96a..0d729ef 100644 (file)
@@ -15,7 +15,6 @@
 #include "includes.h"
 
 #include "common.h"
-#include "drivers/driver.h"
 #include "ieee802_11_defs.h"
 #include "eapol_supp/eapol_supp_sm.h"
 #include "wpa_common.h"
@@ -23,6 +22,7 @@
 #include "pmksa_cache.h"
 #include "config.h"
 #include "wpa_supplicant_i.h"
+#include "driver_i.h"
 #include "wpas_glue.h"
 #include "wps_supplicant.h"
 #include "sme.h"
@@ -35,6 +35,7 @@ void sme_authenticate(struct wpa_supplicant *wpa_s,
 #ifdef CONFIG_IEEE80211R
        const u8 *md = NULL;
 #endif /* CONFIG_IEEE80211R */
+       int i;
 
        if (bss == NULL) {
                wpa_printf(MSG_ERROR, "SME: No scan result available for the "
@@ -84,6 +85,13 @@ void sme_authenticate(struct wpa_supplicant *wpa_s,
                           params.auth_alg);
        }
 
+       for (i = 0; i < NUM_WEP_KEYS; i++) {
+               if (ssid->wep_key_len[i])
+                       params.wep_key[i] = ssid->wep_key[i];
+               params.wep_key_len[i] = ssid->wep_key_len[i];
+       }
+       params.wep_tx_keyidx = ssid->wep_tx_keyidx;
+
        os_memset(wpa_s->bssid, 0, ETH_ALEN);
        os_memcpy(wpa_s->pending_bssid, bss->bssid, ETH_ALEN);
 
@@ -335,3 +343,38 @@ int sme_update_ft_ies(struct wpa_supplicant *wpa_s, const u8 *md,
        wpa_s->sme.ft_ies_len = ies_len;
        return 0;
 }
+
+
+void sme_event_assoc_reject(struct wpa_supplicant *wpa_s,
+                           union wpa_event_data *data)
+{
+       wpa_printf(MSG_DEBUG, "SME: Association failed: status code %d",
+                  data->assoc_reject.status_code);
+
+       wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED);
+       os_memset(wpa_s->bssid, 0, ETH_ALEN);
+       os_memset(wpa_s->pending_bssid, 0, ETH_ALEN);
+
+       /*
+        * TODO: if more than one possible AP is available in scan results,
+        * could try the other ones before requesting a new scan.
+        */
+       wpa_supplicant_req_scan(wpa_s, 5, 0);
+}
+
+
+void sme_event_auth_timed_out(struct wpa_supplicant *wpa_s,
+                             union wpa_event_data *data)
+{
+       wpa_printf(MSG_DEBUG, "SME: Authentication timed out");
+       wpa_supplicant_req_scan(wpa_s, 5, 0);
+}
+
+
+void sme_event_assoc_timed_out(struct wpa_supplicant *wpa_s,
+                              union wpa_event_data *data)
+{
+       wpa_printf(MSG_DEBUG, "SME: Association timed out");
+       wpa_supplicant_mark_disassoc(wpa_s);
+       wpa_supplicant_req_scan(wpa_s, 5, 0);
+}