|
|
99be8f |
From 1a12c7c90330410171007ada7513247fda5a1c57 Mon Sep 17 00:00:00 2001
|
|
|
99be8f |
From: Andrea Claudi <aclaudi@redhat.com>
|
|
|
99be8f |
Date: Wed, 5 Jun 2019 13:11:03 +0200
|
|
|
99be8f |
Subject: [PATCH] tc: util: Don't call NEXT_ARG_FWD() in
|
|
|
99be8f |
__parse_action_control()
|
|
|
99be8f |
|
|
|
99be8f |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1714660
|
|
|
99be8f |
Upstream Status: iproute2.git commit 3572e01a090a2
|
|
|
99be8f |
Conflicts: context change mainly due to missing commit 35f2a7639dca4
|
|
|
99be8f |
("tc/actions: introduce support for jump action")
|
|
|
99be8f |
|
|
|
99be8f |
commit 3572e01a090a298e2f4c4f796bad6639b652e031
|
|
|
99be8f |
Author: Michal Privoznik <mprivozn@redhat.com>
|
|
|
99be8f |
Date: Fri Dec 8 11:18:07 2017 +0100
|
|
|
99be8f |
|
|
|
99be8f |
tc: util: Don't call NEXT_ARG_FWD() in __parse_action_control()
|
|
|
99be8f |
|
|
|
99be8f |
Not all callers want parse_action_control*() to advance the
|
|
|
99be8f |
arguments. For instance act_parse_police() does the argument
|
|
|
99be8f |
advancing itself.
|
|
|
99be8f |
|
|
|
99be8f |
Fixes: e67aba559581 ("tc: actions: add helpers to parse and print control actions")
|
|
|
99be8f |
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
99be8f |
---
|
|
|
99be8f |
tc/m_bpf.c | 1 +
|
|
|
99be8f |
tc/m_connmark.c | 1 +
|
|
|
99be8f |
tc/m_csum.c | 1 +
|
|
|
99be8f |
tc/m_gact.c | 12 ++++++------
|
|
|
99be8f |
tc/m_ife.c | 1 +
|
|
|
99be8f |
tc/m_mirred.c | 4 +++-
|
|
|
99be8f |
tc/m_nat.c | 1 +
|
|
|
99be8f |
tc/m_pedit.c | 1 +
|
|
|
99be8f |
tc/m_sample.c | 1 +
|
|
|
99be8f |
tc/m_skbedit.c | 1 +
|
|
|
99be8f |
tc/m_skbmod.c | 1 +
|
|
|
99be8f |
tc/m_tunnel_key.c | 1 +
|
|
|
99be8f |
tc/m_vlan.c | 1 +
|
|
|
99be8f |
tc/tc_util.c | 1 -
|
|
|
99be8f |
14 files changed, 20 insertions(+), 8 deletions(-)
|
|
|
99be8f |
|
|
|
99be8f |
diff --git a/tc/m_bpf.c b/tc/m_bpf.c
|
|
|
99be8f |
index 57283030a35f5..c2bad5640707c 100644
|
|
|
99be8f |
--- a/tc/m_bpf.c
|
|
|
99be8f |
+++ b/tc/m_bpf.c
|
|
|
99be8f |
@@ -125,6 +125,7 @@ opt_bpf:
|
|
|
99be8f |
|
|
|
99be8f |
parse_action_control_dflt(&argc, &argv, &parm.action,
|
|
|
99be8f |
false, TC_ACT_PIPE);
|
|
|
99be8f |
+ NEXT_ARG_FWD();
|
|
|
99be8f |
|
|
|
99be8f |
if (argc) {
|
|
|
99be8f |
if (matches(*argv, "index") == 0) {
|
|
|
99be8f |
diff --git a/tc/m_connmark.c b/tc/m_connmark.c
|
|
|
99be8f |
index 37d7185415490..47c7a8c2b17e7 100644
|
|
|
99be8f |
--- a/tc/m_connmark.c
|
|
|
99be8f |
+++ b/tc/m_connmark.c
|
|
|
99be8f |
@@ -82,6 +82,7 @@ parse_connmark(struct action_util *a, int *argc_p, char ***argv_p, int tca_id,
|
|
|
99be8f |
}
|
|
|
99be8f |
|
|
|
99be8f |
parse_action_control_dflt(&argc, &argv, &sel.action, false, TC_ACT_PIPE);
|
|
|
99be8f |
+ NEXT_ARG_FWD();
|
|
|
99be8f |
|
|
|
99be8f |
if (argc) {
|
|
|
99be8f |
if (matches(*argv, "index") == 0) {
|
|
|
99be8f |
diff --git a/tc/m_csum.c b/tc/m_csum.c
|
|
|
99be8f |
index 7b156734f64c5..e1352c0820f69 100644
|
|
|
99be8f |
--- a/tc/m_csum.c
|
|
|
99be8f |
+++ b/tc/m_csum.c
|
|
|
99be8f |
@@ -124,6 +124,7 @@ parse_csum(struct action_util *a, int *argc_p,
|
|
|
99be8f |
}
|
|
|
99be8f |
|
|
|
99be8f |
parse_action_control_dflt(&argc, &argv, &sel.action, false, TC_ACT_OK);
|
|
|
99be8f |
+ NEXT_ARG_FWD();
|
|
|
99be8f |
|
|
|
99be8f |
if (argc) {
|
|
|
99be8f |
if (matches(*argv, "index") == 0) {
|
|
|
99be8f |
diff --git a/tc/m_gact.c b/tc/m_gact.c
|
|
|
99be8f |
index 73346d4e9333b..dd9542a5cc644 100644
|
|
|
99be8f |
--- a/tc/m_gact.c
|
|
|
99be8f |
+++ b/tc/m_gact.c
|
|
|
99be8f |
@@ -86,14 +86,13 @@ parse_gact(struct action_util *a, int *argc_p, char ***argv_p,
|
|
|
99be8f |
if (argc < 0)
|
|
|
99be8f |
return -1;
|
|
|
99be8f |
|
|
|
99be8f |
-
|
|
|
99be8f |
- if (matches(*argv, "gact") == 0) {
|
|
|
99be8f |
- argc--;
|
|
|
99be8f |
- argv++;
|
|
|
99be8f |
- } else if (parse_action_control(&argc, &argv, &p.action, false) == -1) {
|
|
|
99be8f |
- usage();
|
|
|
99be8f |
+ if (matches(*argv, "gact") != 0 &&
|
|
|
99be8f |
+ parse_action_control(&argc, &argv, &p.action, false) == -1) {
|
|
|
99be8f |
+ usage(); /* does not return */
|
|
|
99be8f |
}
|
|
|
99be8f |
|
|
|
99be8f |
+ NEXT_ARG_FWD();
|
|
|
99be8f |
+
|
|
|
99be8f |
#ifdef CONFIG_GACT_PROB
|
|
|
99be8f |
if (argc > 0) {
|
|
|
99be8f |
if (matches(*argv, "random") == 0) {
|
|
|
99be8f |
@@ -113,6 +112,7 @@ parse_gact(struct action_util *a, int *argc_p, char ***argv_p,
|
|
|
99be8f |
if (parse_action_control(&argc, &argv,
|
|
|
99be8f |
&pp.paction, false) == -1)
|
|
|
99be8f |
usage();
|
|
|
99be8f |
+ NEXT_ARG_FWD();
|
|
|
99be8f |
if (get_u16(&pp.pval, *argv, 10)) {
|
|
|
99be8f |
fprintf(stderr, "Illegal probability val 0x%x\n", pp.pval);
|
|
|
99be8f |
return -1;
|
|
|
99be8f |
diff --git a/tc/m_ife.c b/tc/m_ife.c
|
|
|
99be8f |
index e3521e62c178c..54fad8f70e73a 100644
|
|
|
99be8f |
--- a/tc/m_ife.c
|
|
|
99be8f |
+++ b/tc/m_ife.c
|
|
|
99be8f |
@@ -158,6 +158,7 @@ static int parse_ife(struct action_util *a, int *argc_p, char ***argv_p,
|
|
|
99be8f |
|
|
|
99be8f |
parse_action_control_dflt(&argc, &argv, &p.action, false, TC_ACT_PIPE);
|
|
|
99be8f |
|
|
|
99be8f |
+ NEXT_ARG_FWD();
|
|
|
99be8f |
if (argc) {
|
|
|
99be8f |
if (matches(*argv, "index") == 0) {
|
|
|
99be8f |
NEXT_ARG();
|
|
|
99be8f |
diff --git a/tc/m_mirred.c b/tc/m_mirred.c
|
|
|
99be8f |
index 2384bda1ff045..b09b016c2ca39 100644
|
|
|
99be8f |
--- a/tc/m_mirred.c
|
|
|
99be8f |
+++ b/tc/m_mirred.c
|
|
|
99be8f |
@@ -170,8 +170,10 @@ parse_direction(struct action_util *a, int *argc_p, char ***argv_p,
|
|
|
99be8f |
}
|
|
|
99be8f |
|
|
|
99be8f |
|
|
|
99be8f |
- if (p.eaction == TCA_EGRESS_MIRROR || p.eaction == TCA_INGRESS_MIRROR)
|
|
|
99be8f |
+ if (p.eaction == TCA_EGRESS_MIRROR || p.eaction == TCA_INGRESS_MIRROR) {
|
|
|
99be8f |
parse_action_control(&argc, &argv, &p.action, false);
|
|
|
99be8f |
+ NEXT_ARG_FWD();
|
|
|
99be8f |
+ }
|
|
|
99be8f |
|
|
|
99be8f |
if (argc) {
|
|
|
99be8f |
if (iok && matches(*argv, "index") == 0) {
|
|
|
99be8f |
diff --git a/tc/m_nat.c b/tc/m_nat.c
|
|
|
99be8f |
index 31b68fb6bd784..bb455f080b3a4 100644
|
|
|
99be8f |
--- a/tc/m_nat.c
|
|
|
99be8f |
+++ b/tc/m_nat.c
|
|
|
99be8f |
@@ -117,6 +117,7 @@ parse_nat(struct action_util *a, int *argc_p, char ***argv_p, int tca_id, struct
|
|
|
99be8f |
|
|
|
99be8f |
parse_action_control_dflt(&argc, &argv, &sel.action, false, TC_ACT_OK);
|
|
|
99be8f |
|
|
|
99be8f |
+ NEXT_ARG_FWD();
|
|
|
99be8f |
if (argc) {
|
|
|
99be8f |
if (matches(*argv, "index") == 0) {
|
|
|
99be8f |
NEXT_ARG();
|
|
|
99be8f |
diff --git a/tc/m_pedit.c b/tc/m_pedit.c
|
|
|
99be8f |
index 5d89ab1d832ab..3391be95da38c 100644
|
|
|
99be8f |
--- a/tc/m_pedit.c
|
|
|
99be8f |
+++ b/tc/m_pedit.c
|
|
|
99be8f |
@@ -673,6 +673,7 @@ int parse_pedit(struct action_util *a, int *argc_p, char ***argv_p, int tca_id,
|
|
|
99be8f |
|
|
|
99be8f |
parse_action_control_dflt(&argc, &argv, &sel.sel.action, false, TC_ACT_OK);
|
|
|
99be8f |
|
|
|
99be8f |
+ NEXT_ARG_FWD();
|
|
|
99be8f |
if (argc) {
|
|
|
99be8f |
if (matches(*argv, "index") == 0) {
|
|
|
99be8f |
NEXT_ARG();
|
|
|
99be8f |
diff --git a/tc/m_sample.c b/tc/m_sample.c
|
|
|
99be8f |
index ff5ee6bd1ef63..31774c0e806b4 100644
|
|
|
99be8f |
--- a/tc/m_sample.c
|
|
|
99be8f |
+++ b/tc/m_sample.c
|
|
|
99be8f |
@@ -100,6 +100,7 @@ static int parse_sample(struct action_util *a, int *argc_p, char ***argv_p,
|
|
|
99be8f |
|
|
|
99be8f |
parse_action_control_dflt(&argc, &argv, &p.action, false, TC_ACT_PIPE);
|
|
|
99be8f |
|
|
|
99be8f |
+ NEXT_ARG_FWD();
|
|
|
99be8f |
if (argc) {
|
|
|
99be8f |
if (matches(*argv, "index") == 0) {
|
|
|
99be8f |
NEXT_ARG();
|
|
|
99be8f |
diff --git a/tc/m_skbedit.c b/tc/m_skbedit.c
|
|
|
99be8f |
index aa374fcb33ed9..c41a7bb082dad 100644
|
|
|
99be8f |
--- a/tc/m_skbedit.c
|
|
|
99be8f |
+++ b/tc/m_skbedit.c
|
|
|
99be8f |
@@ -123,6 +123,7 @@ parse_skbedit(struct action_util *a, int *argc_p, char ***argv_p, int tca_id,
|
|
|
99be8f |
parse_action_control_dflt(&argc, &argv, &sel.action,
|
|
|
99be8f |
false, TC_ACT_PIPE);
|
|
|
99be8f |
|
|
|
99be8f |
+ NEXT_ARG_FWD();
|
|
|
99be8f |
if (argc) {
|
|
|
99be8f |
if (matches(*argv, "index") == 0) {
|
|
|
99be8f |
NEXT_ARG();
|
|
|
99be8f |
diff --git a/tc/m_skbmod.c b/tc/m_skbmod.c
|
|
|
99be8f |
index ba79308ba8354..00318d42642a5 100644
|
|
|
99be8f |
--- a/tc/m_skbmod.c
|
|
|
99be8f |
+++ b/tc/m_skbmod.c
|
|
|
99be8f |
@@ -125,6 +125,7 @@ static int parse_skbmod(struct action_util *a, int *argc_p, char ***argv_p,
|
|
|
99be8f |
|
|
|
99be8f |
parse_action_control_dflt(&argc, &argv, &p.action, false, TC_ACT_PIPE);
|
|
|
99be8f |
|
|
|
99be8f |
+ NEXT_ARG_FWD();
|
|
|
99be8f |
if (argc) {
|
|
|
99be8f |
if (matches(*argv, "index") == 0) {
|
|
|
99be8f |
NEXT_ARG();
|
|
|
99be8f |
diff --git a/tc/m_tunnel_key.c b/tc/m_tunnel_key.c
|
|
|
99be8f |
index cdde64a15b929..0ff3f1a2b9876 100644
|
|
|
99be8f |
--- a/tc/m_tunnel_key.c
|
|
|
99be8f |
+++ b/tc/m_tunnel_key.c
|
|
|
99be8f |
@@ -197,6 +197,7 @@ static int parse_tunnel_key(struct action_util *a, int *argc_p, char ***argv_p,
|
|
|
99be8f |
parse_action_control_dflt(&argc, &argv, &parm.action,
|
|
|
99be8f |
false, TC_ACT_PIPE);
|
|
|
99be8f |
|
|
|
99be8f |
+ NEXT_ARG_FWD();
|
|
|
99be8f |
if (argc) {
|
|
|
99be8f |
if (matches(*argv, "index") == 0) {
|
|
|
99be8f |
NEXT_ARG();
|
|
|
99be8f |
diff --git a/tc/m_vlan.c b/tc/m_vlan.c
|
|
|
99be8f |
index cccb4996b05f3..0b2966ce82e53 100644
|
|
|
99be8f |
--- a/tc/m_vlan.c
|
|
|
99be8f |
+++ b/tc/m_vlan.c
|
|
|
99be8f |
@@ -137,6 +137,7 @@ static int parse_vlan(struct action_util *a, int *argc_p, char ***argv_p,
|
|
|
99be8f |
parse_action_control_dflt(&argc, &argv, &parm.action,
|
|
|
99be8f |
false, TC_ACT_PIPE);
|
|
|
99be8f |
|
|
|
99be8f |
+ NEXT_ARG_FWD();
|
|
|
99be8f |
if (argc) {
|
|
|
99be8f |
if (matches(*argv, "index") == 0) {
|
|
|
99be8f |
NEXT_ARG();
|
|
|
99be8f |
diff --git a/tc/tc_util.c b/tc/tc_util.c
|
|
|
99be8f |
index cdc23477ada53..4584d4a448fb4 100644
|
|
|
99be8f |
--- a/tc/tc_util.c
|
|
|
99be8f |
+++ b/tc/tc_util.c
|
|
|
99be8f |
@@ -507,7 +507,6 @@ static int __parse_action_control(int *argc_p, char ***argv_p, int *result_p,
|
|
|
99be8f |
}
|
|
|
99be8f |
result |= chain_index;
|
|
|
99be8f |
}
|
|
|
99be8f |
- NEXT_ARG_FWD();
|
|
|
99be8f |
*argc_p = argc;
|
|
|
99be8f |
*argv_p = argv;
|
|
|
99be8f |
*result_p = result;
|
|
|
99be8f |
--
|
|
|
d30c09 |
2.21.0
|
|
|
99be8f |
|