[PATCH][BZ #13928] Use minimum ttl value from dns query
Siddhesh Poyarekar
siddhesh@redhat.com
Thu Mar 29 09:19:00 GMT 2012
Hi,
When a queried dns name is a CNAME record with a TTL, the TTL of the A
or AAAA record that the CNAME finally resolves to is considered as its
TTL, which results in incorrect cache timeouts for such CNAME records
in nscd.
AFAICT, the ttl is only used by nscd and this behaviour affects how long
nscd caches a DNS entry before it looks to reload it. The correct
approach in this case for nscd ought to be to have the minimum of the
TTL values in the entire chain of results (CNAME -> CNAME -> ... ->
A|AAAA) as the cache timeout value for the DNS entry.
The bugzilla has detailed steps to reproduce the problem and verify
the fix. I have tested the patch with HEAD and it gives the minimum ttl
value. Following scenarios (dns entries) were tested to confirm minimum
ttl values. The default ttl is 1200 and zone is foo.net (as detailed in
the bz):
* query bad.foo.net and cad.foo.net:
ad IN AAAA ::8
cad 30 IN CNAME ad
bad 15 IN CNAME cad
* query bad.foo.net and cad.foo.net:
ad IN A 1.0.0.1
cad 30 IN CNAME ad
bad 15 IN CNAME cad
* query bed.foo.net and ced.foo.net
ed IN AAAA ::9
ced 15 IN CNAME ed
bed 30 IN CNAME ced
* query id.foo.net and od.foo.net
id 15 A 1.0.0.1
od 15 AAAA ::1
Regards,
Siddhesh
ChangeLog:
2012-03-29 Siddhesh Poyarekar <siddhesh@redhat.com>
[BZ #13928]
* resolv/nss_dns/dns-host.c (getanswer_r): Also consider ttl
from a CNAME entry and return the minimum ttl for the query.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Use-the-TTL-value-of-the-CNAME-record.patch
Type: text/x-patch
Size: 1156 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20120329/de46b6ea/attachment.bin>
More information about the Libc-alpha
mailing list