summaryrefslogtreecommitdiff
path: root/src/resolve/resolved-dns-packet.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-12-29 19:00:53 +0100
committerLennart Poettering <lennart@poettering.net>2015-12-29 21:42:09 +0100
commit0d0b52d79c2e9a79aeff9a9cca877de8b4fcbd16 (patch)
treeab975a5e83a896d8ec63137b7e0e76c86aad52e1 /src/resolve/resolved-dns-packet.c
parent9a1f0c283bac56eb26a2fa02d62e0e9ece82f25a (diff)
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.
Diffstat (limited to 'src/resolve/resolved-dns-packet.c')
-rw-r--r--src/resolve/resolved-dns-packet.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/resolve/resolved-dns-packet.c b/src/resolve/resolved-dns-packet.c
index 5f79701296..b0c70d0017 100644
--- a/src/resolve/resolved-dns-packet.c
+++ b/src/resolve/resolved-dns-packet.c
@@ -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;