Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/net return EAI_NODATA, instead of EAI_NONAME, on na...



details:   https://anonhg.NetBSD.org/src/rev/50be0d84c68c
branches:  trunk
changeset: 494304:50be0d84c68c
user:      itojun <itojun%NetBSD.org@localhost>
date:      Wed Jul 05 12:41:16 2000 +0000

description:
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@localhost

diffstat:

 lib/libc/net/getaddrinfo.c |  38 +++++++++++++++++++-------------------
 1 files changed, 19 insertions(+), 19 deletions(-)

diffs (112 lines):

diff -r b4f69552f98b -r 50be0d84c68c lib/libc/net/getaddrinfo.c
--- a/lib/libc/net/getaddrinfo.c        Wed Jul 05 12:11:59 2000 +0000
+++ b/lib/libc/net/getaddrinfo.c        Wed Jul 05 12:41:16 2000 +0000
@@ -1,5 +1,5 @@
-/*     $NetBSD: getaddrinfo.c,v 1.42 2000/04/27 05:30:22 itojun Exp $  */
-/*     $KAME: getaddrinfo.c,v 1.15 2000/04/27 03:36:25 itojun Exp $    */
+/*     $NetBSD: getaddrinfo.c,v 1.43 2000/07/05 12:41:16 itojun Exp $  */
+/*     $KAME: getaddrinfo.c,v 1.22 2000/07/05 02:31:36 itojun Exp $    */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -79,7 +79,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: getaddrinfo.c,v 1.42 2000/04/27 05:30:22 itojun Exp $");
+__RCSID("$NetBSD: getaddrinfo.c,v 1.43 2000/07/05 12:41:16 itojun Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -207,7 +207,7 @@
 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 */
@@ -488,9 +488,9 @@
                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.
@@ -821,7 +821,7 @@
                        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;
                }
@@ -1258,25 +1258,25 @@
        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;
@@ -1285,14 +1285,14 @@
        }
        if (res_searchN(name, &q) < 0)
                return NS_NOTFOUND;
-       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;
        }
@@ -1611,8 +1611,8 @@
                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



Home | Main Index | Thread Index | Old Index