netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/3] selftests: forwarding: Additions to mirror-to-gretap tests
@ 2018-05-23 16:34 Petr Machata
  2018-05-23 16:34 ` [PATCH net-next 1/3] selftests: forwarding: Test mirroring to deleted device Petr Machata
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Petr Machata @ 2018-05-23 16:34 UTC (permalink / raw)
  To: netdev, linux-kselftest; +Cc: davem, shuah, idosch

This patchset is for a handful of edge cases in mirror-to-gretap
scenarios: removal of mirrored-to netdevice (#1), removal of underlay
route for tunnel remote endpoint (#2) and cessation of mirroring upon
removal of flower mirroring rule (#3).

Petr Machata (3):
  selftests: forwarding: Test mirroring to deleted device
  selftests: forwarding: Test removal of underlay route
  selftests: forwarding: Test removal of mirroring

 .../selftests/net/forwarding/mirror_gre_changes.sh | 68 ++++++++++++++++++++++
 .../selftests/net/forwarding/mirror_gre_flower.sh  |  8 +++
 2 files changed, 76 insertions(+)

-- 
2.4.11

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH net-next 1/3] selftests: forwarding: Test mirroring to deleted device
  2018-05-23 16:34 [PATCH net-next 0/3] selftests: forwarding: Additions to mirror-to-gretap tests Petr Machata
@ 2018-05-23 16:34 ` Petr Machata
  2018-05-23 16:35 ` [PATCH net-next 2/3] selftests: forwarding: Test removal of underlay route Petr Machata
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Petr Machata @ 2018-05-23 16:34 UTC (permalink / raw)
  To: netdev, linux-kselftest; +Cc: davem, shuah, idosch

Tests that the mirroring code catches up with deletion of a mirrored-to
device.

Signed-off-by: Petr Machata <petrm@mellanox.com>
---
 .../selftests/net/forwarding/mirror_gre_changes.sh | 38 ++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/tools/testing/selftests/net/forwarding/mirror_gre_changes.sh b/tools/testing/selftests/net/forwarding/mirror_gre_changes.sh
index 50ab346..a35fd55 100755
--- a/tools/testing/selftests/net/forwarding/mirror_gre_changes.sh
+++ b/tools/testing/selftests/net/forwarding/mirror_gre_changes.sh
@@ -12,6 +12,7 @@ ALL_TESTS="
 	test_tun_up
 	test_egress_up
 	test_remote_ip
+	test_tun_del
 "
 
 NUM_NETIFS=6
@@ -159,6 +160,35 @@ test_span_gre_remote_ip()
 	log_test "$what: remote address change ($tcflags)"
 }
 
+test_span_gre_tun_del()
+{
+	local tundev=$1; shift
+	local type=$1; shift
+	local flags=$1; shift
+	local local_ip=$1; shift
+	local remote_ip=$1; shift
+	local what=$1; shift
+
+	RET=0
+
+	mirror_install $swp1 ingress $tundev "matchall $tcflags"
+	quick_test_span_gre_dir $tundev ingress
+	ip link del dev $tundev
+	fail_test_span_gre_dir $tundev ingress
+
+	tunnel_create $tundev $type $local_ip $remote_ip \
+		      ttl 100 tos inherit $flags
+
+	# Recreating the tunnel doesn't reestablish mirroring, so reinstall it
+	# and verify it works for the follow-up tests.
+	mirror_uninstall $swp1 ingress
+	mirror_install $swp1 ingress $tundev "matchall $tcflags"
+	quick_test_span_gre_dir $tundev ingress
+	mirror_uninstall $swp1 ingress
+
+	log_test "$what: tunnel deleted ($tcflags)"
+}
+
 test_ttl()
 {
 	test_span_gre_ttl gt4 gretap ip "mirror to gretap"
@@ -183,6 +213,14 @@ test_remote_ip()
 	test_span_gre_remote_ip gt6 ip6gretap 2001:db8:2::2 2001:db8:2::4 "mirror to ip6gretap"
 }
 
+test_tun_del()
+{
+	test_span_gre_tun_del gt4 gretap "" \
+			      192.0.2.129 192.0.2.130 "mirror to gretap"
+	test_span_gre_tun_del gt6 ip6gretap allow-localremote \
+			      2001:db8:2::1 2001:db8:2::2 "mirror to ip6gretap"
+}
+
 test_all()
 {
 	slow_path_trap_install $swp1 ingress
-- 
2.4.11

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH net-next 2/3] selftests: forwarding: Test removal of underlay route
  2018-05-23 16:34 [PATCH net-next 0/3] selftests: forwarding: Additions to mirror-to-gretap tests Petr Machata
  2018-05-23 16:34 ` [PATCH net-next 1/3] selftests: forwarding: Test mirroring to deleted device Petr Machata
@ 2018-05-23 16:35 ` Petr Machata
  2018-05-23 16:35 ` [PATCH net-next 3/3] selftests: forwarding: Test removal of mirroring Petr Machata
  2018-05-25  2:14 ` [PATCH net-next 0/3] selftests: forwarding: Additions to mirror-to-gretap tests David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: Petr Machata @ 2018-05-23 16:35 UTC (permalink / raw)
  To: netdev, linux-kselftest; +Cc: davem, shuah, idosch

When underlay route is removed, the mirrored traffic should not be
forwarded.

Signed-off-by: Petr Machata <petrm@mellanox.com>
---
 .../selftests/net/forwarding/mirror_gre_changes.sh | 30 ++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/tools/testing/selftests/net/forwarding/mirror_gre_changes.sh b/tools/testing/selftests/net/forwarding/mirror_gre_changes.sh
index a35fd55..e22a9e4 100755
--- a/tools/testing/selftests/net/forwarding/mirror_gre_changes.sh
+++ b/tools/testing/selftests/net/forwarding/mirror_gre_changes.sh
@@ -13,6 +13,7 @@ ALL_TESTS="
 	test_egress_up
 	test_remote_ip
 	test_tun_del
+	test_route_del
 "
 
 NUM_NETIFS=6
@@ -189,6 +190,29 @@ test_span_gre_tun_del()
 	log_test "$what: tunnel deleted ($tcflags)"
 }
 
+test_span_gre_route_del()
+{
+	local tundev=$1; shift
+	local edev=$1; shift
+	local route=$1; shift
+	local what=$1; shift
+
+	RET=0
+
+	mirror_install $swp1 ingress $tundev "matchall $tcflags"
+	quick_test_span_gre_dir $tundev ingress
+
+	ip route del $route dev $edev
+	fail_test_span_gre_dir $tundev ingress
+
+	ip route add $route dev $edev
+	quick_test_span_gre_dir $tundev ingress
+
+	mirror_uninstall $swp1 ingress
+
+	log_test "$what: underlay route removal ($tcflags)"
+}
+
 test_ttl()
 {
 	test_span_gre_ttl gt4 gretap ip "mirror to gretap"
@@ -221,6 +245,12 @@ test_tun_del()
 			      2001:db8:2::1 2001:db8:2::2 "mirror to ip6gretap"
 }
 
+test_route_del()
+{
+	test_span_gre_route_del gt4 $swp3 192.0.2.128/28 "mirror to gretap"
+	test_span_gre_route_del gt6 $swp3 2001:db8:2::/64 "mirror to ip6gretap"
+}
+
 test_all()
 {
 	slow_path_trap_install $swp1 ingress
-- 
2.4.11

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH net-next 3/3] selftests: forwarding: Test removal of mirroring
  2018-05-23 16:34 [PATCH net-next 0/3] selftests: forwarding: Additions to mirror-to-gretap tests Petr Machata
  2018-05-23 16:34 ` [PATCH net-next 1/3] selftests: forwarding: Test mirroring to deleted device Petr Machata
  2018-05-23 16:35 ` [PATCH net-next 2/3] selftests: forwarding: Test removal of underlay route Petr Machata
@ 2018-05-23 16:35 ` Petr Machata
  2018-05-25  2:14 ` [PATCH net-next 0/3] selftests: forwarding: Additions to mirror-to-gretap tests David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: Petr Machata @ 2018-05-23 16:35 UTC (permalink / raw)
  To: netdev, linux-kselftest; +Cc: davem, shuah, idosch

Test that when flower-based mirror action is removed, mirroring stops.

Signed-off-by: Petr Machata <petrm@mellanox.com>
---
 tools/testing/selftests/net/forwarding/mirror_gre_flower.sh | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tools/testing/selftests/net/forwarding/mirror_gre_flower.sh b/tools/testing/selftests/net/forwarding/mirror_gre_flower.sh
index 2e54407..12914f4 100755
--- a/tools/testing/selftests/net/forwarding/mirror_gre_flower.sh
+++ b/tools/testing/selftests/net/forwarding/mirror_gre_flower.sh
@@ -67,6 +67,11 @@ test_span_gre_dir_acl()
 	test_span_gre_dir_ips "$@" 192.0.2.3 192.0.2.4
 }
 
+fail_test_span_gre_dir_acl()
+{
+	fail_test_span_gre_dir_ips "$@" 192.0.2.3 192.0.2.4
+}
+
 full_test_span_gre_dir_acl()
 {
 	local tundev=$1; shift
@@ -83,6 +88,9 @@ full_test_span_gre_dir_acl()
 			  "$forward_type" "$backward_type"
 	mirror_uninstall $swp1 $direction
 
+	# Test lack of mirroring after ACL mirror is uninstalled.
+	fail_test_span_gre_dir_acl "$tundev" "$direction"
+
 	log_test "$direction $what ($tcflags)"
 }
 
-- 
2.4.11

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next 0/3] selftests: forwarding: Additions to mirror-to-gretap tests
  2018-05-23 16:34 [PATCH net-next 0/3] selftests: forwarding: Additions to mirror-to-gretap tests Petr Machata
                   ` (2 preceding siblings ...)
  2018-05-23 16:35 ` [PATCH net-next 3/3] selftests: forwarding: Test removal of mirroring Petr Machata
@ 2018-05-25  2:14 ` David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2018-05-25  2:14 UTC (permalink / raw)
  To: petrm; +Cc: netdev, linux-kselftest, shuah, idosch

From: Petr Machata <petrm@mellanox.com>
Date: Wed, 23 May 2018 18:34:49 +0200

> This patchset is for a handful of edge cases in mirror-to-gretap
> scenarios: removal of mirrored-to netdevice (#1), removal of underlay
> route for tunnel remote endpoint (#2) and cessation of mirroring upon
> removal of flower mirroring rule (#3).

Series applied, thank you.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-05-25  2:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-23 16:34 [PATCH net-next 0/3] selftests: forwarding: Additions to mirror-to-gretap tests Petr Machata
2018-05-23 16:34 ` [PATCH net-next 1/3] selftests: forwarding: Test mirroring to deleted device Petr Machata
2018-05-23 16:35 ` [PATCH net-next 2/3] selftests: forwarding: Test removal of underlay route Petr Machata
2018-05-23 16:35 ` [PATCH net-next 3/3] selftests: forwarding: Test removal of mirroring Petr Machata
2018-05-25  2:14 ` [PATCH net-next 0/3] selftests: forwarding: Additions to mirror-to-gretap tests David Miller

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).