@@ -89,7 +89,7 @@ static int8_t auth_eap_tls_sec_prot_receive(sec_prot_t *prot, void *pdu, uint16_
89
89
static void auth_eap_tls_sec_prot_state_machine (sec_prot_t * prot );
90
90
91
91
static int8_t auth_eap_tls_sec_prot_message_handle (sec_prot_t * prot );
92
- static int8_t auth_eap_tls_sec_prot_message_send (sec_prot_t * prot , uint8_t eap_code , uint8_t eap_type , uint8_t tls_state );
92
+ static int8_t auth_eap_tls_sec_prot_message_send (sec_prot_t * prot , uint8_t eap_code , uint8_t eap_type , uint8_t tls_state , bool retry );
93
93
94
94
static void auth_eap_tls_sec_prot_timer_timeout (sec_prot_t * prot , uint16_t ticks );
95
95
static int8_t auth_eap_tls_sec_prot_init_tls (sec_prot_t * prot );
@@ -247,7 +247,7 @@ static int8_t auth_eap_tls_sec_prot_message_handle(sec_prot_t *prot)
247
247
return eap_tls_sec_prot_lib_message_handle (data_ptr , length , new_seq_id , & data -> tls_send , & data -> tls_recv );
248
248
}
249
249
250
- static int8_t auth_eap_tls_sec_prot_message_send (sec_prot_t * prot , uint8_t eap_code , uint8_t eap_type , uint8_t tls_state )
250
+ static int8_t auth_eap_tls_sec_prot_message_send (sec_prot_t * prot , uint8_t eap_code , uint8_t eap_type , uint8_t tls_state , bool retry )
251
251
{
252
252
eap_tls_sec_prot_int_t * data = eap_tls_sec_prot_get (prot );
253
253
@@ -275,9 +275,9 @@ static int8_t auth_eap_tls_sec_prot_message_send(sec_prot_t *prot, uint8_t eap_c
275
275
return -1 ;
276
276
}
277
277
278
- tr_info ("EAP-TLS: send %s type %s id %i flags %x len %i, eui-64: %s" , eap_msg_trace [ eap_code - 1 ] ,
279
- eap_type == EAP_IDENTITY ? "IDENTITY" : "TLS" , data -> eap_id_seq , flags , eapol_pdu_size ,
280
- trace_array (sec_prot_remote_eui_64_addr_get (prot ), 8 ));
278
+ tr_info ("EAP-TLS: %s %s type %s id %i flags %x len %i, eui-64: %s" , retry ? "retry" : "send" ,
279
+ eap_msg_trace [ eap_code - 1 ], eap_type == EAP_IDENTITY ? "IDENTITY" : "TLS" ,
280
+ data -> eap_id_seq , flags , eapol_pdu_size , trace_array (sec_prot_remote_eui_64_addr_get (prot ), 8 ));
281
281
282
282
if (prot -> send (prot , eapol_decoded_data , eapol_pdu_size + prot -> header_size ) < 0 ) {
283
283
return -1 ;
@@ -418,7 +418,7 @@ static void auth_eap_tls_sec_prot_state_machine(sec_prot_t *prot)
418
418
auth_eap_tls_sec_prot_seq_id_update (prot );
419
419
420
420
// Sends EAP request, Identity
421
- auth_eap_tls_sec_prot_message_send (prot , EAP_REQ , EAP_IDENTITY , EAP_TLS_EXCHANGE_NONE );
421
+ auth_eap_tls_sec_prot_message_send (prot , EAP_REQ , EAP_IDENTITY , EAP_TLS_EXCHANGE_NONE , false );
422
422
423
423
// Start trickle timer to re-send if no response
424
424
sec_prot_timer_trickle_start (& data -> common , & prot -> sec_cfg -> prot_cfg .sec_prot_trickle_params );
@@ -432,7 +432,7 @@ static void auth_eap_tls_sec_prot_state_machine(sec_prot_t *prot)
432
432
// On timeout
433
433
if (sec_prot_result_timeout_check (& data -> common )) {
434
434
// Re-sends EAP request, Identity
435
- auth_eap_tls_sec_prot_message_send (prot , EAP_REQ , EAP_IDENTITY , EAP_TLS_EXCHANGE_NONE );
435
+ auth_eap_tls_sec_prot_message_send (prot , EAP_REQ , EAP_IDENTITY , EAP_TLS_EXCHANGE_NONE , true );
436
436
return ;
437
437
}
438
438
@@ -442,7 +442,7 @@ static void auth_eap_tls_sec_prot_state_machine(sec_prot_t *prot)
442
442
}
443
443
444
444
// Sends EAP request, TLS EAP start
445
- auth_eap_tls_sec_prot_message_send (prot , EAP_REQ , EAP_TLS , EAP_TLS_EXCHANGE_START );
445
+ auth_eap_tls_sec_prot_message_send (prot , EAP_REQ , EAP_TLS , EAP_TLS_EXCHANGE_START , false );
446
446
447
447
// Start trickle timer to re-send if no response
448
448
sec_prot_timer_trickle_start (& data -> common , & prot -> sec_cfg -> prot_cfg .sec_prot_trickle_params );
@@ -456,12 +456,13 @@ static void auth_eap_tls_sec_prot_state_machine(sec_prot_t *prot)
456
456
457
457
// On timeout
458
458
if (sec_prot_result_timeout_check (& data -> common )) {
459
+
459
460
if (sec_prot_state_get (& data -> common ) == EAP_TLS_STATE_RESPONSE_START ) {
460
461
// Re-sends EAP request, TLS EAP start
461
- auth_eap_tls_sec_prot_message_send (prot , EAP_REQ , EAP_TLS , EAP_TLS_EXCHANGE_START );
462
+ auth_eap_tls_sec_prot_message_send (prot , EAP_REQ , EAP_TLS , EAP_TLS_EXCHANGE_START , true );
462
463
} else {
463
464
// Re-sends EAP request, TLS EAP
464
- auth_eap_tls_sec_prot_message_send (prot , EAP_REQ , EAP_TLS , EAP_TLS_EXCHANGE_ONGOING );
465
+ auth_eap_tls_sec_prot_message_send (prot , EAP_REQ , EAP_TLS , EAP_TLS_EXCHANGE_ONGOING , true );
465
466
}
466
467
return ;
467
468
}
@@ -475,7 +476,7 @@ static void auth_eap_tls_sec_prot_state_machine(sec_prot_t *prot)
475
476
}
476
477
if (result == EAP_TLS_MSG_IDENTITY ) {
477
478
// If received EAP response, Identity: re-sends EAP request, TLS EAP start
478
- auth_eap_tls_sec_prot_message_send (prot , EAP_REQ , EAP_TLS , EAP_TLS_EXCHANGE_START );
479
+ auth_eap_tls_sec_prot_message_send (prot , EAP_REQ , EAP_TLS , EAP_TLS_EXCHANGE_START , true );
479
480
return ;
480
481
}
481
482
@@ -524,7 +525,7 @@ static void auth_eap_tls_sec_prot_state_machine(sec_prot_t *prot)
524
525
data -> send_pending = false;
525
526
526
527
// Sends EAP request, TLS EAP, TLS exchange
527
- auth_eap_tls_sec_prot_message_send (prot , EAP_REQ , EAP_TLS , EAP_TLS_EXCHANGE_ONGOING );
528
+ auth_eap_tls_sec_prot_message_send (prot , EAP_REQ , EAP_TLS , EAP_TLS_EXCHANGE_ONGOING , false );
528
529
529
530
// Start trickle timer to re-send if no response
530
531
sec_prot_timer_trickle_start (& data -> common , & prot -> sec_cfg -> prot_cfg .sec_prot_trickle_params );
@@ -534,10 +535,10 @@ static void auth_eap_tls_sec_prot_state_machine(sec_prot_t *prot)
534
535
// Supplicant PMK is now valid
535
536
sec_prot_keys_pmk_mismatch_reset (prot -> sec_keys );
536
537
// Sends EAP success
537
- auth_eap_tls_sec_prot_message_send (prot , EAP_SUCCESS , 0 , EAP_TLS_EXCHANGE_NONE );
538
+ auth_eap_tls_sec_prot_message_send (prot , EAP_SUCCESS , 0 , EAP_TLS_EXCHANGE_NONE , false );
538
539
} else {
539
540
// Sends EAP failure
540
- auth_eap_tls_sec_prot_message_send (prot , EAP_FAILURE , 0 , EAP_TLS_EXCHANGE_NONE );
541
+ auth_eap_tls_sec_prot_message_send (prot , EAP_FAILURE , 0 , EAP_TLS_EXCHANGE_NONE , false );
541
542
sec_prot_result_set (& data -> common , SEC_RESULT_ERROR );
542
543
}
543
544
0 commit comments