Commit 9150820c authored by Hangbin Liu's avatar Hangbin Liu Committed by Jakub Kicinski

selftests: bonding: use tc filter to check if LACP was sent

Use tc filter to check if LACP was sent, which is accurate and save
more time.

No need to remove bonding module as some test env may buildin bonding.
And the bond link has been deleted.
Reviewed-by: default avatarPrzemek Kitszel <przemyslaw.kitszel@intel.com>
Signed-off-by: default avatarHangbin Liu <liuhangbin@gmail.com>
Link: https://lore.kernel.org/r/20240205130048.282087-3-liuhangbin@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent c8f4b19d
...@@ -20,21 +20,21 @@ ...@@ -20,21 +20,21 @@
# +------+ +------+ # +------+ +------+
# #
# We use veths instead of physical interfaces # We use veths instead of physical interfaces
REQUIRE_MZ=no
NUM_NETIFS=0
lib_dir=$(dirname "$0")
source "$lib_dir"/../../../net/forwarding/lib.sh
set -e set -e
tmp=$(mktemp -q dump.XXXXXX)
cleanup() { cleanup() {
ip link del fab-br0 >/dev/null 2>&1 || : ip link del fab-br0 >/dev/null 2>&1 || :
ip link del fbond >/dev/null 2>&1 || : ip link del fbond >/dev/null 2>&1 || :
ip link del veth1-bond >/dev/null 2>&1 || : ip link del veth1-bond >/dev/null 2>&1 || :
ip link del veth2-bond >/dev/null 2>&1 || : ip link del veth2-bond >/dev/null 2>&1 || :
modprobe -r bonding >/dev/null 2>&1 || :
rm -f -- ${tmp}
} }
trap cleanup 0 1 2 trap cleanup 0 1 2
cleanup cleanup
sleep 1
# create the bridge # create the bridge
ip link add fab-br0 address 52:54:00:3B:7C:A6 mtu 1500 type bridge \ ip link add fab-br0 address 52:54:00:3B:7C:A6 mtu 1500 type bridge \
...@@ -67,13 +67,12 @@ ip link set fab-br0 up ...@@ -67,13 +67,12 @@ ip link set fab-br0 up
ip link set fbond up ip link set fbond up
ip addr add dev fab-br0 10.0.0.3 ip addr add dev fab-br0 10.0.0.3
tcpdump -n -i veth1-end -e ether proto 0x8809 >${tmp} 2>&1 &
sleep 15
pkill tcpdump >/dev/null 2>&1
rc=0 rc=0
num=$(grep "packets captured" ${tmp} | awk '{print $1}') tc qdisc add dev veth1-end clsact
if test "$num" -gt 0; then tc filter add dev veth1-end ingress protocol 0x8809 pref 1 handle 101 flower skip_hw action pass
echo "PASS, captured ${num}" if slowwait_for_counter 15 2 \
tc_rule_handle_stats_get "dev veth1-end ingress" 101 ".packets" "" &> /dev/null; then
echo "PASS, captured 2"
else else
echo "FAIL" echo "FAIL"
rc=1 rc=1
......
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