aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2006-04-06 17:09:12 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2006-04-10 01:25:32 -0400
commit972d1cb1427946f4980240363aac4e73fb375290 (patch)
tree6b4af7fa66b358ab2d167093cd4bd43baa75f0a3 /net
parent137dc0233fba0bfa19679bdd96eb104f0e659c5a (diff)
[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')
-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)
63} 63}
64EXPORT_SYMBOL(nf_unregister_hook); 64EXPORT_SYMBOL(nf_unregister_hook);
65 65
66int nf_register_hooks(struct nf_hook_ops *reg, unsigned int n)
67{
68 unsigned int i;
69 int err = 0;
70
71 for (i = 0; i < n; i++) {
72 err = nf_register_hook(&reg[i]);
73 if (err)
74 goto err;
75 }
76 return err;
77
78err:
79 if (i > 0)
80 nf_unregister_hooks(reg, i);
81 return err;
82}
83EXPORT_SYMBOL(nf_register_hooks);
84
85void nf_unregister_hooks(struct nf_hook_ops *reg, unsigned int n)
86{
87 unsigned int i;
88
89 for (i = 0; i < n; i++)
90 nf_unregister_hook(&reg[i]);
91}
92EXPORT_SYMBOL(nf_unregister_hooks);
93
66unsigned int nf_iterate(struct list_head *head, 94unsigned int nf_iterate(struct list_head *head,
67 struct sk_buff **skb, 95 struct sk_buff **skb,
68 int hook, 96 int hook,