diff options
Diffstat (limited to 'net/ipv4/tcp_ipv4.c')
-rw-r--r-- | net/ipv4/tcp_ipv4.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index dc8c3dc75fe5..1d4a77acdc0b 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 | |||
2492 | static 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 | |||
2498 | static void __net_exit tcp_sk_exit(struct net *net) | ||
2499 | { | ||
2500 | inet_ctl_sock_destroy(net->ipv4.tcp_sock); | ||
2501 | } | ||
2502 | |||
2503 | static struct pernet_operations __net_initdata tcp_sk_ops = { | ||
2504 | .init = tcp_sk_init, | ||
2505 | .exit = tcp_sk_exit, | ||
2506 | }; | ||
2507 | |||
2491 | void __init tcp_v4_init(void) | 2508 | void __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 | ||
2498 | EXPORT_SYMBOL(ipv4_specific); | 2515 | EXPORT_SYMBOL(ipv4_specific); |