From: Nigel Kukard <nkukard@lbsd.net>
To: netdev@vger.kernel.org
Subject: [PATCH] iproute2 - Fix tc stats when using -batch mode
Date: Mon, 14 Oct 2013 22:16:36 +0000 [thread overview]
Message-ID: <sig.1999aa60cf.525C6D44.9040207@lbsd.net> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 528 bytes --]
Hi,
There are two global variables in tc/tc_class.c:
__u32 filter_qdisc;
__u32 filter_classid;
These are not re-initialized for each line received in -batch mode:
# tc -force -batch -
class show dev eth0 parent 1: classid 1:1
class show dev eth0 parent 1: classid 1:1
Error: duplicate "classid": "1:1" is the second value.
This patch fixes the issue by initializing the two globals when we
enter print_class().
Attached a patch which fixes this by initializing them when
print_class() is called.
-N
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: batchfix.patch --]
[-- Type: text/x-patch; name="batchfix.patch", Size: 986 bytes --]
commit d04acab5a8c0267610e9ea21f8a42e54ed4585dc
Author: Nigel Kukard <nkukard@lbsd.net>
Date: Mon Oct 14 22:10:16 2013 +0000
Fix tc stats when using -batch mode
There are two global variables in tc/tc_class.c:
__u32 filter_qdisc;
__u32 filter_classid;
These are not re-initialized for each line received in -batch mode:
class show dev eth0 parent 1: classid 1:1
class show dev eth0 parent 1: classid 1:1
Error: duplicate "classid": "1:1" is the second value.
This patch fixes the issue by initializing the two globals when we
enter print_class().
diff --git a/tc/tc_class.c b/tc/tc_class.c
index 9d4eea5..8043448 100644
--- a/tc/tc_class.c
+++ b/tc/tc_class.c
@@ -241,6 +241,9 @@ int tc_class_list(int argc, char **argv)
t.tcm_family = AF_UNSPEC;
memset(d, 0, sizeof(d));
+ filter_qdisc = 0;
+ filter_classid = 0;
+
while (argc > 0) {
if (strcmp(*argv, "dev") == 0) {
NEXT_ARG();
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4052 bytes --]
reply other threads:[~2013-10-14 22:16 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sig.1999aa60cf.525C6D44.9040207@lbsd.net \
--to=nkukard@lbsd.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox