aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/netfilter.h2
-rw-r--r--net/netfilter/core.c28
2 files changed, 30 insertions, 0 deletions
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 412e52ca9720..5aa931607923 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -110,6 +110,8 @@ struct nf_info
110/* Function to register/unregister hook points. */ 110/* Function to register/unregister hook points. */
111int nf_register_hook(struct nf_hook_ops *reg); 111int nf_register_hook(struct nf_hook_ops *reg);
112void nf_unregister_hook(struct nf_hook_ops *reg); 112void nf_unregister_hook(struct nf_hook_ops *reg);
113int nf_register_hooks(struct nf_hook_ops *reg, unsigned int n);
114void nf_unregister_hooks(struct nf_hook_ops *reg, unsigned int n);
113 115
114/* Functions to register get/setsockopt ranges (non-inclusive). You 116/* Functions to register get/setsockopt ranges (non-inclusive). You
115 need to check permissions yourself! */ 117 need to check permissions yourself! */
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,