HAProxy fails to start with "invalid address" when using IPv6 Resolvable Name in the Backend


#1

Hi,

I have an issue with Haproxy failing to start when using an IPv6 resolvable DNS Name:

[root@util-1 ~]# haproxy -f /etc/haproxy/haproxy.cfg -d
[ALERT] 208/190746 (13694) : parsing [/etc/haproxy/haproxy.cfg:98] : 'server backend1' : invalid address: 'backend-1.test.com' in 'backend-1.test.com'

[ALERT] 208/190746 (13694) : Error(s) found in configuration file : /etc/haproxy/haproxy.cfg
[ALERT] 208/190746 (13694) : Fatal errors found in configuration.

The name resolves fine:

[root@util-1 ~]# dig backend-1.test.com AAAA

; <<>> DiG 9.9.4-RedHat-9.9.4-29.el7_2.3 <<>> backend-1.test.com AAAA
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 34045
;; flags: qr aa rd ra ad; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;backend-1.test.com.	IN	AAAA

;; ANSWER SECTION:
backend-1.test.com. 0	IN	AAAA	2001:1234::100

;; Query time: 0 msec
;; SERVER: 2001:1234::1#53(2001:1234::1)
;; WHEN: Wed Jul 27 19:08:50 EDT 2016
;; MSG SIZE  rcvd: 73

There is no issue pinging using the name:

[root@util-1 ~]# ping6 backend-1.test.com
PING backend-1.test.com(backend-1.test.com) 56 data bytes
64 bytes from backend-1.test.com: icmp_seq=1 ttl=64 time=0.208 ms
64 bytes from backend-1.test.com: icmp_seq=2 ttl=64 time=0.225 ms
64 bytes from backend-1.test.com: icmp_seq=3 ttl=64 time=0.218 ms
64 bytes from backend-1.test.com: icmp_seq=4 ttl=64 time=0.318 ms
^C
--- backend-1.test.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3000ms
rtt min/avg/max/mdev = 0.208/0.242/0.318/0.045 ms

I’m currently using version 1.5.2:

[root@util-1 ~]# haproxy -v
HA-Proxy version 1.5.2 2014/07/12
Copyright 2000-2014 Willy Tarreau <w@1wt.eu>

I have also tried this using haproxy version 1.6.7 with the same result.

[root@util-1 ~]# ./haproxy -f /etc/haproxy/haproxy.cfg
[ALERT] 208/192951 (13972) : parsing [/etc/haproxy/haproxy.cfg:98] : 'server backend1' : invalid address: 'backend-1.test.com' in 'backend-1.test.com'

[ALERT] 208/192951 (13972) : Error(s) found in configuration file : /etc/haproxy/haproxy.cfg
[WARNING] 208/192951 (13972) : Setting tune.ssl.default-dh-param to 1024 by default, if your workload permits it you should set it to at least 2048. Please set a value >= 1024 to make this warning disappear.
[ALERT] 208/192951 (13972) : Fatal errors found in configuration.
[root@util-1 ~]# ./haproxy -v
HA-Proxy version 1.6.7 2016/07/13
Copyright 2000-2016 Willy Tarreau <willy@haproxy.org>

I have noticed other systems have the same issue with IPv6 names and had to change the underlying library to a method that supports both ipv6 and ipv4. Not sure if this is a similar issue here.

BTW, when I use the IPv6 Address, everything works fine.


#2

You have to compile with USE_GETADDRINFO=1. Also see README.