wpa_supplicant: try install gtk before send 2 of 2

This commit is contained in:
muhaidong 2022-09-05 21:28:19 +08:00
parent 25c968ec65
commit 5b24356ab5

View File

@ -1587,20 +1587,7 @@ static void wpa_supplicant_process_1_of_2(struct wpa_sm *sm,
wpa_sm_set_seq(sm, key, 0); wpa_sm_set_seq(sm, key, 0);
sm->key_info=key_info; sm->key_info=key_info;
if (wpa_supplicant_send_2_of_2(sm, key, ver, key_info)) /*install gtk before send 2 of 2*/
goto failed;
return;
failed:
wpa_sm_deauthenticate(sm, WLAN_REASON_UNSPECIFIED);
}
static int wpa_supplicant_send_2_of_2_txcallback(struct wpa_sm *sm)
{
u16 key_info=sm->key_info;
u16 rekey= (WPA_SM_STATE(sm) == WPA_COMPLETED);
if((sm->gd).gtk_len) { if((sm->gd).gtk_len) {
if (wpa_supplicant_install_gtk(sm, &(sm->gd))) if (wpa_supplicant_install_gtk(sm, &(sm->gd)))
goto failed; goto failed;
@ -1608,7 +1595,10 @@ static int wpa_supplicant_send_2_of_2_txcallback(struct wpa_sm *sm)
goto failed; goto failed;
} }
if (rekey) { if (wpa_supplicant_send_2_of_2(sm, key, ver, key_info))
goto failed;
if ((WPA_SM_STATE(sm) == WPA_COMPLETED)) {
#ifdef MSG_PRINT #ifdef MSG_PRINT
wpa_printf(MSG_DEBUG, "WPA: Group rekeying " wpa_printf(MSG_DEBUG, "WPA: Group rekeying "
"completed with " MACSTR " [GTK=%s]", "completed with " MACSTR " [GTK=%s]",
@ -1616,13 +1606,15 @@ static int wpa_supplicant_send_2_of_2_txcallback(struct wpa_sm *sm)
#endif #endif
wpa_sm_cancel_auth_timeout(sm); wpa_sm_cancel_auth_timeout(sm);
wpa_sm_set_state(WPA_COMPLETED); wpa_sm_set_state(WPA_COMPLETED);
} else } else {
wpa_supplicant_key_neg_complete(sm, sm->bssid, wpa_supplicant_key_neg_complete(sm, sm->bssid,
key_info &WPA_KEY_INFO_SECURE); sm->key_info &WPA_KEY_INFO_SECURE);
return 0; }
return;
failed: failed:
return WLAN_REASON_UNSPECIFIED; wpa_sm_deauthenticate(sm, WLAN_REASON_UNSPECIFIED);
} }
static int wpa_supplicant_verify_eapol_key_mic(struct wpa_sm *sm, static int wpa_supplicant_verify_eapol_key_mic(struct wpa_sm *sm,
@ -2526,7 +2518,6 @@ void eapol_txcb(void *eb)
case WPA_GROUP_HANDSHAKE: case WPA_GROUP_HANDSHAKE:
if (sm->txcb_flags & WPA_GROUP_HANDSHAKE_BIT) { if (sm->txcb_flags & WPA_GROUP_HANDSHAKE_BIT) {
sm->txcb_flags &= ~WPA_GROUP_HANDSHAKE_BIT; sm->txcb_flags &= ~WPA_GROUP_HANDSHAKE_BIT;
isdeauth = wpa_supplicant_send_2_of_2_txcallback(sm);
} else { } else {
wpa_printf(MSG_DEBUG, "2/2 txcb, flags=%d\n", sm->txcb_flags); wpa_printf(MSG_DEBUG, "2/2 txcb, flags=%d\n", sm->txcb_flags);
} }