From: Willy Tarreau Date: Mon, 4 Mar 2013 19:07:44 +0000 (+0100) Subject: BUG/MEDIUM: checks: don't call connect() on unsupported address families X-Git-Tag: v1.5-dev18~73 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8f46ccad27c22864d0b8cf0165c3ca40b032265d;p=thirdparty%2Fhaproxy.git BUG/MEDIUM: checks: don't call connect() on unsupported address families At the moment, all address families supported on a "server" statement support a connect() method, but this will soon change with the generalization of str2sa_range(). Checks currently call ->connect() unconditionally so let's add a check for this. --- diff --git a/src/checks.c b/src/checks.c index 2ab509d6b0..f1072cdb75 100644 --- a/src/checks.c +++ b/src/checks.c @@ -1377,8 +1377,10 @@ static struct task *process_chk(struct task *t) * Note that we try to prevent the network stack from sending the ACK during the * connect() when a pure TCP check is used (without PROXY protocol). */ - ret = s->check.proto->connect(conn, s->proxy->options2 & PR_O2_CHK_ANY, - s->check.send_proxy ? 1 : (s->proxy->options2 & PR_O2_CHK_ANY) ? 0 : 2); + ret = SN_ERR_INTERNAL; + if (s->check.proto->connect) + ret = s->check.proto->connect(conn, s->proxy->options2 & PR_O2_CHK_ANY, + s->check.send_proxy ? 1 : (s->proxy->options2 & PR_O2_CHK_ANY) ? 0 : 2); conn->flags |= CO_FL_WAKE_DATA; if (s->check.send_proxy) conn->flags |= CO_FL_LOCAL_SPROXY;