X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=net%2Fsched%2Fsch_ingress.c;h=c3242f727d414667a26b89b4ff68d0895645a524;hb=1e8a4455896009fde96b35c0ca102f1b82e9225a;hp=3ec741a3b44a916189a35dca5565fc06c0e57848;hpb=70790a4b5cd6c0291e5b1a2836e2832d46036ac6;p=linux-2.6.git diff --git a/net/sched/sch_ingress.c b/net/sched/sch_ingress.c index 3ec741a3b..c3242f727 100644 --- a/net/sched/sch_ingress.c +++ b/net/sched/sch_ingress.c @@ -7,13 +7,13 @@ * Authors: Jamal Hadi Salim 1999 */ -#include #include #include #include #include #include #include +#include #include #include #include @@ -40,7 +40,7 @@ #endif -#define PRIV(sch) ((struct ingress_qdisc_data *) (sch)->data) +#define PRIV(sch) qdisc_priv(sch) /* Thanks to Doron Oz for this hack @@ -151,12 +151,12 @@ static int ingress_enqueue(struct sk_buff *skb,struct Qdisc *sch) * firewall FW_* code. */ #ifdef CONFIG_NET_CLS_ACT - sch->stats.packets++; - sch->stats.bytes += skb->len; + sch->bstats.packets++; + sch->bstats.bytes += skb->len; switch (result) { case TC_ACT_SHOT: result = TC_ACT_SHOT; - sch->stats.drops++; + sch->qstats.drops++; break; case TC_ACT_STOLEN: case TC_ACT_QUEUED: @@ -176,14 +176,14 @@ static int ingress_enqueue(struct sk_buff *skb,struct Qdisc *sch) switch (result) { case TC_POLICE_SHOT: result = NF_DROP; - sch->stats.drops++; + sch->qstats.drops++; break; case TC_POLICE_RECLASSIFY: /* DSCP remarking here ? */ case TC_POLICE_OK: case TC_POLICE_UNSPEC: default: - sch->stats.packets++; - sch->stats.bytes += skb->len; + sch->bstats.packets++; + sch->bstats.bytes += skb->len; result = NF_ACCEPT; break; }; @@ -191,8 +191,8 @@ static int ingress_enqueue(struct sk_buff *skb,struct Qdisc *sch) #else D2PRINTK("Overriding result to ACCEPT\n"); result = NF_ACCEPT; - sch->stats.packets++; - sch->stats.bytes += skb->len; + sch->bstats.packets++; + sch->bstats.bytes += skb->len; #endif #endif @@ -271,10 +271,18 @@ static struct nf_hook_ops ing_ops = { .priority = NF_IP_PRI_FILTER + 1, }; +static struct nf_hook_ops ing6_ops = { + .hook = ing_hook, + .owner = THIS_MODULE, + .pf = PF_INET6, + .hooknum = NF_IP6_PRE_ROUTING, + .priority = NF_IP6_PRI_FILTER + 1, +}; + #endif #endif -int ingress_init(struct Qdisc *sch,struct rtattr *opt) +static int ingress_init(struct Qdisc *sch,struct rtattr *opt) { struct ingress_qdisc_data *p = PRIV(sch); @@ -283,34 +291,33 @@ int ingress_init(struct Qdisc *sch,struct rtattr *opt) #ifndef CONFIG_NET_CLS_ACT #ifndef CONFIG_NETFILTER printk("You MUST compile classifier actions into the kernel\n"); - goto error; + return -EINVAL; #else printk("Ingress scheduler: Classifier actions prefered over netfilter\n"); #endif #endif - if (NULL == p) - goto error; - #ifndef CONFIG_NET_CLS_ACT #ifdef CONFIG_NETFILTER if (!nf_registered) { if (nf_register_hook(&ing_ops) < 0) { printk("ingress qdisc registration error \n"); - goto error; + return -EINVAL; } nf_registered++; + + if (nf_register_hook(&ing6_ops) < 0) { + printk("IPv6 ingress qdisc registration error, " \ + "disabling IPv6 support.\n"); + } else + nf_registered++; } #endif #endif DPRINTK("ingress_init(sch %p,[qdisc %p],opt %p)\n",sch,p,opt); - memset(p, 0, sizeof(*p)); - p->filter_list = NULL; p->q = &noop_qdisc; return 0; -error: - return -EINVAL; } @@ -346,9 +353,6 @@ static void ingress_destroy(struct Qdisc *sch) p->filter_list = tp->next; tcf_destroy(tp); } - memset(p, 0, sizeof(*p)); - p->filter_list = NULL; - #if 0 /* for future use */ qdisc_destroy(p->q); @@ -418,8 +422,11 @@ static void __exit ingress_module_exit(void) unregister_qdisc(&ingress_qdisc_ops); #ifndef CONFIG_NET_CLS_ACT #ifdef CONFIG_NETFILTER - if (nf_registered) + if (nf_registered) { nf_unregister_hook(&ing_ops); + if (nf_registered > 1) + nf_unregister_hook(&ing6_ops); + } #endif #endif }