From: Willy Tarreau Date: Fri, 6 Jan 2017 17:42:57 +0000 (+0100) Subject: MEDIUM: server: disable protocol validations when the server doesn't resolve X-Git-Tag: v1.8-dev1~172 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9698f4b295a5429a5341bfe633a6eb8d386f6182;p=thirdparty%2Fhaproxy.git MEDIUM: server: disable protocol validations when the server doesn't resolve 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. --- diff --git a/src/server.c b/src/server.c index 68e8b80157..f23b938aa3 100644 --- a/src/server.c +++ b/src/server.c @@ -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;