diff --git a/source/6LoWPAN/ws/ws_bootstrap.c b/source/6LoWPAN/ws/ws_bootstrap.c index 8cf66cc69c7..ff3fee308c0 100644 --- a/source/6LoWPAN/ws/ws_bootstrap.c +++ b/source/6LoWPAN/ws/ws_bootstrap.c @@ -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; + } + } } } @@ -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;