summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@osdl.org>2005-06-08 09:30:09 -0700
committerChris Wright <chrisw@osdl.org>2005-06-11 19:45:27 -0700
commit03cc725bc4846ac0f9ed6203b6ac150980763359 (patch)
treeb16491e83d41608db5a79a789c4d4dd558b30583
parentc5187a40291642ae66928dd54bc83117286067d3 (diff)
downloadlinux-stable-03cc725bc4846ac0f9ed6203b6ac150980763359.tar.gz
linux-stable-03cc725bc4846ac0f9ed6203b6ac150980763359.tar.bz2
linux-stable-03cc725bc4846ac0f9ed6203b6ac150980763359.zip
[PATCH] netem: duplication fix
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>
-rw-r--r--net/sched/sch_netem.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c
index c8259cbe652c..05b4b8398361 100644
--- a/net/sched/sch_netem.c
+++ b/net/sched/sch_netem.c
@@ -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