-
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: clean up _resolve_addr() #18939
Conversation
return false; | ||
} | ||
|
||
if (IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ARSM)) { |
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.
I have a feeling that this should in fact be
if (IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ARSM)) { | |
if (IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ARSM) && !gnrc_netif_is_6lo(netif)) { |
but I'll leave this PR to cleanups only.
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, it shoud still be possible to activate the ARSM optionally on 6Lo nodes.
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.
(also resolution by address generation reversal is also a nice feature for non-6Lo-nodes to have (and will become necessary with SCHC at some point too).
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, it shoud still be possible to activate the ARSM optionally on 6Lo nodes.
But that would be a separate config then, right? Because right now we only have CONFIG_GNRC_IPV6_NIB_ARSM
which globally turns on ARSM on all interfaces.
So the BR will do ARSM on the 6lo interface (because it needs it on the upstream interface) but the 6lo nodes do not.
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.
In my opinion, CONFIG_GNRC_IPV6_NIB_ARSM
should even be enabled for all 6LN. Because our CONFIG_GNRC_IPV6_NIB_ARSM
is actually responsible for two things:
- address resolution obviously
(Note: with private addresses, 6LN cannot reverse translate IPv6 addresses to L2 addresses, so they must look in the NC anyway. But this is a bit off-topic here currently.) - and Neighbor Unreachable Detection
6LN actually do NUD and additionally include an ARO
option RFC6775.
Hosts send unicast NS messages to register their IPv6 addresses, and
also to do NUD to verify that their default routers are still
reachable.
For some things like joining the Solicited-node multicast address and multicast L2 address resolution, we just exclude 6LN interfaces.
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.
Neighbor Unreachable Detection
hm might this be the reason for #17327
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.
very hard to tell... To be honest I am not very familiar with RPL. I have to catch up here.
d925acb
to
71a01df
Compare
return false; | ||
} | ||
|
||
if (!IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ARSM)) { |
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.
same here
if (!IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ARSM)) { | |
if (!IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ARSM) || gnrc_netif_is_6lo(netif)) { |
71a01df
to
14fc375
Compare
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.
Nice to see a clean up. I looked at it for a while and did not find a semantic change.
res = true; | ||
|
||
/* directly resolve 6lo address */ | ||
if (_resolve_addr_from_ipv6(dst, netif, nce)) { |
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.
For consistency, this if
clause could use a nice DEBUG()
message too.
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.
I wonder if this should be moved above _resolve_addr_from_nc()
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.
could be, maybe, but not necessarily.
static bool _resolve_addr_from_nc(gnrc_netif_t *netif, gnrc_ipv6_nib_nc_t *nce, const ipv6_addr_t * dst) {
/* lookup _nib_onl_entry_t *entry by dst and netif */
/* if exists get L2 address from NC */
/* else if 6LN and link-local do reverse translation */
}
And if _resolve_addr_from_nc()
fails to resolve the L2 address, we know we don´t have an NC entry and we have to add one, or it existed but was UNREACHABLE. Also having (netif
+ dst
) and entry
as input is a bit redundant.
... I don´t know, maybe the clean up could propagate upwards, but not without changing too much I guess.
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.
I'm not sure I understand what you want me to do 😅
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.
Sorry I misread your last comment. I thought you wanted to merge _resolve_addr_from_nc()
and _resolve_addr_from_ipv6()
into one function. Then I thought about how this would look like.
Ok, moving _resolve_addr_from_ipv6()
above _resolve_addr_from_nc()
and keeping them as they are now,
would mean that every link-local destination address would be resolved immediately by reverse translation.
This would mean that link local addresses would not have to be registered. But this is somewhat required if the link local address is a private address (CGA or SLAAC pivacy extension) .
Let´s say R
is the upstream router of host H
. H
implements the SLAAC privacy extension and builds a private link local address that it registers to R
where due to an SLLA option an NCA is created there.
If R
would not examine the NCE when it sends something to the private SLAAC address of H
, it would put the wrong L2 address in the frame.
In fact, in my SEND
branch, I added this:
/* If any IPv6 privacy extension is used, we cannot derive the L2 address from the IP address */
bool res = !IS_USED(MODULE_IPV6_CGA) &&
(netif != NULL) &&
gnrc_netif_is_6ln(netif) &&
ipv6_addr_is_link_local(dst);
to _resolve_addr_from_ipv6()
.
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.
I once again looked through the changes and found no change in semantics.
Are we going to merge the clean up or is there something more to discuss regarding this PR?
My comments were addressed. |
9cff238
to
64a2fbc
Compare
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.
bors merge
Build succeeded: |
Contribution description
I'm still trying to find a proper fix for #16988 (border router does ARSM on the 6lo interface) but still no avail.
But as a first step, clean up
_resolve_addr()
by getting rid of unececary pre-processor conditionals and moving logic blocks to separate functions.This makes it easier to figure out what's actually going on.
There should be no changes to the logic.
Testing procedure
All tests should continue yielding the same results as before.
Issues/PRs references