host: handle "debug", "attempts" and "timeout" options in resolv.conf well

Signed-off-by: Adam Tkac <atkac@redhat.com>
This commit is contained in:
Adam Tkac 2010-08-10 13:27:02 +02:00
parent 62ad4d6446
commit aa9e285744
2 changed files with 159 additions and 1 deletions

View File

@ -21,7 +21,7 @@ Summary: The Berkeley Internet Name Domain (BIND) DNS (Domain Name System) serv
Name: bind Name: bind
License: ISC License: ISC
Version: 9.7.2 Version: 9.7.2
Release: 0.1.%{PREVER}%{?dist} Release: 0.2.%{PREVER}%{?dist}
Epoch: 32 Epoch: 32
Url: http://www.isc.org/products/BIND/ Url: http://www.isc.org/products/BIND/
Buildroot:%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Buildroot:%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@ -56,6 +56,7 @@ Patch102:bind-95-rh452060.patch
Patch106:bind93-rh490837.patch Patch106:bind93-rh490837.patch
Patch107:bind97-dist-pkcs11.patch Patch107:bind97-dist-pkcs11.patch
Patch109:bind97-rh478718.patch Patch109:bind97-rh478718.patch
Patch110:bind97-rh570851.patch
# SDB patches # SDB patches
Patch11: bind-9.3.2b2-sdbsrc.patch Patch11: bind-9.3.2b2-sdbsrc.patch
@ -237,6 +238,7 @@ mkdir m4
%patch106 -p0 -b .rh490837 %patch106 -p0 -b .rh490837
%patch107 -p1 -b .dist-pkcs11 %patch107 -p1 -b .dist-pkcs11
%patch109 -p1 -b .rh478718 %patch109 -p1 -b .rh478718
%patch110 -p1 -b .rh570851
# Sparc and s390 arches need to use -fPIE # Sparc and s390 arches need to use -fPIE
%ifarch sparcv9 sparc64 s390 s390x %ifarch sparcv9 sparc64 s390 s390x
@ -672,6 +674,9 @@ rm -rf ${RPM_BUILD_ROOT}
%endif %endif
%changelog %changelog
* Tue Aug 10 2010 Adam Tkac <atkac redhat com> 32:9.7.2-0.2.b1
- host: handle "debug", "attempts" and "timeout" options in resolv.conf well
* Tue Aug 03 2010 Adam Tkac <atkac redhat com> 32:9.7.2-0.1.b1 * Tue Aug 03 2010 Adam Tkac <atkac redhat com> 32:9.7.2-0.1.b1
- update to 9.7.2b1 - update to 9.7.2b1
- patches merged - patches merged

153
bind97-rh570851.patch Normal file
View File

