]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
2514. [bug] dig/host failed with -4 or -6 when resolv.conf contains
authorTatuya JINMEI 神明達哉 <jinmei@isc.org>
Sat, 13 Dec 2008 04:43:52 +0000 (04:43 +0000)
committerTatuya JINMEI 神明達哉 <jinmei@isc.org>
Sat, 13 Dec 2008 04:43:52 +0000 (04:43 +0000)
a nameserver of the unsupported address family.
[RT #18848]

CHANGES
bin/dig/dighost.c

diff --git a/CHANGES b/CHANGES
index fd47819784be74ae3153e7a81faa6e81289b2e92..624b0c363eecb3cf002f0312a590bebd4c4306cf 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,7 @@
+2514.  [bug]           dig/host failed with -4 or -6 when resolv.conf contains
+                       a nameserver of the unsupported address family.
+                       [RT #18848]
+
 2511.  [cleanup]       dns_rdata_tofmttext() add const to linebreak.
                        [RT #18885]
 
index 8d24a18c173fd8a24d502717e5d7684a361b25d0..5790d442061f840796afab4ce30206c876ea13e6 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: dighost.c,v 1.259.18.50 2008/12/10 23:25:40 marka Exp $ */
+/* $Id: dighost.c,v 1.259.18.51 2008/12/13 04:43:52 jinmei Exp $ */
 
 /*! \file
  *  \note
@@ -583,6 +583,11 @@ copy_server_list(lwres_conf_t *confdata, dig_serverlist_t *dest) {
        for (i = 0; i < confdata->nsnext; i++) {
                af = addr2af(confdata->nameservers[i].family);
 
+               if (af == AF_INET && !have_ipv4)
+                       continue;
+               if (af == AF_INET6 && !have_ipv6)
+                       continue;
+
                lwres_net_ntop(af, confdata->nameservers[i].address,
                                   tmp, sizeof(tmp));
                newsrv = make_server(tmp, tmp);
@@ -1033,8 +1038,10 @@ setup_system(void) {
                debug("ndots is %d.", ndots);
        }
 
+       copy_server_list(lwconf, &server_list);
+
        /* If we don't find a nameserver fall back to localhost */
-       if (lwconf->nsnext == 0) {
+       if (ISC_LIST_EMPTY(server_list)) {
                if (have_ipv4) {
                        lwresult = add_nameserver(lwconf, "127.0.0.1", AF_INET);
                        if (lwresult != ISC_R_SUCCESS)
@@ -1045,10 +1052,9 @@ setup_system(void) {
                        if (lwresult != ISC_R_SUCCESS)
                                fatal("add_nameserver failed");
                }
-       }
 
-       if (ISC_LIST_EMPTY(server_list))
                copy_server_list(lwconf, &server_list);
+       }
 
 #ifdef WITH_IDN
        initialize_idn();