Skip to content

Commit

Permalink
gnrc/ipv6_auto_subnets: auto init RPL root
Browse files Browse the repository at this point in the history
  • Loading branch information
benpicco committed Feb 25, 2022
1 parent eddf651 commit 14d5681
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions sys/net/gnrc/routing/ipv6_auto_subnets/gnrc_ipv6_auto_subnets.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
#include "net/gnrc/udp.h"
#include "net/gnrc/ipv6/nib.h"
#include "net/gnrc/ndp.h"
#include "net/gnrc/rpl.h"
#include "random.h"
#include "xtimer.h"

Expand Down Expand Up @@ -286,6 +287,7 @@ static void _configure_subnets(uint8_t subnets, uint8_t start_idx, gnrc_netif_t
while ((downstream = gnrc_netif_iter(downstream))) {
gnrc_pktsnip_t *tmp;
ipv6_addr_t new_prefix;
int idx;

if (downstream == upstream) {
continue;
Expand All @@ -302,8 +304,8 @@ static void _configure_subnets(uint8_t subnets, uint8_t start_idx, gnrc_netif_t
_remove_old_prefix(downstream, &new_prefix, new_prefix_len, &ext_opts);

/* configure subnet on downstream interface */
gnrc_netif_ipv6_add_prefix(downstream, &new_prefix, new_prefix_len,
valid_ltime, pref_ltime);
idx = gnrc_netif_ipv6_add_prefix(downstream, &new_prefix, new_prefix_len,
valid_ltime, pref_ltime);

/* start advertising subnet */
gnrc_ipv6_nib_change_rtr_adv_iface(downstream, true);
Expand All @@ -316,6 +318,11 @@ static void _configure_subnets(uint8_t subnets, uint8_t start_idx, gnrc_netif_t
} else {
ext_opts = tmp;
}

/* configure RPL root if applicable */
if (idx >= 0) {
gnrc_rpl_configure_root(downstream, &downstream->ipv6.addrs[idx]);
}
}

/* immediately send an RA with RIO */
Expand Down

0 comments on commit 14d5681

Please sign in to comment.