Skip to content

Commit aeb93a1

Browse files
author
Mika Tervonen
committed
Add support for bbr configuration that removes default route from DIO
New api bit added to configuration that removes the default route from DIO
1 parent 9b941af commit aeb93a1

File tree

7 files changed

+36
-11
lines changed

7 files changed

+36
-11
lines changed

nanostack/ws_bbr_api.h

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,10 @@ int ws_bbr_start(int8_t interface_id, int8_t backbone_interface_id);
4848
/**
4949
* Border router configuration options
5050
*/
51-
#define BBR_ULA_C 0x0001 /**< Static ULA prefix created automatically */
52-
#define BBR_GUA_ROUTE 0x0002 /**< More specific route is added for GUA prefix */
53-
#define BBR_BB_WAIT 0x0004 /**< Wait backbone availability before starting Wi-SUN network */
54-
55-
/*Deprecated configuration values */
56-
#define BBR_GUA_C 0x0000 /**< Routable prefix is learned from the backbone */
57-
#define BBR_GUA_SLAAC 0x0000 /**< Use SLAAC addressing in routable prefix */
58-
#define BBR_GUA_WAIT 0x0000 /**< Wait backbone availability before startingRPL dodag */
51+
#define BBR_ULA_C 0x0001 /**< Static ULA prefix created automatically */
52+
#define BBR_GUA_ROUTE 0x0002 /**< More specific route is added for GUA prefix */
53+
#define BBR_BB_WAIT 0x0004 /**< Wait backbone availability before starting Wi-SUN network */
54+
#define BBR_DEFAULT_ROUTE 0x0008 /**< Add default route parameter to DIO */
5955

6056
/**
6157
* Configure border router features.

source/6LoWPAN/ws/ws_bbr_api.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,9 @@ static void ws_bbr_rpl_status_check(protocol_interface_info_entry_t *cur)
423423
/*
424424
* Add default route to RPL
425425
*/
426-
rpl_control_update_dodag_route(protocol_6lowpan_rpl_root_dodag, NULL, 0, 0, WS_ROUTE_LIFETIME, false);
426+
if (configuration & BBR_DEFAULT_ROUTE) {
427+
rpl_control_update_dodag_route(protocol_6lowpan_rpl_root_dodag, NULL, 0, 0, WS_ROUTE_LIFETIME, false);
428+
}
427429

428430
/*
429431
* Create static ULA configuration or modify if needed

source/6LoWPAN/ws/ws_bootstrap.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2257,6 +2257,7 @@ static void ws_bootstrap_rpl_activate(protocol_interface_info_entry_t *cur)
22572257
rpl_control_set_callback(protocol_6lowpan_rpl_domain, ws_bootstrap_rpl_callback, ws_rpl_prefix_callback, ws_rpl_new_parent_callback, cur);
22582258
// If i am router I Do this
22592259
rpl_control_force_leaf(protocol_6lowpan_rpl_domain, leaf);
2260+
rpl_control_process_routes(protocol_6lowpan_rpl_domain, false); // Wi-SUN assumes that no default route needed
22602261
rpl_control_request_parent_link_confirmation(true);
22612262
rpl_control_set_dio_multicast_min_config_advertisment_count(WS_MIN_DIO_MULTICAST_CONFIG_ADVERTISMENT_COUNT);
22622263
rpl_control_set_dao_retry_count(WS_MAX_DAO_RETRIES);

source/RPL/rpl_control.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,7 @@ rpl_domain_t *rpl_control_create_domain(void)
417417
domain->callback = NULL;
418418
domain->cb_handle = NULL;
419419
domain->force_leaf = false;
420+
domain->process_routes = true;
420421
ns_list_add_to_start(&rpl_domains, domain);
421422

422423
addr_notification_register(rpl_control_addr_notifier);
@@ -672,6 +673,10 @@ void rpl_control_force_leaf(rpl_domain_t *domain, bool leaf)
672673
}
673674
}
674675
}
676+
void rpl_control_process_routes(rpl_domain_t *domain, bool process_routes)
677+
{
678+
domain->process_routes = process_routes;
679+
}
675680

676681
/* Check whether the options section of a RPL control message is well-formed */
677682
static bool rpl_control_options_well_formed(const uint8_t *dptr, uint_fast16_t dlen)
@@ -941,7 +946,6 @@ static void rpl_control_process_route_options(rpl_instance_t *instance, rpl_doda
941946
}
942947
rpl_dodag_update_dio_route(dodag, prefix, prefix_len, flags, lifetime, true);
943948
}
944-
945949
/* We do not purge unadvertised routes. Thus if the root wants to purge
946950
* a route before its lifetime is up, stopping advertising it is not
947951
* sufficient, it has to advertise it with low or zero lifetime. This fits

source/RPL/rpl_control.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ typedef struct rpl_domain {
5555
int8_t non_storing_downstream_interface;
5656
/* As part of shutdown, we can force entering leaf mode */
5757
bool force_leaf;
58+
/* if false routes are not set to routing table, instead default route is added for DODAGID */
59+
bool process_routes;
5860
rpl_domain_callback_t *callback;
5961
rpl_prefix_callback_t *prefix_cb;
6062
rpl_new_parent_callback_t *new_parent_add;
@@ -137,6 +139,8 @@ void rpl_control_increment_dtsn(struct rpl_dodag *dodag);
137139

