Skip to content

Commit

Permalink
Clear all neighbors only on eapol next target check
Browse files Browse the repository at this point in the history
  • Loading branch information
Mika Leppänen committed May 14, 2020
1 parent faa19e1 commit 6b8beef
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions source/6LoWPAN/ws/ws_bootstrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ static void ws_nud_entry_remove(protocol_interface_info_entry_t *cur, mac_neighb
static bool ws_neighbor_entry_nud_notify(mac_neighbor_table_entry_t *entry_ptr, void *user_data);

static void ws_address_registration_update(protocol_interface_info_entry_t *interface, const uint8_t addr[16]);
static int8_t ws_bootstrap_neighbor_set(protocol_interface_info_entry_t *cur, parent_info_t *parent_ptr);
static int8_t ws_bootstrap_neighbor_set(protocol_interface_info_entry_t *cur, parent_info_t *parent_ptr, bool clear_list);

static void ws_bootstrap_candidate_table_reset(protocol_interface_info_entry_t *cur);
static parent_info_t *ws_bootstrap_candidate_parent_get(struct protocol_interface_info_entry *cur, const uint8_t *addr, bool create);
Expand Down Expand Up @@ -2769,7 +2769,7 @@ static const uint8_t *ws_bootstrap_authentication_next_target(protocol_interface
if (parent_info) {
/* On failure still continues with the new parent, and on next call,
will try to set the neighbor again */
ws_bootstrap_neighbor_set(cur, parent_info);
ws_bootstrap_neighbor_set(cur, parent_info, true);
*pan_id = parent_info->pan_id;
return parent_info->addr;
}
Expand Down Expand Up @@ -3167,7 +3167,7 @@ static void ws_bootstrap_event_handler(arm_event_s *event)
}
}

static int8_t ws_bootstrap_neighbor_set(protocol_interface_info_entry_t *cur, parent_info_t *parent_ptr)
static int8_t ws_bootstrap_neighbor_set(protocol_interface_info_entry_t *cur, parent_info_t *parent_ptr, bool clear_list)
{
uint16_t pan_id = cur->ws_info->network_pan_id;

Expand All @@ -3178,7 +3178,9 @@ static int8_t ws_bootstrap_neighbor_set(protocol_interface_info_entry_t *cur, pa

// If PAN ID changes, clear learned neighbors and activate FHSS
if (pan_id != cur->ws_info->network_pan_id) {
ws_bootstrap_neighbor_list_clean(cur);
if (clear_list) {
ws_bootstrap_neighbor_list_clean(cur);
}
ws_bootstrap_fhss_activate(cur);
}

Expand Down Expand Up @@ -3221,7 +3223,7 @@ void ws_bootstrap_network_scan_process(protocol_interface_info_entry_t *cur)
}
tr_info("selected parent:%s panid %u", trace_array(selected_parent_ptr->addr, 8), selected_parent_ptr->pan_id);

if (ws_bootstrap_neighbor_set(cur, selected_parent_ptr) < 0) {
if (ws_bootstrap_neighbor_set(cur, selected_parent_ptr, false) < 0) {
goto select_best_candidate;
}

Expand Down

0 comments on commit 6b8beef

Please sign in to comment.