From patchwork Thu Jan 25 15:23:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hurley X-Patchwork-Id: 865923 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; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=netronome-com.20150623.gappssmtp.com header.i=@netronome-com.20150623.gappssmtp.com header.b="GkrEf1YS"; dkim-atps=neutral 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 3zS5R61L7cz9sNV for ; Fri, 26 Jan 2018 02:23:45 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 09F24EB6; Thu, 25 Jan 2018 15:23:42 +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 8702FE77 for ; Thu, 25 Jan 2018 15:23:40 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-qt0-f195.google.com (mail-qt0-f195.google.com [209.85.216.195]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 65EFE134 for ; Thu, 25 Jan 2018 15:23:39 +0000 (UTC) Received: by mail-qt0-f195.google.com with SMTP id f4so20047748qtj.6 for ; Thu, 25 Jan 2018 07:23:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netronome-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=NsvlaV1CFU0GOhUOSyl9L0xDHSW/C7Somwti4aS3QCs=; b=GkrEf1YSa3UT/t40nA+fc9CdUi4iT7NhlIKNylmXq7MC1QuPiY7ekRTbK1DkMHGLYS OOk4Qxh3ijdWVFJCJZZmTsuOTESGpoz+UxCyZQLLPD9DA096MjXsSrcMWuZx5DyjFtPZ Hh70+zNchmplLvfA47+rP6kyLk6qQmRI91UTEvSaeClBYy4TCYV9wGyIm/C002x3przd he4h3LaWHVO/EPY40/VYYd2JPVB97Bgy8MJFMQxsMTVB2RDaok+WAO7pxPDY9YJYGRKS GLSZjhAP2aFxdBTj/KQIsS98tR7/rL/hqcIEqGM3vOtrP4uzH92/KTTN2O9C8DNCewE4 qNVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=NsvlaV1CFU0GOhUOSyl9L0xDHSW/C7Somwti4aS3QCs=; b=KRfpyRmYjx3HBm0gZcSsY8k9yT7z4I1WLWhkuUCg8gn21aZ0EcqyOnn571KenjKyQ9 R0q+d/qWU9pBeM5hJYvysrC0fhk/RXdLQxuTtukdN/U25kEBv+fzKmaerrno5fU61oZ+ SG9JrRtdbaRnRBsW6B/o+z3shlpgrq4w6bhDqMZxMKu5dTsxUnBICrkck4G7/u4MmomJ 3N0FbCJh3VxlrhyZB69ydc3sfgwWfr6LBEdIMB/3ZF07u+PyXnTKpr1C+q0vPLz2CIp6 UsLKeSULX3b+0olr2zWDrMsIlsekRGOqnWA+CPYEd/P78DpjimiWDfaa9bxcPHLpJWo+ eu4Q== X-Gm-Message-State: AKwxytdYUJviHgO3oQyTNCy3rnslp7uINDqUpNwXF9YWe0hF3UUoTELV mVs78siPP6Nfnd9L1Z+vwEfTNdA6 X-Google-Smtp-Source: AH8x227GRXnsM2HLG49kkNfwczAWSijfJt6ifGAsQDAyYzO39Y4UYWWzMOO8nv7rlulGw8E1AWt7WQ== X-Received: by 10.55.163.150 with SMTP id m144mr14876614qke.256.1516893818435; Thu, 25 Jan 2018 07:23:38 -0800 (PST) Received: from jhurley-Precision-Tower-3420.netronome.com ([80.76.204.157]) by smtp.gmail.com with ESMTPSA id y30sm3961714qtm.50.2018.01.25.07.23.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 25 Jan 2018 07:23:37 -0800 (PST) From: John Hurley To: dev@openvswitch.org, simon.horman@netronome.com Date: Thu, 25 Jan 2018 15:23:21 +0000 Message-Id: <1516893801-13983-1-git-send-email-john.hurley@netronome.com> X-Mailer: git-send-email 2.7.4 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH branch-2.8 1/1] tc flower: reorder tunnel encap/decap actions 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 The tc_flower conversion struct does not consider the order of actions. If an OvS rule matches on a tunnel (decap) and outputs to a new tunnel, the netlink conversion to TC will add the set tunnel key action before the unset, leading to an incorrect TC rule. This patch reorders the netlink generation to ensure a decap is done before an encap if both exist. Patch was committed to master. Backport to branch 2.8 requested by Simon Horman. Signed-off-by: John Hurley Reviewed-by: Simon Horman --- lib/tc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/tc.c b/lib/tc.c index 5c36d0d..6f8cd1b 100644 --- a/lib/tc.c +++ b/lib/tc.c @@ -921,6 +921,11 @@ nl_msg_put_flower_acts(struct ofpbuf *request, struct tc_flower *flower) { uint16_t act_index = 1; + if (flower->tunnel.tunnel) { + act_offset = nl_msg_start_nested(request, act_index++); + nl_msg_put_act_tunnel_key_release(request); + nl_msg_end_nested(request, act_offset); + } if (flower->set.set) { act_offset = nl_msg_start_nested(request, act_index++); nl_msg_put_act_tunnel_key_set(request, flower->set.id, @@ -931,11 +936,6 @@ nl_msg_put_flower_acts(struct ofpbuf *request, struct tc_flower *flower) flower->set.tp_dst); nl_msg_end_nested(request, act_offset); } - if (flower->tunnel.tunnel) { - act_offset = nl_msg_start_nested(request, act_index++); - nl_msg_put_act_tunnel_key_release(request); - nl_msg_end_nested(request, act_offset); - } if (flower->vlan_pop) { act_offset = nl_msg_start_nested(request, act_index++); nl_msg_put_act_pop_vlan(request);