138140
/* Force leaf behaviour on a domain - useful before shutdown, and in conjunction with poison */
139141
void rpl_control_force_leaf(rpl_domain_t *domain, bool leaf);
142+
/*Process routes from DIOs and add those as real routes. if routes are not processed assume DODAGID as default route*/
143+
void rpl_control_process_routes(rpl_domain_t *domain, bool process_routes);
140144

141145
/* Manually send poison on all existing instances a few times */
142146
void rpl_control_poison(rpl_domain_t *domain, uint8_t poison_count);

source/RPL/rpl_upward.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1364,6 +1364,10 @@ void rpl_dodag_update_implicit_system_routes(rpl_dodag_t *dodag, rpl_neighbour_t
13641364
/* Also add a specific route to the DODAGID */
13651365
ipv6_route_add_metric(dodag->id, 128, parent->interface_id, parent->ll_address, ROUTE_RPL_ROOT, parent, dodag->instance->id, default_lifetime, metric);
13661366

1367+
/* Check if we assume default route to DODAGID */
1368+
if (!dodag->instance->domain->process_routes) {
1369+
ipv6_route_add_metric(NULL, 0, parent->interface_id, parent->ll_address, ROUTE_RPL_ROOT, parent, dodag->instance->id, default_lifetime, metric);
1370+
}
13671371
}
13681372

13691373
/* Called when a DIO RIO route has been updated (but not the parent list) */
@@ -1372,9 +1376,13 @@ static void rpl_dodag_update_system_route(rpl_dodag_t *dodag, rpl_dio_route_t *r
13721376
if (!rpl_dodag_is_current(dodag)) {
13731377
return;
13741378
}
1375-
13761379
rpl_instance_t *instance = dodag->instance;
13771380

1381+
if (!instance->domain->process_routes) {
1382+
// We dont add actual routes and only create default route throuh DODAGID
1383+
return;
1384+
}
1385+
13781386
ns_list_foreach(rpl_neighbour_t, neighbour, &instance->candidate_neighbours) {
13791387
if (neighbour->dodag_parent) {
13801388
rpl_instance_update_system_dio_route(instance, neighbour, route);
@@ -1389,6 +1397,11 @@ static void rpl_instance_update_system_routes_through_parent(rpl_instance_t *ins
13891397

13901398
rpl_dodag_update_implicit_system_routes(dodag, parent);
13911399

1400+
if (!instance->domain->process_routes) {
1401+
// We dont add actual routes and only create default route through DODAGID
1402+
return;
1403+
}
1404+
13921405
/* Then add the specific routes listed in the DIO as ROUTE_RPL_DIO */
13931406
ns_list_foreach(rpl_dio_route_t, route, &dodag->routes) {
13941407
rpl_instance_update_system_dio_route(instance, parent, route);

test/nanostack/unittest/stub/rpl_control_stub.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,11 @@ void rpl_control_force_leaf(rpl_domain_t *domain, bool leaf)
164164

165165
}
166166

167+
void rpl_control_process_routes(rpl_domain_t *domain, bool process_routes)
168+
{
169+
170+
}
171+
167172
void rpl_control_transmit(struct rpl_domain *domain, struct protocol_interface_info_entry *cur, uint8_t code, struct buffer *buf, const uint8_t *dst)
168173
{
169174

0 commit comments

Comments
 (0)