[NET] share tcp_v4_destroy_sock with tcpv6

tcp_v6_destroy_sock just extends tcp_v4_destroy_sock, so reuse the
tcp_v4_destroy_sock instead of cut'n'pasting it into tcpv6.
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@conectiva.com.br>
Signed-off-by: default avatarDavid S. Miller <davem@redhat.com>
parent f42f6519
...@@ -2094,7 +2094,7 @@ static int tcp_v4_init_sock(struct sock *sk) ...@@ -2094,7 +2094,7 @@ static int tcp_v4_init_sock(struct sock *sk)
return 0; return 0;
} }
static int tcp_v4_destroy_sock(struct sock *sk) int tcp_v4_destroy_sock(struct sock *sk)
{ {
struct tcp_opt *tp = tcp_sk(sk); struct tcp_opt *tp = tcp_sk(sk);
...@@ -2118,6 +2118,8 @@ static int tcp_v4_destroy_sock(struct sock *sk) ...@@ -2118,6 +2118,8 @@ static int tcp_v4_destroy_sock(struct sock *sk)
return 0; return 0;
} }
EXPORT_SYMBOL(tcp_v4_destroy_sock);
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
/* Proc filesystem TCP sock list dumping. */ /* Proc filesystem TCP sock list dumping. */
......
...@@ -1892,25 +1892,9 @@ static int tcp_v6_init_sock(struct sock *sk) ...@@ -1892,25 +1892,9 @@ static int tcp_v6_init_sock(struct sock *sk)
static int tcp_v6_destroy_sock(struct sock *sk) static int tcp_v6_destroy_sock(struct sock *sk)
{ {
struct tcp_opt *tp = tcp_sk(sk); extern int tcp_v4_destroy_sock(struct sock *sk);
tcp_clear_xmit_timers(sk);
/* Cleanup up the write buffer. */
sk_stream_writequeue_purge(sk);
/* Cleans up our, hopefully empty, out_of_order_queue. */
__skb_queue_purge(&tp->out_of_order_queue);
/* Clean prequeue, it must be empty really */
__skb_queue_purge(&tp->ucopy.prequeue);
/* Clean up a referenced TCP bind bucket. */
if (tcp_sk(sk)->bind_hash)
tcp_put_port(sk);
atomic_dec(&tcp_sockets_allocated);
tcp_v4_destroy_sock(sk);
return inet6_destroy_sock(sk); return inet6_destroy_sock(sk);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment