]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
[PATCH] netem: duplication fix
authorStephen Hemminger <shemminger@osdl.org>
Wed, 8 Jun 2005 16:30:09 +0000 (09:30 -0700)
committerChris Wright <chrisw@osdl.org>
Sun, 12 Jun 2005 02:45:27 +0000 (19:45 -0700)
Netem duplication can cause infinite loop in qdisc_run
because the qlen of the parent qdisc is not affected by the duplication.

Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
Signed-off-by: Chris Wright <chrisw@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
net/sched/sch_netem.c

index c8259cbe652c3f12af75d57a38cfadda08f9dd7c..05b4b839836142a8bd415824bb6349e26a39c6d2 100644 (file)
@@ -184,10 +184,15 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch)
        /* Random duplication */
        if (q->duplicate && q->duplicate >= get_crandom(&q->dup_cor)) {
                struct sk_buff *skb2 = skb_clone(skb, GFP_ATOMIC);
-
-               pr_debug("netem_enqueue: dup %p\n", skb2);
-               if (skb2)
-                       delay_skb(sch, skb2);
+               if (skb2) {
+                       struct Qdisc *rootq = sch->dev->qdisc;
+                       u32 dupsave = q->duplicate;
+
+                       /* prevent duplicating a dup... */
+                       q->duplicate = 0;
+                       rootq->enqueue(skb2, rootq);
+                       q->duplicate = dupsave;
+               }
        }
 
        /* If doing simple delay then gap == 0 so all packets