]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
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 2ce2ed994f4a936ba6d70ba7580eb2ec864797e2..98bd104ce27064c1e754f7dba8d1cc84cb4f1113 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 294a39d6fa1f17f4523640a86c6891d4b8d5d667..dd97b1240ffd9d24870656fba2fe548b50148c09 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 a2c2cf0214dc3920a2c4a7b0e2ca0bffd960f2d7..a292598be39e12a3dee71a59ec0d2cd32047bd8b 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)