Merge branch 'selftests-net-more-pmtu-sh-fixes'

Paolo Abeni says:

====================
selftests: net: more pmtu.sh fixes

The mentioned test is still flaky, unusally enough in 'fast'
environments.

Patch 2/2 [try to] address the existing issues, while patch 1/2
introduces more strict tests for the existing net helpers, to hopefully
prevent future pain.
====================

Link: https://lore.kernel.org/r/cover.1707731086.git.pabeni@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Jakub Kicinski 2024-02-13 10:19:07 -08:00
commit 1e41f11f08
2 changed files with 9 additions and 6 deletions

View File

@ -8,13 +8,16 @@ wait_local_port_listen()
local listener_ns="${1}"
local port="${2}"
local protocol="${3}"
local port_hex
local pattern
local i
port_hex="$(printf "%04X" "${port}")"
pattern=":$(printf "%04X" "${port}") "
# for tcp protocol additionally check the socket state
[ ${protocol} = "tcp" ] && pattern="${pattern}0A"
for i in $(seq 10); do
if ip netns exec "${listener_ns}" cat /proc/net/"${protocol}"* | \
grep -q "${port_hex}"; then
if ip netns exec "${listener_ns}" awk '{print $2" "$4}' \
/proc/net/"${protocol}"* | grep -q "${pattern}"; then
break
fi
sleep 0.1

View File

@ -1336,16 +1336,16 @@ test_pmtu_ipvX_over_bridged_vxlanY_or_geneveY_exception() {
else
TCPDST="TCP:[${dst}]:50000"
fi
${ns_b} socat -T 3 -u -6 TCP-LISTEN:50000 STDOUT > $tmpoutfile &
${ns_b} socat -T 3 -u -6 TCP-LISTEN:50000,reuseaddr STDOUT > $tmpoutfile &
local socat_pid=$!
wait_local_port_listen ${NS_B} 50000 tcp
dd if=/dev/zero status=none bs=1M count=1 | ${target} socat -T 3 -u STDIN $TCPDST,connect-timeout=3
wait ${socat_pid}
size=$(du -sb $tmpoutfile)
size=${size%%/tmp/*}
wait ${socat_pid}
[ $size -ne 1048576 ] && err "File size $size mismatches exepcted value in locally bridged vxlan test" && return 1
done