1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/socket/socket.c (ruby_getnameinfo__aix): AF_INET6 workaround

for AIX.  a patch from Yutaka Kanemoto <kinpoco AT gmail.com>.
  [ruby-dev:29744]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@11270 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2006-11-02 15:23:08 +00:00
parent 82371d77ee
commit 89e7d586f4
3 changed files with 38 additions and 0 deletions

View file

@ -1,3 +1,9 @@
Fri Nov 3 00:16:37 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
* ext/socket/socket.c (ruby_getnameinfo__aix): AF_INET6 workaround
for AIX. a patch from Yutaka Kanemoto <kinpoco AT gmail.com>.
[ruby-dev:29744]
Thu Nov 2 15:43:39 2006 NAKAMURA Usaku <usa@ruby-lang.org>
* parse.y (primary): should set NODE even when compstmt is NULL.

View file

@ -156,6 +156,10 @@ main()
if (ai->ai_addr == NULL)
goto bad;
#if defined(_AIX)
if (ai->ai_family == AF_INET6 && passive) {
inet6++;
continue;
}
ai->ai_addr->sa_len = ai->ai_addrlen;
ai->ai_addr->sa_family = ai->ai_family;
#endif

View file

@ -198,6 +198,34 @@ ruby_getaddrinfo__aix(nodename, servname, hints, res)
}
#undef getaddrinfo
#define getaddrinfo(node,serv,hints,res) ruby_getaddrinfo__aix((node),(serv),(hints),(res))
static int
ruby_getnameinfo__aix(sa, salen, host, hostlen, serv, servlen, flags)
const struct sockaddr *sa;
size_t salen;
char *host;
size_t hostlen;
char *serv;
size_t servlen;
int flags;
{
struct sockaddr_in6 *sa6;
u_int32_t *a6;
if (sa->sa_family == AF_INET6) {
sa6 = (struct sockaddr_in6 *)sa;
a6 = sa6->sin6_addr.u6_addr.u6_addr32;
if (a6[0] == 0 && a6[1] == 0 && a6[2] == 0 && a6[3] == 0) {
strncpy(host, "::", hostlen);
snprintf(serv, servlen, "%d", sa6->sin6_port);
return 0;
}
}
return getnameinfo(sa, salen, host, hostlen, serv, servlen, flags);
}
#undef getnameinfo
#define getnameinfo(sa, salen, host, hostlen, serv, servlen, flags) \
ruby_getnameinfo__aix((sa), (salen), (host), (hostlen), (serv), (servlen), (flags))
#ifndef CMSG_SPACE
# define CMSG_SPACE(len) (_CMSG_ALIGN(sizeof(struct cmsghdr)) + _CMSG_ALIGN(len))
#endif