getaddrinfo now accepts shorthand ipv4 notation

Signed-off-by: Adrien Destugues <[email protected]>

As required by POSIX:
"If the specified address family is AF_INET or AF_UNSPEC, address
strings using Internet standard dot notation as specified in inet_addr
are valid." (which allows IP in a.b.c.d, a.b.c, a.b, and a forms, and
also accepts the numbers in hex and octal).

Fixes #3884.
This commit is contained in:
A-star-ayush
2017-04-22 08:04:35 +02:00
committed by Adrien Destugues
parent 73c2c7b4b5
commit 315633e13e
@@ -801,7 +801,6 @@ explore_numeric(const struct addrinfo *pai, const char *hostname,
return 0;
switch (afd->a_af) {
#if 0 /*X/Open spec*/
case AF_INET:
if (inet_aton(hostname, (struct in_addr *)pton) == 1) {
if (pai->ai_family == afd->a_af ||
@@ -822,7 +821,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 ||