AP MLD: Mark GKeyDone completed for STAs in a helper function

This makes it easier to extend the design for MLO group rekeying.

Signed-off-by: Rameshkumar Sundaram <quic_ramess@quicinc.com>
Co-developed-by: Adil Saeed Musthafa <quic_adilm@quicinc.com>
Signed-off-by: Adil Saeed Musthafa <quic_adilm@quicinc.com>
Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
This commit is contained in:
Rameshkumar Sundaram 2024-03-28 23:46:47 +05:30 committed by Jouni Malinen
parent e5b49876a8
commit 78adbf2c08

View file

@ -103,6 +103,16 @@ static const u8 * wpa_auth_get_spa(const struct wpa_state_machine *sm)
} }
static void wpa_gkeydone_sta(struct wpa_state_machine *sm)
{
if (!sm->wpa_auth)
return;
sm->wpa_auth->group->GKeyDoneStations--;
sm->GUpdateStationKeys = false;
}
#ifdef CONFIG_IEEE80211BE #ifdef CONFIG_IEEE80211BE
void wpa_release_link_auth_ref(struct wpa_state_machine *sm, void wpa_release_link_auth_ref(struct wpa_state_machine *sm,
@ -894,10 +904,8 @@ static void wpa_free_sta_sm(struct wpa_state_machine *sm)
bitfield_clear(sm->wpa_auth->ip_pool, sm->ip_addr_bit); bitfield_clear(sm->wpa_auth->ip_pool, sm->ip_addr_bit);
} }
#endif /* CONFIG_P2P */ #endif /* CONFIG_P2P */
if (sm->GUpdateStationKeys) { if (sm->GUpdateStationKeys)
sm->group->GKeyDoneStations--; wpa_gkeydone_sta(sm);
sm->GUpdateStationKeys = false;
}
#ifdef CONFIG_IEEE80211R_AP #ifdef CONFIG_IEEE80211R_AP
os_free(sm->assoc_resp_ftie); os_free(sm->assoc_resp_ftie);
wpabuf_free(sm->ft_pending_req_ies); wpabuf_free(sm->ft_pending_req_ies);
@ -2234,8 +2242,7 @@ int wpa_auth_sm_event(struct wpa_state_machine *sm, enum wpa_event event)
* Reauthentication cancels the pending group key * Reauthentication cancels the pending group key
* update for this STA. * update for this STA.
*/ */
sm->group->GKeyDoneStations--; wpa_gkeydone_sta(sm);
sm->GUpdateStationKeys = false;
sm->PtkGroupInit = true; sm->PtkGroupInit = true;
} }
sm->ReAuthenticationRequest = true; sm->ReAuthenticationRequest = true;
@ -2311,8 +2318,7 @@ SM_STATE(WPA_PTK, INITIALIZE)
sm->keycount = 0; sm->keycount = 0;
if (sm->GUpdateStationKeys) if (sm->GUpdateStationKeys)
sm->group->GKeyDoneStations--; wpa_gkeydone_sta(sm);
sm->GUpdateStationKeys = false;
if (sm->wpa == WPA_VERSION_WPA) if (sm->wpa == WPA_VERSION_WPA)
sm->PInitAKeys = false; sm->PInitAKeys = false;
if (1 /* Unicast cipher supported AND (ESS OR ((IBSS or WDS) and if (1 /* Unicast cipher supported AND (ESS OR ((IBSS or WDS) and
@ -5143,8 +5149,7 @@ SM_STATE(WPA_PTK_GROUP, REKEYESTABLISHED)
#endif /* CONFIG_OCV */ #endif /* CONFIG_OCV */
if (sm->GUpdateStationKeys) if (sm->GUpdateStationKeys)
sm->group->GKeyDoneStations--; wpa_gkeydone_sta(sm);
sm->GUpdateStationKeys = false;
sm->GTimeoutCtr = 0; sm->GTimeoutCtr = 0;
/* FIX: MLME.SetProtection.Request(TA, Tx_Rx) */ /* FIX: MLME.SetProtection.Request(TA, Tx_Rx) */
wpa_auth_vlogger(wpa_auth, wpa_auth_get_spa(sm), LOGGER_INFO, wpa_auth_vlogger(wpa_auth, wpa_auth_get_spa(sm), LOGGER_INFO,
@ -5158,8 +5163,7 @@ SM_STATE(WPA_PTK_GROUP, KEYERROR)
{ {
SM_ENTRY_MA(WPA_PTK_GROUP, KEYERROR, wpa_ptk_group); SM_ENTRY_MA(WPA_PTK_GROUP, KEYERROR, wpa_ptk_group);
if (sm->GUpdateStationKeys) if (sm->GUpdateStationKeys)
sm->group->GKeyDoneStations--; wpa_gkeydone_sta(sm);
sm->GUpdateStationKeys = false;
sm->Disconnect = true; sm->Disconnect = true;
sm->disconnect_reason = WLAN_REASON_GROUP_KEY_UPDATE_TIMEOUT; sm->disconnect_reason = WLAN_REASON_GROUP_KEY_UPDATE_TIMEOUT;
wpa_auth_vlogger(sm->wpa_auth, wpa_auth_get_spa(sm), LOGGER_INFO, wpa_auth_vlogger(sm->wpa_auth, wpa_auth_get_spa(sm), LOGGER_INFO,