diff options
author | itojun <> | 2000-07-05 03:00:55 +0000 |
---|---|---|
committer | itojun <> | 2000-07-05 03:00:55 +0000 |
commit | 60e5eb02ef9ee3431b1dd7b549438b53e7b16392 (patch) | |
tree | f573a70611d64c017a815ffe853e3e15695a7a8c | |
parent | ae0d08409ff4b235bacc9ce0e06fe6e5cc51d114 (diff) | |
download | openbsd-60e5eb02ef9ee3431b1dd7b549438b53e7b16392.tar.gz openbsd-60e5eb02ef9ee3431b1dd7b549438b53e7b16392.tar.bz2 openbsd-60e5eb02ef9ee3431b1dd7b549438b53e7b16392.zip |
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
-rw-r--r-- | src/lib/libc/net/getaddrinfo.c | 36 |
1 files 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 @@ | |||
1 | /* $OpenBSD: getaddrinfo.c,v 1.23 2000/05/15 10:49:55 itojun Exp $ */ | 1 | /* $OpenBSD: getaddrinfo.c,v 1.24 2000/07/05 03:00:55 itojun Exp $ */ |
2 | /* $KAME: getaddrinfo.c,v 1.21 2000/05/05 07:40:51 itojun Exp $ */ | 2 | /* $KAME: getaddrinfo.c,v 1.25 2000/07/05 02:59:28 itojun Exp $ */ |
3 | 3 | ||
4 | /* | 4 | /* |
5 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. | 5 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. |
@@ -192,7 +192,7 @@ typedef union { | |||
192 | struct res_target { | 192 | struct res_target { |
193 | struct res_target *next; | 193 | struct res_target *next; |
194 | const char *name; /* domain name */ | 194 | const char *name; /* domain name */ |
195 | int class, type; /* class and type of query */ | 195 | int qclass, qtype; /* class and type of query */ |
196 | u_char *answer; /* buffer to put answer */ | 196 | u_char *answer; /* buffer to put answer */ |
197 | int anslen; /* size of answer buffer */ | 197 | int anslen; /* size of answer buffer */ |
198 | int n; /* result length */ | 198 | int n; /* result length */ |
@@ -435,9 +435,9 @@ getaddrinfo(hostname, servname, hints, res) | |||
435 | goto good; | 435 | goto good; |
436 | 436 | ||
437 | if (pai->ai_flags & AI_NUMERICHOST) | 437 | if (pai->ai_flags & AI_NUMERICHOST) |
438 | ERR(EAI_NONAME); | 438 | ERR(EAI_NODATA); |
439 | if (hostname == NULL) | 439 | if (hostname == NULL) |
440 | ERR(EAI_NONAME); | 440 | ERR(EAI_NODATA); |
441 | 441 | ||
442 | /* | 442 | /* |
443 | * hostname as alphabetical name. | 443 | * hostname as alphabetical name. |
@@ -783,7 +783,7 @@ explore_numeric_scope(pai, hostname, servname, res) | |||
783 | sin6 = (struct sockaddr_in6 *)(void *)cur->ai_addr; | 783 | sin6 = (struct sockaddr_in6 *)(void *)cur->ai_addr; |
784 | if ((scopeid = ip6_str2scopeid(scope, sin6)) == -1) { | 784 | if ((scopeid = ip6_str2scopeid(scope, sin6)) == -1) { |
785 | free(hostname2); | 785 | free(hostname2); |
786 | return(EAI_NONAME); /* XXX: is return OK? */ | 786 | return(EAI_NODATA); /* XXX: is return OK? */ |
787 | } | 787 | } |
788 | sin6->sin6_scope_id = scopeid; | 788 | sin6->sin6_scope_id = scopeid; |
789 | } | 789 | } |
@@ -1214,25 +1214,25 @@ _dns_getaddrinfo(name, pai) | |||
1214 | switch (pai->ai_family) { | 1214 | switch (pai->ai_family) { |
1215 | case AF_UNSPEC: | 1215 | case AF_UNSPEC: |
1216 | /* prefer IPv6 */ | 1216 | /* prefer IPv6 */ |
1217 | q.class = C_IN; | 1217 | q.qclass = C_IN; |
1218 | q.type = T_AAAA; | 1218 | q.qtype = T_AAAA; |
1219 | q.answer = buf.buf; | 1219 | q.answer = buf.buf; |
1220 | q.anslen = sizeof(buf); | 1220 | q.anslen = sizeof(buf); |
1221 | q.next = &q2; | 1221 | q.next = &q2; |
1222 | q2.class = C_IN; | 1222 | q2.qclass = C_IN; |
1223 | q2.type = T_A; | 1223 | q2.qtype = T_A; |
1224 | q2.answer = buf2.buf; | 1224 | q2.answer = buf2.buf; |
1225 | q2.anslen = sizeof(buf2); | 1225 | q2.anslen = sizeof(buf2); |
1226 | break; | 1226 | break; |
1227 | case AF_INET: | 1227 | case AF_INET: |
1228 | q.class = C_IN; | 1228 | q.qclass = C_IN; |
1229 | q.type = T_A; | 1229 | q.qtype = T_A; |
1230 | q.answer = buf.buf; | 1230 | q.answer = buf.buf; |
1231 | q.anslen = sizeof(buf); | 1231 | q.anslen = sizeof(buf); |
1232 | break; | 1232 | break; |
1233 | case AF_INET6: | 1233 | case AF_INET6: |
1234 | q.class = C_IN; | 1234 | q.qclass = C_IN; |
1235 | q.type = T_AAAA; | 1235 | q.qtype = T_AAAA; |
1236 | q.answer = buf.buf; | 1236 | q.answer = buf.buf; |
1237 | q.anslen = sizeof(buf); | 1237 | q.anslen = sizeof(buf); |
1238 | break; | 1238 | break; |
@@ -1241,14 +1241,14 @@ _dns_getaddrinfo(name, pai) | |||
1241 | } | 1241 | } |
1242 | if (res_searchN(name, &q) < 0) | 1242 | if (res_searchN(name, &q) < 0) |
1243 | return NULL; | 1243 | return NULL; |
1244 | ai = getanswer(&buf, q.n, q.name, q.type, pai); | 1244 | ai = getanswer(&buf, q.n, q.name, q.qtype, pai); |
1245 | if (ai) { | 1245 | if (ai) { |
1246 | cur->ai_next = ai; | 1246 | cur->ai_next = ai; |
1247 | while (cur && cur->ai_next) | 1247 | while (cur && cur->ai_next) |
1248 | cur = cur->ai_next; | 1248 | cur = cur->ai_next; |
1249 | } | 1249 | } |
1250 | if (q.next) { | 1250 | if (q.next) { |
1251 | ai = getanswer(&buf2, q2.n, q2.name, q2.type, pai); | 1251 | ai = getanswer(&buf2, q2.n, q2.name, q2.qtype, pai); |
1252 | if (ai) | 1252 | if (ai) |
1253 | cur->ai_next = ai; | 1253 | cur->ai_next = ai; |
1254 | } | 1254 | } |
@@ -1540,8 +1540,8 @@ res_queryN(name, target) | |||
1540 | hp->rcode = NOERROR; /* default */ | 1540 | hp->rcode = NOERROR; /* default */ |
1541 | 1541 | ||
1542 | /* make it easier... */ | 1542 | /* make it easier... */ |
1543 | class = t->class; | 1543 | class = t->qclass; |
1544 | type = t->type; | 1544 | type = t->qtype; |
1545 | answer = t->answer; | 1545 | answer = t->answer; |
1546 | anslen = t->anslen; | 1546 | anslen = t->anslen; |
1547 | #ifdef DEBUG | 1547 | #ifdef DEBUG |