* [PATCH net-next] tcp: diag: add support for request sockets to tcp_abort()
@ 2015-12-18 0:14 Eric Dumazet
2015-12-18 8:38 ` Lorenzo Colitti
2015-12-18 21:07 ` David Miller
0 siblings, 2 replies; 5+ messages in thread
From: Eric Dumazet @ 2015-12-18 0:14 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Lorenzo Colitti
From: Eric Dumazet <edumazet@google.com>
Adding support for SYN_RECV request sockets to tcp_abort()
is quite easy after our tcp listener rewrite.
Note that we also need to better handle listeners, or we might
leak not yet accepted children, because of a missing
inet_csk_listen_stop() call.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Lorenzo Colitti <lorenzo@google.com>
---
net/ipv4/tcp.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 2c0e340518d2..cc7aaa507abf 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -3083,6 +3083,15 @@ EXPORT_SYMBOL_GPL(tcp_done);
int tcp_abort(struct sock *sk, int err)
{
if (!sk_fullsock(sk)) {
+ if (sk->sk_state == TCP_NEW_SYN_RECV) {
+ struct request_sock *req = inet_reqsk(sk);
+
+ local_bh_disable();
+ inet_csk_reqsk_queue_drop_and_put(req->rsk_listener,
+ req);
+ local_bh_enable();
+ return 0;
+ }
sock_gen_put(sk);
return -EOPNOTSUPP;
}
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] tcp: diag: add support for request sockets to tcp_abort()
2015-12-18 0:14 [PATCH net-next] tcp: diag: add support for request sockets to tcp_abort() Eric Dumazet
@ 2015-12-18 8:38 ` Lorenzo Colitti
2015-12-18 12:46 ` Eric Dumazet
2015-12-18 21:07 ` David Miller
1 sibling, 1 reply; 5+ messages in thread
From: Lorenzo Colitti @ 2015-12-18 8:38 UTC (permalink / raw)
To: Eric Dumazet; +Cc: David Miller, netdev
On Fri, Dec 18, 2015 at 9:14 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> Adding support for SYN_RECV request sockets to tcp_abort()
> is quite easy after our tcp listener rewrite.
I added test coverage for this to our tests.
Without this patch, attempting to destroy an SYN_RECV socket using
SOCK_DESTROY results in EOPNOTSUPP. With this patch, SOCK_DESTROY
succeeds, and after it does, sock_diag reports no child sockets.
Tested-by: Lorenzo Colitti <lorenzo@google.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] tcp: diag: add support for request sockets to tcp_abort()
2015-12-18 8:38 ` Lorenzo Colitti
@ 2015-12-18 12:46 ` Eric Dumazet
2015-12-19 7:12 ` Lorenzo Colitti
0 siblings, 1 reply; 5+ messages in thread
From: Eric Dumazet @ 2015-12-18 12:46 UTC (permalink / raw)
To: Lorenzo Colitti; +Cc: David Miller, netdev
On Fri, 2015-12-18 at 17:38 +0900, Lorenzo Colitti wrote:
> On Fri, Dec 18, 2015 at 9:14 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> > Adding support for SYN_RECV request sockets to tcp_abort()
> > is quite easy after our tcp listener rewrite.
>
> I added test coverage for this to our tests.
>
> Without this patch, attempting to destroy an SYN_RECV socket using
> SOCK_DESTROY results in EOPNOTSUPP. With this patch, SOCK_DESTROY
> succeeds, and after it does, sock_diag reports no child sockets.
>
> Tested-by: Lorenzo Colitti <lorenzo@google.com>
I am curious, did you use packetdrill for this ?
I was about to write a packetdrill test as well ;)
Thanks !
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] tcp: diag: add support for request sockets to tcp_abort()
2015-12-18 0:14 [PATCH net-next] tcp: diag: add support for request sockets to tcp_abort() Eric Dumazet
2015-12-18 8:38 ` Lorenzo Colitti
@ 2015-12-18 21:07 ` David Miller
1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2015-12-18 21:07 UTC (permalink / raw)
To: eric.dumazet; +Cc: netdev, lorenzo
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Thu, 17 Dec 2015 16:14:11 -0800
> From: Eric Dumazet <edumazet@google.com>
>
> Adding support for SYN_RECV request sockets to tcp_abort()
> is quite easy after our tcp listener rewrite.
>
> Note that we also need to better handle listeners, or we might
> leak not yet accepted children, because of a missing
> inet_csk_listen_stop() call.
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
Applied, thanks Eric.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-12-19 7:12 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-18 0:14 [PATCH net-next] tcp: diag: add support for request sockets to tcp_abort() Eric Dumazet
2015-12-18 8:38 ` Lorenzo Colitti
2015-12-18 12:46 ` Eric Dumazet
2015-12-19 7:12 ` Lorenzo Colitti
2015-12-18 21:07 ` 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.