@@ -158,16 +158,14 @@ static void ws_bbr_rpl_root_start(protocol_interface_info_entry_t *cur, uint8_t
158
158
159
159
}
160
160
161
+
161
162
static void ws_bbr_rpl_root_stop (void )
162
163
{
163
164
tr_info ("RPL root stop" );
164
165
if (protocol_6lowpan_rpl_root_dodag ) {
165
166
rpl_control_delete_dodag_root (protocol_6lowpan_rpl_domain , protocol_6lowpan_rpl_root_dodag );
166
167
protocol_6lowpan_rpl_root_dodag = NULL ;
167
168
}
168
- memset (current_local_prefix , 0 , 8 );
169
- memset (current_global_prefix , 0 , 8 );
170
- memset (current_dodag_id , 0 , 16 );
171
169
}
172
170
173
171
static int ws_border_router_proxy_validate (int8_t interface_id , uint8_t * address )
@@ -360,6 +358,31 @@ static void ws_bbr_dhcp_server_stop(protocol_interface_info_entry_t *cur, uint8_
360
358
361
359
}
362
360
361
+ static void ws_bbr_routing_stop (protocol_interface_info_entry_t * cur )
362
+ {
363
+ tr_info ("BBR routing stop" );
364
+ if (memcmp (current_local_prefix , ADDR_UNSPECIFIED , 8 ) != 0 ) {
365
+ ws_bbr_slaac_remove (cur , current_local_prefix );
366
+ memset (current_local_prefix , 0 , 8 );
367
+ }
368
+
369
+ if (memcmp (current_global_prefix , ADDR_UNSPECIFIED , 8 ) != 0 ) {
370
+ ws_bbr_dhcp_server_stop (cur , current_global_prefix );
371
+ if (backbone_interface_id >= 0 ) {
372
+ // Delete route to backbone if it exists
373
+ ipv6_route_add_with_info (current_global_prefix , 64 , backbone_interface_id , NULL , ROUTE_THREAD_BBR , NULL , 0 , 0 , 0 );
374
+ }
375
+ memset (current_global_prefix , 0 , 8 );
376
+ }
377
+
378
+ if (memcmp (current_dodag_id , ADDR_UNSPECIFIED , 8 ) != 0 ) {
379
+ ws_bbr_slaac_remove (cur , current_dodag_id );
380
+ memset (current_dodag_id , 0 , 16 );
381
+ }
382
+
383
+ ws_bbr_rpl_root_stop ();
384
+ }
385
+
363
386
static void ws_bbr_rpl_status_check (protocol_interface_info_entry_t * cur )
364
387
{
365
388
@@ -389,9 +412,8 @@ static void ws_bbr_rpl_status_check(protocol_interface_info_entry_t *cur)
389
412
*/
390
413
if (protocol_interface_address_compare (current_dodag_id ) != 0 ) {
391
414
//DODAGID is lost need to restart
392
- tr_warn ("DODAGID lost restart RPL" );
393
- memset (current_dodag_id , 0 , 16 );
394
- ws_bbr_rpl_root_stop ();
415
+ tr_warn ("DODAGID lost restart BBR" );
416
+ ws_bbr_routing_stop (cur );
395
417
return ;
396
418
}
397
419
@@ -651,18 +673,11 @@ void ws_bbr_stop(int8_t interface_id)
651
673
{
652
674
#ifdef HAVE_WS_BORDER_ROUTER
653
675
654
- backbone_interface_id = -1 ;
655
676
protocol_interface_info_entry_t * cur = protocol_stack_interface_info_get_by_id (interface_id );
656
677
657
- ws_bbr_slaac_remove (cur , current_dodag_id );
658
- if (memcmp (current_local_prefix , ADDR_UNSPECIFIED , 8 ) != 0 ) {
659
- ws_bbr_slaac_remove (cur , current_local_prefix );
660
- }
661
- if (memcmp (current_global_prefix , ADDR_UNSPECIFIED , 8 ) != 0 ) {
662
- ws_bbr_dhcp_server_stop (cur , current_global_prefix );
663
- }
678
+ ws_bbr_routing_stop (cur );
664
679
665
- ws_bbr_rpl_root_stop () ;
680
+ backbone_interface_id = -1 ;
666
681
current_instance_id ++ ;
667
682
668
683
#else
@@ -673,11 +688,12 @@ int ws_bbr_configure(int8_t interface_id, uint16_t options)
673
688
{
674
689
#ifdef HAVE_WS_BORDER_ROUTER
675
690
676
- (void )interface_id ;
691
+ protocol_interface_info_entry_t * cur = protocol_stack_interface_info_get_by_id (interface_id );
692
+
677
693
if (protocol_6lowpan_rpl_root_dodag &&
678
694
options != configuration ) {
679
695
//Configuration changed delete previous setup
680
- ws_bbr_rpl_root_stop ( );
696
+ ws_bbr_routing_stop ( cur );
681
697
}
682
698
configuration = options ;
683
699
return 0 ;
0 commit comments