diff options
author | murray <murray@FreeBSD.org> | 2003-12-07 12:32:24 +0000 |
---|---|---|
committer | murray <murray@FreeBSD.org> | 2003-12-07 12:32:24 +0000 |
commit | 93b87ff9b0c62b50781c5c64ceca2f2662fee9d2 (patch) | |
tree | 1a35bb43b7ac361b9f14caf982706023116c0b51 | |
parent | ac33b83fc2706126a74084cba417f5084ff93c1e (diff) | |
download | FreeBSD-src-93b87ff9b0c62b50781c5c64ceca2f2662fee9d2.zip FreeBSD-src-93b87ff9b0c62b50781c5c64ceca2f2662fee9d2.tar.gz |
Add support for timeout: and attempts: resolver options.
Submitted by: Paul Vixie <paul@vix.com> / ISC
MFC After: 1 week
-rw-r--r-- | include/resolv.h | 2 | ||||
-rw-r--r-- | lib/libc/net/res_init.c | 20 | ||||
-rw-r--r-- | share/man/man5/resolver.5 | 16 |
3 files changed, 37 insertions, 1 deletions
diff --git a/include/resolv.h b/include/resolv.h index 12d14b4..9305023 100644 --- a/include/resolv.h +++ b/include/resolv.h @@ -94,6 +94,8 @@ #define RES_TIMEOUT 5 /* min. seconds between retries */ #define MAXRESOLVSORT 10 /* number of net to sort on */ #define RES_MAXNDOTS 15 /* should reflect bit field size */ +#define RES_MAXRETRANS 30 /* only for resolv.conf/RES_OPTIONS */ +#define RES_MAXRETRY 5 /* only for resolv.conf/RES_OPTIONS */ struct __res_state { int retrans; /* retransmition time interval */ diff --git a/lib/libc/net/res_init.c b/lib/libc/net/res_init.c index 9bb8452..6c22973 100644 --- a/lib/libc/net/res_init.c +++ b/lib/libc/net/res_init.c @@ -524,6 +524,26 @@ res_setoptions(options, source) if (_res.options & RES_DEBUG) printf(";;\tndots=%d\n", _res.ndots); #endif + } else if (!strncmp(cp, "timeout:", sizeof("timeout:") - 1)) { + i = atoi(cp + sizeof("timeout:") - 1); + if (i <= RES_MAXRETRANS) + _res.retrans = i; + else + _res.retrans = RES_MAXRETRANS; +#ifdef DEBUG + if (_res.options & RES_DEBUG) + printf(";;\ttimeout=%d\n", _res.retrans); +#endif + } else if (!strncmp(cp, "attempts:", sizeof("attempts:") - 1)){ + i = atoi(cp + sizeof("attempts:") - 1); + if (i <= RES_MAXRETRY) + _res.retry = i; + else + _res.retry = RES_MAXRETRY; +#ifdef DEBUG + if (_res.options & RES_DEBUG) + printf(";;\tretry=%d\n", _res.retry); +#endif } else if (!strncmp(cp, "debug", sizeof("debug") - 1)) { #ifdef DEBUG if (!(_res.options & RES_DEBUG)) { diff --git a/share/man/man5/resolver.5 b/share/man/man5/resolver.5 index 16320af..535b54e 100644 --- a/share/man/man5/resolver.5 +++ b/share/man/man5/resolver.5 @@ -130,7 +130,7 @@ is one of the following: sets .Dv RES_DEBUG in _res.options. -.It Sy ndots:n +.It Sy ndots: Ns Ar n sets a threshold for the number of dots which must appear in a name given to .Fn res_query (see @@ -146,6 +146,20 @@ meaning that if there are any dots in a name, the name will be tried first as an absolute name before any .Em search list elements are appended to it. +.It Sy timeout: Ns Ar n +sets the amount of time the resolver will wait for a response from a remote +name server before retrying the query via a different name server. Measured in +seconds, the default is +.Dv RES_TIMEOUT +(see +.Pa <resolv.h> ) . +.It Sy attempts: Ns Ar n +sets the number of times the resolver will send a query to its name servers +before giving up and returning an error to the calling application. The +default is +.Dv RES_DFLRETRY +(see +.Pa <resolv.h> ) . .It Sy no_tld_query tells the resolver not to attempt to resolve a top level domain name, that is, a name that contains no dots. Use of this option doesn't prevent |