eap-tls-common: Handle response retransmission

This commit is contained in:
Tim Kourt 2018-11-29 14:41:39 -08:00 committed by Denis Kenzior
parent 9df7785fee
commit bb98101bd4
2 changed files with 47 additions and 0 deletions

View File

@ -608,6 +608,51 @@ error:
eap_method_error(eap);
}
void eap_tls_common_handle_retransmit(struct eap_state *eap,
const uint8_t *pkt, size_t len)
{
struct eap_tls_state *eap_tls = eap_get_data(eap);
uint8_t flags_version;
if (len < 1) {
l_error("%s: Request packet is too short.",
eap_get_method_name(eap));
goto error;
}
flags_version = pkt[0];
if (!eap_tls_validate_version(eap, flags_version)) {
l_error("%s: Version negotiation has failed.",
eap_get_method_name(eap));
goto error;
}
if (flags_version & EAP_TLS_FLAG_M) {
if (!eap_tls->rx_pdu_buf)
goto error;
eap_tls_send_fragmented_request_ack(eap);
return;
}
if (!eap_tls->tx_pdu_buf || !eap_tls->tx_pdu_buf->data ||
!eap_tls->tx_pdu_buf->len)
goto error;
if (EAP_TLS_HEADER_LEN + eap_tls->tx_pdu_buf->len > eap_get_mtu(eap))
eap_tls_send_fragment(eap);
else
eap_tls_send_response(eap, eap_tls->tx_pdu_buf->data,
eap_tls->tx_pdu_buf->len);
return;
error:
eap_method_error(eap);
}
int eap_tls_common_settings_check(struct l_settings *settings,
struct l_queue *secrets,
const char *prefix,

View File

@ -56,6 +56,8 @@ void eap_tls_common_set_phase2_faild(struct eap_state *eap);
void eap_tls_common_handle_request(struct eap_state *eap,
const uint8_t *pkt, size_t len);
void eap_tls_common_handle_retransmit(struct eap_state *eap,
const uint8_t *pkt, size_t len);
int eap_tls_common_settings_check(struct l_settings *settings,
struct l_queue *secrets,