Fwd: default resolver(5) configuration and behavior of functions like gethostbyname(3)

Rostislav Krasny rosti_bsd at yahoo.com
Fri Oct 15 17:39:26 PDT 2004


--- Ryan Sommers <ryans at gamersimpact.com> wrote:
> 
> Rostislav Krasny said:
> >> Please explain why developers of FreeBSD had chose 4 instead of 2?
> >> Maybe they should change it to 2, as this default value is defined on
> >> most of other systems, including NetBSD?
> 
> Don't know why 4 was chosen instead of 2, haven't had a chance to look at
> the commit logs. We might have ported over the code from OpenBSD and just
> didn't change their value.

Yes it looks so at first sight because both FreeBSD (before the foregoing
commits of Yar Tikhiy) and OpenBSD have this value hardcoded by no macro
definition in the lib/libc/net/res_init.c.

After further looking through CVSWEB of these three *BSD OSes I've found
following:

OpenBSD have this value there since revision 1.11 where BIND 4.9.5 resolver
and associated routines were integrated in 1997. FreeBSD have this value
there since revision 1.2 where "get* rework and new bind code" was done in
1994. Maybe this value had come from BIND4?

NetBSD had that source file too with the same value hardcoded in it till
the file (and some others) was removed in May 21 02:30:04 2004 UTC after
bind9 resolver merge had been finished. Look at
http://cvsweb.netbsd.org/cgi-bin/cvsweb.cgi/src/lib/libc/net/Attic/res_init.c

The RES_DFLRETRY macro defined in the include/resolv.h of NetBSD since
revisions 1.1.1.4 and 1.23 those were made in May 21 2004, during BIND9
merge. The RES_DFLRETRY macro defined as 2 already in those revisions.

BIND9 was merged into FreeBSD (RELENG_5 and HEAD) recently. Meybe now is
the time to change RES_DFLRETRY from 4 to 2 or even port NetBSD's resolver
code?

> >> why is doubling the number of DNS queries? Is it gethostbyname(3)
> >> function or the resolver itself?
> 
> Do you have 2 name servers in /etc/resolv.conf? Or do you have a hostname
> in /etc/resolv.conf that resolves to multiple IPs?

All my experimets of DNS queries counting were done with one address of
name server (21.21.21.21) defined in the /etc/resolv.conf. Interesting what
results would I get on NetBSD 2.0-RCx/RELEASE?


		
_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com


More information about the freebsd-hackers mailing list