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 ingress
) local src_mac
=$
(mac_get
$h1); local dst_mac
=$
(mac_get
$h2)
71 egress
) local src_mac
=$
(mac_get
$h2); local dst_mac
=$
(mac_get
$h1)
77 mirror_install
$swp1 $direction $tundev "matchall $tcflags"
78 icmp_capture_install h3-
${tundev} "src_mac $src_mac dst_mac $dst_mac"
80 mirror_test v
$h1 192.0.2.1 192.0.2.2 h3-
${tundev} 100 10
82 icmp_capture_uninstall h3-
${tundev}
83 mirror_uninstall
$swp1 $direction
85 log_test
"$direction $what: envelope MAC ($tcflags)"
92 mirror_install
$swp1 ingress gt4
"matchall $tcflags"
93 mirror_install
$swp1 egress gt6
"matchall $tcflags"
94 quick_test_span_gre_dir gt4 ingress
95 quick_test_span_gre_dir gt6 egress
97 mirror_uninstall
$swp1 ingress
98 fail_test_span_gre_dir gt4 ingress
99 quick_test_span_gre_dir gt6 egress
101 mirror_install
$swp1 ingress gt4
"matchall $tcflags"
102 mirror_uninstall
$swp1 egress
103 quick_test_span_gre_dir gt4 ingress
104 fail_test_span_gre_dir gt6 egress
106 mirror_uninstall
$swp1 ingress
107 log_test
"two simultaneously configured mirrors ($tcflags)"
112 full_test_span_gre_dir gt4 ingress
8 0 "mirror to gretap"
113 full_test_span_gre_dir gt4 egress
0 8 "mirror to gretap"
118 full_test_span_gre_dir gt6 ingress
8 0 "mirror to ip6gretap"
119 full_test_span_gre_dir gt6 egress
0 8 "mirror to ip6gretap"
124 test_span_gre_mac gt4 ingress
"mirror to gretap"
125 test_span_gre_mac gt4 egress
"mirror to gretap"
130 test_span_gre_mac gt6 ingress
"mirror to ip6gretap"
131 test_span_gre_mac gt6 egress
"mirror to ip6gretap"
136 slow_path_trap_install
$swp1 ingress
137 slow_path_trap_install
$swp1 egress
141 slow_path_trap_uninstall
$swp1 egress
142 slow_path_trap_uninstall
$swp1 ingress
153 if ! tc_offload_check
; then
154 echo "WARN: Could not test offloaded functionality"