Hi Dmitry!

On Wed, Sep 30, 2015 at 01:33:56PM +0300, Dmitry Sivachenko wrote:
> 
> > On 29 ????????. 2015 ??., at 23:06, Willy Tarreau <[email protected]> wrote:
> > 
> > On Tue, Sep 29, 2015 at 10:59:15PM +0300, Dmitry Sivachenko wrote:
> >>> I *think* that getaddrinfo() provides this. You can try to build by
> >>> adding USE_GETADDRINFO=1 to your makefile. It's not enabled by default
> >>> because there are numerous bogus implementations on various systems.
> >>> If it works for you it could be the best solution as other programs
> >>> which work are likely using it. I don't know if it's safe to enable
> >>> it by default on FreeBSD.
> >>> 
> >> 
> >> 
> >> I do have this enabled:
> >> 
> >> Build options :
> >>  TARGET  = freebsd
> >>  CPU     = generic
> >>  CC      = cc
> >>  CFLAGS  = -O2 -pipe -O2 -fno-strict-aliasing -pipe -fstack-protector 
> >> -DFREEBSD_PORTS
> >>  OPTIONS = USE_GETADDRINFO=1 USE_ZLIB=1 USE_OPENSSL=1 USE_STATIC_PCRE=1 
> >> USE_PCRE_JIT=1
> > 
> > Then I have no idea how other programs retrieve the information allowing
> > them to respect your system-global choices :-(
> 
> 
> The following patch fixes the problem for me:
> 
> --- standard.c.orig     2015-09-30 13:28:52.688425000 +0300
> +++ standard.c  2015-09-30 13:29:00.826968000 +0300
> @@ -599,7 +599,7 @@ static struct sockaddr_storage *str2ip(c
>                 memset(&hints, 0, sizeof(hints));
>                 hints.ai_family = sa->ss_family ? sa->ss_family : AF_UNSPEC;
>                 hints.ai_socktype = SOCK_DGRAM;
> -               hints.ai_flags = AI_PASSIVE;
> +               hints.ai_flags = 0;
>                 hints.ai_protocol = 0;
>  
>                 if (getaddrinfo(str, NULL, &hints, &result) == 0) {
> 
> 
> 
> FreeBSD manual page for getaddrinfo() is uncertain how to treat AI_PASSIVE 
> when hostname parameter is non-NULL (and this parameter is always non-NULL in 
> standard.c:str2ip()).
> https://www.freebsd.org/cgi/man.cgi?query=getaddrinfo&sektion=3
> 
> On  Linux manual page explicitly states that "If node is not NULL, then the 
> AI_PASSIVE flag is ignored."
> 
> So this change should be harmless for Linux.
> 
> What do you think?

I think that you did a good job and that you're perfectly right. I even
checked on one of my older systems and the text was the same in 2008.

Could you please write a commit message describing the initial issue
and copying your analysis above so that we don't lose the elements.
Please tag it as a bug so that we backport it to 1.5 as well.

Cheers,
Willy


Reply via email to