]> err.no Git - linux-2.6/blobdiff - net/sched/sch_gred.c
[TCP] FRTO: Plug potential LOST-bit leak
[linux-2.6] / net / sched / sch_gred.c
index 079b0a4ea1c2dbc0a3dac2b866f2aab7b8194138..3cc6dda02e2e0a1297ecc8a2d5a7e3707a4b556c 100644 (file)
  *  For all the glorious comments look at include/net/red.h
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
-#include <linux/netdevice.h>
 #include <linux/skbuff.h>
 #include <net/pkt_sched.h>
 #include <net/red.h>
@@ -146,6 +144,11 @@ static inline int gred_use_ecn(struct gred_sched *t)
        return t->red_flags & TC_RED_ECN;
 }
 
+static inline int gred_use_harddrop(struct gred_sched *t)
+{
+       return t->red_flags & TC_RED_HARDDROP;
+}
+
 static int gred_enqueue(struct sk_buff *skb, struct Qdisc* sch)
 {
        struct gred_sched_data *q=NULL;
@@ -214,7 +217,8 @@ static int gred_enqueue(struct sk_buff *skb, struct Qdisc* sch)
 
                case RED_HARD_MARK:
                        sch->qstats.overlimits++;
-                       if (!gred_use_ecn(t) || !INET_ECN_set_ce(skb)) {
+                       if (gred_use_harddrop(t) || !gred_use_ecn(t) ||
+                           !INET_ECN_set_ce(skb)) {
                                q->stats.forced_drop++;
                                goto congestion_drop;
                        }
@@ -330,7 +334,7 @@ static void gred_reset(struct Qdisc* sch)
 
        qdisc_reset_queue(sch);
 
-        for (i = 0; i < t->DPs; i++) {
+       for (i = 0; i < t->DPs; i++) {
                struct gred_sched_data *q = t->tab[i];
 
                if (!q)
@@ -388,7 +392,7 @@ static inline int gred_change_table_def(struct Qdisc *sch, struct rtattr *dps)
                               "shadowed VQ 0x%x\n", i);
                        gred_destroy_vq(table->tab[i]);
                        table->tab[i] = NULL;
-               }
+               }
        }
 
        return 0;
@@ -401,10 +405,9 @@ static inline int gred_change_vq(struct Qdisc *sch, int dp,
        struct gred_sched_data *q;
 
        if (table->tab[dp] == NULL) {
-               table->tab[dp] = kmalloc(sizeof(*q), GFP_KERNEL);
+               table->tab[dp] = kzalloc(sizeof(*q), GFP_KERNEL);
                if (table->tab[dp] == NULL)
                        return -ENOMEM;
-               memset(table->tab[dp], 0, sizeof(*q));
        }
 
        q = table->tab[dp];