Skip to contentSkip to conversation

iproute2 - Fix tc stats when using -batch mode

PATCH Superseded Nigel Kukard 1 participant 1 message Oct 14, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iproute2 - Fix tc stats when using -batch mode

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

commit d04acab5a8c0267610e9ea21f8a42e54ed4585dc

Author: Nigel Kukard <[email protected]>
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().

tc/tc_class.c +3 -0
index 9d4eea5..8043448 100644
@@ -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();