From: Baptiste Assmann Date: Fri, 4 Dec 2015 05:49:31 +0000 (+0100) Subject: BUG/MINOR: tcpcheck: conf parsing error when no port configured on server and first... X-Git-Tag: v1.7-dev1~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=baf9794;p=thirdparty%2Fhaproxy.git BUG/MINOR: tcpcheck: conf parsing error when no port configured on server and first rule(s) is (are) COMMENT A small configuration parsing error exists when no port is setup on the server IP:port statement and the server's parameter 'port' is not set and if the first tcp-check rule is a comment, like in the example below: backend b option tcp-check tcp-check comment blah tcp-check connect 8444 server s 127.0.0.1 check In such case, an ALERT is improperly returned, despite this configuration is valid and works. The new code move the pointer to the first tcp-check rule which isn't a comment before checking the presence of the port. backport status: 1.6 and above --- diff --git a/src/server.c b/src/server.c index 481697564b..a76ca6b043 100644 --- a/src/server.c +++ b/src/server.c @@ -1709,6 +1709,13 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr err_code |= ERR_ALERT | ERR_FATAL; goto out; } + /* search the first action (connect / send / expect) in the list */ + l = &newsrv->proxy->tcpcheck_rules; + list_for_each_entry(n, l, list) { + r = (struct tcpcheck_rule *)n->list.n; + if (r->action != TCPCHK_ACT_COMMENT) + break; + } if ((r->action != TCPCHK_ACT_CONNECT) || !r->port) { Alert("parsing [%s:%d] : server %s has neither service port nor check port nor tcp_check rule 'connect' with port information. Check has been disabled.\n", file, linenum, newsrv->id);