2 # SPDX-License-Identifier: GPL-2.0
4 # This test uses standard topology for testing gretap. See
5 # mirror_gre_topo_lib.sh for more details.
7 # Test that gretap and ip6gretap mirroring works when the other tunnel endpoint
8 # is reachable through a next-hop route (as opposed to directly-attached route).
18 source mirror_gre_lib.sh
19 source mirror_gre_topo_lib.sh
32 sysctl_set net.ipv4.conf.all.rp_filter 0
33 sysctl_set net.ipv4.conf.$h3.rp_filter 0
36 mirror_gre_topo_create
38 sysctl_set net.ipv4.conf.v$h3.rp_filter 0
40 ip address add dev $swp3 192.0.2.161/28
41 ip address add dev $h3 192.0.2.162/28
42 ip address add dev gt4 192.0.2.129/32
43 ip address add dev h3-gt4 192.0.2.130/32
45 # IPv6 route can't be added after address. Such routes are rejected due
46 # to the gateway address having been configured on the local system. It
47 # works the other way around though.
48 ip address add dev $swp3 2001:db8:4::1/64
49 ip -6 route add 2001:db8:2::2/128 via 2001:db8:4::2
50 ip address add dev $h3 2001:db8:4::2/64
51 ip address add dev gt6 2001:db8:2::1
52 ip address add dev h3-gt6 2001:db8:2::2
59 ip -6 route del 2001:db8:2::2/128 via 2001:db8:4::2
60 ip address del dev $h3 2001:db8:4::2/64
61 ip address del dev $swp3 2001:db8:4::1/64
63 ip address del dev $h3 192.0.2.162/28
64 ip address del dev $swp3 192.0.2.161/28
66 sysctl_restore net.ipv4.conf.v$h3.rp_filter 0
68 mirror_gre_topo_destroy
71 sysctl_restore net.ipv4.conf.$h3.rp_filter
72 sysctl_restore net.ipv4.conf.all.rp_filter
78 mirror_install $swp1 ingress gt4 "matchall $tcflags"
80 # For IPv4, test that there's no mirroring without the route directing
81 # the traffic to tunnel remote address. Then add it and test that
82 # mirroring starts. For IPv6 we can't test this due to the limitation
83 # that routes for locally-specified IPv6 addresses can't be added.
84 fail_test_span_gre_dir gt4 ingress
86 ip route add 192.0.2.130/32 via 192.0.2.162
87 quick_test_span_gre_dir gt4 ingress
88 ip route del 192.0.2.130/32 via 192.0.2.162
90 mirror_uninstall $swp1 ingress
91 log_test "mirror to gre with next-hop remote ($tcflags)"
98 mirror_install $swp1 ingress gt6 "matchall $tcflags"
99 quick_test_span_gre_dir gt6 ingress
100 mirror_uninstall $swp1 ingress
102 log_test "mirror to ip6gre with next-hop remote ($tcflags)"
107 slow_path_trap_install $swp1 ingress
108 slow_path_trap_install $swp1 egress
112 slow_path_trap_uninstall $swp1 egress
113 slow_path_trap_uninstall $swp1 ingress
124 if ! tc_offload_check; then
125 echo "WARN: Could not test offloaded functionality"