From 7b760c9c80f9f1be426d011f8228eb58343dc420 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Fri, 6 Jan 2017 19:23:20 +0100 Subject: [PATCH] BUG/MEDIUM: tools: do not force an unresolved address to AF_INET:0.0.0.0 This prevents DNS from resolving IPv6-only servers in 1.7. Note, this patch depends on the previous series : 1. BUG/MINOR: tools: fix off-by-one in port size check 2. BUG/MEDIUM: server: consider AF_UNSPEC as a valid address family 3. MEDIUM: server: split the address and the port into two different fields 4. MINOR: tools: make str2sa_range() return the port in a separate argument 5. MINOR: server: take the destination port from the port field, not the addr 6. MEDIUM: server: disable protocol validations when the server doesn't resolve This fix (hence the whole series) must be backported to 1.7. --- src/standard.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/standard.c b/src/standard.c index 468b15bce..5dcf9946d 100644 --- a/src/standard.c +++ b/src/standard.c @@ -958,14 +958,7 @@ struct sockaddr_storage *str2sa_range(const char *str, int *port, int *low, int * set or if resolve is set, otherwise it's an error. */ if (str2ip2(str2, &ss, 0) == NULL) { - if (!resolve && fqdn) { - /* we'll still want to store the port, so let's - * force it to IPv4 for now. - */ - memset(&ss, 0, sizeof(ss)); - ss.ss_family = AF_INET; - } - else if ((!resolve && !fqdn) || + if ((!resolve && !fqdn) || (resolve && str2ip2(str2, &ss, 1) == NULL)) { memprintf(err, "invalid address: '%s' in '%s'\n", str2, str); goto out;