]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: server: disable protocol validations when the server doesn't resolve
authorWilly Tarreau <w@1wt.eu>
Fri, 6 Jan 2017 17:42:57 +0000 (18:42 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 6 Jan 2017 18:29:34 +0000 (19:29 +0100)
When a server doesn't resolve we don't know the address family so we
can't perform the basic protocol validations. However we know that we'll
ultimately resolve to AF_INET4 or AF_INET6 so the controls are OK. It is
important to proceed like this otherwise it will not be possible to start
with unresolved addresses.

src/server.c

index 68e8b801575dd222a67c1d9cf1aa47ecfa741b7f..f23b938aa3a40403de6db99fa4392e150bfdc742 100644 (file)
@@ -1013,7 +1013,7 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
                        }
 
                        proto = protocol_by_family(sk->ss_family);
-                       if (!proto || !proto->connect) {
+                       if (!fqdn && (!proto || !proto->connect)) {
                                Alert("parsing [%s:%d] : '%s %s' : connect() not supported for this address family.\n",
                                      file, linenum, args[0], args[1]);
                                err_code |= ERR_ALERT | ERR_FATAL;
@@ -1065,7 +1065,7 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
                        newsrv->svc_port = port;
                        newsrv->xprt  = newsrv->check.xprt = newsrv->agent.xprt = xprt_get(XPRT_RAW);
 
-                       if (!protocol_by_family(newsrv->addr.ss_family)) {
+                       if (!newsrv->hostname && !protocol_by_family(newsrv->addr.ss_family)) {
                                Alert("parsing [%s:%d] : Unknown protocol family %d '%s'\n",
                                      file, linenum, newsrv->addr.ss_family, args[2]);
                                err_code |= ERR_ALERT | ERR_FATAL;