From 4e34ea184637bb32b338d86cc398cc56a58c61b7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Elan=20Ruusam=C3=A4e?= Date: Mon, 14 Jan 2008 10:47:40 +0000 Subject: [PATCH] - merged ipv6 patches Changed files: mod_rpaf_degtine.patch -> 1.3 --- mod_rpaf_degtine.patch | 81 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 75 insertions(+), 6 deletions(-) diff --git a/mod_rpaf_degtine.patch b/mod_rpaf_degtine.patch index 9117708..c45b11b 100644 --- a/mod_rpaf_degtine.patch +++ b/mod_rpaf_degtine.patch @@ -1,5 +1,27 @@ ---- mod_rpaf-0.6/mod_rpaf-2.0.c~ 2008-01-14 12:22:30.000000000 +0200 -+++ mod_rpaf-0.6/mod_rpaf-2.0.c 2008-01-14 12:24:24.311847900 +0200 +--- mod_rpaf-0.5/mod_rpaf.c 2004-03-17 17:47:30.000000000 +0200 ++++ mod_rpaf-0.5.ipv6/mod_rpaf.c 2006-01-05 18:18:09.000000000 +0200 +@@ -148,7 +148,18 @@ + ++fwdvalue; + } + r->connection->remote_ip = ap_pstrdup(r->connection->pool, ((char **)arr->elts)[((arr->nelts)-1)]); +- r->connection->remote_addr.sin_addr.s_addr = inet_addr(r->connection->remote_ip); ++ switch (r->connection->remote_addr.ss_family) { ++ case AF_INET: ++ inet_pton(AF_INET, r->connection->remote_ip, &((struct sockaddr_in*)&r->connection->remote_addr)->sin_addr.s_addr); ++ break; ++ case AF_INET6: ++ inet_pton(AF_INET6, r->connection->remote_ip, ((struct sockaddr_in6*)&r->connection->remote_addr)->sin6_addr.s6_addr); ++ break; ++ default: ++ ap_log_rerror(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, r, "Apache doesn't support this address family"); ++ break; ++ } ++ + if (cfg->sethostname) { + const char *hostvalue; + if (hostvalue = ap_table_get(r->headers_in, "X-Forwarded-Host")) { +--- mod_rpaf-0.6/mod_rpaf-2.0.c~ 2008-01-14 12:27:30.000000000 +0200 ++++ mod_rpaf-0.6/mod_rpaf-2.0.c 2008-01-14 12:28:18.413347347 +0200 @@ -130,6 +130,16 @@ return 0; } @@ -26,8 +48,8 @@ r->connection->remote_addr->sa.sin.sin_addr.s_addr = apr_inet_addr(r->connection->remote_ip); if (cfg->sethostname) { const char *hostvalue; ---- mod_rpaf-0.6/mod_rpaf.c~ 2008-01-14 12:25:04.000000000 +0200 -+++ mod_rpaf-0.6/mod_rpaf.c 2008-01-14 12:25:28.975575680 +0200 +--- mod_rpaf-0.6/mod_rpaf.c~ 2008-01-14 12:28:40.000000000 +0200 ++++ mod_rpaf-0.6/mod_rpaf.c 2008-01-14 12:30:47.021926815 +0200 @@ -130,6 +130,16 @@ return 0; } @@ -45,12 +67,59 @@ static int change_remote_ip(request_rec *r) { const char *fwdvalue; char *val; -@@ -192,7 +192,7 @@ +@@ -192,18 +192,7 @@ rcr->old_ip = ap_pstrdup(r->connection->pool, r->connection->remote_ip); rcr->r = r; ap_register_cleanup(r->pool, (void *)rcr, rpaf_cleanup, ap_null_cleanup); - r->connection->remote_ip = ap_pstrdup(r->connection->pool, ((char **)arr->elts)[((arr->nelts)-1)]); +- switch (r->connection->remote_addr.ss_family) { +- case AF_INET: +- inet_pton(AF_INET, r->connection->remote_ip, &((struct sockaddr_in*)&r->connection->remote_addr)->sin_addr.s_addr); +- break; +- case AF_INET6: +- inet_pton(AF_INET6, r->connection->remote_ip, ((struct sockaddr_in6*)&r->connection->remote_addr)->sin6_addr.s6_addr); +- break; +- default: +- ap_log_rerror(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, r, "Apache doesn't support this address family"); +- break; +- } + r->connection->remote_ip = ap_pstrdup(r->connection->pool, last_not_in_array(arr, cfg->proxy_ips)); - r->connection->remote_addr.sin_addr.s_addr = inet_addr(r->connection->remote_ip); + + if (cfg->sethostname) { + const char *hostvalue; +--- mod_rpaf-0.6/mod_rpaf.c~ 2008-01-14 12:31:19.000000000 +0200 ++++ mod_rpaf-0.6/mod_rpaf.c 2008-01-14 12:35:56.507787818 +0200 +@@ -148,7 +148,15 @@ + static void rpaf_cleanup(void *data) { + rpaf_cleanup_rec *rcr = (rpaf_cleanup_rec *)data; + rcr->r->connection->remote_ip = ap_pstrdup(rcr->r->connection->pool, rcr->old_ip); ++#ifdef INET6 ++ switch (rcr->r->connection->remote_addr.ss_family) { ++ case AF_INET: ++ inet_pton(AF_INET, rcr->r->connection->remote_ip, &((struct sockaddr_in*)&rcr->r->connection->remote_addr)->sin_addr.s_addr); ++ break; ++ } ++#else + rcr->r->connection->remote_addr.sin_addr.s_addr = inet_addr(rcr->r->connection->remote_ip); ++#endif + } + + static char* last_not_in_array(array_header *forwarded_for, +--- mod_rpaf-0.6/mod_rpaf.c~ 2008-01-14 12:39:58.000000000 +0200 ++++ mod_rpaf-0.6/mod_rpaf.c 2008-01-14 12:42:16.393702934 +0200 +@@ -201,6 +201,15 @@ + rcr->r = r; + ap_register_cleanup(r->pool, (void *)rcr, rpaf_cleanup, ap_null_cleanup); + r->connection->remote_ip = ap_pstrdup(r->connection->pool, last_not_in_array(arr, cfg->proxy_ips)); ++#ifdef INET6 ++ switch (r->connection->remote_addr.ss_family) { ++ case AF_INET: ++ inet_pton(AF_INET, r->connection->remote_ip, &((struct sockaddr_in*)&r->connection->remote_addr)->sin_addr.s_addr); ++ break; ++ } ++#else ++ r->connection->remote_addr.sin_addr.s_addr = inet_addr(r->connection->remote_ip); ++#endif + if (cfg->sethostname) { const char *hostvalue; -- 2.43.0