Commit Graph

43 Commits

Author SHA1 Message Date
Eric van Gyzen
c70540ec67 resolver: preserve binary compatibility; reduce header pollution
In r289315, I added new fields to res_state.  This broke binary
backward compatibility.  It also broke some ports (and possibly
other code) by requiring the definition of time_t and struct timespec.

Fix these problems by moving the new fields into __res_state_ext.

Suggested by:	ume
Reviewed by:	ume
MFC after:	3 days
Sponsored by:	Dell Inc.
Differential Revision:	https://reviews.freebsd.org/D4472
2015-12-14 17:21:06 +00:00
Eric van Gyzen
d7acdd2f9b resolver: fix the build of some ports, broken by r289315
r289315 required time_t and struct timespec to be defined before
including <resolv.h>.  This broke the build of net-mgmt/sx, at least.

Include <sys/timespec.h> in resolv.h to fix this with minimal pollution.

Reported by:	Raphael Kubo da Costa <rakuco>
MFC after:	3 days
Sponsored by:	Dell Inc.
2015-12-08 16:09:48 +00:00
Eric van Gyzen
60b27ebb25 resolver: automatically reload /etc/resolv.conf
On each resolver query, use stat(2) to see if the modification time
of /etc/resolv.conf has changed.  If so, reload the file and reinitialize
the resolver library.  However, only call stat(2) if at least two seconds
have passed since the last call to stat(2), since calling it on every
query could kill performance.

This new behavior is enabled by default.  Add a "reload-period" option
to disable it or change the period of the test.

Document this behavior and option in resolv.conf(5).

Polish the man page just enough to appease igor.

https://lists.freebsd.org/pipermail/freebsd-arch/2015-October/017342.html

Reviewed by:	kp, wblock
Discussed with:	jilles, imp, alfred
MFC after:	1 month
Relnotes:	yes
Sponsored by:	Dell Inc.
Differential Revision:	https://reviews.freebsd.org/D3867
2015-10-14 14:26:44 +00:00
Hajimu UMEMOTO
e45764721a Update our stub resolver to final version of libbind.
Obtained from:	ISC
2014-08-12 12:36:06 +00:00
Pedro F. Giffuni
046c3635cd Bring final version of libbind:
From
http://www.isc.org/downloads/libbind/

The libbind functions have been separated from the BIND suite as of BIND
9.6.0. Originally from older versions of BIND, they have been continually
maintained and improved but not installed by default with BIND 9. This
standard resolver library contains the same historical functions and
headers included with many Unix operating systems. In fact, most
implementations are based on the same original code.

At present, NetBSD maintains libbind code, now known as "netresolv".
2014-08-05 23:16:31 +00:00
Ulrich Spörlein
2f98c0ba01 Spelling fixes for include/ 2012-01-07 16:10:15 +00:00
Warner Losh
f2556687c6 Remove the Berkeley clause 3's.
Add a few $FreeBSD$
2010-02-16 19:39:50 +00:00
Hajimu UMEMOTO
54ebdd631d Merge the resolver part of BIND 9.4.3 into HEAD.
It includes the following fix:

  2426.   [bug]           libbind: inet_net_pton() can sometimes return the
                          wrong value if excessively large netmasks are
                          supplied. [RT #18512]

Reported by:	Maksymilian Arciemowicz <cxib__at__securityreason.com>
2008-12-14 19:39:53 +00:00
Hajimu UMEMOTO
9aeb4147cc Import the resolver part of BIND 9.4.3. 2008-12-14 16:47:21 +00:00
Hajimu UMEMOTO
dde4a85d9d Merge BIND 9.4.1 into main chunk.
MFC after:	2 weeks
2007-06-03 17:20:27 +00:00
Hajimu UMEMOTO
861249f583 Vendor import of BIND 9.4.1 2007-06-03 17:02:29 +00:00
Hajimu UMEMOTO
d808369aa1 Upgrade res_update(3) and the friends to BIND9's one excluding TSIG
support.

X-MFC after:	never
2006-05-21 11:19:36 +00:00
Hajimu UMEMOTO
2d39807f07 Comment out the function prototypes which our libc actually
doesn't have.
2006-05-13 12:43:12 +00:00
Hajimu UMEMOTO
5342d17f09 Update the resolver in libc to BIND9's one.
Since, res_sendsigned(3) and the friends use MD5 functions, it is
hard to include them without having MD5 functions in libc.  So,
res_sendsigned(3) is not merged into libc.

Since, res_update(3) in BIND9 is not binary compatible with our
res_update(3), res_update(3) is leaved as is, except some
necessary modifications.
The res_update(3) and the friends are not essential part of the
resolver.  They are not defined in resolv.h but defined in
res_update.h separately in BIND9.  Further, they are not called from
our tree.  So, I hide them from our resolv.h, but leave them only
for binary backward compatibility (perhaps, no one calls them).

Since, struct __res_state_ext is not exposed in BIND9, I hide it
from our resolv.h.  And, global variable _res_ext is removed.  It
breaks binary backward compatibility.  But, since it is not used from
outside of our libc, I think it is safe.

Reviewed by:	arch@ (no objection)
2006-03-21 16:11:11 +00:00
Hajimu UMEMOTO
f85162f084 Vendor import of BIND 9.3.2 2006-03-21 15:57:58 +00:00
Hajimu UMEMOTO
f9ad25aace Decrease the value of RES_DFLRETRY from 4 to 2.
PR:		bin/62139
Reported by:	Rostislav Krasny <rosti.bsd__at__gmail.com>
Obtained from:	BIND9
MFC after:	1 week
2006-02-24 17:00:50 +00:00
Stefan Farfeleder
533dcdacf1 Don't declare ___res_ext() twice. 2005-09-12 15:53:28 +00:00
Yaroslav Tykhiy
b22ae8ba2d Add the macro RES_DFLRETRY long-promised by resolver(5).
It specifies the default number of retries per a name server.
This makes the code consistent with the manpage and allows to
kill another constant in res_init.c that should have been a
#define'd parameter.  (This appears to be a case when the manpage
was better than the code, so the latter was to be fixed.)

