]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
resolved: don't discard mDNS queries with bad flags
authorSergey Bugaev <bugaevc@gmail.com>
Fri, 19 Feb 2021 12:29:02 +0000 (15:29 +0300)
committerLennart Poettering <lennart@poettering.net>
Wed, 24 Feb 2021 16:17:03 +0000 (17:17 +0100)
Even though RFC 6762 specifies these bits MUST be zero, it also says they MUST
be ignored on reception.

src/resolve/resolved-dns-packet.c

index a51514a8de894be5df7c231c7e99567861ca17ee..9778f5ee6b5645b248eb388149b3ed73a86c8a20 100644 (file)
@@ -326,13 +326,10 @@ int dns_packet_validate_query(DnsPacket *p) {
                 break;
 
         case DNS_PROTOCOL_MDNS:
-                /* RFC 6762, Section 18 */
-                if (DNS_PACKET_AA(p)    != 0 ||
-                    DNS_PACKET_RD(p)    != 0 ||
-                    DNS_PACKET_RA(p)    != 0 ||
-                    DNS_PACKET_AD(p)    != 0 ||
-                    DNS_PACKET_CD(p)    != 0 ||
-                    DNS_PACKET_RCODE(p) != 0)
+                /* RFC 6762, Section 18 specifies that messages with non-zero RCODE
+                 * must be silently ignored, and that we must ignore the values of
+                 * AA, RD, RA, AD, and CD bits. */
+                if (DNS_PACKET_RCODE(p) != 0)
                         return -EBADMSG;
 
                 break;