diff options
-rw-r--r-- | include/linux/netfilter.h | 2 | ||||
-rw-r--r-- | net/netfilter/core.c | 28 |
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. */ |
111 | int nf_register_hook(struct nf_hook_ops *reg); | 111 | int nf_register_hook(struct nf_hook_ops *reg); |
112 | void nf_unregister_hook(struct nf_hook_ops *reg); | 112 | void nf_unregister_hook(struct nf_hook_ops *reg); |
113 | int nf_register_hooks(struct nf_hook_ops *reg, unsigned int n); | ||
114 | void 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 | } |
64 | EXPORT_SYMBOL(nf_unregister_hook); | 64 | EXPORT_SYMBOL(nf_unregister_hook); |
65 | 65 | ||
66 | int 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(®[i]); | ||
73 | if (err) | ||
74 | goto err; | ||
75 | } | ||
76 | return err; | ||
77 | |||
78 | err: | ||
79 | if (i > 0) | ||
80 | nf_unregister_hooks(reg, i); | ||
81 | return err; | ||
82 | } | ||
83 | EXPORT_SYMBOL(nf_register_hooks); | ||
84 | |||
85 | void 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(®[i]); | ||
91 | } | ||
92 | EXPORT_SYMBOL(nf_unregister_hooks); | ||
93 | |||
66 | unsigned int nf_iterate(struct list_head *head, | 94 | unsigned int nf_iterate(struct list_head *head, |
67 | struct sk_buff **skb, | 95 | struct sk_buff **skb, |
68 | int hook, | 96 | int hook, |