Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

tcp: Reset tcp connections in SYN-SENT state

Userspace sends tcp connection (sock) destroy on network switch
i.e switching the default network of the device between multiple
networks(Cellular/Wifi/Ethernet).

Kernel though doesn't send reset for the connections in SYN-SENT state
and these connections continue to remain.
Even as per RFC 793, there is no hard rule to not send RST on ABORT in
this state.

Modify tcp_abort and tcp_disconnect behavior to send RST for connections
in syn-sent state to avoid lingering connections on network switch.

Signed-off-by: Manoj Basapathi <manojbm@codeaurora.org>
Signed-off-by: Sauvik Saha <ssaha@codeaurora.org>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Manoj Basapathi and committed by
David S. Miller
e880f8b3 cc0626c2

+2 -3
+2 -3
net/ipv4/tcp.c
··· 2888 2888 { 2889 2889 return (1 << state) & 2890 2890 (TCPF_ESTABLISHED | TCPF_CLOSE_WAIT | TCPF_FIN_WAIT1 | 2891 - TCPF_FIN_WAIT2 | TCPF_SYN_RECV); 2891 + TCPF_FIN_WAIT2 | TCPF_SYN_RECV | TCPF_SYN_SENT); 2892 2892 } 2893 2893 2894 2894 static void tcp_rtx_queue_purge(struct sock *sk) ··· 2954 2954 */ 2955 2955 tcp_send_active_reset(sk, gfp_any()); 2956 2956 sk->sk_err = ECONNRESET; 2957 - } else if (old_state == TCP_SYN_SENT) 2958 - sk->sk_err = ECONNRESET; 2957 + } 2959 2958 2960 2959 tcp_clear_xmit_timers(sk); 2961 2960 __skb_queue_purge(&sk->sk_receive_queue);