-
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
ndp: separate & clean next hop & l2 determination #3622
Conversation
After discussing with @emmanuelsearch and @cgundogan, we could not find a use case where the destination cache would introduce any benefit. |
Also, putting link-local addresses in the FIB (or looking them up there) is rather useless (see also https://tools.ietf.org/html/rfc5889). |
I don't see the benefit of splitting the function up. |
Next-hop determination and looking a l2 address up are two different things. |
(The l2 lookup function is still too long anyway.) |
if (ipv6_addr_is_link_local(&(hdr->dst))) { | ||
memcpy(&next_hop_ip, &(hdr->dst), sizeof(ipv6_addr_t)); | ||
} | ||
else if (!ng_ndp_node_next_hop_ipv6_addr(&next_hop_ip, &iface, |
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.
If we go for this this way, this function needs to be wrapped in the same manner as ng_ndp_node_next_hop_l2addr()
is in https://github.com/RIOT-OS/RIOT/pull/3622/files#diff-c0ab51e027bbe0cfdb3482d3e29d6f34R569.
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?
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.
Because next-hop determination for 6LoWPAN-ND is not the same as for NDP.
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 6LoWPAN-ND it even is different for routers and hosts):
HostsRouters: https://tools.ietf.org/html/rfc6775#section-6.5.4RoutersHosts: https://tools.ietf.org/html/rfc6775#section-5.6
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.
But this is not implemented yet anyway, but actually looking at the RFC I don't see a big difference for the next-hop determination itself.
Yes, but there is no use case where they are used separately. They are always used together and always in the exact same order. So why not safe some ROM and put them together in one function (this was my original rational). |
For link-local addresses a FIB lookup is not needed (without destination cache). |
Yes, but on-link prefix determination and default router determination. Also the diff is kind of messy so I'm not sure, but can it be that you forgot on-link prefix determination? |
|
I read this. |
On-link determination in wireless networks is difficult anyway (see RFC 5889). The current implementation seems to look up a flag for an address configured to a local address for on-link determination which seems weird. |
We don't deal with just wireless networks anymore. As far as I read RFC 5889 prefixes should just not be configured to be on-link (so you are not to allowed the flag) for such networks. That's a situation we have to deal with, but not by omitting on-link prefix determination all-together but by proper prefix initialization.
Why? In RIOT the prefix list and the local address list are the same (as proposed by RFC 4861) and on-link is a flag of this prefix. It is either set on the prefix' initialization (when a user adds an address to the interface - this is the point we need to change in regard to RFC 5889) or when it receives the prefix via a PIO with the on-link flag set. This and checking the neighbor cache are the only options in our current implementation if you take the definition in RFC 4861 in account
|
Yes I actually forgot to check the neighbor cache in the current implementation, but this is actually an argument FOR keeping the function together. Otherwise you would have to look into the neighbor cache twice to make a clean implementation: once when you determine the next hop and then for link-layer address determination. |
True, we're not dealing only with wireless networks, but for now most of the time. My argument (and I think also @emmanuelsearch's one) is that "on-link" is difficult to determine in wireless networks. Thinking about failing nodes, changing links and unidirectional links.
Is this documented somewhere? The lookup as it is in the current implementation without any comment looks just weird. Summa summarum, I would argue that at least for the wireless case on-link determination per prefix is pointless and should be omitted. So this should at least be configurable. @emmanuelsearch, what do you think? |
Seems not to be, but the fact alone, that the assigned addresses have also a prefix length assigned to them makes it a prefix list (otherwise it wouldn't be needed) |
Then make it configurable using a flag or something. We have at least one device regular used that isn't wireless: native. |
Concerning "on-link" and spontaneous wireless networks, I think about section 6.1. of RFC5889. Basically in our context, on-link means nothing useful, so I am of the opinion of (i) not using this concept and associated flags in wireless context and (ii) focus on using non-link-local address as much of the time in wireless context. |
Nit-picky: native is not device. More seriously: we want native to behave as much as possible as real devices, so I wouldn't make an exception for native. However, I agree that we might want to distinguish between wireless and wired (Ethernet, MS/TP...). |
a0fb9dd
to
8b15b9c
Compare
Updated and rebased on #3697. Now on-link prefix lookup is only performed for wired interfaces. |
Determining the next hop and the corresponding L2 address are split up in two steps. No next hop look up is performed for link-local addresses any more. Destination cache has been disabled.
6806edd
to
fb47756
Compare
rebased on current master |
I considered as soon as I saw the PR, but since the address is memcopied now anyway, this doesn't apply. |
needs rebase |
(next_hop_size == sizeof(ipv6_addr_t))) { | ||
next_hop_ip = &next_hop_actual; | ||
} | ||
next_hop_ip = gnrc_ipv6_ext_rh_next_hop(hdr); |
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.
This only modify a local pointer variable. We should memcpy like this.
ipv6_addr *tmp = gnrc_ipv6_ext_rh_next_hop(hdr);
if (tmp != NULL) {
memcpy(next_hop_ip, tmp, sizeof(ipv6_addr_t));
return true;
}
Alternatively, change signature like this:
bool gnrc_ndp_node_next_hop_ipv6_addr(ipv6_addr_t **next_hop_ip, ...)
{
*next_hop_ip = gnrc_ipv6_ext_rh_next_hop(hdr);
...
}
call site:
ipv6_addr_t *next_hop_ip;
gnrc_ndp_node_next_hop_ipv6_addr(&next_hop_ip, ...);
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.
Thanks for the hint. In fact this PR is very outdated and I just left it open to remind me of re-introducing it as a new one anytime soon.
Needs rebase. |
I will abandon this for now. |
Determining the next hop and the corresponding L2 address are split up
in two steps. No next hop look up is performed for link-local addresses
any more. Destination cache has been disabled.