diff options
author | ume <ume@FreeBSD.org> | 2006-07-21 19:00:22 +0000 |
---|---|---|
committer | ume <ume@FreeBSD.org> | 2006-07-21 19:00:22 +0000 |
commit | 34bbbddd7edea08765b37576afc0456076006a6c (patch) | |
tree | cc77a7f51fa6dab85cf2290e938eaaeabd4e4806 /lib/libc | |
parent | 9cc6e84d28d55e96dea517a0afa186cda673010f (diff) | |
download | FreeBSD-src-34bbbddd7edea08765b37576afc0456076006a6c.zip FreeBSD-src-34bbbddd7edea08765b37576afc0456076006a6c.tar.gz |
RFC3493 requires use of inet_aton for AF_INET.
Obtained from: KAME
MFC after: 1 week
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/net/getaddrinfo.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/libc/net/getaddrinfo.c b/lib/libc/net/getaddrinfo.c index d93c14b..21f65ac 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 || |