Page MenuHomeFreeBSD

Remove TCP option alignment padding
AbandonedPublic

Authored by rscheff on Jun 10 2020, 6:47 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sep 9 2025, 9:05 PM
Unknown Object (File)
Sep 1 2025, 6:34 PM
Unknown Object (File)
Aug 1 2025, 6:47 PM
Unknown Object (File)
Jul 27 2025, 5:36 AM
Unknown Object (File)
Jul 22 2025, 2:00 PM
Unknown Object (File)
Jul 22 2025, 2:00 PM
Unknown Object (File)
Jul 22 2025, 2:00 PM
Unknown Object (File)
Jun 18 2025, 8:08 AM
Subscribers

Details

Reviewers
tuexen
jtl
rrs
Group Reviewers
transport
Summary

As TCP SYN option space is scarce, padding each option
individually for a 32bit alignment seems wasteful.

This is currently a placeholder, to be extended when
the AccECN option with variable length is added.

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 31617
Build 29204: arc lint + arc unit

Event Timeline

Why are you removing the NOP Pad chunks? IP options *must* be a multiple of 4 which is what the pad does, taking
it out is going to make the options incorrect I would think??

The overall TCP option space needs to be 4 octet align (which I believe is still in the code, as there should be a block after this to stuff in final EOL / NOPs; see line 1857/1832ff)

Each individual option isn't strictly required to be 4 octet aligned - I believe that was a legacy optimization for a "fast path" pass for parsing options quickly, but TCP required all stacks to be able to process options byte-by-byte also. As long as I can remember, FBSD was going byte-oriented through the TCP option space - there never existed the 4-byte aligned fast path to begin with - in our stack at least.

The problem really arises by stacking various (and potentially variable length) options and aligning each to 4 bytes; this may burn multiple times 1..3 NOP bytes, which could be used by a variable length option such as AccECN to provide another field (or allow AccECN / MPTCP options to exist at all).

Let us discuss this on the bi-weekly transport call... I'm not convinced that the gain you get from this is higher than the risk to run into bugs on peer implementations.

Certainly; as currently this doesn't have a ready-to-go use case, this Diff is not intended for immediate commit. Also, this change could certainly be dependent on the (negotiated) features of the TCP session (e.g. MPTCP, AccECN, AO, ...) once these other features become available/ready.

Discussed in @transport call, abandoning as no immediate need, and high liklihood to break LRO and no gain. Also, the options should be stacked in such a way to minimize NOPs already.