Skip to content

Commit 9ce41f1

Browse files
author
Juha Heiskanen
committed
Pendig address registration will move DAO send.
Wi-sun node must wait min 5 seconds negative ARO before send DAO. Change-Id: Ib4fb1050403bbbdfe438a269f6d1e489a3a7028d
1 parent f54ea6b commit 9ce41f1

File tree

3 files changed

+58
-0
lines changed

3 files changed

+58
-0
lines changed

source/RPL/rpl_downward.c

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,7 @@ bool rpl_instance_address_registration_done(protocol_interface_info_entry_t *int
624624
addr->addr_reg_done |= neighbour->dao_path_control;
625625
/* State_timer is 1/10 s. Set renewal to 75-85% of lifetime */
626626
addr->state_timer = (addr->preferred_lifetime * randLIB_get_random_in_range(75, 85) / 10);
627+
neighbour->dao_wait_after_registration = 6;
627628
} else {
628629
tr_error("Address registration failed");
629630
rpl_delete_neighbour(instance, neighbour);
@@ -640,6 +641,30 @@ bool rpl_instance_address_registration_done(protocol_interface_info_entry_t *int
640641
return false;
641642
}
642643

644+
static bool rpl_instance_dao_address_reg_pending_check(rpl_instance_t *instance)
645+
{
646+
//Validate that there is no pending address at list
647+
rpl_neighbour_t *neighbour = ns_list_get_first(&instance->candidate_neighbours);
648+
if (!neighbour) {
649+
return true;
650+
}
651+
protocol_interface_info_entry_t *cur = protocol_stack_interface_info_get_by_id(neighbour->interface_id);
652+
if (!cur) {
653+
return true;
654+
}
655+
656+
ns_list_foreach(if_address_entry_t, addr, &cur->ip_addresses) {
657+
658+
/* Optimize, ll addresses are not registered anyway.. */
659+
if (!addr_is_ipv6_link_local(addr->address) && addr->addr_reg_pend) {
660+
return true;
661+
}
662+
}
663+
664+
return false;
665+
}
666+
667+
643668
/* We are optimised for sending updates to existing targets to current parents;
644669
* we track the state of what information DAO parents have, and manage the
645670
* updates together with message coalescing and ack tracking.
@@ -673,6 +698,20 @@ void rpl_instance_send_dao_update(rpl_instance_t *instance)
673698
return;
674699
}
675700

701+
//Verify that no pending address registartion to parent
702+
if (rpl_instance_dao_address_reg_pending_check(instance)) {
703+
rpl_instance_dao_trigger(instance, 6 * 10);
704+
return;
705+
}
706+
707+
//Verify that no pending dao wait time
708+
ns_list_foreach_safe(rpl_neighbour_t, n, &instance->candidate_neighbours) {
709+
if (n->dodag_parent && n->dao_wait_after_registration) {
710+
rpl_instance_dao_trigger(instance, n->dao_wait_after_registration * 10);
711+
return;
712+
}
713+
}
714+
676715
if (instance->dao_in_transit) {
677716
// Force current DAO timeout to be cut short, then
678717
// when it times out, it will re-evaluate the situation,

source/RPL/rpl_structures.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ struct rpl_neighbour {
5353
bool have_global_address: 1; // Global address known
5454
bool considered: 1; // Have considered at least once for parent selection
5555
unsigned dodag_pref: 4; // Preference indication for DODAG parents (0=best)
56+
uint8_t dao_wait_after_registration;
5657
uint8_t dao_path_control; // Path control bit assignments for DAO parent
5758
uint8_t old_dao_path_control;
5859
int8_t interface_id;

source/RPL/rpl_upward.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,8 +341,25 @@ void rpl_instance_trigger_parent_selection(rpl_instance_t *instance, uint16_t de
341341
}
342342
}
343343

344+
static void rpl_instance_parent_address_reg_timer_update(rpl_instance_t *instance, uint16_t seconds)
345+
{
346+
ns_list_foreach_safe(rpl_neighbour_t, n, &instance->candidate_neighbours) {
347+
if (!n->dodag_parent || n->dao_wait_after_registration == 0) {
348+
continue;
349+
}
350+
uint16_t wait_time = n->dao_wait_after_registration;
351+
if (seconds >= wait_time) {
352+
n->dao_wait_after_registration = 0;
353+
} else {
354+
n->dao_wait_after_registration -= seconds;
355+
}
356+
}
357+
}
358+
344359
static void rpl_instance_parent_selection_timer(rpl_instance_t *instance, uint16_t seconds)
345360
{
361+
rpl_instance_parent_address_reg_timer_update(instance, seconds);
362+
346363
if (instance->parent_selection_timer > seconds) {
347364
instance->parent_selection_timer -= seconds;
348365
} else if (instance->parent_selection_timer != 0) {
@@ -405,6 +422,7 @@ rpl_neighbour_t *rpl_create_neighbour(rpl_dodag_version_t *version, const uint8_
405422
neighbour->g_mop_prf = g_mop_prf;
406423
neighbour->dtsn = dtsn;
407424
neighbour->dao_path_control = 0;
425+
neighbour->dao_wait_after_registration = 0;
408426

409427
/* Need to limit number of neighbours here - chucking worst neighbour */
410428

0 commit comments

Comments
 (0)