Change FreeBSD 7 so that it returns TCP options in

the same order that FreeBSD 6 and before did.  Doug
White and the other bloodhounds at ISC discovered that
while FreeBSD 7's ordering of options was more efficient,
it caused some cable modem routers to ignore the
SYN-ACKs ordered in this fashion.

The placement of sackOK after the timestamp option seems
to be the critical difference:

FreeBSD 6:
<mss 1460,nop,wscale 1,nop,nop,timestamp 3512155768 0,sackOK,eol>

FreeBSD 7.0:
<mss 1460,nop,wscale 3,sackOK,timestamp 1370692577 0>

FreeBSD 7.0 + this change:
<mss 1460,nop,wscale 3,nop,nop,timestamp 7371813 0,sackOK,eol>

MFC after: 1 week
This commit is contained in:
Mike Silbersack 2008-02-24 05:13:20 +00:00
parent cebb2edba8
commit ea346b19cc

View File

@ -238,14 +238,17 @@ struct tcpcb {
* to tcp_dooptions and tcp_addoptions.
* The binary order of the to_flags is relevant for packing of the
* options in tcp_addoptions.
* SACK should be kept after TS; some broken cable modem / router
* devices were found in the field that ignore SYN-ACKs with
* SACK before TS.
*/
struct tcpopt {
u_long to_flags; /* which options are present */
#define TOF_MSS 0x0001 /* maximum segment size */
#define TOF_SCALE 0x0002 /* window scaling */
#define TOF_SACKPERM 0x0004 /* SACK permitted */
#define TOF_TS 0x0010 /* timestamp */
#define TOF_SIGNATURE 0x0040 /* TCP-MD5 signature option (RFC2385) */
#define TOF_SIGNATURE 0x0020 /* TCP-MD5 signature option (RFC2385) */
#define TOF_SACKPERM 0x0040 /* SACK permitted */
#define TOF_SACK 0x0080 /* Peer sent SACK option */
#define TOF_MAXOPT 0x0100
u_int32_t to_tsval; /* new timestamp */