netem: missing break in ge loss generator
Subsystems (4)
Stephen Hemminger
maintainerPATCH 1/3 netem: missing break in ge loss generator
There is a missing break statement in the Gilbert Elliot loss model generator which makes state machine behave incorrectly.
net/sched/sch_netem.c +1 -0
@@ -268,6 +268,7 @@ static bool loss_gilb_ell(struct netem_s clg->state =2 ;if (net_random () < clg->a4)return true; +break ;case 2 :if (net_random () < clg->a2) clg->state =1 ;
Stephen Hemminger
maintainerPATCH 2/3 netem: fix loss 4 state model
Patch from developers of the alternative loss models, downloaded from:
http://netgroup.uniroma2.it/twiki/bin/view.cgi/Main/NetemCLG
"In the case 1 of the switch statement in the if conditions we
need to add clg->a4 to clg->a1, according to the model."
net/sched/sch_netem.c +2 -2
@@ -215,10 +215,10 @@ static bool loss_4state(struct netem_schif (rnd < clg->a4) { clg->state =4 ;return true; - }else if (clg->a4 < rnd && rnd < clg->a1) { + }else if (clg->a4 < rnd && rnd < clg->a1 + clg->a4) { clg->state =3 ;return true; - }else if (clg->a1 < rnd) + }else if (clg->a1 + clg->a4 < rnd) clg->state =1 ;break ;
Stephen Hemminger
maintainerPATCH 3/3 netem: fix gemodel loss generator
In reply to Stephen HemmingerPatch from developers of the alternative loss models, downloaded from:
http://netgroup.uniroma2.it/twiki/bin/view.cgi/Main/NetemCLG
"in case 2, of the switch we change the direction of the inequality to
net_random()>clg->a3, because clg->a3 is h in the GE model and when h is 0 all packets will be lost."
net/sched/sch_netem.c +1 -1
@@ -272,7 +272,7 @@ static bool loss_gilb_ell(struct netem_scase 2 :if (net_random () < clg->a2) clg->state =1 ; -if (clg->a3 >net_random ()) +if (net_random () > clg->a3)return true; }
From: Stephen Hemminger <[email protected]>
Date: Fri, 29 Nov 2013 11:02:43 -0800
Quoted 5 lines
There is a missing break statement in the Gilbert Elliot loss model generator which makes state machine behave incorrectly.
Reported-by Martin Burri <[email protected]Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH net 2/3] netem: fix loss 4 state model
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 29 Nov 2013 11:03:35 -0800
Quoted 7 lines
Patch from developers of the alternative loss models, downloaded from:
http://netgroup.uniroma2.it/twiki/bin/view.cgi/Main/NetemCLG"In the case 1 of the switch statement in the if conditions we
need to addclg->a4toclg->a1, according to the model."Signed-off-by Stephen Hemminger <[email protected]>
Applied.
Re: [PATCH net 3/3] netem: fix gemodel loss generator
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 29 Nov 2013 11:04:26 -0800
Quoted 8 lines
Patch from developers of the alternative loss models, downloaded from:
http://netgroup.uniroma2.it/twiki/bin/view.cgi/Main/NetemCLG"in case 2, of the switch we change the direction of the inequality to
net_random()>clg->a3, becauseclg->a3is h in the GE model and when h is 0 all packets will be lost."Signed-off-by Stephen Hemminger <[email protected]>
Applied.