1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

gnrc_ipv6_nib: don't auto-configure IPv6 w/o SLAAC on non-6LN interface

When the NIB is compiled for 6LN mode (but not a 6LBR), the Stateless
Address Autoconfiguration (SLAAC) functionality is disabled, as it is
typically not required; see `sys/include/net/gnrc/ipv6/nib/conf.h`, ll.
46 and 55. However, if a non-6LN interface is also compiled in (still
without making the node a border router) an auto-configured address will
be assigned in accordance with [RFC 6775] to the interface, just
assuming the interface is a 6LN interface. As it then only performs
duplicate address detection RFC-6775-style then, the address then never
becomes valid, as the duplicate address detection according to [RFC
4862] (part of the SLAAC functionality) is never performed.

As auto-configuring an address without SLAAC doesn't make sense, this
fix makes the interface skip it completely, but provides a warning to
the user, so they know what to do.

[RFC 6775]: https://tools.ietf.org/html/rfc6775#section-5.2
[RFC 4862]: https://tools.ietf.org/html/rfc4862#section-5.4
This commit is contained in:
Martine Lenders 2019-10-20 16:07:21 +02:00
parent 5db4310b45
commit 7cba2fb63d

View File

@ -15,6 +15,7 @@
#include <stdbool.h>
#include "log.h"
#include "luid.h"
#include "net/gnrc/netif/internal.h"
@ -34,6 +35,15 @@ void _auto_configure_addr(gnrc_netif_t *netif, const ipv6_addr_t *pfx,
int idx;
uint8_t flags = GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_TENTATIVE;
#if !GNRC_IPV6_NIB_CONF_SLAAC
if (!gnrc_netif_is_6ln(netif)) {
LOG_WARNING("SLAAC not activated; will not auto-configure IPv6 address "
"for interface %u.\n"
" Use GNRC_IPV6_NIB_CONF_SLAAC=1 to activate.\n",
netif->pid);
return;
}
#endif
if (!(netif->flags & GNRC_NETIF_FLAGS_HAS_L2ADDR)) {
DEBUG("nib: interface %i has no link-layer addresses\n", netif->pid);
return;