lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Thu, 27 Jun 2019 16:47:45 +0200
From:   Andrea Claudi <aclaudi@...hat.com>
To:     netdev@...r.kernel.org
Cc:     stephen@...workplumber.org, dsahern@...nel.org
Subject: [PATCH iproute2] tc: netem: fix r parameter in Bernoulli loss model

As the man page for tc netem states:

    To use the Bernoulli model, the only needed parameter is p while the
    others will be set to the default values r=1-p, 1-h=1 and 1-k=0.

However r parameter is erroneusly set to 1, and not to 1-p.
Fix this using the same approach of the 4-state loss model.

Fixes: 3c7950af598be ("netem: add support for 4 state and GE loss model")
Signed-off-by: Andrea Claudi <aclaudi@...hat.com>
---
 tc/q_netem.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tc/q_netem.c b/tc/q_netem.c
index 6e0e8a8cbfde5..d1cd17f8a8a7e 100644
--- a/tc/q_netem.c
+++ b/tc/q_netem.c
@@ -284,14 +284,17 @@ static int netem_parse_opt(struct qdisc_util *qu, int argc, char **argv,
 				}
 
 			} else if (!strcmp(*argv, "gemodel")) {
+				double p;
+
 				NEXT_ARG();
-				if (get_percent(&gemodel.p, *argv)) {
+				if (parse_percent(&p, *argv)) {
 					explain1("loss gemodel p");
 					return -1;
 				}
+				set_percent(&gemodel.p, p);
 
 				/* set defaults */
-				set_percent(&gemodel.r, 1.);
+				set_percent(&gemodel.r, 1. - p);
 				set_percent(&gemodel.h, 0);
 				set_percent(&gemodel.k1, 0);
 				loss_type = NETEM_LOSS_GE;
-- 
2.20.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