@@ -73,9 +73,9 @@ static const trickle_params_t trickle_params_pan_discovery = {
73
73
74
74
static void ws_bootstrap_event_handler (arm_event_s * event );
75
75
static void ws_bootstrap_state_change (protocol_interface_info_entry_t * cur , icmp_state_t nwk_bootstrap_state );
76
- static bool ws_bootstrap_state_active (struct protocol_interface_info_entry * cur );
76
+ //static bool ws_bootstrap_state_active(struct protocol_interface_info_entry *cur);
77
+ //static bool ws_bootstrap_state_wait_rpl(struct protocol_interface_info_entry *cur);
77
78
static bool ws_bootstrap_state_discovery (struct protocol_interface_info_entry * cur );
78
- static bool ws_bootstrap_state_wait_rpl (struct protocol_interface_info_entry * cur );
79
79
static int8_t ws_bootsrap_event_trig (ws_bootsrap_event_type_e event_type , int8_t interface_id , arm_library_event_priority_e priority , void * event_data );
80
80
81
81
static bool ws_bootstrap_neighbor_info_request (struct protocol_interface_info_entry * interface , const uint8_t * mac_64 , llc_neighbour_req_t * neighbor_buffer , bool request_new );
@@ -1058,10 +1058,6 @@ static void ws_bootstrap_rpl_activate(protocol_interface_info_entry_t *cur)
1058
1058
rpl_control_force_leaf (protocol_6lowpan_rpl_domain , leaf );
1059
1059
1060
1060
cur -> ws_info -> rpl_state = 0xff ; // Set invalid state and learn from event
1061
- if (cur -> bootsrap_mode == ARM_NWK_BOOTSRAP_MODE_6LoWPAN_ROUTER ) {
1062
- // TODO Multicast DIS should be sent only if no DIO heard for some time
1063
- rpl_control_transmit_dis (cur -> rpl_domain , cur , 0 , 0 , NULL , 0 , ADDR_LINK_LOCAL_ALL_RPL_NODES );
1064
- }
1065
1061
}
1066
1062
1067
1063
static void ws_bootstrap_network_start (protocol_interface_info_entry_t * cur )
@@ -1146,6 +1142,14 @@ static void ws_bootstrap_start_configuration_learn(protocol_interface_info_entry
1146
1142
trickle_start (& cur -> ws_info -> trickle_pan_config_solicit , & trickle_params_pan_discovery );
1147
1143
trickle_inconsistent_heard (& cur -> ws_info -> trickle_pan_config_solicit , & trickle_params_pan_discovery );
1148
1144
}
1145
+ static void ws_bootstrap_rpl_scan_start (protocol_interface_info_entry_t * cur )
1146
+ {
1147
+ tr_debug ("Start RPL learn" );
1148
+ // routers wait until RPL root is contacted
1149
+ ws_bootstrap_state_change (cur , ER_RPL_SCAN );
1150
+ // Set timeout for check to 30 -60 seconds
1151
+ cur -> bootsrap_state_machine_cnt = randLIB_get_random_in_range (WS_RPL_DIS_INITIAL_TIMEOUT /2 ,WS_RPL_DIS_INITIAL_TIMEOUT );
1152
+ }
1149
1153
1150
1154
/*
1151
1155
* Event transitions
@@ -1394,8 +1398,7 @@ static void ws_bootstrap_event_handler(arm_event_s *event)
1394
1398
if (cur -> bootsrap_mode == ARM_NWK_BOOTSRAP_MODE_6LoWPAN_BORDER_ROUTER ) {
1395
1399
ws_bootstrap_event_routing_ready (cur );
1396
1400
} else {
1397
- // routers wait until RPL root is contacted
1398
- ws_bootstrap_state_change (cur , ER_RPL_SCAN );
1401
+ ws_bootstrap_rpl_scan_start (cur );
1399
1402
}
1400
1403
break ;
1401
1404
case WS_ROUTING_READY :
@@ -1460,13 +1463,23 @@ void ws_bootstrap_rpl_wait_process(protocol_interface_info_entry_t *cur)
1460
1463
{
1461
1464
1462
1465
if (cur -> ws_info -> rpl_state == RPL_EVENT_DAO_DONE ) {
1463
- // Trigger statemachine check
1466
+ // RPL routing is ready
1464
1467
ws_bootstrap_event_routing_ready (cur );
1468
+ } else if (!rpl_control_have_dodag (cur -> rpl_domain )){
1469
+ // RPL not ready send DIS message if possible
1470
+ if (cur -> bootsrap_mode == ARM_NWK_BOOTSRAP_MODE_6LoWPAN_ROUTER ) {
1471
+ // TODO Multicast DIS should be sent only if no DIO heard for some time
1472
+ rpl_control_transmit_dis (cur -> rpl_domain , cur , 0 , 0 , NULL , 0 , ADDR_LINK_LOCAL_ALL_RPL_NODES );
1473
+ }
1474
+ // set timer for next DIS
1475
+ cur -> bootsrap_state_machine_cnt = randLIB_get_random_in_range (WS_RPL_DIS_TIMEOUT /2 , WS_RPL_DIS_TIMEOUT );
1465
1476
}
1466
1477
return ;
1467
1478
}
1468
1479
1469
- static bool ws_bootstrap_state_active (struct protocol_interface_info_entry * cur )
1480
+ /*
1481
+
1482
+ static bool ws_bootstrap_state_active(struct protocol_interface_info_entry *cur)
1470
1483
{
1471
1484
if(cur->nwk_bootstrap_state == ER_BOOTSRAP_DONE) {
1472
1485
return true;
@@ -1491,7 +1504,7 @@ static bool ws_bootstrap_state_wait_rpl(struct protocol_interface_info_entry *cu
1491
1504
}
1492
1505
return false;
1493
1506
}
1494
-
1507
+ */
1495
1508
static bool ws_bootstrap_state_discovery (struct protocol_interface_info_entry * cur )
1496
1509
{
1497
1510
if (cur -> nwk_bootstrap_state == ER_ACTIVE_SCAN ) {
0 commit comments