From patchwork Thu Dec 9 11:16:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 1565722 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=G+/B+UAb; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::138; helo=smtp1.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4J8s1W4wNpz9sCD for ; Thu, 9 Dec 2021 22:16:47 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 84353830A8; Thu, 9 Dec 2021 11:16:40 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 20ncWC9szHzF; Thu, 9 Dec 2021 11:16:39 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp1.osuosl.org (Postfix) with ESMTPS id A365D8293F; Thu, 9 Dec 2021 11:16:38 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 6D0E0C001E; Thu, 9 Dec 2021 11:16:38 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 7A71AC0012 for ; Thu, 9 Dec 2021 11:16:36 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 616FD405AE for ; Thu, 9 Dec 2021 11:16:36 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp4.osuosl.org (amavisd-new); dkim=pass (1024-bit key) header.d=redhat.com Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BLN65xMbPkQV for ; Thu, 9 Dec 2021 11:16:34 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp4.osuosl.org (Postfix) with ESMTPS id 5A4E74059D for ; Thu, 9 Dec 2021 11:16:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639048593; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=h5oDPjVYpTQkLV749DgoOhU3egY4+WYV8gbURXUS/5Y=; b=G+/B+UAbdjhvFGzRaUSqgu+EW/lkchBDOY8sTiTQjfR6n/xSCx8RZ4xk/wbpJRy7z5QSou TT9qgNPe9p4UeQsOFkFu3A96uJHpy0mNyRRoc6MpwQeY230iGKuNxEWsO/2KzuZuTfZFqz STAAxP/1LTWWSnaUOED3x53193hDHMs= Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-168-073yAROjO0aUVEmYtSY46w-1; Thu, 09 Dec 2021 06:16:32 -0500 X-MC-Unique: 073yAROjO0aUVEmYtSY46w-1 Received: by mail-qv1-f71.google.com with SMTP id g15-20020a0562141ccf00b003cada9e7e2fso8628144qvd.1 for ; Thu, 09 Dec 2021 03:16:32 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=h5oDPjVYpTQkLV749DgoOhU3egY4+WYV8gbURXUS/5Y=; b=3stLjhP4Ql5joAWVHrWQZyx6S/srENOba+nWlqBc/dlGdiyaFqavdkhcyp14lqqf0N HJqd2cRccqBnkd859lLk22Q+CztMWMKVEBze/c6ptvCT3BeSysGmr8r5NtT1ATzc5hv0 UU0H93Qa2wVu8Uc+mo/8c9GctoNJwg29xRGNy8dKlOO577IRC0L8MQ5upNaqp6mKkPmd t1JXbAl72oByANTc4aonSafw8B0r6rwYucrPOF8fVlu46qW0swKwHEIGTqBM850UXWOF ZdGhV/UWwx2f0wtElD6VT1xXj4HAeR5oKryZv36NaZvsHw5PZkgsCHdb5TSTVivSL67B we0g== X-Gm-Message-State: AOAM5337+cDnAoBZstvVR0o2W2PIAHJwh0EwjeUyQGM5Qrk6tO/mTTVX 0AYsdFuq3BbgWV83JyS6MWQ3wPLzDMwplGt2tj5/LffHw4DBiE92SZXCqqEg/MPogTN7FGAnZ+M yPFf7qPFDf8vBm9TnDUy/wsPlTqssrBaZdi7m8xhUcLMmGFQUriG9fj+MMkCrP4Mag+rFaBkPqU IH2N8Z X-Received: by 2002:a05:622a:20d:: with SMTP id b13mr15982160qtx.368.1639048591513; Thu, 09 Dec 2021 03:16:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJyN7oT1cerurUUejYwsvkSuOn109uSjCcVoX8TCXsTk6wtWcQ4Wsh9XHwCfASBWONgeNk016g== X-Received: by 2002:a05:622a:20d:: with SMTP id b13mr15982118qtx.368.1639048591210; Thu, 09 Dec 2021 03:16:31 -0800 (PST) Received: from lore-desk.redhat.com (net-37-182-17-175.cust.vodafonedsl.it. [37.182.17.175]) by smtp.gmail.com with ESMTPSA id h16sm3776074qtx.20.2021.12.09.03.16.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Dec 2021 03:16:30 -0800 (PST) From: Lorenzo Bianconi To: ovs-dev@openvswitch.org Date: Thu, 9 Dec 2021 12:16:20 +0100 Message-Id: <10475b1e52fa3b875455a014882ce5c9be80a35f.1639048426.git.lorenzo.bianconi@redhat.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=lorenzo.bianconi@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Cc: dceara@redhat.com Subject: [ovs-dev] [PATCH v2 ovn] ovn-trace: honor ct state in execute_ct_lb X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" When performing CT_LB action in ovn-trace, take into account current connection tracking state provided by the user. Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=1980702 Fixes: 8accd26cb2 ("OVN: add CT_LB action to ovn-trace") Signed-off-by: Lorenzo Bianconi --- Changes since v1: - use next_ct_state() and do not access ct state directly --- tests/ovn-northd.at | 56 ++++++++++++++++++++++++++++++++++++------- utilities/ovn-trace.c | 8 ++++++- 2 files changed, 55 insertions(+), 9 deletions(-) diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at index c4424ab14..8c14bc76a 100644 --- a/tests/ovn-northd.at +++ b/tests/ovn-northd.at @@ -2916,7 +2916,12 @@ AT_CHECK_UNQUOTED([ovn-trace --ct new --ct new --minimal ls "${flow}"], [0], [dn # tcp,reg14=0x${lsp1_inport},vlan_tci=0x0000,dl_src=00:00:00:00:00:01,dl_dst=00:00:00:00:00:02,nw_src=42.42.42.1,nw_dst=66.66.66.66,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=0,tp_dst=80,tcp_flags=0 ct_lb { ct_lb { - output("lsp2"); + reg0[[6]] = 0; + *** chk_lb_hairpin_reply action not implemented; + reg0[[12]] = 0; + ct_lb { + output("lsp2"); + }; }; }; ]) @@ -2927,7 +2932,12 @@ AT_CHECK_UNQUOTED([ovn-trace --ct new --ct new --minimal ls "${flow}"], [0], [dn # udp,reg14=0x${lsp1_inport},vlan_tci=0x0000,dl_src=00:00:00:00:00:01,dl_dst=00:00:00:00:00:02,nw_src=42.42.42.1,nw_dst=66.66.66.66,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=0,tp_dst=80 ct_lb { ct_lb { - output("lsp2"); + reg0[[6]] = 0; + *** chk_lb_hairpin_reply action not implemented; + reg0[[12]] = 0; + ct_lb { + output("lsp2"); + }; }; }; ]) @@ -2944,7 +2954,12 @@ AT_CHECK_UNQUOTED([ovn-trace --ct new --ct new --minimal ls "${flow}"], [0], [dn # tcp,reg14=0x${lsp1_inport},vlan_tci=0x0000,dl_src=00:00:00:00:00:01,dl_dst=00:00:00:00:00:02,nw_src=42.42.42.1,nw_dst=66.66.66.66,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=0,tp_dst=80,tcp_flags=0 ct_lb { ct_lb { - output("lsp2"); + reg0[[6]] = 0; + *** chk_lb_hairpin_reply action not implemented; + reg0[[12]] = 0; + ct_lb { + output("lsp2"); + }; }; }; ]) @@ -2955,7 +2970,12 @@ AT_CHECK_UNQUOTED([ovn-trace --ct new --ct new --minimal ls "${flow}"], [0], [dn # udp,reg14=0x${lsp1_inport},vlan_tci=0x0000,dl_src=00:00:00:00:00:01,dl_dst=00:00:00:00:00:02,nw_src=42.42.42.1,nw_dst=66.66.66.66,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=0,tp_dst=80 ct_lb { ct_lb { - output("lsp2"); + reg0[[6]] = 0; + *** chk_lb_hairpin_reply action not implemented; + reg0[[12]] = 0; + ct_lb { + output("lsp2"); + }; }; }; ]) @@ -3052,7 +3072,12 @@ AT_CHECK_UNQUOTED([ovn-trace --ct new --ct new --minimal ls "${flow}"], [0], [dn # tcp,reg14=0x${lsp1_inport},vlan_tci=0x0000,dl_src=00:00:00:00:00:01,dl_dst=00:00:00:00:00:02,nw_src=42.42.42.1,nw_dst=66.66.66.66,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=0,tp_dst=80,tcp_flags=0 ct_lb { ct_lb { - output("lsp2"); + reg0[[6]] = 0; + *** chk_lb_hairpin_reply action not implemented; + reg0[[12]] = 0; + ct_lb { + output("lsp2"); + }; }; }; ]) @@ -3063,7 +3088,12 @@ AT_CHECK_UNQUOTED([ovn-trace --ct new --ct new --minimal ls "${flow}"], [0], [dn # udp,reg14=0x${lsp1_inport},vlan_tci=0x0000,dl_src=00:00:00:00:00:01,dl_dst=00:00:00:00:00:02,nw_src=42.42.42.1,nw_dst=66.66.66.66,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=0,tp_dst=80 ct_lb { ct_lb { - output("lsp2"); + reg0[[6]] = 0; + *** chk_lb_hairpin_reply action not implemented; + reg0[[12]] = 0; + ct_lb { + output("lsp2"); + }; }; }; ]) @@ -3080,7 +3110,12 @@ AT_CHECK_UNQUOTED([ovn-trace --ct new --ct new --minimal ls "${flow}"], [0], [dn # tcp,reg14=0x${lsp1_inport},vlan_tci=0x0000,dl_src=00:00:00:00:00:01,dl_dst=00:00:00:00:00:02,nw_src=42.42.42.1,nw_dst=66.66.66.66,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=0,tp_dst=80,tcp_flags=0 ct_lb { ct_lb { - output("lsp2"); + reg0[[6]] = 0; + *** chk_lb_hairpin_reply action not implemented; + reg0[[12]] = 0; + ct_lb { + output("lsp2"); + }; }; }; ]) @@ -3091,7 +3126,12 @@ AT_CHECK_UNQUOTED([ovn-trace --ct new --ct new --minimal ls "${flow}"], [0], [dn # udp,reg14=0x${lsp1_inport},vlan_tci=0x0000,dl_src=00:00:00:00:00:01,dl_dst=00:00:00:00:00:02,nw_src=42.42.42.1,nw_dst=66.66.66.66,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=0,tp_dst=80 ct_lb { ct_lb { - output("lsp2"); + reg0[[6]] = 0; + *** chk_lb_hairpin_reply action not implemented; + reg0[[12]] = 0; + ct_lb { + output("lsp2"); + }; }; }; ]) diff --git a/utilities/ovn-trace.c b/utilities/ovn-trace.c index 617ad834c..e99202da6 100644 --- a/utilities/ovn-trace.c +++ b/utilities/ovn-trace.c @@ -2351,6 +2351,7 @@ execute_ct_lb(const struct ovnact_ct_lb *ct_lb, const struct ovntrace_datapath *dp, struct flow *uflow, enum ovnact_pipeline pipeline, struct ovs_list *super) { + struct ds comment = DS_EMPTY_INITIALIZER; struct flow ct_lb_flow = *uflow; int family = (ct_lb_flow.dl_type == htons(ETH_TYPE_IP) ? AF_INET @@ -2404,10 +2405,15 @@ execute_ct_lb(const struct ovnact_ct_lb *ct_lb, } ct_lb_flow.ct_state |= CS_DST_NAT; } + if (ct_state_idx < n_ct_states) { + ct_lb_flow.ct_state |= next_ct_state(&comment); + } } struct ovntrace_node *node = ovntrace_node_append( - super, OVNTRACE_NODE_TRANSFORMATION, "ct_lb"); + super, OVNTRACE_NODE_TRANSFORMATION, "ct_lb%s", + ds_cstr_ro(&comment)); + ds_destroy(&comment); trace__(dp, &ct_lb_flow, ct_lb->ltable, pipeline, &node->subs); }