From: Willy Tarreau Date: Tue, 3 Sep 2013 07:02:11 +0000 (+0200) Subject: BUG/MEDIUM: fix broken send_proxy on FreeBSD X-Git-Tag: v1.5-dev20~286 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=95742a43aaddf8a262339833688b75b5907f95c6;p=thirdparty%2Fhaproxy.git BUG/MEDIUM: fix broken send_proxy on FreeBSD David Berard reported that send-proxy was broken on FreeBSD and tracked the issue to be an error returned by send(). We already had the same issue in the past in another area which was addressed by the following commit : 0ea0cf6 BUG: raw_sock: also consider ENOTCONN in addition to EAGAIN In fact, on Linux send() returns EAGAIN when the connection is not yet established while other OSes return ENOTCONN. Let's consider ENOTCONN for send-proxy there as the same as EAGAIN. David confirmed that this change properly fixed the issue. Another place was affected as well (health checks with send-proxy), and was fixed. This fix does not need any backport since it only affects 1.5. --- diff --git a/src/connection.c b/src/connection.c index f86afde816..ad523b9606 100644 --- a/src/connection.c +++ b/src/connection.c @@ -573,7 +573,7 @@ int conn_local_send_proxy(struct connection *conn, unsigned int flag) goto out_wait; if (ret < 0) { - if (errno == EAGAIN) + if (errno == EAGAIN || errno == ENOTCONN) goto out_wait; goto out_error; } diff --git a/src/stream_interface.c b/src/stream_interface.c index 33f1d0efc0..6a21c641f3 100644 --- a/src/stream_interface.c +++ b/src/stream_interface.c @@ -468,7 +468,7 @@ int conn_si_send_proxy(struct connection *conn, unsigned int flag) goto out_wait; if (ret < 0) { - if (errno == EAGAIN) + if (errno == EAGAIN || errno == ENOTCONN) goto out_wait; goto out_error; }