Two copies of resolver routines in libc ?
Hajimu UMEMOTO
ume at freebsd.org
Sat Nov 8 00:40:01 PST 2008
Hi,
>>>>> On Thu, 6 Nov 2008 20:21:03 +0100
>>>>> Luigi Rizzo <rizzo at iet.unipi.it> said:
rizzo> While looking for a workaround (attached, read later), i noticed
rizzo> that libc has two versions of the resolver routines: one is in
rizzo> /usr/src/lib/libc/resolv/res_query.c
rizzo> the other one is embedded into
rizzo> /usr/src/lib/libc/net/getaddrinfo.c
rizzo> which includes a slightly modified version of res_nquery, res_ndots,
rizzo> res_nquerydomain (all parts of the routines documented in resolver(3)).
Yes.
rizzo> If we are lucky, this is just replicated code.
No, the resolver functions in getaddrinfo.c has some addition of
functionality. It was done for solving the query order problem.
rizzo> But i am not even sure they are the same, e.g. in the handling of
rizzo> options (in resolv.conf or the environment variable RES_OPTIONS).
The basic functionality including the handling of options are same.
rizzo> This is really annoying, because generally you don't know if an
rizzo> application uses getaddrinfo() or the traditional gethost*() routines
rizzo> (which in turn use resolver(3)), so it is hard to tell whether
rizzo> applications have a consistent behaviour.
You don't need to worry about it.
rizzo> If someone has time, it would be worthwhile trying to merge
rizzo> the two versions of the code into one (and i believe we should
rizzo> make getaddrinfo use the standard stuff in resolv/
When we tried to solve the query order problem, we decided to have a
modification code of the resolver into getaddrinfo.c. Because:
- Hide the internal functions from outside of libc.
- Don't change the resolver as possible to ease further merge from
ISC BIND.
Since we have the symbol versioning facility, we can hide the libc
internal functions from outside of libc, these days. So, it may
better to merge the two. I attached the proposed patch in this mail.
Please review it.
Sincerely,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: resolver-multi.diff
Type: text/x-patch
Size: 19773 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-net/attachments/20081108/e78dc2a4/resolver-multi.bin
-------------- next part --------------
--
Hajimu UMEMOTO @ Internet Mutual Aid Society Yokohama, Japan
ume at mahoroba.org ume@{,jp.}FreeBSD.org
http://www.imasy.org/~ume/
More information about the freebsd-net
mailing list