Skip to content

Commit

Permalink
RPL dao dynamic timeout
Browse files Browse the repository at this point in the history
DAO lifetime will dynamic when Imin define 64seconds delay.
Smaller values will use 40 seconds value.
MAX wait delay is cutted to 14.5min based on 540 seconds.
  • Loading branch information
Juha Heiuskanen committed Dec 21, 2020
1 parent 00bbd02 commit 29b387b
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions source/RPL/rpl_downward.c
Original file line number Diff line number Diff line change
Expand Up @@ -885,9 +885,24 @@ void rpl_instance_send_dao_update(rpl_instance_t *instance)
instance->requested_dao_ack = need_ack;
instance->dao_in_transit = true;
if (instance->dao_attempt < 16) {
uint32_t t = (uint32_t) rpl_policy_initial_dao_ack_wait(instance->domain, mop) << instance->dao_attempt;
t = randLIB_randomise_base(t, 0x4000, 0xC000);
instance->dao_retry_timer = t <= 0xffff ? t : 0xffff;

uint32_t delay = rpl_policy_initial_dao_ack_wait(instance->domain, mop);
if (delay < dodag->dio_timer_params.Imin) {
//Use Imin Based on delay if it is longer than cache retry
delay = dodag->dio_timer_params.Imin;
}
//Multiply Delay by attempt
delay = delay << instance->dao_attempt;

if (delay > 5400) {
//MAX base 540 seconds (9min)
delay = 5400;
}

// 0.5 - 1.5 *t randomized base delay
delay = randLIB_randomise_base(delay, 0x4000, 0xC000);

instance->dao_retry_timer = delay;
} else {
instance->dao_retry_timer = 0xffff;
}
Expand Down

0 comments on commit 29b387b

Please sign in to comment.