From 0572a9571b6bcec5de4bdd282de0b05ea06541e1 Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Mon, 11 Sep 2023 16:03:54 +0200 Subject: [PATCH 1/2] gnrc_ipv6_nib: disable router advertisements on interface startup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Router Advertisements are enabled automatically for routing nodes as soon as they obtain a prefix (e.g. via DHCPv6, UHCP, …). Enabling router advertisements without a prefix to advertise is wrong and causes no router solicitations to be send on an upstream interface. Also from https://www.rfc-editor.org/rfc/rfc4861#section-6.2.1 Note that AdvSendAdvertisements MUST be FALSE by default so that a node will not accidentally start acting as a router unless it is explicitly configured by system management to send Router Advertisements. --- sys/include/net/gnrc/ipv6/nib/conf.h | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/sys/include/net/gnrc/ipv6/nib/conf.h b/sys/include/net/gnrc/ipv6/nib/conf.h index d715b18c88..4ab6ba820a 100644 --- a/sys/include/net/gnrc/ipv6/nib/conf.h +++ b/sys/include/net/gnrc/ipv6/nib/conf.h @@ -130,18 +130,11 @@ extern "C" { #endif /** - * @brief (de-)activate router advertising at interface start-up + * @brief activate router advertising at interface start-up */ #ifndef CONFIG_GNRC_IPV6_NIB_ADV_ROUTER -#if CONFIG_GNRC_IPV6_NIB_ROUTER && \ - (!CONFIG_GNRC_IPV6_NIB_6LR || CONFIG_GNRC_IPV6_NIB_6LBR) && \ - !(IS_USED(MODULE_DHCPV6_CLIENT_IA_PD) || IS_USED(MODULE_GNRC_UHCPC) || \ - IS_USED(MODULE_GNRC_IPV6_AUTO_SUBNETS) || IS_USED(MODULE_GNRC_IPV6_STATIC_ADDR)) -#define CONFIG_GNRC_IPV6_NIB_ADV_ROUTER 1 -#else #define CONFIG_GNRC_IPV6_NIB_ADV_ROUTER 0 #endif -#endif /** * @brief Include a Route Information Option for subnets From c33799223639782cd807198eab73d9065b870407 Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Tue, 12 Sep 2023 10:32:16 +0200 Subject: [PATCH 2/2] net/gnrc/rpl: enable RTR_ADV on RPL interface --- sys/net/gnrc/routing/rpl/gnrc_rpl.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sys/net/gnrc/routing/rpl/gnrc_rpl.c b/sys/net/gnrc/routing/rpl/gnrc_rpl.c index f2b0f3749d..383637b295 100644 --- a/sys/net/gnrc/routing/rpl/gnrc_rpl.c +++ b/sys/net/gnrc/routing/rpl/gnrc_rpl.c @@ -122,10 +122,15 @@ kernel_pid_t gnrc_rpl_init(kernel_pid_t if_pid) } /* register all_RPL_nodes multicast address */ - gnrc_netif_ipv6_group_join_internal(gnrc_netif_get_by_pid(if_pid), - &ipv6_addr_all_rpl_nodes); + gnrc_netif_t *netif = gnrc_netif_get_by_pid(if_pid); + gnrc_netif_ipv6_group_join_internal(netif, &ipv6_addr_all_rpl_nodes); + /* send DODAG Information Solicitation */ gnrc_rpl_send_DIS(NULL, (ipv6_addr_t *) &ipv6_addr_all_rpl_nodes, NULL, 0); + + /* RPL enables routing, start advertising ourself as a router */ + gnrc_ipv6_nib_change_rtr_adv_iface(netif, true); + return gnrc_rpl_pid; }