Skip to content

Commit

Permalink
RPL DAO timeout update:
Browse files Browse the repository at this point in the history
RPL dao timeout will trig Extra Address registration to primary parent if confirmation is requested.
  • Loading branch information
Juha Heiuskanen committed Nov 6, 2020
1 parent 660e178 commit 18fa048
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion source/RPL/rpl_downward.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ static void rpl_downward_topo_sort_invalidate(rpl_instance_t *instance);
/* The PCS mask */
#define PCSMASK(pcs) ((uint8_t)(0x100 - PCBIT(pcs)))

static bool rpl_instance_push_address_registration(protocol_interface_info_entry_t *interface, rpl_neighbour_t *neighbour, if_address_entry_t *addr);
static if_address_entry_t *rpl_interface_addr_get(protocol_interface_info_entry_t *interface, const uint8_t addr[16]);

/*
* 0 1 2 3 4 5 6 7
Expand Down Expand Up @@ -1541,6 +1543,25 @@ bool rpl_instance_dao_received(rpl_instance_t *instance, const uint8_t src[16],
}
#endif // HAVE_RPL_DAO_HANDLING

static uint16_t rpl_instance_address_registration_start(rpl_instance_t *instance, rpl_dao_target_t *pending_target)
{
rpl_neighbour_t *pref_parent = rpl_instance_preferred_parent(instance);
protocol_interface_info_entry_t *interface = protocol_stack_interface_info_get_by_rpl_domain(instance->domain, -1);
if (!interface || !pref_parent) {
return 1;
}
if_address_entry_t *address = rpl_interface_addr_get(interface, pending_target->prefix);
if (!address) {
return 1;
}
if (!rpl_instance_push_address_registration(interface, pref_parent, address)) {
return 1;
}
tr_debug("Extra Address Confirmation trig...next dao trig 10s");
return 100;

}

void rpl_instance_dao_acked(rpl_instance_t *instance, const uint8_t src[16], int8_t interface_id, uint8_t dao_sequence, uint8_t status)
{
if (!instance->dao_in_transit || dao_sequence != instance->dao_sequence_in_transit) {
Expand Down Expand Up @@ -1572,6 +1593,7 @@ void rpl_instance_dao_acked(rpl_instance_t *instance, const uint8_t src[16], int
}

bool more_to_do = false;
rpl_dao_target_t *pending_target = NULL;
ns_list_foreach(rpl_dao_target_t, target, &instance->dao_targets) {
if (target->root) {
continue;
Expand All @@ -1589,12 +1611,14 @@ void rpl_instance_dao_acked(rpl_instance_t *instance, const uint8_t src[16], int
target->info.non_root.pc_assigned |= target->info.non_root.pc_assigning;
} else {
target->info.non_root.pc_to_retry |= target->info.non_root.pc_assigning;

}
target->info.non_root.pc_assigning = 0;
}
target->info.non_root.pc_assigned &= target->path_control;
if (target->info.non_root.pc_assigned != target->path_control) {
more_to_do = true;
pending_target = target;
} else {
if (target->published && target->info.non_root.refresh_timer == 0) {
uint32_t t;
Expand All @@ -1616,7 +1640,14 @@ void rpl_instance_dao_acked(rpl_instance_t *instance, const uint8_t src[16], int
}

if (more_to_do) {
rpl_instance_dao_trigger(instance, 1);
uint16_t dao_trig_time = 1;
if (pending_target && rpl_policy_parent_confirmation_requested()) {
//Possible NS ARO trig
dao_trig_time = rpl_instance_address_registration_start(instance, pending_target);
}

rpl_instance_dao_trigger(instance, dao_trig_time);

} else {
rpl_control_event(instance->domain, RPL_EVENT_DAO_DONE);
}
Expand Down

0 comments on commit 18fa048

Please sign in to comment.