mirror of
https://github.com/torvalds/linux.git
synced 2026-05-31 10:33:41 +02:00
selftests: rtnetlink: Add bridge promiscuity tests
Add two test cases that always pass, but trigger sleeping in atomic context BUGs without "bridge: Fix sleep in atomic context in netlink path" and "bridge: Fix sleep in atomic context in sysfs path". Reviewed-by: Nikolay Aleksandrov <nikolay@nvidia.com> Signed-off-by: Ido Schimmel <idosch@nvidia.com> Link: https://patch.msgid.link/20260526064818.272516-4-idosch@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
6d34594cc6
commit
147f3b1f23
|
|
@ -24,6 +24,8 @@ ALL_TESTS="
|
|||
kci_test_macsec
|
||||
kci_test_macsec_vlan
|
||||
kci_test_team_bridge_macvlan
|
||||
kci_test_bridge_promisc_netlink
|
||||
kci_test_bridge_promisc_sysfs
|
||||
kci_test_ipsec
|
||||
kci_test_ipsec_offload
|
||||
kci_test_fdb_get
|
||||
|
|
@ -61,6 +63,14 @@ check_fail()
|
|||
fi
|
||||
}
|
||||
|
||||
sysfs_write()
|
||||
{
|
||||
local val="$1"
|
||||
local path="$2"
|
||||
|
||||
echo "$val" > "$path"
|
||||
}
|
||||
|
||||
run_cmd_common()
|
||||
{
|
||||
local cmd="$*"
|
||||
|
|
@ -680,6 +690,59 @@ kci_test_team_bridge_macvlan()
|
|||
end_test "PASS: team_bridge_macvlan"
|
||||
}
|
||||
|
||||
# Test that changing bridge port flags via the netlink path does not sleep with
|
||||
# the bridge spin lock held.
|
||||
kci_test_bridge_promisc_netlink()
|
||||
{
|
||||
local dummy="test_dummy1"
|
||||
local bridge="test_br1"
|
||||
local team="test_team1"
|
||||
local ret=0
|
||||
|
||||
run_cmd ip link add $team up type team
|
||||
run_cmd ip link add $bridge up type bridge vlan_filtering 1
|
||||
run_cmd ip link add $dummy up type dummy
|
||||
run_cmd ip link set $dummy master $bridge
|
||||
run_cmd ip link set $team master $bridge
|
||||
|
||||
# This causes the bridge driver to sync all the static FDB entries to
|
||||
# the team device (which supports unicast filtering) and remove it from
|
||||
# promiscuous mode. The call to dev_set_promiscuity() can sleep due to
|
||||
# Rx mode inlining, which is a problem if the bridge spin lock is held.
|
||||
run_cmd bridge link set dev $dummy flood off learning off
|
||||
|
||||
run_cmd ip link del $dummy
|
||||
run_cmd ip link del $bridge
|
||||
run_cmd ip link del $team
|
||||
|
||||
end_test "PASS: bridge_promisc_netlink"
|
||||
}
|
||||
|
||||
# Same as kci_test_bridge_promisc_netlink(), but the flags are changed via the
|
||||
# sysfs path.
|
||||
kci_test_bridge_promisc_sysfs()
|
||||
{
|
||||
local dummy="test_dummy1"
|
||||
local bridge="test_br1"
|
||||
local team="test_team1"
|
||||
local ret=0
|
||||
|
||||
run_cmd ip link add $team up type team
|
||||
run_cmd ip link add $bridge up type bridge vlan_filtering 1
|
||||
run_cmd ip link add $dummy up type dummy
|
||||
run_cmd ip link set $dummy master $bridge
|
||||
run_cmd ip link set $team master $bridge
|
||||
|
||||
run_cmd sysfs_write 0 /sys/class/net/$dummy/brport/unicast_flood
|
||||
run_cmd sysfs_write 0 /sys/class/net/$dummy/brport/learning
|
||||
|
||||
run_cmd ip link del $dummy
|
||||
run_cmd ip link del $bridge
|
||||
run_cmd ip link del $team
|
||||
|
||||
end_test "PASS: bridge_promisc_sysfs"
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# Example commands
|
||||
# ip x s add proto esp src 14.0.0.52 dst 14.0.0.70 \
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user