From: Alexander Sosedkin Date: Tue, 20 Jan 2026 00:34:05 +0000 (+0100) Subject: tests/scripts/common.sh: avoid IPv6 in check_if_port_* X-Git-Tag: 3.8.12~7^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e7a3ebb249c0c8368dbab3946d2b366ae16041ec;p=thirdparty%2Fgnutls.git tests/scripts/common.sh: avoid IPv6 in check_if_port_* I've encountered a race condition when IPv4 couldn't bind, IPv6 did bind, the check passed because IPv6 could bind, but then tlsfuzzer testsuite used IPv4 and failed. One of the simplest solutions is to filter out IPv6 in the checks. Signed-off-by: Alexander Sosedkin --- diff --git a/tests/scripts/common.sh b/tests/scripts/common.sh index 0f68b02fb9..1b78b8cf10 100644 --- a/tests/scripts/common.sh +++ b/tests/scripts/common.sh @@ -70,7 +70,7 @@ check_if_port_in_use() { local PORT=$1 reserve_port $PORT have_port_finder - if ! $PFCMD -an|grep "[\:\.]$PORT" >/dev/null 2>&1; then + if ! $PFCMD -an|grep -v ::|grep "[\:\.]$PORT" >/dev/null 2>&1; then return 1 fi unreserve_port $PORT @@ -79,7 +79,7 @@ check_if_port_in_use() { check_if_port_listening() { local PORT=$1 have_port_finder - $PFCMD -anl|grep "[\:\.]$PORT"|grep LISTEN >/dev/null 2>&1 + $PFCMD -anl|grep -v ::|grep "[\:\.]$PORT"|grep LISTEN >/dev/null 2>&1 } # Find a port number not currently in use.