]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit
selftests: devlink_trap_l3_drops: Avoid race condition
authorIdo Schimmel <idosch@mellanox.com>
Thu, 27 Feb 2020 07:50:10 +0000 (08:50 +0100)
committerDavid S. Miller <davem@davemloft.net>
Thu, 27 Feb 2020 19:10:14 +0000 (11:10 -0800)
commit5d66773f4158894f2266398ecbdaf2f94a89348b
tree0f249a5aac8723c0026dd600aef4c50bd063fd6f
parentab2b8ab253d17a81a3d905d4c3e215391c725771
selftests: devlink_trap_l3_drops: Avoid race condition

The test checks that packets are trapped when they should egress a
router interface (RIF) that has become disabled. This is a temporary
state in a RIF's deletion sequence.

Currently, the test deletes the RIF by flushing all the IP addresses
configured on the associated netdev (br0). However, this is racy, as
this also flushes all the routes pointing to the netdev and if the
routes are deleted from the device before the RIF is disabled, then no
packets will try to egress the disabled RIF and the trap will not be
triggered.

Instead, trigger the deletion of the RIF by unlinking the mlxsw port
from the bridge that is backing the RIF. Unlike before, this will not
cause the kernel to delete the routes pointing to the bridge.

Note that due to current mlxsw locking scheme the RIF is always deleted
first, but this is going to change.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
tools/testing/selftests/drivers/net/mlxsw/devlink_trap_l3_drops.sh