netfilter: xtables: use xt_table for hook instantiation
[deliverable/linux.git] / net / ipv4 / netfilter / iptable_filter.c
index 1bfeaae6f62473c340c934239bae13402c8b8117..c14bb85db1d9b2ff773c7e527fb3ad75dcaf3aa8 100644 (file)
@@ -58,6 +58,7 @@ static const struct xt_table packet_filter = {
        .valid_hooks    = FILTER_VALID_HOOKS,
        .me             = THIS_MODULE,
        .af             = NFPROTO_IPV4,
+       .priority       = NF_IP_PRI_FILTER,
 };
 
 static unsigned int
@@ -77,29 +78,7 @@ iptable_filter_hook(unsigned int hook, struct sk_buff *skb,
        return ipt_do_table(skb, hook, in, out, net->ipv4.iptable_filter);
 }
 
-static struct nf_hook_ops ipt_ops[] __read_mostly = {
-       {
-               .hook           = iptable_filter_hook,
-               .owner          = THIS_MODULE,
-               .pf             = NFPROTO_IPV4,
-               .hooknum        = NF_INET_LOCAL_IN,
-               .priority       = NF_IP_PRI_FILTER,
-       },
-       {
-               .hook           = iptable_filter_hook,
-               .owner          = THIS_MODULE,
-               .pf             = NFPROTO_IPV4,
-               .hooknum        = NF_INET_FORWARD,
-               .priority       = NF_IP_PRI_FILTER,
-       },
-       {
-               .hook           = iptable_filter_hook,
-               .owner          = THIS_MODULE,
-               .pf             = NFPROTO_IPV4,
-               .hooknum        = NF_INET_LOCAL_OUT,
-               .priority       = NF_IP_PRI_FILTER,
-       },
-};
+static struct nf_hook_ops *filter_ops __read_mostly;
 
 /* Default to forward because I got too much mail already. */
 static int forward = NF_ACCEPT;
@@ -142,9 +121,11 @@ static int __init iptable_filter_init(void)
                return ret;
 
        /* Register hooks */
-       ret = nf_register_hooks(ipt_ops, ARRAY_SIZE(ipt_ops));
-       if (ret < 0)
+       filter_ops = xt_hook_link(&packet_filter, iptable_filter_hook);
+       if (IS_ERR(filter_ops)) {
+               ret = PTR_ERR(filter_ops);
                goto cleanup_table;
+       }
 
        return ret;
 
@@ -155,7 +136,7 @@ static int __init iptable_filter_init(void)
 
 static void __exit iptable_filter_fini(void)
 {
-       nf_unregister_hooks(ipt_ops, ARRAY_SIZE(ipt_ops));
+       xt_hook_unlink(&packet_filter, filter_ops);
        unregister_pernet_subsys(&iptable_filter_net_ops);
 }
 
This page took 0.027222 seconds and 5 git commands to generate.