From a803ba4f9d41d72650f04ae9f43df5ffa2d9a5dc Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Wed, 29 Apr 2020 13:00:53 +0300 Subject: [PATCH] Use more specific reason codes for 4-way handshake timeouts IEEE 802.11 defines reason codes for indicating 4-way handshake and group key handshake timeouts. Use those reason codes instead of the more generic one for these particular cases in the Authenticator state machine. Signed-off-by: Jouni Malinen --- src/ap/wpa_auth.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ap/wpa_auth.c b/src/ap/wpa_auth.c index 4881357f5..30e725864 100644 --- a/src/ap/wpa_auth.c +++ b/src/ap/wpa_auth.c @@ -3655,6 +3655,8 @@ SM_STEP(WPA_PTK) wpa_auth_vlogger(wpa_auth, sm->addr, LOGGER_DEBUG, "PTKSTART: Retry limit %u reached", conf->wpa_pairwise_update_count); + sm->disconnect_reason = + WLAN_REASON_4WAY_HANDSHAKE_TIMEOUT; SM_ENTER(WPA_PTK, DISCONNECT); } else if (sm->TimeoutEvt) SM_ENTER(WPA_PTK, PTKSTART); @@ -3685,6 +3687,8 @@ SM_STEP(WPA_PTK) wpa_auth_vlogger(wpa_auth, sm->addr, LOGGER_DEBUG, "PTKINITNEGOTIATING: Retry limit %u reached", conf->wpa_pairwise_update_count); + sm->disconnect_reason = + WLAN_REASON_4WAY_HANDSHAKE_TIMEOUT; SM_ENTER(WPA_PTK, DISCONNECT); } else if (sm->TimeoutEvt) SM_ENTER(WPA_PTK, PTKINITNEGOTIATING); @@ -3867,6 +3871,7 @@ SM_STATE(WPA_PTK_GROUP, KEYERROR) sm->group->GKeyDoneStations--; sm->GUpdateStationKeys = false; sm->Disconnect = true; + sm->disconnect_reason = WLAN_REASON_GROUP_KEY_UPDATE_TIMEOUT; wpa_auth_vlogger(sm->wpa_auth, sm->addr, LOGGER_INFO, "group key handshake failed (%s) after %u tries", sm->wpa == WPA_VERSION_WPA ? "WPA" : "RSN",