Re: [regression] TCP_MD5SIG on established sockets
From: Eric Dumazet
Date: Wed Jul 01 2020 - 13:24:32 EST
On Tue, Jun 30, 2020 at 3:07 PM Eric Dumazet <edumazet@xxxxxxxxxx> wrote:
> Oh well, tcp_syn_options() is supposed to have the same logic.
>
> Maybe we have an issue with SYNCOOKIES (with MD5 + TS + SACK)
>
> Nice can of worms.
Yes, MD5 does not like SYNCOOKIES in some cases.
In this trace, S is a linux host, the SYNACK is a syncookie.
C host is attempting a SYN with MD5+TS+SACK, which a standard linux
host would not attempt.
But we could expect another stack to attempt this combination.
TCP stack believes it can encode selected TCP options (in the TSVAL value),
but since MD5 option is set, TS option is not sent in the SYNACK.
However we still send other options that MUST not be sent if TS option
could not fit the TCP option space.
10:12:15.464591 IP C > S: Flags [S], seq 4202415601, win 65535,
options [nop,nop,md5 valid,mss 65495,sackOK,TS val 456965269 ecr
0,nop,wscale 8], length 0
10:12:15.464602 IP S > C: Flags [S.], seq 253516766, ack 4202415602,
win 65535, options [nop,nop,md5 valid,mss
65495,nop,nop,sackOK,nop,wscale 8], length 0
<When ACK packets comes back from client, the server has no state and
no TS ecr value, so must assume no option was negotiated>
10:12:15.464611 IP C > S: Flags [.], ack 1, win 256, options
[nop,nop,md5 valid], length 0
10:12:15.464678 IP C > S: Flags [P.], seq 1:13, ack 1, win 256,
options [nop,nop,md5 valid], length 12
10:12:15.464685 IP S > C: Flags [.], ack 13, win 65535, options
[nop,nop,md5 valid], length 0
We can see for instance the windows are wrong by a 256 factor (wscale 8)