From: Matthew Hodgson Date: Wed, 21 Nov 2018 02:00:52 +0000 (+0000) Subject: openssl s_server: don't use sendto() with connected UDP socket X-Git-Tag: openssl-3.0.0-alpha1~2880 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=b92678f4e94eeec468f194333f874906a6fff7f1;p=oweals%2Fopenssl.git openssl s_server: don't use sendto() with connected UDP socket Fixes #7675 On macOS, if you call `connect()` on a UDP socket you cannot then call `sendto()` with a destination, otherwise it fails with Err#56 ('socket is already connected'). By calling `BIO_ctrl_set_connected()` on the wbio we can tell it that the socket has been connected and make it call `send()` rather than `sendto()`. Reviewed-by: Matt Caswell Reviewed-by: Matthias St. Pierre (Merged from https://github.com/openssl/openssl/pull/7676) --- diff --git a/apps/s_server.c b/apps/s_server.c index ac7dca607b..15b4b430da 100644 --- a/apps/s_server.c +++ b/apps/s_server.c @@ -2754,6 +2754,8 @@ static int init_ssl_connection(SSL *con) BIO_ADDR_free(client); return 0; } + + (void)BIO_ctrl_set_connected(wbio, client); BIO_ADDR_free(client); dtlslisten = 0; } else {