From 7ba05518c7ee2f38cd9eedbafb43cf6e7db76aef Mon Sep 17 00:00:00 2001 From: Brian Wellington Date: Wed, 22 Nov 2000 21:25:38 +0000 Subject: [PATCH] ipv4-less operation --- bin/nsupdate/nsupdate.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/bin/nsupdate/nsupdate.c b/bin/nsupdate/nsupdate.c index 981403dd19..93ca3a127a 100644 --- a/bin/nsupdate/nsupdate.c +++ b/bin/nsupdate/nsupdate.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: nsupdate.c,v 1.63 2000/11/22 02:54:15 bwelling Exp $ */ +/* $Id: nsupdate.c,v 1.64 2000/11/22 21:25:38 bwelling Exp $ */ #include @@ -85,6 +85,7 @@ extern int h_errno; static isc_boolean_t debugging = ISC_FALSE, ddebugging = ISC_FALSE; static isc_boolean_t memdebugging = ISC_FALSE; +static isc_boolean_t have_ipv4 = ISC_FALSE; static isc_boolean_t have_ipv6 = ISC_FALSE; static isc_boolean_t is_dst_up = ISC_FALSE; static isc_boolean_t usevc = ISC_FALSE; @@ -366,12 +367,16 @@ setup_system(void) { dns_result_register(); result = isc_net_probeipv4(); - check_result(result, "isc_net_probeipv4"); + if (result == ISC_R_SUCCESS) + have_ipv4 = ISC_TRUE; result = isc_net_probeipv6(); if (result == ISC_R_SUCCESS) have_ipv6 = ISC_TRUE; + if (!have_ipv4 && !have_ipv6) + fatal("couldn't find either IPv4 or IPv6"); + result = isc_mem_create(0, 0, &mctx); check_result(result, "isc_mem_create"); @@ -445,14 +450,17 @@ setup_system(void) { check_result(result, "dns_dispatch_getudp (v6)"); } - attrs = DNS_DISPATCHATTR_UDP; - attrs |= DNS_DISPATCHATTR_MAKEQUERY; - attrs |= DNS_DISPATCHATTR_IPV4; - isc_sockaddr_any(&bind_any); - result = dns_dispatch_getudp(dispatchmgr, socketmgr, taskmgr, - &bind_any, PACKETSIZE, 4, 2, 3, 5, - attrs, attrmask, &dispatchv4); - check_result(result, "dns_dispatch_getudp (v4)"); + if (have_ipv4) { + attrs = DNS_DISPATCHATTR_UDP; + attrs |= DNS_DISPATCHATTR_MAKEQUERY; + attrs |= DNS_DISPATCHATTR_IPV4; + isc_sockaddr_any(&bind_any); + result = dns_dispatch_getudp(dispatchmgr, socketmgr, taskmgr, + &bind_any, PACKETSIZE, + 4, 2, 3, 5, + attrs, attrmask, &dispatchv4); + check_result(result, "dns_dispatch_getudp (v4)"); + } result = dns_requestmgr_create(mctx, timermgr, socketmgr, taskmgr, dispatchmgr,