Skip to content

Commit 40b2eec

Browse files
author
Mika Tervonen
committed
Set global address flag to follow address state
If we have higher than link local scope address global address becomes available
1 parent b46eacc commit 40b2eec

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

source/6LoWPAN/ws/ws_bootstrap.c

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,14 +124,27 @@ static void ws_bootstrap_address_notification_cb(struct protocol_interface_info_
124124
if(addr->source == ADDR_SOURCE_UNKNOWN) {
125125
return;
126126
}
127-
128127
if (reason == ADDR_CALLBACK_DAD_COMPLETE) {
129128
//Trig Address Registartion only when Bootstrap is ready
130129
if (interface->nwk_bootstrap_state == ER_BOOTSRAP_DONE) {
131130
ws_bootsrap_event_trig(WS_ADDRESS_ADDED, interface->bootStrapId, ARM_LIB_LOW_PRIORITY_EVENT, (void *)addr);
132131
}
132+
if (addr_ipv6_scope(addr->address,interface) > IPV6_SCOPE_LINK_LOCAL) {
133+
// at least ula address available inside mesh.
134+
interface->global_address_available = true;
135+
}
136+
133137
} else if (reason == ADDR_CALLBACK_DELETED) {
134138
// What to do?
139+
// Go through address list and check if there is global address still available
140+
interface->global_address_available = false;
141+
ns_list_foreach(if_address_entry_t, addr_str, &interface->ip_addresses) {
142+
if (addr_ipv6_scope(addr_str->address, interface) > IPV6_SCOPE_LINK_LOCAL) {
143+
// at least ula address available inside mesh.
144+
interface->global_address_available = true;
145+
break;
146+
}
147+
}
135148
}
136149
}
137150

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

0 commit comments

Comments
 (0)