diff options
author | Alexey Dobriyan <adobriyan@sw.ru> | 2008-01-31 07:49:35 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-31 22:28:06 -0500 |
commit | 3cb609d57c20027a8b39fc60b79b930a89da82d4 (patch) | |
tree | f88a4d355b6612665a0ea89ac91a746c06e2c3cc /net/ipv4 | |
parent | 715cf35ac9291f31a4fea7d022695a64cac0af80 (diff) |
[NETFILTER]: x_tables: create per-netns /proc/net/*_tables_*
Signed-off-by: Alexey Dobriyan <adobriyan@sw.ru>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/netfilter/arp_tables.c | 21 | ||||
-rw-r--r-- | net/ipv4/netfilter/ip_tables.c | 21 |
2 files changed, 36 insertions, 6 deletions
diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c index 3608675ab08c..a7591ce344d2 100644 --- a/net/ipv4/netfilter/arp_tables.c +++ b/net/ipv4/netfilter/arp_tables.c | |||
@@ -1822,11 +1822,26 @@ static struct nf_sockopt_ops arpt_sockopts = { | |||
1822 | .owner = THIS_MODULE, | 1822 | .owner = THIS_MODULE, |
1823 | }; | 1823 | }; |
1824 | 1824 | ||
1825 | static int __net_init arp_tables_net_init(struct net *net) | ||
1826 | { | ||
1827 | return xt_proto_init(net, NF_ARP); | ||
1828 | } | ||
1829 | |||
1830 | static void __net_exit arp_tables_net_exit(struct net *net) | ||
1831 | { | ||
1832 | xt_proto_fini(net, NF_ARP); | ||
1833 | } | ||
1834 | |||
1835 | static struct pernet_operations arp_tables_net_ops = { | ||
1836 | .init = arp_tables_net_init, | ||
1837 | .exit = arp_tables_net_exit, | ||
1838 | }; | ||
1839 | |||
1825 | static int __init arp_tables_init(void) | 1840 | static int __init arp_tables_init(void) |
1826 | { | 1841 | { |
1827 | int ret; | 1842 | int ret; |
1828 | 1843 | ||
1829 | ret = xt_proto_init(NF_ARP); | 1844 | ret = register_pernet_subsys(&arp_tables_net_ops); |
1830 | if (ret < 0) | 1845 | if (ret < 0) |
1831 | goto err1; | 1846 | goto err1; |
1832 | 1847 | ||
@@ -1851,7 +1866,7 @@ err4: | |||
1851 | err3: | 1866 | err3: |
1852 | xt_unregister_target(&arpt_standard_target); | 1867 | xt_unregister_target(&arpt_standard_target); |
1853 | err2: | 1868 | err2: |
1854 | xt_proto_fini(NF_ARP); | 1869 | unregister_pernet_subsys(&arp_tables_net_ops); |
1855 | err1: | 1870 | err1: |
1856 | return ret; | 1871 | return ret; |
1857 | } | 1872 | } |
@@ -1861,7 +1876,7 @@ static void __exit arp_tables_fini(void) | |||
1861 | nf_unregister_sockopt(&arpt_sockopts); | 1876 | nf_unregister_sockopt(&arpt_sockopts); |
1862 | xt_unregister_target(&arpt_error_target); | 1877 | xt_unregister_target(&arpt_error_target); |
1863 | xt_unregister_target(&arpt_standard_target); | 1878 | xt_unregister_target(&arpt_standard_target); |
1864 | xt_proto_fini(NF_ARP); | 1879 | unregister_pernet_subsys(&arp_tables_net_ops); |
1865 | } | 1880 | } |
1866 | 1881 | ||
1867 | EXPORT_SYMBOL(arpt_register_table); | 1882 | EXPORT_SYMBOL(arpt_register_table); |
diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c index a73afa1ba8b8..600737f122d2 100644 --- a/net/ipv4/netfilter/ip_tables.c +++ b/net/ipv4/netfilter/ip_tables.c | |||
@@ -2213,11 +2213,26 @@ static struct xt_match icmp_matchstruct __read_mostly = { | |||
2213 | .family = AF_INET, | 2213 | .family = AF_INET, |
2214 | }; | 2214 | }; |
2215 | 2215 | ||
2216 | static int __net_init ip_tables_net_init(struct net *net) | ||
2217 | { | ||
2218 | return xt_proto_init(net, AF_INET); | ||
2219 | } | ||
2220 | |||
2221 | static void __net_exit ip_tables_net_exit(struct net *net) | ||
2222 | { | ||
2223 | xt_proto_fini(net, AF_INET); | ||
2224 | } | ||
2225 | |||
2226 | static struct pernet_operations ip_tables_net_ops = { | ||
2227 | .init = ip_tables_net_init, | ||
2228 | .exit = ip_tables_net_exit, | ||
2229 | }; | ||
2230 | |||
2216 | static int __init ip_tables_init(void) | 2231 | static int __init ip_tables_init(void) |
2217 | { | 2232 | { |
2218 | int ret; | 2233 | int ret; |
2219 | 2234 | ||
2220 | ret = xt_proto_init(AF_INET); | 2235 | ret = register_pernet_subsys(&ip_tables_net_ops); |
2221 | if (ret < 0) | 2236 | if (ret < 0) |
2222 | goto err1; | 2237 | goto err1; |
2223 | 2238 | ||
@@ -2247,7 +2262,7 @@ err4: | |||
2247 | err3: | 2262 | err3: |
2248 | xt_unregister_target(&ipt_standard_target); | 2263 | xt_unregister_target(&ipt_standard_target); |
2249 | err2: | 2264 | err2: |
2250 | xt_proto_fini(AF_INET); | 2265 | unregister_pernet_subsys(&ip_tables_net_ops); |
2251 | err1: | 2266 | err1: |
2252 | return ret; | 2267 | return ret; |
2253 | } | 2268 | } |
@@ -2260,7 +2275,7 @@ static void __exit ip_tables_fini(void) | |||
2260 | xt_unregister_target(&ipt_error_target); | 2275 | xt_unregister_target(&ipt_error_target); |
2261 | xt_unregister_target(&ipt_standard_target); | 2276 | xt_unregister_target(&ipt_standard_target); |
2262 | 2277 | ||
2263 | xt_proto_fini(AF_INET); | 2278 | unregister_pernet_subsys(&ip_tables_net_ops); |
2264 | } | 2279 | } |
2265 | 2280 | ||
2266 | EXPORT_SYMBOL(ipt_register_table); | 2281 | EXPORT_SYMBOL(ipt_register_table); |