[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <01774dea3239d1127d2e174a48419db4089c4de3.1511805077.git.mprivozn@redhat.com>
Date: Mon, 27 Nov 2017 19:00:14 +0100
From: Michal Privoznik <mprivozn@...hat.com>
To: netdev@...r.kernel.org
Cc: jiri@...lanox.com
Subject: [PATCH iproute2] tc: police: fix control action parsing
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: Michal Privoznik <mprivozn@...hat.com>
---
tc/m_police.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/tc/m_police.c b/tc/m_police.c
index ff1dcb7d..62cc6f86 100644
--- a/tc/m_police.c
+++ b/tc/m_police.c
@@ -75,6 +75,7 @@ int act_parse_police(struct action_util *a, int *argc_p, char ***argv_p,
return -1;
while (argc > 0) {
+ bool advance = true;
if (matches(*argv, "index") == 0) {
NEXT_ARG();
@@ -154,11 +155,13 @@ int act_parse_police(struct action_util *a, int *argc_p, char ***argv_p,
matches(*argv, "goto") == 0) {
if (parse_action_control(&argc, &argv, &p.action, false))
return -1;
+ advance = false;
} else if (strcmp(*argv, "conform-exceed") == 0) {
NEXT_ARG();
if (parse_action_control_slash(&argc, &argv, &p.action,
&presult, true))
return -1;
+ advance = false;
} else if (matches(*argv, "overhead") == 0) {
NEXT_ARG();
if (get_u16(&overhead, *argv, 10)) {
@@ -175,7 +178,9 @@ int act_parse_police(struct action_util *a, int *argc_p, char ***argv_p,
break;
}
ok++;
- argc--; argv++;
+ if (advance) {
+ argc--; argv++;
+ }
}
if (!ok)
--
2.13.6
Powered by blists - more mailing lists