Re: use ipv6 for name resolution

2014-04-14 Thread Nenad Merdanovic
Hello, Let me see if we are on the same page: - remove the USE flag USE_GETADDRINFO and use gai() by default No, we cannot remove them as some supported systems don't provide gai(). However we can put it by default in the implicit options for the systems which are known for supporting it

Re: use ipv6 for name resolution

2014-04-14 Thread Willy Tarreau
Hi Nenad, On Mon, Apr 14, 2014 at 12:39:23PM +0200, Nenad Merdanovic wrote: I have attached another patch for review. I have removed some ifdef/else/endif code and it looks to be more readable for me this way (and in line how it was before this change). If you still prefer to have an ifdef

Re: use ipv6 for name resolution

2014-04-14 Thread Willy Tarreau
Hi Lukas, On Mon, Apr 14, 2014 at 02:22:33PM +0200, Lukas Tribus wrote: Hi, Hi Nenad, On Mon, Apr 14, 2014 at 12:39:23PM +0200, Nenad Merdanovic wrote: I have attached another patch for review. I have removed some ifdef/else/endif code and it looks to be more readable for me this

Re: use ipv6 for name resolution

2014-04-14 Thread Nenad Merdanovic
Hello, On 04/14/2014 02:32 PM, Willy Tarreau wrote: Hi Lukas, On Mon, Apr 14, 2014 at 02:22:33PM +0200, Lukas Tribus wrote: Hi, Hi Nenad, On Mon, Apr 14, 2014 at 12:39:23PM +0200, Nenad Merdanovic wrote: I have attached another patch for review. I have removed some ifdef/else/endif

RE: use ipv6 for name resolution

2014-04-14 Thread Lukas Tribus
Hi, Fails for me when compiling with USE_GETADDRINFO: src/standard.c: In function ?str2ip?: src/standard.c:554:6: error: ?global? undeclared (first use in this function) src/standard.c:554:6: note: each undeclared identifier is reported only once for each function it appears in

Re: use ipv6 for name resolution

2014-04-14 Thread Willy Tarreau
On Mon, Apr 14, 2014 at 02:46:09PM +0200, Nenad Merdanovic wrote: Something along the lines for commit message should be OK: BUG/MINOR: Fix name lookup ordering when compiled with USE_GETADDRINFO When compiled with USE_GETADDRINFO, make sure we use getaddrinfo(3) to perform name lookups.

RE: use ipv6 for name resolution

2014-04-12 Thread Lukas Tribus
Hi, These are happening at startup only and are a direct consequence of using getaddrinfo(). Ah indeed I didn't notice the destination port is zero, so they're just used to check whether the protocols are supported or not! Thanks for enlighting me on this! So this is not a problem in

Re: use ipv6 for name resolution

2014-04-12 Thread Willy Tarreau
Hi Lukas, On Sat, Apr 12, 2014 at 01:00:02PM +0200, Lukas Tribus wrote: Hi, These are happening at startup only and are a direct consequence of using getaddrinfo(). Ah indeed I didn't notice the destination port is zero, so they're just used to check whether the protocols are

Re: use ipv6 for name resolution

2014-04-11 Thread Martijn Otto
This is because haproxy does not support IPv6 for backends. It makes no sense to query those addresses only to not use them afterwards. On Fri, 2014-04-11 at 11:15 +0200, Manuel Bauer wrote: sorry for what is probably a pretty noob question, but could anyone tell me why haproxy resolves the

Re: use ipv6 for name resolution

2014-04-11 Thread Nenad Merdanovic
Hello, On 04/11/2014 11:15 AM, Manuel Bauer wrote: sorry for what is probably a pretty noob question, but could anyone tell me why haproxy resolves the hostnames in my config to ipv4 addresses, and not ipv6? If I run a tcpdump on port 53 during a haproxy restart I can see that only the A

Re: use ipv6 for name resolution

2014-04-11 Thread Manuel Bauer
Good idea, but that seems to work only with ip addresses, and not hostnames. If I try it haproxy complains about an error in its config and refuses to start. On Fri, 11 Apr 2014 12:04:40 +0200, Nenad Merdanovic ni...@nimzo.info wrote: Hello, On 04/11/2014 11:15 AM, Manuel Bauer wrote:

Re: use ipv6 for name resolution

2014-04-11 Thread Nenad Merdanovic
Hello, On 04/11/2014 12:23 PM, Manuel Bauer wrote: Good idea, but that seems to work only with ip addresses, and not hostnames. If I try it haproxy complains about an error in its config and refuses to start. On Fri, 11 Apr 2014 12:04:40 +0200, Nenad Merdanovic ni...@nimzo.info wrote:

Re: use ipv6 for name resolution

2014-04-11 Thread Willy Tarreau
Hi Nenad, On Fri, Apr 11, 2014 at 02:09:09PM +0200, Nenad Merdanovic wrote: Why are we using gethostbyname() first if USE_GETADDRINFO is enabled? Probably only because that's what we used to do for over a decade in fact. Getaddrinfo() used to work very badly on a large number of platforms,

RE: use ipv6 for name resolution

2014-04-11 Thread Lukas Tribus
Hi, On Fri, Apr 11, 2014 at 02:09:09PM +0200, Nenad Merdanovic wrote: Why are we using gethostbyname() first if USE_GETADDRINFO is enabled? Probably only because that's what we used to do for over a decade in fact. Getaddrinfo() used to work very badly on a large number of platforms,

Re: use ipv6 for name resolution

2014-04-11 Thread Willy Tarreau
Hi Lukas, On Fri, Apr 11, 2014 at 02:43:47PM +0200, Lukas Tribus wrote: Hi, On Fri, Apr 11, 2014 at 02:09:09PM +0200, Nenad Merdanovic wrote: Why are we using gethostbyname() first if USE_GETADDRINFO is enabled? Probably only because that's what we used to do for over a decade in

RE: use ipv6 for name resolution

2014-04-11 Thread Martijn Otto
FYI, with getaddrinfo() - with Nenad's patch - against a dual-stacked host and without IPv6 connectivity leads to additional syscalls in this case: connect(4, {sa_family=AF_INET6, sin6_port=htons(0), inet_pton(AF_INET6, 2a03:2880:f010:900:face:b00c:0:1, sin6_addr), sin6_flowinfo=0,

Re: use ipv6 for name resolution

2014-04-11 Thread Willy Tarreau
On Fri, Apr 11, 2014 at 02:55:20PM +0200, Martijn Otto wrote: FYI, with getaddrinfo() - with Nenad's patch - against a dual-stacked host and without IPv6 connectivity leads to additional syscalls in this case: connect(4, {sa_family=AF_INET6, sin6_port=htons(0), inet_pton(AF_INET6,

Re: use ipv6 for name resolution

2014-04-11 Thread Nenad Merdanovic
Hello, On 04/11/2014 02:59 PM, Willy Tarreau wrote: On Fri, Apr 11, 2014 at 02:55:20PM +0200, Martijn Otto wrote: FYI, with getaddrinfo() - with Nenad's patch - against a dual-stacked host and without IPv6 connectivity leads to additional syscalls in this case: connect(4,

Re: use ipv6 for name resolution

2014-04-11 Thread Willy Tarreau
Hi Nenad, On Fri, Apr 11, 2014 at 05:24:02PM +0200, Nenad Merdanovic wrote: connect(4, {sa_family=AF_INET6, sin6_port=htons(0), inet_pton(AF_INET6, 2a03:2880:f010:900:face:b00c:0:1, sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, 28) = -1 ENETUNREACH (Network is unreachable) connect(4,