]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
tcp: fix tcpi_segs_in after connection establishment
authorEric Dumazet <edumazet@google.com>
Sun, 6 Mar 2016 17:29:21 +0000 (09:29 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 7 Mar 2016 20:47:13 +0000 (15:47 -0500)
commita9d99ce28ed359d68cf6f3c1a69038aefedf6d6a
treeda3f59ea0a25bac72ccd556dae77b24213b157e6
parent68c222a6bc90e4bf03df7ae36a9b196fa869928e
tcp: fix tcpi_segs_in after connection establishment

If final packet (ACK) of 3WHS is lost, it appears we do not properly
account the following incoming segment into tcpi_segs_in

While we are at it, starts segs_in with one, to count the SYN packet.

We do not yet count number of SYN we received for a request sock, we
might add this someday.

packetdrill script showing proper behavior after fix :

// Tests tcpi_segs_in when 3rd packet (ACK) of 3WHS is lost
0.000 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
   +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
   +0 bind(3, ..., ...) = 0
   +0 listen(3, 1) = 0

   +0 < S 0:0(0) win 32792 <mss 1000,sackOK,nop,nop>
   +0 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK>
+.020 < P. 1:1001(1000) ack 1 win 32792

   +0 accept(3, ..., ...) = 4

+.000 %{ assert tcpi_segs_in == 2, 'tcpi_segs_in=%d' % tcpi_segs_in }%

Fixes: 2efd055c53c06 ("tcp: add tcpi_segs_in and tcpi_segs_out to tcp_info")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/tcp_minisocks.c