Skip to content

Commit af0a511

Browse files
pmachatadavem330
authored andcommitted
selftests: forwarding: Fix packet matching in mirroring selftests
In commit 6de6e46 ("cls_flower: Fix inability to match GRE/IPIP packets"), cls_flower was fixed to match an outer packet of a tunneled packet as would be expected, rather than dissecting to the inner packet and matching on that. This fix uncovered several issues in packet matching in mirroring selftests: - in mirror_gre_bridge_1d_vlan.sh and mirror_gre_vlan_bridge_1q.sh, the vlan_ethtype match is copied around as "ip", even as some of the tests are running over ip6gretap. This is fixed by using an "ipv6" for vlan_ethtype in the ip6gretap tests. - in mirror_gre_changes.sh, a filter to count GRE packets is set up to match TTL of 50. This used to trigger in the offloaded datapath, where the envelope TTL was matched, but not in the software datapath, which considered TTL of the inner packet. Now that both match consistently, all the packets were double-counted. This is fixed by marking the filter as skip_hw, leaving only the SW datapath component active. Fixes: 6de6e46 ("cls_flower: Fix inability to match GRE/IPIP packets") Signed-off-by: Petr Machata <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent c7cd82b commit af0a511

File tree

5 files changed

+13
-11
lines changed

5 files changed

+13
-11
lines changed

tools/testing/selftests/net/forwarding/mirror_gre_bridge_1d_vlan.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ test_gretap()
8080

8181
test_ip6gretap()
8282
{
83-
test_vlan_match gt6 'skip_hw vlan_id 555 vlan_ethtype ip' \
83+
test_vlan_match gt6 'skip_hw vlan_id 555 vlan_ethtype ipv6' \
8484
"mirror to ip6gretap"
8585
}
8686

tools/testing/selftests/net/forwarding/mirror_gre_changes.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ test_span_gre_ttl()
7474

7575
mirror_install $swp1 ingress $tundev "matchall $tcflags"
7676
tc filter add dev $h3 ingress pref 77 prot $prot \
77-
flower ip_ttl 50 action pass
77+
flower skip_hw ip_ttl 50 action pass
7878

7979
mirror_test v$h1 192.0.2.1 192.0.2.2 $h3 77 0
8080

tools/testing/selftests/net/forwarding/mirror_gre_vlan_bridge_1q.sh

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ test_gretap()
141141

142142
test_ip6gretap()
143143
{
144-
test_vlan_match gt6 'skip_hw vlan_id 555 vlan_ethtype ip' \
144+
test_vlan_match gt6 'skip_hw vlan_id 555 vlan_ethtype ipv6' \
145145
"mirror to ip6gretap"
146146
}
147147

@@ -218,30 +218,31 @@ test_ip6gretap_forbidden_egress()
218218
test_span_gre_untagged_egress()
219219
{
220220
local tundev=$1; shift
221+
local ul_proto=$1; shift
221222
local what=$1; shift
222223

223224
RET=0
224225

225226
mirror_install $swp1 ingress $tundev "matchall $tcflags"
226227

227228
quick_test_span_gre_dir $tundev ingress
228-
quick_test_span_vlan_dir $h3 555 ingress
229+
quick_test_span_vlan_dir $h3 555 ingress "$ul_proto"
229230

230231
h3_addr_add_del del $h3.555
231232
bridge vlan add dev $swp3 vid 555 pvid untagged
232233
h3_addr_add_del add $h3
233234
sleep 5
234235

235236
quick_test_span_gre_dir $tundev ingress
236-
fail_test_span_vlan_dir $h3 555 ingress
237+
fail_test_span_vlan_dir $h3 555 ingress "$ul_proto"
237238

238239
h3_addr_add_del del $h3
239240
bridge vlan add dev $swp3 vid 555
240241
h3_addr_add_del add $h3.555
241242
sleep 5
242243

243244
quick_test_span_gre_dir $tundev ingress
244-
quick_test_span_vlan_dir $h3 555 ingress
245+
quick_test_span_vlan_dir $h3 555 ingress "$ul_proto"
245246

246247
mirror_uninstall $swp1 ingress
247248

@@ -250,12 +251,12 @@ test_span_gre_untagged_egress()
250251

251252
test_gretap_untagged_egress()
252253
{
253-
test_span_gre_untagged_egress gt4 "mirror to gretap"
254+
test_span_gre_untagged_egress gt4 ip "mirror to gretap"
254255
}
255256

256257
test_ip6gretap_untagged_egress()
257258
{
258-
test_span_gre_untagged_egress gt6 "mirror to ip6gretap"
259+
test_span_gre_untagged_egress gt6 ipv6 "mirror to ip6gretap"
259260
}
260261

261262
test_span_gre_fdb_roaming()

tools/testing/selftests/net/forwarding/mirror_lib.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,14 @@ do_test_span_vlan_dir_ips()
115115
local dev=$1; shift
116116
local vid=$1; shift
117117
local direction=$1; shift
118+
local ul_proto=$1; shift
118119
local ip1=$1; shift
119120
local ip2=$1; shift
120121

121122
# Install the capture as skip_hw to avoid double-counting of packets.
122123
# The traffic is meant for local box anyway, so will be trapped to
123124
# kernel.
124-
vlan_capture_install $dev "skip_hw vlan_id $vid vlan_ethtype ip"
125+
vlan_capture_install $dev "skip_hw vlan_id $vid vlan_ethtype $ul_proto"
125126
mirror_test v$h1 $ip1 $ip2 $dev 100 $expect
126127
mirror_test v$h2 $ip2 $ip1 $dev 100 $expect
127128
vlan_capture_uninstall $dev

tools/testing/selftests/net/forwarding/mirror_vlan.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ test_tagged_vlan_dir()
8585
RET=0
8686

8787
mirror_install $swp1 $direction $swp3.555 "matchall $tcflags"
88-
do_test_span_vlan_dir_ips 10 "$h3.555" 111 "$direction" \
88+
do_test_span_vlan_dir_ips 10 "$h3.555" 111 "$direction" ip \
8989
192.0.2.17 192.0.2.18
90-
do_test_span_vlan_dir_ips 0 "$h3.555" 555 "$direction" \
90+
do_test_span_vlan_dir_ips 0 "$h3.555" 555 "$direction" ip \
9191
192.0.2.17 192.0.2.18
9292
mirror_uninstall $swp1 $direction
9393

0 commit comments

Comments
 (0)