@@ -390,38 +390,51 @@ uint8_t ws_common_temporary_entry_size(uint8_t mac_table_size)
390
390
}
391
391
}
392
392
393
- static void ws_common_neighbour_address_reg_link_update (protocol_interface_info_entry_t * interface , const uint8_t * eui64 )
393
+ static void ws_common_neighbour_address_reg_link_update (protocol_interface_info_entry_t * interface , const uint8_t * eui64 , uint32_t link_lifetime )
394
394
{
395
+ if (link_lifetime > WS_NEIGHBOR_LINK_TIMEOUT ) {
396
+ link_lifetime = WS_NEIGHBOR_LINK_TIMEOUT ;
397
+ }
395
398
/*
396
399
* ARO registration from child can update the link timeout so we don't need to send extra NUD if ARO received
397
400
*/
398
401
mac_neighbor_table_entry_t * mac_neighbor = mac_neighbor_entry_get_by_mac64 (mac_neighbor_info (interface ), eui64 , false, false);
399
402
400
403
if (mac_neighbor ) {
401
- if (mac_neighbor -> link_lifetime != WS_NEIGHBOR_LINK_TIMEOUT ) {
404
+ if (mac_neighbor -> link_lifetime < link_lifetime ) {
402
405
//Set Stable timeout for temporary entry here
406
+ if (link_lifetime > WS_NEIGHBOUR_TEMPORARY_NEIGH_MAX_LIFETIME && mac_neighbor -> link_lifetime < WS_NEIGHBOUR_TEMPORARY_NEIGH_MAX_LIFETIME ) {
407
+ tr_info ("Added new neighbor %s : index:%u" , trace_array (eui64 , 8 ), mac_neighbor -> index );
408
+ }
403
409
mac_neighbor -> link_lifetime = WS_NEIGHBOR_LINK_TIMEOUT ;
404
- tr_info ( "Added new neighbor %s : index:%u" , trace_array ( eui64 , 8 ), mac_neighbor -> index );
410
+
405
411
}
406
412
//Refresh
407
413
mac_neighbor -> lifetime = mac_neighbor -> link_lifetime ;
408
414
}
409
415
}
410
416
411
- uint8_t ws_common_allow_child_registration (protocol_interface_info_entry_t * interface , const uint8_t * eui64 )
417
+ uint8_t ws_common_allow_child_registration (protocol_interface_info_entry_t * interface , const uint8_t * eui64 , uint16_t aro_timeout )
412
418
{
413
419
uint8_t child_count = 0 ;
414
420
uint8_t max_child_count = mac_neighbor_info (interface )-> list_total_size - ws_common_temporary_entry_size (mac_neighbor_info (interface )-> list_total_size );
415
421
422
+ if (aro_timeout == 0 ) {
423
+ //DeRegister Address Reg
424
+ return ARO_SUCCESS ;
425
+ }
426
+ uint32_t link_lifetime = (aro_timeout * 60 ) + 1 ;
427
+
416
428
// Test API to limit child count
417
429
if (test_max_child_count_override != 0xffff ) {
418
430
max_child_count = test_max_child_count_override ;
419
431
}
420
432
421
433
//Validate Is EUI64 already allocated for any address
422
434
if (ipv6_neighbour_has_registered_by_eui64 (& interface -> ipv6_neighbour_cache , eui64 )) {
423
- ws_common_neighbour_address_reg_link_update (interface , eui64 );
435
+ ws_common_neighbour_address_reg_link_update (interface , eui64 , link_lifetime );
424
436
tr_info ("Child registration from old child" );
437
+
425
438
return ARO_SUCCESS ;
426
439
}
427
440
@@ -431,20 +444,21 @@ uint8_t ws_common_allow_child_registration(protocol_interface_info_entry_t *inte
431
444
return ARO_TOPOLOGICALLY_INCORRECT ;
432
445
}
433
446
434
-
435
447
ns_list_foreach_safe (mac_neighbor_table_entry_t , cur , & mac_neighbor_info (interface )-> neighbour_list ) {
436
448
437
449
if (ipv6_neighbour_has_registered_by_eui64 (& interface -> ipv6_neighbour_cache , cur -> mac64 )) {
438
450
child_count ++ ;
439
451
}
440
452
}
453
+
441
454
if (child_count >= max_child_count ) {
442
455
tr_warn ("Child registration not allowed %d/%d, max:%d" , child_count , max_child_count , mac_neighbor_info (interface )-> list_total_size );
443
456
return ARO_FULL ;
444
457
}
445
458
446
- ws_common_neighbour_address_reg_link_update (interface , eui64 );
459
+ ws_common_neighbour_address_reg_link_update (interface , eui64 , link_lifetime );
447
460
tr_info ("Child registration allowed %d/%d, max:%d" , child_count , max_child_count , mac_neighbor_info (interface )-> list_total_size );
461
+
448
462
return ARO_SUCCESS ;
449
463
}
450
464
0 commit comments