3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-21 11:52:34 +01:00

eap-tls-common: Add method completion flag

This flag prevents methods from restarting
This commit is contained in:
Tim Kourt 2018-11-29 14:41:36 -08:00 committed by Denis Kenzior
parent c35c91ad20
commit c2d3a84e3a
2 changed files with 22 additions and 0 deletions

View File

@ -94,6 +94,8 @@ struct eap_tls_state {
struct l_tls *tunnel;
bool method_completed:1;
struct databuf *plain_buf;
struct databuf *tx_pdu_buf;
struct databuf *rx_pdu_buf;
@ -114,6 +116,7 @@ struct eap_tls_state {
static void __eap_tls_common_state_reset(struct eap_tls_state *eap_tls)
{
eap_tls->version_negotiated = EAP_TLS_VERSION_NOT_NEGOTIATED;
eap_tls->method_completed = false;
eap_tls->expecting_frag_ack = false;
if (eap_tls->tunnel) {
@ -198,6 +201,13 @@ static void eap_tls_tunnel_ready(const char *peer_identity, void *user_data)
static void eap_tls_tunnel_disconnected(enum l_tls_alert_desc reason,
bool remote, void *user_data)
{
struct eap_state *eap = user_data;
struct eap_tls_state *eap_tls = eap_get_data(eap);
l_info("%s: Tunnel has disconnected with alert: %s",
eap_get_method_name(eap), l_tls_alert_to_str(reason));
eap_tls->method_completed = true;
}
static bool eap_tls_validate_version(struct eap_state *eap,
@ -481,6 +491,9 @@ void eap_tls_common_handle_request(struct eap_state *eap,
struct eap_tls_state *eap_tls = eap_get_data(eap);
uint8_t flags_version;
if (eap_tls->method_completed)
return;
if (len < 1) {
l_error("%s: Request packet is too short.",
eap_get_method_name(eap));
@ -714,3 +727,10 @@ bool eap_tls_common_settings_load(struct eap_state *eap,
return true;
}
void eap_tls_common_set_completed(struct eap_state *eap)
{
struct eap_tls_state *eap_tls = eap_get_data(eap);
eap_tls->method_completed = true;
}

View File

@ -51,6 +51,8 @@ struct eap_tls_variant_ops {
void eap_tls_common_state_free(struct eap_state *eap);
void eap_tls_common_set_completed(struct eap_state *eap);
void eap_tls_common_handle_request(struct eap_state *eap,
const uint8_t *pkt, size_t len);