]> git.ipfire.org Git - thirdparty/openssl.git/commit
Test randomly selected client port for availabilty in sslrecords test
authorNeil Horman <nhorman@openssl.org>
Tue, 3 Jun 2025 20:02:15 +0000 (16:02 -0400)
committerNeil Horman <nhorman@openssl.org>
Thu, 5 Jun 2025 14:32:44 +0000 (10:32 -0400)
commit89a4ef3849f8481b1e0e81c8cabd5c2ddb01e93f
treec6bbc6ae6e517641ecbbcf5a36d054dbba739a6f
parent56d12310d404b7db2d9f999bd07f38fcd54453d0
Test randomly selected client port for availabilty in sslrecords test

Encountered this error in a pr today:
https://github.com/openssl/openssl/actions/runs/15418713146/job/43387767612

===
Proxy started on port [::1]:56662
Engine "ossltest" set.
Using default temp DH parameters
ACCEPT [::1]:59189
Server responds on [::1]:59189
Engine "ossltest" set.
C0774F02907F0000:error:80000062:system library:BIO_bind:Address already in use:crypto/bio/bio_sock2.c:240:calling bind()
C0774F02907F0000:error:10000075:BIO routines:BIO_bind:unable to bind socket:crypto/bio/bio_sock2.c:242:
connect:errno=98
===

Its occuring because we randomly select a port to use for our client
connection in the sslrecords test.  Thats usually fine, but sometimes,
we get unlucky and pick a port thats already in use.  This presents as
random failures in our CI on this test.

So lets try harden ourselves against it.  When creating the client
connection, test the randomly selected port by trying to bind to it via
a call to IO::Socket::IP->new(). If that fails, try a different port
number, until we get one that works.  If it works, use that port in the
assignment for the clients local port value.

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27752)

(cherry picked from commit f78f824c8e4064148af1186490e9b445871765fd)
util/perl/TLSProxy/Proxy.pm