[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

(usagi-users 02064) Re: getifaddrs() in glibc, IPv6 detection questions



Pekka Savola [mailto:pekkas@xxxxxxxxxx] wrote:
> 
> On Mon, 6 Jan 2003, Jeroen Massar wrote:
> > > > AI_ADDRCONFIG flag will help you when available.
> > > > Otherwise, yes, scan addresses; or, try to socket(2).
> > > > (In latter case, kernel may try to insmod ipv6.o)
> > > 
> > > Then is it possible that an IPv6 interface would not be 
> included by
> > > getifaddrs() because the ipv6.o module hasn't been loaded?
> > > 
> > > I'm wondering then if it's a more reliable IPv6 test to 
> > > attempt to bind to
> > > 0::0 or to call socket(AF_INET6).
> > 
> > Even then it doesn't say a thing wether the target is reachable
> > or if it is even possible to get out of the local subnet.
> > 
> > Just use getaddrinfo() that should take care of all your tests.
> > If getaddrinfo() returns you AF_INET6 then there should also
> > be support for IPv6 in the kernel.
> 
> Uhh, there are many ways to "use getaddrinfo()".  Some of 
> them return you 
> AF_INET6 addresses even though kernel does not have IPv6 
> enabled; that's perfectly acceptable to me.

If one specifies AI_PASSIVE it should only return addresses that
are bind()'able on the local machine, thus if the box doesn't
support IPv6 it should not return IPv6 addresses.
Though I am not quite sure if every implementation has this behaviour.

Greets,
 Jeroen