summaryrefslogtreecommitdiffstats
path: root/src/resolve
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-16 18:18:34 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-16 18:18:34 +0000
commit67497cedb2f732b3445ecdc0d09b881f9c69f852 (patch)
treeb7197679acca419c7ddc0300873e19141d5fae3e /src/resolve
parentAdding debian version 256.1-2. (diff)
downloadsystemd-67497cedb2f732b3445ecdc0d09b881f9c69f852.tar.xz
systemd-67497cedb2f732b3445ecdc0d09b881f9c69f852.zip
Merging upstream version 256.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/resolve')
-rw-r--r--src/resolve/resolved-dns-packet.c6
-rw-r--r--src/resolve/resolved-dns-packet.h2
2 files changed, 4 insertions, 4 deletions
diff --git a/src/resolve/resolved-dns-packet.c b/src/resolve/resolved-dns-packet.c
index e626740..e446461 100644
--- a/src/resolve/resolved-dns-packet.c
+++ b/src/resolve/resolved-dns-packet.c
@@ -1804,9 +1804,9 @@ int dns_packet_read_rr(
if (r < 0)
return r;
- /* RFC 2181, Section 8, suggests to
- * treat a TTL with the MSB set as a zero TTL. */
- if (rr->ttl & UINT32_C(0x80000000))
+ /* RFC 2181, Section 8, suggests to treat a TTL with the MSB set as a zero TTL. We avoid doing this
+ * for OPT records so that all 8 bits of the extended RCODE may be used .*/
+ if (key->type != DNS_TYPE_OPT && rr->ttl & UINT32_C(0x80000000))
rr->ttl = 0;
r = dns_packet_read_uint16(p, &rdlength, NULL);
diff --git a/src/resolve/resolved-dns-packet.h b/src/resolve/resolved-dns-packet.h
index 393b7b2..1b649af 100644
--- a/src/resolve/resolved-dns-packet.h
+++ b/src/resolve/resolved-dns-packet.h
@@ -117,7 +117,7 @@ static inline uint16_t DNS_PACKET_RCODE(DnsPacket *p) {
uint16_t rcode;
if (p->opt)
- rcode = (uint16_t) (p->opt->ttl >> 24);
+ rcode = (uint16_t) ((p->opt->ttl >> 20) & 0xFF0);
else
rcode = 0;