resolved: make sure the packet's transaction ID is always 0 for mDNS
authorDaniel Mack <daniel@zonque.org>
Thu, 10 Dec 2015 14:59:30 +0000 (15:59 +0100)
committerDaniel Mack <daniel@zonque.org>
Thu, 10 Dec 2015 15:32:03 +0000 (16:32 +0100)
RFC6762, 18.1:

   In multicast query messages, the Query Identifier SHOULD be set to
   zero on transmission.

src/resolve/resolved-dns-scope.c
src/resolve/resolved-dns-transaction.c

index 4d83ac5..bf49c51 100644 (file)
@@ -818,7 +818,11 @@ static int dns_scope_make_conflict_packet(
                                                               0 /* (ad) */,
                                                               0 /* (cd) */,
                                                               0));
-        random_bytes(&DNS_PACKET_HEADER(p)->id, sizeof(uint16_t));
+
+        /* For mDNS, the transaction ID should always be 0 */
+        if (s->protocol != DNS_PROTOCOL_MDNS)
+                random_bytes(&DNS_PACKET_HEADER(p)->id, sizeof(uint16_t));
+
         DNS_PACKET_HEADER(p)->qdcount = htobe16(1);
         DNS_PACKET_HEADER(p)->arcount = htobe16(1);
 
index 90f07e6..05fce99 100644 (file)
@@ -819,7 +819,6 @@ static int dns_transaction_make_packet_mdns(DnsTransaction *t) {
         }
 
         DNS_PACKET_HEADER(p)->qdcount = htobe16(qdcount);
-        DNS_PACKET_HEADER(p)->id = t->id;
 
         /* Append known answer section if we're asking for any shared record */
         if (add_known_answers) {