From 9572ca2bf0394e29842c57382b178f4506c4113b Mon Sep 17 00:00:00 2001 From: ume Date: Tue, 24 Mar 2009 17:47:24 +0000 Subject: getaddrinfo(3) should accept numeric when ai_socktype is not specified in hint or hints is NULL. PR: bin/51827 Submitted by: Mark Andrews MFC after: 1 week --- lib/libc/net/getaddrinfo.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/libc/net/getaddrinfo.c b/lib/libc/net/getaddrinfo.c index 941c315..21ba70e 100644 --- a/lib/libc/net/getaddrinfo.c +++ b/lib/libc/net/getaddrinfo.c @@ -1347,7 +1347,17 @@ get_port(struct addrinfo *ai, const char *servname, int matchonly) allownumeric = 1; break; case ANY: - allownumeric = 0; + switch (ai->ai_family) { + case AF_INET: +#ifdef AF_INET6 + case AF_INET6: +#endif + allownumeric = 1; + break; + default: + allownumeric = 0; + break; + } break; default: return EAI_SOCKTYPE; -- cgit v1.1