[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: (ITS#5251) getaddrinfo might return duplicate results

On Donnerstag, 29. November 2007, hyc@symas.com wrote:
> rhafer@suse.de wrote:
> > Full_Name: Ralf Haferkamp
> > Version: All
> > OS: Linux, glibc 2.7
> > URL: ftp://ftp.openldap.org/incoming/
> > Submission from: (NULL) (
> >
> >
> > Newer versions of glibc (2.7) in my case might return duplicate addrinfo
> > structs in the results under certain circumstances. According to the
> > friendly glibc maintainer ;) this is not a bug:
> > http://sources.redhat.com/bugzilla/show_bug.cgi?id=4980
> > Unfortunately he doesn't give a reason for this change in behavior.
> Interesting. In that bug report the /etc/hosts file has once and
> ::1 once, so why is being returned twice? That is clearly bogus.
The glibc code explicitly checks the /etc/hosts entry for IN6_IS_ADDR_LOOPBACK 
and returns the the in_attr_t for INADDR_LOOPBACK in that case. For reasons 
that the glibc author seemingly doesn't want to share with the outer world.

> > BTW, I didn't find any reference in the related RFCs that state that the
> > getaddrinfo results need to be unique (nor the opposite).
> > In my current builds I simply patched slapd to check the getaddrinfo()
> > results for uniqueness in the slap_get_listner_addresses() function. Has
> > anybody a better idea how to fix this?
> I'm sure there's nothing that states that the returned info is required to
> be unique. The returned data must accurately reflect the host databases
> being queried though. If you put " localhost" twice in /etc/hosts,
> then it's reasonable to get it returned twice. But if it's only in there
> once, then returning it twice is a bug.