Dear resolving IOTlers,
in several lengthy discussions on Github we (mostly Martine and me) discussed if the netif header in GNRC should be mandatory. As a context: the netif header in GNRC is a pseudo-header that contains (optional) link-layer information such as the source and destination address, the information about the used interface, and some additional, again optional, information about link-layer metrics (RSSI and LQI).
Until recently, it was optional to include this header while passing the packet up the stack. However, recently, I introduced a patch to change this, by asserting the presence of the netif header while receiving a packet in the IPv6 implementation. The current discussion is about reverting this change.
My rationale to _keep_ this change is the following: * In my opinion a protocol running logically directly above the link-layer, such as IP (adaptation layers like 6LoWPAN may exist in between) will typically require information about the interface that received the packet. (The same is true for other layers, e.g. UDP cannot work without information from the IP header.) * Not in all cases a physical interface may be involved, but for those cases there should typically be a pseudo-interface. The only case, where we do not have a pseudo-interface right now (as far as I know) is the loopback case. In my opinion, it is - for efficiency reasons - completely okay not to provide a loopback device in GNRC, but I still don't see a reason why a netif header indicating a pseudo interface should do any harm here. Implementation detail: So far, KERNEL_PID_UNDEF is used as identifier in my proposal, but we could also define the PID of the IPv6 thread as loopback device identifier. * Finally, I think asserting a present netif header makes the code easier, because one does not have to cover exception cases and provide different branches for netif-header-is-present and netif-header-is-NOT-present.
Cheers, Oleg