summaryrefslogtreecommitdiffstats
path: root/apps/s_socket.c
diff options
context:
space:
mode:
authorTodd Short <todd.short@me.com>2022-03-08 09:36:43 -0500
committerTodd Short <todd.short@me.com>2022-03-10 09:51:52 -0500
commit3aeed22c593ae036c2503ac07276768c82fe5782 (patch)
tree5a14a94eda231b1485e4948b0b734528f1becfbe /apps/s_socket.c
parentc02fff5aecd4d002143a0e901f3dde3d14934a18 (diff)
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 <tomas@openssl.org> Reviewed-by: Tim Hudson <tjh@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17838) (cherry picked from commit 54b6755702309487ea860e1cc3e60ccef4cf7878)
Diffstat (limited to 'apps/s_socket.c')
-rw-r--r--apps/s_socket.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/apps/s_socket.c b/apps/s_socket.c
index aee366d5f4..a518d56200 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;