openssl s_server: don't use sendto() with connected UDP socket
authorMatthew Hodgson <matthew@matrix.org>
Wed, 21 Nov 2018 02:00:52 +0000 (02:00 +0000)
committerDr. Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Wed, 21 Nov 2018 20:06:03 +0000 (21:06 +0100)
commit49fabf6b4d3b53f0f1871be10c5b28e15e7d33d3
treeb62819ab831a8a24545734e927ff8080e4f610a3
parent3ccccb91ae1c07a4310778b3d7ba74ff4ff787f0
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 <matt@openssl.org>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/7676)

(cherry picked from commit b92678f4e94eeec468f194333f874906a6fff7f1)
apps/s_server.c