Convert STA session_timeout to os_reltime
This is needed to allow the remaining session time to be computed for FT (when sending PMK-R1 to another AP). Signed-off-by: Michael Braun <michael-dev@fami-braun.de>
This commit is contained in:
parent
d269740a3e
commit
13f118dc59
3 changed files with 34 additions and 12 deletions
|
@ -1472,15 +1472,24 @@ prepare_auth_resp_fils(struct hostapd_data *hapd,
|
||||||
if (sta->fils_erp_pmkid_set) {
|
if (sta->fils_erp_pmkid_set) {
|
||||||
/* TODO: get PMKLifetime from WPA parameters */
|
/* TODO: get PMKLifetime from WPA parameters */
|
||||||
unsigned int dot11RSNAConfigPMKLifetime = 43200;
|
unsigned int dot11RSNAConfigPMKLifetime = 43200;
|
||||||
|
int session_timeout;
|
||||||
|
|
||||||
|
session_timeout = dot11RSNAConfigPMKLifetime;
|
||||||
|
if (sta->session_timeout_set) {
|
||||||
|
struct os_reltime now, diff;
|
||||||
|
|
||||||
|
os_get_reltime(&now);
|
||||||
|
os_reltime_sub(&sta->session_timeout, &now,
|
||||||
|
&diff);
|
||||||
|
session_timeout = diff.sec;
|
||||||
|
}
|
||||||
|
|
||||||
sta->fils_erp_pmkid_set = 0;
|
sta->fils_erp_pmkid_set = 0;
|
||||||
if (wpa_auth_pmksa_add2(
|
if (wpa_auth_pmksa_add2(
|
||||||
hapd->wpa_auth, sta->addr,
|
hapd->wpa_auth, sta->addr,
|
||||||
pmk, pmk_len,
|
pmk, pmk_len,
|
||||||
sta->fils_erp_pmkid,
|
sta->fils_erp_pmkid,
|
||||||
sta->session_timeout_set ?
|
session_timeout,
|
||||||
sta->session_timeout :
|
|
||||||
dot11RSNAConfigPMKLifetime,
|
|
||||||
wpa_auth_sta_key_mgmt(sta->wpa_sm)) < 0) {
|
wpa_auth_sta_key_mgmt(sta->wpa_sm)) < 0) {
|
||||||
wpa_printf(MSG_ERROR,
|
wpa_printf(MSG_ERROR,
|
||||||
"FILS: Failed to add PMKSA cache entry based on ERP");
|
"FILS: Failed to add PMKSA cache entry based on ERP");
|
||||||
|
@ -1658,10 +1667,15 @@ ieee802_11_set_radius_info(struct hostapd_data *hapd, struct sta_info *sta,
|
||||||
|
|
||||||
if (hapd->conf->acct_interim_interval == 0 && acct_interim_interval)
|
if (hapd->conf->acct_interim_interval == 0 && acct_interim_interval)
|
||||||
sta->acct_interim_interval = acct_interim_interval;
|
sta->acct_interim_interval = acct_interim_interval;
|
||||||
if (res == HOSTAPD_ACL_ACCEPT_TIMEOUT)
|
if (res == HOSTAPD_ACL_ACCEPT_TIMEOUT) {
|
||||||
|
sta->session_timeout_set = 1;
|
||||||
|
os_get_reltime(&sta->session_timeout);
|
||||||
|
sta->session_timeout.sec += session_timeout;
|
||||||
ap_sta_session_timeout(hapd, sta, session_timeout);
|
ap_sta_session_timeout(hapd, sta, session_timeout);
|
||||||
else
|
} else {
|
||||||
|
sta->session_timeout_set = 0;
|
||||||
ap_sta_no_session_timeout(hapd, sta);
|
ap_sta_no_session_timeout(hapd, sta);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1817,14 +1817,17 @@ ieee802_1x_receive_auth(struct radius_msg *msg, struct radius_msg *req,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
sta->session_timeout_set = !!session_timeout_set;
|
sta->session_timeout_set = !!session_timeout_set;
|
||||||
sta->session_timeout = session_timeout;
|
os_get_reltime(&sta->session_timeout);
|
||||||
|
sta->session_timeout.sec += session_timeout;
|
||||||
|
|
||||||
/* RFC 3580, Ch. 3.17 */
|
/* RFC 3580, Ch. 3.17 */
|
||||||
if (session_timeout_set && termination_action ==
|
if (session_timeout_set && termination_action ==
|
||||||
RADIUS_TERMINATION_ACTION_RADIUS_REQUEST) {
|
RADIUS_TERMINATION_ACTION_RADIUS_REQUEST)
|
||||||
sm->reAuthPeriod = session_timeout;
|
sm->reAuthPeriod = session_timeout;
|
||||||
} else if (session_timeout_set)
|
else if (session_timeout_set)
|
||||||
ap_sta_session_timeout(hapd, sta, session_timeout);
|
ap_sta_session_timeout(hapd, sta, session_timeout);
|
||||||
|
else
|
||||||
|
ap_sta_no_session_timeout(hapd, sta);
|
||||||
|
|
||||||
sm->eap_if->aaaSuccess = TRUE;
|
sm->eap_if->aaaSuccess = TRUE;
|
||||||
override_eapReq = 1;
|
override_eapReq = 1;
|
||||||
|
@ -2714,6 +2717,7 @@ static void ieee802_1x_finished(struct hostapd_data *hapd,
|
||||||
/* TODO: get PMKLifetime from WPA parameters */
|
/* TODO: get PMKLifetime from WPA parameters */
|
||||||
static const int dot11RSNAConfigPMKLifetime = 43200;
|
static const int dot11RSNAConfigPMKLifetime = 43200;
|
||||||
unsigned int session_timeout;
|
unsigned int session_timeout;
|
||||||
|
struct os_reltime now, remaining;
|
||||||
|
|
||||||
#ifdef CONFIG_HS20
|
#ifdef CONFIG_HS20
|
||||||
if (remediation && !sta->remediation) {
|
if (remediation && !sta->remediation) {
|
||||||
|
@ -2734,10 +2738,13 @@ static void ieee802_1x_finished(struct hostapd_data *hapd,
|
||||||
#endif /* CONFIG_HS20 */
|
#endif /* CONFIG_HS20 */
|
||||||
|
|
||||||
key = ieee802_1x_get_key(sta->eapol_sm, &len);
|
key = ieee802_1x_get_key(sta->eapol_sm, &len);
|
||||||
if (sta->session_timeout_set)
|
if (sta->session_timeout_set) {
|
||||||
session_timeout = sta->session_timeout;
|
os_get_reltime(&now);
|
||||||
else
|
os_reltime_sub(&sta->session_timeout, &now, &remaining);
|
||||||
|
session_timeout = (remaining.sec > 0) ? remaining.sec : 1;
|
||||||
|
} else {
|
||||||
session_timeout = dot11RSNAConfigPMKLifetime;
|
session_timeout = dot11RSNAConfigPMKLifetime;
|
||||||
|
}
|
||||||
if (success && key && len >= PMK_LEN && !sta->remediation &&
|
if (success && key && len >= PMK_LEN && !sta->remediation &&
|
||||||
!sta->hs20_deauth_requested &&
|
!sta->hs20_deauth_requested &&
|
||||||
wpa_auth_pmksa_add(sta->wpa_sm, key, len, session_timeout,
|
wpa_auth_pmksa_add(sta->wpa_sm, key, len, session_timeout,
|
||||||
|
|
|
@ -198,7 +198,8 @@ struct sta_info {
|
||||||
unsigned int mesh_sae_pmksa_caching:1;
|
unsigned int mesh_sae_pmksa_caching:1;
|
||||||
#endif /* CONFIG_SAE */
|
#endif /* CONFIG_SAE */
|
||||||
|
|
||||||
u32 session_timeout; /* valid only if session_timeout_set == 1 */
|
/* valid only if session_timeout_set == 1 */
|
||||||
|
struct os_reltime session_timeout;
|
||||||
|
|
||||||
/* Last Authentication/(Re)Association Request/Action frame sequence
|
/* Last Authentication/(Re)Association Request/Action frame sequence
|
||||||
* control */
|
* control */
|
||||||
|
|
Loading…
Reference in a new issue