resolved: make sure the packet's transaction ID is always 0 for mDNS

RFC6762, 18.1:

   In multicast query messages, the Query Identifier SHOULD be set to
   zero on transmission.
This commit is contained in:
Daniel Mack 2015-12-10 15:59:30 +01:00
parent 40fa4728eb
commit fe2dfc8b49
2 changed files with 5 additions and 2 deletions

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

View 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) {