@@ -73,9 +73,9 @@ static const trickle_params_t trickle_params_pan_discovery = {
7373
7474static void ws_bootstrap_event_handler (arm_event_s * event );
7575static 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);
7778static 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 );
7979static 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 );
8080
8181static 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)
10581058 rpl_control_force_leaf (protocol_6lowpan_rpl_domain , leaf );
10591059
10601060 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- }
10651061}
10661062
10671063static 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
11461142 trickle_start (& cur -> ws_info -> trickle_pan_config_solicit , & trickle_params_pan_discovery );
11471143 trickle_inconsistent_heard (& cur -> ws_info -> trickle_pan_config_solicit , & trickle_params_pan_discovery );
11481144}
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+ }
11491153
11501154/*
11511155 * Event transitions
@@ -1394,8 +1398,7 @@ static void ws_bootstrap_event_handler(arm_event_s *event)
13941398 if (cur -> bootsrap_mode == ARM_NWK_BOOTSRAP_MODE_6LoWPAN_BORDER_ROUTER ) {
13951399 ws_bootstrap_event_routing_ready (cur );
13961400 } 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 );
13991402 }
14001403 break ;
14011404 case WS_ROUTING_READY :
@@ -1460,13 +1463,23 @@ void ws_bootstrap_rpl_wait_process(protocol_interface_info_entry_t *cur)
14601463{
14611464
14621465 if (cur -> ws_info -> rpl_state == RPL_EVENT_DAO_DONE ) {
1463- // Trigger statemachine check
1466+ // RPL routing is ready
14641467 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 );
14651476 }
14661477 return ;
14671478}
14681479
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)
14701483{
14711484 if(cur->nwk_bootstrap_state == ER_BOOTSRAP_DONE) {
14721485 return true;
@@ -1491,7 +1504,7 @@ static bool ws_bootstrap_state_wait_rpl(struct protocol_interface_info_entry *cu
14911504 }
14921505 return false;
14931506}
1494-
1507+ */
14951508static bool ws_bootstrap_state_discovery (struct protocol_interface_info_entry * cur )
14961509{
14971510 if (cur -> nwk_bootstrap_state == ER_ACTIVE_SCAN ) {
0 commit comments