Skip to content

Commit 16d52fb

Browse files
author
Juha Heiskanen
authored
Merge pull request #1991 from ARMmbed/aro_failure_fix
Aro failure fix
2 parents 81cd273 + 187ad94 commit 16d52fb

File tree

1 file changed

+35
-11
lines changed

1 file changed

+35
-11
lines changed

source/6LoWPAN/ws/ws_bootstrap.c

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ static void ws_bootstrap_nw_key_insert(protocol_interface_info_entry_t *cur, uin
8989
static void ws_bootstrap_nw_key_index_set(protocol_interface_info_entry_t *cur, uint8_t index);
9090
static void ws_bootstrap_authentication_completed(protocol_interface_info_entry_t *cur, bool success);
9191
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);
9294

9395
mac_neighbor_table_entry_t *ws_bootstrap_mac_neighbor_add(struct protocol_interface_info_entry *interface, const uint8_t *src64)
9496

@@ -222,22 +224,33 @@ static ws_nud_table_entry_t *ws_nud_entry_get_free(protocol_interface_info_entry
222224

223225

224226
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)
225244
{
226245
ns_list_foreach(ws_nud_table_entry_t, entry, &cur->ws_info->active_nud_process) {
227246
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;
237248
}
238249
}
250+
return NULL;
239251
}
240252

253+
241254
static void ws_nud_state_clean(protocol_interface_info_entry_t *cur, ws_nud_table_entry_t *entry)
242255
{
243256
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
249262
}
250263
}
251264

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+
252273
static bool ws_nud_message_build(protocol_interface_info_entry_t *cur, mac_neighbor_table_entry_t *neighbor)
253274
{
254275
//Send NS
@@ -1307,6 +1328,10 @@ static void ws_neighbor_entry_remove_notify(mac_neighbor_table_entry_t *entry_pt
13071328
protocol_6lowpan_release_short_link_address_from_neighcache(cur, entry_ptr->mac16);
13081329
protocol_6lowpan_release_long_link_address_from_neighcache(cur, entry_ptr->mac64);
13091330
}
1331+
1332+
//NUD Process Clear Here
1333+
ws_nud_entry_remove(cur, entry_ptr);
1334+
13101335
ws_bootstrap_neighbor_delete(cur, entry_ptr->index);
13111336
}
13121337

@@ -1563,8 +1588,7 @@ int ws_bootstrap_neighbor_remove(protocol_interface_info_entry_t *cur, const uin
15631588
mac_neighbor_table_entry_t *mac_neighbor = mac_neighbor_entry_get_by_ll64(mac_neighbor_info(cur), ll_address, false, NULL);
15641589

15651590
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);
15681592
}
15691593
return 0;
15701594
}

0 commit comments

Comments
 (0)