aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/netns/ipv4.h1
-rw-r--r--net/ipv4/tcp_ipv4.c21
2 files changed, 20 insertions, 2 deletions
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h
index af685f71f4b..34ee348a2cf 100644
--- a/include/net/netns/ipv4.h
+++ b/include/net/netns/ipv4.h
@@ -28,6 +28,7 @@ struct netns_ipv4 {
28 struct sock *fibnl; 28 struct sock *fibnl;
29 29
30 struct sock **icmp_sk; 30 struct sock **icmp_sk;
31 struct sock *tcp_sock;
31 32
32 struct netns_frags frags; 33 struct netns_frags frags;
33#ifdef CONFIG_NETFILTER 34#ifdef CONFIG_NETFILTER
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index dc8c3dc75fe..1d4a77acdc0 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -2488,11 +2488,28 @@ struct proto tcp_prot = {
2488#endif 2488#endif
2489}; 2489};
2490 2490
2491
2492static int __net_init tcp_sk_init(struct net *net)
2493{
2494 return inet_ctl_sock_create(&net->ipv4.tcp_sock,
2495 PF_INET, SOCK_RAW, IPPROTO_TCP, net);
2496}
2497
2498static void __net_exit tcp_sk_exit(struct net *net)
2499{
2500 inet_ctl_sock_destroy(net->ipv4.tcp_sock);
2501}
2502
2503static struct pernet_operations __net_initdata tcp_sk_ops = {
2504 .init = tcp_sk_init,
2505 .exit = tcp_sk_exit,
2506};
2507
2491void __init tcp_v4_init(void) 2508void __init tcp_v4_init(void)
2492{ 2509{
2493 if (inet_ctl_sock_create(&tcp_sock, PF_INET, SOCK_RAW, 2510 if (register_pernet_device(&tcp_sk_ops))
2494 IPPROTO_TCP, &init_net) < 0)
2495 panic("Failed to create the TCP control socket.\n"); 2511 panic("Failed to create the TCP control socket.\n");
2512 tcp_sock = init_net.ipv4.tcp_sock;
2496} 2513}
2497 2514
2498EXPORT_SYMBOL(ipv4_specific); 2515EXPORT_SYMBOL(ipv4_specific);