Skip to content

Commit

Permalink
Set global address flag to follow address state
Browse files Browse the repository at this point in the history
If we have higher than link local scope address global address
becomes available
  • Loading branch information
Mika Tervonen committed Sep 12, 2018
1 parent b46eacc commit 40b2eec
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions source/6LoWPAN/ws/ws_bootstrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,27 @@ static void ws_bootstrap_address_notification_cb(struct protocol_interface_info_
if(addr->source == ADDR_SOURCE_UNKNOWN) {
return;
}

if (reason == ADDR_CALLBACK_DAD_COMPLETE) {
//Trig Address Registartion only when Bootstrap is ready
if (interface->nwk_bootstrap_state == ER_BOOTSRAP_DONE) {
ws_bootsrap_event_trig(WS_ADDRESS_ADDED, interface->bootStrapId, ARM_LIB_LOW_PRIORITY_EVENT, (void *)addr);
}
if (addr_ipv6_scope(addr->address,interface) > IPV6_SCOPE_LINK_LOCAL) {
// at least ula address available inside mesh.
interface->global_address_available = true;
}

} else if (reason == ADDR_CALLBACK_DELETED) {
// What to do?
// Go through address list and check if there is global address still available
interface->global_address_available = false;
ns_list_foreach(if_address_entry_t, addr_str, &interface->ip_addresses) {
if (addr_ipv6_scope(addr_str->address, interface) > IPV6_SCOPE_LINK_LOCAL) {
// at least ula address available inside mesh.
interface->global_address_available = true;
break;
}
}
}
}

Expand Down Expand Up @@ -1588,7 +1601,7 @@ static void ws_bootstrap_event_handler(arm_event_s *event)
break;
case WS_DISCOVERY_START:
tr_info("Discovery start");
// All trikkles stopped so here can be entered anytime
// All trickle timers stopped to allow entry from any state
cur->ws_info->trickle_pa_running = false;
cur->ws_info->trickle_pc_running = false;
cur->ws_info->trickle_pas_running = false;
Expand Down

0 comments on commit 40b2eec

Please sign in to comment.