aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/netfilter/arptable_filter.c
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2006-04-06 14:09:49 -0700
committerDavid S. Miller <davem@sunset.davemloft.net>2006-04-09 22:25:33 -0700
commit964ddaa10de8f3aeed12bc2a30726514ff309e64 (patch)
tree4cda0dcd4d5ec2bf8f06cd4375be4251e96c6a16 /net/ipv4/netfilter/arptable_filter.c
parent[NETFILTER]: Add helper functions for mass hook registration/unregistration (diff)
downloadlinux-dev-964ddaa10de8f3aeed12bc2a30726514ff309e64.tar.xz
linux-dev-964ddaa10de8f3aeed12bc2a30726514ff309e64.zip
[NETFILTER]: Clean up hook registration
Clean up hook registration by makeing use of the new mass registration and unregistration helpers. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/netfilter/arptable_filter.c')
-rw-r--r--net/ipv4/netfilter/arptable_filter.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/net/ipv4/netfilter/arptable_filter.c b/net/ipv4/netfilter/arptable_filter.c
index d0d379c7df9a..d7c472faa53b 100644
--- a/net/ipv4/netfilter/arptable_filter.c
+++ b/net/ipv4/netfilter/arptable_filter.c
@@ -181,33 +181,26 @@ static struct nf_hook_ops arpt_ops[] = {
static int __init arptable_filter_init(void)
{
- int ret, i;
+ int ret;
/* Register table */
ret = arpt_register_table(&packet_filter, &initial_table.repl);
if (ret < 0)
return ret;
- for (i = 0; i < ARRAY_SIZE(arpt_ops); i++)
- if ((ret = nf_register_hook(&arpt_ops[i])) < 0)
- goto cleanup_hooks;
+ ret = nf_register_hooks(arpt_ops, ARRAY_SIZE(arpt_ops));
+ if (ret < 0)
+ goto cleanup_table;
return ret;
-cleanup_hooks:
- while (--i >= 0)
- nf_unregister_hook(&arpt_ops[i]);
-
+cleanup_table:
arpt_unregister_table(&packet_filter);
return ret;
}
static void __exit arptable_filter_fini(void)
{
- unsigned int i;
-
- for (i = 0; i < ARRAY_SIZE(arpt_ops); i++)
- nf_unregister_hook(&arpt_ops[i]);
-
+ nf_unregister_hooks(arpt_ops, ARRAY_SIZE(arpt_ops));
arpt_unregister_table(&packet_filter);
}