Skip to content
Snippets Groups Projects
Commit 03cc725b authored by Stephen Hemminger's avatar Stephen Hemminger Committed by Chris Wright
Browse files

[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: default avatarStephen Hemminger <shemminger@osdl.org>
Signed-off-by: default avatarChris Wright <chrisw@osdl.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent c5187a40
No related branches found
No related tags found
No related merge requests found
...@@ -184,10 +184,15 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch) ...@@ -184,10 +184,15 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch)
/* Random duplication */ /* Random duplication */
if (q->duplicate && q->duplicate >= get_crandom(&q->dup_cor)) { if (q->duplicate && q->duplicate >= get_crandom(&q->dup_cor)) {
struct sk_buff *skb2 = skb_clone(skb, GFP_ATOMIC); struct sk_buff *skb2 = skb_clone(skb, GFP_ATOMIC);
if (skb2) {
pr_debug("netem_enqueue: dup %p\n", skb2); struct Qdisc *rootq = sch->dev->qdisc;
if (skb2) u32 dupsave = q->duplicate;
delay_skb(sch, skb2);
/* prevent duplicating a dup... */
q->duplicate = 0;
rootq->enqueue(skb2, rootq);
q->duplicate = dupsave;
}
} }
/* If doing simple delay then gap == 0 so all packets /* If doing simple delay then gap == 0 so all packets
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment