From 60e5eb02ef9ee3431b1dd7b549438b53e7b16392 Mon Sep 17 00:00:00 2001 From: itojun <> Date: Wed, 5 Jul 2000 03:00:55 +0000 Subject: return EAI_NODATA, instead of EAI_NONAME, on name resolution errors. EAI_NONAME does not make sense in these situations. from kame. From: enami@netbsd.org --- src/lib/libc/net/getaddrinfo.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/lib/libc/net/getaddrinfo.c b/src/lib/libc/net/getaddrinfo.c index 9cc9314327..c64e838acc 100644 --- a/src/lib/libc/net/getaddrinfo.c +++ b/src/lib/libc/net/getaddrinfo.c @@ -1,5 +1,5 @@ -/* $OpenBSD: getaddrinfo.c,v 1.23 2000/05/15 10:49:55 itojun Exp $ */ -/* $KAME: getaddrinfo.c,v 1.21 2000/05/05 07:40:51 itojun Exp $ */ +/* $OpenBSD: getaddrinfo.c,v 1.24 2000/07/05 03:00:55 itojun Exp $ */ +/* $KAME: getaddrinfo.c,v 1.25 2000/07/05 02:59:28 itojun Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -192,7 +192,7 @@ typedef union { struct res_target { struct res_target *next; const char *name; /* domain name */ - int class, type; /* class and type of query */ + int qclass, qtype; /* class and type of query */ u_char *answer; /* buffer to put answer */ int anslen; /* size of answer buffer */ int n; /* result length */ @@ -435,9 +435,9 @@ getaddrinfo(hostname, servname, hints, res) goto good; if (pai->ai_flags & AI_NUMERICHOST) - ERR(EAI_NONAME); + ERR(EAI_NODATA); if (hostname == NULL) - ERR(EAI_NONAME); + ERR(EAI_NODATA); /* * hostname as alphabetical name. @@ -783,7 +783,7 @@ explore_numeric_scope(pai, hostname, servname, res) sin6 = (struct sockaddr_in6 *)(void *)cur->ai_addr; if ((scopeid = ip6_str2scopeid(scope, sin6)) == -1) { free(hostname2); - return(EAI_NONAME); /* XXX: is return OK? */ + return(EAI_NODATA); /* XXX: is return OK? */ } sin6->sin6_scope_id = scopeid; } @@ -1214,25 +1214,25 @@ _dns_getaddrinfo(name, pai) switch (pai->ai_family) { case AF_UNSPEC: /* prefer IPv6 */ - q.class = C_IN; - q.type = T_AAAA; + q.qclass = C_IN; + q.qtype = T_AAAA; q.answer = buf.buf; q.anslen = sizeof(buf); q.next = &q2; - q2.class = C_IN; - q2.type = T_A; + q2.qclass = C_IN; + q2.qtype = T_A; q2.answer = buf2.buf; q2.anslen = sizeof(buf2); break; case AF_INET: - q.class = C_IN; - q.type = T_A; + q.qclass = C_IN; + q.qtype = T_A; q.answer = buf.buf; q.anslen = sizeof(buf); break; case AF_INET6: - q.class = C_IN; - q.type = T_AAAA; + q.qclass = C_IN; + q.qtype = T_AAAA; q.answer = buf.buf; q.anslen = sizeof(buf); break; @@ -1241,14 +1241,14 @@ _dns_getaddrinfo(name, pai) } if (res_searchN(name, &q) < 0) return NULL; - ai = getanswer(&buf, q.n, q.name, q.type, pai); + ai = getanswer(&buf, q.n, q.name, q.qtype, pai); if (ai) { cur->ai_next = ai; while (cur && cur->ai_next) cur = cur->ai_next; } if (q.next) { - ai = getanswer(&buf2, q2.n, q2.name, q2.type, pai); + ai = getanswer(&buf2, q2.n, q2.name, q2.qtype, pai); if (ai) cur->ai_next = ai; } @@ -1540,8 +1540,8 @@ res_queryN(name, target) hp->rcode = NOERROR; /* default */ /* make it easier... */ - class = t->class; - type = t->type; + class = t->qclass; + type = t->qtype; answer = t->answer; anslen = t->anslen; #ifdef DEBUG -- cgit v1.2.3-55-g6feb