resolved: reset RR TTL to 0, if MSB is set

RFC 2181, Section 8 suggests to treat an RR TTL with the MSB set as 0.
Implement this.
This commit is contained in:
Lennart Poettering 2015-12-29 19:00:53 +01:00
parent 9a1f0c283b
commit 0d0b52d79c

View file

@ -1580,6 +1580,11 @@ int dns_packet_read_rr(DnsPacket *p, DnsResourceRecord **ret, bool *ret_cache_fl
if (r < 0)
goto fail;
/* RFC 2181, Section 8, suggests to
* treat a TTL with the MSB set as a zero TTL. */
if (rr->ttl & UINT32_C(0x80000000))
rr->ttl = 0;
r = dns_packet_read_uint16(p, &rdlength, NULL);
if (r < 0)
goto fail;