]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
Fix tc stats when using -batch mode
authorNigel Kukard <nkukard@lbsd.net>
Wed, 30 Oct 2013 18:44:58 +0000 (18:44 +0000)
committerStephen Hemminger <stephen@networkplumber.org>
Wed, 30 Oct 2013 23:37:07 +0000 (16:37 -0700)
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().

Signed-off-by: Nigel Kukard <nkukard@lbsd.net>
tc/tc_class.c

index 6c0850d09f874ffd0108cea9031402111ee6875d..e56bf07c9dafdeddf8784ae4635a868d1394ba2c 100644 (file)
@@ -241,6 +241,9 @@ static 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();