• Eric Dumazet's avatar
    tcp: fix TCP_SYNCNT flakes · ce682ef6
    Eric Dumazet authored
    After the mentioned commit, some of our packetdrill tests became flaky.
    
    TCP_SYNCNT socket option can limit the number of SYN retransmits.
    
    retransmits_timed_out() has to compare times computations based on
    local_clock() while timers are based on jiffies. With NTP adjustments
    and roundings we can observe 999 ms delay for 1000 ms timers.
    We end up sending one extra SYN packet.
    
    Gimmick added in commit 6fa12c85 ("Revert Backoff [v3]: Calculate
    TCP's connection close threshold as a time value") makes no
    real sense for TCP_SYN_SENT sockets where no RTO backoff can happen at
    all.
    
    Lets use a simpler logic for TCP_SYN_SENT sockets and remove @syn_set
    parameter from retransmits_timed_out()
    
    Fixes: 9a568de4 ("tcp: switch TCP TS option (RFC 7323) to 1ms clock")
    Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
    Signed-off-by: default avatarYuchung Cheng <ycheng@google.com>
    Acked-by: default avatarSoheil Hassas Yeganeh <soheil@google.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    ce682ef6
tcp_timer.c 20.4 KB