]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
wpa_auth: Deplete group rekey eloop handler for strict rekeying
authorJohannes Berg <johannes.berg@intel.com>
Wed, 25 Oct 2017 08:06:10 +0000 (10:06 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 29 Oct 2017 15:04:14 +0000 (17:04 +0200)
When strict group rekeying is in effect, every station that leaves will
cause a rekeying to happen 0.5 s after leaving. However, if a lot of
stations join/leave, the previous code could postpone this rekeying
forever, since it always re-registers the handling with a 0.5 s timeout.

Use eloop_deplete_timeout() to address that, only registering the
timeout from scratch if it wasn't pending.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
src/ap/wpa_auth.c

index b0a36e42d3f6e79bd422a5e6f592fc3dd5b00cab..fdebd80c828ab4d6e56986455f2009cffc461b32 100644 (file)
@@ -698,9 +698,10 @@ void wpa_auth_sta_deinit(struct wpa_state_machine *sm)
                wpa_auth_logger(sm->wpa_auth, sm->addr, LOGGER_DEBUG,
                                "strict rekeying - force GTK rekey since STA "
                                "is leaving");
-               eloop_cancel_timeout(wpa_rekey_gtk, sm->wpa_auth, NULL);
-               eloop_register_timeout(0, 500000, wpa_rekey_gtk, sm->wpa_auth,
-                                      NULL);
+               if (eloop_deplete_timeout(0, 500000, wpa_rekey_gtk,
+                                         sm->wpa_auth, NULL) == -1)
+                       eloop_register_timeout(0, 500000, wpa_rekey_gtk, sm->wpa_auth,
+                                              NULL);
        }
 
        eloop_cancel_timeout(wpa_send_eapol_timeout, sm->wpa_auth, sm);