Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gnrc/ipv6_auto_subnets: init RPL root when adding a prefix #17350

Merged
merged 4 commits into from
May 2, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions sys/include/net/gnrc/netif/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,9 @@ static inline int gnrc_netif_ipv6_group_to_l2_group(gnrc_netif_t *netif,
* @param[in] pref Preferred lifetime of the prefix in seconds
*
* @return >= 0, on success
* The returned value is the index of the newly created address
* based on the prefix and the interfaces IID in the interface's
* address array.
* @return -ENOMEM, when no space for new addresses (or its solicited nodes
* multicast address) is left on the interface
*/
Expand Down
13 changes: 11 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,12 @@ 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);
benpicco marked this conversation as resolved.
Show resolved Hide resolved

/* 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);
benpicco marked this conversation as resolved.
Show resolved Hide resolved
if (idx < 0) {
DEBUG("auto_subnets: adding prefix to %u failed\n", downstream->pid);
continue;
}

/* start advertising subnet */
gnrc_ipv6_nib_change_rtr_adv_iface(downstream, true);
benpicco marked this conversation as resolved.
Show resolved Hide resolved
Expand All @@ -316,6 +322,9 @@ static void _configure_subnets(uint8_t subnets, uint8_t start_idx, gnrc_netif_t
} else {
ext_opts = tmp;
}

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

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