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 # This tests flower-triggered mirroring to gretap and ip6gretap netdevices. The
8 # interfaces on H1 and H2 have two addresses each. Flower match on one of the
9 # addresses is configured with mirror action. It is expected that when pinging
10 # this address, mirroring takes place, whereas when pinging the other one,
11 # there's no mirroring.
21 source mirror_gre_lib.sh
22 source mirror_gre_topo_lib.sh
36 mirror_gre_topo_create
38 ip address add dev
$swp3 192.0.2.129/28
39 ip address add dev
$h3 192.0.2.130/28
41 ip address add dev
$swp3 2001:db8
:2::1/64
42 ip address add dev
$h3 2001:db8
:2::2/64
44 ip address add dev
$h1 192.0.2.3/28
45 ip address add dev
$h2 192.0.2.4/28
52 ip address del dev
$h2 192.0.2.4/28
53 ip address del dev
$h1 192.0.2.3/28
55 ip address del dev
$h3 2001:db8
:2::2/64
56 ip address del dev
$swp3 2001:db8
:2::1/64
58 ip address del dev
$h3 192.0.2.130/28
59 ip address del dev
$swp3 192.0.2.129/28
61 mirror_gre_topo_destroy
65 test_span_gre_dir_acl
()
67 test_span_gre_dir_ips
"$@" 192.0.2.3 192.0.2.4
70 fail_test_span_gre_dir_acl
()
72 fail_test_span_gre_dir_ips
"$@" 192.0.2.3 192.0.2.4
75 full_test_span_gre_dir_acl
()
77 local tundev
=$1; shift
78 local direction
=$1; shift
79 local forward_type
=$1; shift
80 local backward_type
=$1; shift
81 local match_dip
=$1; shift
86 mirror_install
$swp1 $direction $tundev \
87 "protocol ip flower $tcflags dst_ip $match_dip"
88 fail_test_span_gre_dir
$tundev $direction
89 test_span_gre_dir_acl
"$tundev" "$direction" \
90 "$forward_type" "$backward_type"
91 mirror_uninstall
$swp1 $direction
93 # Test lack of mirroring after ACL mirror is uninstalled.
94 fail_test_span_gre_dir_acl
"$tundev" "$direction"
96 log_test
"$direction $what ($tcflags)"
101 full_test_span_gre_dir_acl gt4 ingress
8 0 192.0.2.4 "ACL mirror to gretap"
102 full_test_span_gre_dir_acl gt4 egress
0 8 192.0.2.3 "ACL mirror to gretap"
107 full_test_span_gre_dir_acl gt6 ingress
8 0 192.0.2.4 "ACL mirror to ip6gretap"
108 full_test_span_gre_dir_acl gt6 egress
0 8 192.0.2.3 "ACL mirror to ip6gretap"
113 slow_path_trap_install
$swp1 ingress
114 slow_path_trap_install
$swp1 egress
118 slow_path_trap_uninstall
$swp1 egress
119 slow_path_trap_uninstall
$swp1 ingress
130 if ! tc_offload_check
; then
131 echo "WARN: Could not test offloaded functionality"