From 9698f4b295a5429a5341bfe633a6eb8d386f6182 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Fri, 6 Jan 2017 18:42:57 +0100 Subject: [PATCH] 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. --- src/server.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/server.c b/src/server.c index 68e8b8015..f23b938aa 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;