mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-25 08:02:56 +00:00
selftests: forwarding: add tests for TC chains creation adn destruction
Add basic sanity tests for TC chains. Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
7f333cbf2b
commit
2d73c8871f
2 changed files with 31 additions and 1 deletions
|
@ -44,6 +44,15 @@ check_tc_shblock_support()
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
check_tc_chain_support()
|
||||||
|
{
|
||||||
|
tc help 2>&1|grep chain &> /dev/null
|
||||||
|
if [[ $? -ne 0 ]]; then
|
||||||
|
echo "SKIP: iproute2 too old; tc is missing chain support"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
if [[ "$(id -u)" -ne 0 ]]; then
|
if [[ "$(id -u)" -ne 0 ]]; then
|
||||||
echo "SKIP: need root privileges"
|
echo "SKIP: need root privileges"
|
||||||
exit 0
|
exit 0
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# SPDX-License-Identifier: GPL-2.0
|
# SPDX-License-Identifier: GPL-2.0
|
||||||
|
|
||||||
ALL_TESTS="unreachable_chain_test gact_goto_chain_test"
|
ALL_TESTS="unreachable_chain_test gact_goto_chain_test create_destroy_chain"
|
||||||
NUM_NETIFS=2
|
NUM_NETIFS=2
|
||||||
source tc_common.sh
|
source tc_common.sh
|
||||||
source lib.sh
|
source lib.sh
|
||||||
|
@ -80,6 +80,25 @@ gact_goto_chain_test()
|
||||||
log_test "gact goto chain ($tcflags)"
|
log_test "gact goto chain ($tcflags)"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
create_destroy_chain()
|
||||||
|
{
|
||||||
|
RET=0
|
||||||
|
|
||||||
|
tc chain add dev $h2 ingress
|
||||||
|
check_err $? "Failed to create default chain"
|
||||||
|
|
||||||
|
tc chain add dev $h2 ingress chain 1
|
||||||
|
check_err $? "Failed to create chain 1"
|
||||||
|
|
||||||
|
tc chain del dev $h2 ingress
|
||||||
|
check_err $? "Failed to destroy default chain"
|
||||||
|
|
||||||
|
tc chain del dev $h2 ingress chain 1
|
||||||
|
check_err $? "Failed to destroy chain 1"
|
||||||
|
|
||||||
|
log_test "create destroy chain"
|
||||||
|
}
|
||||||
|
|
||||||
setup_prepare()
|
setup_prepare()
|
||||||
{
|
{
|
||||||
h1=${NETIFS[p1]}
|
h1=${NETIFS[p1]}
|
||||||
|
@ -103,6 +122,8 @@ cleanup()
|
||||||
vrf_cleanup
|
vrf_cleanup
|
||||||
}
|
}
|
||||||
|
|
||||||
|
check_tc_chain_support
|
||||||
|
|
||||||
trap cleanup EXIT
|
trap cleanup EXIT
|
||||||
|
|
||||||
setup_prepare
|
setup_prepare
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue