-
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: replace check by assert #5179
gnrc ipv6: replace check by assert #5179
Conversation
The existence of netif is mandatory here.
That might be, but I would like to keep it the way, that you can use IPv6 without a netif header. |
You mean: "change it" instead of "keep it"? |
And how would one get the inferface without a netif header? |
I don't think that's quite true. |
No, that's why the check is in there. IPv6 is (and should) be able to handle packets without netif header. Otherwise, we damage GNRC's modularity by making it de facto monolithic in a modular dress ;) |
True, haven't looked carefully. Thanks for the correction. |
Can NDP work without the information about the interface of incoming interfaces?
I fail to see the relationship. Upper layer require information from lower layers. UDP won't work without an IP header and IP needs information about the interfaces. |
If there is only one interface, yes.
Not necessarily. Especially in the IPv6 case we only need this header to determine the interface PID which isn't even network related but purely OS related and there can also be other ways to determine the interface, if we really need it (e.g. searching the destination address on the interfaces). UDP is a different case because the (address, port) tuple defines its communication end points. And also: UDP doesn't necessarily need an IPv6 header. It also works with IPv4 and any other surrounding header. This interchangeability makes it as modular as IPv6, just in a different sense. |
I don't argue with that, I just say that the interface identifier should always be provided to the IP layer. |
Regardless, are we okay to close this PR? |
Do we have another solution? |
Solution for what? I still don't see any problem here. |
I took this statement as an implicit "won't work for multiple interfaces without netif header". And more general, I think any protocol that works on the network layer will require information about the interfaces. At least IP requires this for the neighbor/ARP cache and CCN/NDN requires it for the reverse path forwarding. IMO we can either go with a mandatory netif header (without changing much in the code) or provide some other mechanism to obtain this information. |
How about this: For one interface the netif header is not mandatory. For more then one it is. This way we don't need to change any code. |
(I'm still doubting that it even is mandatory for multiple interfaces, because |
Wouldn't this require an (ugly) ifdef?
The code there seems to be more like wild guessing. |
Okay, let's go back a step... Is there a problem? If yes: Does this PR fixes it? And how? |
The only concrete problem that I have observed and which would be fixed by this PR is in #5178. One cannot update the IPv6 RX statistics per interface if one doesn't which interface received the datagram. For NDP in the multi-interface case I haven't traced what would happen if the interface information is missing, but I assume that it might lead to wrong results. If I see it correctly, |
On the other hand, is there any case where we don't pass a netif header to IPv6? |
Currently not, but I would like to keep enforced crashes (which asserts basically are :P) to a minimum :P.
That is correct. |
(but at least for unicast addresses this should be a very good guess). |
Yes, enforced and controlled crashes during testing and development. That's basically the purpose of asserts. And I definitely prefer this over potentially uncontrolled behavior. Can you envision any case where passing a netif header from any lower layer would conflict with anything? |
Not so sure. Currently any IEEE 802.15.4 transceiver without hardware addresses stored on the transceiver itself (i.e. at86rf2xx or kw2xrf) would get the same link-local address. (Which itself is not perfect, but AFAIK legal behavior, since whether link-layer nor link-local IP addresses are required to be unique beyond the scope of the link.) |
Especially for testing I could envision such a case, or stuff like SLIP where addresses are not required. |
This is something DAD should fix very soon (I will take DAD into account for my ND remodelling): If an address already exists: change hardware address. |
And GUAs should have different prefixes for different interfaces ;-) |
Only if the operate in the same network. (Which wouldn't make too much sense for two IEEE 802.15.4 transceivers.) |
For testing a netif header can be easily mocked (and I'm unwilling to make any compromises just for testing) and SLIP may not require L2 addresses, but still run over a certain interface. As I wrote above: we could also introduce a separate mechanism to obtain the receiving interface, but I think just filling and passing the netif header would be easier. |
Will test at the Hack'n'ACK. Please remind me! |
I didn't check the docs, but I assume they will need to be updated to include this |
Yapp. |
Would this line of documentation be okay? |
untested ACK
Did you? |
|
This breaks PR #4725, no idea why. Somehow the assertion fails. |
Debugger shows assertion fails here: https://github.com/RIOT-OS/RIOT/blob/master/sys/net/gnrc/network_layer/ipv6/gnrc_ipv6.c#L768 |
Maybe your PR is broken ;-P do you prepend the netif header in ethos as expected per this PR? (Hi, I'm a Troubleshooting person. Have you tried turning it on and off again ;-P) |
No, the missing netif header occurs actually in a loopback case. (Why there's loopback communication at all is another mistery.) |
ethos doesn't deal with netif... Somehow there are two packets without netif header that only appear if uhcpc adds the prefix. I think the packets get triggered by router advertisement code. |
Currently I try to understand why we cannot simply reverse the pktsnip order here. |
gnrc_ipv6: Revert #5179 (backport)
The existence of netif is mandatory here.
IMO this check doesn't make sense because https://github.com/RIOT-OS/RIOT/blob/master/sys/net/gnrc/network_layer/ipv6/gnrc_ipv6.c#L855 requires
iface
to be set. @authmillenon, can you verify?