Skip to content

Commit

Permalink
BIO_s_connect: Do not set keepalive on dgram sockets
Browse files Browse the repository at this point in the history
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from #24015)

(cherry picked from commit 5673680)
  • Loading branch information
hlandau authored and t8m committed Apr 2, 2024
1 parent c8e4570 commit bf2944a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions crypto/bio/bss_conn.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ static int conn_create_dgram_bio(BIO *b, BIO_CONNECT *c)

static int conn_state(BIO *b, BIO_CONNECT *c)
{
int ret = -1, i;
int ret = -1, i, opts;
BIO_info_cb *cb = NULL;

if (c->info_callback != NULL)
Expand Down Expand Up @@ -188,8 +188,12 @@ static int conn_state(BIO *b, BIO_CONNECT *c)
case BIO_CONN_S_CONNECT:
BIO_clear_retry_flags(b);
ERR_set_mark();
ret = BIO_connect(b->num, BIO_ADDRINFO_address(c->addr_iter),
BIO_SOCK_KEEPALIVE | c->connect_mode);

opts = c->connect_mode;
if (BIO_ADDRINFO_socktype(c->addr_iter) == SOCK_STREAM)
opts |= BIO_SOCK_KEEPALIVE;

ret = BIO_connect(b->num, BIO_ADDRINFO_address(c->addr_iter), opts);
b->retry_reason = 0;
if (ret == 0) {
if (BIO_sock_should_retry(ret)) {
Expand Down

0 comments on commit bf2944a

Please sign in to comment.