Commit c6eb92be authored by Mark Andrews's avatar Mark Andrews
Browse files

3589. [func] Report serial numbers in when starting zone transfers.

                        Report accepted NOTIFY requests including serial.
                        [RT# 33037]
parent bf0441a3
3589. [func] Report serial numbers in when starting zone transfers.
Report accepted NOTIFY requests including serial.
[RT# 33037]
3588. [bug] dig: addressed a memory leak in the sigchase code
that could cause a shutdown crash. [RT #33733]
......
......@@ -755,6 +755,8 @@ ns_xfr_start(ns_client_t *client, dns_rdatatype_t reqtype) {
char keyname[DNS_NAME_FORMATSIZE];
isc_boolean_t is_poll = ISC_FALSE;
isc_boolean_t is_dlz = ISC_FALSE;
isc_boolean_t is_ixfr = ISC_FALSE;
isc_uint32_t begin_serial = 0, current_serial;
switch (reqtype) {
case dns_rdatatype_axfr:
......@@ -952,8 +954,8 @@ ns_xfr_start(ns_client_t *client, dns_rdatatype_t reqtype) {
CHECK(dns_db_createsoatuple(db, ver, mctx, DNS_DIFFOP_EXISTS,
&current_soa_tuple));
current_serial = dns_soa_getserial(&current_soa_tuple->rdata);
if (reqtype == dns_rdatatype_ixfr) {
isc_uint32_t begin_serial, current_serial;
isc_boolean_t provide_ixfr;
/*
......@@ -971,7 +973,6 @@ ns_xfr_start(ns_client_t *client, dns_rdatatype_t reqtype) {
"IXFR request missing SOA");
begin_serial = dns_soa_getserial(&soa_rdata);
current_serial = dns_soa_getserial(&current_soa_tuple->rdata);
/*
* RFC1995 says "If an IXFR query with the same or
......@@ -1010,10 +1011,10 @@ ns_xfr_start(ns_client_t *client, dns_rdatatype_t reqtype) {
goto axfr_fallback;
}
CHECK(result);
is_ixfr = ISC_TRUE;
} else {
axfr_fallback:
CHECK(axfr_rrstream_create(mctx, db, ver,
&data_stream));
CHECK(axfr_rrstream_create(mctx, db, ver, &data_stream));
}
/*
......@@ -1071,10 +1072,16 @@ ns_xfr_start(ns_client_t *client, dns_rdatatype_t reqtype) {
xfrout_log1(client, question_name, question_class,
ISC_LOG_DEBUG(1), "IXFR poll up to date%s%s",
(xfr->tsigkey != NULL) ? ": TSIG " : "", keyname);
else if (is_ixfr)
xfrout_log1(client, question_name, question_class,
ISC_LOG_INFO, "%s started%s%s (serial %u -> %u)",
mnemonic, (xfr->tsigkey != NULL) ? ": TSIG " : "",
keyname, begin_serial, current_serial);
else
xfrout_log1(client, question_name, question_class,
ISC_LOG_INFO, "%s started%s%s", mnemonic,
(xfr->tsigkey != NULL) ? ": TSIG " : "", keyname);
ISC_LOG_INFO, "%s started%s%s (serial %u)",
mnemonic, (xfr->tsigkey != NULL) ? ": TSIG " : "",
keyname, current_serial);
/*
* Hand the context over to sendstream(). Set xfr to NULL;
......
......@@ -62,6 +62,13 @@ cp -f ns2/example2.db ns2/example.db
kill -HUP `cat ns2/named.pid`
sleep 45
n=`expr $n + 1`
echo "I:checking notify message was logged ($n)"
ret=0
grep 'notify from 10.53.0.2#[0-9][0-9]*: serial 2$' ns3/named.run > /dev/null || ret=1
[ $ret = 0 ] || echo "I:failed"
status=`expr $ret + $status`
n=`expr $n + 1`
echo "I:checking example2 loaded ($n)"
ret=0
......@@ -98,6 +105,13 @@ $PERL $SYSTEMTESTTOP/start.pl --noclean --restart . ns2
sleep 45
n=`expr $n + 1`
echo "I:checking notify message was logged ($n)"
ret=0
grep 'notify from 10.53.0.2#[0-9][0-9]*: serial 4$' ns3/named.run > /dev/null || ret=1
[ $ret = 0 ] || echo "I:failed"
status=`expr $ret + $status`
n=`expr $n + 1`
echo "I:checking example4 loaded ($n)"
ret=0
......
......@@ -12011,6 +12011,8 @@ dns_zone_notifyreceive(dns_zone_t *zone, isc_sockaddr_t *from,
int match = 0;
isc_netaddr_t netaddr;
isc_sockaddr_t local, remote;
isc_uint32_t serial = 0;
isc_boolean_t have_serial = ISC_FALSE;
REQUIRE(DNS_ZONE_VALID(zone));
......@@ -12128,13 +12130,14 @@ dns_zone_notifyreceive(dns_zone_t *zone, isc_sockaddr_t *from,
if (result == ISC_R_SUCCESS)
result = dns_rdataset_first(rdataset);
if (result == ISC_R_SUCCESS) {
isc_uint32_t serial = 0, oldserial;
isc_uint32_t oldserial;
unsigned int soacount;
dns_rdataset_current(rdataset, &rdata);
result = dns_rdata_tostruct(&rdata, &soa, NULL);
RUNTIME_CHECK(result == ISC_R_SUCCESS);
serial = soa.serial;
have_serial = ISC_TRUE;
/*
* The following should safely be performed without DB
* lock and succeed in this context.
......@@ -12165,12 +12168,23 @@ dns_zone_notifyreceive(dns_zone_t *zone, isc_sockaddr_t *from,
DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_NEEDREFRESH);
zone->notifyfrom = *from;
UNLOCK_ZONE(zone);
dns_zone_log(zone, ISC_LOG_INFO,
"notify from %s: refresh in progress, "
"refresh check queued",
fromtext);
if (have_serial)
dns_zone_log(zone, ISC_LOG_INFO,
"notify from %s: serial %u: refresh in "
"progress, refresh check queued",
fromtext, serial);
else
dns_zone_log(zone, ISC_LOG_INFO,
"notify from %s: refresh in progress, "
"refresh check queued", fromtext);
return (ISC_R_SUCCESS);
}
if (have_serial)
dns_zone_log(zone, ISC_LOG_INFO, "notify from %s: serial %u",
fromtext, serial);
else
dns_zone_log(zone, ISC_LOG_INFO, "notify from %s: no serial",
fromtext);
zone->notifyfrom = *from;
local = zone->masteraddr;
remote = zone->sourceaddr;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment