diff options
author | Robert Mustacchi <rm@joyent.com> | 2014-08-14 21:58:20 +0000 |
---|---|---|
committer | Robert Mustacchi <rm@joyent.com> | 2014-12-10 15:36:39 -0800 |
commit | 2f443e27e5988131d8b57bec58ee15f9227e0899 (patch) | |
tree | 29561bb2247a33c57961097813dd556cccee6f21 /usr/src/lib/libsocket/inet | |
parent | e3bee06925aba994e30db6f2d408f86963166961 (diff) | |
download | illumos-joyent-2f443e27e5988131d8b57bec58ee15f9227e0899.tar.gz |
5096 getaddrinfo doesn't properly handle AI_ADDRCONFIG | AI_V4MAPPED
Reviewed by: Dan McDonald <danmcd@omniti.com>
Reviewed by: Jason King <jason.brian.king@gmail.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Diffstat (limited to 'usr/src/lib/libsocket/inet')
-rw-r--r-- | usr/src/lib/libsocket/inet/getaddrinfo.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/usr/src/lib/libsocket/inet/getaddrinfo.c b/usr/src/lib/libsocket/inet/getaddrinfo.c index ec72a9974e..99b769e41e 100644 --- a/usr/src/lib/libsocket/inet/getaddrinfo.c +++ b/usr/src/lib/libsocket/inet/getaddrinfo.c @@ -69,6 +69,17 @@ const struct in6_addr in6addr_loopback = IN6ADDR_LOOPBACK_INIT; #define AI_MASK (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST \ | AI_ADDRCONFIG | AI_NUMERICSERV | AI_V4MAPPED | AI_ALL) #define ANY 0 + +/* + * This is a private, undocumented, flag that getaddrinfo() uses for + * getipnodebyname(). In the case of AI_ADDRCONFIG && AI_V4MAPPED, if there are + * no IPv6 addresses, getaddrinfo() should return non-IPv4 mapped addresses. On + * the flip side, getipnodebyname() is defined by RFC 2553 to explicitly do so. + * Therefore this private flag indicates to getaddrinfo that we shouldn't do + * this. + */ +#define AI_ADDRINFO 0x8000 + /* function prototypes for used by getaddrinfo() routine */ static int get_addr(int family, const char *hostname, struct addrinfo *aip, struct addrinfo *cur, ushort_t port, int version); @@ -602,7 +613,7 @@ get_addr(int family, const char *hostname, struct addrinfo *aip, struct /* if hostname argument is literal, name service doesn't get called */ if (family == PF_UNSPEC) { hp = getipnodebyname(_hostname, AF_INET6, AI_ALL | - aip->ai_flags | AI_V4MAPPED, &errnum); + aip->ai_flags | AI_V4MAPPED | AI_ADDRINFO, &errnum); } else { hp = getipnodebyname(_hostname, family, aip->ai_flags, &errnum); } |