OpenVZ Forum


Home » Mailing lists » Devel » [PATCH net-2.6.26 2/5][NETNS][TCP]: Register /proc/net/tcp in a namespace.
[PATCH net-2.6.26 2/5][NETNS][TCP]: Register /proc/net/tcp in a namespace. [message #28557] Mon, 24 March 2008 10:48 Go to next message
Pavel Emelianov is currently offline  Pavel Emelianov
Messages: 1149
Registered: September 2006
Senior Member
After the commit f40c8174d3c21bf178283f3ef3aa8c7bf238fdec ([NETNS][IPV4] 
tcp - make proc handle the network namespaces) it is now possible to make
this file present in newly created namespaces.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>

---
 net/ipv4/tcp_ipv4.c |   19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 1a47719..9ec4d0f 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -2425,14 +2425,29 @@ static struct tcp_seq_afinfo tcp4_seq_afinfo = {
 	.seq_fops	= &tcp4_seq_fops,
 };
 
+static int tcp4_proc_init_net(struct net *net)
+{
+	return tcp_proc_register(net, &tcp4_seq_afinfo);
+}
+
+static void tcp4_proc_exit_net(struct net *net)
+{
+	tcp_proc_unregister(net, &tcp4_seq_afinfo);
+}
+
+static struct pernet_operations tcp4_net_ops = {
+	.init = tcp4_proc_init_net,
+	.exit = tcp4_proc_exit_net,
+};
+
 int __init tcp4_proc_init(void)
 {
-	return tcp_proc_register(&init_net, &tcp4_seq_afinfo);
+	return register_pernet_subsys(&tcp4_net_ops);
 }
 
 void tcp4_proc_exit(void)
 {
-	tcp_proc_unregister(&init_net, &tcp4_seq_afinfo);
+	unregister_pernet_subsys(&tcp4_net_ops);
 }
 #endif /* CONFIG_PROC_FS */
 
-- 
1.5.3.4
Re: [PATCH net-2.6.26 2/5][NETNS][TCP]: Register /proc/net/tcp in a namespace. [message #28589 is a reply to message #28557] Mon, 24 March 2008 21:58 Go to previous message
davem is currently offline  davem
Messages: 463
Registered: February 2006
Senior Member
From: Pavel Emelyanov <xemul@openvz.org>
Date: Mon, 24 Mar 2008 13:48:54 +0300

> After the commit f40c8174d3c21bf178283f3ef3aa8c7bf238fdec ([NETNS][IPV4] 
> tcp - make proc handle the network namespaces) it is now possible to make
> this file present in newly created namespaces.
> 
> Signed-off-by: Pavel Emelyanov <xemul@openvz.org>

Applied.
Previous Topic: [PATCH net-2.6.26 1/5][NETNS][UDP]: Register /proc/net/udp in a namespace.
Next Topic: [PATCH net-2.6.26 3/5][UDP-Lite]: Clean up proc creation a bit.
Goto Forum:
  


Current Time: Wed Jul 17 06:34:37 GMT 2024

Total time taken to generate the page: 0.02837 seconds