[NET_SCHED]: Fix prio/ingress classification logic error
authorPatrick McHardy <kaber@trash.net>
Tue, 31 Jul 2007 00:07:14 +0000 (17:07 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Tue, 31 Jul 2007 09:28:18 +0000 (02:28 -0700)
Fix handling of empty or completely non-matching filter chains. In
that case -1 is returned and tcf_result is uninitialized, the
qdisc should fall back to default classification in that case.

Noticed by PJ Waskiewicz <peter.p.waskiewicz.jr@intel.com>.

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/sch_ingress.c
net/sched/sch_prio.c

index 51f16b0af198deb9e7d3810b9b0024b65ab396e2..2d32fd27496ecf8011999827f0450958d0e76486 100644 (file)
@@ -158,9 +158,8 @@ static int ingress_enqueue(struct sk_buff *skb,struct Qdisc *sch)
                        break;
                case TC_ACT_RECLASSIFY:
                case TC_ACT_OK:
-               case TC_ACT_UNSPEC:
-               default:
                        skb->tc_index = TC_H_MIN(res.classid);
+               default:
                        result = TC_ACT_OK;
                        break;
        }
index 2d8c08493d6e9275683161418c0fd26cf4ec5a37..71bafde353a6f038b083994aff7c67b4d6d040c5 100644 (file)
@@ -38,9 +38,11 @@ prio_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr)
        struct prio_sched_data *q = qdisc_priv(sch);
        u32 band = skb->priority;
        struct tcf_result res;
+       int err;
 
        *qerr = NET_XMIT_BYPASS;
        if (TC_H_MAJ(skb->priority) != sch->handle) {
+               err = tc_classify(skb, q->filter_list, &res);
 #ifdef CONFIG_NET_CLS_ACT
                switch (tc_classify(skb, q->filter_list, &res)) {
                case TC_ACT_STOLEN:
@@ -49,11 +51,8 @@ prio_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr)
                case TC_ACT_SHOT:
                        return NULL;
                }
-
-               if (!q->filter_list ) {
-#else
-               if (!q->filter_list || tc_classify(skb, q->filter_list, &res)) {
 #endif
+               if (!q->filter_list || err < 0) {
                        if (TC_H_MAJ(band))
                                band = 0;
                        band = q->prio2band[band&TC_PRIO_MAX];