This is required by RFC 6762.
Fixes https://github.com/systemd/systemd/issues/17972
_cleanup_(dns_packet_unrefp) DnsPacket *p = NULL;
unsigned n_answer = 0, n_soa = 0;
int r;
+ bool c_or_aa;
assert(s);
assert(ret);
if (r < 0)
return r;
+ /* mDNS answers must have the Authoritative Answer bit set, see RFC 6762, section 18.4. */
+ c_or_aa = s->protocol == DNS_PROTOCOL_MDNS;
+
DNS_PACKET_HEADER(p)->id = id;
DNS_PACKET_HEADER(p)->flags = htobe16(DNS_PACKET_MAKE_FLAGS(
1 /* qr */,
0 /* opcode */,
- 0 /* c */,
+ c_or_aa,
0 /* tc */,
tentative,
0 /* (ra) */,