diff options
author | Daniel Lezcano <dlezcano@fr.ibm.com> | 2008-03-21 07:14:17 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-03-21 07:14:17 -0400 |
commit | 0c96d8c50bffb7f02690dd8a8cf1adb8e07e100f (patch) | |
tree | 9add3d8686b41aa3022b49d9cc57710865245e26 | |
parent | f40c8174d3c21bf178283f3ef3aa8c7bf238fdec (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>
-rw-r--r-- | include/net/ipv6.h | 4 | ||||
-rw-r--r-- | include/net/udp.h | 4 | ||||
-rw-r--r-- | net/ipv4/udp.c | 12 | ||||
-rw-r--r-- | net/ipv4/udplite.c | 2 | ||||
-rw-r--r-- | net/ipv6/af_inet6.c | 19 | ||||
-rw-r--r-- | net/ipv6/udp.c | 8 | ||||
-rw-r--r-- | net/ipv6/udplite.c | 4 |
7 files changed, 29 insertions, 24 deletions
diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 8db06af1efbb..e01a563132e8 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h | |||
@@ -597,8 +597,8 @@ extern int raw6_proc_init(void); | |||
597 | extern void raw6_proc_exit(void); | 597 | extern void raw6_proc_exit(void); |
598 | extern int tcp6_proc_init(void); | 598 | extern int tcp6_proc_init(void); |
599 | extern void tcp6_proc_exit(void); | 599 | extern void tcp6_proc_exit(void); |
600 | extern int udp6_proc_init(void); | 600 | extern int udp6_proc_init(struct net *net); |
601 | extern void udp6_proc_exit(void); | 601 | extern void udp6_proc_exit(struct net *net); |
602 | extern int udplite6_proc_init(void); | 602 | extern int udplite6_proc_init(void); |
603 | extern void udplite6_proc_exit(void); | 603 | extern void udplite6_proc_exit(void); |
604 | extern int ipv6_misc_proc_init(void); | 604 | extern int ipv6_misc_proc_init(void); |
diff --git a/include/net/udp.h b/include/net/udp.h index a1b33d667199..b4cbdce883d1 100644 --- a/include/net/udp.h +++ b/include/net/udp.h | |||
@@ -200,8 +200,8 @@ struct udp_iter_state { | |||
200 | }; | 200 | }; |
201 | 201 | ||
202 | #ifdef CONFIG_PROC_FS | 202 | #ifdef CONFIG_PROC_FS |
203 | extern int udp_proc_register(struct udp_seq_afinfo *afinfo); | 203 | extern int udp_proc_register(struct net *net, struct udp_seq_afinfo *afinfo); |
204 | extern void udp_proc_unregister(struct udp_seq_afinfo *afinfo); | 204 | extern void udp_proc_unregister(struct net *net, struct udp_seq_afinfo *afinfo); |
205 | 205 | ||
206 | extern int udp4_proc_init(void); | 206 | extern int udp4_proc_init(void); |
207 | extern void udp4_proc_exit(void); | 207 | extern void udp4_proc_exit(void); |
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 | /* ------------------------------------------------------------------------ */ |
1635 | int udp_proc_register(struct udp_seq_afinfo *afinfo) | 1635 | int 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 | ||
1656 | void udp_proc_unregister(struct udp_seq_afinfo *afinfo) | 1656 | void 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 | ||
1710 | int __init udp4_proc_init(void) | 1710 | int __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 | ||
1715 | void udp4_proc_exit(void) | 1715 | void 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 | ||
843 | static int inet6_net_init(struct net *net) | 843 | static 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; | ||
862 | out: | ||
863 | #endif | ||
864 | return err; | ||
857 | } | 865 | } |
858 | 866 | ||
859 | static void inet6_net_exit(struct net *net) | 867 | static 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 | ||
864 | static struct pernet_operations inet6_net_ops = { | 874 | static 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: | |||
1029 | proc_misc6_fail: | 1037 | proc_misc6_fail: |
1030 | udplite6_proc_exit(); | 1038 | udplite6_proc_exit(); |
1031 | proc_udplite6_fail: | 1039 | proc_udplite6_fail: |
1032 | udp6_proc_exit(); | ||
1033 | proc_udp6_fail: | ||
1034 | tcp6_proc_exit(); | 1040 | tcp6_proc_exit(); |
1035 | proc_tcp6_fail: | 1041 | proc_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 | ||
992 | int __init udp6_proc_init(void) | 992 | int 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 | ||
997 | void udp6_proc_exit(void) { | 997 | void 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 | ||
116 | int __init udplite6_proc_init(void) | 116 | int __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 | ||
121 | void udplite6_proc_exit(void) | 121 | void 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 |