aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHajimu UMEMOTO <ume@FreeBSD.org>2006-07-21 19:00:22 +0000
committerHajimu UMEMOTO <ume@FreeBSD.org>2006-07-21 19:00:22 +0000
commit0cf41987df03583a9489357933fe9fcca5692ed3 (patch)
treecc77a7f51fa6dab85cf2290e938eaaeabd4e4806 /lib
parent0aceddcef76792af218fb15166571d808ad7f494 (diff)
downloadsrc-0cf41987df03583a9489357933fe9fcca5692ed3.tar.gz
src-0cf41987df03583a9489357933fe9fcca5692ed3.zip
RFC3493 requires use of inet_aton for AF_INET.
Obtained from: KAME MFC after: 1 week
Notes
Notes: svn path=/head/; revision=160552
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/net/getaddrinfo.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/libc/net/getaddrinfo.c b/lib/libc/net/getaddrinfo.c
index d93c14b8043c..21f65acc3e64 100644
--- a/lib/libc/net/getaddrinfo.c
+++ b/lib/libc/net/getaddrinfo.c
@@ -59,7 +59,6 @@
*
* OS specific notes for freebsd4:
* - FreeBSD supported $GAI. The code does not.
- * - FreeBSD allowed classful IPv4 numeric (127.1), the code does not.
*/
#include <sys/cdefs.h>
@@ -1132,8 +1131,14 @@ explore_numeric(const struct addrinfo *pai, const char *hostname,
return 0;
switch (afd->a_af) {
-#if 1 /*X/Open spec*/
case AF_INET:
+ /*
+ * RFC3493 requires getaddrinfo() to accept AF_INET formats
+ * that are accepted by inet_addr() and its family. The
+ * accepted forms includes the "classful" one, which inet_pton
+ * does not accept. So we need to separate the case for
+ * AF_INET.
+ */
if (inet_aton(hostname, (struct in_addr *)pton) == 1) {
if (pai->ai_family == afd->a_af ||
pai->ai_family == PF_UNSPEC /*?*/) {
@@ -1151,7 +1156,6 @@ explore_numeric(const struct addrinfo *pai, const char *hostname,
ERR(EAI_FAMILY); /*xxx*/
}
break;
-#endif
default:
if (inet_pton(afd->a_af, hostname, pton) == 1) {
if (pai->ai_family == afd->a_af ||