]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Fix WPA state machine initialization on WPA_REAUTH if needed
authorJouni Malinen <jouni.malinen@atheros.com>
Fri, 23 Apr 2010 13:49:50 +0000 (16:49 +0300)
committerJouni Malinen <j@w1.fi>
Fri, 23 Apr 2010 13:49:50 +0000 (16:49 +0300)
When using WPS, we may end up here if the STA manages to re-associate
without the previous STA entry getting removed. Consequently, we need to
make sure that the WPA state machines gets initialized properly at this
point.

src/ap/wpa_auth.c

index 3784afdfb6cb24145973d2c540e4c80f52b60ad6..36cb0f4783c34dcf4f0965bdd923818deb222ea2 100644 (file)
@@ -1274,6 +1274,24 @@ int wpa_auth_sm_event(struct wpa_state_machine *sm, wpa_event event)
                break;
        case WPA_REAUTH:
        case WPA_REAUTH_EAPOL:
+               if (!sm->started) {
+                       /*
+                        * When using WPS, we may end up here if the STA
+                        * manages to re-associate without the previous STA
+                        * entry getting removed. Consequently, we need to make
+                        * sure that the WPA state machines gets initialized
+                        * properly at this point.
+                        */
+                       wpa_printf(MSG_DEBUG, "WPA state machine had not been "
+                                  "started - initialize now");
+                       sm->started = 1;
+                       sm->Init = TRUE;
+                       if (wpa_sm_step(sm) == 1)
+                               return 1; /* should not really happen */
+                       sm->Init = FALSE;
+                       sm->AuthenticationRequest = TRUE;
+                       break;
+               }
                if (sm->GUpdateStationKeys) {
                        /*
                         * Reauthentication cancels the pending group key