aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2020-10-14 10:54:39 +0200
committerSergei Trofimovich <slyfox@gentoo.org>2020-12-07 20:03:15 +0000
commitf5d4fcb1c6c8a40827b6a5c579c7da4376715346 (patch)
tree9c40e5decd72b9a018fd9d2f91d0508b3a82071d
parentsupport: Provide a way to reorder responses within the DNS test server (diff)
downloadglibc-f5d4fcb1c6c8a40827b6a5c579c7da4376715346.tar.gz
glibc-f5d4fcb1c6c8a40827b6a5c579c7da4376715346.tar.bz2
glibc-f5d4fcb1c6c8a40827b6a5c579c7da4376715346.zip
support: Provide a way to clear the RA bit in DNS server responses
(cherry picked from commit 08443b19965f48862b02c2fd7b33a39d66daf2ff)
-rw-r--r--support/resolv_test.c4
-rw-r--r--support/resolv_test.h4
2 files changed, 7 insertions, 1 deletions
diff --git a/support/resolv_test.c b/support/resolv_test.c
index e343c4b516..9878a040a3 100644
--- a/support/resolv_test.c
+++ b/support/resolv_test.c
@@ -181,7 +181,9 @@ resolv_response_init (struct resolv_response_builder *b,
b->buffer[2] |= b->query_buffer[2] & 0x01; /* Copy the RD bit. */
if (flags.tc)
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)
b->buffer[3] |= 0x20;
diff --git a/support/resolv_test.h b/support/resolv_test.h
index c46de32ff4..31a5c1c3e7 100644
--- a/support/resolv_test.h
+++ b/support/resolv_test.h
@@ -148,6 +148,10 @@ struct resolv_response_flags
/* If true, the AD (authenticated data) flag will be set. */
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
increase the counts, for malformed packet testing.*/
unsigned short qdcount;