Return-Path: Delivered-To: apmail-httpd-dev-archive@www.apache.org Received: (qmail 22418 invoked from network); 11 Jun 2008 15:58:12 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 11 Jun 2008 15:58:12 -0000 Received: (qmail 5172 invoked by uid 500); 11 Jun 2008 15:58:11 -0000 Delivered-To: apmail-httpd-dev-archive@httpd.apache.org Received: (qmail 5100 invoked by uid 500); 11 Jun 2008 15:58:11 -0000 Mailing-List: contact dev-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list dev@httpd.apache.org Received: (qmail 5089 invoked by uid 99); 11 Jun 2008 15:58:11 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Jun 2008 08:58:11 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of ryan-apache@trolocsis.com designates 64.62.244.66 as permitted sender) Received: from [64.62.244.66] (HELO zeus.kimaker.com) (64.62.244.66) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Jun 2008 15:57:20 +0000 Received: by zeus.kimaker.com (Postfix, from userid 1002) id 6FDF9758403; Wed, 11 Jun 2008 08:57:03 -0700 (PDT) Date: Wed, 11 Jun 2008 08:57:03 -0700 From: Ryan Phillips To: dev@httpd.apache.org Cc: trawick@gmail.com Subject: Re: [patch] Add IPV6 'specials' flag to mod_rewrite Message-ID: <20080611155703.GB64831@zeus.kimaker.com> Mail-Followup-To: dev@httpd.apache.org, trawick@gmail.com References: <20080609230715.GA40239@zeus.kimaker.com> <20080610011909.GB40239@zeus.kimaker.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) X-Virus-Checked: Checked by ClamAV on apache.org Jeff Trawick said: > On Mon, Jun 9, 2008 at 9:19 PM, Ryan Phillips wrote: > > Ryan Phillips said: > >> So I needed to create some mod_rewrite rules only for IPv6 when httpd is > >> configured for both ipv4 and ipv6 modes. This patch adds > >> 'RewriteCond IPV6 on' support to the ruleset. > >> > >> I initially tried to see if the incoming socket was APR_INET6, but couldn't > >> find the right structure within the request to query. > >> > > > > Should r->connection->local_addr or remote_addr have the correct socket > > family? If I try either of these over an IPv4 connection, I always get a > > socket family of IPv6. > > On most platforms, httpd will handle IPv4 connections on an IPv6 > socket; the address family will be APR_INET6 and the socket address > will have a special format which indicates that the client is IPv4 > (http://en.wikipedia.org/wiki/IPv4_mapped_address). > > Replace "Listen ##" with the combination "Listen 0.0.0.0:##" + "Listen > [::]:##" and you should be able to distinguish between client > connection type by checking the address family (not a real solution). > > The system macro IN6_IS_ADDR_V4MAPPED() can check if an IPv6 socket > address represents an IPv4 client connection. Apparently APR doesn't > provide an equivalent. Jeff, Thanks for the detailed explanation. I wasn't aware of this. Regards, Ryan