From 52f7e4a9f56d2d648124663ade949190e8425d47 Mon Sep 17 00:00:00 2001 From: Laurent Deru Date: Mon, 11 Dec 2017 17:19:02 +0100 Subject: [PATCH] Don't autoconfigure address on RPL Root --- os/net/rpl-classic/rpl-dag.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/os/net/rpl-classic/rpl-dag.c b/os/net/rpl-classic/rpl-dag.c index e4f4191b1..6bb15007d 100644 --- a/os/net/rpl-classic/rpl-dag.c +++ b/os/net/rpl-classic/rpl-dag.c @@ -522,14 +522,16 @@ rpl_set_prefix(rpl_dag_t *dag, uip_ipaddr_t *prefix, unsigned len) dag->prefix_info.length = len; dag->prefix_info.flags = UIP_ND6_RA_FLAG_AUTONOMOUS; PRINTF("RPL: Prefix set - will announce this in DIOs\n"); - /* Autoconfigure an address if this node does not already have an address - with this prefix. Otherwise, update the prefix */ - if(last_len == 0) { - PRINTF("rpl_set_prefix - prefix NULL\n"); - check_prefix(NULL, &dag->prefix_info); - } else { - PRINTF("rpl_set_prefix - prefix NON-NULL\n"); - check_prefix(&last_prefix, &dag->prefix_info); + if(dag->rank != ROOT_RANK(dag->instance)) { + /* Autoconfigure an address if this node does not already have an address + with this prefix. Otherwise, update the prefix */ + if(last_len == 0) { + PRINTF("rpl_set_prefix - prefix NULL\n"); + check_prefix(NULL, &dag->prefix_info); + } else { + PRINTF("rpl_set_prefix - prefix NON-NULL\n"); + check_prefix(&last_prefix, &dag->prefix_info); + } } return 1; }