Skip to content

Commit f145b0a

Browse files
committed
Merge branch 'More-mirror-to-gretap-tests-with-bridge-in-UL'
Petr Machata says: ==================== More mirror-to-gretap tests with bridge in UL This patchset adds two more tests where the mirror-to-gretap has a bridge in underlay packet path, without a VLAN above or below that bridge. In patch #1, a non-VLAN-filtering bridge is tested. In patch #2, a VLAN-filtering bridge is tested. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 2d1b138 + 239e754 commit f145b0a

File tree

2 files changed

+258
-0
lines changed

2 files changed

+258
-0
lines changed
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
#!/bin/bash
2+
# SPDX-License-Identifier: GPL-2.0
3+
4+
# Test for "tc action mirred egress mirror" when the underlay route points at a
5+
# bridge device without vlan filtering (802.1d).
6+
#
7+
# This test uses standard topology for testing mirror-to-gretap. See
8+
# mirror_gre_topo_lib.sh for more details. The full topology is as follows:
9+
#
10+
# +---------------------+ +---------------------+
11+
# | H1 | | H2 |
12+
# | + $h1 | | $h2 + |
13+
# | | 192.0.2.1/28 | | 192.0.2.2/28 | |
14+
# +-----|---------------+ +---------------|-----+
15+
# | |
16+
# +-----|-------------------------------------------------------------|-----+
17+
# | SW o---> mirror | |
18+
# | +---|-------------------------------------------------------------|---+ |
19+
# | | + $swp1 + br1 (802.1q bridge) $swp2 + | |
20+
# | +---------------------------------------------------------------------+ |
21+
# | |
22+
# | +---------------------------------------------------------------------+ |
23+
# | | + br2 (802.1d bridge) | |
24+
# | | 192.0.2.129/28 | |
25+
# | | + $swp3 2001:db8:2::1/64 | |
26+
# | +---|-----------------------------------------------------------------+ |
27+
# | | ^ ^ |
28+
# | | + gt6 (ip6gretap) | + gt4 (gretap) | |
29+
# | | : loc=2001:db8:2::1 | : loc=192.0.2.129 | |
30+
# | | : rem=2001:db8:2::2 -+ : rem=192.0.2.130 -+ |
31+
# | | : ttl=100 : ttl=100 |
32+
# | | : tos=inherit : tos=inherit |
33+
# +-----|---------------------:----------------------:----------------------+
34+
# | : :
35+
# +-----|---------------------:----------------------:----------------------+
36+
# | H3 + $h3 + h3-gt6(ip6gretap) + h3-gt4 (gretap) |
37+
# | 192.0.2.130/28 loc=2001:db8:2::2 loc=192.0.2.130 |
38+
# | 2001:db8:2::2/64 rem=2001:db8:2::1 rem=192.0.2.129 |
39+
# | ttl=100 ttl=100 |
40+
# | tos=inherit tos=inherit |
41+
# +-------------------------------------------------------------------------+
42+
43+
ALL_TESTS="
44+
test_gretap
45+
test_ip6gretap
46+
"
47+
48+
NUM_NETIFS=6
49+
source lib.sh
50+
source mirror_lib.sh
51+
source mirror_gre_lib.sh
52+
source mirror_gre_topo_lib.sh
53+
54+
setup_prepare()
55+
{
56+
h1=${NETIFS[p1]}
57+
swp1=${NETIFS[p2]}
58+
59+
swp2=${NETIFS[p3]}
60+
h2=${NETIFS[p4]}
61+
62+
swp3=${NETIFS[p5]}
63+
h3=${NETIFS[p6]}
64+
65+
vrf_prepare
66+
mirror_gre_topo_create
67+
68+
ip link add name br2 type bridge vlan_filtering 0
69+
ip link set dev br2 up
70+
71+
ip link set dev $swp3 master br2
72+
ip route add 192.0.2.130/32 dev br2
73+
ip -6 route add 2001:db8:2::2/128 dev br2
74+
75+
ip address add dev br2 192.0.2.129/28
76+
ip address add dev br2 2001:db8:2::1/64
77+
78+
ip address add dev $h3 192.0.2.130/28
79+
ip address add dev $h3 2001:db8:2::2/64
80+
}
81+
82+
cleanup()
83+
{
84+
pre_cleanup
85+
86+
ip address del dev $h3 2001:db8:2::2/64
87+
ip address del dev $h3 192.0.2.130/28
88+
ip link del dev br2
89+
90+
mirror_gre_topo_destroy
91+
vrf_cleanup
92+
}
93+
94+
test_gretap()
95+
{
96+
full_test_span_gre_dir gt4 ingress 8 0 "mirror to gretap"
97+
full_test_span_gre_dir gt4 egress 0 8 "mirror to gretap"
98+
}
99+
100+
test_ip6gretap()
101+
{
102+
full_test_span_gre_dir gt6 ingress 8 0 "mirror to ip6gretap"
103+
full_test_span_gre_dir gt6 egress 0 8 "mirror to ip6gretap"
104+
}
105+
106+
test_all()
107+
{
108+
slow_path_trap_install $swp1 ingress
109+
slow_path_trap_install $swp1 egress
110+
111+
tests_run
112+
113+
slow_path_trap_uninstall $swp1 egress
114+
slow_path_trap_uninstall $swp1 ingress
115+
}
116+
117+
trap cleanup EXIT
118+
119+
setup_prepare
120+
setup_wait
121+
122+
tcflags="skip_hw"
123+
test_all
124+
125+
if ! tc_offload_check; then
126+
echo "WARN: Could not test offloaded functionality"
127+
else
128+
tcflags="skip_sw"
129+
test_all
130+
fi
131+
132+
exit $EXIT_STATUS
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
#!/bin/bash
2+
# SPDX-License-Identifier: GPL-2.0
3+
4+
# Test for "tc action mirred egress mirror" when the underlay route points at a
5+
# bridge device with vlan filtering (802.1q).
6+
#
7+
# This test uses standard topology for testing mirror-to-gretap. See
8+
# mirror_gre_topo_lib.sh for more details. The full topology is as follows:
9+
#
10+
# +---------------------+ +---------------------+
11+
# | H1 | | H2 |
12+
# | + $h1 | | $h2 + |
13+
# | | 192.0.2.1/28 | | 192.0.2.2/28 | |
14+
# +-----|---------------+ +---------------|-----+
15+
# | |
16+
# +-----|---------------------------------------------------------------|-----+
17+
# | SW o---> mirror | |
18+
# | +---|---------------------------------------------------------------|---+ |
19+
# | | + $swp1 + br1 (802.1q bridge) $swp2 + | |
20+
# | | 192.0.2.129/28 | |
21+
# | | + $swp3 2001:db8:2::1/64 | |
22+
# | | | vid555 vid555[pvid,untagged] | |
23+
# | +---|-------------------------------------------------------------------+ |
24+
# | | ^ ^ |
25+
# | | + gt6 (ip6gretap) | + gt4 (gretap) | |
26+
# | | : loc=2001:db8:2::1 | : loc=192.0.2.129 | |
27+
# | | : rem=2001:db8:2::2 -+ : rem=192.0.2.130 -+ |
28+
# | | : ttl=100 : ttl=100 |
29+
# | | : tos=inherit : tos=inherit |
30+
# +-----|---------------------:------------------------:----------------------+
31+
# | : :
32+
# +-----|---------------------:------------------------:----------------------+
33+
# | H3 + $h3 + h3-gt6(ip6gretap) + h3-gt4 (gretap) |
34+
# | | loc=2001:db8:2::2 loc=192.0.2.130 |
35+
# | + $h3.555 rem=2001:db8:2::1 rem=192.0.2.129 |
36+
# | 192.0.2.130/28 ttl=100 ttl=100 |
37+
# | 2001:db8:2::2/64 tos=inherit tos=inherit |
38+
# +---------------------------------------------------------------------------+
39+
40+
ALL_TESTS="
41+
test_gretap
42+
test_ip6gretap
43+
"
44+
45+
NUM_NETIFS=6
46+
source lib.sh
47+
source mirror_lib.sh
48+
source mirror_gre_lib.sh
49+
source mirror_gre_topo_lib.sh
50+
51+
setup_prepare()
52+
{
53+
h1=${NETIFS[p1]}
54+
swp1=${NETIFS[p2]}
55+
56+
swp2=${NETIFS[p3]}
57+
h2=${NETIFS[p4]}
58+
59+
swp3=${NETIFS[p5]}
60+
h3=${NETIFS[p6]}
61+
62+
vrf_prepare
63+
mirror_gre_topo_create
64+
65+
ip link set dev $swp3 master br1
66+
bridge vlan add dev br1 vid 555 pvid untagged self
67+
ip address add dev br1 192.0.2.129/28
68+
ip address add dev br1 2001:db8:2::1/64
69+
70+
ip -4 route add 192.0.2.130/32 dev br1
71+
ip -6 route add 2001:db8:2::2/128 dev br1
72+
73+
vlan_create $h3 555 v$h3 192.0.2.130/28 2001:db8:2::2/64
74+
bridge vlan add dev $swp3 vid 555
75+
}
76+
77+
cleanup()
78+
{
79+
pre_cleanup
80+
81+
ip link set dev $swp3 nomaster
82+
vlan_destroy $h3 555
83+
84+
mirror_gre_topo_destroy
85+
vrf_cleanup
86+
}
87+
88+
test_gretap()
89+
{
90+
full_test_span_gre_dir gt4 ingress 8 0 "mirror to gretap"
91+
full_test_span_gre_dir gt4 egress 0 8 "mirror to gretap"
92+
}
93+
94+
test_ip6gretap()
95+
{
96+
full_test_span_gre_dir gt6 ingress 8 0 "mirror to ip6gretap"
97+
full_test_span_gre_dir gt6 egress 0 8 "mirror to ip6gretap"
98+
}
99+
100+
tests()
101+
{
102+
slow_path_trap_install $swp1 ingress
103+
slow_path_trap_install $swp1 egress
104+
105+
tests_run
106+
107+
slow_path_trap_uninstall $swp1 egress
108+
slow_path_trap_uninstall $swp1 ingress
109+
}
110+
111+
trap cleanup EXIT
112+
113+
setup_prepare
114+
setup_wait
115+
116+
tcflags="skip_hw"
117+
tests
118+
119+
if ! tc_offload_check; then
120+
echo "WARN: Could not test offloaded functionality"
121+
else
122+
tcflags="skip_sw"
123+
tests
124+
fi
125+
126+
exit $EXIT_STATUS

0 commit comments

Comments
 (0)