Improved TCP syncookie implementation

Andre Oppermann andre at freebsd.org
Wed Sep 13 11:56:57 PDT 2006


Igor Sysoev wrote:
> On Sun, 3 Sep 2006, Andre Oppermann wrote:
> 
>> I've pretty much rewritten our implementation of TCP syncookies to get
>> rid of some locking in TCP syncache and to improve their functionality.
>>
>> The RFC1323 timestamp option is used to carry the full TCP SYN+SYN/ACK
>> optional feature information.  This means that a FreeBSD host may run
>> with syncookies only and not degrade TCP connections made through it.
>> All important TCP connection setup negotiated options are preserved
>> (send/receive window scaling, SACK, MSS) without storing any state on
>> the host during the SYN-SYN/ACK phase.  As a nice side effect the
>> timestamps we respond with are randomized instead of directly using
>> ticks (which reveals out uptime).
> 
> As I understand syncache is used to retransmit SYN/ACK.
> What would be if
> 
> 1) a client sent SYN,
> 2) we sent SYN/ACK with cookie,
> 3) the client sent ACK, but the ACK was lost

If the client sent ACK it will retry again after the normal retransmit
timeout.

If our SYN-ACK back to client is lost we won't resend it with syncookies.
The client then has to try again which is does after the syn retransmit
timeout.

The only brokeness with syncookies used to be that we would not be able
to use RFC1323 features, most prominently window scaling.  This would
seriously affect throughput on todays links.  The improved syncookies
can carry all that information in the timestamp if present and thus
get rid of the limitations of the original syncookie concept and
implementation.

-- 
Andre



More information about the freebsd-net mailing list