@@ -89,6 +89,8 @@ static void ws_bootstrap_nw_key_insert(protocol_interface_info_entry_t *cur, uin
89
89
static void ws_bootstrap_nw_key_index_set (protocol_interface_info_entry_t * cur , uint8_t index );
90
90
static void ws_bootstrap_authentication_completed (protocol_interface_info_entry_t * cur , bool success );
91
91
static void ws_bootstrap_pan_version_increment (protocol_interface_info_entry_t * cur );
92
+ static ws_nud_table_entry_t * ws_nud_entry_discover (protocol_interface_info_entry_t * cur , void * neighbor );
93
+ static void ws_nud_entry_remove (protocol_interface_info_entry_t * cur , mac_neighbor_table_entry_t * entry_ptr );
92
94
93
95
mac_neighbor_table_entry_t * ws_bootstrap_mac_neighbor_add (struct protocol_interface_info_entry * interface , const uint8_t * src64 )
94
96
@@ -222,22 +224,33 @@ static ws_nud_table_entry_t *ws_nud_entry_get_free(protocol_interface_info_entry
222
224
223
225
224
226
void ws_nud_entry_remove_active (protocol_interface_info_entry_t * cur , void * neighbor )
227
+ {
228
+ ws_nud_table_entry_t * entry = ws_nud_entry_discover (cur , neighbor );
229
+
230
+ if (entry ) {
231
+ mac_neighbor_table_entry_t * mac_neighbor = neighbor ;
232
+ ns_list_remove (& cur -> ws_info -> active_nud_process , entry );
233
+ ns_list_add_to_end (& cur -> ws_info -> free_nud_entries , entry );
234
+ if (mac_neighbor -> nud_active ) {
235
+ mac_neighbor_table_neighbor_refresh (mac_neighbor_info (cur ), mac_neighbor , mac_neighbor -> link_lifetime );
236
+ }
237
+
238
+ mac_neighbor_table_neighbor_connected (mac_neighbor_info (cur ), mac_neighbor );
239
+ }
240
+ }
241
+
242
+
243
+ static ws_nud_table_entry_t * ws_nud_entry_discover (protocol_interface_info_entry_t * cur , void * neighbor )
225
244
{
226
245
ns_list_foreach (ws_nud_table_entry_t , entry , & cur -> ws_info -> active_nud_process ) {
227
246
if (entry -> neighbor_info == neighbor ) {
228
- mac_neighbor_table_entry_t * mac_neighbor = neighbor ;
229
- ns_list_remove (& cur -> ws_info -> active_nud_process , entry );
230
- ns_list_add_to_end (& cur -> ws_info -> free_nud_entries , entry );
231
- if (mac_neighbor -> nud_active ) {
232
- mac_neighbor_table_neighbor_refresh (mac_neighbor_info (cur ), mac_neighbor , mac_neighbor -> link_lifetime );
233
- }
234
-
235
- mac_neighbor_table_neighbor_connected (mac_neighbor_info (cur ), mac_neighbor );
236
- return ;
247
+ return entry ;
237
248
}
238
249
}
250
+ return NULL ;
239
251
}
240
252
253
+
241
254
static void ws_nud_state_clean (protocol_interface_info_entry_t * cur , ws_nud_table_entry_t * entry )
242
255
{
243
256
mac_neighbor_table_entry_t * neighbor = entry -> neighbor_info ;
@@ -249,6 +262,14 @@ static void ws_nud_state_clean(protocol_interface_info_entry_t *cur, ws_nud_tabl
249
262
}
250
263
}
251
264
265
+ static void ws_nud_entry_remove (protocol_interface_info_entry_t * cur , mac_neighbor_table_entry_t * entry_ptr )
266
+ {
267
+ ws_nud_table_entry_t * nud_entry = ws_nud_entry_discover (cur , entry_ptr );
268
+ if (nud_entry ) {
269
+ ws_nud_state_clean (cur , nud_entry );
270
+ }
271
+ }
272
+
252
273
static bool ws_nud_message_build (protocol_interface_info_entry_t * cur , mac_neighbor_table_entry_t * neighbor )
253
274
{
254
275
//Send NS
@@ -1307,6 +1328,10 @@ static void ws_neighbor_entry_remove_notify(mac_neighbor_table_entry_t *entry_pt
1307
1328
protocol_6lowpan_release_short_link_address_from_neighcache (cur , entry_ptr -> mac16 );
1308
1329
protocol_6lowpan_release_long_link_address_from_neighcache (cur , entry_ptr -> mac64 );
1309
1330
}
1331
+
1332
+ //NUD Process Clear Here
1333
+ ws_nud_entry_remove (cur , entry_ptr );
1334
+
1310
1335
ws_bootstrap_neighbor_delete (cur , entry_ptr -> index );
1311
1336
}
1312
1337
@@ -1563,8 +1588,7 @@ int ws_bootstrap_neighbor_remove(protocol_interface_info_entry_t *cur, const uin
1563
1588
mac_neighbor_table_entry_t * mac_neighbor = mac_neighbor_entry_get_by_ll64 (mac_neighbor_info (cur ), ll_address , false, NULL );
1564
1589
1565
1590
if (mac_neighbor ) {
1566
- ws_bootstrap_neighbor_delete (cur , mac_neighbor -> index );
1567
- // TODO Add to blacklist
1591
+ mac_neighbor_table_neighbor_remove (mac_neighbor_info (cur ), mac_neighbor );
1568
1592
}
1569
1593
return 0 ;
1570
1594
}
0 commit comments