eap: Introduce state reset

This is meant to reset the EAP state back to its original state without
affecting any state variables obtained through load_settings.  This can
be useful for EAP Reauthentication triggered by the AP.
This commit is contained in:
Denis Kenzior 2018-05-30 14:52:22 -05:00
parent 16a2fb2664
commit 5894051d6c
2 changed files with 18 additions and 0 deletions

View File

@ -93,6 +93,20 @@ void eap_set_event_func(struct eap_state *eap, eap_event_func_t func)
eap->event_func = func;
}
bool eap_reset(struct eap_state *eap)
{
if (eap->method_state && eap->method->reset_state) {
if (!eap->method->reset_state(eap))
return false;
}
eap->method_success = false;
l_timeout_remove(eap->complete_timeout);
eap->complete_timeout = NULL;
return true;
}
void eap_free(struct eap_state *eap)
{
if (eap->method_state && eap->method->free)

View File

@ -70,6 +70,7 @@ int eap_check_settings(struct l_settings *settings, struct l_queue *secrets,
struct l_queue **out_missing);
bool eap_load_settings(struct eap_state *eap, struct l_settings *settings,
const char *prefix);
bool eap_reset(struct eap_state *eap);
void eap_set_key_material_func(struct eap_state *eap,
eap_key_material_func_t func);
@ -130,6 +131,9 @@ struct eap_method {
bool (*load_settings)(struct eap_state *eap,
struct l_settings *settings,
const char *prefix);
/* Reset the internal state back to initial conditions */
bool (*reset_state)(struct eap_state *eap);
void (*free)(struct eap_state *eap);
void (*handle_request)(struct eap_state *eap,