diff options
author | 2001-07-31 22:02:18 +0000 | |
---|---|---|
committer | 2001-07-31 22:02:18 +0000 | |
commit | a572a86e93a9aa7912214affd56d604bdf6c36f8 (patch) | |
tree | 308c1223525bb430794e97d0f41a099b2e7d1912 /lib/libc | |
parent | Don't include a NUL at the end of our CHAP SUCCESS packet. (diff) | |
download | wireguard-openbsd-a572a86e93a9aa7912214affd56d604bdf6c36f8.tar.xz wireguard-openbsd-a572a86e93a9aa7912214affd56d604bdf6c36f8.zip |
add support for EDNS0 extended flag DNSSEC OK (aka DO). ok deraadt@
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/net/res_mkquery.c | 17 | ||||
-rw-r--r-- | lib/libc/net/res_query.c | 9 |
2 files changed, 19 insertions, 7 deletions
diff --git a/lib/libc/net/res_mkquery.c b/lib/libc/net/res_mkquery.c index 61595a6e8c5..e414b5060d9 100644 --- a/lib/libc/net/res_mkquery.c +++ b/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/lib/libc/net/res_query.c b/lib/libc/net/res_query.c index db76821fc69..3cf79283027 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.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) |