]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: tools: do not force an unresolved address to AF_INET:0.0.0.0
authorWilly Tarreau <w@1wt.eu>
Fri, 6 Jan 2017 18:23:20 +0000 (19:23 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 11 Jan 2017 11:44:33 +0000 (12:44 +0100)
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

index 468b15bce84426c43e9062008a1fc262866266bd..5dcf9946dc65a21cd809af9521bb39af4c04b6d3 100644 (file)
@@ -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;