tcp/dccp: fix behavior of stale SYN_RECV request sockets
When a TCP/DCCP listener is closed, its pending SYN_RECV request sockets
become stale, meaning 3WHS can not complete.
But current behavior is wrong :
incoming packets finding such stale sockets are dropped.
We need instead to cleanup the request socket and perform another
lookup :
- Incoming ACK will give a RST answer,
- SYN rtx might find another listener if available.
- We expedite cleanup of request sockets and old listener socket.
Fixes: 079096f103
("tcp/dccp: install syn_recv requests into ehash table")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
bbb300eb97
commit
4bdc3d6614
@@ -1363,6 +1363,7 @@ static int tcp_v6_rcv(struct sk_buff *skb)
|
||||
th = tcp_hdr(skb);
|
||||
hdr = ipv6_hdr(skb);
|
||||
|
||||
lookup:
|
||||
sk = __inet6_lookup_skb(&tcp_hashinfo, skb, th->source, th->dest,
|
||||
inet6_iif(skb));
|
||||
if (!sk)
|
||||
@@ -1382,8 +1383,12 @@ process:
|
||||
reqsk_put(req);
|
||||
goto discard_it;
|
||||
}
|
||||
if (sk->sk_state == TCP_LISTEN)
|
||||
if (likely(sk->sk_state == TCP_LISTEN)) {
|
||||
nsk = tcp_check_req(sk, skb, req, false);
|
||||
} else {
|
||||
inet_csk_reqsk_queue_drop(sk, req);
|
||||
goto lookup;
|
||||
}
|
||||
if (!nsk) {
|
||||
reqsk_put(req);
|
||||
goto discard_it;
|
||||
|
Reference in New Issue
Block a user