From 21c23707d17ed24f945fca316d19de534e68dd8e Mon Sep 17 00:00:00 2001 From: brad Date: Mon, 26 Jan 2015 12:06:40 +0000 Subject: [PATCH] Merge in a commit from upstream.. - Synthesize CNAMEs with same TTL as DNAME. ok sthen@ --- usr.sbin/nsd/query.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/usr.sbin/nsd/query.c b/usr.sbin/nsd/query.c index f8cb1b496c0..07b02d72511 100644 --- a/usr.sbin/nsd/query.c +++ b/usr.sbin/nsd/query.c @@ -705,7 +705,7 @@ add_rrset(struct query *query, static size_t query_synthesize_cname(struct query* q, struct answer* answer, const dname_type* from_name, const dname_type* to_name, domain_type* src, domain_type* to_closest_encloser, - domain_type** to_closest_match) + domain_type** to_closest_match, uint32_t ttl) { /* add temporary domains for from_name and to_name and all their (not allocated yet) parents */ @@ -767,7 +767,7 @@ query_synthesize_cname(struct query* q, struct answer* answer, const dname_type* rrset->rrs = (rr_type*) region_alloc(q->region, sizeof(rr_type)); memset(rrset->rrs, 0, sizeof(rr_type)); rrset->rrs->owner = cname_domain; - rrset->rrs->ttl = 0; + rrset->rrs->ttl = ttl; rrset->rrs->type = TYPE_CNAME; rrset->rrs->klass = CLASS_IN; rrset->rrs->rdata_count = 1; @@ -1022,7 +1022,7 @@ answer_authoritative(struct nsd *nsd, exact = namedb_lookup(nsd->db, newname, &closest_match, &closest_encloser); /* synthesize CNAME record */ newnum = query_synthesize_cname(q, answer, name, newname, - src, closest_encloser, &closest_match); + src, closest_encloser, &closest_match, rrset->rrs[0].ttl); if(!newnum) { /* could not synthesize the CNAME. */ /* return previous CNAMEs to make resolver recurse for us */ -- 2.20.1