eap_proxy: Add support for SIM state change indication from eap_proxy
This registers a new callback to indicate change in SIM state. This helps to do some clean up (more specifically pmksa_flush) based on the state change of the SIM. Without this, the reconnection using the cached PMKSA could happen though the SIM is changed. Currently eap_proxy_sim_state corresponds to only SIM_STATE_ERROR. This can be further extended. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
parent
79a54ab9f6
commit
a6f3761f7d
5 changed files with 56 additions and 0 deletions
|
@ -376,4 +376,8 @@ enum beacon_rate_type {
|
||||||
BEACON_RATE_VHT
|
BEACON_RATE_VHT
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum eap_proxy_sim_state {
|
||||||
|
SIM_STATE_ERROR,
|
||||||
|
};
|
||||||
|
|
||||||
#endif /* DEFS_H */
|
#endif /* DEFS_H */
|
||||||
|
|
|
@ -252,6 +252,14 @@ struct eapol_callbacks {
|
||||||
* @ctx: eapol_ctx from eap_peer_sm_init() call
|
* @ctx: eapol_ctx from eap_peer_sm_init() call
|
||||||
*/
|
*/
|
||||||
void (*eap_proxy_cb)(void *ctx);
|
void (*eap_proxy_cb)(void *ctx);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* eap_proxy_notify_sim_status - Notification of SIM status change
|
||||||
|
* @ctx: eapol_ctx from eap_peer_sm_init() call
|
||||||
|
* @sim_state: One of enum value from sim_state
|
||||||
|
*/
|
||||||
|
void (*eap_proxy_notify_sim_status)(void *ctx,
|
||||||
|
enum eap_proxy_sim_state sim_state);
|
||||||
#endif /* CONFIG_EAP_PROXY */
|
#endif /* CONFIG_EAP_PROXY */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1999,6 +1999,7 @@ static void eapol_sm_notify_status(void *ctx, const char *status,
|
||||||
|
|
||||||
|
|
||||||
#ifdef CONFIG_EAP_PROXY
|
#ifdef CONFIG_EAP_PROXY
|
||||||
|
|
||||||
static void eapol_sm_eap_proxy_cb(void *ctx)
|
static void eapol_sm_eap_proxy_cb(void *ctx)
|
||||||
{
|
{
|
||||||
struct eapol_sm *sm = ctx;
|
struct eapol_sm *sm = ctx;
|
||||||
|
@ -2006,6 +2007,18 @@ static void eapol_sm_eap_proxy_cb(void *ctx)
|
||||||
if (sm->ctx->eap_proxy_cb)
|
if (sm->ctx->eap_proxy_cb)
|
||||||
sm->ctx->eap_proxy_cb(sm->ctx->ctx);
|
sm->ctx->eap_proxy_cb(sm->ctx->ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
eapol_sm_eap_proxy_notify_sim_status(void *ctx,
|
||||||
|
enum eap_proxy_sim_state sim_state)
|
||||||
|
{
|
||||||
|
struct eapol_sm *sm = ctx;
|
||||||
|
|
||||||
|
if (sm->ctx->eap_proxy_notify_sim_status)
|
||||||
|
sm->ctx->eap_proxy_notify_sim_status(sm->ctx->ctx, sim_state);
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_EAP_PROXY */
|
#endif /* CONFIG_EAP_PROXY */
|
||||||
|
|
||||||
|
|
||||||
|
@ -2034,6 +2047,7 @@ static const struct eapol_callbacks eapol_cb =
|
||||||
eapol_sm_notify_status,
|
eapol_sm_notify_status,
|
||||||
#ifdef CONFIG_EAP_PROXY
|
#ifdef CONFIG_EAP_PROXY
|
||||||
eapol_sm_eap_proxy_cb,
|
eapol_sm_eap_proxy_cb,
|
||||||
|
eapol_sm_eap_proxy_notify_sim_status,
|
||||||
#endif /* CONFIG_EAP_PROXY */
|
#endif /* CONFIG_EAP_PROXY */
|
||||||
eapol_sm_set_anon_id
|
eapol_sm_set_anon_id
|
||||||
};
|
};
|
||||||
|
|
|
@ -277,6 +277,14 @@ struct eapol_ctx {
|
||||||
* @ctx: eapol_ctx from eap_peer_sm_init() call
|
* @ctx: eapol_ctx from eap_peer_sm_init() call
|
||||||
*/
|
*/
|
||||||
void (*eap_proxy_cb)(void *ctx);
|
void (*eap_proxy_cb)(void *ctx);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* eap_proxy_notify_sim_status - Notification of SIM status change
|
||||||
|
* @ctx: eapol_ctx from eap_peer_sm_init() call
|
||||||
|
* @status: One of enum value from sim_state
|
||||||
|
*/
|
||||||
|
void (*eap_proxy_notify_sim_status)(void *ctx,
|
||||||
|
enum eap_proxy_sim_state sim_state);
|
||||||
#endif /* CONFIG_EAP_PROXY */
|
#endif /* CONFIG_EAP_PROXY */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -893,6 +893,7 @@ static void wpa_supplicant_eap_param_needed(void *ctx,
|
||||||
|
|
||||||
|
|
||||||
#ifdef CONFIG_EAP_PROXY
|
#ifdef CONFIG_EAP_PROXY
|
||||||
|
|
||||||
static void wpa_supplicant_eap_proxy_cb(void *ctx)
|
static void wpa_supplicant_eap_proxy_cb(void *ctx)
|
||||||
{
|
{
|
||||||
struct wpa_supplicant *wpa_s = ctx;
|
struct wpa_supplicant *wpa_s = ctx;
|
||||||
|
@ -908,6 +909,25 @@ static void wpa_supplicant_eap_proxy_cb(void *ctx)
|
||||||
wpa_printf(MSG_DEBUG, "eap_proxy: IMSI not available");
|
wpa_printf(MSG_DEBUG, "eap_proxy: IMSI not available");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
wpa_supplicant_eap_proxy_notify_sim_status(void *ctx,
|
||||||
|
enum eap_proxy_sim_state sim_state)
|
||||||
|
{
|
||||||
|
struct wpa_supplicant *wpa_s = ctx;
|
||||||
|
|
||||||
|
wpa_printf(MSG_DEBUG, "eap_proxy: SIM card status %u", sim_state);
|
||||||
|
switch (sim_state) {
|
||||||
|
case SIM_STATE_ERROR:
|
||||||
|
wpa_sm_pmksa_cache_flush(wpa_s->wpa, NULL);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
wpa_printf(MSG_DEBUG, "eap_proxy: SIM card status unknown");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_EAP_PROXY */
|
#endif /* CONFIG_EAP_PROXY */
|
||||||
|
|
||||||
|
|
||||||
|
@ -1018,6 +1038,8 @@ int wpa_supplicant_init_eapol(struct wpa_supplicant *wpa_s)
|
||||||
ctx->eap_param_needed = wpa_supplicant_eap_param_needed;
|
ctx->eap_param_needed = wpa_supplicant_eap_param_needed;
|
||||||
#ifdef CONFIG_EAP_PROXY
|
#ifdef CONFIG_EAP_PROXY
|
||||||
ctx->eap_proxy_cb = wpa_supplicant_eap_proxy_cb;
|
ctx->eap_proxy_cb = wpa_supplicant_eap_proxy_cb;
|
||||||
|
ctx->eap_proxy_notify_sim_status =
|
||||||
|
wpa_supplicant_eap_proxy_notify_sim_status;
|
||||||
#endif /* CONFIG_EAP_PROXY */
|
#endif /* CONFIG_EAP_PROXY */
|
||||||
ctx->port_cb = wpa_supplicant_port_cb;
|
ctx->port_cb = wpa_supplicant_port_cb;
|
||||||
ctx->cb = wpa_supplicant_eapol_cb;
|
ctx->cb = wpa_supplicant_eapol_cb;
|
||||||
|
|
Loading…
Reference in a new issue