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)
Dec 22 2023, 9:42 PM
Unknown Object (File)
Aug 20 2023, 11:34 AM
Unknown Object (File)
Mar 23 2023, 6:31 AM
Unknown Object (File)
Mar 6 2023, 4:02 AM
Unknown Object (File)
Apr 11 2017, 8:31 AM
Unknown Object (File)
Apr 8 2017, 10:30 PM
Unknown Object (File)
Nov 10 2016, 11:04 AM
Unknown Object (File)
Nov 9 2016, 11:35 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.