From: Todd Short Date: Tue, 8 Mar 2022 14:36:43 +0000 (-0500) Subject: Set protocol in init_client() X-Git-Tag: OpenSSL_1_1_1n~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3aeed22c593ae036c2503ac07276768c82fe5782;p=thirdparty%2Fopenssl.git Set protocol in init_client() If TCP is being used, protocol = 0 is passed to init_client(), then protocol == IPPROTO_TCP fails when attempting to set BIO_SOCK_NODELAY. Reviewed-by: Tomas Mraz Reviewed-by: Tim Hudson (Merged from https://github.com/openssl/openssl/pull/17838) (cherry picked from commit 54b6755702309487ea860e1cc3e60ccef4cf7878) --- diff --git a/apps/s_socket.c b/apps/s_socket.c index aee366d5f45..a518d56200e 100644 --- a/apps/s_socket.c +++ b/apps/s_socket.c @@ -147,7 +147,7 @@ int init_client(int *sock, const char *host, const char *port, #endif if (!BIO_connect(*sock, BIO_ADDRINFO_address(ai), - protocol == IPPROTO_TCP ? BIO_SOCK_NODELAY : 0)) { + BIO_ADDRINFO_protocol(ai) == IPPROTO_TCP ? BIO_SOCK_NODELAY : 0)) { BIO_closesocket(*sock); *sock = INVALID_SOCKET; continue;