From: Baptiste Assmann Date: Fri, 4 Dec 2015 05:57:25 +0000 (+0100) Subject: BUG/MINOR: tcpcheck: conf parsing error when no port configured on server and last... X-Git-Tag: v1.7-dev1~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3dd73bea64dcbaa04858cb256c2230dbf3da58e8;p=thirdparty%2Fhaproxy.git BUG/MINOR: tcpcheck: conf parsing error when no port configured on server and last rule is a CONNECT with no port Current configuration parsing is permissive in such situation: A server in a backend with no port conigured on the IP address statement, no 'port' parameter configured and last rule of a tcp-check is a CONNECT with no port. The current code currently parses all the rules to validate a port is well available, but it misses the last one, which means such configuration is valid: backend b option tcp-check tcp-check connect port 8444 tcp-check connect server s 127.0.0.1 check the second connect tentative is sent to port '0'... Current patch fixes this by parsing the list the right way, including the last rule. backport status: 1.6 and above --- diff --git a/src/server.c b/src/server.c index b45a7fd9d7..481697564b 100644 --- a/src/server.c +++ b/src/server.c @@ -1719,7 +1719,7 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr /* scan the tcp-check ruleset to ensure a port has been configured */ l = &newsrv->proxy->tcpcheck_rules; list_for_each_entry(n, l, list) { - r = (struct tcpcheck_rule *)n->list.p; + r = (struct tcpcheck_rule *)n->list.n; if ((r->action == TCPCHK_ACT_CONNECT) && (!r->port)) { Alert("parsing [%s:%d] : server %s has neither service port nor check port, and a tcp_check rule 'connect' with no port information. Check has been disabled.\n", file, linenum, newsrv->id);