-
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/netif: don't treat link local differently in prefix matching #12404
gnrc/netif: don't treat link local differently in prefix matching #12404
Conversation
Since @kaspar030, @fjmolinas, and I discussed this over lunch, I did some digging in the past of this check myself to figure out where this was coming from. It was introduced in 0b80c7e (part of #7370), however the original version in the old RIOT/sys/net/gnrc/network_layer/ipv6/netif/gnrc_ipv6_netif.c Lines 466 to 480 in 8d941d5
(the new I also asked @bergzand and @cgundogan (who reviewed #7370) but they didn't know either. As such, I'm willing to ACK this, I just want to run some tests first. |
|
@miri64, i don't have time to check the code now but what you have to ensure is that the set of candidate source addresses should only include link-local addresses if the destination address is a link-local address. from this point of view, link-local addresses are treated differently compared to global addresses. |
The check @kaspar030 removes is applied in Rule 8 of the source address selection, so long after the candidate set was generated. I'm investigating at the moment why the test fails. This could give the answer why the check is there for matching prefixes (for a different use case other than source address selection), but I'm still investigating. From what I know so far: In the scope of source address selection I am however pretty sure by now, that the check removed here was invalid indeed. |
(the current implementation apart from some tweaks on my side goes back to an implementation @OlegHahm did for an earlier version of GNRC btw, so for me it is also "other peoples code" ;-)) |
The failing test at least confirms this suspicion, not sure if it is justified though. |
I tested the following now:
On master 3. is working. I'm trying to figure out what's wrong... |
I'm pinging the |
I believe rule 2 is (and originally was) implemented wrong. It is stated:
If I'm not mistaken this means "If an address has a larger scope, prefer it". The code however adds points for having a smaller scope (which also doesn't make much sense to me from a networking perspective): RIOT/sys/net/gnrc/netif/gnrc_netif.c Lines 1037 to 1043 in 22b0873
Also the case in #3561: RIOT/sys/net/gnrc/network_layer/ipv6/netif/gnrc_ipv6_netif.c Lines 718 to 724 in 8d941d5
|
Ah the "smaller" part only applies to the "If Scope(SA) < Scope(D)" bit, as only the candidate's scope and the destination scope are compared. I think of instead using arbitrary points, the scope should be used as points. |
In any case: as the PR stands now, it doesn't fix source address selection only, but prefix matching in general. As such I rename it to your commit message. |
you should select a source address that is reachable (at least from the scope point of view) from the destination address. For example, if the destination address is global but you set a link local source address, a reply to this source address will fail. |
The scope selection, while faulty its current form wasn't actually the problem for my issue. The problem was, after all addresses were considered by source selection it then proceeded trying to match the found address to the destination address which for ULAs (prefixed with |
@kaspar030 please squash! I think it makes it easier if I pull the remaining commit in this PR into #12408 so the test case becomes more obvious. |
539c6eb
to
811c1ee
Compare
👍 |
Thanks! |
Closing in favor of #12408. |
Cherry-picked from 811c1ee (RIOT-OS#12404)
Cherry-picked from 811c1ee (RIOT-OS#12404)
Cherry-picked from 811c1ee (RIOT-OS#12404)
Contribution description
RFC6725 describes the algorithm for source address selection.
Rule 9 does not state that link-local address should be treated differently.
Previously, GNRC's
_match_to_idx()
would always chose the first link-local address, instead of doing a prefix match, in case it was comparing a link-local address.This PR removes any special handling of link-local addresses from
_match_to_idx()
.Testing procedure
Test the shit out of GNRC IP.
Issues/PRs references
We thing this happened at some point in #11818.