@@ -178,7 +178,7 @@ static void rpl_downward_target_refresh(rpl_dao_target_t *target)
178
178
target -> info .non_root .path_lifetime = 0 ;
179
179
}
180
180
181
- static bool rpl_instance_parent_selection_ready (rpl_instance_t * instance )
181
+ bool rpl_instance_parent_selection_ready (rpl_instance_t * instance )
182
182
{
183
183
rpl_neighbour_t * neighbour = ns_list_get_first (& instance -> candidate_neighbours );
184
184
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)
407
407
}
408
408
if (instance -> delay_dao_timer == 0 || instance -> delay_dao_timer > delay ) {
409
409
instance -> delay_dao_timer = delay ;
410
- // tr_debug("DAO trigger %" PRIu16, delay);
410
+ tr_debug ("DAO trigger %" PRIu16 , delay );
411
411
}
412
412
}
413
413
@@ -723,7 +723,11 @@ void rpl_instance_send_dao_update(rpl_instance_t *instance)
723
723
instance -> dao_in_transit = false;
724
724
instance -> dao_attempt = 0 ;
725
725
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 ;
727
731
return ;
728
732
}
729
733
@@ -1863,9 +1867,6 @@ static void rpl_instance_address_registration_cancel(rpl_instance_t *instance)
1863
1867
1864
1868
instance -> wait_response = NULL ;
1865
1869
instance -> pending_neighbour_confirmation = false;
1866
- instance -> delay_dao_timer = 0 ;
1867
- instance -> dao_in_transit = false;
1868
- instance -> dao_retry_timer = 0 ;
1869
1870
}
1870
1871
1871
1872
static 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
1881
1882
return ; //No need validate any confirmation
1882
1883
}
1883
1884
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
+
1884
1891
//Verify that we have selected parent and it have a dao path control
1885
1892
if (!rpl_instance_parent_selection_ready (instance )) {
1893
+ tr_debug ("Parent select not ready" );
1886
1894
rpl_instance_address_registration_cancel (instance );
1887
1895
return ;
1888
1896
}
@@ -1925,6 +1933,7 @@ void rpl_instance_parent_address_reg_timer_update(rpl_instance_t *instance, uint
1925
1933
1926
1934
if_address_entry_t * address = rpl_interface_addr_get (interface , dao_target -> prefix );
1927
1935
if (!address ) {
1936
+ tr_debug ("No address for req" );
1928
1937
rpl_instance_address_registration_cancel (instance );
1929
1938
return ;
1930
1939
}
0 commit comments