summaryrefslogtreecommitdiffstats
path: root/net/netfilter
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2006-04-06 14:09:12 -0700
committerDavid S. Miller <davem@sunset.davemloft.net>2006-04-09 22:25:32 -0700
commit972d1cb1427946f4980240363aac4e73fb375290 (patch)
tree6b4af7fa66b358ab2d167093cd4bd43baa75f0a3 /net/netfilter
parent137dc0233fba0bfa19679bdd96eb104f0e659c5a (diff)
downloadlinux-stable-972d1cb1427946f4980240363aac4e73fb375290.tar.gz
linux-stable-972d1cb1427946f4980240363aac4e73fb375290.tar.bz2
linux-stable-972d1cb1427946f4980240363aac4e73fb375290.zip
[NETFILTER]: Add helper functions for mass hook registration/unregistration
Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/netfilter')
-rw-r--r--net/netfilter/core.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/net/netfilter/core.c b/net/netfilter/core.c
index 1ceb1a6c254b..645d62105571 100644
--- a/net/netfilter/core.c
+++ b/net/netfilter/core.c
@@ -63,6 +63,34 @@ void nf_unregister_hook(struct nf_hook_ops *reg)
}
EXPORT_SYMBOL(nf_unregister_hook);
+int nf_register_hooks(struct nf_hook_ops *reg, unsigned int n)
+{
+ unsigned int i;
+ int err = 0;
+
+ for (i = 0; i < n; i++) {
+ err = nf_register_hook(&reg[i]);
+ if (err)
+ goto err;
+ }
+ return err;
+
+err:
+ if (i > 0)
+ nf_unregister_hooks(reg, i);
+ return err;
+}
+EXPORT_SYMBOL(nf_register_hooks);
+
+void nf_unregister_hooks(struct nf_hook_ops *reg, unsigned int n)
+{
+ unsigned int i;
+
+ for (i = 0; i < n; i++)
+ nf_unregister_hook(&reg[i]);
+}
+EXPORT_SYMBOL(nf_unregister_hooks);
+
unsigned int nf_iterate(struct list_head *head,
struct sk_buff **skb,
int hook,