You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openvswitch/0001-lib-tc-Handle-error-pa...

63 lines
2.2 KiB

From 827903321ab68f7cd91e9d7c5d9bdec796b3060d Mon Sep 17 00:00:00 2001
From: Roi Dayan <roid@mellanox.com>
Date: Mon, 12 Mar 2018 14:58:46 +0200
Subject: [PATCH 1/2] lib/tc: Handle error parsing action in
nl_parse_single_action
Raise the error up instead of ignoring it.
Before this commit beside an error an incorrect rule was also printed.
Signed-off-by: Roi Dayan <roid@mellanox.com>
Reviewed-by: Paul Blakey <paulb@mellanox.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
---
lib/tc.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/lib/tc.c b/lib/tc.c
index 914465a9f..b49bbe89b 100644
--- a/lib/tc.c
+++ b/lib/tc.c
@@ -809,6 +809,7 @@ nl_parse_single_action(struct nlattr *action, struct tc_flower *flower)
struct nlattr *stats_attrs[ARRAY_SIZE(stats_policy)];
struct ovs_flow_stats *stats = &flower->stats;
const struct gnet_stats_basic *bs;
+ int err = 0;
if (!nl_parse_nested(action, act_policy, action_attrs,
ARRAY_SIZE(act_policy))) {
@@ -821,20 +822,24 @@ nl_parse_single_action(struct nlattr *action, struct tc_flower *flower)
act_cookie = action_attrs[TCA_ACT_COOKIE];
if (!strcmp(act_kind, "gact")) {
- nl_parse_act_drop(act_options, flower);
+ err = nl_parse_act_drop(act_options, flower);
} else if (!strcmp(act_kind, "mirred")) {
- nl_parse_act_mirred(act_options, flower);
+ err = nl_parse_act_mirred(act_options, flower);
} else if (!strcmp(act_kind, "vlan")) {
- nl_parse_act_vlan(act_options, flower);
+ err = nl_parse_act_vlan(act_options, flower);
} else if (!strcmp(act_kind, "tunnel_key")) {
- nl_parse_act_tunnel_key(act_options, flower);
+ err = nl_parse_act_tunnel_key(act_options, flower);
} else if (!strcmp(act_kind, "pedit")) {
- nl_parse_act_pedit(act_options, flower);
+ err = nl_parse_act_pedit(act_options, flower);
} else if (!strcmp(act_kind, "csum")) {
nl_parse_act_csum(act_options, flower);
} else {
VLOG_ERR_RL(&error_rl, "unknown tc action kind: %s", act_kind);
- return EINVAL;
+ err = EINVAL;
+ }
+
+ if (err) {
+ return err;
}
if (act_cookie) {
--
2.14.3