@@ -99,7 +99,7 @@ typedef struct {
9999 timer_settings_t * timer_settings ; /**< Timer settings */
100100 uint8_t nw_keys_used_cnt ; /**< How many times bootstrap has been tried with current keys */
101101 bool auth_trickle_running : 1 ; /**< Initial EAPOL-Key Trickle timer running */
102- bool auth_requested : 1 ; /**< Authentication has been requested */
102+ bool auth_requested : 1 ; /**< Authentication has been requested by the bootstrap */
103103 bool timer_running : 1 ; /**< Timer is running */
104104 bool new_br_eui_64_set : 1 ; /**< Border router address has been set */
105105 bool new_br_eui_64_fresh : 1 ; /**< Border router address is fresh (set during this authentication attempt) */
@@ -117,7 +117,7 @@ static trickle_params_t initial_eapol_key_trickle_params = {
117117};
118118
119119static void ws_pae_supp_free (pae_supp_t * pae_supp );
120- static void ws_pae_supp_authenticate_response (pae_supp_t * pae_supp , bool success );
120+ static void ws_pae_supp_authenticate_response (pae_supp_t * pae_supp , auth_result_e result );
121121static int8_t ws_pae_supp_initial_key_send (pae_supp_t * pae_supp );
122122static void ws_pae_supp_nvm_update (pae_supp_t * pae_supp );
123123static int8_t ws_pae_supp_nw_keys_valid_check (pae_supp_t * pae_supp , uint16_t pan_id );
@@ -134,6 +134,7 @@ static bool ws_pae_supp_timer_running(pae_supp_t *pae_supp);
134134static void ws_pae_supp_kmp_service_addr_get (kmp_service_t * service , kmp_api_t * kmp , kmp_addr_t * local_addr , kmp_addr_t * remote_addr );
135135static kmp_api_t * ws_pae_supp_kmp_service_api_get (kmp_service_t * service , kmp_api_t * kmp , kmp_type_e type );
136136static kmp_api_t * ws_pae_supp_kmp_incoming_ind (kmp_service_t * service , kmp_type_e type , const kmp_addr_t * addr );
137+ static kmp_api_t * ws_pae_supp_kmp_tx_status_ind (kmp_service_t * service , uint8_t instance_id );
137138static kmp_api_t * ws_pae_supp_kmp_create_and_start (kmp_service_t * service , kmp_type_e type , pae_supp_t * pae_supp );
138139static int8_t ws_pae_supp_eapol_pdu_address_check (protocol_interface_info_entry_t * interface_ptr , const uint8_t * eui_64 );
139140static int8_t ws_pae_supp_parent_eui_64_get (protocol_interface_info_entry_t * interface_ptr , uint8_t * eui_64 );
@@ -143,6 +144,7 @@ static void ws_pae_supp_kmp_api_create_indication(kmp_api_t *kmp, kmp_type_e typ
143144static void ws_pae_supp_kmp_api_finished_indication (kmp_api_t * kmp , kmp_result_e result , kmp_sec_keys_t * sec_keys );
144145static void ws_pae_supp_kmp_api_finished (kmp_api_t * kmp );
145146
147+
146148static const eapol_pdu_recv_cb_data_t eapol_pdu_recv_cb_data = {
147149 .priority = EAPOL_PDU_RECV_HIGH_PRIORITY ,
148150 .addr_check = ws_pae_supp_eapol_pdu_address_check ,
@@ -381,8 +383,6 @@ static void ws_pae_supp_nvm_update(pae_supp_t *pae_supp)
381383 ws_pae_supp_nvm_keys_write (pae_supp );
382384 sec_prot_keys_updated_reset (& pae_supp -> entry .sec_keys );
383385 }
384-
385-
386386}
387387
388388static int8_t ws_pae_supp_nvm_nw_info_write (pae_supp_t * pae_supp )
@@ -457,12 +457,12 @@ static int8_t ws_pae_supp_nvm_keys_read(pae_supp_t *pae_supp)
457457 return 0 ;
458458}
459459
460- static void ws_pae_supp_authenticate_response (pae_supp_t * pae_supp , bool success )
460+ static void ws_pae_supp_authenticate_response (pae_supp_t * pae_supp , auth_result_e result )
461461{
462462 pae_supp -> auth_trickle_running = false;
463463 if (pae_supp -> auth_requested && pae_supp -> auth_completed ) {
464464 pae_supp -> auth_requested = false;
465- pae_supp -> auth_completed (pae_supp -> interface_ptr , success );
465+ pae_supp -> auth_completed (pae_supp -> interface_ptr , result );
466466 }
467467}
468468
@@ -605,7 +605,7 @@ int8_t ws_pae_supp_init(protocol_interface_info_entry_t *interface_ptr, const se
605605 goto error ;
606606 }
607607
608- if (kmp_service_cb_register (pae_supp -> kmp_service , ws_pae_supp_kmp_incoming_ind , ws_pae_supp_kmp_service_addr_get , ws_pae_supp_kmp_service_api_get ) < 0 ) {
608+ if (kmp_service_cb_register (pae_supp -> kmp_service , ws_pae_supp_kmp_incoming_ind , ws_pae_supp_kmp_tx_status_ind , ws_pae_supp_kmp_service_addr_get , ws_pae_supp_kmp_service_api_get ) < 0 ) {
609609 goto error ;
610610 }
611611
@@ -625,7 +625,7 @@ int8_t ws_pae_supp_init(protocol_interface_info_entry_t *interface_ptr, const se
625625 goto error ;
626626 }
627627
628- if (key_sec_prot_register (pae_supp -> kmp_service ) < 0 ) {
628+ if (supp_key_sec_prot_register (pae_supp -> kmp_service ) < 0 ) {
629629 goto error ;
630630 }
631631
@@ -1115,14 +1115,24 @@ static void ws_pae_supp_kmp_api_finished_indication(kmp_api_t *kmp, kmp_result_e
11151115 ws_pae_lib_supp_timer_ticks_set (& pae_supp -> entry , WAIT_FOR_AUTHENTICATION_TICKS );
11161116 }
11171117
1118+ /* When 4WH or GKH completes inserts keys and indicates authentication completed
1119+ (if not alredy indicated) */
11181120 if ((type == IEEE_802_11_4WH || type == IEEE_802_11_GKH ) && result == KMP_RESULT_OK ) {
11191121 if (sec_keys ) {
11201122 sec_prot_keys_t * keys = sec_keys ;
11211123 pae_supp -> nw_key_insert (pae_supp -> interface_ptr , keys -> gtks );
11221124 }
11231125
1124- ws_pae_supp_authenticate_response (pae_supp , true);
1126+ ws_pae_supp_authenticate_response (pae_supp , result );
1127+ }
1128+
1129+ /* If initial EAPOL-key message sending fails to tx no acknowledge, indicates failure so
1130+ that bootstrap can decide if EAPOL target should be changed */
1131+ else if (type > IEEE_802_1X_INITIAL_KEY && result == KMP_RESULT_ERR_TX_NO_ACK ) {
1132+ tr_info ("Initial EAPOL-Key TX failure, target: %s" , trace_array (kmp_address_eui_64_get (& pae_supp -> entry .addr ), 8 ));
1133+ ws_pae_supp_authenticate_response (pae_supp , result );
11251134 }
1135+
11261136}
11271137
11281138static void ws_pae_supp_kmp_api_finished (kmp_api_t * kmp )
@@ -1137,6 +1147,21 @@ static void ws_pae_supp_kmp_api_finished(kmp_api_t *kmp)
11371147 ws_pae_lib_kmp_list_delete (& pae_supp -> entry .kmp_list , kmp );
11381148}
11391149
1150+ static kmp_api_t * ws_pae_supp_kmp_tx_status_ind (kmp_service_t * service , uint8_t instance_id )
1151+ {
1152+ pae_supp_t * pae_supp = ws_pae_supp_by_kmp_service_get (service );
1153+ if (!pae_supp ) {
1154+ return NULL ;
1155+ }
1156+
1157+ kmp_api_t * kmp = ws_pae_lib_kmp_list_instance_id_get (& pae_supp -> entry .kmp_list , instance_id );
1158+ if (!kmp ) {
1159+ return NULL ;
1160+ }
1161+
1162+ return kmp ;
1163+ }
1164+
11401165#endif /* HAVE_PAE_SUPP */
11411166#endif /* HAVE_WS */
11421167
0 commit comments