PR:	bin/62139 (in the audit trail)
2004-09-09 17:39:47 +00:00
Dag-Erling Smørgrav
5b3ce02186 Don't try to pass off a struct sockaddr as a struct sockaddr_in when it
may in fact very well be a struct sockaddr_in6.  Just use plain struct
sockaddr.

This brings us yet another step closer to a clean -O2 build.
2004-03-15 17:08:28 +00:00
Brian Feldman
33dee81933 Make the resolver(3) and many associated interfaces much more reentrant.
The getaddrinfo(3), getipnodebyname(3) and resolver(3) can coincide now
with what should be totally reentrant, and h_errno values will now
be preserved correctly, but this does not affect interfaces such as
gethostbyname(3) which are still mostly non-reentrant.

In all of these relevant functions, the thread-safety has been pushed
down as far as it seems possible right now.  This means that operations
that are selected via nsdispatch(3) (i.e. files, yp, dns) are protected
still under global locks that getaddrinfo(3) defines, but where possible
the locking is greatly reduced.  The most noticeable improvement is
that multiple DNS lookups can now be run at the same time, and this
shows major improvement in performance of DNS-lookup threaded programs,
and solves the "Mozilla tab serialization" problem.

No single-threaded applications need to be recompiled.  Multi-threaded
applications that reference "_res" to change resolver(3) options will
need to be recompiled, and ones which reference "h_errno" will also
if they desire the correct h_errno values.  If the applications already
understood that _res and h_errno were not thread-safe and had their own
locking, they will see no performance improvement but will not
actually break in any way.

