diff -up bind-9.5.1b2/bin/dig/dighost.c.rh469440 bind-9.5.1b2/bin/dig/dighost.c --- bind-9.5.1b2/bin/dig/dighost.c.rh469440 2008-11-03 10:14:05.000000000 +0100 +++ bind-9.5.1b2/bin/dig/dighost.c 2008-11-03 10:33:13.000000000 +0100 @@ -596,6 +596,11 @@ copy_server_list(lwres_conf_t *confdata, 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); @@ -1051,8 +1056,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) @@ -1063,10 +1070,12 @@ setup_system(void) { if (lwresult != ISC_R_SUCCESS) fatal("add_nameserver failed"); } - } - if (ISC_LIST_EMPTY(server_list)) copy_server_list(lwconf, &server_list); + if (ISC_LIST_EMPTY(server_list)) { + fatal("Could not find any nameserver"); + } + } #ifdef WITH_IDN initialize_idn();