1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-07 06:43:00 +03:00

support: Provide a way to clear the RA bit in DNS server responses

This commit is contained in:
Florian Weimer
2020-10-14 10:54:39 +02:00
parent 873e239a4c
commit 08443b1996
2 changed files with 7 additions and 1 deletions

View File

@@ -181,7 +181,9 @@ resolv_response_init (struct resolv_response_builder *b,
b->buffer[2] |= b->query_buffer[2] & 0x01; /* Copy the RD bit. */ b->buffer[2] |= b->query_buffer[2] & 0x01; /* Copy the RD bit. */
if (flags.tc) if (flags.tc)
b->buffer[2] |= 0x02; b->buffer[2] |= 0x02;
b->buffer[3] = 0x80 | flags.rcode; /* Always set RA. */ b->buffer[3] = flags.rcode;
if (!flags.clear_ra)
b->buffer[3] |= 0x80;
if (flags.ad) if (flags.ad)
b->buffer[3] |= 0x20; b->buffer[3] |= 0x20;

View File

@@ -148,6 +148,10 @@ struct resolv_response_flags
/* If true, the AD (authenticated data) flag will be set. */ /* If true, the AD (authenticated data) flag will be set. */
bool ad; bool ad;
/* If true, do not set the RA (recursion available) flag in the
response. */
bool clear_ra;
/* Initial section count values. Can be used to artificially /* Initial section count values. Can be used to artificially
increase the counts, for malformed packet testing.*/ increase the counts, for malformed packet testing.*/
unsigned short qdcount; unsigned short qdcount;