-
Notifications
You must be signed in to change notification settings - Fork 2k
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_nib: don't auto-configure IPv6 w/o SLAAC on non-6LN interface #12513
gnrc_ipv6_nib: don't auto-configure IPv6 w/o SLAAC on non-6LN interface #12513
Conversation
@kb2ma this bug isn't really critical, as it only appears in very special configuration, so if it isn't in by RC2 when you create it, we shouldn't worry about that. |
if (!gnrc_netif_is_6ln(netif)) { | ||
LOG_WARNING("SLAAC not activated; won't auto-configure IPv6 for " | ||
"interface %u\n" | ||
" Use " NAME(GNRC_IPV6_NIB_CONF_SLAAC) "=1 to " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why wouldn't a simple
" Use GNRC_IPV6_NIB_CONF_SLAAC=1 to "
suffice? The stringification of a macro to print the macro name seems unnecessarily complex in this situation. Or are there other intentions (for future use)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My main motivation is future-proofness, e.g. if the name of the macro changes. The example will cause an immediate compile-time error while just having a string literal won't.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The example will cause an immediate compile-time error while just having a string literal won't.
Did you test that? I also thought so and did a quick test using a puts()
. I was able to put anything in NAME()
without the compiler throwing an error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I didn't I assumed the preprocessor checks what it is provided with. Ok then I do it the simple way ;-).
Also fixed the wording to a less colloquial style. |
Alright, the change seems sensible. Still needs a test, though. I will roll up my sleeves in a couple of hours, if nobody tested & confirmed the desired behaviour by then. |
Don't you trust my results posted above? ^^ |
Sure. But you know: the devil is in the detail (: It doesn't hurt to verify your results .. and I just did 👍 looks good. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please squash.
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
35ebfbd
to
7cba2fb
Compare
Okay, Murdock shows finally green! |
Thanks for the review :-) |
Backport provided in #12522 |
Similar as with RIOT-OS#12513, when the NIB is compiled in 6LN mode (but not 6LR mode), the address-resolution state-machine (ARSM) functionality is disabled in favor of the more simpler address resolution proposed in RFC 6775. However, if a non-6LN interface is also compiled in (without making it a router or border router) it will never join the solicited-nodes multicast address of addresses added to it, resulting in address resolution to that interface to fail. If the interface is not a 6LN (which in case 6LN mode is disabled is always false), a warning is now printed, encouraging the user to activate the ARSM functionality if needed.
Similar as with RIOT-OS#12513, when the NIB is compiled in 6LN mode (but not 6LR mode), the address-resolution state-machine (ARSM) functionality is disabled in favor of the more simpler address resolution proposed in RFC 6775. However, if a non-6LN interface is also compiled in (without making it a router or border router) it will never join the solicited-nodes multicast address of addresses added to it, resulting in address resolution to that interface to fail. If the interface is not a 6LN (which in case 6LN mode is disabled is always false), a warning is now printed, encouraging the user to activate the ARSM functionality if needed.
Similar as with RIOT-OS#12513, when the NIB is compiled in 6LN mode (but not 6LR mode), the address-resolution state-machine (ARSM) functionality is disabled in favor of the more simpler address resolution proposed in RFC 6775. However, if a non-6LN interface is also compiled in (without making it a router or border router) it will never join the solicited-nodes multicast address of addresses added to it, resulting in address resolution to that interface to fail. If the interface is not a 6LN (which in case 6LN mode is disabled is always false), a warning is now printed, encouraging the user to activate the ARSM functionality if needed.
Contribution description
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
RIOT/sys/include/net/gnrc/ipv6/nib/conf.h
Lines 41 to 48 in d9c240a
RIOT/sys/include/net/gnrc/ipv6/nib/conf.h
Lines 50 to 59 in d9c240a
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.
Testing procedure
Compile
examples/gnrc_networking
native
with both anetdev_tap
andsocket_zep
:GNRC_NETIF_NUMOF=2 USEMODULE=socket_zep TERMFLAGS="-z [::]:17755 tap0" \ make -C examples/gnrc_networking all term
With this fix, the link-local address of the Ethernet interface won't receive an auto-configured link-local address and a warning is printed
Compiling with
CFLAGS+=-DGNRC_IPV6_NIB_CONF_SLAAC=1
still auto-configures the address and validates it shortly after the node started (and the warning is not shown ;-)):Without the fix and CFLAGS=-DGNRC_IPV6_NIB_CONF_SLAAC=1 not set the Ethernet interface gets a link-local address which will stay tentative forever:
Issues/PRs references
Several, but triggered by testing procedures in #12512 and #10499.