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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1392366970-11592-6-git-send-email-yangyingliang@huawei.com>
Date:	Fri, 14 Feb 2014 16:36:08 +0800
From:	Yang Yingliang <yangyingliang@...wei.com>
To:	<netdev@...r.kernel.org>
CC:	<davem@...emloft.net>, <stephen@...workplumber.org>
Subject: [PATCH net-next 5/7] sch_netem: clear old corrupt when old qdisc's replaced

If we set a netem qdisc with corrupt option, while we
use "#tc qdisc replace ..." that without corrupt option
to replace the old qdisc, the old corrupt is still there.
We need clear old corrupt after qdisc's replaced.

Signed-off-by: Yang Yingliang <yangyingliang@...wei.com>
---
 net/sched/sch_netem.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c
index 33e7cef..2f630e9 100644
--- a/net/sched/sch_netem.c
+++ b/net/sched/sch_netem.c
@@ -732,6 +732,12 @@ static void get_corrupt(struct netem_sched_data *q, const struct nlattr *attr)
 	init_crandom(&q->corrupt_cor, r->correlation);
 }
 
+static void corrupt_reset(struct netem_sched_data *q)
+{
+	q->corrupt = 0;
+	memset(&q->corrupt_cor, 0, sizeof(struct crndstate));
+}
+
 static void get_rate(struct netem_sched_data *q, const struct nlattr *attr)
 {
 	const struct tc_netem_rate *r = nla_data(attr);
@@ -907,6 +913,8 @@ static int netem_change(struct Qdisc *sch, struct nlattr *opt)
 
 	if (tb[TCA_NETEM_CORRUPT])
 		get_corrupt(q, tb[TCA_NETEM_CORRUPT]);
+	else
+		corrupt_reset(q);
 
 	if (tb[TCA_NETEM_RATE])
 		get_rate(q, tb[TCA_NETEM_RATE]);
-- 
1.8.0


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