aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/netfilter/ip_tables.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/netfilter/ip_tables.c')
-rw-r--r--net/ipv4/netfilter/ip_tables.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c
index a73afa1ba8b..600737f122d 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
2216static int __net_init ip_tables_net_init(struct net *net)
2217{
2218 return xt_proto_init(net, AF_INET);
2219}
2220
2221static void __net_exit ip_tables_net_exit(struct net *net)
2222{
2223 xt_proto_fini(net, AF_INET);
2224}
2225
2226static struct pernet_operations ip_tables_net_ops = {
2227 .init = ip_tables_net_init,
2228 .exit = ip_tables_net_exit,
2229};
2230
2216static int __init ip_tables_init(void) 2231static 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:
2247err3: 2262err3:
2248 xt_unregister_target(&ipt_standard_target); 2263 xt_unregister_target(&ipt_standard_target);
2249err2: 2264err2:
2250 xt_proto_fini(AF_INET); 2265 unregister_pernet_subsys(&ip_tables_net_ops);
2251err1: 2266err1:
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
2266EXPORT_SYMBOL(ipt_register_table); 2281EXPORT_SYMBOL(ipt_register_table);