2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 05:57:52 +00:00

4434. [protocol] Return EDNS EXPIRE option for master zones in addition

to slave zones. [RT #43008]
This commit is contained in:
Mark Andrews 2016-08-12 09:31:41 +10:00
parent c38d989fdd
commit bf2238b064
3 changed files with 26 additions and 10 deletions

View File

@ -1,3 +1,6 @@
4434. [protocol] Return EDNS EXPIRE option for master zones in addition
to slave zones. [RT #43008]
4433. [cleanup] Report an error when passing an invalid option or
view name to "rndc dumpdb". [RT #42958]

View File

@ -8699,21 +8699,17 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
client->query.attributes &= ~NS_QUERYATTR_NOADDITIONAL;
/*
* Return the time to expire for slave zones.
* Return the time to expire for slave and master zones.
*/
if (zone != NULL) {
if (zone != NULL && is_zone && qtype == dns_rdatatype_soa &&
(client->attributes & NS_CLIENTATTR_WANTEXPIRE) != 0 &&
client->query.restarts == 0) {
dns_zone_t *raw = NULL, *mayberaw;
if (is_zone)
dns_zone_getraw(zone, &raw);
dns_zone_getraw(zone, &raw);
mayberaw = (raw != NULL) ? raw : zone;
if (is_zone && qtype == dns_rdatatype_soa &&
((client->attributes &
NS_CLIENTATTR_WANTEXPIRE) != 0) &&
client->query.restarts == 0 &&
dns_zone_gettype(mayberaw) == dns_zone_slave)
{
if (dns_zone_gettype(mayberaw) == dns_zone_slave) {
isc_time_t expiretime;
isc_uint32_t secs;
dns_zone_getexpiretime(zone, &expiretime);
@ -8725,6 +8721,16 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
client->expire = secs - client->now;
}
}
if (dns_zone_gettype(mayberaw) == dns_zone_master) {
dns_rdata_soa_t soa;
result = dns_rdataset_first(rdataset);
RUNTIME_CHECK(result == ISC_R_SUCCESS);
dns_rdataset_current(rdataset, &rdata);
result = dns_rdata_tostruct(&rdata, &soa, NULL);
RUNTIME_CHECK(result == ISC_R_SUCCESS);
client->expire = soa.expire;
client->attributes |= NS_CLIENTATTR_HAVEEXPIRE;
}
if (raw != NULL)
dns_zone_detach(&raw);
}

View File

@ -208,6 +208,13 @@ awk '/plain success\/timeout/ {getline; getline; if ($2 == "ns.flushtest.example
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
echo "I:check expire option returned from master zone"
ret=0
$DIG @10.53.0.1 -p 5300 +expire soa expire-test > dig.out.expire
grep EXPIRE: dig.out.expire > /dev/null || ret=1
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
echo "I:check expire option returned from slave zone"
ret=0
$DIG @10.53.0.2 -p 5300 +expire soa expire-test > dig.out.expire