@@ -166,6 +166,11 @@ static void ws_pae_supp_address_set(pae_supp_t *pae_supp, kmp_addr_t *address)
166
166
}
167
167
}
168
168
169
+ static bool ws_pae_supp_address_is_set (pae_supp_t * pae_supp )
170
+ {
171
+ return pae_supp -> entry_address_active ;
172
+ }
173
+
169
174
int8_t ws_pae_supp_authenticate (protocol_interface_info_entry_t * interface_ptr , uint16_t dest_pan_id , uint8_t * dest_eui_64 )
170
175
{
171
176
pae_supp_t * pae_supp = ws_pae_supp_get (interface_ptr );
@@ -321,6 +326,9 @@ int8_t ws_pae_supp_gtk_hash_update(protocol_interface_info_entry_t *interface_pt
321
326
ws_pae_supp_timer_start (pae_supp );
322
327
323
328
tr_info ("GTK update start imin: %i, imax: %i, max mismatch: %i, tr time: %i" , pae_supp -> timer_settings -> gtk_request_imin , pae_supp -> timer_settings -> gtk_request_imax , pae_supp -> timer_settings -> gtk_max_mismatch , pae_supp -> auth_trickle_timer .t );
329
+ } else {
330
+ // If trickle is already running, set inconsistent heard to speed up the trickle
331
+ trickle_inconsistent_heard (& pae_supp -> auth_trickle_timer , & pae_supp -> auth_trickle_params );
324
332
}
325
333
}
326
334
@@ -346,6 +354,19 @@ int8_t ws_pae_supp_nw_key_index_update(protocol_interface_info_entry_t *interfac
346
354
return 0 ;
347
355
}
348
356
357
+ int8_t ws_pae_supp_eapol_target_remove (protocol_interface_info_entry_t * interface_ptr )
358
+ {
359
+ pae_supp_t * pae_supp = ws_pae_supp_get (interface_ptr );
360
+ if (!pae_supp ) {
361
+ return -1 ;
362
+ }
363
+
364
+ // Sets target/parent address to null
365
+ ws_pae_supp_address_set (pae_supp , NULL );
366
+
367
+ return 0 ;
368
+ }
369
+
349
370
static void ws_pae_supp_nvm_update (pae_supp_t * pae_supp )
350
371
{
351
372
// Check if NW info or GTKs have been changed
@@ -450,15 +471,21 @@ static int8_t ws_pae_supp_initial_key_send(pae_supp_t *pae_supp)
450
471
if (!pae_supp -> auth_requested ) {
451
472
// If not making initial authentication updates target (RPL parent) for each EAPOL-key message
452
473
uint8_t parent_eui_64 [8 ];
453
- if (ws_pae_supp_parent_eui_64_get (pae_supp -> interface_ptr , parent_eui_64 ) < 0 ) {
474
+ if (ws_pae_supp_parent_eui_64_get (pae_supp -> interface_ptr , parent_eui_64 ) >= 0 ) {
475
+ // Stores target/parent address
476
+ kmp_address_init (KMP_ADDR_EUI_64 , & pae_supp -> target_addr , parent_eui_64 );
477
+ // Sets parent address in use
478
+ ws_pae_supp_address_set (pae_supp , & pae_supp -> target_addr );
479
+ } else if (ws_pae_supp_address_is_set (pae_supp )) {
480
+ /* If there is no RPL parent but there is target address from initial authentication
481
+ bootstrap, tries to use it. This can happen if BR updates keys after EAPOL authentication
482
+ but before bootstrap is completed and RPL parent is known */
483
+ tr_info ("EAPOL initial auth target used" );
484
+ } else {
485
+ // No target, failure
454
486
return -1 ;
455
487
}
456
488
457
- // Stores target/parent address
458
- kmp_address_init (KMP_ADDR_EUI_64 , & pae_supp -> target_addr , parent_eui_64 );
459
- // Sets parent address in use
460
- ws_pae_supp_address_set (pae_supp , & pae_supp -> target_addr );
461
-
462
489
ws_pae_lib_supp_timer_ticks_set (& pae_supp -> entry , WAIT_FOR_REAUTHENTICATION_TICKS );
463
490
tr_info ("PAE wait for auth seconds: %i" , WAIT_FOR_REAUTHENTICATION_TICKS / 10 );
464
491
}
@@ -758,10 +785,7 @@ void ws_pae_supp_fast_timer(uint16_t ticks)
758
785
759
786
// Checks whether timer needs to be active
760
787
if (!pae_supp -> initial_key_timer && !pae_supp -> auth_trickle_running && !running ) {
761
-
762
788
tr_debug ("PAE idle" );
763
- // Sets target/parent address to null
764
- ws_pae_supp_address_set (pae_supp , NULL );
765
789
// If not already completed, restart bootstrap
766
790
ws_pae_supp_authenticate_response (pae_supp , false);
767
791
@@ -777,7 +801,9 @@ void ws_pae_supp_slow_timer(uint16_t seconds)
777
801
// Checks whether initial EAPOL-Key message needs to be re-send or new GTK request to be sent
778
802
if (pae_supp -> auth_trickle_running ) {
779
803
if (trickle_timer (& pae_supp -> auth_trickle_timer , & pae_supp -> auth_trickle_params , seconds )) {
780
- ws_pae_supp_initial_key_send (pae_supp );
804
+ if (ws_pae_supp_initial_key_send (pae_supp ) < 0 ) {
805
+ tr_info ("EAPOL-Key send failed" );
806
+ }
781
807
}
782
808
// Maximum number of trickle expires, authentication fails
783
809
if (!trickle_running (& pae_supp -> auth_trickle_timer , & pae_supp -> auth_trickle_params )) {
@@ -800,14 +826,15 @@ void ws_pae_supp_slow_timer(uint16_t seconds)
800
826
pae_supp -> initial_key_timer = 0 ;
801
827
802
828
// Sends initial EAPOL-Key message
803
- ws_pae_supp_initial_key_send (pae_supp );
829
+ if (ws_pae_supp_initial_key_send (pae_supp ) < 0 ) {
830
+ tr_info ("EAPOL-Key send failed" );
831
+ }
804
832
805
833
// Starts trickle
806
834
pae_supp -> auth_trickle_params = initial_eapol_key_trickle_params ;
807
835
trickle_start (& pae_supp -> auth_trickle_timer , & pae_supp -> auth_trickle_params );
808
836
pae_supp -> auth_trickle_running = true;
809
837
}
810
-
811
838
}
812
839
}
813
840
}
0 commit comments