Page MenuHomeFreeBSD

Use 32-bit integer for TCP options flags
ClosedPublic

Authored by jtl on Mar 8 2016, 8:36 PM.
Tags
None
Referenced Files
F154344811: D5584.id14517.diff
Mon, Apr 27, 11:57 PM
Unknown Object (File)
Sun, Apr 26, 7:27 AM
Unknown Object (File)
Tue, Apr 21, 2:43 AM
Unknown Object (File)
Tue, Apr 21, 12:34 AM
Unknown Object (File)
Tue, Apr 21, 12:10 AM
Unknown Object (File)
Mon, Apr 13, 1:27 PM
Unknown Object (File)
Mon, Apr 6, 11:20 PM
Unknown Object (File)
Sun, Apr 5, 3:46 AM
Subscribers

Details

Summary

to_flags is currently a 64-bit integer; however, we only use 7 bits. Furthermore, there is no reason this needs to be a 64-bit integer for the foreseeable future.

Also, rS195654 introduced a permanent inconsistency between the to_flags value in struct tcpopt and the mask in tcp_addoptions(). Before rS195654, to_flags was u_long and the mask in tcp_addoptions() was u_int. This meant that both were 32-bit values on platforms with 32-bit longs, but could diverge otherwise. rS195654 changed to_flags to be a u_int_64t, meaning that these variables would have different lengths on platforms without a 64-bit integer.

It seems to be a "win" to convert both to_flags and the mask in tcp_addoptions() to be 32-bit variables. This should save a few cycles on 32-bit platforms, and avoids any problems/questions caused by mixing variables of different types unnecessarily.

(Converting optlen to a u_int_32t should be a no-op, but I can leave it as a u_int if anyone cares.)

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

jtl retitled this revision from to Use 32-bit integer for TCP options flags.
jtl updated this object.
jtl edited the test plan for this revision. (Show Details)
jtl added a reviewer: transport.

This has been hanging out for two weeks without comment. I plan to commit this soon, unless I receive negative feedback.

hiren added a reviewer: hiren.
This revision is now accepted and ready to land.Mar 22 2016, 3:35 PM
This revision was automatically updated to reflect the committed changes.