Commit 863ff546 authored by Hangbin Liu's avatar Hangbin Liu Committed by David S. Miller

selftests: forwarding: skip if kernel not support setting bridge fdb learning limit

If the testing kernel doesn't support setting fdb_max_learned or show
fdb_n_learned, just skip it. Or we will get errors like

./bridge_fdb_learning_limit.sh: line 218: [: null: integer expression expected
./bridge_fdb_learning_limit.sh: line 225: [: null: integer expression expected

Fixes: 6f840903 ("selftests: forwarding: bridge_fdb_learning_limit: Add a new selftest")
Signed-off-by: default avatarHangbin Liu <liuhangbin@gmail.com>
Acked-by: default avatarNikolay Aleksandrov <razor@blackwall.org>
Reviewed-by: default avatarJohannes Nixdorf <jnixdorf-oss@avm.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent fa96c6ba
......@@ -178,6 +178,22 @@ fdb_del()
check_err $? "Failed to remove a FDB entry of type ${type}"
}
check_fdb_n_learned_support()
{
if ! ip link help bridge 2>&1 | grep -q "fdb_max_learned"; then
echo "SKIP: iproute2 too old, missing bridge max learned support"
exit $ksft_skip
fi
ip link add dev br0 type bridge
local learned=$(fdb_get_n_learned)
ip link del dev br0
if [ "$learned" == "null" ]; then
echo "SKIP: kernel too old; bridge fdb_n_learned feature not supported."
exit $ksft_skip
fi
}
check_accounting_one_type()
{
local type=$1 is_counted=$2 overrides_learned=$3
......@@ -274,6 +290,8 @@ check_limit()
done
}
check_fdb_n_learned_support
trap cleanup EXIT
setup_prepare
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment