]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
tc: gact: fix control action parsing
authorJiri Pirko <jiri@mellanox.com>
Mon, 5 Jun 2017 14:22:03 +0000 (16:22 +0200)
committerStephen Hemminger <stephen@networkplumber.org>
Thu, 8 Jun 2017 18:03:12 +0000 (11:03 -0700)
parse_action_control helper does advancing of the arg inside. So don't
do it outside.

Fixes: e67aba559581 ("tc: actions: add helpers to parse and print control actions")
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
tc/m_gact.c

index d95aa117616e85d40aae9da3d332e55c229f98c2..1a2583372c34ea30bb074668c025b89a45f1665c 100644 (file)
@@ -90,17 +90,14 @@ parse_gact(struct action_util *a, int *argc_p, char ***argv_p,
 
        if (matches(*argv, "gact") == 0) {
                ok++;
+               argc--;
+               argv++;
        } else {
                if (parse_action_control(&argc, &argv, &p.action, false) == -1)
                        usage();
                ok++;
        }
 
-       if (ok) {
-               argc--;
-               argv++;
-       }
-
 #ifdef CONFIG_GACT_PROB
        if (ok && argc > 0) {
                if (matches(*argv, "random") == 0) {
@@ -120,8 +117,6 @@ parse_gact(struct action_util *a, int *argc_p, char ***argv_p,
                        if (parse_action_control(&argc, &argv,
                                                 &pp.paction, false) == -1)
                                usage();
-                       argc--;
-                       argv++;
                        if (get_u16(&pp.pval, *argv, 10)) {
                                fprintf(stderr, "Illegal probability val 0x%x\n", pp.pval);
                                return -1;