This is the mail archive of the libc-alpha@sourceware.cygnus.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: getaddrinfo problem and weird nameserver


>>>>> Jason Gunthorpe writes:

 > Hi all,

 > I use getaddrinfo for hostname resolution in one of my programs, but I
 > just discovered that for some hostnames and some nameservers getaddrinfo
 > is *really* slow.

 > It seems that getaddrinfo sets some sort of IPv6 flag even though my box
 > hasn't got any IPv6 capability and this (I presume) upsets the name server
 > I use. The problem goes away if I switch name servers or use traditional
 > name resolution.

It depends how you call getaddrinfo.  struct addrinfo has a field
ai_family.  If you set this to AF_INET, you will only get IPv4
information.  If you set it to 0, you get both IPv4 and IPv6.

The gethostbyname2 call explicitly requests IPv4 or IPv6.

This behaviour can't be changed since it's the specified behaviour.
You might want to check how getaddrinfo is called in your user
application and fix this.

The getaddrinfo code is in sysdeps/posix/getaddrinfo.c.  If you have a
test program, which is correct and shows an incorrect behaviour of
getaddrinfo, feel free to send it.

Andreas
-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.rhein-neckar.de

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]