NetBSD-Users archive

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

Re: lib/42405: libc: getaddrinfo() should perform T_A lookups before T_AAAA lookups, was: Resolver problems



woods%planix.com@localhost ("Greg A. Woods") writes:

>> - sysctl is out of the question. It controls kernel behaviour and
>>   the kernel shouldn't be a storage for configuration data.

>I don't believe that -- in fact I think it's flat-out-wrong for at least
>two cases now and for as long as sysctl has existed.

That doesn't make it a good thing. I could argue that the hostname
might be useful to the kernel, but the NIS domainname isn't.


>But in any case the key trigger here is the question of whether the
>kernel is, or is not, supporting IPv6 so it makes sense for libc to use
>a sysctl to learn this fact from the kernel and thus behave sanely in
>either the presence or absence of kernel support for IPv6.

Sanely? You could disable INET6 handling code if the kernel
doesn't support INET6, but even this is nonsense as the kernel
is pretty capable of returning the proper error codes back
to userland.


Controlling the name resolution however has nothing to do with
the kernels capabilities of handling IPv6 traffic. The name
resolution can be used and is used for other things than
binding sockets and the kernel is perfectly capable of telling
the application that one or the other address family is not
usuable for a network connection.

After all, we are talking about a workaround for systems with
a broken environment and not about a gimmick for IPv6 haters.
Do we?


>> Solaris has an AI_ADDRCONFIG flag to getaddrinfo() that filters
>> according to the current configuration of the machine. If it has
>> IPv6 configuration, then IPv6 addresses are queried. If it has
>> IPv4 configuration, then IPv4 addresses are queried. My guess
>> is that the system utilities all specify this flag.

>OK, so how the heck does libc determine the current configuration of the
>machine for the purpose of this feature?  Perhaps it has to use a
>sysctl?  :-)

It probably queries the protocol devices in Solaris.

>Also that kind of features doesn't seem to be very API/ABI friendly.

It isn't.

>> This would help with the broken DNS server only when you also
>> create a kernel without IPv6 (so far we cannot disable IPv6
>> link local addresses).

>and in the case our kernel gains dynamic protocol control sysctls....

It would still be the wrong thing.


>> So I propose /etc/addrinfo.conf with an associated environment
>> variable ADDRINFO_CONF.

>I think that's the second worst idea possible.  Well, maybe not actually
>worse than the symlink idea -- but equally bad.  This is gratuitous
>replication of information

It is a completely different information. Being able to handle
IPv6 communication and resolving hostnames to IPv6 addresses are
orthogonal issues. And for people with a non-broken environment
that isn't even half of a problem.

>in yet another newly invented configuration
>mechanism (and one that at least for now appears to be single-purpose).

It isn't newly invented. It is used by malloc().


-- 
-- 
                                Michael van Elst
Internet: mlelstv%serpens.de@localhost
                                "A potential Snark may lurk in every tree."


Home | Main Index | Thread Index | Old Index