[PATCH net-next 4/4] selftests: forwarding: Test redirecting vxlan and bareudp packets to Ethernet

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add selftests for the following commit:
  * 99c8719b7981 ("bareudp: allow redirecting bareudp packets to eth
    devices").
(no commit for VXLAN-GPE, which has always worked in this configuration).

Only test collect-md mode as both bareudp and vxlan-gpe devices don't
currently implement classical mode.

Signed-off-by: Guillaume Nault <gnault@xxxxxxxxxx>
---
 tools/testing/selftests/net/forwarding/config |  2 +
 .../net/forwarding/tc_redirect_l2l3.sh        | 55 +++++++++++++++++++
 2 files changed, 57 insertions(+)

diff --git a/tools/testing/selftests/net/forwarding/config b/tools/testing/selftests/net/forwarding/config
index 5d3ab2b63c53..ec49660ee808 100644
--- a/tools/testing/selftests/net/forwarding/config
+++ b/tools/testing/selftests/net/forwarding/config
@@ -21,3 +21,5 @@ CONFIG_NET_IPIP=m
 CONFIG_IPV6_SIT=m
 CONFIG_IPV6_GRE=m
 CONFIG_IPV6_TUNNEL=m
+CONFIG_VXLAN=m
+CONFIG_BAREUDP=m
diff --git a/tools/testing/selftests/net/forwarding/tc_redirect_l2l3.sh b/tools/testing/selftests/net/forwarding/tc_redirect_l2l3.sh
index 207b92775a6c..db8ccef9a334 100755
--- a/tools/testing/selftests/net/forwarding/tc_redirect_l2l3.sh
+++ b/tools/testing/selftests/net/forwarding/tc_redirect_l2l3.sh
@@ -27,6 +27,8 @@ ALL_TESTS="
 	redir_sit
 	redir_ip6gre
 	redir_ip6tnl
+	redir_vxlan_gpe
+	redir_bareudp
 "
 
 NUM_NETIFS=0
@@ -354,6 +356,59 @@ redir_ip6tnl()
 	cleanup_tunnel
 }
 
+redir_vxlan_gpe()
+{
+	local IP
+
+	# As of Linux 5.13, VXLAN-GPE only supports collect-md mode
+	for UNDERLAY_IPVERS in 4 6; do
+		IP="IPv${UNDERLAY_IPVERS}"
+
+		setup_tunnel "${IP}" "collect_md" "vxlan" "gpe external" "id 10"
+		ping_test ipv4 "VXLAN-GPE, external mode: ${IP} / UDP / VXLAN-GPE / IPv4"
+		ping_test ipv6 "VXLAN-GPE, external mode: ${IP} / UDP / VXLAN-GPE / IPv6"
+		ping_test ipv4-mpls "VXLAN-GPE, external mode: ${IP} / UDP / VXLAN-GPE / MPLS / IPv4"
+		ping_test ipv6-mpls "VXLAN-GPE, external mode: ${IP} / UDP / VXLAN-GPE / MPLS / IPv6"
+		cleanup_tunnel
+	done
+}
+
+redir_bareudp()
+{
+	local IP
+
+	# As of Linux 5.13, Bareudp only supports collect-md mode
+	for UNDERLAY_IPVERS in 4 6; do
+		IP="IPv${UNDERLAY_IPVERS}"
+
+		# IPv4 overlay
+		setup_tunnel "${IP}" "collect_md" "bareudp" \
+			"dstport 6635 ethertype ipv4"
+		ping_test ipv4 "Bareudp, external mode: ${IP} / UDP / IPv4"
+		cleanup_tunnel
+
+		# IPv6 overlay
+		setup_tunnel "${IP}" "collect_md" "bareudp" \
+			"dstport 6635 ethertype ipv6"
+		ping_test ipv6 "Bareudp, external mode: ${IP} / UDP / IPv6"
+		cleanup_tunnel
+
+		# Combined IPv4/IPv6 overlay (multiproto mode)
+		setup_tunnel "${IP}" "collect_md" "bareudp" \
+			"dstport 6635 ethertype ipv4 multiproto"
+		ping_test ipv4 "Bareudp, external mode: ${IP} / UDP / IPv4 (multiproto)"
+		ping_test ipv6 "Bareudp, external mode: ${IP} / UDP / IPv6 (multiproto)"
+		cleanup_tunnel
+
+		# MPLS overlay
+		setup_tunnel "${IP}" "collect_md" "bareudp" \
+			"dstport 6635 ethertype mpls_uc"
+		ping_test ipv4-mpls "Bareudp, external mode: ${IP} / UDP / MPLS / IPv4"
+		ping_test ipv6-mpls "Bareudp, external mode: ${IP} / UDP / MPLS / IPv6"
+		cleanup_tunnel
+	done
+}
+
 exit_cleanup()
 {
 	if [ "${TESTS_COMPLETED}" = "no" ]; then
-- 
2.21.3




[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux