aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/sch_netem.c
diff options
context:
space:
mode:
authorVijay Subramanian <subramanian.vijay@gmail.com>2012-01-19 05:20:59 -0500
committerDavid S. Miller <davem@davemloft.net>2012-01-22 15:08:44 -0500
commita42b4799c683723e8c464de4026af085b2ebd5fa (patch)
tree303ebae69ea9f9db0a5bdf7020dc26c01af14afd /net/sched/sch_netem.c
parent803143fbda719106017309d551d082e4b4e7c8c3 (diff)
netem: Fix off-by-one bug in reordering
With netem reordering, a gap of N is supposed to reorder every Nth packet with given reorder probability. However, the code currently skips N packets and reorders every (N+1)th packet. Signed-off-by: Vijay Subramanian <subramanian.vijay@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/sch_netem.c')
-rw-r--r--net/sched/sch_netem.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c
index e7e1d0b57b3d..2776012132ea 100644
--- a/net/sched/sch_netem.c
+++ b/net/sched/sch_netem.c
@@ -419,7 +419,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch)
419 419
420 cb = netem_skb_cb(skb); 420 cb = netem_skb_cb(skb);
421 if (q->gap == 0 || /* not doing reordering */ 421 if (q->gap == 0 || /* not doing reordering */
422 q->counter < q->gap || /* inside last reordering gap */ 422 q->counter < q->gap - 1 || /* inside last reordering gap */
423 q->reorder < get_crandom(&q->reorder_cor)) { 423 q->reorder < get_crandom(&q->reorder_cor)) {
424 psched_time_t now; 424 psched_time_t now;
425 psched_tdiff_t delay; 425 psched_tdiff_t delay;