summaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_ipv4.c
diff options
context:
space:
mode:
authorDenis V. Lunev <den@openvz.org>2008-04-03 14:31:33 -0700
committerDavid S. Miller <davem@davemloft.net>2008-04-03 14:31:33 -0700
commit046ee902357adc046d041441956ec7eeb30c77c4 (patch)
tree7e230cfad9809751d4164f0946ea4e8b5d484c39 /net/ipv4/tcp_ipv4.c
parent1ed8516f09e510e4595bc900ad9266c15aacfdd2 (diff)
downloadop-kernel-dev-046ee902357adc046d041441956ec7eeb30c77c4.zip
op-kernel-dev-046ee902357adc046d041441956ec7eeb30c77c4.tar.gz
[NETNS]: Create tcp control socket in the each namespace.
Signed-off-by: Denis V. Lunev <den@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_ipv4.c')
-rw-r--r--net/ipv4/tcp_ipv4.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index dc8c3dc..1d4a77a 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -2488,11 +2488,28 @@ struct proto tcp_prot = {
#endif
};
+
+static int __net_init tcp_sk_init(struct net *net)
+{
+ return inet_ctl_sock_create(&net->ipv4.tcp_sock,
+ PF_INET, SOCK_RAW, IPPROTO_TCP, net);
+}
+
+static void __net_exit tcp_sk_exit(struct net *net)
+{
+ inet_ctl_sock_destroy(net->ipv4.tcp_sock);
+}
+
+static struct pernet_operations __net_initdata tcp_sk_ops = {
+ .init = tcp_sk_init,
+ .exit = tcp_sk_exit,
+};
+
void __init tcp_v4_init(void)
{
- if (inet_ctl_sock_create(&tcp_sock, PF_INET, SOCK_RAW,
- IPPROTO_TCP, &init_net) < 0)
+ if (register_pernet_device(&tcp_sk_ops))
panic("Failed to create the TCP control socket.\n");
+ tcp_sock = init_net.ipv4.tcp_sock;
}
EXPORT_SYMBOL(ipv4_specific);
OpenPOWER on IntegriCloud