]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Use deauthentication instead of disassociation if not associated
authorJouni Malinen <jouni@qca.qualcomm.com>
Mon, 5 Nov 2012 14:55:30 +0000 (16:55 +0200)
committerJouni Malinen <j@w1.fi>
Mon, 5 Nov 2012 14:58:00 +0000 (16:58 +0200)
cfg80211/mac80211 may reject disassociation command if association has
not yet been formed. Use deauthentication in cases where it is possible
that we are associating at the moment the command is issued.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

wpa_supplicant/ctrl_iface.c
wpa_supplicant/dbus/dbus_new_handlers.c
wpa_supplicant/events.c
wpa_supplicant/wpa_supplicant.c

index a037cca4c49e190f3b58ced294217f3538f27d43..345e026dada757bb4f263fc2d5a2951afe4c1ed0 100644 (file)
@@ -2124,8 +2124,8 @@ static int wpa_supplicant_ctrl_iface_remove_network(
 #endif /* CONFIG_SME */
                        wpa_sm_set_config(wpa_s->wpa, NULL);
                        eapol_sm_notify_config(wpa_s->eapol, NULL, NULL);
-                       wpa_supplicant_disassociate(wpa_s,
-                                                   WLAN_REASON_DEAUTH_LEAVING);
+                       wpa_supplicant_deauthenticate(
+                               wpa_s, WLAN_REASON_DEAUTH_LEAVING);
                }
                return 0;
        }
@@ -2157,7 +2157,8 @@ static int wpa_supplicant_ctrl_iface_remove_network(
                wpa_sm_set_config(wpa_s->wpa, NULL);
                eapol_sm_notify_config(wpa_s->eapol, NULL, NULL);
 
-               wpa_supplicant_disassociate(wpa_s, WLAN_REASON_DEAUTH_LEAVING);
+               wpa_supplicant_deauthenticate(wpa_s,
+                                             WLAN_REASON_DEAUTH_LEAVING);
        }
 
        if (wpa_config_remove_network(wpa_s->conf, id) < 0) {
index 062024fbbe6d5feb3601f6a91c99ac4f4b232ae1..e100df24fed71bd5848da3be2b6f8021069ce946 100644 (file)
@@ -1547,7 +1547,8 @@ static void remove_network(void *arg, struct wpa_ssid *ssid)
        }
 
        if (ssid == wpa_s->current_ssid)
-               wpa_supplicant_disassociate(wpa_s, WLAN_REASON_DEAUTH_LEAVING);
+               wpa_supplicant_deauthenticate(wpa_s,
+                                             WLAN_REASON_DEAUTH_LEAVING);
 }
 
 
index 1aa9c2109c007271e53c0185d77f2c510e45eb4f..42c4deaaa48beeff7e976695de80ddc6125cbd13 100644 (file)
@@ -1609,7 +1609,7 @@ static void wpa_supplicant_event_assoc(struct wpa_supplicant *wpa_s,
 
        if (wpa_drv_get_bssid(wpa_s, bssid) < 0) {
                wpa_dbg(wpa_s, MSG_ERROR, "Failed to get BSSID");
-               wpa_supplicant_disassociate(
+               wpa_supplicant_deauthenticate(
                        wpa_s, WLAN_REASON_DEAUTH_LEAVING);
                return;
        }
@@ -1627,7 +1627,7 @@ static void wpa_supplicant_event_assoc(struct wpa_supplicant *wpa_s,
                        wpa_clear_keys(wpa_s, bssid);
                }
                if (wpa_supplicant_select_config(wpa_s) < 0) {
-                       wpa_supplicant_disassociate(
+                       wpa_supplicant_deauthenticate(
                                wpa_s, WLAN_REASON_DEAUTH_LEAVING);
                        return;
                }
index 076d31301973c8fcac9c0ad7b45305ec332aa58b..82edae20571f770203b2571b035351faa0db0650 100644 (file)
@@ -190,7 +190,7 @@ static void wpa_supplicant_timeout(void *eloop_ctx, void *timeout_ctx)
                MAC2STR(bssid));
        wpa_blacklist_add(wpa_s, bssid);
        wpa_sm_notify_disassoc(wpa_s->wpa);
-       wpa_supplicant_disassociate(wpa_s, WLAN_REASON_DEAUTH_LEAVING);
+       wpa_supplicant_deauthenticate(wpa_s, WLAN_REASON_DEAUTH_LEAVING);
        wpa_s->reassociate = 1;
 
        /*
@@ -1867,11 +1867,11 @@ void wpa_supplicant_disable_network(struct wpa_supplicant *wpa_s,
                                        wpa_s, other_ssid);
                }
                if (wpa_s->current_ssid)
-                       wpa_supplicant_disassociate(
+                       wpa_supplicant_deauthenticate(
                                wpa_s, WLAN_REASON_DEAUTH_LEAVING);
        } else if (ssid->disabled != 2) {
                if (ssid == wpa_s->current_ssid)
-                       wpa_supplicant_disassociate(
+                       wpa_supplicant_deauthenticate(
                                wpa_s, WLAN_REASON_DEAUTH_LEAVING);
 
                was_disabled = ssid->disabled;
@@ -1897,7 +1897,7 @@ void wpa_supplicant_select_network(struct wpa_supplicant *wpa_s,
        int disconnected = 0;
 
        if (ssid && ssid != wpa_s->current_ssid && wpa_s->current_ssid) {
-               wpa_supplicant_disassociate(
+               wpa_supplicant_deauthenticate(
                        wpa_s, WLAN_REASON_DEAUTH_LEAVING);
                disconnected = 1;
        }