45
45
46
46
#define RPL_INSTANCE_ID 1
47
47
48
+ static uint8_t current_instance_id = RPL_INSTANCE_ID ;
49
+
48
50
#ifdef HAVE_WS_BORDER_ROUTER
49
51
50
52
#define WS_ULA_LIFETIME 24*3600
60
62
static int8_t backbone_interface_id = -1 ; // BBR backbone information
61
63
static uint16_t configuration = 0 ;
62
64
63
- static uint8_t static_dodag_prefix [8 ] = {0xfd , 0x00 , 0x61 , 0x72 , 0x6d };
65
+ static uint8_t static_dodag_prefix [8 ] = {0xfd , 0x00 , 0x72 , 0x83 , 0x7e };
66
+ static uint8_t static_dodag_id_prefix [8 ] = {0xfd , 0x00 , 0x61 , 0x72 , 0x6d };
64
67
static uint8_t current_dodag_id [16 ] = {0 };
65
68
static uint8_t current_local_prefix [8 ] = {0 };
66
69
static uint8_t current_global_prefix [8 ] = {0 };
@@ -120,9 +123,10 @@ static void ws_bbr_rpl_root_start(uint8_t *dodag_id)
120
123
if (protocol_6lowpan_rpl_root_dodag ) {
121
124
rpl_control_delete_dodag_root (protocol_6lowpan_rpl_domain , protocol_6lowpan_rpl_root_dodag );
122
125
protocol_6lowpan_rpl_root_dodag = NULL ;
126
+ current_instance_id ++ ;
123
127
}
124
128
125
- protocol_6lowpan_rpl_root_dodag = rpl_control_create_dodag_root (protocol_6lowpan_rpl_domain , RPL_INSTANCE_ID , dodag_id , & rpl_conf , rpl_conf .min_hop_rank_increase , RPL_GROUNDED | RPL_MODE_NON_STORING | RPL_DODAG_PREF (0 ));
129
+ protocol_6lowpan_rpl_root_dodag = rpl_control_create_dodag_root (protocol_6lowpan_rpl_domain , current_instance_id , dodag_id , & rpl_conf , rpl_conf .min_hop_rank_increase , RPL_GROUNDED | RPL_MODE_NON_STORING | RPL_DODAG_PREF (0 ));
126
130
if (!protocol_6lowpan_rpl_root_dodag ) {
127
131
tr_err ("RPL dodag init failed" );
128
132
return ;
@@ -137,6 +141,7 @@ static void ws_bbr_rpl_root_stop(void)
137
141
if (protocol_6lowpan_rpl_root_dodag ) {
138
142
rpl_control_delete_dodag_root (protocol_6lowpan_rpl_domain , protocol_6lowpan_rpl_root_dodag );
139
143
protocol_6lowpan_rpl_root_dodag = NULL ;
144
+ current_instance_id ++ ;
140
145
}
141
146
memset (current_local_prefix , 0 , 8 );
142
147
memset (current_global_prefix , 0 , 8 );
@@ -177,14 +182,14 @@ static int ws_bbr_static_dodagid_create(protocol_interface_info_entry_t *cur)
177
182
return 0 ;
178
183
}
179
184
// This address is only used if no other address available.
180
- if_address_entry_t * add_entry = icmpv6_slaac_address_add (cur , static_dodag_prefix , 64 , 0xffffffff , 0xffffffff , true, SLAAC_IID_FIXED );
185
+ if_address_entry_t * add_entry = icmpv6_slaac_address_add (cur , static_dodag_id_prefix , 64 , 0xffffffff , 0xffffffff , true, SLAAC_IID_FIXED );
181
186
if (!add_entry ) {
182
187
tr_err ("dodagid create failed" );
183
188
return -1 ;
184
189
}
185
190
memcpy (current_dodag_id , add_entry -> address , 16 );
186
191
tr_info ("BBR generate DODAGID %s" , trace_ipv6 (current_dodag_id ));
187
- addr_policy_table_add_entry (static_dodag_prefix , 64 , 2 , WS_NON_PREFFRED_LABEL );
192
+ addr_policy_table_add_entry (static_dodag_id_prefix , 64 , 2 , WS_NON_PREFFRED_LABEL );
188
193
189
194
return 0 ;
190
195
}
@@ -219,7 +224,7 @@ static void ws_bbr_dodag_get(uint8_t *local_prefix_ptr, uint8_t *global_prefix_p
219
224
memset (global_prefix_ptr , 0 , 8 );
220
225
221
226
// By default static dodagID prefix is used as local prefix
222
- memcpy (local_prefix_ptr , current_dodag_id , 8 );
227
+ memcpy (local_prefix_ptr , static_dodag_prefix , 8 );
223
228
ws_bbr_bb_static_prefix_get (local_prefix_ptr );
224
229
225
230
if (arm_net_address_get (backbone_interface_id , ADDR_IPV6_GP , global_address ) != 0 ) {
@@ -523,7 +528,7 @@ uint16_t ws_bbr_pan_size(protocol_interface_info_entry_t *cur)
523
528
prefix_ptr = current_local_prefix ;
524
529
}
525
530
526
- rpl_control_get_instance_dao_target_count (cur -> rpl_domain , RPL_INSTANCE_ID , NULL , prefix_ptr , & result );
531
+ rpl_control_get_instance_dao_target_count (cur -> rpl_domain , current_instance_id , NULL , prefix_ptr , & result );
527
532
if (result > 0 ) {
528
533
// remove the Border router from the PAN size
529
534
result -- ;
@@ -594,6 +599,7 @@ void ws_bbr_stop(int8_t interface_id)
594
599
595
600
rpl_control_delete_dodag_root (protocol_6lowpan_rpl_domain , protocol_6lowpan_rpl_root_dodag );
596
601
protocol_6lowpan_rpl_root_dodag = NULL ;
602
+ current_instance_id ++ ;
597
603
598
604
#else
599
605
(void )interface_id ;
@@ -606,7 +612,7 @@ int ws_bbr_configure(int8_t interface_id, uint16_t options)
606
612
(void )interface_id ;
607
613
if (protocol_6lowpan_rpl_root_dodag &&
608
614
options != configuration ) {
609
- //Configuration changed delete previus setup
615
+ //Configuration changed delete previous setup
610
616
ws_bbr_rpl_root_stop ();
611
617
}
612
618
configuration = options ;
0 commit comments