2 # SPDX-License-Identifier: GPL-2.0
4 # +---------------------+ +---------------------+
7 # | | 192.0.2.1/28 | | 192.0.2.2/28 | |
8 # +-----|---------------+ +---------------|-----+
10 # +-----|-------------------------------------------------------------|-----+
11 # | SW o--> mirror | |
12 # | +---|-------------------------------------------------------------|---+ |
13 # | | + $swp1 BR $swp2 + | |
14 # | +---------------------------------------------------------------------+ |
16 # | +---------------------------------------------------------------------+ |
17 # | | OL + gt6 (ip6gretap) + gt4 (gretap) | |
18 # | | : loc=2001:db8:2::1 : loc=192.0.2.129 | |
19 # | | : rem=2001:db8:2::2 : rem=192.0.2.130 | |
20 # | | : ttl=100 : ttl=100 | |
21 # | | : tos=inherit : tos=inherit | |
22 # | +-------------------------:--|-------------------:--|-----------------+ |
24 # | +-------------------------:--|-------------------:--|-----------------+ |
25 # | | UL : |,---------------------' | |
26 # | | + $swp3 : || : | |
27 # | | | 192.0.2.129/28 : vv : | |
28 # | | | 2001:db8:2::1/64 : + ul (dummy) : | |
29 # | +---|---------------------:----------------------:--------------------+ |
30 # +-----|---------------------:----------------------:----------------------+
32 # +-----|---------------------:----------------------:----------------------+
33 # | H3 + $h3 + h3-gt6 (ip6gretap) + h3-gt4 (gretap) |
34 # | 192.0.2.130/28 loc=2001:db8:2::2 loc=192.0.2.130 |
35 # | 2001:db8:2::2/64 rem=2001:db8:2::1 rem=192.0.2.129 |
37 # | tos=inherit tos=inherit |
39 # +-------------------------------------------------------------------------+
41 # This tests mirroring to gretap and ip6gretap configured in an overlay /
42 # underlay manner, i.e. with a bound dummy device that marks underlay VRF where
43 # the encapsulated packed should be routed.
53 source mirror_gre_lib.sh
57 simple_if_init
$h1 192.0.2.1/28
62 simple_if_fini
$h1 192.0.2.1/28
67 simple_if_init
$h2 192.0.2.2/28
72 simple_if_fini
$h2 192.0.2.2/28
77 simple_if_init
$h3 192.0.2.130/28 2001:db8
:2::2/64
79 tunnel_create h3-gt4 gretap
192.0.2.130 192.0.2.129
80 ip link
set h3-gt4 vrf v
$h3
81 matchall_sink_create h3-gt4
83 tunnel_create h3-gt6 ip6gretap
2001:db8
:2::2 2001:db8
:2::1
84 ip link
set h3-gt6 vrf v
$h3
85 matchall_sink_create h3-gt6
93 simple_if_fini
$h3 192.0.2.130/28 2001:db8
:2::2/64
98 # Bridge between H1 and H2.
100 ip link add name br1
type bridge vlan_filtering
1
101 ip link
set dev br1 up
103 ip link
set dev
$swp1 master br1
104 ip link
set dev
$swp1 up
106 ip link
set dev
$swp2 master br1
107 ip link
set dev
$swp2 up
109 tc qdisc add dev
$swp1 clsact
113 simple_if_init
$swp3 192.0.2.129/28 2001:db8
:2::1/64
115 ip link add name ul
type dummy
116 ip link
set dev ul master v
$swp3
117 ip link
set dev ul up
122 ip link
set dev vrf-ol up
124 tunnel_create gt4 gretap
192.0.2.129 192.0.2.130 \
125 ttl
100 tos inherit dev ul
126 ip link
set dev gt4 master vrf-ol
127 ip link
set dev gt4 up
129 tunnel_create gt6 ip6gretap
2001:db8
:2::1 2001:db8
:2::2 \
130 ttl
100 tos inherit dev ul allow-localremote
131 ip link
set dev gt6 master vrf-ol
132 ip link
set dev gt6 up
142 simple_if_fini
$swp3 192.0.2.129/28 2001:db8
:2::1/64
146 tc qdisc del dev
$swp1 clsact
148 ip link
set dev
$swp1 down
149 ip link
set dev
$swp2 down
188 full_test_span_gre_dir gt4 ingress
8 0 "mirror to gretap w/ UL"
189 full_test_span_gre_dir gt4 egress
0 8 "mirror to gretap w/ UL"
194 full_test_span_gre_dir gt6 ingress
8 0 "mirror to ip6gretap w/ UL"
195 full_test_span_gre_dir gt6 egress
0 8 "mirror to ip6gretap w/ UL"
202 slow_path_trap_install
$swp1 ingress
203 slow_path_trap_install
$swp1 egress
207 slow_path_trap_uninstall
$swp1 egress
208 slow_path_trap_uninstall
$swp1 ingress
219 if ! tc_offload_check
; then
220 echo "WARN: Could not test offloaded functionality"