]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
tcp: Reset bytes_acked and bytes_received when disconnecting
authorChristoph Paasch <cpaasch@apple.com>
Sat, 6 Jul 2019 23:13:07 +0000 (16:13 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 9 Jul 2019 02:29:19 +0000 (19:29 -0700)
If an app is playing tricks to reuse a socket via tcp_disconnect(),
bytes_acked/received needs to be reset to 0. Otherwise tcp_info will
report the sum of the current and the old connection..

Cc: Eric Dumazet <edumazet@google.com>
Fixes: 0df48c26d841 ("tcp: add tcpi_bytes_acked to tcp_info")
Fixes: bdd1f9edacb5 ("tcp: add tcpi_bytes_received to tcp_info")
Signed-off-by: Christoph Paasch <cpaasch@apple.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/tcp.c

index 7dc9ab84bb69aa90953e98f9763287fcee3a1659..2eebd092c3c19398313230a7942782684218a8ed 100644 (file)
@@ -2614,6 +2614,8 @@ int tcp_disconnect(struct sock *sk, int flags)
        tcp_saved_syn_free(tp);
        tp->compressed_ack = 0;
        tp->bytes_sent = 0;
+       tp->bytes_acked = 0;
+       tp->bytes_received = 0;
        tp->bytes_retrans = 0;
        tp->duplicate_sack[0].start_seq = 0;
        tp->duplicate_sack[0].end_seq = 0;