From: Johannes Berg Date: Wed, 25 Oct 2017 08:06:10 +0000 (+0200) Subject: wpa_auth: Deplete group rekey eloop handler for strict rekeying X-Git-Tag: hostap_2_7~937 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3f5a1860a85bea2d335643fec57d35dcec1ef3ba;p=thirdparty%2Fhostap.git wpa_auth: Deplete group rekey eloop handler for strict rekeying 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 --- diff --git a/src/ap/wpa_auth.c b/src/ap/wpa_auth.c index b0a36e42d..fdebd80c8 100644 --- a/src/ap/wpa_auth.c +++ b/src/ap/wpa_auth.c @@ -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);