Project

General

Profile

Bug #2514 » getaddrinfo.diff

xibbar (Takeyuki FUJIOKA), 12/22/2009 08:36 PM

View differences:

ext/socket/getaddrinfo.c (working copy)
88 88
#include "sockport.h"
89
#if defined(__KAME__) && defined(INET6)
90
# define FAITH
91
#endif
92

  
93 89
#define SUCCESS 0
94 90
#define ANY 0
......
494 490
#ifdef INET6
495 491
			case AF_INET6:
496
#ifdef HAVE_ADDR8
497
				pfx = ((struct in6_addr *)pton)->s6_addr8[0];
498
#else
499 492
				pfx = ((struct in6_addr *)pton)->s6_addr[0];
500
#endif
501 493
				if (pfx == 0 || pfx == 0xfe || pfx == 0xff)
502 494
					pai->ai_flags &= ~AI_CANONNAME;
......
674 666
			GET_AI(cur->ai_next, &afdl[N_INET6], ap, port);
675 667
			in6 = &((struct sockaddr_in6 *)cur->ai_next->ai_addr)->sin6_addr;
676
			memcpy(&in6->s6_addr32[0], &faith_prefix,
677
			    sizeof(struct in6_addr) - sizeof(struct in_addr));
678
			memcpy(&in6->s6_addr32[3], ap, sizeof(struct in_addr));
668
			memcpy(&in6->s6_addr, &faith_prefix,
669
			       sizeof(struct in6_addr) - sizeof(struct in_addr));
670
			memcpy(&in6->s6_addr + sizeof(struct in_addr), ap,
671
			       sizeof(struct in_addr));
679 672
		} else
680 673
#endif /* FAITH */
ext/socket/extconf.rb (working copy)
121 121
end
122
getaddr_info_ok = enable_config("wide-getaddrinfo") do
123
  checking_for("wide getaddrinfo") {try_run(<<EOF)}
122
getaddr_info_ok = (enable_config("wide-getaddrinfo", nil) && :wide) ||
123
  (checking_for("wide getaddrinfo") {try_run(<<EOF)} && :os)
124 124
#{cpp_include(headers)}
125 125
#include <stdlib.h>
......
225 225
}
226 226
EOF
227
end
228 227
if ipv6 and not getaddr_info_ok
229 228
  abort <<EOS
......
252 251
$objs = ["socket.#{$OBJEXT}"]
253
unless getaddr_info_ok and have_func("getnameinfo", "netdb.h") and have_func("getaddrinfo", "netdb.h")
252
if !have_func("getnameinfo", "netdb.h") or !have_func("getaddrinfo", "netdb.h") or
253
   getaddr_info_ok == :wide
254 254
  if have_struct_member("struct in6_addr", "s6_addr8", headers)
255
    $defs[-1] = "-DHAVE_ADDR8"
255
    $defs[-1] = "s6_addr=s6_addr8"
256
  end
257
  if ipv6 == "kame" && have_struct_member("struct in6_addr", "s6_addr32", headers)
258
    $defs[-1] = "-DFAITH"
256 259
  end
257 260
  $CPPFLAGS="-I. "+$CPPFLAGS
ext/socket/addrinfo.h (working copy)
162 162
extern void freehostent __P((struct hostent *));
163 163
extern void freeaddrinfo __P((struct addrinfo *));
164
#if defined __UCLIBC__
164
#ifdef GAI_STRERROR_CONST
165 165
const
166 166
#endif
ext/socket/getnameinfo.c (working copy)
136 136
getnameinfo(sa, salen, host, hostlen, serv, servlen, flags)
137 137
	const struct sockaddr *sa;
138
	size_t salen;
138
	socklen_t salen;
139 139
	char *host;
140
	size_t hostlen;
140
	socklen_t hostlen;
141 141
	char *serv;
142
	size_t servlen;
142
	socklen_t servlen;
143 143
	int flags;
144 144
{