getaddrinfo()-related replication problem on FreeBSD

Andrew Bartlett abartlet at
Wed Oct 3 19:35:31 MDT 2012

On Tue, 2012-06-05 at 10:29 +0300, Andriy Syrovenko wrote:
> 2012/6/5 Ira Cooper <ira at>:
> > On Mon, Jun 4, 2012 at 8:07 PM, Andrew Bartlett <abartlet at> wrote:
> >> On Tue, 2012-06-05 at 02:12 +0300, Andriy Syrovenko wrote:
> >>> Andrew,
> >>>
> >>> > A patch to the wscript to detect platforms with this breakage (I'm
> >>> > surprised it hasn't been noticed elsewhere before!) and then a patch to
> >>> > force the flag on seems most sensible at this point.
> >>>
> >>> The getaddrinfo() function on FreeBSD fails this way (i.e. returns
> >>> EAI_FAIL) only when the following conditions are met:
> >>>
> >>> * The host name in question contains underscore.
> >>> * The host name in question exists. If the name does not exists the
> >>> function returns EAI_NONAME.
> >>> * The host name in question is in the DNS. If it is placed in
> >>> /etc/hosts the function succeeds.
> >>>
> >>> This makes basing detection of this kind of breakage on the analysis
> >>> of the function's behavior particularly difficult. I don't see any
> >>> other way to detect this kind of breakage except by checking for a
> >>> particular OS name (and possibly version as well). Is this approach
> >>> acceptable?
> >>
> >> It seems a very deliberate policy decision then.  I guess we may just
> >> have to blacklist FreeBSD on this point then.
> >>
> >> The problem is that by not testing it (I can't see how we can, without
> >> doing DNS lookups in configure, which would suck) we will never know how
> >> far the rot spreads (what about the other BSDs?).
> >
> > Have you tried pinging the FreeBSD folks?  I can't believe they'd
> > randomly break this.  If they did it intentionally, it'd be good to
> > know why, in case we start seeing it elsewhere.
> I haven't. I have tracked the issue in gdb and then looked into their
> SVN repo though. The code that calls the host name checker from the
> getaddrinfo() was added almost 12 years ago, and seems to be a part of
> some IPv6-related work. The host name checker itself was imported from
> the BIND.
> The FreeBSD folks did make the rule checking less strict by allowing
> the underscores in host names in Feb 2008
> ( but
> that change only allowed underscores in the middle of the name
> component, i.e. '' is allowed, but '' and
> '' are not. It looks strange and I concede it might have been
> done unintentionally.

I'm just wondering where we want to go from here?

I do want to fix this 'right', but I'm not sure what right really is.
Is this only FreeBSD, or does it hit other BSDs?  Can we detect this at
configure time in any way?

Otherwise, if we can at least confirm this patch works, and perhaps if
you would like to return it with a tested #ifdef FreeBSD wrapper I could
include it.

Andrew Bartlett

Andrew Bartlett                      
Authentication Developer, Samba Team 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch
Type: text/x-patch
Size: 493 bytes
Desc: not available
URL: <>

More information about the samba-technical mailing list