RFC: Patch allowing associate immediately following unassociate in SME mode.

Blaise Gassend blaise
Mon Oct 25 13:19:42 PDT 2010


Hi,

When I try to do a wpa_supplicant_disassociate immediately followed by
a wpa_supplicant_associate, I get a lot of association failures due to
disassociation or disauthentication messges for the previous
association killing the new association. The following patch appears
to fix the problem by ignoring events that do not relate to the
association that is currently in progres (at least for non-encrypted
connections). However, it prevents wpa_supplicant_event_disassoc from
being called, which could lead to problems that I am not anticipating
at the bottom of the EVENT_DEAUTH case. Anybody know what kind of
trouble I might be running into by preventing the cleanup that would
take place in wpa_supplicant_event_disassoc from happening?

Thanks,
Blaise

Note: This is against a modified 0.7.2 tree, so it might not be
entirely up to date. This fix isn't in there yet.

Index: wpa_supplicant/wpa_supplicant/events.c
===================================================================
--- wpa_supplicant/wpa_supplicant/events.c      (revision 33141)
+++ wpa_supplicant/wpa_supplicant/events.c      (working copy)
@@ -1598,6 +1601,7 @@
 {
        struct wpa_supplicant *wpa_s = ctx;
        u16 reason_code = 0;
+        struct u8 *event_bssid;

        switch (event) {
        case EVENT_AUTH:
@@ -1615,17 +1619,23 @@
                        break;
                }
 #endif /* CONFIG_AP */
-               if (data)
-                       reason_code = data->deauth_info.reason_code;
+               if (data) {
+                  reason_code = data->disassoc_info.reason_code;
+                  event_bssid = data->disassoc_info.addr;
+                }
                if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME)
                        sme_event_disassoc(wpa_s, data);
                /* fall through */
        case EVENT_DEAUTH:
                if (event == EVENT_DEAUTH) {
                        wpa_printf(MSG_DEBUG, "Deauthentication notification");
-                       if (data)
+                       if (data) {
                                reason_code = data->deauth_info.reason_code;
+                                event_bssid = data->deauth_info.addr;
+                        }
                }
+                if (wpa_s->current_bss && event_bssid &&
os_memcmp(wpa_s->current
_bss->bssid, event_bssid, ETH_ALEN))
+                  break; // A new association is in progress. This
event refers t
o an old association.
 #ifdef CONFIG_AP
                if (wpa_s->ap_iface && data) {
                        hostapd_notif_disassoc(wpa_s->ap_iface->bss[0],



More information about the Hostap mailing list