@ -0,0 +1,153 @@
diff -up bind-9.7.2b1/bin/dig/dighost.c.rh570851 bind-9.7.2b1/bin/dig/dighost.c
--- bind-9.7.2b1/bin/dig/dighost.c.rh570851 2010-08-10 12:55:14.219403986 +0200
+++ bind-9.7.2b1/bin/dig/dighost.c 2010-08-10 12:56:40.716015777 +0200
@@ -126,7 +126,8 @@ isc_boolean_t
usesearch = ISC_FALSE,
showsearch = ISC_FALSE,
qr = ISC_FALSE,
- is_dst_up = ISC_FALSE;
+ is_dst_up = ISC_FALSE,
+ verbose = ISC_FALSE;
in_port_t port = 53;
unsigned int timeout = 0;
unsigned int extrabytes;
@@ -1240,10 +1241,24 @@ setup_system(void) {
}
}
+ if (lwconf->resdebug) {
+ verbose = ISC_TRUE;
+ debug("verbose is on");
+ }
if (ndots == -1) {
ndots = lwconf->ndots;
debug("ndots is %d.", ndots);
}
+ if (lwconf->attempts) {
+ tries = lwconf->attempts + 1;
+ if (tries < 2)
+ tries = 2;
+ debug("tries is %d.", tries);
+ }
+ if (lwconf->timeout) {
+ timeout = lwconf->timeout;
+ debug("timeout is %d.", timeout);
+ }
/* If user doesn't specify server use nameservers from resolv.conf. */
if (ISC_LIST_EMPTY(server_list))
diff -up bind-9.7.2b1/bin/dig/host.c.rh570851 bind-9.7.2b1/bin/dig/host.c
--- bind-9.7.2b1/bin/dig/host.c.rh570851 2010-08-10 12:57:16.032758098 +0200
+++ bind-9.7.2b1/bin/dig/host.c 2010-08-10 13:02:12.848559845 +0200
@@ -659,6 +659,7 @@ parse_args(isc_boolean_t is_batchfile, i
lookup->servfail_stops = ISC_FALSE;
lookup->comments = ISC_FALSE;
+ short_form = !verbose;
while ((c = isc_commandline_parse(argc, argv, optstring)) != -1) {
switch (c) {
@@ -869,8 +870,8 @@ main(int argc, char **argv) {
result = isc_app_start();
check_result(result, "isc_app_start");
setup_libs();
- parse_args(ISC_FALSE, argc, argv);
setup_system();
+ parse_args(ISC_FALSE, argc, argv);
result = isc_app_onrun(mctx, global_task, onrun_callback, NULL);
check_result(result, "isc_app_onrun");
isc_app_run();
diff -up bind-9.7.2b1/bin/dig/include/dig/dig.h.rh570851 bind-9.7.2b1/bin/dig/include/dig/dig.h
--- bind-9.7.2b1/bin/dig/include/dig/dig.h.rh570851 2010-08-10 13:02:32.722244088 +0200
+++ bind-9.7.2b1/bin/dig/include/dig/dig.h 2010-08-10 13:02:48.465158159 +0200
@@ -278,6 +278,7 @@ extern isc_boolean_t debugging, memdebug
extern char *progname;
extern int tries;
extern int fatalexit;
+extern isc_boolean_t verbose;
#ifdef WITH_IDN
extern int idnoptions;
#endif
diff -up bind-9.7.2b1/lib/lwres/include/lwres/lwres.h.rh570851 bind-9.7.2b1/lib/lwres/include/lwres/lwres.h
--- bind-9.7.2b1/lib/lwres/include/lwres/lwres.h.rh570851 2010-08-10 13:04:40.465780506 +0200
+++ bind-9.7.2b1/lib/lwres/include/lwres/lwres.h 2010-08-10 13:05:57.559867830 +0200
@@ -243,6 +243,8 @@ typedef struct {
lwres_uint8_t resdebug; /*%< non-zero if 'options debug' set */
lwres_uint8_t ndots; /*%< set to n in 'options ndots:n' */
lwres_uint8_t no_tld_query; /*%< non-zero if 'options no_tld_query' */
+ lwres_int32_t attempts; /*%< set to n in 'options attempts:n' */
+ lwres_int32_t timeout; /*%< set to n in 'options timeout:n' */
} lwres_conf_t;
#define LWRES_ADDRTYPE_V4 0x00000001U /*%< ipv4 */
diff -up bind-9.7.2b1/lib/lwres/lwconfig.c.rh570851 bind-9.7.2b1/lib/lwres/lwconfig.c
--- bind-9.7.2b1/lib/lwres/lwconfig.c.rh570851 2010-08-10 13:06:08.051778429 +0200
+++ bind-9.7.2b1/lib/lwres/lwconfig.c 2010-08-10 13:09:53.972555776 +0200
@@ -237,6 +237,8 @@ lwres_conf_init(lwres_context_t *ctx) {
confdata->resdebug = 0;
confdata->ndots = 1;
confdata->no_tld_query = 0;
+ confdata->attempts = 0;
+ confdata->timeout = 0;
for (i = 0; i < LWRES_CONFMAXNAMESERVERS; i++)
lwres_resetaddr(&confdata->nameservers[i]);
@@ -289,6 +291,8 @@ lwres_conf_clear(lwres_context_t *ctx) {
confdata->resdebug = 0;
confdata->ndots = 1;
confdata->no_tld_query = 0;
+ confdata->attempts = 0;
+ confdata->timeout = 0;
}
static lwres_result_t
@@ -530,6 +534,8 @@ static lwres_result_t
lwres_conf_parseoption(lwres_context_t *ctx, FILE *fp) {
int delim;
long ndots;
+ long attempts;
+ long timeout;
char *p;
char word[LWRES_CONFMAXLINELEN];
lwres_conf_t *confdata;
@@ -546,6 +552,8 @@ lwres_conf_parseoption(lwres_context_t *
confdata->resdebug = 1;
} else if (strcmp("no_tld_query", word) == 0) {
confdata->no_tld_query = 1;
+ } else if (strcmp("debug", word) == 0) {
+ confdata->resdebug = 1;
} else if (strncmp("ndots:", word, 6) == 0) {
ndots = strtol(word + 6, &p, 10);
if (*p != '\0') /* Bad string. */
@@ -553,6 +561,18 @@ lwres_conf_parseoption(lwres_context_t *
if (ndots < 0 || ndots > 0xff) /* Out of range. */
return (LWRES_R_FAILURE);
confdata->ndots = (lwres_uint8_t)ndots;
+ } else if (strncmp("timeout:", word, 8) == 0) {
+ timeout = strtol(word + 8, &p, 10);
+ if (*p != '\0') /* Bad string. */
+ return (LWRES_R_FAILURE);
+ confdata->timeout = (lwres_int32_t)timeout;
+ } else if (strncmp("attempts:", word, 9) == 0) {
+ attempts = strtol(word + 9, &p, 10);
+ if (*p != '\0') /* Bad string. */
+ return (LWRES_R_FAILURE);
+ if (attempts < 0) /* Out of range. */
+ return (LWRES_R_FAILURE);
+ confdata->attempts = (lwres_int32_t)attempts;
}
if (delim == EOF || delim == '\n')
@@ -716,6 +736,12 @@ lwres_conf_print(lwres_context_t *ctx, F
if (confdata->no_tld_query)
fprintf(fp, "options no_tld_query\n");
+ if (confdata->attempts)
+ fprintf(fp, "options attempts:%d\n", confdata->attempts);
+
+ if (confdata->timeout)
+ fprintf(fp, "options timeout:%d\n", confdata->timeout);
+
return (LWRES_R_SUCCESS);
}