netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ido Schimmel <idosch@nvidia.com>
To: <netdev@vger.kernel.org>
Cc: <davem@davemloft.net>, <kuba@kernel.org>, <pabeni@redhat.com>,
	<edumazet@google.com>, <dsahern@kernel.org>, <gnault@redhat.com>,
	"Ido Schimmel" <idosch@nvidia.com>
Subject: [PATCH net-next 5/6] selftests: fib_rule_tests: Add DSCP selector match tests
Date: Wed, 11 Sep 2024 12:37:47 +0300	[thread overview]
Message-ID: <20240911093748.3662015-6-idosch@nvidia.com> (raw)
In-Reply-To: <20240911093748.3662015-1-idosch@nvidia.com>

Add tests for the new FIB rule DSCP selector. Test with both IPv4 and
IPv6 and with both input and output routes.

Signed-off-by: Ido Schimmel <idosch@nvidia.com>
---
 tools/testing/selftests/net/fib_rule_tests.sh | 34 +++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/tools/testing/selftests/net/fib_rule_tests.sh b/tools/testing/selftests/net/fib_rule_tests.sh
index 53c5c1ad437e..21d11d23fab7 100755
--- a/tools/testing/selftests/net/fib_rule_tests.sh
+++ b/tools/testing/selftests/net/fib_rule_tests.sh
@@ -274,6 +274,23 @@ fib_rule6_test()
 			"$getnomatch" "ipproto ipv6-icmp match" \
 			"ipproto ipv6-tcp no match"
 	fi
+
+	fib_check_iproute_support "dscp" "tos"
+	if [ $? -eq 0 ]; then
+		match="dscp 0x3f"
+		getmatch="tos 0xfc"
+		getnomatch="tos 0xf4"
+		fib_rule6_test_match_n_redirect "$match" "$getmatch" \
+			"$getnomatch" "dscp redirect to table" \
+			"dscp no redirect to table"
+
+		match="dscp 0x3f"
+		getmatch="from $SRC_IP6 iif $DEV tos 0xfc"
+		getnomatch="from $SRC_IP6 iif $DEV tos 0xf4"
+		fib_rule6_test_match_n_redirect "$match" "$getmatch" \
+			"$getnomatch" "iif dscp redirect to table" \
+			"iif dscp no redirect to table"
+	fi
 }
 
 fib_rule6_vrf_test()
@@ -468,6 +485,23 @@ fib_rule4_test()
 			"$getnomatch" "ipproto icmp match" \
 			"ipproto tcp no match"
 	fi
+
+	fib_check_iproute_support "dscp" "tos"
+	if [ $? -eq 0 ]; then
+		match="dscp 0x3f"
+		getmatch="tos 0xfc"
+		getnomatch="tos 0xf4"
+		fib_rule4_test_match_n_redirect "$match" "$getmatch" \
+			"$getnomatch" "dscp redirect to table" \
+			"dscp no redirect to table"
+
+		match="dscp 0x3f"
+		getmatch="from $SRC_IP iif $DEV tos 0xfc"
+		getnomatch="from $SRC_IP iif $DEV tos 0xf4"
+		fib_rule4_test_match_n_redirect "$match" "$getmatch" \
+			"$getnomatch" "iif dscp redirect to table" \
+			"iif dscp no redirect to table"
+	fi
 }
 
 fib_rule4_vrf_test()
-- 
2.46.0


  parent reply	other threads:[~2024-09-11  9:38 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-11  9:37 [PATCH net-next 0/6] net: fib_rules: Add DSCP selector support Ido Schimmel
2024-09-11  9:37 ` [PATCH net-next 1/6] net: fib_rules: Add DSCP selector attribute Ido Schimmel
2024-09-13 12:03   ` Guillaume Nault
2024-09-11  9:37 ` [PATCH net-next 2/6] ipv4: fib_rules: Add DSCP selector support Ido Schimmel
2024-09-13 12:10   ` Guillaume Nault
2024-09-11  9:37 ` [PATCH net-next 3/6] ipv6: " Ido Schimmel
2024-09-13 12:21   ` Guillaume Nault
2024-09-11  9:37 ` [PATCH net-next 4/6] net: fib_rules: Enable DSCP selector usage Ido Schimmel
2024-09-13 12:26   ` Guillaume Nault
2024-09-11  9:37 ` Ido Schimmel [this message]
2024-09-13 12:52   ` [PATCH net-next 5/6] selftests: fib_rule_tests: Add DSCP selector match tests Guillaume Nault
2024-09-11  9:37 ` [PATCH net-next 6/6] selftests: fib_rule_tests: Add DSCP selector connect tests Ido Schimmel
2024-09-13 12:58   ` Guillaume Nault
2024-09-13 13:08 ` [PATCH net-next 0/6] net: fib_rules: Add DSCP selector support Guillaume Nault
2024-09-30 13:45   ` Ido Schimmel
2024-09-30 18:18     ` David Ahern
2024-10-01 20:08     ` Guillaume Nault
2024-09-13 14:31 ` David Ahern
2024-09-14  4:30 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240911093748.3662015-6-idosch@nvidia.com \
    --to=idosch@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=gnault@redhat.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).