1
0
mirror of https://github.com/systemd/systemd.git synced 2025-05-29 01:05:59 +03:00

Merge pull request #33523 from neighbourhoodie/fix/dns-opt-extended-rcode

Fix DNS OPT extended rcode parsing
This commit is contained in:
Luca Boccassi 2024-07-02 01:48:40 +02:00 committed by GitHub
commit aedc4f77d1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View File

@ -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);

View File

@ -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;