Skip to content

Commit

Permalink
Support SLAAC addressing method for Wi-SUN Border router
Browse files Browse the repository at this point in the history
This prevents the usage of DHCP in the Wi-SUN network and devices
generates the address using SLAAC.
  • Loading branch information
Mika committed Oct 1, 2020
1 parent 71c8bde commit 76fc9d7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions nanostack/ws_bbr_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ int ws_bbr_start(int8_t interface_id, int8_t backbone_interface_id);
#define BBR_BB_WAIT 0x0004 /**< Wait backbone availability before starting Wi-SUN network */
#define BBR_DEFAULT_ROUTE 0x0008 /**< Add default route parameter to DIO */
#define BBR_REQUIRE_DAO_REFRESH 0x0010 /**< Do not increment PAN version number when active forces DAO update from nodes*/
#define BBR_GUA_SLAAC 0x0020 /**< in Global prefix use SLAAC address generation to reduce traffic during bootstrap */

/**
* Configure border router features.
Expand Down
15 changes: 12 additions & 3 deletions source/6LoWPAN/ws/ws_bbr_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,8 @@ static void ws_bbr_rpl_status_check(protocol_interface_info_entry_t *cur)

uint8_t local_prefix[8] = {0};
uint8_t global_prefix[8] = {0};
uint8_t prefix_flags = 0;
uint32_t prefix_lifetime = 0;

//tr_info("BBR status check");

Expand Down Expand Up @@ -596,7 +598,6 @@ static void ws_bbr_rpl_status_check(protocol_interface_info_entry_t *cur)
}
// TODO add global prefix
if (memcmp(global_prefix, ADDR_UNSPECIFIED, 8) != 0) {

tr_info("RPL global prefix activate %s", trace_ipv6_prefix(global_prefix, 64));
// Add default route to RPL
// Enable default routing to backbone
Expand All @@ -606,8 +607,12 @@ static void ws_bbr_rpl_status_check(protocol_interface_info_entry_t *cur)
return;
}
}
if (configuration & BBR_GUA_SLAAC) {
prefix_flags |= PIO_A;
prefix_lifetime = WS_ULA_LIFETIME;
}
ws_bbr_dhcp_server_start(cur, global_prefix, cur->ws_info->cfg->bbr.dhcp_address_lifetime);
rpl_control_update_dodag_prefix(protocol_6lowpan_rpl_root_dodag, global_prefix, 64, 0, 0, 0, false);
rpl_control_update_dodag_prefix(protocol_6lowpan_rpl_root_dodag, global_prefix, 64, prefix_flags, prefix_lifetime, prefix_lifetime, false);
// no check for failure should have

if (configuration & BBR_GUA_ROUTE) {
Expand All @@ -626,7 +631,11 @@ static void ws_bbr_rpl_status_check(protocol_interface_info_entry_t *cur)
* There is no status checks on prefix adds so this makes sure they are not lost
* DHCP validation should be done also
*/
rpl_control_update_dodag_prefix(protocol_6lowpan_rpl_root_dodag, current_global_prefix, 64, 0, 0, 0, false);
if (configuration & BBR_GUA_SLAAC) {
prefix_flags |= PIO_A;
prefix_lifetime = WS_ULA_LIFETIME;
}
rpl_control_update_dodag_prefix(protocol_6lowpan_rpl_root_dodag, current_global_prefix, 64, prefix_flags, prefix_lifetime, prefix_lifetime, false);

if (configuration & BBR_GUA_ROUTE) {
// Add also global prefix and route to RPL
Expand Down

0 comments on commit 76fc9d7

Please sign in to comment.