All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] tcp: Reset bytes_acked and bytes_received when disconnecting
@ 2019-07-06 23:13 Christoph Paasch
  2019-07-08 12:26 ` Eric Dumazet
  2019-07-09  2:30 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Christoph Paasch @ 2019-07-06 23:13 UTC (permalink / raw)
  To: netdev; +Cc: David Miller, Eric Dumazet

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>
---
 net/ipv4/tcp.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 7dc9ab84bb69..2eebd092c3c1 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -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;
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net] tcp: Reset bytes_acked and bytes_received when disconnecting
  2019-07-06 23:13 [PATCH net] tcp: Reset bytes_acked and bytes_received when disconnecting Christoph Paasch
@ 2019-07-08 12:26 ` Eric Dumazet
  2019-07-09  2:30 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Dumazet @ 2019-07-08 12:26 UTC (permalink / raw)
  To: Christoph Paasch; +Cc: netdev, David Miller

On Sun, Jul 7, 2019 at 1:13 AM Christoph Paasch <cpaasch@apple.com> wrote:
>
> 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>

I am sure other fields miss their zeroing as well.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net] tcp: Reset bytes_acked and bytes_received when disconnecting
  2019-07-06 23:13 [PATCH net] tcp: Reset bytes_acked and bytes_received when disconnecting Christoph Paasch
  2019-07-08 12:26 ` Eric Dumazet
@ 2019-07-09  2:30 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2019-07-09  2:30 UTC (permalink / raw)
  To: cpaasch; +Cc: netdev, edumazet

From: Christoph Paasch <cpaasch@apple.com>
Date: Sat, 06 Jul 2019 16:13:07 -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>

Applied and queued up for -stable.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-07-09  2:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-06 23:13 [PATCH net] tcp: Reset bytes_acked and bytes_received when disconnecting Christoph Paasch
2019-07-08 12:26 ` Eric Dumazet
2019-07-09  2:30 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.