简体   繁体   中英

TIME-WAIT connection refuse to accept a new SYN even it has a lager ISN

According to this SO post Can a TCP port be re-used before TIME-WAIT expires? , TIME-WAIT could be reused if the newly SYN packet has a larger ISN.

But the following SYN failed event if it has a larger ISN than the elder connection.

Detailed info:
Failed SYN: NO(54365) , ISN(3853063683)
Elder connection max packet: NO(50379), ISN(2103445551)

在此处输入图片说明

Got it now.

Both server and client has enabled option 'net.ipv4.tcp_timestamps'(enabled default under centos). So server will first check the timestamp of the newly coming SYN (Ignore ISN now): If it's lager the the corresponding value of the elder connection, then server reuse the TIMEWAIT connection (no matter whether ISN is smaller or lager now). else consider it as a lost packet of the elder connection and send the last ack of the elder connection (no matter whether ISN is smaller or lager now).

Packet 54365 has a smaller value of timestamp(tsval) than packet 50379, so it fails.

Useful Refer: https://vincent.bernat.ch/en/blog/2014-tcp-time-wait-state-linux

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM