summaryrefslogtreecommitdiff
path: root/lib/libc/asr
diff options
context:
space:
mode:
authorJeremie Courreges-Anglas <jca@cvs.openbsd.org>2017-02-27 11:31:02 +0000
committerJeremie Courreges-Anglas <jca@cvs.openbsd.org>2017-02-27 11:31:02 +0000
commit9edc258191f4552fdf21290b3257df0602093054 (patch)
treea31ea856d5e4e33deb3231d0bd59c581cee15a19 /lib/libc/asr
parente70c07db38bac3044c7e116b4d83a122829834a8 (diff)
Recognize and allow bits AD and CD in DNS replies.
Needed for RES_USE_DNSSEC support. ok eric@ gilles@
Diffstat (limited to 'lib/libc/asr')
-rw-r--r--lib/libc/asr/asr_debug.c9
-rw-r--r--lib/libc/asr/asr_private.h6
2 files changed, 9 insertions, 6 deletions
diff --git a/lib/libc/asr/asr_debug.c b/lib/libc/asr/asr_debug.c
index 0c5f2823331..1591bd204c1 100644
--- a/lib/libc/asr/asr_debug.c
+++ b/lib/libc/asr/asr_debug.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: asr_debug.c,v 1.23 2017/02/17 22:24:45 eric Exp $ */
+/* $OpenBSD: asr_debug.c,v 1.24 2017/02/27 11:31:01 jca Exp $ */
/*
* Copyright (c) 2012 Eric Faurot <eric@openbsd.org>
*
@@ -37,7 +37,6 @@ static const char *print_rr(const struct asr_dns_rr *, char *, size_t);
FILE *_asr_debug = NULL;
#define OPCODE_SHIFT 11
-#define Z_SHIFT 4
static const char *
rcodetostr(uint16_t v)
@@ -147,7 +146,7 @@ static const char *
print_header(const struct asr_dns_header *h, char *buf, size_t max)
{
snprintf(buf, max,
- "id:0x%04x %s op:%i %s %s %s %s z:%i r:%s qd:%i an:%i ns:%i ar:%i",
+ "id:0x%04x %s op:%i %s %s %s %s z:%i %s %s r:%s qd:%i an:%i ns:%i ar:%i",
((int)h->id),
(h->flags & QR_MASK) ? "QR":" ",
(int)(OPCODE(h->flags) >> OPCODE_SHIFT),
@@ -155,7 +154,9 @@ print_header(const struct asr_dns_header *h, char *buf, size_t max)
(h->flags & TC_MASK) ? "TC":" ",
(h->flags & RD_MASK) ? "RD":" ",
(h->flags & RA_MASK) ? "RA":" ",
- ((h->flags & Z_MASK) >> Z_SHIFT),
+ (h->flags & Z_MASK),
+ (h->flags & AD_MASK) ? "AD":" ",
+ (h->flags & CD_MASK) ? "CD":" ",
rcodetostr(RCODE(h->flags)),
h->qdcount, h->ancount, h->nscount, h->arcount);
diff --git a/lib/libc/asr/asr_private.h b/lib/libc/asr/asr_private.h
index 6b4198933ec..80baf031890 100644
--- a/lib/libc/asr/asr_private.h
+++ b/lib/libc/asr/asr_private.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: asr_private.h,v 1.44 2017/02/27 10:44:46 jca Exp $ */
+/* $OpenBSD: asr_private.h,v 1.45 2017/02/27 11:31:01 jca Exp $ */
/*
* Copyright (c) 2012 Eric Faurot <eric@openbsd.org>
*
@@ -23,7 +23,9 @@
#define TC_MASK (0x1 << 9)
#define RD_MASK (0x1 << 8)
#define RA_MASK (0x1 << 7)
-#define Z_MASK (0x7 << 4)
+#define Z_MASK (0x1 << 6)
+#define AD_MASK (0x1 << 5)
+#define CD_MASK (0x1 << 4)
#define RCODE_MASK (0xf)
#define OPCODE(v) ((v) & OPCODE_MASK)