Please note that when NSS modules are used, or when nsdispatch(3)
defaults to adding any lookups of its own to the individual libc
_nsdispatch() calls, those MUST be reentrant as well.
2004-02-25 21:03:46 +00:00
Murray Stokely
a298e0ba03 Add support for timeout: and attempts: resolver options.
Submitted by:	Paul Vixie <paul@vix.com> / ISC
MFC After:	1 week
2003-12-07 12:32:24 +00:00
Jacques Vidrine
2bbd7cf820 Eliminate 19 warnings in libc (at level WARNS=2) of the
`implicit declaration of function' variety.
2003-02-27 13:40:01 +00:00
Warner Losh
bb28f3c29b Breath deep and take __P out of the system include files.
# This appears to not break X11, but I'm having problems compiling the
# glide part of the server with or without this patch, so I can't tell
# for sure.
2002-03-23 17:24:55 +00:00
Hajimu UMEMOTO
ce6282db3b Implement EDNS0 support, as EDNS0 support will be made mandatory for
IPv6 transport-ready resolvers/DNS servers.  Need careful configuration
when enable it. (default config is not affected).
See manpage for details.

XXX visible symbol __res_opt() is added, however, it is not supposed to be
called from outside, libc minor is not bumped.

Obtained from:	KAME/NetBSD
2001-06-10 20:25:24 +00:00
Yoshinobu Inoue
7d56d3747c Getaddrinfo(), getnameinfo(), and etc support in libc/net.
Several udp and raw apps IPv6 support.

Reviewed by: freebsd-arch, cvs-committers
Obtained from: KAME project
1999-12-28 02:37:14 +00:00
Peter Wemm
a4add9a9b1 $Id$ -> $FreeBSD$ 1999-08-27 23:45:13 +00:00
Brian Somers
d54358ffe5 Remove the extern decl of ``h_errno''. It's already
externed in netdb.h - where all of its #define values
live.  If anything requires h_errno here (nothing in
/usr/src seems to) it's almost definitely broken.
1998-09-07 19:54:08 +00:00
Peter Wemm
71e8a85c73 Damn, bind8 includes added <arpa/nameser.h> as a prerequisite for
<resolv.h>.  This breaks user ppp at least, and goodness knows how
many ports. :-(

This a bit of a hack, but is probably simpler than duplicating the
typedefs and protecting them from each other.

Also, remove some temporary XXX notes that I forgot to remove before.
1998-06-11 12:52:45 +00:00
Peter Wemm
0160f9c065 Update nameserver interface to bind-8.1.2 levels. We do not use IRS (yet?)
since it has far wider impact than hostname lookups (including passwords).
Note that this has more ugly symbol hiding and binary compatability hacks
that can go away the second we bump majors.

Obtained from:  Mostly from diff against ISC bind-8.1.2 sources
1998-06-11 08:55:17 +00:00
Brian Somers
a367bd9e25 Add "options no_tld_query" to resolv.conf.
Mention the capability in resolver(5).
Mention that RES_OPTIONS can be used in resolver(5).
Discussed with: -hackers
1997-09-01 01:19:23 +00:00
Peter Wemm
4ebe87f9cc merge in bind-4.9.6 changes (only effect is __res_send #define reverted) 1997-06-27 08:32:38 +00:00
Eivind Eklund
f756433e8b Back out all of yesterdays include file changes. 1997-05-07 20:01:10 +00:00
Eivind Eklund
48ea0bec18 Make a lot of include-files self-contained. I excluded the patches changing
int's to gid_t and uid_t - should I commit these, too?

Closes PR misc/2625.

Submitted by:	Julian Assange <proff@iq.org>
1997-05-07 02:27:18 +00:00
Peter Wemm
79403fe300 Revert $FreeBSD$ to $Id$ 1997-02-23 09:21:14 +00:00
Jordan K. Hubbard
1130b656e5 Make the long-awaited change from $Id$ to $FreeBSD$
This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore.  This update would have been
insane otherwise.
1997-01-14 07:20:47 +00:00
Peter Wemm
315d6d9c3b Update the resolver definitions from bind-4.9.4-P1 to 4.9.5-P1 level.
(More commits to come)
1996-12-30 13:08:54 +00:00
Peter Wemm
74b3fad642 Hand merge in the bind-4.9.4-P1 resolver updates. 1996-08-29 20:01:00 +00:00
Mike Pritchard
71d9c7815e Fix a bunch of spelling errors in the comment fields
of a bunch of system include files.
1996-01-30 23:33:04 +00:00
Peter Wemm
25c570d8a8 Update resolver include files to bind-4.9.3-rel level 1996-01-07 05:01:52 +00:00
Peter Wemm
d58a9efd01 Update the resolver include files to bind-4.9.3-beta24 level (from beta9p1)
Note: this was done by selective patching from diffs by hand, in order
to not conflict with the 4.4BSD base code.  Beta9 was done the same way.

Obtained from:	Paul Vixie <paul@vix.com>
1995-08-20 19:59:28 +00:00
Rodney W. Grimes
4399be3cbd Remove trailing whitespace. 1995-05-30 05:05:38 +00:00
Paul Traina
1363f04ce1 get* rework and new bind code 1994-09-25 02:12:49 +00:00
Rodney W. Grimes
59deaec541 BSD 4.4 Lite Include Sources 1994-05-24 09:57:34 +00:00