@@ -178,7 +178,7 @@ static void rpl_downward_target_refresh(rpl_dao_target_t *target)
178178 target -> info .non_root .path_lifetime = 0 ;
179179}
180180
181- static bool rpl_instance_parent_selection_ready (rpl_instance_t * instance )
181+ bool rpl_instance_parent_selection_ready (rpl_instance_t * instance )
182182{
183183 rpl_neighbour_t * neighbour = ns_list_get_first (& instance -> candidate_neighbours );
184184 if (neighbour && neighbour -> dodag_parent && neighbour -> dao_path_control ) {
@@ -407,7 +407,7 @@ void rpl_instance_dao_trigger(rpl_instance_t *instance, uint16_t delay)
407407 }
408408 if (instance -> delay_dao_timer == 0 || instance -> delay_dao_timer > delay ) {
409409 instance -> delay_dao_timer = delay ;
410- // tr_debug("DAO trigger %" PRIu16, delay);
410+ tr_debug ("DAO trigger %" PRIu16 , delay );
411411 }
412412}
413413
@@ -723,7 +723,11 @@ void rpl_instance_send_dao_update(rpl_instance_t *instance)
723723 instance -> dao_in_transit = false;
724724 instance -> dao_attempt = 0 ;
725725 instance -> dao_retry_timer = 0 ;
726- instance -> delay_dao_timer = 0 ;
726+ // Primary parent deletion will trigger parent selection
727+ // While waiting, leave dao_timer "running" to indicate DAO incomplete
728+ // This is checked in rpl_upward_dio_timer to delay initial DIO sending
729+ // If we stopped the timer, that code might think DAO registration was complete
730+ instance -> delay_dao_timer = 0xffff ;
727731 return ;
728732 }
729733
@@ -1863,9 +1867,6 @@ static void rpl_instance_address_registration_cancel(rpl_instance_t *instance)
18631867
18641868 instance -> wait_response = NULL ;
18651869 instance -> pending_neighbour_confirmation = false;
1866- instance -> delay_dao_timer = 0 ;
1867- instance -> dao_in_transit = false;
1868- instance -> dao_retry_timer = 0 ;
18691870}
18701871
18711872static void rpl_instance_address_registration_retry (rpl_dao_target_t * dao_target )
@@ -1881,8 +1882,15 @@ void rpl_instance_parent_address_reg_timer_update(rpl_instance_t *instance, uint
18811882 return ; //No need validate any confirmation
18821883 }
18831884
1885+ if (rpl_instance_am_root (instance )) {
1886+ tr_debug ("Root shuold not handle this" );
1887+ rpl_instance_address_registration_cancel (instance );
1888+ return ;
1889+ }
1890+
18841891 //Verify that we have selected parent and it have a dao path control
18851892 if (!rpl_instance_parent_selection_ready (instance )) {
1893+ tr_debug ("Parent select not ready" );
18861894 rpl_instance_address_registration_cancel (instance );
18871895 return ;
18881896 }
@@ -1925,6 +1933,7 @@ void rpl_instance_parent_address_reg_timer_update(rpl_instance_t *instance, uint
19251933
19261934 if_address_entry_t * address = rpl_interface_addr_get (interface , dao_target -> prefix );
19271935 if (!address ) {
1936+ tr_debug ("No address for req" );
19281937 rpl_instance_address_registration_cancel (instance );
19291938 return ;
19301939 }
0 commit comments