]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: checks: don't call connect() on unsupported address families
authorWilly Tarreau <w@1wt.eu>
Mon, 4 Mar 2013 19:07:44 +0000 (20:07 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 8 Mar 2013 13:04:53 +0000 (14:04 +0100)
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.

src/checks.c

index 2ab509d6b0557bba27c6921316e1afd0f25ef0de..f1072cdb75fb37b899e578951e8667c8ca4a5c83 100644 (file)
@@ -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;