]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
resolved: reset RR TTL to 0, if MSB is set
authorLennart Poettering <lennart@poettering.net>
Tue, 29 Dec 2015 18:00:53 +0000 (19:00 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 29 Dec 2015 20:42:09 +0000 (21:42 +0100)
RFC 2181, Section 8 suggests to treat an RR TTL with the MSB set as 0.
Implement this.

src/resolve/resolved-dns-packet.c

index 5f7970129610e3c4708fb227d4111ed0bf2f0d5b..b0c70d0017bf4be0eea58a78c0244c76e3b276b6 100644 (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;