From patchwork Fri Jun 11 14:10:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Gray X-Patchwork-Id: 1490978 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::137; helo=smtp4.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: 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=iY+Cu/k+; dkim-atps=neutral Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) (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 ozlabs.org (Postfix) with ESMTPS id 4G1jSC1CQgz9sRN for ; Sat, 12 Jun 2021 00:11:06 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id B26F64159C; Fri, 11 Jun 2021 14:11:03 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org 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 OEaE9MrTvYl1; Fri, 11 Jun 2021 14:11:02 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp4.osuosl.org (Postfix) with ESMTPS id 3354441577; Fri, 11 Jun 2021 14:11:01 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 79FA4C0026; Fri, 11 Jun 2021 14:10:59 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 853C6C000D for ; Fri, 11 Jun 2021 14:10:56 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 644F26062E for ; Fri, 11 Jun 2021 14:10:56 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp3.osuosl.org (amavisd-new); dkim=pass (1024-bit key) header.d=redhat.com Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id AqkfpPqwXMGr for ; Fri, 11 Jun 2021 14:10:55 +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 smtp3.osuosl.org (Postfix) with ESMTPS id 8D66060604 for ; Fri, 11 Jun 2021 14:10:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623420654; 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: in-reply-to:in-reply-to:references:references; bh=cMgON3noiT30kztCj+AvhEBlY1NOn+Zw9LDYKSgDWsw=; b=iY+Cu/k+z9duIWVwuhRlFsil9bU9zgXWi5lt/NjYnMbQpiHA1W7OU+CHWzAz5Lh8ySj6rw AekilDw8n9Ts6GX30g9exXnNiWzuw0Hkup2DWqoFt+syJ0gE92h2Ew3Wsg7M/Pa1XI82/w LtsAv+khHyXOxIgbaaHn+QRNgKMEMXk= Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-32-uhGwGOKzNuujQQvS2cWM3g-1; Fri, 11 Jun 2021 10:10:53 -0400 X-MC-Unique: uhGwGOKzNuujQQvS2cWM3g-1 Received: by mail-qk1-f200.google.com with SMTP id k125-20020a3788830000b02903a65618d46cso21518639qkd.3 for ; Fri, 11 Jun 2021 07:10:53 -0700 (PDT) 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=cMgON3noiT30kztCj+AvhEBlY1NOn+Zw9LDYKSgDWsw=; b=gYIjGFSEDQsWeFrNrvI4zm/OjN7Z0mTiU/VrlcVT+fXNXneGd3So2yIjCJCgCRX9pW fc5mbwDBb87F9bgIDkW/z5jk9/1IymqJ5E/0RqZr2E+xElUdIqIcCknzD0Hxpy5zrr1m efsPDJEvvzh/X2yJ9/oMVstmg0C2gL1ffdQvG+udbrPKJ5neCYcEz5mOVR+hCJNyOd6d sF+wLbC7WLT3L7u6BhuiD5E+qDbqf6I3PSsR58cqaYP7b7rZOaH5d4usTkLKrZ9CkKkF OlLBlpaD2ubmwLO2oNGw0Jpqp25/1SjcInh/aW0++5XH6okCMeYajZIhA62mPgCZmFxu 56MQ== X-Gm-Message-State: AOAM5321CwjStN9zNfjB42ZYRyX0iXNdlGpfNOg2IhowU+xr5OZ2/ewO w4P/TRF9r3piepbtd7FXeQxVk6KKS165fxY2lyVbM9glpClhswhBYamJm4ApXN8x6AjBlgZWwdK nbdFUC9rHd0dWlFCMZB9eVtR8M71ALbwmNoWRI+4+LnMLyQDlNH0fCSEhjPWrCY8ReTTF X-Received: by 2002:ac8:728c:: with SMTP id v12mr3964254qto.324.1623420652024; Fri, 11 Jun 2021 07:10:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwmrYdS8I7Cb7I5hiykDFcxoNX0gwlRD36jV/+4S0RJMYpKIp4Xq44GKUR3Rnwxvm8D69fp0g== X-Received: by 2002:ac8:728c:: with SMTP id v12mr3964226qto.324.1623420651785; Fri, 11 Jun 2021 07:10:51 -0700 (PDT) Received: from wsfd-netdev91.ntdv.lab.eng.bos.redhat.com (nat-pool-bos-t.redhat.com. [66.187.233.206]) by smtp.gmail.com with ESMTPSA id e4sm4039963qtw.62.2021.06.11.07.10.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Jun 2021 07:10:51 -0700 (PDT) From: Mark Gray To: dev@openvswitch.org Date: Fri, 11 Jun 2021 10:10:47 -0400 Message-Id: <20210611141048.2272957-2-mark.d.gray@redhat.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210611141048.2272957-1-mark.d.gray@redhat.com> References: <20210611141048.2272957-1-mark.d.gray@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mark.d.gray@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Cc: dceara@redhat.com Subject: [ovs-dev] [PATCH ovn v4 1/2] ovn-northd.at: Fix trailing whitespace 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" Signed-off-by: Mark Gray Acked-by: Dumitru Ceara --- tests/ovn-northd.at | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at index 4692775ad720..aae85e3bf657 100644 --- a/tests/ovn-northd.at +++ b/tests/ovn-northd.at @@ -483,7 +483,7 @@ check ovn-nbctl --wait=sb lsp-set-options sw0-lr1 router-port=lr1-sw0 # connected to lr0 exp_ref_ch_list="$comp1_ch_uuid $comp2_ch_uuid" -wait_column "$exp_ref_ch_list" HA_Chassis_Group ref_chassis +wait_column "$exp_ref_ch_list" HA_Chassis_Group ref_chassis # Unind sw1-p1. comp2 should not be in the ref_chassis. ovn-sbctl lsp-unbind sw1-p1 From patchwork Fri Jun 11 14:10:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Gray X-Patchwork-Id: 1490979 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: 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=FlhnaQid; dkim-atps=neutral Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (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 ozlabs.org (Postfix) with ESMTPS id 4G1jSH74D5z9sRN for ; Sat, 12 Jun 2021 00:11:11 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 7236A60B38; Fri, 11 Jun 2021 14:11:09 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fP0MAyP9rvle; Fri, 11 Jun 2021 14:11:07 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTPS id AE4F360ADE; Fri, 11 Jun 2021 14:11:06 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 92060C000D; Fri, 11 Jun 2021 14:11:06 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id E9E46C000B for ; Fri, 11 Jun 2021 14:11:04 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id C0A5383E0C for ; Fri, 11 Jun 2021 14:11:04 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp1.osuosl.org (amavisd-new); dkim=pass (1024-bit key) header.d=redhat.com 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 bSiqMrwZdds5 for ; Fri, 11 Jun 2021 14:11:01 +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 smtp1.osuosl.org (Postfix) with ESMTPS id 099DB83E1E for ; Fri, 11 Jun 2021 14:11:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623420659; 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: in-reply-to:in-reply-to:references:references; bh=xrxusK3ly7I0unD5OdCKwCKYr+sX0gwMy5YKPmVTtNg=; b=FlhnaQidrgQFRO3jl/3NLjQrrmQJtM4/l7fGtSTa/ruWmX9UDOKbJLgRW18jfbPd+FBW+5 aN0pL7l1R/JqV6+rWqeBRpQmVxZeKM/7fAlnfZ+OizudN0XchlhZbFfEE7Bb2JUNrRqa8n Ik2+JQ16ISOVKB5c/TxE6HRo+4Ew9IY= Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-536-sLAtDL3-OrWynGMkOlTiEQ-1; Fri, 11 Jun 2021 10:10:55 -0400 X-MC-Unique: sLAtDL3-OrWynGMkOlTiEQ-1 Received: by mail-qt1-f198.google.com with SMTP id r1-20020ac85c810000b02901fa9798cdb5so1998763qta.8 for ; Fri, 11 Jun 2021 07:10:54 -0700 (PDT) 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=xrxusK3ly7I0unD5OdCKwCKYr+sX0gwMy5YKPmVTtNg=; b=SvCY9w+VSTLzuLryf2XKgExcFgJmuWVCgHhquwm3Q9ulUjz+dA4X67pDwOfXiYb3om K4o2hO4hl6UDQxpCQ8dEC/oWI2hjsfnCzhO0oaigAsCh6nylb/8qSizN2Kg/VkEObRbr +nKOkkj3xpLq2BuqBChS9pux2MFNior0p6nYpXYXyDk5gDDplqzrYpf6ixeSz+AW/AVn TZmltMIZA5az0gURUVWU+D0s41171srvEowJgSMZceUfiDvBoe1F3rdlw6dcrIQiVYqO 16iTfxQ6l8tllZc+IeZhHaVCKvSPifiJU7QSnH2QF85Uy+Bj3SK80Nls+DlKdLznrqFn wn3g== X-Gm-Message-State: AOAM532pElEXTSsN81AumjJiwO/miFu/fUudin391x1FL1kka1vm2qnu c/rOiQU0JkKqNhhTGv6Oc785xW+STGkmEdZmXujGHv5X0QsETAcBY8KKtZl2+wOycb69o2dv5ns 9bFxZ6NAiexIiroRxYFSIcAH2OIf/EiXU4EJek1vvnwS1rh1tqpHgso8C5OoQ0Wo4OvLY X-Received: by 2002:a37:9244:: with SMTP id u65mr4037043qkd.46.1623420653711; Fri, 11 Jun 2021 07:10:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxMZS0pXReh0H2D2Y9g1Ml+shTNMwlFaFM6RFwXNuUxwaKD9gpJdzD4TNzAm4HeNZOQlQ7/2A== X-Received: by 2002:a37:9244:: with SMTP id u65mr4037013qkd.46.1623420653406; Fri, 11 Jun 2021 07:10:53 -0700 (PDT) Received: from wsfd-netdev91.ntdv.lab.eng.bos.redhat.com (nat-pool-bos-t.redhat.com. [66.187.233.206]) by smtp.gmail.com with ESMTPSA id e4sm4039963qtw.62.2021.06.11.07.10.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Jun 2021 07:10:52 -0700 (PDT) From: Mark Gray To: dev@openvswitch.org Date: Fri, 11 Jun 2021 10:10:48 -0400 Message-Id: <20210611141048.2272957-3-mark.d.gray@redhat.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210611141048.2272957-1-mark.d.gray@redhat.com> References: <20210611141048.2272957-1-mark.d.gray@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mark.d.gray@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Cc: dceara@redhat.com Subject: [ovs-dev] [PATCH ovn v4 2/2] ovn-trace: correctly handle ct_dnat(IP) action 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" ovn-trace does not set translated ip address for ct_dnat() actions when tracing. This causes the trace to end prematurely. This can be tested with the following or an equivalent for IPv6: ovn-nbctl ls-add sw0 ovn-nbctl lsp-add sw0 sw0-port1 ovn-nbctl lsp-set-addresses sw0-port1 "50:54:00:00:00:01 192.168.0.2" ovn-nbctl ls-add sw1 ovn-nbctl lsp-add sw1 sw1-port1 ovn-nbctl lsp-set-addresses sw1-port1 "50:54:00:00:00:03 11.0.0.2" ovn-nbctl lr-add lr0 ovn-nbctl lrp-add lr0 lrp0 00:00:00:00:ff:01 192.168.0.1/24 ovn-nbctl lsp-add sw0 lrp0-attachment ovn-nbctl lsp-set-type lrp0-attachment router ovn-nbctl lsp-set-addresses lrp0-attachment 00:00:00:00:ff:01 ovn-nbctl lsp-set-options lrp0-attachment router-port=lrp0 ovn-nbctl lrp-add lr0 lrp1 00:00:00:00:ff:02 11.0.0.1/24 -- lrp-set-gateway-chassis lrp1 chassis-1 ovn-nbctl lsp-add sw1 lrp1-attachment ovn-nbctl lsp-set-type lrp1-attachment router ovn-nbctl lsp-set-addresses lrp1-attachment 00:00:00:00:ff:02 ovn-nbctl lsp-set-options lrp1-attachment router-port=lrp1 ovn-nbctl lr-nat-add lr0 dnat 42.42.42.42 192.168.0.2 ovs-vsctl add-port br-int p1 -- \ set Interface p1 external_ids:iface-id=sw0-port1 ovs-vsctl add-port br-int p2 -- \ set Interface p2 external_ids:iface-id=sw1-port1 ovn-trace 'inport == "sw1-port1" && eth.src == 50:54:00:00:00:03 && eth.dst == 00:00:00:00:ff:02 && ip4.dst == 42.42.42.42 && ip4.src == 11.0.0.2 && ip.ttl == 64' Signed-off-by: Mark Gray Acked-by: Dumitru Ceara --- Notes: v2: fix whitespace and add unit tests, move ovn-trace tests to dedicated file v3: Move ovn-trace tests back to original file v4: Split out whitepace patch add Dumitru's ack add trailing whitespace add check for 'ovn-nbctl' commands tests/ovn-northd.at | 78 +++++++++++++++++++++++++++++++++++++++++++ utilities/ovn-trace.c | 10 ++++++ 2 files changed, 88 insertions(+) diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at index aae85e3bf657..7f54ce91e6ab 100644 --- a/tests/ovn-northd.at +++ b/tests/ovn-northd.at @@ -3644,3 +3644,81 @@ check ovn-nbctl --wait=sb sync OVS_APP_EXIT_AND_WAIT([NORTHD_TYPE]) AT_CLEANUP ]) + +OVN_FOR_EACH_NORTHD([ +AT_SETUP([ovn -- trace with IPv4 dnat]) +AT_KEYWORDS([dnat]) +ovn_start + +check ovn-nbctl ls-add sw0 +check ovn-nbctl lsp-add sw0 sw0-port1 +check ovn-nbctl lsp-set-addresses sw0-port1 "50:54:00:00:00:01 192.168.0.2" + +check ovn-nbctl ls-add sw1 +check ovn-nbctl lsp-add sw1 sw1-port1 +check ovn-nbctl lsp-set-addresses sw1-port1 "50:54:00:00:00:03 11.0.0.2" + +check ovn-nbctl lr-add lr0 +check ovn-nbctl lrp-add lr0 lrp0 00:00:00:00:ff:01 192.168.0.1/24 +check ovn-nbctl lsp-add sw0 lrp0-attachment +check ovn-nbctl lsp-set-type lrp0-attachment router +check ovn-nbctl lsp-set-addresses lrp0-attachment 00:00:00:00:ff:01 +check ovn-nbctl lsp-set-options lrp0-attachment router-port=lrp0 +check ovn-nbctl lrp-add lr0 lrp1 00:00:00:00:ff:02 11.0.0.1/24 -- lrp-set-gateway-chassis lrp1 chassis-1 +check ovn-nbctl lsp-add sw1 lrp1-attachment +check ovn-nbctl lsp-set-type lrp1-attachment router +check ovn-nbctl lsp-set-addresses lrp1-attachment 00:00:00:00:ff:02 +check ovn-nbctl lsp-set-options lrp1-attachment router-port=lrp1 + +check ovn-nbctl lr-nat-add lr0 dnat 42.42.42.42 192.168.0.2 +check ovn-nbctl --wait=sb sync + +AT_CHECK([ovn-trace --minimal 'inport == "sw1-port1" && eth.src == 50:54:00:00:00:03 && eth.dst == 00:00:00:00:ff:02 && ip4.dst == 42.42.42.42 && ip4.src == 11.0.0.2 && ip.ttl == 64' | grep "output(\"sw0-port1\")"], [0], [ignore]) + +dnl If we remove the DNAT entry we will be unable to trace to the DNAT address +check ovn-nbctl lr-nat-del lr0 dnat 42.42.42.42 +check ovn-nbctl --wait=sb sync + +AT_CHECK([ovn-trace --minimal 'inport == "sw1-port1" && eth.src == 50:54:00:00:00:03 && eth.dst == 00:00:00:00:ff:02 && ip4.dst == 42.42.42.42 && ip4.src == 11.0.0.2 && ip.ttl == 64' | grep "output(\"sw0-port1\")"], [1], [ignore]) + +AT_CLEANUP +]) + +OVN_FOR_EACH_NORTHD([ +AT_SETUP([ovn -- trace with IPv6 dnat]) +AT_KEYWORDS([dnat]) +ovn_start + +check ovn-nbctl ls-add sw0 +check ovn-nbctl lsp-add sw0 sw0-port1 +check ovn-nbctl lsp-set-addresses sw0-port1 "50:54:00:00:00:01 fd68::2" + +check ovn-nbctl ls-add sw1 +check ovn-nbctl lsp-add sw1 sw1-port1 +check ovn-nbctl lsp-set-addresses sw1-port1 "50:54:00:00:00:03 fd11::2" + +check ovn-nbctl lr-add lr0 +check ovn-nbctl lrp-add lr0 lrp0 00:00:00:00:ff:01 fd68::1/64 +check ovn-nbctl lsp-add sw0 lrp0-attachment +check ovn-nbctl lsp-set-type lrp0-attachment router +check ovn-nbctl lsp-set-addresses lrp0-attachment 00:00:00:00:ff:01 +check ovn-nbctl lsp-set-options lrp0-attachment router-port=lrp0 +check ovn-nbctl lrp-add lr0 lrp1 00:00:00:00:ff:02 fd11::1/64 -- lrp-set-gateway-chassis lrp1 chassis-1 +check ovn-nbctl lsp-add sw1 lrp1-attachment +check ovn-nbctl lsp-set-type lrp1-attachment router +check ovn-nbctl lsp-set-addresses lrp1-attachment 00:00:00:00:ff:02 +check ovn-nbctl lsp-set-options lrp1-attachment router-port=lrp1 + +check ovn-nbctl lr-nat-add lr0 dnat fd42::42 fd68::2 +check ovn-nbctl --wait=sb sync + +AT_CHECK([ovn-trace --minimal 'inport == "sw1-port1" && eth.src == 50:54:00:00:00:03 && eth.dst == 00:00:00:00:ff:02 && ip6.dst == fd42::42 && ip6.src == fd11::2 && ip.ttl == 64' | grep "output(\"sw0-port1\")"], [0], [ignore]) + +dnl If we remove the DNAT entry we will be unable to trace to the DNAT address +check ovn-nbctl lr-nat-del lr0 dnat fd42::42 +check ovn-nbctl --wait=sb sync + +AT_CHECK([ovn-trace --minimal 'inport == "sw1-port1" && eth.src == 50:54:00:00:00:03 && eth.dst == 00:00:00:00:ff:02 && ip6.dst == fd42::42 && ip6.src == fd11::2 && ip.ttl == 64' | grep "output(\"sw0-port1\")"], [1], [ignore]) + +AT_CLEANUP +]) diff --git a/utilities/ovn-trace.c b/utilities/ovn-trace.c index 3b26b5af1d69..49463c5c2652 100644 --- a/utilities/ovn-trace.c +++ b/utilities/ovn-trace.c @@ -2297,10 +2297,20 @@ execute_ct_nat(const struct ovnact_ct_nat *ct_nat, if (ct_nat->family == AF_INET) { ds_put_format(&s, "(ip4.%s="IP_FMT")", direction, IP_ARGS(ct_nat->ipv4)); + if (is_dst) { + ct_flow.nw_dst = ct_nat->ipv4; + } else { + ct_flow.nw_src = ct_nat->ipv4; + } } else { ds_put_format(&s, "(ip6.%s=", direction); ipv6_format_addr(&ct_nat->ipv6, &s); ds_put_char(&s, ')'); + if (is_dst) { + ct_flow.ipv6_dst = ct_nat->ipv6; + } else { + ct_flow.ipv6_src = ct_nat->ipv6; + } } uint8_t state = is_dst ? CS_DST_NAT : CS_SRC_NAT;