Skip to content

Commit edcbf51

Browse files
daniellertskuba-moo
authored andcommitted
selftests: forwarding: Fix race condition in mirror installation
When mirroring to a gretap in hardware the device expects to be programmed with the egress port and all the encapsulating headers. This requires the driver to resolve the path the packet will take in the software data path and program the device accordingly. If the path cannot be resolved (in this case because of an unresolved neighbor), then mirror installation fails until the path is resolved. This results in a race that causes the test to sometimes fail. Fix this by setting the neighbor's state to permanent, so that it is always valid. Fixes: b5b0293 ("selftests: forwarding: mirror_gre_bridge_1d_vlan: Add STP test") Signed-off-by: Danielle Ratson <[email protected]> Reviewed-by: Petr Machata <[email protected]> Signed-off-by: Ido Schimmel <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 2107d45 commit edcbf51

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,20 @@ test_ip6gretap()
8686

8787
test_gretap_stp()
8888
{
89+
# Sometimes after mirror installation, the neighbor's state is not valid.
90+
# The reason is that there is no SW datapath activity related to the
91+
# neighbor for the remote GRE address. Therefore whether the corresponding
92+
# neighbor will be valid is a matter of luck, and the test is thus racy.
93+
# Set the neighbor's state to permanent, so it would be always valid.
94+
ip neigh replace 192.0.2.130 lladdr $(mac_get $h3) \
95+
nud permanent dev br2
8996
full_test_span_gre_stp gt4 $swp3.555 "mirror to gretap"
9097
}
9198

9299
test_ip6gretap_stp()
93100
{
101+
ip neigh replace 2001:db8:2::2 lladdr $(mac_get $h3) \
102+
nud permanent dev br2
94103
full_test_span_gre_stp gt6 $swp3.555 "mirror to ip6gretap"
95104
}
96105

0 commit comments

Comments
 (0)