summaryrefslogtreecommitdiffstats
path: root/lib/libc/asr/res_mkquery.c
diff options
context:
space:
mode:
authorjca <jca@openbsd.org>2017-02-18 19:23:05 +0000
committerjca <jca@openbsd.org>2017-02-18 19:23:05 +0000
commit2aa4cd219b1fae15f061ec9753d5a6990ec2ba48 (patch)
tree77639f64821e8dabbde640015c5277782230015d /lib/libc/asr/res_mkquery.c
parentAdd a regress test for the chflags problem analogous to the chmod bug (diff)
downloadwireguard-openbsd-2aa4cd219b1fae15f061ec9753d5a6990ec2ba48.tar.xz
wireguard-openbsd-2aa4cd219b1fae15f061ec9753d5a6990ec2ba48.zip
Add EDNS0 support.
EDNS allows for various DNS extensions, among which UDP DNS packets size bigger than 512 bytes. The default is still to not advertize anything. ok eric@
Diffstat (limited to 'lib/libc/asr/res_mkquery.c')
-rw-r--r--lib/libc/asr/res_mkquery.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/libc/asr/res_mkquery.c b/lib/libc/asr/res_mkquery.c
index 3b169c13194..340c1f11f74 100644
--- a/lib/libc/asr/res_mkquery.c
+++ b/lib/libc/asr/res_mkquery.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: res_mkquery.c,v 1.9 2015/09/09 15:49:34 deraadt Exp $ */
+/* $OpenBSD: res_mkquery.c,v 1.10 2017/02/18 19:23:05 jca Exp $ */
/*
* Copyright (c) 2012 Eric Faurot <eric@openbsd.org>
*
@@ -61,10 +61,14 @@ res_mkquery(int op, const char *dname, int class, int type,
if (ac->ac_options & RES_RECURSE)
h.flags |= RD_MASK;
h.qdcount = 1;
+ if (ac->ac_options & RES_USE_EDNS0)
+ h.arcount = 1;
_asr_pack_init(&p, buf, buflen);
_asr_pack_header(&p, &h);
_asr_pack_query(&p, type, class, dn);
+ if (ac->ac_options & RES_USE_EDNS0)
+ _asr_pack_edns0(&p, MAXPACKETSZ);
_asr_ctx_unref(ac);