@@ -138,15 +138,11 @@ static void ws_bootsrap_create_ll_address(uint8_t *ll_address, const uint8_t *ma
138138 ll_address [8 ] ^= 2 ;
139139}
140140
141- mac_neighbor_table_entry_t * ws_bootstrap_mac_neighbor_add (struct protocol_interface_info_entry * interface , const uint8_t * src64 )
142141
143- {
144- mac_neighbor_table_entry_t * neighbor = mac_neighbor_table_address_discover (mac_neighbor_info (interface ), src64 , MAC_ADDR_MODE_64_BIT );
145- if (neighbor ) {
146- return neighbor ;
147- }
148142
149- neighbor = mac_neighbor_table_entry_allocate (mac_neighbor_info (interface ), src64 );
143+ static mac_neighbor_table_entry_t * ws_bootstrap_mac_neighbor_allocate (struct protocol_interface_info_entry * interface , const uint8_t * src64 )
144+ {
145+ mac_neighbor_table_entry_t * neighbor = mac_neighbor_table_entry_allocate (mac_neighbor_info (interface ), src64 );
150146 if (!neighbor ) {
151147 return NULL ;
152148 }
@@ -160,6 +156,17 @@ mac_neighbor_table_entry_t *ws_bootstrap_mac_neighbor_add(struct protocol_interf
160156 return neighbor ;
161157}
162158
159+ mac_neighbor_table_entry_t * ws_bootstrap_mac_neighbor_add (struct protocol_interface_info_entry * interface , const uint8_t * src64 )
160+
161+ {
162+ mac_neighbor_table_entry_t * neighbor = mac_neighbor_table_address_discover (mac_neighbor_info (interface ), src64 , MAC_ADDR_MODE_64_BIT );
163+ if (neighbor ) {
164+ return neighbor ;
165+ }
166+
167+ return ws_bootstrap_mac_neighbor_allocate (interface , src64 );
168+ }
169+
163170void ws_bootstrap_neighbor_set_stable (struct protocol_interface_info_entry * interface , const uint8_t * src64 )
164171{
165172 mac_neighbor_table_entry_t * neighbor = mac_neighbor_table_address_discover (mac_neighbor_info (interface ), src64 , MAC_ADDR_MODE_64_BIT );
@@ -200,13 +207,13 @@ static void ws_bootstap_eapol_neigh_entry_allocate(struct protocol_interface_inf
200207 if (!mac_entry ) {
201208 return ;
202209 }
203- ws_bootstrap_neighbor_set_stable (interface , mac_64 );
204210 mac_entry -> lifetime = 0xffffffff ;
205211 mac_entry -> link_lifetime = 0xffffffff ;
206212 ws_neighbor_class_entry_t * ws_neigh = ws_neighbor_class_entry_get (& interface -> ws_info -> neighbor_storage , mac_entry -> index );
207213 if (!ws_neigh ) {
208214 return ;
209215 }
216+
210217 interface -> ws_info -> eapol_tx_index = mac_entry -> index ;
211218}
212219
@@ -1990,6 +1997,13 @@ static void ws_bootstrap_neighbor_table_clean(struct protocol_interface_info_ent
19901997 // Enough neighbor entries
19911998 return ;
19921999 }
2000+ uint32_t temp_link_min_timeout ;
2001+ if (mac_neighbor_info (interface )-> neighbour_list_size == mac_neighbor_info (interface )-> list_total_size ) {
2002+ temp_link_min_timeout = 1 ; //Accept 1 second time from last
2003+ } else {
2004+ temp_link_min_timeout = interface -> ws_info -> cfg -> timing .temp_link_min_timeout ;
2005+ }
2006+
19932007 memcpy (ll_target , ADDR_LINK_LOCAL_PREFIX , 8 );
19942008
19952009 uint32_t current_time_stamp = ns_sw_mac_read_current_timestamp (interface -> mac_api );
@@ -2002,17 +2016,14 @@ static void ws_bootstrap_neighbor_table_clean(struct protocol_interface_info_ent
20022016 continue ;
20032017 }
20042018
2005- if (cur -> link_lifetime < WS_NEIGHBOUR_TEMPORARY_NEIGH_MAX_LIFETIME ) {
2006- continue ;
2007- }
2008-
20092019 if (cur -> link_role == PRIORITY_PARENT_NEIGHBOUR ) {
20102020 //This is our primary parent we cannot delete
20112021 continue ;
20122022 }
20132023
2014- if (cur -> nud_active || ws_neighbor -> negative_aro_send ) {
2024+ if (cur -> nud_active ) {
20152025 //If NUD process is active do not trig
2026+ // or Negative ARO is active
20162027 continue ;
20172028 }
20182029
@@ -2021,6 +2032,11 @@ static void ws_bootstrap_neighbor_table_clean(struct protocol_interface_info_ent
20212032 continue ;
20222033 }
20232034
2035+ if (cur -> link_lifetime > WS_NEIGHBOUR_TEMPORARY_ENTRY_LIFETIME && cur -> link_lifetime <= WS_NEIGHBOUR_TEMPORARY_NEIGH_MAX_LIFETIME ) {
2036+ //Do not permit to remove configured temp life time
2037+ continue ;
2038+ }
2039+
20242040 if (cur -> trusted_device ) {
20252041
20262042 if (ipv6_neighbour_has_registered_by_eui64 (& interface -> ipv6_neighbour_cache , cur -> mac64 )) {
@@ -2039,7 +2055,7 @@ static void ws_bootstrap_neighbor_table_clean(struct protocol_interface_info_ent
20392055
20402056 //Read current timestamp
20412057 uint32_t time_from_last_unicast_shedule = ws_time_from_last_unicast_traffic (current_time_stamp , ws_neighbor );
2042- if (time_from_last_unicast_shedule > interface -> ws_info -> cfg -> timing . temp_link_min_timeout ) {
2058+ if (time_from_last_unicast_shedule >= temp_link_min_timeout ) {
20432059 //Accept only Enough Old Device
20442060 if (!neighbor_entry_ptr ) {
20452061 //Accept first compare
@@ -2134,7 +2150,7 @@ static bool ws_neighbor_entry_nud_notify(mac_neighbor_table_entry_t *entry_ptr,
21342150 ws_neighbor_class_entry_t * ws_neighbor = ws_neighbor_class_entry_get (& cur -> ws_info -> neighbor_storage , entry_ptr -> index );
21352151 etx_storage_t * etx_entry = etx_storage_entry_get (cur -> id , entry_ptr -> index );
21362152
2137- if (!entry_ptr -> trusted_device || !ws_neighbor || !etx_entry || ws_neighbor -> negative_aro_send || entry_ptr -> link_lifetime < WS_NEIGHBOUR_TEMPORARY_NEIGH_MAX_LIFETIME ) {
2153+ if (!entry_ptr -> trusted_device || !ws_neighbor || !etx_entry || entry_ptr -> link_lifetime <= WS_NEIGHBOUR_TEMPORARY_NEIGH_MAX_LIFETIME ) {
21382154 return false;
21392155 }
21402156
0 commit comments