public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Florian Weimer <fw@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc] support: Provide a way to clear the RA bit in DNS server responses
Date: Wed, 14 Oct 2020 09:34:07 +0000 (GMT)	[thread overview]
Message-ID: <20201014093407.EA507385783A@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=08443b19965f48862b02c2fd7b33a39d66daf2ff

commit 08443b19965f48862b02c2fd7b33a39d66daf2ff
Author: Florian Weimer <fweimer@redhat.com>
Date:   Wed Oct 14 10:54:39 2020 +0200

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

Diff:
---
 support/resolv_test.c | 4 +++-
 support/resolv_test.h | 4 ++++
 2 files changed, 7 insertions(+), 1 deletion(-)

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;


                 reply	other threads:[~2020-10-14  9:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201014093407.EA507385783A@sourceware.org \
    --to=fw@sourceware.org \
    --cc=glibc-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).