[PKT_SCHED]: Fix ingress qdisc to pick up IPv6 packets when using netfilter hooks.
Linux Kernel Mailing List <[email protected]>
| Newsgroups | gmane.linux.kernel.commits.2-4 |
|---|---|
| Message-ID | <[email protected]> |
ChangeSet 1.1539.1.1, 2005/02/02 14:06:35-08:00, [email protected] [PKT_SCHED]: Fix ingress qdisc to pick up IPv6 packets when using netfilter hooks. Signed-off-by: Thomas Graf <[email protected]> Signed-off-by: David S. Miller <[email protected]> sch_ingress.c | 22 ++++++++++++++++++++-- 1 files changed, 20 insertions(+), 2 deletions(-) diff -Nru a/net/sched/sch_ingress.c b/net/sched/sch_ingress.c --- a/net/sched/sch_ingress.c 2005-02-09 09:05:44 -08:00 +++ b/net/sched/sch_ingress.c 2005-02-09 09:05:44 -08:00 @@ -14,6 +14,7 @@ #include <linux/netdevice.h> #include <linux/rtnetlink.h> #include <linux/netfilter_ipv4.h> +#include <linux/netfilter_ipv6.h> #include <linux/netfilter.h> #include <linux/smp.h> #include <net/pkt_sched.h> @@ -241,6 +242,15 @@ NF_IP_PRI_FILTER + 1 }; +static struct nf_hook_ops ing6_ops = +{ + { NULL, NULL}, + ing_hook, + PF_INET6, + NF_IP6_PRE_ROUTING, + NF_IP6_PRI_FILTER + 1 +}; + int ingress_init(struct Qdisc *sch,struct rtattr *opt) { struct ingress_qdisc_data *p = PRIV(sch); @@ -249,8 +259,13 @@ if (nf_register_hook(&ing_ops) < 0) { printk("ingress qdisc registration error \n"); goto error; - } + } nf_registered++; + if (nf_register_hook(&ing6_ops) < 0) { + printk("IPv6 ingress qdisc registration error, " \ + "disabling IPv6 support.\n"); + } else + nf_registered++; } DPRINTK("ingress_init(sch %p,[qdisc %p],opt %p)\n",sch,p,opt); @@ -374,8 +389,11 @@ void cleanup_module(void) { unregister_qdisc(&ingress_qdisc_ops); - if (nf_registered) + if (nf_registered) { nf_unregister_hook(&ing_ops); + if (nf_registered > 1) + nf_unregister_hook(&ing6_ops); + } } #endif MODULE_LICENSE("GPL");