aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorDaniel Lezcano <dlezcano@fr.ibm.com>2008-03-21 07:14:17 -0400
committerDavid S. Miller <davem@davemloft.net>2008-03-21 07:14:17 -0400
commit0c96d8c50bffb7f02690dd8a8cf1adb8e07e100f (patch)
tree9add3d8686b41aa3022b49d9cc57710865245e26 /net
parentf40c8174d3c21bf178283f3ef3aa8c7bf238fdec (diff)
[NETNS][IPV6] udp6 - make proc per namespace
The proc init/exit functions take a new network namespace parameter in order to register/unregister /proc/net/udp6 for a namespace. Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/udp.c12
-rw-r--r--net/ipv4/udplite.c2
-rw-r--r--net/ipv6/af_inet6.c19
-rw-r--r--net/ipv6/udp.c8
-rw-r--r--net/ipv6/udplite.c4
5 files changed, 25 insertions, 20 deletions
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 049e92519616..a98c43c0a89c 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1632,7 +1632,7 @@ static int udp_seq_release(struct inode *inode, struct file *file)
1632} 1632}
1633 1633
1634/* ------------------------------------------------------------------------ */ 1634/* ------------------------------------------------------------------------ */
1635int udp_proc_register(struct udp_seq_afinfo *afinfo) 1635int udp_proc_register(struct net *net, struct udp_seq_afinfo *afinfo)
1636{ 1636{
1637 struct proc_dir_entry *p; 1637 struct proc_dir_entry *p;
1638 int rc = 0; 1638 int rc = 0;
@@ -1645,7 +1645,7 @@ int udp_proc_register(struct udp_seq_afinfo *afinfo)
1645 afinfo->seq_fops->llseek = seq_lseek; 1645 afinfo->seq_fops->llseek = seq_lseek;
1646 afinfo->seq_fops->release = udp_seq_release; 1646 afinfo->seq_fops->release = udp_seq_release;
1647 1647
1648 p = proc_net_fops_create(&init_net, afinfo->name, S_IRUGO, afinfo->seq_fops); 1648 p = proc_net_fops_create(net, afinfo->name, S_IRUGO, afinfo->seq_fops);
1649 if (p) 1649 if (p)
1650 p->data = afinfo; 1650 p->data = afinfo;
1651 else 1651 else
@@ -1653,11 +1653,11 @@ int udp_proc_register(struct udp_seq_afinfo *afinfo)
1653 return rc; 1653 return rc;
1654} 1654}
1655 1655
1656void udp_proc_unregister(struct udp_seq_afinfo *afinfo) 1656void udp_proc_unregister(struct net *net, struct udp_seq_afinfo *afinfo)
1657{ 1657{
1658 if (!afinfo) 1658 if (!afinfo)
1659 return; 1659 return;
1660 proc_net_remove(&init_net, afinfo->name); 1660 proc_net_remove(net, afinfo->name);
1661 memset(afinfo->seq_fops, 0, sizeof(*afinfo->seq_fops)); 1661 memset(afinfo->seq_fops, 0, sizeof(*afinfo->seq_fops));
1662} 1662}
1663 1663
@@ -1709,12 +1709,12 @@ static struct udp_seq_afinfo udp4_seq_afinfo = {
1709 1709
1710int __init udp4_proc_init(void) 1710int __init udp4_proc_init(void)
1711{ 1711{
1712 return udp_proc_register(&udp4_seq_afinfo); 1712 return udp_proc_register(&init_net, &udp4_seq_afinfo);
1713} 1713}
1714 1714
1715void udp4_proc_exit(void) 1715void udp4_proc_exit(void)
1716{ 1716{
1717 udp_proc_unregister(&udp4_seq_afinfo); 1717 udp_proc_unregister(&init_net, &udp4_seq_afinfo);
1718} 1718}
1719#endif /* CONFIG_PROC_FS */ 1719#endif /* CONFIG_PROC_FS */
1720 1720
diff --git a/net/ipv4/udplite.c b/net/ipv4/udplite.c
index d49c6d68c8a9..2469b5104587 100644
--- a/net/ipv4/udplite.c
+++ b/net/ipv4/udplite.c
@@ -105,7 +105,7 @@ void __init udplite4_register(void)
105 inet_register_protosw(&udplite4_protosw); 105 inet_register_protosw(&udplite4_protosw);
106 106
107#ifdef CONFIG_PROC_FS 107#ifdef CONFIG_PROC_FS
108 if (udp_proc_register(&udplite4_seq_afinfo)) /* udplite4_proc_init() */ 108 if (udp_proc_register(&init_net, &udplite4_seq_afinfo))
109 printk(KERN_ERR "%s: Cannot register /proc!\n", __func__); 109 printk(KERN_ERR "%s: Cannot register /proc!\n", __func__);
110#endif 110#endif
111 return; 111 return;
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index 730a861b8f41..e3e09147d134 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -842,6 +842,8 @@ static void cleanup_ipv6_mibs(void)
842 842
843static int inet6_net_init(struct net *net) 843static int inet6_net_init(struct net *net)
844{ 844{
845 int err = 0;
846
845 net->ipv6.sysctl.bindv6only = 0; 847 net->ipv6.sysctl.bindv6only = 0;
846 net->ipv6.sysctl.flush_delay = 0; 848 net->ipv6.sysctl.flush_delay = 0;
847 net->ipv6.sysctl.ip6_rt_max_size = 4096; 849 net->ipv6.sysctl.ip6_rt_max_size = 4096;
@@ -853,12 +855,20 @@ static int inet6_net_init(struct net *net)
853 net->ipv6.sysctl.ip6_rt_min_advmss = IPV6_MIN_MTU - 20 - 40; 855 net->ipv6.sysctl.ip6_rt_min_advmss = IPV6_MIN_MTU - 20 - 40;
854 net->ipv6.sysctl.icmpv6_time = 1*HZ; 856 net->ipv6.sysctl.icmpv6_time = 1*HZ;
855 857
856 return 0; 858#ifdef CONFIG_PROC_FS
859 err = udp6_proc_init(net);
860 if (err)
861 goto out;
862out:
863#endif
864 return err;
857} 865}
858 866
859static void inet6_net_exit(struct net *net) 867static void inet6_net_exit(struct net *net)
860{ 868{
861 return; 869#ifdef CONFIG_PROC_FS
870 udp6_proc_exit(net);
871#endif
862} 872}
863 873
864static struct pernet_operations inet6_net_ops = { 874static struct pernet_operations inet6_net_ops = {
@@ -943,8 +953,6 @@ static int __init inet6_init(void)
943 goto proc_raw6_fail; 953 goto proc_raw6_fail;
944 if (tcp6_proc_init()) 954 if (tcp6_proc_init())
945 goto proc_tcp6_fail; 955 goto proc_tcp6_fail;
946 if (udp6_proc_init())
947 goto proc_udp6_fail;
948 if (udplite6_proc_init()) 956 if (udplite6_proc_init())
949 goto proc_udplite6_fail; 957 goto proc_udplite6_fail;
950 if (ipv6_misc_proc_init()) 958 if (ipv6_misc_proc_init())
@@ -1029,8 +1037,6 @@ proc_anycast6_fail:
1029proc_misc6_fail: 1037proc_misc6_fail:
1030 udplite6_proc_exit(); 1038 udplite6_proc_exit();
1031proc_udplite6_fail: 1039proc_udplite6_fail:
1032 udp6_proc_exit();
1033proc_udp6_fail:
1034 tcp6_proc_exit(); 1040 tcp6_proc_exit();
1035proc_tcp6_fail: 1041proc_tcp6_fail:
1036 raw6_proc_exit(); 1042 raw6_proc_exit();
@@ -1092,7 +1098,6 @@ static void __exit inet6_exit(void)
1092 ac6_proc_exit(); 1098 ac6_proc_exit();
1093 ipv6_misc_proc_exit(); 1099 ipv6_misc_proc_exit();
1094 udplite6_proc_exit(); 1100 udplite6_proc_exit();
1095 udp6_proc_exit();
1096 tcp6_proc_exit(); 1101 tcp6_proc_exit();
1097 raw6_proc_exit(); 1102 raw6_proc_exit();
1098#endif 1103#endif
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index d6e311f6c8eb..af619d48ba80 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -989,13 +989,13 @@ static struct udp_seq_afinfo udp6_seq_afinfo = {
989 .seq_fops = &udp6_seq_fops, 989 .seq_fops = &udp6_seq_fops,
990}; 990};
991 991
992int __init udp6_proc_init(void) 992int udp6_proc_init(struct net *net)
993{ 993{
994 return udp_proc_register(&udp6_seq_afinfo); 994 return udp_proc_register(net, &udp6_seq_afinfo);
995} 995}
996 996
997void udp6_proc_exit(void) { 997void udp6_proc_exit(struct net *net) {
998 udp_proc_unregister(&udp6_seq_afinfo); 998 udp_proc_unregister(net, &udp6_seq_afinfo);
999} 999}
1000#endif /* CONFIG_PROC_FS */ 1000#endif /* CONFIG_PROC_FS */
1001 1001
diff --git a/net/ipv6/udplite.c b/net/ipv6/udplite.c
index 87d4202522ee..815190be528c 100644
--- a/net/ipv6/udplite.c
+++ b/net/ipv6/udplite.c
@@ -115,11 +115,11 @@ static struct udp_seq_afinfo udplite6_seq_afinfo = {
115 115
116int __init udplite6_proc_init(void) 116int __init udplite6_proc_init(void)
117{ 117{
118 return udp_proc_register(&udplite6_seq_afinfo); 118 return udp_proc_register(&init_net, &udplite6_seq_afinfo);
119} 119}
120 120
121void udplite6_proc_exit(void) 121void udplite6_proc_exit(void)
122{ 122{
123 udp_proc_unregister(&udplite6_seq_afinfo); 123 udp_proc_unregister(&init_net, &udplite6_seq_afinfo);
124} 124}
125#endif 125#endif