- Fix buil with apache13 + ipv6

Set APACHE_PORT or define WITH_APACHE_IPV6

PR:		ports/68158
Submitted by:	SoD <sod at cd dot pri dot ee>
Obtained from:	NetBSD
This commit is contained in:
Clement Laforet 2004-08-18 19:11:12 +00:00
parent 5f5cf805c6
commit 443cf00359
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=116627
3 changed files with 43 additions and 0 deletions

View File

@ -40,6 +40,10 @@ MAN3= Apache.3 Apache::Constants.3 Apache::ExtUtils.3 \
mod_perl_cvs.3 mod_perl_method_handlers.3 mod_perl_traps.3 \
mod_perl_tuning.3
.if defined(WITH_APACHE_IPV6) && ${APACHE_PORT:Mipv6}
CFLAGS+= -DAPACHE6
.endif
.include <bsd.port.pre.mk>
post-install:

View File

@ -0,0 +1,39 @@
--- src/modules/perl/Connection.xs.orig Fri Nov 23 06:19:44 2001
+++ src/modules/perl/Connection.xs Fri Nov 23 10:29:44 2001
@@ -78,7 +78,11 @@
RETVAL = newSVpv((char *)&conn->remote_addr,
sizeof conn->remote_addr);
if(sv_addr) {
+#ifdef APACHE6
+ struct sockaddr_storage addr;
+#else
struct sockaddr_in addr;
+#endif
STRLEN sockaddrlen;
char * new_addr = SvPV(sv_addr,sockaddrlen);
if (sockaddrlen != sizeof(addr)) {
@@ -106,7 +110,26 @@
#else
conn->remote_ip = pstrdup(conn->pool, (char *)SvPV(ST(1),na));
#endif
+#ifdef APACHE6
+ {
+ struct addrinfo hints, *res0;
+ int error;
+
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_family = PF_UNSPEC;
+ hints.ai_flags = AI_NUMERICHOST;
+ error = getaddrinfo(conn->remote_ip, NULL, &hints, &res0);
+ if (!error) {
+ memcpy(&conn->remote_addr, res0->ai_addr, res0->ai_addrlen);
+ freeaddrinfo(res0);
+ } else {
+ croak("Bad ip address in remote_ip getaddrinfo failed %s",
+ gai_strerror(error));
+ }
+ }
+#else
conn->remote_addr.sin_addr.s_addr = inet_addr(conn->remote_ip);
+#endif
}