All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net 1/1] net: tcp: Increase TCPABORTONLINGER when send RST by linger2 in keepalive timer
@ 2017-04-09 12:44 gfree.wind
  2017-04-12 17:20 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: gfree.wind @ 2017-04-09 12:44 UTC (permalink / raw)
  To: davem, kuznet, jmorris, kaber, ncardwell, netdev; +Cc: Gao Feng

From: Gao Feng <fgao@ikuai8.com>

It should increase TCPABORTONLINGER counter when send RST caused by
linger2 in keepalive timer.

Signed-off-by: Gao Feng <fgao@ikuai8.com>
---
 net/ipv4/tcp_timer.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
index b2ab411..5c01f21 100644
--- a/net/ipv4/tcp_timer.c
+++ b/net/ipv4/tcp_timer.c
@@ -650,6 +650,8 @@ static void tcp_keepalive_timer (unsigned long data)
 				tcp_time_wait(sk, TCP_FIN_WAIT2, tmo);
 				goto out;
 			}
+		} else {
+			NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPABORTONLINGER);
 		}
 		tcp_send_active_reset(sk, GFP_ATOMIC);
 		goto death;
-- 
1.9.1

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

* Re: [PATCH net 1/1] net: tcp: Increase TCPABORTONLINGER when send RST by linger2 in keepalive timer
  2017-04-09 12:44 [PATCH net 1/1] net: tcp: Increase TCPABORTONLINGER when send RST by linger2 in keepalive timer gfree.wind
@ 2017-04-12 17:20 ` David Miller
  2017-04-12 22:17   ` Gao Feng
  0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2017-04-12 17:20 UTC (permalink / raw)
  To: gfree.wind; +Cc: kuznet, jmorris, kaber, ncardwell, netdev, fgao

From: gfree.wind@foxmail.com
Date: Sun,  9 Apr 2017 20:44:41 +0800

> From: Gao Feng <fgao@ikuai8.com>
> 
> It should increase TCPABORTONLINGER counter when send RST caused by
> linger2 in keepalive timer.
> 
> Signed-off-by: Gao Feng <fgao@ikuai8.com>
> ---
>  net/ipv4/tcp_timer.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
> index b2ab411..5c01f21 100644
> --- a/net/ipv4/tcp_timer.c
> +++ b/net/ipv4/tcp_timer.c
> @@ -650,6 +650,8 @@ static void tcp_keepalive_timer (unsigned long data)
>  				tcp_time_wait(sk, TCP_FIN_WAIT2, tmo);
>  				goto out;
>  			}
> +		} else {
> +			NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPABORTONLINGER);
>  		}
>  		tcp_send_active_reset(sk, GFP_ATOMIC);
>  		goto death;

I think this else clause is completely unnecessary.  Just do it right above
the tcp_send_active_reset() call and at the same indentation level.

Alternatively, if you are trying to only bump the counter when tp->linger2 is
>= 0, then you attached the else clause to the wrong if() test.

Thank you.

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

* RE: [PATCH net 1/1] net: tcp: Increase TCPABORTONLINGER when send RST by linger2 in keepalive timer
  2017-04-12 17:20 ` David Miller
@ 2017-04-12 22:17   ` Gao Feng
  0 siblings, 0 replies; 3+ messages in thread
From: Gao Feng @ 2017-04-12 22:17 UTC (permalink / raw)
  To: 'David Miller', gfree.wind
  Cc: kuznet, jmorris, kaber, ncardwell, netdev

Hi David,

> -----Original Message-----
> From: David Miller [mailto:davem@davemloft.net]
> Sent: Thursday, April 13, 2017 1:21 AM
> To: gfree.wind@foxmail.com
> Cc: kuznet@ms2.inr.ac.ru; jmorris@namei.org; kaber@trash.net;
> ncardwell@google.com; netdev@vger.kernel.org; fgao@ikuai8.com
> Subject: Re: [PATCH net 1/1] net: tcp: Increase TCPABORTONLINGER when send
> RST by linger2 in keepalive timer
> 
> From: gfree.wind@foxmail.com
> Date: Sun,  9 Apr 2017 20:44:41 +0800
> 
> > From: Gao Feng <fgao@ikuai8.com>
> >
> > It should increase TCPABORTONLINGER counter when send RST caused by
> > linger2 in keepalive timer.
> >
> > Signed-off-by: Gao Feng <fgao@ikuai8.com>
> > ---
> >  net/ipv4/tcp_timer.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c index
> > b2ab411..5c01f21 100644
> > --- a/net/ipv4/tcp_timer.c
> > +++ b/net/ipv4/tcp_timer.c
> > @@ -650,6 +650,8 @@ static void tcp_keepalive_timer (unsigned long data)
> >  				tcp_time_wait(sk, TCP_FIN_WAIT2, tmo);
> >  				goto out;
> >  			}
> > +		} else {
> > +			NET_INC_STATS(sock_net(sk),
LINUX_MIB_TCPABORTONLINGER);
> >  		}
> >  		tcp_send_active_reset(sk, GFP_ATOMIC);
> >  		goto death;
> 
> I think this else clause is completely unnecessary.  Just do it right
above the
> tcp_send_active_reset() call and at the same indentation level.
> 
> Alternatively, if you are trying to only bump the counter when tp->linger2
is
> >= 0, then you attached the else clause to the wrong if() test.
> 
> Thank you.

Actually I only want increase the TCPABORTONLINGER when linger2 is negative
which
means the timeout of FIN_WAIT2 is 0. We need to make socket state is closed
and send
one RST to peer.

Because tmo may be zero too, so increase this counter in the else block to
avoid it.

Best Regards
Feng

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

end of thread, other threads:[~2017-04-12 22:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-09 12:44 [PATCH net 1/1] net: tcp: Increase TCPABORTONLINGER when send RST by linger2 in keepalive timer gfree.wind
2017-04-12 17:20 ` David Miller
2017-04-12 22:17   ` Gao Feng

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.