Skip to content

Commit 14a244d

Browse files
author
Juha Heiskanen
committed
Wi-sun BBR, bootsrap and RPL Prefix calback update
RPL Prefix callback update indicate Prefix invalidation when Parent address parameter is NULL. Wi-SUN BBR not delete seprate own client RPL prefix invalidation handle this automatically. Wi-SUN bootsrap support new RPL Prefix invalidation for DHCPv6 client for deprecate address and clean client.
1 parent 669b325 commit 14a244d

File tree

3 files changed

+17
-28
lines changed

3 files changed

+17
-28
lines changed

source/6LoWPAN/ws/ws_bbr_api.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -302,9 +302,6 @@ static void ws_bbr_dhcp_server_stop(protocol_interface_info_entry_t *cur, uint8_
302302
tr_debug("DHCP server deactivate %s", trace_ipv6(global_id));
303303
DHCPv6_server_service_delete(cur->id, global_id, false);
304304

305-
// Set old addresses to deferred and timeout
306-
ws_dhcp_client_address_delete(cur, global_id);
307-
308305
}
309306

310307
static void ws_bbr_rpl_status_check(protocol_interface_info_entry_t *cur)
@@ -342,9 +339,9 @@ static void ws_bbr_rpl_status_check(protocol_interface_info_entry_t *cur)
342339
tr_info("RPL GUA deactivate %s", trace_ipv6(global_dodag_id));
343340

344341
// Old backbone information is deleted after 120 seconds
345-
rpl_control_update_dodag_route(protocol_6lowpan_rpl_root_dodag, NULL, 0, 0, 120, true);
342+
rpl_control_update_dodag_route(protocol_6lowpan_rpl_root_dodag, NULL, 0, 0, 0, true);
346343
rpl_control_update_dodag_prefix(protocol_6lowpan_rpl_root_dodag, global_dodag_id, 64, 0, 0, 0, true);
347-
rpl_control_update_dodag_route(protocol_6lowpan_rpl_root_dodag, global_dodag_id, 64, 0, 120, true);
344+
rpl_control_update_dodag_route(protocol_6lowpan_rpl_root_dodag, global_dodag_id, 64, 0, 0, true);
348345
ipv6_route_add_with_info(global_dodag_id, 64, backbone_interface_id, NULL, ROUTE_THREAD_BBR, NULL, 0, 120, 0);
349346

350347
ws_bbr_dhcp_server_stop(cur, global_dodag_id);

source/6LoWPAN/ws/ws_bootstrap.c

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1813,31 +1813,11 @@ static void ws_dhcp_client_global_adress_cb(int8_t interface, uint8_t dhcp_addr[
18131813
tr_debug("DHCPv6 %s status %u", trace_ipv6(dhcp_addr), register_status);
18141814
}
18151815

1816-
static bool ws_address_entry_available(uint8_t *prefixPtr, if_address_list_t *list)
1817-
{
1818-
bool addressReady = false;
1819-
ns_list_foreach(if_address_entry_t, entry, list) {
1820-
if (prefixPtr) {
1821-
if (memcmp(entry->address, prefixPtr, 8) == 0) {
1822-
addressReady = true;
1823-
break;
1824-
}
1825-
} else {
1826-
if (entry->source == ADDR_SOURCE_DHCP) {
1827-
addressReady = true;
1828-
break;
1829-
}
1830-
}
1831-
}
1832-
return addressReady;
1833-
}
18341816

18351817
void ws_dhcp_client_address_request(protocol_interface_info_entry_t *cur, uint8_t *prefix, uint8_t *parent_link_local)
18361818
{
1837-
if (!ws_address_entry_available(prefix, &cur->ip_addresses)) {
1838-
if (dhcp_client_get_global_address(cur->id, parent_link_local, prefix, cur->mac, DHCPV6_DUID_HARDWARE_IEEE_802_NETWORKS_TYPE, ws_dhcp_client_global_adress_cb) != 0) {
1839-
tr_error("DHCPp client request fail");
1840-
}
1819+
if (dhcp_client_get_global_address(cur->id, parent_link_local, prefix, cur->mac, DHCPV6_DUID_HARDWARE_IEEE_802_NETWORKS_TYPE, ws_dhcp_client_global_adress_cb) != 0) {
1820+
tr_error("DHCPp client request fail");
18411821
}
18421822
}
18431823

@@ -1876,7 +1856,13 @@ static void ws_rpl_prefix_callback(prefix_entry_t *prefix, void *handle, uint8_t
18761856
}
18771857
} else if (prefix->prefix_len) {
18781858
// Create new address using DHCP
1879-
ws_dhcp_client_address_request(cur, prefix->prefix, parent_link_local);
1859+
if (parent_link_local) {
1860+
ws_dhcp_client_address_request(cur, prefix->prefix, parent_link_local);
1861+
} else {
1862+
/* Deprecate address and remove client */
1863+
tr_debug("Prefix invalidation %s", trace_ipv6(prefix->prefix));
1864+
dhcp_client_global_address_delete(cur->id, NULL, prefix->prefix);
1865+
}
18801866
}
18811867
}
18821868

source/RPL/rpl_upward.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -993,6 +993,12 @@ prefix_entry_t *rpl_dodag_update_dio_prefix(rpl_dodag_t *dodag, const uint8_t *p
993993

994994
void rpl_dodag_delete_dio_prefix(rpl_dodag_t *dodag, prefix_entry_t *prefix)
995995
{
996+
rpl_instance_t *instance = dodag->instance;
997+
998+
if (instance && instance->domain->prefix_cb) {
999+
instance->domain->prefix_cb(prefix, instance->domain->cb_handle, NULL);
1000+
}
1001+
9961002
ns_list_remove(&dodag->prefixes, prefix);
9971003
ns_dyn_mem_free(prefix);
9981004
}

0 commit comments

Comments
 (0)