Commit bf2238b0 authored by Mark Andrews's avatar Mark Andrews

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

                        to slave zones. [RT #43008]
parent c38d989f
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]
......
......@@ -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);
}
......
......@@ -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
......
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