summaryrefslogtreecommitdiff
path: root/lib/libc/net/res_query.c
diff options
context:
space:
mode:
authorJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2001-06-11 10:06:05 +0000
committerJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2001-06-11 10:06:05 +0000
commit2661edd5e2d7a0106c9507f4de4c44d6fbe5102d (patch)
tree7a116003b29bcf48ddb6f76a18479bd911b44af3 /lib/libc/net/res_query.c
parent9f4fa9f45bad8232fea1393de0e5ddeb8b9d20c0 (diff)
support EDNS0 (RFC2671) buffer size notification on DNS queries.
"options edns0" in /etc/resolv.conf will enable the behavior. no behavior change if you don't have the line. see resolv.conf(5) for more details. EDNS0 is useful for avoiding TCP DNS queries/replies on larger DNS responses. also, draft-ietf-dnsext-message-size-* plans to mandate EDNS0 support for DNS clients that support IPv6 transport.
Diffstat (limited to 'lib/libc/net/res_query.c')
-rw-r--r--lib/libc/net/res_query.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/libc/net/res_query.c b/lib/libc/net/res_query.c
index 01d1f691cb7..433e80f6482 100644
--- a/lib/libc/net/res_query.c
+++ b/lib/libc/net/res_query.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: res_query.c,v 1.13 1999/09/27 23:58:26 alex Exp $ */
+/* $OpenBSD: res_query.c,v 1.14 2001/06/11 10:06:01 itojun Exp $ */
/*
* ++Copyright++ 1988, 1993
@@ -60,7 +60,7 @@
static char sccsid[] = "@(#)res_query.c 8.1 (Berkeley) 6/4/93";
static char rcsid[] = "$From: res_query.c,v 8.9 1996/09/22 00:13:28 vixie Exp $";
#else
-static char rcsid[] = "$OpenBSD: res_query.c,v 1.13 1999/09/27 23:58:26 alex Exp $";
+static char rcsid[] = "$OpenBSD: res_query.c,v 1.14 2001/06/11 10:06:01 itojun Exp $";
#endif
#endif /* LIBC_SCCS and not lint */
@@ -87,6 +87,7 @@ static char rcsid[] = "$OpenBSD: res_query.c,v 1.13 1999/09/27 23:58:26 alex Exp
const char *hostalias __P((const char *));
int h_errno;
+extern int res_opt __P((int, u_char *, int, int));
/*
* Formulate a normal query, send, and await answer.
@@ -122,6 +123,8 @@ res_query(name, class, type, answer, anslen)
n = res_mkquery(QUERY, name, class, type, NULL, 0, NULL,
buf, sizeof(buf));
+ if (n > 0 && (_res.options & RES_USE_EDNS0) != 0)
+ n = res_opt(n, buf, sizeof(buf), anslen);
if (n <= 0) {
#ifdef DEBUG
if (_res.options & RES_DEBUG)