[riot-devel] Mandatory netif header?

Oleg Hahm oliver.hahm at inria.fr
Wed Apr 6 15:41:35 CEST 2016


Hi Martine!

On Wed, Apr 06, 2016 at 02:47:24PM +0200, Martine Lenders wrote:
> IP on the other hand has ARP/NDP to resolve an IP address into
> link-layer information. 

Yes, but ARP/NDP needs link-layer information to work, right?

> Furthermore, as far as we discussed so far we talked only about reception of
> a packet and there this information is only important for routing protocols
> and IP-internal stuff (and for the most part only the non-address related
> information from these header, like the interface identifier and the
> link-layer metrics). In these cases the information is provided for natural
> interfaces. Pseudo-interfaces as you define them usually are not handled by
> these kind of operation in a sensible way so packets from those can just
> ignore packets without a netif header.

I don't see any argument against having a netif header here, either.

> > 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.
> 
> Well unless you want to send all IPv6 packets to the loopback to the IPv6
> thread this would require an additional check anyways.

Why? If the PID inside the netif header is the PID of the IPv6 thread, the
interface is assumed to be loopback. But let's discuss this afterwards, that's
really just an implementation detail. We can also introduce other values for
that.

> > 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.
> 
> I have the complete opposite impression: Currently the check for a netif
> header is AFAIK only present at the point of your patch. So we have a
> little bit more complex code at this point (where the complexity is only as
> far as a `assert(netif)` vs `if(netif) { iface = netif->iface } else {iface
> = KERNEL_PID_UNDEF}`) 

Anything inside the layer which works directly on top of the link-layer needs
to perform the check if the header is present when it is interested in its
information. If it's always present I can skip this check.

> while anything else that is a pseudo-interface now needs to prepend a netif
> header to the packet.

That's a one-time work - and a very simple one. Moreover, this would it make
possible to distinguish between, let's say loopback and ZEP pseudo interfaces.
If I just set iface to KERNEL_PID_UNDEF, I cannot.

Basically, you're proposing to set the interface to KERNEL_PID_UNDEF in the
network layer if no information is present, I propose to set the interface to
KERNEL_PID_UNDEF if no better fitting device exists before passing it up to
the network layer. In my opinion is just more consistent to handle all
interfaces the same way - whether they are physical devices or only logical
devices.

Cheers,
Oleg
-- 
arrival order packet joke is critical to good a make
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.riot-os.org/pipermail/devel/attachments/20160406/a8b12514/attachment-0001.sig>


More information about the devel mailing list