Skip to content

Commit

Permalink
lib/tc: Handle error parsing action in nl_parse_single_action
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Paul Blakey <[email protected]>
Signed-off-by: Simon Horman <[email protected]>
  • Loading branch information
roidayan authored and shorman-netronome committed Mar 21, 2018
1 parent cb8cbbb commit 40c5aa1
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions lib/tc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))) {
Expand All @@ -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) {
Expand Down

0 comments on commit 40c5aa1

Please sign in to comment.