aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/sch_ingress.c
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2007-12-05 04:22:43 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 17:56:06 -0500
commit41c5b317036fcb593d14b4dfd12e3318faf3af8a (patch)
treeafb68078c92947371d7723bc97c8026808f88a27 /net/sched/sch_ingress.c
parent279c2c74b6a26fbd8c3dc100a59c3ac0ff7559fa (diff)
[NETFILTER]: Use nf_register_hooks for multiple registrations
Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/sch_ingress.c')
-rw-r--r--net/sched/sch_ingress.c44
1 files changed, 18 insertions, 26 deletions
diff --git a/net/sched/sch_ingress.c b/net/sched/sch_ingress.c
index 902d82ea764b..f4af9b604f3f 100644
--- a/net/sched/sch_ingress.c
+++ b/net/sched/sch_ingress.c
@@ -231,20 +231,21 @@ ing_hook(unsigned int hook, struct sk_buff *skb,
231} 231}
232 232
233/* after ipt_filter */ 233/* after ipt_filter */
234static struct nf_hook_ops ing_ops = { 234static struct nf_hook_ops ing_ops[] = {
235 .hook = ing_hook, 235 {
236 .owner = THIS_MODULE, 236 .hook = ing_hook,
237 .pf = PF_INET, 237 .owner = THIS_MODULE,
238 .hooknum = NF_INET_PRE_ROUTING, 238 .pf = PF_INET,
239 .priority = NF_IP_PRI_FILTER + 1, 239 .hooknum = NF_INET_PRE_ROUTING,
240}; 240 .priority = NF_IP_PRI_FILTER + 1,
241 241 },
242static struct nf_hook_ops ing6_ops = { 242 {
243 .hook = ing_hook, 243 .hook = ing_hook,
244 .owner = THIS_MODULE, 244 .owner = THIS_MODULE,
245 .pf = PF_INET6, 245 .pf = PF_INET6,
246 .hooknum = NF_INET_PRE_ROUTING, 246 .hooknum = NF_INET_PRE_ROUTING,
247 .priority = NF_IP6_PRI_FILTER + 1, 247 .priority = NF_IP6_PRI_FILTER + 1,
248 },
248}; 249};
249 250
250#endif 251#endif
@@ -268,17 +269,11 @@ static int ingress_init(struct Qdisc *sch,struct rtattr *opt)
268#ifndef CONFIG_NET_CLS_ACT 269#ifndef CONFIG_NET_CLS_ACT
269#ifdef CONFIG_NETFILTER 270#ifdef CONFIG_NETFILTER
270 if (!nf_registered) { 271 if (!nf_registered) {
271 if (nf_register_hook(&ing_ops) < 0) { 272 if (nf_register_hooks(ing_ops, ARRAY_SIZE(ing_ops)) < 0) {
272 printk("ingress qdisc registration error \n"); 273 printk("ingress qdisc registration error \n");
273 return -EINVAL; 274 return -EINVAL;
274 } 275 }
275 nf_registered++; 276 nf_registered++;
276
277 if (nf_register_hook(&ing6_ops) < 0) {
278 printk("IPv6 ingress qdisc registration error, " \
279 "disabling IPv6 support.\n");
280 } else
281 nf_registered++;
282 } 277 }
283#endif 278#endif
284#endif 279#endif
@@ -385,11 +380,8 @@ static void __exit ingress_module_exit(void)
385 unregister_qdisc(&ingress_qdisc_ops); 380 unregister_qdisc(&ingress_qdisc_ops);
386#ifndef CONFIG_NET_CLS_ACT 381#ifndef CONFIG_NET_CLS_ACT
387#ifdef CONFIG_NETFILTER 382#ifdef CONFIG_NETFILTER
388 if (nf_registered) { 383 if (nf_registered)
389 nf_unregister_hook(&ing_ops); 384 nf_unregister_hooks(ing_ops, ARRAY_SIZE(ing_ops));
390 if (nf_registered > 1)
391 nf_unregister_hook(&ing6_ops);
392 }
393#endif 385#endif
394#endif 386#endif
395} 387}