mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 06:25:31 +00:00
Merge branch '433-restore-localhost-fallback-in-bin-dig-dighost.c' into 'master'
Restore localhost fallback in bin/dig/dighost.c Closes #433 See merge request isc-projects/bind9!910
This commit is contained in:
5
CHANGES
5
CHANGES
@@ -1,3 +1,8 @@
|
||||
5089. [bug] Restore localhost fallback in dig and host which is
|
||||
used when no nameserver addresses present in
|
||||
/etc/resolv.conf are usable due to the requested
|
||||
address family restrictions. [GL #433]
|
||||
|
||||
5088. [bug] dig/host/nslookup could crash when interrupted close to
|
||||
a query timeout. [GL #599]
|
||||
|
||||
|
@@ -1227,6 +1227,19 @@ create_search_list(irs_resconf_t *resconf) {
|
||||
}
|
||||
}
|
||||
|
||||
/*%
|
||||
* Append 'addr' to the list of servers to be queried. This function is only
|
||||
* called when no server addresses are explicitly specified and either libirs
|
||||
* returns an empty list of servers to use or none of the addresses returned by
|
||||
* libirs are usable due to the specified address family restrictions.
|
||||
*/
|
||||
static void
|
||||
add_fallback_nameserver(const char *addr) {
|
||||
dig_server_t *server = make_server(addr, addr);
|
||||
ISC_LINK_INIT(server, link);
|
||||
ISC_LIST_APPEND(server_list, server, link);
|
||||
}
|
||||
|
||||
/*%
|
||||
* Setup the system as a whole, reading key information and resolv.conf
|
||||
* settings.
|
||||
@@ -1272,6 +1285,16 @@ setup_system(bool ipv4only, bool ipv6only) {
|
||||
get_server_list(resconf);
|
||||
}
|
||||
|
||||
/* If we don't find a nameserver fall back to localhost */
|
||||
if (ISC_LIST_EMPTY(server_list)) {
|
||||
if (have_ipv6) {
|
||||
add_fallback_nameserver("::1");
|
||||
}
|
||||
if (have_ipv4) {
|
||||
add_fallback_nameserver("127.0.0.1");
|
||||
}
|
||||
}
|
||||
|
||||
irs_resconf_destroy(&resconf);
|
||||
|
||||
#ifdef HAVE_SETLOCALE
|
||||
|
Reference in New Issue
Block a user