diff options
| -rw-r--r-- | src/lib/libc/net/getaddrinfo.c | 5 | ||||
| -rw-r--r-- | src/lib/libc/net/res_debug.c | 6 | ||||
| -rw-r--r-- | src/lib/libc/net/res_init.c | 6 | ||||
| -rw-r--r-- | src/lib/libc/net/res_mkquery.c | 41 | ||||
| -rw-r--r-- | src/lib/libc/net/res_query.c | 7 | 
5 files changed, 56 insertions, 9 deletions
| diff --git a/src/lib/libc/net/getaddrinfo.c b/src/lib/libc/net/getaddrinfo.c index 1326473fb7..0a0b112589 100644 --- a/src/lib/libc/net/getaddrinfo.c +++ b/src/lib/libc/net/getaddrinfo.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: getaddrinfo.c,v 1.27 2000/08/31 17:41:51 itojun Exp $ */ | 1 | /* $OpenBSD: getaddrinfo.c,v 1.28 2001/06/11 10:05:58 itojun Exp $ */ | 
| 2 | /* $KAME: getaddrinfo.c,v 1.31 2000/08/31 17:36:43 itojun Exp $ */ | 2 | /* $KAME: getaddrinfo.c,v 1.31 2000/08/31 17:36:43 itojun Exp $ */ | 
| 3 | 3 | ||
| 4 | /* | 4 | /* | 
| @@ -1511,6 +1511,7 @@ _yp_getaddrinfo(name, pai) | |||
| 1511 | 1511 | ||
| 1512 | extern const char *__hostalias __P((const char *)); | 1512 | extern const char *__hostalias __P((const char *)); | 
| 1513 | extern int h_errno; | 1513 | extern int h_errno; | 
| 1514 | extern int res_opt __P((int, u_char *, int, int)); | ||
| 1514 | 1515 | ||
| 1515 | /* | 1516 | /* | 
| 1516 | * Formulate a normal query, send, and await answer. | 1517 | * Formulate a normal query, send, and await answer. | 
| @@ -1562,6 +1563,8 @@ res_queryN(name, target) | |||
| 1562 | 1563 | ||
| 1563 | n = res_mkquery(QUERY, name, class, type, NULL, 0, NULL, | 1564 | n = res_mkquery(QUERY, name, class, type, NULL, 0, NULL, | 
| 1564 | buf, sizeof(buf)); | 1565 | buf, sizeof(buf)); | 
| 1566 | if (n > 0 && (_res.options & RES_USE_EDNS0) != 0) | ||
| 1567 | n = res_opt(n, buf, sizeof(buf), anslen); | ||
| 1565 | if (n <= 0) { | 1568 | if (n <= 0) { | 
| 1566 | #ifdef DEBUG | 1569 | #ifdef DEBUG | 
| 1567 | if (_res.options & RES_DEBUG) | 1570 | if (_res.options & RES_DEBUG) | 
| diff --git a/src/lib/libc/net/res_debug.c b/src/lib/libc/net/res_debug.c index e1894b1508..54be69cef7 100644 --- a/src/lib/libc/net/res_debug.c +++ b/src/lib/libc/net/res_debug.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: res_debug.c,v 1.10 2000/07/07 20:59:47 deraadt Exp $ */ | 1 | /* $OpenBSD: res_debug.c,v 1.11 2001/06/11 10:05:59 itojun Exp $ */ | 
| 2 | 2 | ||
| 3 | /* | 3 | /* | 
| 4 | * ++Copyright++ 1985, 1990, 1993 | 4 | * ++Copyright++ 1985, 1990, 1993 | 
| @@ -82,7 +82,7 @@ | |||
| 82 | static char sccsid[] = "@(#)res_debug.c 8.1 (Berkeley) 6/4/93"; | 82 | static char sccsid[] = "@(#)res_debug.c 8.1 (Berkeley) 6/4/93"; | 
| 83 | static char rcsid[] = "$From: res_debug.c,v 8.19 1996/11/26 10:11:23 vixie Exp $"; | 83 | static char rcsid[] = "$From: res_debug.c,v 8.19 1996/11/26 10:11:23 vixie Exp $"; | 
| 84 | #else | 84 | #else | 
| 85 | static char rcsid[] = "$OpenBSD: res_debug.c,v 1.10 2000/07/07 20:59:47 deraadt Exp $"; | 85 | static char rcsid[] = "$OpenBSD: res_debug.c,v 1.11 2001/06/11 10:05:59 itojun Exp $"; | 
| 86 | #endif | 86 | #endif | 
| 87 | #endif /* LIBC_SCCS and not lint */ | 87 | #endif /* LIBC_SCCS and not lint */ | 
| 88 | 88 | ||
| @@ -1028,6 +1028,8 @@ __p_option(option) | |||
| 1028 | case RES_DNSRCH: return "dnsrch"; | 1028 | case RES_DNSRCH: return "dnsrch"; | 
| 1029 | case RES_INSECURE1: return "insecure1"; | 1029 | case RES_INSECURE1: return "insecure1"; | 
| 1030 | case RES_INSECURE2: return "insecure2"; | 1030 | case RES_INSECURE2: return "insecure2"; | 
| 1031 | case RES_USE_INET6: return "inet6"; | ||
| 1032 | case RES_USE_EDNS0: return "edns0"; | ||
| 1031 | default: sprintf(nbuf, "?0x%lx?", (u_long)option); | 1033 | default: sprintf(nbuf, "?0x%lx?", (u_long)option); | 
| 1032 | return (nbuf); | 1034 | return (nbuf); | 
| 1033 | } | 1035 | } | 
| diff --git a/src/lib/libc/net/res_init.c b/src/lib/libc/net/res_init.c index bba8cfaad1..c44539604a 100644 --- a/src/lib/libc/net/res_init.c +++ b/src/lib/libc/net/res_init.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: res_init.c,v 1.20 2000/11/10 15:33:04 provos Exp $ */ | 1 | /* $OpenBSD: res_init.c,v 1.21 2001/06/11 10:06:00 itojun Exp $ */ | 
| 2 | 2 | ||
| 3 | /* | 3 | /* | 
| 4 | * ++Copyright++ 1985, 1989, 1993 | 4 | * ++Copyright++ 1985, 1989, 1993 | 
| @@ -64,7 +64,7 @@ | |||
| 64 | static char sccsid[] = "@(#)res_init.c 8.1 (Berkeley) 6/7/93"; | 64 | static char sccsid[] = "@(#)res_init.c 8.1 (Berkeley) 6/7/93"; | 
| 65 | static char rcsid[] = "$From: res_init.c,v 8.7 1996/09/28 06:51:07 vixie Exp $"; | 65 | static char rcsid[] = "$From: res_init.c,v 8.7 1996/09/28 06:51:07 vixie Exp $"; | 
| 66 | #else | 66 | #else | 
| 67 | static char rcsid[] = "$OpenBSD: res_init.c,v 1.20 2000/11/10 15:33:04 provos Exp $"; | 67 | static char rcsid[] = "$OpenBSD: res_init.c,v 1.21 2001/06/11 10:06:00 itojun Exp $"; | 
| 68 | #endif | 68 | #endif | 
| 69 | #endif /* LIBC_SCCS and not lint */ | 69 | #endif /* LIBC_SCCS and not lint */ | 
| 70 | 70 | ||
| @@ -608,6 +608,8 @@ res_setoptions(options, source) | |||
| 608 | #endif | 608 | #endif | 
| 609 | } else if (!strncmp(cp, "inet6", sizeof("inet6") - 1)) { | 609 | } else if (!strncmp(cp, "inet6", sizeof("inet6") - 1)) { | 
| 610 | _res.options |= RES_USE_INET6; | 610 | _res.options |= RES_USE_INET6; | 
| 611 | } else if (!strncmp(cp, "edns0", sizeof("edns0") - 1)) { | ||
| 612 | _res.options |= RES_USE_EDNS0; | ||
| 611 | } else { | 613 | } else { | 
| 612 | /* XXX - print a warning here? */ | 614 | /* XXX - print a warning here? */ | 
| 613 | } | 615 | } | 
| diff --git a/src/lib/libc/net/res_mkquery.c b/src/lib/libc/net/res_mkquery.c index 3e7e2ae5d3..61595a6e8c 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.8 1997/04/13 22:37:21 provos Exp $ */ | 1 | /* $OpenBSD: res_mkquery.c,v 1.9 2001/06/11 10:06:00 itojun 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.8 1997/04/13 22:37:21 provos Exp $"; | 63 | static char rcsid[] = "$OpenBSD: res_mkquery.c,v 1.9 2001/06/11 10:06:00 itojun Exp $"; | 
| 64 | #endif | 64 | #endif | 
| 65 | #endif /* LIBC_SCCS and not lint */ | 65 | #endif /* LIBC_SCCS and not lint */ | 
| 66 | 66 | ||
| @@ -193,3 +193,40 @@ res_mkquery(op, dname, class, type, data, datalen, newrr_in, buf, buflen) | |||
| 193 | } | 193 | } | 
| 194 | return (cp - buf); | 194 | return (cp - buf); | 
| 195 | } | 195 | } | 
| 196 | |||
| 197 | /* attach OPT pseudo-RR, as documented in RFC2671 (EDNS0). */ | ||
| 198 | int | ||
| 199 | res_opt(n0, buf, buflen, anslen) | ||
| 200 | int n0; | ||
| 201 | u_char *buf; /* buffer to put query */ | ||
| 202 | int buflen; /* size of buffer */ | ||
| 203 | int anslen; /* answer buffer length */ | ||
| 204 | { | ||
| 205 | register HEADER *hp; | ||
| 206 | register u_char *cp; | ||
| 207 | |||
| 208 | hp = (HEADER *) buf; | ||
| 209 | cp = buf + n0; | ||
| 210 | buflen -= n0; | ||
| 211 | |||
| 212 | if (buflen < 1 + RRFIXEDSZ) | ||
| 213 | return -1; | ||
| 214 | |||
| 215 | *cp++ = 0; /* "." */ | ||
| 216 | buflen--; | ||
| 217 | |||
| 218 | __putshort(T_OPT, cp); /* TYPE */ | ||
| 219 | cp += INT16SZ; | ||
| 220 | __putshort(anslen & 0xffff, cp); /* CLASS = UDP payload size */ | ||
| 221 | cp += INT16SZ; | ||
| 222 | *cp++ = NOERROR; /* extended RCODE */ | ||
| 223 | *cp++ = 0; /* EDNS version */ | ||
| 224 | __putshort(0, cp); /* MBZ */ | ||
| 225 | cp += INT16SZ; | ||
| 226 | __putshort(0, cp); /* RDLEN */ | ||
| 227 | cp += INT16SZ; | ||
| 228 | hp->arcount = htons(ntohs(hp->arcount) + 1); | ||
| 229 | buflen -= RRFIXEDSZ; | ||
| 230 | |||
| 231 | return cp - buf; | ||
| 232 | } | ||
| diff --git a/src/lib/libc/net/res_query.c b/src/lib/libc/net/res_query.c index 01d1f691cb..433e80f648 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.13 1999/09/27 23:58:26 alex Exp $ */ | 1 | /* $OpenBSD: res_query.c,v 1.14 2001/06/11 10:06:01 itojun 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.13 1999/09/27 23:58:26 alex Exp $"; | 63 | static char rcsid[] = "$OpenBSD: res_query.c,v 1.14 2001/06/11 10:06:01 itojun Exp $"; | 
| 64 | #endif | 64 | #endif | 
| 65 | #endif /* LIBC_SCCS and not lint */ | 65 | #endif /* LIBC_SCCS and not lint */ | 
| 66 | 66 | ||
| @@ -87,6 +87,7 @@ static char rcsid[] = "$OpenBSD: res_query.c,v 1.13 1999/09/27 23:58:26 alex Exp | |||
| 87 | 87 | ||
| 88 | const char *hostalias __P((const char *)); | 88 | const char *hostalias __P((const char *)); | 
| 89 | int h_errno; | 89 | int h_errno; | 
| 90 | extern int res_opt __P((int, u_char *, int, int)); | ||
| 90 | 91 | ||
| 91 | /* | 92 | /* | 
| 92 | * Formulate a normal query, send, and await answer. | 93 | * Formulate a normal query, send, and await answer. | 
| @@ -122,6 +123,8 @@ res_query(name, class, type, answer, anslen) | |||
| 122 | 123 | ||
| 123 | n = res_mkquery(QUERY, name, class, type, NULL, 0, NULL, | 124 | n = res_mkquery(QUERY, name, class, type, NULL, 0, NULL, | 
| 124 | buf, sizeof(buf)); | 125 | buf, sizeof(buf)); | 
| 126 | if (n > 0 && (_res.options & RES_USE_EDNS0) != 0) | ||
| 127 | n = res_opt(n, buf, sizeof(buf), anslen); | ||
| 125 | if (n <= 0) { | 128 | if (n <= 0) { | 
| 126 | #ifdef DEBUG | 129 | #ifdef DEBUG | 
| 127 | if (_res.options & RES_DEBUG) | 130 | if (_res.options & RES_DEBUG) | 
