From patchwork Sun Mar 4 12:20:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roi Dayan X-Patchwork-Id: 881170 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=mellanox.com Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zvMky74KTz9s3Q for ; Sun, 4 Mar 2018 23:28:10 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 4BDF8F64; Sun, 4 Mar 2018 12:27:34 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 3747EF4A for ; Sun, 4 Mar 2018 12:27:32 +0000 (UTC) X-Greylist: delayed 00:06:41 by SQLgrey-1.7.6 Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by smtp1.linuxfoundation.org (Postfix) with ESMTP id 50CBD5CF for ; Sun, 4 Mar 2018 12:27:31 +0000 (UTC) Received: from Internal Mail-Server by MTLPINE1 (envelope-from roid@mellanox.com) with ESMTPS (AES256-SHA encrypted); 4 Mar 2018 14:21:12 +0200 Received: from r-vnc11.mtr.labs.mlnx (r-vnc11.mtr.labs.mlnx [10.208.0.123]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id w24CKkqK012981; Sun, 4 Mar 2018 14:20:46 +0200 From: Roi Dayan To: dev@openvswitch.org Date: Sun, 4 Mar 2018 14:20:30 +0200 Message-Id: <1520166031-22709-2-git-send-email-roid@mellanox.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1520166031-22709-1-git-send-email-roid@mellanox.com> References: <1520166031-22709-1-git-send-email-roid@mellanox.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Shahar Klein Subject: [ovs-dev] [PATCH 1/2] lib/tc: Handle error parsing action in nl_parse_single_action X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org 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 Reviewed-by: Paul Blakey --- lib/tc.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/lib/tc.c b/lib/tc.c index 914465a..b49bbe8 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) {