Skip to content

Commit

Permalink
RPL update
Browse files Browse the repository at this point in the history
Fixed double age issue for route update.

Minor typo fix's

Change-Id: Iac93311ca9d176cf2d3f3f35a180bc336d416bb5
  • Loading branch information
Juha Heiskanen committed May 29, 2019
1 parent bbae493 commit 5e67f7c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion source/RPL/rpl_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -992,7 +992,7 @@ static buffer_t *rpl_control_dio_handler(protocol_interface_info_entry_t *cur, r


rpl_control_process_prefix_options(cur, instance, dodag, neighbour, ptr, buffer_data_end(buf));
rpl_dodag_update_implicit_system_routes(dodag, neighbour);
//rpl_dodag_update_implicit_system_routes(dodag, neighbour);
rpl_control_process_route_options(instance, dodag, version, neighbour, rank, ptr, buffer_data_end(buf));

//rpl_control_process_metric_containers(neighbour, ptr, buffer_data_end(buf))
Expand Down
11 changes: 6 additions & 5 deletions source/RPL/rpl_upward.c
Original file line number Diff line number Diff line change
Expand Up @@ -1280,7 +1280,7 @@ static void rpl_instance_update_system_dio_route(rpl_instance_t *instance, rpl_n

uint8_t metric = ipv6_route_pref_to_metric(pref) + parent->dodag_pref;

ipv6_route_add_metric(route->prefix, route->prefix_len, parent->interface_id, parent->ll_address, ROUTE_RPL_DIO, parent, instance->id, rpl_aged_lifetime(route->lifetime, parent->dio_timestamp), metric);
ipv6_route_add_metric(route->prefix, route->prefix_len, parent->interface_id, parent->ll_address, ROUTE_RPL_DIO, parent, instance->id, route->lifetime, metric);
}

/* Called when a DIO has been received */
Expand All @@ -1290,14 +1290,14 @@ void rpl_dodag_update_implicit_system_routes(rpl_dodag_t *dodag, rpl_neighbour_t
return;
}

uint32_t aged_default = rpl_aged_lifetime(rpl_default_lifetime(dodag), parent->dio_timestamp);
uint32_t default_lifetime = rpl_default_lifetime(dodag);
uint8_t metric = IPV6_ROUTE_DEFAULT_METRIC + parent->dodag_pref;

/* Always add the "root" default route - only used for per-instance lookup */
ipv6_route_add_metric(NULL, 0, parent->interface_id, parent->ll_address, ROUTE_RPL_INSTANCE, parent, dodag->instance->id, aged_default, metric);
ipv6_route_add_metric(NULL, 0, parent->interface_id, parent->ll_address, ROUTE_RPL_INSTANCE, parent, dodag->instance->id, default_lifetime, metric);

/* Also add a specific route to the DODAGID */
ipv6_route_add_metric(dodag->id, 128, parent->interface_id, parent->ll_address, ROUTE_RPL_ROOT, parent, dodag->instance->id, aged_default, metric);
ipv6_route_add_metric(dodag->id, 128, parent->interface_id, parent->ll_address, ROUTE_RPL_ROOT, parent, dodag->instance->id, default_lifetime, metric);

}

Expand Down Expand Up @@ -1365,7 +1365,8 @@ void rpl_instance_run_parent_selection(rpl_instance_t *instance)
}

ns_list_foreach_safe(rpl_neighbour_t, n, &instance->candidate_neighbours) {
if (rpl_aged_lifetime(rpl_default_lifetime(n->dodag_version->dodag), n->dio_timestamp) == 0) {
//Remove a Parent candidates which are not heared a long time ago and not slected ones
if (!n->dodag_parent && (rpl_aged_lifetime(rpl_default_lifetime(n->dodag_version->dodag), n->dio_timestamp) == 0)) {
rpl_delete_neighbour(instance, n);
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion source/ipv6_stack/ipv6_routing_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ typedef enum ipv6_route_src {
ROUTE_RPL_DAO, /* Explicitly advertised in DAO, Storing mode */
ROUTE_RPL_DAO_SR, /* Explicitly advertised in DAO, Root Source Routes in Non-Storing mode */
ROUTE_RPL_SRH, /* Not in routing table - used in buffers to represent on-link inferred from SRH */
ROUTE_RPL_ROOT, /* Implicit route to DODAG route */
ROUTE_RPL_ROOT, /* Implicit route to DODAG root */
ROUTE_RPL_INSTANCE, /* Implicit instance-specific default upward route (not for general search) */
ROUTE_RPL_FWD_ERROR, /* Not in routing table - used in buffers to represent Forwarding-Error bounce */
ROUTE_MULTICAST, /* Not in routing table - used to represent multicast interface selection */
Expand Down

0 comments on commit 5e67f7c

Please sign in to comment.