Skip to content

Commit 6245dd6

Browse files
rveerama1jukkar
authored andcommitted
net: rpl: Ignore parents with lower rank
When a node joins in DAG network, it chooses neighbor (node or border router) as its parent. But if it receives DIO message from another peer, it can only act as a neighbor, not as a parent. If peer rank is better than current preferred parent rank then node will select new peer as it's best parent. Signed-off-by: Ravi kumar Veeramally <[email protected]>
1 parent cfc8749 commit 6245dd6

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

subsys/net/ip/rpl.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2645,6 +2645,14 @@ static void net_rpl_process_dio(struct net_if *iface,
26452645
net_rpl_reset_dio_timer(instance);
26462646
}
26472647

2648+
if (instance->current_dag && instance->current_dag->preferred_parent) {
2649+
if (instance->current_dag->preferred_parent->rank <=
2650+
dio->rank) {
2651+
/* Not a preferable parent. */
2652+
return;
2653+
}
2654+
}
2655+
26482656
/* Prefix Information Option treated to add new prefix */
26492657
if (dio->prefix_info.length != 0) {
26502658
if (dio->prefix_info.flags & NET_ICMPV6_RA_FLAG_AUTONOMOUS) {

0 commit comments

Comments
 (0)