From c1afda90dd79b98367107633d387abc265dfca60 Mon Sep 17 00:00:00 2001 From: jakob <> Date: Tue, 31 Jul 2001 22:02:18 +0000 Subject: add support for EDNS0 extended flag DNSSEC OK (aka DO). ok deraadt@ --- src/lib/libc/net/res_mkquery.c | 17 +++++++++++++---- src/lib/libc/net/res_query.c | 9 ++++++--- 2 files changed, 19 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/lib/libc/net/res_mkquery.c b/src/lib/libc/net/res_mkquery.c index 61595a6e8c..e414b5060d 100644 --- a/src/lib/libc/net/res_mkquery.c +++ b/src/lib/libc/net/res_mkquery.c @@ -1,4 +1,4 @@ -/* $OpenBSD: res_mkquery.c,v 1.9 2001/06/11 10:06:00 itojun Exp $ */ +/* $OpenBSD: res_mkquery.c,v 1.10 2001/07/31 22:02:18 jakob Exp $ */ /* * ++Copyright++ 1985, 1993 @@ -60,7 +60,7 @@ static char sccsid[] = "@(#)res_mkquery.c 8.1 (Berkeley) 6/4/93"; static char rcsid[] = "$From: res_mkquery.c,v 8.5 1996/08/27 08:33:28 vixie Exp $"; #else -static char rcsid[] = "$OpenBSD: res_mkquery.c,v 1.9 2001/06/11 10:06:00 itojun Exp $"; +static char rcsid[] = "$OpenBSD: res_mkquery.c,v 1.10 2001/07/31 22:02:18 jakob Exp $"; #endif #endif /* LIBC_SCCS and not lint */ @@ -221,8 +221,17 @@ res_opt(n0, buf, buflen, anslen) cp += INT16SZ; *cp++ = NOERROR; /* extended RCODE */ *cp++ = 0; /* EDNS version */ - __putshort(0, cp); /* MBZ */ - cp += INT16SZ; + if (_res.options & RES_USE_DNSSEC) { +#ifdef DEBUG + if (_res.options & RES_DEBUG) + printf(";; res_opt()... ENDS0 DNSSEC OK\n"); +#endif /* DEBUG */ + __putshort(DNS_MESSAGEEXTFLAG_DO, cp); /* EDNS Z field */ + cp += INT16SZ; + } else { + __putshort(0, cp); /* EDNS Z field */ + cp += INT16SZ; + } __putshort(0, cp); /* RDLEN */ cp += INT16SZ; hp->arcount = htons(ntohs(hp->arcount) + 1); diff --git a/src/lib/libc/net/res_query.c b/src/lib/libc/net/res_query.c index db76821fc6..3cf7928302 100644 --- a/src/lib/libc/net/res_query.c +++ b/src/lib/libc/net/res_query.c @@ -1,4 +1,4 @@ -/* $OpenBSD: res_query.c,v 1.15 2001/06/27 00:58:55 lebel Exp $ */ +/* $OpenBSD: res_query.c,v 1.16 2001/07/31 22:02:18 jakob 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.15 2001/06/27 00:58:55 lebel Exp $"; +static char rcsid[] = "$OpenBSD: res_query.c,v 1.16 2001/07/31 22:02:18 jakob Exp $"; #endif #endif /* LIBC_SCCS and not lint */ @@ -123,8 +123,11 @@ 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) + if (n > 0 && ((_res.options & RES_USE_EDNS0) || + (_res.options & RES_USE_DNSSEC))) { n = res_opt(n, buf, sizeof(buf), anslen); + } + if (n <= 0) { #ifdef DEBUG if (_res.options & RES_DEBUG) -- cgit v1.2.3-55-g6feb