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
Unknown Object (File)
Fri, Nov 29, 4:31 AM
Unknown Object (File)
Oct 16 2024, 8:16 AM
Unknown Object (File)
Oct 16 2024, 8:16 AM
Unknown Object (File)
Oct 4 2024, 12:34 AM
Unknown Object (File)
Oct 3 2024, 1:06 AM
Unknown Object (File)
Oct 2 2024, 2:48 PM
Unknown Object (File)
Oct 1 2024, 9:01 PM
Unknown Object (File)
Sep 29 2024, 9:01 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 Passed
Unit
No Test Coverage
Build Status
Buildable 2822
Build 2846: arc lint + arc unit

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.