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.
This commit is contained in:
Willy Tarreau 2017-01-06 18:42:57 +01:00
parent 6ecb10aec7
commit 9698f4b295

View 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;