From a0d68463e1a34bab24fbb590a0a0c3fbc59ade32 Mon Sep 17 00:00:00 2001 From: Evan Hunt Date: Wed, 23 Jan 2013 15:47:51 -0800 Subject: [PATCH] [v9_6] fix dns_request_createvia assert 3474. [bug] nsupdate could assert when the local and remote address families didn't match. [RT #22897] (cherry picked from commit ffff5d67926821d3db8df63bdd84a9cb1ce56739) (cherry picked from commit 8d025e23e3521d2b3b4654e17494c5892e609b29) --- CHANGES | 3 +++ bin/tests/system/nsupdate/tests.sh | 10 ++++++++++ lib/dns/request.c | 6 ++++-- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 9abbf637a9..f755143269 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +3474. [bug] nsupdate could assert when the local and remote + address families didn't match. [RT #22897] + --- 9.6-ESV-R9b1 released --- 3465. [bug] Handle isolated reserved ports. [RT #31778] diff --git a/bin/tests/system/nsupdate/tests.sh b/bin/tests/system/nsupdate/tests.sh index fb77cabccf..4af7f7596a 100644 --- a/bin/tests/system/nsupdate/tests.sh +++ b/bin/tests/system/nsupdate/tests.sh @@ -128,6 +128,16 @@ $DIG +tcp version.bind txt ch @10.53.0.1 -p 5300 > dig.out.ns1.$n grep "status: NOERROR" dig.out.ns1.$n > /dev/null || ret=1 [ $ret = 0 ] || { echo I:failed; status=1; } +n=`expr $n + 1` +echo "I:check that address family mismatch is handled ($n)" +$NSUPDATE < /dev/null 2>&1 && ret=1 +server ::1 +local 127.0.0.1 +update add 600 txt.example.nil in txt "test" +send +END +[ $ret = 0 ] || { echo I:failed; status=1; } + if $PERL -e 'use Net::DNS;' 2>/dev/null then echo "I:running update.pl test" diff --git a/lib/dns/request.c b/lib/dns/request.c index 2ff5b173a9..236ab807eb 100644 --- a/lib/dns/request.c +++ b/lib/dns/request.c @@ -893,13 +893,15 @@ dns_request_createvia3(dns_requestmgr_t *requestmgr, dns_message_t *message, REQUIRE(action != NULL); REQUIRE(requestp != NULL && *requestp == NULL); REQUIRE(timeout > 0); - if (srcaddr != NULL) - REQUIRE(isc_sockaddr_pf(srcaddr) == isc_sockaddr_pf(destaddr)); mctx = requestmgr->mctx; req_log(ISC_LOG_DEBUG(3), "dns_request_createvia"); + if (srcaddr != NULL && + isc_sockaddr_pf(srcaddr) != isc_sockaddr_pf(destaddr)) + return (ISC_R_FAMILYMISMATCH); + if (isblackholed(requestmgr->dispatchmgr, destaddr)) return (DNS_R_BLACKHOLED);