Page MenuHomeFreeBSD

ipv6: leave room for link headers in UDP
ClosedPublic

Authored by gallatin on Tue, Apr 15, 5:38 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Apr 29, 10:03 PM
Unknown Object (File)
Sun, Apr 20, 8:58 PM
Unknown Object (File)
Sun, Apr 20, 9:30 AM
Unknown Object (File)
Sun, Apr 20, 6:28 AM
Unknown Object (File)
Sat, Apr 19, 10:38 AM
Unknown Object (File)
Fri, Apr 18, 9:26 AM
Unknown Object (File)
Fri, Apr 18, 9:16 AM
Unknown Object (File)
Fri, Apr 18, 6:39 AM
Subscribers

Details

Summary

UDP over IPv6 was not leaving space for link headers, resulting in the ethernet header being placed in its own mbuf at the start of an mbuf chain sent to a NIC driver. This is inefficient, in terms of allocating 2x as many header mbufs as needed, and its also confusing for drivers which may expect to find ether/ip/l4 headers together in the same mbuf.

UDP over IPv4 already did this back in 2004 e6ccd70936186495ada83c2ee0e4cf74efa19811, so I've made a patch based on the IPv4 code.

I found this when putting together a patchset to implement UDP segmentation offload, and was confused why a driver was unable to properly offload segmentation for V6.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Only question I have is why the change from hlen -> sizeof(struct ip6_hdr)

I realize that either works but I would think it slightly more efficient to continue to use hlen since that (I presume without looking) is passed in and is the size of the ip header needed (6 or 4)... or maybe
its not and this is just a safe way to handle all cases?

This revision is now accepted and ready to land.Tue, Apr 15, 6:20 PM

I will also stylistically prefer to remain hlen there. Or move the M_PREPEND(sizeof(struct)) above initialization of ulen, plen, hlen.

gallatin edited the summary of this revision. (Show Details)

Update to use hlen, which already holds the size of the ip6 hdr, as suggested by glebius

This revision now requires review to proceed.Tue, Apr 15, 7:15 PM
This revision is now accepted and ready to land.Tue, Apr 15, 7:26 PM
This revision was automatically updated to reflect the committed changes.