Add additional logging about xfrin transfer status (#39170)

(cherry picked from commit ac31adc3b7)
(cherry picked from commit 6065cb0858)
This commit is contained in:
Mukund Sivaraman
2015-04-14 12:24:14 +05:30
parent 9087397f01
commit 182a53d7dd
4 changed files with 59 additions and 3 deletions
+3
View File
@@ -1,3 +1,6 @@
4097. [func] Add additional logging about xfrin transfer status.
[RT #39170]
4096. [bug] Fix a use after free of query->sendevent.
[RT #39132]
+1 -1
View File
@@ -31,7 +31,7 @@ while true; do
exit 1
fi
if grep "example.nil/IN.*Transfer completed" ns2/named.run > /dev/null
if grep "example.nil/IN.*Transfer status" ns2/named.run > /dev/null
then
break
else
+38 -1
View File
@@ -235,7 +235,7 @@ $SENDCMD < ans5/goodaxfr
sleep 1
# Initially, ns4 is not authoritative for anything.
# Now that ans is up and running with the right data, we make it
# Now that ans is up and running with the right data, we make ns4
# a slave for nil.
cat <<EOF >>ns4/named.conf
@@ -248,6 +248,7 @@ EOF
$RNDCCMD reload | sed 's/^/I:ns4 /'
cur=`wc -l < ns4/named.run`
for i in 0 1 2 3 4 5 6 7 8 9
do
@@ -256,6 +257,12 @@ do
sleep 1
done
tail -n +"$cur" < ns4/named.run | grep "Transfer status: success" > /dev/null || {
echo "I: failed: expected status was not logged"
status=1
}
cur=`wc -l < ns4/named.run`
$DIGCMD nil. TXT | grep 'initial AXFR' >/dev/null || {
echo "I:failed"
status=1
@@ -270,6 +277,12 @@ $RNDCCMD retransfer nil | sed 's/^/I:ns4 /'
sleep 2
tail -n +"$cur" < ns4/named.run | grep "Transfer status: expected a TSIG or SIG(0)" > /dev/null || {
echo "I: failed: expected status was not logged"
status=1
}
cur=`wc -l < ns4/named.run`
$DIGCMD nil. TXT | grep 'unsigned AXFR' >/dev/null && {
echo "I:failed"
status=1
@@ -284,6 +297,12 @@ $RNDCCMD retransfer nil | sed 's/^/I:ns4 /'
sleep 2
tail -n +"$cur" < ns4/named.run | grep "Transfer status: tsig verify failure" > /dev/null || {
echo "I: failed: expected status was not logged"
status=1
}
cur=`wc -l < ns4/named.run`
$DIGCMD nil. TXT | grep 'bad keydata AXFR' >/dev/null && {
echo "I:failed"
status=1
@@ -298,6 +317,12 @@ $RNDCCMD retransfer nil | sed 's/^/I:ns4 /'
sleep 2
tail -n +"$cur" < ns4/named.run | grep "Transfer status: expected a TSIG or SIG(0)" > /dev/null || {
echo "I: failed: expected status was not logged"
status=1
}
cur=`wc -l < ns4/named.run`
$DIGCMD nil. TXT | grep 'partially signed AXFR' >/dev/null && {
echo "I:failed"
status=1
@@ -312,6 +337,12 @@ $RNDCCMD retransfer nil | sed 's/^/I:ns4 /'
sleep 2
tail -n +"$cur" < ns4/named.run | grep "tsig key 'tsig_key': key name and algorithm do not match" > /dev/null || {
echo "I: failed: expected status was not logged"
status=1
}
cur=`wc -l < ns4/named.run`
$DIGCMD nil. TXT | grep 'unknown key AXFR' >/dev/null && {
echo "I:failed"
status=1
@@ -326,6 +357,12 @@ $RNDCCMD retransfer nil | sed 's/^/I:ns4 /'
sleep 2
tail -n +"$cur" < ns4/named.run | grep "tsig key 'tsig_key': key name and algorithm do not match" > /dev/null || {
echo "I: failed: expected status was not logged"
status=1
}
cur=`wc -l < ns4/named.run`
$DIGCMD nil. TXT | grep 'incorrect key AXFR' >/dev/null && {
echo "I:failed"
status=1
+17 -1
View File
@@ -107,6 +107,7 @@ struct dns_xfrin_ctx {
int sends; /*%< Send in progress */
int recvs; /*%< Receive in progress */
isc_boolean_t shuttingdown;
isc_result_t shutdown_result;
dns_name_t name; /*%< Name of zone to transfer */
dns_rdataclass_t rdclass;
@@ -657,7 +658,8 @@ dns_xfrin_create2(dns_zone_t *zone, dns_rdatatype_t xfrtype,
CHECK(xfrin_start(xfr));
xfr->done = done;
xfr->refcount++;
if (xfr->done != NULL)
xfr->refcount++;
*xfrp = xfr;
failure:
@@ -762,6 +764,7 @@ xfrin_fail(dns_xfrin_ctx_t *xfr, isc_result_t result, const char *msg) {
xfr->done = NULL;
}
xfr->shuttingdown = ISC_TRUE;
xfr->shutdown_result = result;
maybe_free(xfr);
}
@@ -802,6 +805,7 @@ xfrin_create(isc_mem_t *mctx,
xfr->sends = 0;
xfr->recvs = 0;
xfr->shuttingdown = ISC_FALSE;
xfr->shutdown_result = ISC_R_UNSET;
dns_name_init(&xfr->name, NULL);
xfr->rdclass = rdclass;
@@ -1365,6 +1369,7 @@ xfrin_recv_done(isc_task_t *task, isc_event_t *ev) {
* point, thus maybe_free() should succeed.
*/
xfr->shuttingdown = ISC_TRUE;
xfr->shutdown_result = ISC_R_SUCCESS;
maybe_free(xfr);
break;
default:
@@ -1403,6 +1408,7 @@ static void
maybe_free(dns_xfrin_ctx_t *xfr) {
isc_uint64_t msecs;
isc_uint64_t persec;
const char *result_str;
REQUIRE(VALID_XFRIN(xfr));
@@ -1411,6 +1417,16 @@ maybe_free(dns_xfrin_ctx_t *xfr) {
xfr->recvs != 0)
return;
INSIST(! xfr->shuttingdown || xfr->shutdown_result != ISC_R_UNSET);
/* If we're called through dns_xfrin_detach() and are not
* shutting down, we can't know what the transfer status is as
* we are only called when the last reference is lost.
*/
result_str = (xfr->shuttingdown ?
isc_result_totext(xfr->shutdown_result) : "unknown");
xfrin_log(xfr, ISC_LOG_INFO, "Transfer status: %s", result_str);
/*
* Calculate the length of time the transfer took,
* and print a log message with the bytes and rate.