diff options
author | 2019-12-17 01:52:25 +0000 | |
---|---|---|
committer | 2019-12-17 01:52:25 +0000 | |
commit | c35d4ceefb31c7618476a2ff3efb06eb269767ef (patch) | |
tree | 11cba913b0cf0a84e2f37d15e06a6a94e33f09a6 | |
parent | update to 9.10.8-P1, last isc-licensed release (diff) | |
download | wireguard-openbsd-c35d4ceefb31c7618476a2ff3efb06eb269767ef.tar.xz wireguard-openbsd-c35d4ceefb31c7618476a2ff3efb06eb269767ef.zip |
merge in https://github.com/isc-projects/bind9/commit/b8a04d50a361.patch
(pre MPL), v4/v6-only wasn't working correctly (trying to use an v6-mapped
v4 address when set for v6-only)
-rw-r--r-- | usr.sbin/bind/bin/dig/dig.c | 22 | ||||
-rw-r--r-- | usr.sbin/bind/bin/dig/dighost.c | 22 | ||||
-rw-r--r-- | usr.sbin/bind/bin/dig/host.c | 27 | ||||
-rw-r--r-- | usr.sbin/bind/bin/dig/include/dig/dig.h | 2 | ||||
-rw-r--r-- | usr.sbin/bind/bin/dig/nslookup.c | 2 |
5 files changed, 53 insertions, 22 deletions
diff --git a/usr.sbin/bind/bin/dig/dig.c b/usr.sbin/bind/bin/dig/dig.c index 592c530c040..8288b30660d 100644 --- a/usr.sbin/bind/bin/dig/dig.c +++ b/usr.sbin/bind/bin/dig/dig.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dig.c,v 1.20 2019/12/17 01:46:31 sthen Exp $ */ +/* $Id: dig.c,v 1.21 2019/12/17 01:52:25 sthen Exp $ */ /*! \file */ @@ -83,7 +83,8 @@ static char sitvalue[256]; static isc_boolean_t short_form = ISC_FALSE, printcmd = ISC_TRUE, ip6_int = ISC_FALSE, plusquest = ISC_FALSE, pluscomm = ISC_FALSE, multiline = ISC_FALSE, nottl = ISC_FALSE, noclass = ISC_FALSE, - onesoa = ISC_FALSE, use_usec = ISC_FALSE, nocrypto = ISC_FALSE; + onesoa = ISC_FALSE, use_usec = ISC_FALSE, nocrypto = ISC_FALSE, + ipv4only = ISC_FALSE, ipv6only = ISC_FALSE; static isc_uint32_t splitwidth = 0xffffffff; /*% rrcomments are neither explicitly enabled nor disabled by default */ @@ -1788,11 +1789,22 @@ preparse_args(int argc, char **argv) { continue; option = &rv[0][1]; while (strpbrk(option, single_dash_opts) == &option[0]) { - if (option[0] == 'm') { + switch (option[0]) { + case 'm': memdebugging = ISC_TRUE; isc_mem_debugging = ISC_MEM_DEBUGTRACE | ISC_MEM_DEBUGRECORD; - return; + break; + case '4': + if (ipv6only) + fatal("only one of -4 and -6 allowed"); + ipv4only = ISC_TRUE; + break; + case '6': + if (ipv4only) + fatal("only one of -4 and -6 allowed"); + ipv6only = ISC_TRUE; + break; } option = &option[1]; } @@ -2173,7 +2185,7 @@ void dig_setup(int argc, char **argv) check_result(result, "isc_app_start"); setup_libs(); - setup_system(); + setup_system(ipv4only, ipv6only); } void dig_query_setup(isc_boolean_t is_batchfile, isc_boolean_t config_only, diff --git a/usr.sbin/bind/bin/dig/dighost.c b/usr.sbin/bind/bin/dig/dighost.c index b0d9ae1bcee..06aeb8b8110 100644 --- a/usr.sbin/bind/bin/dig/dighost.c +++ b/usr.sbin/bind/bin/dig/dighost.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dighost.c,v 1.20 2019/12/17 01:46:31 sthen Exp $ */ +/* $Id: dighost.c,v 1.21 2019/12/17 01:52:25 sthen Exp $ */ /*! \file * \note @@ -1421,7 +1421,7 @@ create_search_list(lwres_conf_t *confdata) { * settings. */ void -setup_system(void) { +setup_system(isc_boolean_t ipv4only, isc_boolean_t ipv6only) { dig_searchlist_t *domain = NULL; lwres_result_t lwresult; unsigned int lwresflags; @@ -1429,6 +1429,24 @@ setup_system(void) { debug("setup_system()"); + if (ipv4only) { + if (have_ipv4) { + isc_net_disableipv6(); + have_ipv6 = ISC_FALSE; + } else { + fatal("can't find IPv4 networking"); + } + } + + if (ipv6only) { + if (have_ipv6) { + isc_net_disableipv4(); + have_ipv4 = ISC_FALSE; + } else { + fatal("can't find IPv6 networking"); + } + } + lwresflags = LWRES_CONTEXT_SERVERMODE; if (have_ipv4) lwresflags |= LWRES_CONTEXT_USEIPV4; diff --git a/usr.sbin/bind/bin/dig/host.c b/usr.sbin/bind/bin/dig/host.c index 91e88c2a1ec..f5128b96f13 100644 --- a/usr.sbin/bind/bin/dig/host.c +++ b/usr.sbin/bind/bin/dig/host.c @@ -58,6 +58,7 @@ static int seen_error = -1; static isc_boolean_t list_addresses = ISC_TRUE; static dns_rdatatype_t list_type = dns_rdatatype_a; static isc_boolean_t printed_server = ISC_FALSE; +static isc_boolean_t ipv4only = ISC_FALSE, ipv6only = ISC_FALSE; static const char *opcodetext[] = { "QUERY", @@ -625,8 +626,16 @@ pre_parse_args(int argc, char **argv) { isc_mem_debugging |= ISC_MEM_DEBUGUSAGE; break; - case '4': break; - case '6': break; + case '4': + if (ipv6only) + fatal("only one of -4 and -6 allowed"); + ipv4only = ISC_TRUE; + break; + case '6': + if (ipv4only) + fatal("only one of -4 and -6 allowed"); + ipv6only = ISC_TRUE; + break; case 'a': break; case 'c': break; case 'd': break; @@ -820,18 +829,10 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) { /* Handled by pre_parse_args(). */ break; case '4': - if (have_ipv4) { - isc_net_disableipv6(); - have_ipv6 = ISC_FALSE; - } else - fatal("can't find IPv4 networking"); + /* Handled by pre_parse_args(). */ break; case '6': - if (have_ipv6) { - isc_net_disableipv4(); - have_ipv4 = ISC_FALSE; - } else - fatal("can't find IPv6 networking"); + /* Handled by pre_parse_args(). */ break; case 's': lookup->servfail_stops = ISC_TRUE; @@ -899,7 +900,7 @@ main(int argc, char **argv) { check_result(result, "isc_app_start"); setup_libs(); parse_args(ISC_FALSE, argc, argv); - setup_system(); + setup_system(ipv4only, ipv6only); result = isc_app_onrun(mctx, global_task, onrun_callback, NULL); check_result(result, "isc_app_onrun"); isc_app_run(); diff --git a/usr.sbin/bind/bin/dig/include/dig/dig.h b/usr.sbin/bind/bin/dig/include/dig/dig.h index c37beaf810b..2f644532c13 100644 --- a/usr.sbin/bind/bin/dig/include/dig/dig.h +++ b/usr.sbin/bind/bin/dig/include/dig/dig.h @@ -346,7 +346,7 @@ void setup_libs(void); void -setup_system(void); +setup_system(isc_boolean_t ipv4only, isc_boolean_t ipv6only); isc_result_t parse_uint(isc_uint32_t *uip, const char *value, isc_uint32_t max, diff --git a/usr.sbin/bind/bin/dig/nslookup.c b/usr.sbin/bind/bin/dig/nslookup.c index 006a80578d2..0045f0d6cfa 100644 --- a/usr.sbin/bind/bin/dig/nslookup.c +++ b/usr.sbin/bind/bin/dig/nslookup.c @@ -940,7 +940,7 @@ main(int argc, char **argv) { parse_args(argc, argv); - setup_system(); + setup_system(ISC_FALSE, ISC_FALSE); if (domainopt[0] != '\0') set_search_domain(domainopt); if (in_use) |