]> 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:05:48 +0000 (10:05 -0400)
commitf78f824c8e4064148af1186490e9b445871765fd
tree1503a34e027a27ee247f248288ebb2e276e9e43c
parentfb6ae00713efed59c7c087d428a86dffeedc6d93
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)
util/perl/TLSProxy/Proxy.pm