Skip to content
Snippets Groups Projects
Commit ac5e9af4 authored by Cenk Gündoğan's avatar Cenk Gündoğan
Browse files

Merge pull request #2607 from cgundogan/rpl_update_rt_table_for_all_dodags

rpl: update routing table information for all dodags
parents 67602bb4 d27cd45a
No related branches found
No related tags found
No related merge requests found
...@@ -276,25 +276,22 @@ void *rpl_process(void *arg) ...@@ -276,25 +276,22 @@ void *rpl_process(void *arg)
void _rpl_update_routing_table(void) void _rpl_update_routing_table(void)
{ {
rpl_dodag_t *my_dodag = rpl_get_my_dodag(); rpl_dodag_t *my_dodag, *end;
rpl_routing_entry_t *rt; rpl_routing_entry_t *rt = rpl_get_routing_table();
if (my_dodag != NULL) { for (unsigned int i = 0; i < rpl_max_routing_entries; i++) {
rt = rpl_get_routing_table(); if (rt[i].used) {
if (rt[i].lifetime <= 1) {
for (uint8_t i = 0; i < rpl_max_routing_entries; i++) { memset(&rt[i], 0, sizeof(rt[i]));
if (rt[i].used) { }
if (rt[i].lifetime <= 1) { else {
memset(&rt[i], 0, sizeof(rt[i])); rt[i].lifetime = rt[i].lifetime - RPL_LIFETIME_STEP;
}
else {
rt[i].lifetime = rt[i].lifetime - RPL_LIFETIME_STEP;
}
} }
} }
}
/* Parent is NULL for root too */ for (my_dodag = rpl_dodags, end = my_dodag + RPL_MAX_DODAGS; my_dodag < end; my_dodag++) {
if (my_dodag->my_preferred_parent != NULL) { if ((my_dodag->used) && (my_dodag->my_preferred_parent != NULL)) {
if (my_dodag->my_preferred_parent->lifetime <= 1) { if (my_dodag->my_preferred_parent->lifetime <= 1) {
DEBUGF("parent lifetime timeout\n"); DEBUGF("parent lifetime timeout\n");
rpl_parent_update(my_dodag, NULL); rpl_parent_update(my_dodag, NULL);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment