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 for "tc action mirred egress mirror" when the device to mirror to is a
8 # gretap or ip6gretap netdevice. Expect that the packets come out encapsulated,
9 # and another gretap / ip6gretap netdevice is then capable of decapsulating the
10 # traffic. Test that the payload is what is expected (ICMP ping request or
11 # reply, depending on test).
24 source mirror_gre_lib.sh
25 source mirror_gre_topo_lib.sh
39 mirror_gre_topo_create
41 ip address add dev $swp3 192.0.2.129/28
42 ip address add dev $h3 192.0.2.130/28
44 ip address add dev $swp3 2001:db8:2::1/64
45 ip address add dev $h3 2001:db8:2::2/64
52 ip address del dev $h3 2001:db8:2::2/64
53 ip address del dev $swp3 2001:db8:2::1/64
55 ip address del dev $h3 192.0.2.130/28
56 ip address del dev $swp3 192.0.2.129/28
58 mirror_gre_topo_destroy
64 local tundev=$1; shift
65 local direction=$1; shift
69 local swp3mac=$(mac_get $swp3)
70 local h3mac=$(mac_get $h3)
74 mirror_install $swp1 $direction $tundev "matchall $tcflags"
75 tc filter add dev $h3 ingress pref 77 prot $prot \
76 flower ip_proto 0x2f src_mac $swp3mac dst_mac $h3mac \
79 mirror_test v$h1 192.0.2.1 192.0.2.2 $h3 77 10
81 tc filter del dev $h3 ingress pref 77
82 mirror_uninstall $swp1 $direction
84 log_test "$direction $what: envelope MAC ($tcflags)"
91 mirror_install $swp1 ingress gt4 "matchall $tcflags"
92 mirror_install $swp1 egress gt6 "matchall $tcflags"
93 quick_test_span_gre_dir gt4 ingress
94 quick_test_span_gre_dir gt6 egress
96 mirror_uninstall $swp1 ingress
97 fail_test_span_gre_dir gt4 ingress
98 quick_test_span_gre_dir gt6 egress
100 mirror_install $swp1 ingress gt4 "matchall $tcflags"
101 mirror_uninstall $swp1 egress
102 quick_test_span_gre_dir gt4 ingress
103 fail_test_span_gre_dir gt6 egress
105 mirror_uninstall $swp1 ingress
106 log_test "two simultaneously configured mirrors ($tcflags)"
111 full_test_span_gre_dir gt4 ingress 8 0 "mirror to gretap"
112 full_test_span_gre_dir gt4 egress 0 8 "mirror to gretap"
117 full_test_span_gre_dir gt6 ingress 8 0 "mirror to ip6gretap"
118 full_test_span_gre_dir gt6 egress 0 8 "mirror to ip6gretap"
123 test_span_gre_mac gt4 ingress ip "mirror to gretap"
124 test_span_gre_mac gt4 egress ip "mirror to gretap"
129 test_span_gre_mac gt6 ingress ipv6 "mirror to ip6gretap"
130 test_span_gre_mac gt6 egress ipv6 "mirror to ip6gretap"
135 slow_path_trap_install $swp1 ingress
136 slow_path_trap_install $swp1 egress
140 slow_path_trap_uninstall $swp1 egress
141 slow_path_trap_uninstall $swp1 ingress
152 if ! tc_offload_check; then
153 echo "WARN: Could not test offloaded functionality"