[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
(usagi-users 01920) Re: getifaddrs() in glibc, IPv6 detection questions
Hello.
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:
> If not, would it be ok to use the Usagi code in GNet? We're under the
> LGPL, the getifaddrs() code is under the GPL.
Sure.
> 2) We have a function gnet_inetaddr_new(char* name) which maps a FQDN to a
> network address. It uses getaddrinfo() for DNS queries. The problem is a
> FQDN can map to multiple addresses, some IPv4 and some IPv6, even when the
> host cannot make IPv6 connections. Ideally, our function will return IPv6
> addresses only if the host can make IPv6 connections.
Ideally, make the function return multiple addresses.
> 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)
--
Hideaki YOSHIFUJI @ USAGI Project <yoshfuji@xxxxxxxxxxxxxx>
GPG FP: 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA