Skip to content

Commit f578c26

Browse files
author
Mika Tervonen
committed
Updated border router configuration
DAG_MAX_RANK_INCREASE is now 0 causing networks not to automatically go down in rank for this reason Border router now updates RPL version in every 12 minutes Moved Border router version timer to Border router file
1 parent 1ce2385 commit f578c26

File tree

5 files changed

+67
-51
lines changed

5 files changed

+67
-51
lines changed

source/6LoWPAN/ws/ws_bbr_api.c

Lines changed: 55 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include "6LoWPAN/Bootstraps/protocol_6lowpan_interface.h"
2727
#include "6LoWPAN/ws/ws_config.h"
2828
#include "6LoWPAN/ws/ws_common.h"
29+
#include "6LoWPAN/ws/ws_bootstrap.h"
2930
#include "RPL/rpl_control.h"
3031
#include "RPL/rpl_data.h"
3132
#include "Common_Protocols/icmpv6.h"
@@ -43,25 +44,21 @@
4344
static void ws_bbr_rpl_root_activate(uint8_t *dodag_prefix, uint8_t *dodag_id)
4445
{
4546
tr_debug("RPL root Activate");
46-
rpl_dodag_conf_t new_conf;
47-
48-
// Lifetime values
49-
new_conf.default_lifetime = 120;
50-
new_conf.lifetime_unit = 60;
51-
new_conf.objective_code_point = 1; // MRHOF algorithm used
52-
new_conf.authentication = 0;
53-
new_conf.path_control_size = 0;
54-
55-
56-
// TODO temporary values spec says 0
57-
new_conf.dag_max_rank_increase = 3072;
58-
new_conf.min_hop_rank_increase = 128;// 24 Hop networks 3072/128 == 24
59-
60-
61-
// DIO configuration
62-
new_conf.dio_interval_min = WS_RPL_DIO_IMIN;
63-
new_conf.dio_interval_doublings = WS_RPL_DIO_DOUBLING;
64-
new_conf.dio_redundancy_constant = WS_RPL_DIO_REDUDANCY;
47+
rpl_dodag_conf_t new_conf =
48+
{
49+
// Lifetime values
50+
.default_lifetime = 120,
51+
.lifetime_unit = 60,
52+
.objective_code_point = 1, // MRHOF algorithm used
53+
.authentication = 0,
54+
.path_control_size = 0,
55+
.dag_max_rank_increase = 0,
56+
.min_hop_rank_increase = 128,
57+
// DIO configuration
58+
.dio_interval_min = WS_RPL_DIO_IMIN,
59+
.dio_interval_doublings = WS_RPL_DIO_DOUBLING,
60+
.dio_redundancy_constant = WS_RPL_DIO_REDUNDANCY
61+
};
6562

6663
rpl_data_init_root();
6764
protocol_6lowpan_rpl_root_dodag = rpl_control_create_dodag_root(protocol_6lowpan_rpl_domain, RPL_INSTANCE_ID, dodag_id, &new_conf, new_conf.min_hop_rank_increase, RPL_GROUNDED | RPL_MODE_NON_STORING | RPL_DODAG_PREF(0));
@@ -118,27 +115,48 @@ void ws_bbr_seconds_timer(protocol_interface_info_entry_t *cur, uint32_t seconds
118115
return;
119116
}
120117

121-
if (protocol_6lowpan_rpl_root_dodag) {
118+
if (!protocol_6lowpan_rpl_root_dodag) {
122119
// RPL configured
120+
// 1. Wait for backend connection
121+
// 2. request own prefix if available
122+
// 3. check if connected to RPL root
123+
// 3.1 check if Globally connected root available (Backend with own mesh prefix)
124+
// 3.2 check if Globally connected root available (ND proxy)
125+
// 3.3 Check if grounded root available (Backend connectivity to static config in backend)
126+
// 3.4 only local connectivity (No backend)
127+
// 4. If I can provide better connectivity start root
128+
// 4.1. If no other roots or backend start static root
129+
// 4.2. If backend gets connectivity add global root
130+
// 4.3. If backend loses connectivity remove global root, leave static
131+
// 5. if someone has offered better connected root remove own
132+
// 6. if multiple same level roots
133+
// 6.1 lower connectivity must drop
134+
// 6.2 lowest dodag ID remains
135+
136+
ws_bbr_root_start(cur);
123137
return;
124138
}
125-
// 1. Wait for backend connection
126-
// 2. request own prefix if available
127-
// 3. check if connected to RPL root
128-
// 3.1 check if Globally connected root available (Backend with own mesh prefix)
129-
// 3.2 check if Globally connected root available (ND proxy)
130-
// 3.3 Check if grounded root available (Backend connectivity to static config in backend)
131-
// 3.4 only local connectivity (No backend)
132-
// 4. If I can provide better connectivity start root
133-
// 4.1. If no other roots or backend start static root
134-
// 4.2. If backend gets connectivity add global root
135-
// 4.3. If backend loses connectivity remove global root, leave static
136-
// 5. if someone has offered better connected root remove own
137-
// 6. if multiple same level roots
138-
// 6.1 lower connectivity must drop
139-
// 6.2 lowest dodag ID remains
140-
141-
ws_bbr_root_start(cur);
139+
140+
// Normal BBR operation
141+
if (cur->ws_info->pan_version_timer > seconds ) {
142+
cur->ws_info->pan_version_timer -= seconds;
143+
} else {
144+
// Border router has timed out
145+
tr_debug("Border router version number update");
146+
cur->ws_info->pan_version_timer = PAN_VERSION_LIFETIME;
147+
cur->ws_info->pan_information.pan_version++;
148+
// Inconsistent for border router to make information distribute faster
149+
ws_bootstrap_configuration_trickle_reset(cur);
150+
151+
// We update the RPL version in same time to allow nodes to reselect parent
152+
// As configuration is made so that devices cant move downward in dodag this allows it
153+
// TODO think the correct rate for this
154+
if (cur->ws_info->pan_information.pan_version % 3 == 0) {
155+
// Third the rate of configuration version change at default 12 minutes
156+
rpl_control_increment_dodag_version(protocol_6lowpan_rpl_root_dodag);
157+
}
158+
}
159+
142160
}
143161

144162
uint16_t test_pan_size_override = 0xffff;

source/6LoWPAN/ws/ws_bootstrap.c

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,6 +1104,10 @@ void ws_bootstrap_event_routing_ready(protocol_interface_info_entry_t *cur)
11041104
{
11051105
ws_bootsrap_event_trig(WS_ROUTING_READY, cur->bootStrapId, ARM_LIB_LOW_PRIORITY_EVENT, NULL);
11061106
}
1107+
void ws_bootstrap_configuration_trickle_reset(protocol_interface_info_entry_t *cur)
1108+
{
1109+
trickle_inconsistent_heard(&cur->ws_info->trickle_pan_config,&trickle_params_pan_configuration);
1110+
}
11071111

11081112

11091113
static void ws_bootstrap_pan_advert_solicit(protocol_interface_info_entry_t *cur)
@@ -1445,19 +1449,6 @@ void ws_bootstrap_seconds_timer(protocol_interface_info_entry_t *cur, uint32_t s
14451449
tr_info("Send PAN configuration");
14461450
ws_bootstrap_pan_config(cur);
14471451
}
1448-
if (cur->bootsrap_mode == ARM_NWK_BOOTSRAP_MODE_6LoWPAN_BORDER_ROUTER) {
1449-
// update version number
1450-
if (cur->ws_info->pan_version_timer > seconds ) {
1451-
cur->ws_info->pan_version_timer -= seconds;
1452-
} else {
1453-
// Border router has timed out
1454-
tr_debug("Border router version number update");
1455-
cur->ws_info->pan_version_timer = PAN_VERSION_LIFETIME;
1456-
cur->ws_info->pan_information.pan_version++;
1457-
// Inconsistent for border router to make information distribute faster
1458-
trickle_inconsistent_heard(&cur->ws_info->trickle_pan_config,&trickle_params_pan_configuration);
1459-
}
1460-
}
14611452
if (cur->ws_info->pan_version_timeout_timer){
14621453
// PAN version timer running
14631454
if (cur->ws_info->pan_version_timeout_timer > seconds ) {

source/6LoWPAN/ws/ws_bootstrap.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ void ws_bootstrap_event_operation_start(protocol_interface_info_entry_t *cur);
4646

4747
void ws_bootstrap_event_routing_ready(protocol_interface_info_entry_t *cur);
4848

49+
void ws_bootstrap_configuration_trickle_reset(protocol_interface_info_entry_t *cur);
50+
4951
void ws_bootstrap_seconds_timer(protocol_interface_info_entry_t *cur, uint32_t seconds);
5052

5153
#else

source/6LoWPAN/ws/ws_config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
#define WS_RPL_DIO_IMIN 15
3030
#define WS_RPL_DIO_DOUBLING 2
31-
#define WS_RPL_DIO_REDUDANCY 1
31+
#define WS_RPL_DIO_REDUNDANCY 1
3232

3333

3434
/* Border router version change interval

test/nanostack/unittest/stub/ws_bootstrap_stub.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,8 @@ void ws_bootstrap_state_machine(protocol_interface_info_entry_t *cur)
4040

4141
return;
4242
}
43+
44+
void ws_bootstrap_configuration_trickle_reset(protocol_interface_info_entry_t *cur)
45+
{
46+
47+
}

0 commit comments

Comments
 (0)