@@ -1278,7 +1278,7 @@ static void ws_bootstrap_pan_config_analyse(struct protocol_interface_info_entry
12781278 tr_info ("Updated PAN configuration own:%d, heard:%d" , cur -> ws_info -> pan_information .pan_version , pan_version );
12791279
12801280 // restart PAN version timer
1281- cur -> ws_info -> pan_version_timeout_timer = ws_common_version_timeout_get (cur -> ws_info -> network_size_config );
1281+ cur -> ws_info -> pan_timeout_timer = ws_common_version_timeout_get (cur -> ws_info -> network_size_config );
12821282 cur -> ws_info -> pan_information .pan_version = pan_version ;
12831283
12841284 ws_pae_controller_gtk_hash_update (cur , gtkhash_ptr );
@@ -2017,6 +2017,10 @@ static void ws_bootstrap_rpl_callback(rpl_event_t event, void *handle)
20172017 ws_pae_controller_nw_info_set (cur , cur -> ws_info -> network_pan_id , cur -> ws_info -> network_name );
20182018 // Network key is valid
20192019 ws_pae_controller_nw_key_valid (cur );
2020+
2021+ // After successful DAO ACK connection to border router is verified
2022+ cur -> ws_info -> pan_timeout_timer = ws_common_version_timeout_get (cur -> ws_info -> network_size_config );
2023+
20202024 }
20212025
20222026 ws_set_fhss_hop (cur );
@@ -2274,6 +2278,9 @@ static void ws_bootstrap_rpl_activate(protocol_interface_info_entry_t *cur)
22742278 rpl_control_set_memory_limits (WS_NODE_RPL_SOFT_MEM_LIMIT , WS_NODE_RPL_HARD_MEM_LIMIT );
22752279 }
22762280
2281+ // Set the minimum target refresh to sen DAO registrations before pan timeout
2282+ rpl_control_set_minimum_dao_target_refresh (WS_RPL_DAO_MAX_TIMOUT );
2283+
22772284 cur -> ws_info -> rpl_state = 0xff ; // Set invalid state and learn from event
22782285}
22792286
@@ -2307,7 +2314,8 @@ static void ws_bootstrap_advertise_start(protocol_interface_info_entry_t *cur)
23072314
23082315static void ws_bootstrap_pan_version_increment (protocol_interface_info_entry_t * cur )
23092316{
2310- cur -> ws_info -> pan_version_timer = 1 ;
2317+ (void )cur ;
2318+ ws_bbr_pan_version_increase (cur );
23112319}
23122320
23132321// Start network scan
@@ -2319,7 +2327,7 @@ static void ws_bootstrap_start_discovery(protocol_interface_info_entry_t *cur)
23192327 ws_bootstrap_state_change (cur , ER_ACTIVE_SCAN );
23202328 cur -> nwk_nd_re_scan_count = 0 ;
23212329 cur -> ws_info -> configuration_learned = false;
2322- cur -> ws_info -> pan_version_timeout_timer = 0 ;
2330+ cur -> ws_info -> pan_timeout_timer = 0 ;
23232331
23242332 // Clear learned neighbours
23252333 ws_bootstrap_neighbor_list_clean (cur );
@@ -2471,6 +2479,11 @@ static void ws_bootstrap_rpl_scan_start(protocol_interface_info_entry_t *cur)
24712479 // Set timeout for check to 30 -60 seconds
24722480 cur -> bootsrap_state_machine_cnt = randLIB_get_random_in_range (WS_RPL_DIS_INITIAL_TIMEOUT / 2 , WS_RPL_DIS_INITIAL_TIMEOUT );
24732481 }
2482+ /* While in Join State 4, if a non Border Router determines it has been unable to communicate with the PAN Border
2483+ * Router for an interval of PAN_TIMEOUT, a node MUST assume failure of the PAN Border Router and MUST
2484+ * Transition to Join State 1
2485+ */
2486+ cur -> ws_info -> pan_timeout_timer = ws_common_version_timeout_get (cur -> ws_info -> network_size_config );
24742487}
24752488
24762489/*
@@ -2685,6 +2698,9 @@ static void ws_bootstrap_event_handler(arm_event_s *event)
26852698 cur -> ws_info -> pending_key_index_info .state = NO_PENDING_PROCESS ;
26862699 cur -> mac_parameters -> mac_default_key_index = 0 ;
26872700
2701+ // Clear parent blacklist
2702+ blacklist_clear ();
2703+
26882704 // All trickle timers stopped to allow entry from any state
26892705 cur -> ws_info -> trickle_pa_running = false;
26902706 cur -> ws_info -> trickle_pc_running = false;
@@ -2715,7 +2731,7 @@ static void ws_bootstrap_event_handler(arm_event_s *event)
27152731
27162732 uint8_t * gtkhash = ws_pae_controller_gtk_hash_ptr_get (cur );
27172733 ws_llc_set_gtkhash (cur , gtkhash );
2718- cur -> ws_info -> pan_version_timer = ws_common_version_lifetime_get (cur -> ws_info -> network_size_config );
2734+ ws_bbr_pan_version_increase (cur );
27192735
27202736 // Set default parameters for FHSS when starting a discovery
27212737 ws_fhss_border_router_configure (cur );
@@ -3018,12 +3034,23 @@ void ws_bootstrap_trickle_timer(protocol_interface_info_entry_t *cur, uint16_t t
30183034
30193035void ws_bootstrap_seconds_timer (protocol_interface_info_entry_t * cur , uint32_t seconds )
30203036{
3021- if (cur -> ws_info -> pan_version_timeout_timer ) {
3037+ /* Border router keep alive check
3038+ */
3039+ if (cur -> ws_info -> pan_timeout_timer ) {
30223040 // PAN version timer running
3023- if (cur -> ws_info -> pan_version_timeout_timer > seconds ) {
3024- cur -> ws_info -> pan_version_timeout_timer -= seconds ;
3041+ if (cur -> ws_info -> pan_timeout_timer > seconds ) {
3042+ cur -> ws_info -> pan_timeout_timer -= seconds ;
3043+ if (cur -> ws_info -> pan_timeout_timer < ws_common_version_timeout_get (cur -> ws_info -> network_size_config ) / 10 ) {
3044+ /* pan timeout is closing need to verify that DAO is tested before the pan times out.
3045+ This will give some extra time for RPL to find better parents.
3046+ Border router liveliness can be checked from version number change or from successful DAO registrations
3047+ in this case there has not been any version number changes during this PAN lifetime.
3048+ */
3049+ rpl_control_dao_timeout (cur -> rpl_domain , 20 );
3050+ }
30253051 } else {
30263052 // Border router has timed out
3053+ cur -> ws_info -> pan_timeout_timer = 0 ;
30273054 tr_warn ("Border router has timed out" );
30283055 ws_bootstrap_event_discovery_start (cur );
30293056 }
0 commit comments