Skip to content

Commit

Permalink
Neighbour remove clear active Nud table if neighbor is at list.
Browse files Browse the repository at this point in the history
Change-Id: I2cfbf1e1b6c5546ca70e6c14a5028a94c5dc63e9
  • Loading branch information
Juha Heiskanen committed Feb 26, 2019
1 parent 5e89e16 commit 187ad94
Showing 1 changed file with 34 additions and 9 deletions.
43 changes: 34 additions & 9 deletions source/6LoWPAN/ws/ws_bootstrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ static void ws_bootstrap_nw_key_insert(protocol_interface_info_entry_t *cur, uin
static void ws_bootstrap_nw_key_index_set(protocol_interface_info_entry_t *cur, uint8_t index);
static void ws_bootstrap_authentication_completed(protocol_interface_info_entry_t *cur, bool success);
static void ws_bootstrap_pan_version_increment(protocol_interface_info_entry_t *cur);
static ws_nud_table_entry_t *ws_nud_entry_discover(protocol_interface_info_entry_t *cur, void *neighbor);
static void ws_nud_entry_remove(protocol_interface_info_entry_t *cur, mac_neighbor_table_entry_t *entry_ptr);

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

Expand Down Expand Up @@ -222,22 +224,33 @@ static ws_nud_table_entry_t *ws_nud_entry_get_free(protocol_interface_info_entry


void ws_nud_entry_remove_active(protocol_interface_info_entry_t *cur, void *neighbor)
{
ws_nud_table_entry_t *entry = ws_nud_entry_discover(cur, neighbor);

if (entry) {
mac_neighbor_table_entry_t *mac_neighbor = neighbor;
ns_list_remove(&cur->ws_info->active_nud_process, entry);
ns_list_add_to_end(&cur->ws_info->free_nud_entries, entry);
if (mac_neighbor->nud_active) {
mac_neighbor_table_neighbor_refresh(mac_neighbor_info(cur), mac_neighbor, mac_neighbor->link_lifetime);
}

mac_neighbor_table_neighbor_connected(mac_neighbor_info(cur), mac_neighbor);
}
}


static ws_nud_table_entry_t *ws_nud_entry_discover(protocol_interface_info_entry_t *cur, void *neighbor)
{
ns_list_foreach(ws_nud_table_entry_t, entry, &cur->ws_info->active_nud_process) {
if (entry->neighbor_info == neighbor) {
mac_neighbor_table_entry_t *mac_neighbor = neighbor;
ns_list_remove(&cur->ws_info->active_nud_process, entry);
ns_list_add_to_end(&cur->ws_info->free_nud_entries, entry);
if (mac_neighbor->nud_active) {
mac_neighbor_table_neighbor_refresh(mac_neighbor_info(cur), mac_neighbor, mac_neighbor->link_lifetime);
}

mac_neighbor_table_neighbor_connected(mac_neighbor_info(cur), mac_neighbor);
return;
return entry;
}
}
return NULL;
}


static void ws_nud_state_clean(protocol_interface_info_entry_t *cur, ws_nud_table_entry_t *entry)
{
mac_neighbor_table_entry_t *neighbor = entry->neighbor_info;
Expand All @@ -249,6 +262,14 @@ static void ws_nud_state_clean(protocol_interface_info_entry_t *cur, ws_nud_tabl
}
}

static void ws_nud_entry_remove(protocol_interface_info_entry_t *cur, mac_neighbor_table_entry_t *entry_ptr)
{
ws_nud_table_entry_t *nud_entry = ws_nud_entry_discover(cur, entry_ptr);
if (nud_entry) {
ws_nud_state_clean(cur, nud_entry);
}
}

static bool ws_nud_message_build(protocol_interface_info_entry_t *cur, mac_neighbor_table_entry_t *neighbor)
{
//Send NS
Expand Down Expand Up @@ -1307,6 +1328,10 @@ static void ws_neighbor_entry_remove_notify(mac_neighbor_table_entry_t *entry_pt
protocol_6lowpan_release_short_link_address_from_neighcache(cur, entry_ptr->mac16);
protocol_6lowpan_release_long_link_address_from_neighcache(cur, entry_ptr->mac64);
}

//NUD Process Clear Here
ws_nud_entry_remove(cur, entry_ptr);

ws_bootstrap_neighbor_delete(cur, entry_ptr->index);
}

Expand Down

0 comments on commit 187ad94

Please sign in to comment.