WPS: Reschedule AP configuration reload on EAP completion
authorJouni Malinen <jouni@qca.qualcomm.com>
Fri, 29 Nov 2013 14:52:44 +0000 (16:52 +0200)
committerJouni Malinen <j@w1.fi>
Thu, 26 Dec 2013 18:50:28 +0000 (20:50 +0200)
Reduce race condition of the station trying to reconnect immediately
after AP reconfiguration through WPS by rescheduling the reload
timeout to happen after EAP completion rather than the originally
scheduled 100 ms after new configuration became known.

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

src/ap/ieee802_1x.c
src/ap/wps_hostapd.c
src/ap/wps_hostapd.h

index 2ce2ed9..98bd104 100644 (file)
@@ -29,6 +29,7 @@
 #include "pmksa_cache_auth.h"
 #include "ap_config.h"
 #include "ap_drv_ops.h"
+#include "wps_hostapd.h"
 #include "ieee802_1x.h"
 
 
@@ -2128,5 +2129,6 @@ static void ieee802_1x_finished(struct hostapd_data *hapd,
                os_sleep(0, 10000);
                ap_sta_disconnect(hapd, sta, sta->addr,
                                  WLAN_REASON_IEEE_802_1X_AUTH_FAILED);
+               hostapd_wps_eap_completed(hapd);
        }
 }
index 294a39d..dd97b12 100644 (file)
@@ -287,6 +287,19 @@ static void wps_reload_config(void *eloop_data, void *user_ctx)
 }
 
 
+void hostapd_wps_eap_completed(struct hostapd_data *hapd)
+{
+       /*
+        * Reduce race condition of the station trying to reconnect immediately
+        * after AP reconfiguration through WPS by rescheduling the reload
+        * timeout to happen after EAP completion rather than the originally
+        * scheduled 100 ms after new configuration became known.
+        */
+       if (eloop_deplete_timeout(0, 0, wps_reload_config, hapd->iface, NULL))
+               wpa_printf(MSG_DEBUG, "WPS: Reschedule immediate configuration reload");
+}
+
+
 static void hapd_new_ap_event(struct hostapd_data *hapd, const u8 *attr,
                              size_t attr_len)
 {
index a2c2cf0..a292598 100644 (file)
@@ -16,6 +16,7 @@ int hostapd_init_wps(struct hostapd_data *hapd,
 int hostapd_init_wps_complete(struct hostapd_data *hapd);
 void hostapd_deinit_wps(struct hostapd_data *hapd);
 void hostapd_update_wps(struct hostapd_data *hapd);
+void hostapd_wps_eap_completed(struct hostapd_data *hapd);
 int hostapd_wps_add_pin(struct hostapd_data *hapd, const u8 *addr,
                        const char *uuid, const char *pin, int timeout);
 int hostapd_wps_button_pushed(struct hostapd_data *hapd,
@@ -61,6 +62,10 @@ static inline void hostapd_update_wps(struct hostapd_data *hapd)
 {
 }
 
+static inline void hostapd_wps_eap_completed(struct hostapd_data *hapd)
+{
+}
+
 static inline int hostapd_wps_get_mib_sta(struct hostapd_data *hapd,
                                          const u8 *addr,
                                          char *buf, size_t buflen)