From d12e19ed35761dc6ae45b8a71b2874f5bb8ef2cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Fri, 30 Oct 2026 11:53:44 +0100 Subject: [PATCH] test.py: Keep the ad hoc tests' ports below Linux's ephemeral ports With offsets of up to 30000, a port net/adhoc/limits listened on could be one an outgoing connection was using, and the listen failed. Co-Authored-By: Claude Opus 5.5 --- test.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test.py b/test.py index 47abe0a2ca..43ee6abe71 100755 --- a/test.py +++ b/test.py @@ -757,8 +757,9 @@ def flags_for(test): return test_flags[test] if test.startswith("net/adhoc/"): # A new port offset each run: a connection the last run made with the same ports is still in TCP - # TIME_WAIT for a while, and connecting again fails. - return ADHOC_FLAGS + ["--port-offset=%d" % random.randrange(10000, 30000)] + # TIME_WAIT for a while, and connecting again fails. The tests' ports go up to 31000 (game mode's), and + # have to stay below Linux's ephemeral ports (32768 and up), which outgoing connections hold. + return ADHOC_FLAGS + ["--port-offset=%d" % random.randrange(1, 1700)] return None def is_pair_test(test):