Skip to content

Commit

Permalink
Wi-SUN discovery and address registration update
Browse files Browse the repository at this point in the history
Moved Neighbour table clean before clear old Pan-id and enable Neighbour cache clean.

ARO registration set Stable timeout also now for old regisred cache.
  • Loading branch information
Juha Heiskanen committed Sep 29, 2020
1 parent e73c808 commit b720fbd
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 13 deletions.
6 changes: 2 additions & 4 deletions source/6LoWPAN/ws/ws_bootstrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -2788,9 +2788,6 @@ static void ws_bootstrap_start_discovery(protocol_interface_info_entry_t *cur)
cur->ws_info->pan_timeout_timer = 0;
cur->ws_info->weakest_received_rssi = 0;

// Clear learned neighbours
ws_bootstrap_neighbor_list_clean(cur);

// Clear learned candidate parents
ws_bootstrap_candidate_table_reset(cur);

Expand Down Expand Up @@ -3316,7 +3313,8 @@ static void ws_bootstrap_event_handler(arm_event_s *event)
break;
}
ws_pae_controller_supp_init(cur);

// Clear learned neighbours
ws_bootstrap_neighbor_list_clean(cur);
// Configure LLC for network discovery
ws_bootstrap_network_discovery_configure(cur);
ws_bootstrap_fhss_activate(cur);
Expand Down
30 changes: 21 additions & 9 deletions source/6LoWPAN/ws/ws_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,24 @@ uint8_t ws_common_temporary_entry_size(uint8_t mac_table_size)
}
}

static void ws_common_neighbour_address_reg_link_update(protocol_interface_info_entry_t *interface, const uint8_t *eui64)
{
/*
* ARO registration from child can update the link timeout so we don't need to send extra NUD if ARO received
*/
mac_neighbor_table_entry_t *mac_neighbor = mac_neighbor_entry_get_by_mac64(mac_neighbor_info(interface), eui64, false, false);

if (mac_neighbor) {
if (mac_neighbor->link_lifetime != WS_NEIGHBOR_LINK_TIMEOUT) {
//Set Stable timeout for temporary entry here
mac_neighbor->link_lifetime = WS_NEIGHBOR_LINK_TIMEOUT;
tr_info("Added new neighbor %s : index:%u", trace_array(eui64, 8), mac_neighbor->index);
}
//Refresh
mac_neighbor->lifetime = mac_neighbor->link_lifetime;
}
}

uint8_t ws_common_allow_child_registration(protocol_interface_info_entry_t *interface, const uint8_t *eui64)
{
uint8_t child_count = 0;
Expand All @@ -402,14 +420,7 @@ uint8_t ws_common_allow_child_registration(protocol_interface_info_entry_t *inte

//Validate Is EUI64 already allocated for any address
if (ipv6_neighbour_has_registered_by_eui64(&interface->ipv6_neighbour_cache, eui64)) {
/*
* ARO registration from child can update the link timeout so we don't need to send extra NUD if ARO received
*/
mac_neighbor_table_entry_t *mac_neighbor = mac_neighbor_entry_get_by_mac64(mac_neighbor_info(interface), eui64, false, false);

if (mac_neighbor) {
mac_neighbor_table_neighbor_refresh(mac_neighbor_info(interface), mac_neighbor, mac_neighbor->link_lifetime);
}
ws_common_neighbour_address_reg_link_update(interface, eui64);
tr_info("Child registration from old child");
return ARO_SUCCESS;
}
Expand All @@ -431,7 +442,8 @@ uint8_t ws_common_allow_child_registration(protocol_interface_info_entry_t *inte
tr_warn("Child registration not allowed %d/%d, max:%d", child_count, max_child_count, mac_neighbor_info(interface)->list_total_size);
return ARO_FULL;
}
ws_bootstrap_neighbor_set_stable(interface, eui64);

ws_common_neighbour_address_reg_link_update(interface, eui64);
tr_info("Child registration allowed %d/%d, max:%d", child_count, max_child_count, mac_neighbor_info(interface)->list_total_size);
return ARO_SUCCESS;
}
Expand Down

0 comments on commit b720fbd

Please sign in to comment.