diff options
author | jakob <> | 2001-07-31 22:02:18 +0000 |
---|---|---|
committer | jakob <> | 2001-07-31 22:02:18 +0000 |
commit | c1afda90dd79b98367107633d387abc265dfca60 (patch) | |
tree | f5c50e87b4f57f6f31955e16fb4f965395f6a095 | |
parent | 9881bf5c2b3e174de4860f9dbc618c83c94448ac (diff) | |
download | openbsd-c1afda90dd79b98367107633d387abc265dfca60.tar.gz openbsd-c1afda90dd79b98367107633d387abc265dfca60.tar.bz2 openbsd-c1afda90dd79b98367107633d387abc265dfca60.zip |
add support for EDNS0 extended flag DNSSEC OK (aka DO). ok deraadt@
-rw-r--r-- | src/lib/libc/net/res_mkquery.c | 17 | ||||
-rw-r--r-- | src/lib/libc/net/res_query.c | 9 |
2 files changed, 19 insertions, 7 deletions
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 @@ | |||
1 | /* $OpenBSD: res_mkquery.c,v 1.9 2001/06/11 10:06:00 itojun Exp $ */ | 1 | /* $OpenBSD: res_mkquery.c,v 1.10 2001/07/31 22:02:18 jakob Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * ++Copyright++ 1985, 1993 | 4 | * ++Copyright++ 1985, 1993 |
@@ -60,7 +60,7 @@ | |||
60 | static char sccsid[] = "@(#)res_mkquery.c 8.1 (Berkeley) 6/4/93"; | 60 | static char sccsid[] = "@(#)res_mkquery.c 8.1 (Berkeley) 6/4/93"; |
61 | static char rcsid[] = "$From: res_mkquery.c,v 8.5 1996/08/27 08:33:28 vixie Exp $"; | 61 | static char rcsid[] = "$From: res_mkquery.c,v 8.5 1996/08/27 08:33:28 vixie Exp $"; |
62 | #else | 62 | #else |
63 | static char rcsid[] = "$OpenBSD: res_mkquery.c,v 1.9 2001/06/11 10:06:00 itojun Exp $"; | 63 | static char rcsid[] = "$OpenBSD: res_mkquery.c,v 1.10 2001/07/31 22:02:18 jakob Exp $"; |
64 | #endif | 64 | #endif |
65 | #endif /* LIBC_SCCS and not lint */ | 65 | #endif /* LIBC_SCCS and not lint */ |
66 | 66 | ||
@@ -221,8 +221,17 @@ res_opt(n0, buf, buflen, anslen) | |||
221 | cp += INT16SZ; | 221 | cp += INT16SZ; |
222 | *cp++ = NOERROR; /* extended RCODE */ | 222 | *cp++ = NOERROR; /* extended RCODE */ |
223 | *cp++ = 0; /* EDNS version */ | 223 | *cp++ = 0; /* EDNS version */ |
224 | __putshort(0, cp); /* MBZ */ | 224 | if (_res.options & RES_USE_DNSSEC) { |
225 | cp += INT16SZ; | 225 | #ifdef DEBUG |
226 | if (_res.options & RES_DEBUG) | ||
227 | printf(";; res_opt()... ENDS0 DNSSEC OK\n"); | ||
228 | #endif /* DEBUG */ | ||
229 | __putshort(DNS_MESSAGEEXTFLAG_DO, cp); /* EDNS Z field */ | ||
230 | cp += INT16SZ; | ||
231 | } else { | ||
232 | __putshort(0, cp); /* EDNS Z field */ | ||
233 | cp += INT16SZ; | ||
234 | } | ||
226 | __putshort(0, cp); /* RDLEN */ | 235 | __putshort(0, cp); /* RDLEN */ |
227 | cp += INT16SZ; | 236 | cp += INT16SZ; |
228 | hp->arcount = htons(ntohs(hp->arcount) + 1); | 237 | 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 @@ | |||
1 | /* $OpenBSD: res_query.c,v 1.15 2001/06/27 00:58:55 lebel Exp $ */ | 1 | /* $OpenBSD: res_query.c,v 1.16 2001/07/31 22:02:18 jakob Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * ++Copyright++ 1988, 1993 | 4 | * ++Copyright++ 1988, 1993 |
@@ -60,7 +60,7 @@ | |||
60 | static char sccsid[] = "@(#)res_query.c 8.1 (Berkeley) 6/4/93"; | 60 | static char sccsid[] = "@(#)res_query.c 8.1 (Berkeley) 6/4/93"; |
61 | static char rcsid[] = "$From: res_query.c,v 8.9 1996/09/22 00:13:28 vixie Exp $"; | 61 | static char rcsid[] = "$From: res_query.c,v 8.9 1996/09/22 00:13:28 vixie Exp $"; |
62 | #else | 62 | #else |
63 | static char rcsid[] = "$OpenBSD: res_query.c,v 1.15 2001/06/27 00:58:55 lebel Exp $"; | 63 | static char rcsid[] = "$OpenBSD: res_query.c,v 1.16 2001/07/31 22:02:18 jakob Exp $"; |
64 | #endif | 64 | #endif |
65 | #endif /* LIBC_SCCS and not lint */ | 65 | #endif /* LIBC_SCCS and not lint */ |
66 | 66 | ||
@@ -123,8 +123,11 @@ res_query(name, class, type, answer, anslen) | |||
123 | 123 | ||
124 | n = res_mkquery(QUERY, name, class, type, NULL, 0, NULL, | 124 | n = res_mkquery(QUERY, name, class, type, NULL, 0, NULL, |
125 | buf, sizeof(buf)); | 125 | buf, sizeof(buf)); |
126 | if (n > 0 && (_res.options & RES_USE_EDNS0) != 0) | 126 | if (n > 0 && ((_res.options & RES_USE_EDNS0) || |
127 | (_res.options & RES_USE_DNSSEC))) { | ||
127 | n = res_opt(n, buf, sizeof(buf), anslen); | 128 | n = res_opt(n, buf, sizeof(buf), anslen); |
129 | } | ||
130 | |||
128 | if (n <= 0) { | 131 | if (n <= 0) { |
129 | #ifdef DEBUG | 132 | #ifdef DEBUG |
130 | if (_res.options & RES_DEBUG) | 133 | if (_res.options & RES_DEBUG) |