[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
(usagi-users 02055) Re: getifaddrs() in glibc, IPv6 detection questions
- To: <usagi-users@xxxxxxxxxxxxxx>
- Subject: (usagi-users 02055) Re: getifaddrs() in glibc, IPv6 detection questions
- From: "Jeroen Massar" <jeroen@xxxxxxxxx>
- Date: Mon, 6 Jan 2003 23:25:02 +0100
- Importance: Normal
- In-reply-to: <Pine.LNX.4.40.0301061622150.21981-100000@speak.eecs.umich.edu>
- Organization: Unfix
- Reply-to: usagi-users@xxxxxxxxxxxxxx
David Helder [mailto:dhelder@xxxxxxxxx] wrote:
> On Fri, 1 Nov 2002, YOSHIFUJI Hideaki / [iso-2022-jp]
> 吉藤英明 wrote:
> > In article
> <Pine.LNX.4.40.0210311612020.7725-100000@xxxxxxxxxxxxxxxxxxxx>
> (at Thu, 31 Oct 2002 16:25:09 -0500 (EST)), David Helder
> <dhelder@xxxxxxxxx> says:
> > > [Detecting IPv6]
> > > The best solution I've come up with is to get the list of
> interfaces,
> > > check if there's an interface that supports IPv6, and
> only return an IPv6
> > > address if there is an IPv6 supporting interface. Is
> this sensible or is
> > > there a better solution?
> >
> > 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.
Greets,
Jeroen