|
|
446cf2 |
Backport the support/ changes from this commit, to avoid future
|
|
|
446cf2 |
conflicts:
|
|
|
446cf2 |
|
|
|
446cf2 |
commit 446997ff1433d33452b81dfa9e626b8dccf101a4
|
|
|
446cf2 |
Author: Florian Weimer <fweimer@redhat.com>
|
|
|
446cf2 |
Date: Wed Oct 30 17:26:58 2019 +0100
|
|
|
446cf2 |
|
|
|
446cf2 |
resolv: Implement trust-ad option for /etc/resolv.conf [BZ #20358]
|
|
|
446cf2 |
|
|
|
446cf2 |
This introduces a concept of trusted name servers, for which the
|
|
|
446cf2 |
AD bit is passed through to applications. For untrusted name
|
|
|
446cf2 |
servers (the default), the AD bit in responses are cleared, to
|
|
|
446cf2 |
provide a safe default.
|
|
|
446cf2 |
|
|
|
446cf2 |
This approach is very similar to the one suggested by Pavel Šimerda
|
|
|
446cf2 |
in <https://bugzilla.redhat.com/show_bug.cgi?id=1164339#c15>.
|
|
|
446cf2 |
|
|
|
446cf2 |
The DNS test framework in support/ is enhanced with support for
|
|
|
446cf2 |
setting the AD bit in responses.
|
|
|
446cf2 |
|
|
|
446cf2 |
Tested on x86_64-linux-gnu.
|
|
|
446cf2 |
|
|
|
446cf2 |
Change-Id: Ibfe0f7c73ea221c35979842c5c3b6ed486495ccc
|
|
|
446cf2 |
|
|
|
446cf2 |
diff --git a/support/resolv_test.c b/support/resolv_test.c
|
|
|
446cf2 |
index 3f2a09f36f445878..28af227cb5ed901c 100644
|
|
|
446cf2 |
--- a/support/resolv_test.c
|
|
|
446cf2 |
+++ b/support/resolv_test.c
|
|
|
446cf2 |
@@ -182,6 +182,8 @@ resolv_response_init (struct resolv_response_builder *b,
|
|
|
446cf2 |
if (flags.tc)
|
|
|
446cf2 |
b->buffer[2] |= 0x02;
|
|
|
446cf2 |
b->buffer[3] = 0x80 | flags.rcode; /* Always set RA. */
|
|
|
446cf2 |
+ if (flags.ad)
|
|
|
446cf2 |
+ b->buffer[3] |= 0x20;
|
|
|
446cf2 |
|
|
|
446cf2 |
/* Fill in the initial section count values. */
|
|
|
446cf2 |
b->buffer[4] = flags.qdcount >> 8;
|
|
|
446cf2 |
diff --git a/support/resolv_test.h b/support/resolv_test.h
|
|
|
446cf2 |
index 4c2e6c1b417f5fcd..be736aead40cd0cc 100644
|
|
|
446cf2 |
--- a/support/resolv_test.h
|
|
|
446cf2 |
+++ b/support/resolv_test.h
|
|
|
446cf2 |
@@ -134,6 +134,9 @@ struct resolv_response_flags
|
|
|
446cf2 |
/* If true, the TC (truncation) flag will be set. */
|
|
|
446cf2 |
bool tc;
|
|
|
446cf2 |
|
|
|
446cf2 |
+ /* If true, the AD (authenticated data) flag will be set. */
|
|
|
446cf2 |
+ bool ad;
|
|
|
446cf2 |
+
|
|
|
446cf2 |
/* Initial section count values. Can be used to artificially
|
|
|
446cf2 |
increase the counts, for malformed packet testing.*/
|
|
|
446cf2 |
unsigned short qdcount;
|