]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: dns: no DNS resolution happens if no ports provided to the nameserver
authorBaptiste Assmann <bedis9@gmail.com>
Wed, 20 Jan 2016 23:59:46 +0000 (00:59 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 21 Jan 2016 06:41:59 +0000 (07:41 +0100)
Erez reported a bug on discourse.haproxy.org about DNS resolution not
occuring when no port is specified on the nameserver directive.

This patch prevent this behavior by returning an error explaining this
issue when parsing the configuration file.
That said, later, we may want to force port 53 when client did not
provide any.

backport: 1.6

src/cfgparse.c

index efbf10dd52ec69ae511fb0d4a1b30ae980d6276d..86558baec488133446974c24980adcc0dbafde4c 100644 (file)
@@ -2317,6 +2317,13 @@ int cfg_parse_resolvers(const char *file, int linenum, char **args, int kwm)
                        goto out;
                }
 
+               if (!port1 && !port2) {
+                       Alert("parsing [%s:%d] : '%s %s' : no UDP port specified\n",
+                               file, linenum, args[0], args[1]);
+                       err_code |= ERR_ALERT | ERR_FATAL;
+                       goto out;
+               }
+
                newnameserver->addr = *sk;
        }
        else if (strcmp(args[0], "hold") == 0) { /* hold periods */