From patchwork Mon Oct 14 16:06:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Horman X-Patchwork-Id: 1997055 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XS2DH3n1fz1xsc for ; Tue, 15 Oct 2024 03:06:55 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 2C1FA40493; Mon, 14 Oct 2024 16:06:53 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id wImV9WbBMXBZ; Mon, 14 Oct 2024 16:06:52 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.9.56; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org EB55B402E7 Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp4.osuosl.org (Postfix) with ESMTPS id EB55B402E7; Mon, 14 Oct 2024 16:06:51 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 9397DC08A6; Mon, 14 Oct 2024 16:06:51 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) by lists.linuxfoundation.org (Postfix) with ESMTP id BFC0CC08A3 for ; Mon, 14 Oct 2024 16:06:49 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id A7E0080EB7 for ; Mon, 14 Oct 2024 16:06:49 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id K0tEg8tQ_vww for ; Mon, 14 Oct 2024 16:06:49 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=217.70.183.193; helo=relay1-d.mail.gandi.net; envelope-from=horms@ovn.org; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org A2AF080BEB Authentication-Results: smtp1.osuosl.org; dmarc=none (p=none dis=none) header.from=ovn.org DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org A2AF080BEB Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) by smtp1.osuosl.org (Postfix) with ESMTPS id A2AF080BEB for ; Mon, 14 Oct 2024 16:06:48 +0000 (UTC) Received: by mail.gandi.net (Postfix) with ESMTPSA id C8069240007; Mon, 14 Oct 2024 16:06:46 +0000 (UTC) From: Simon Horman Date: Mon, 14 Oct 2024 17:06:38 +0100 MIME-Version: 1.0 Message-Id: <20241014-nft-testsuite-v1-3-6cd52bb0ceb5@ovn.org> References: <20241014-nft-testsuite-v1-0-6cd52bb0ceb5@ovn.org> In-Reply-To: <20241014-nft-testsuite-v1-0-6cd52bb0ceb5@ovn.org> To: dev@openvswitch.org X-Mailer: b4 0.14.0 X-GND-Sasl: horms@ovn.org Subject: [ovs-dev] [PATCH 3/3] tests: Handle marks using nft if available. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Update the "offloads - ping over vxlan tunnel with gbp - offloads enabled" test to use nft, instead of iptables, if available. This is part of an effort to use nft in place of iptables throughout the testsuite. Unlike other patches towards this series, simply inline nft support into the test, rather than using macros. This matches the current iptables support in this test. Signed-off-by: Simon Horman --- tests/system-offloads-traffic.at | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/tests/system-offloads-traffic.at b/tests/system-offloads-traffic.at index d1da33d96c63..a84c3be5a1c8 100644 --- a/tests/system-offloads-traffic.at +++ b/tests/system-offloads-traffic.at @@ -812,6 +812,7 @@ OVS_CHECK_VXLAN() OVS_TRAFFIC_VSWITCHD_START([], [], [-- set Open_vSwitch . other_config:hw-offload=true]) AT_SKIP_IF([! grep -q "probe tc: vxlan gbp is supported." ovs-vswitchd.log]) +AT_SKIP_IF([test $HAVE_NFT = no -a $HAVE_IPTABLES = no]) ADD_BR([br-underlay]) AT_CHECK([ovs-ofctl add-flow br-underlay "actions=normal"]) @@ -832,8 +833,32 @@ AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"]) ADD_NATIVE_TUNNEL([vxlan], [at_vxlan1], [at_ns0], [172.31.1.100], [10.1.1.1/24], [id 0 dstport 4789 gbp]) -NS_CHECK_EXEC([at_ns0], [iptables -I OUTPUT -p ip -j MARK --set-mark 512 2>/dev/null], [0]) -NS_CHECK_EXEC([at_ns0], [iptables -I INPUT -m mark --mark 512 -j ACCEPT 2>/dev/null], [0], [ignore]) + +if test $HAVE_NFT = yes; then + NS_CHECK_EXEC([at_ns0], [nft -f - << EOF + table ip filter { + chain OUTPUT { + type filter hook output priority filter; policy accept; + counter meta mark set 512 + } + } + + table ip filter { + chain INPUT { + type filter hook input priority filter; policy accept; + mark 512 counter accept; + } + } +EOF + ]) +else + NS_CHECK_EXEC([at_ns0], + [iptables -I OUTPUT -p ip -j MARK --set-mark 512 2>/dev/null], + [0]) + NS_CHECK_EXEC([at_ns0], + [iptables -I INPUT -m mark --mark 512 -j ACCEPT 2>/dev/null], + [0], [ignore]) +fi dnl First, check the underlay. NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -W 2 172.31.1.100 | FORMAT_PING], [0], [dnl