You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Puneet Mohan <pu...@gmail.com> on 2011/03/01 10:51:45 UTC

Re: Apache : IPv4 mapped address Issue

Hi Jeff Trawick,



I am presently implementing transparency in Apache source code. So the
strange thing I noticed that while binding to a non-local IP prior to
connect (), the remote addr(i.e. the client_addr) it binds to is in the IPv4
mapped address whereas the socket descriptor created is IPv4 type only. As a
result of this I couldn’t able to bind to the non-local IP.


The work around I tried is manipulating the bits of IPv4 mapped address, but
I don’t feel it to be convincing.


Regards,

Puneet Mohan

Re: Apache : IPv4 mapped address Issue

Posted by Puneet Mohan <pu...@gmail.com>.
Hi Jeho,

I applied the patch available at "
http://mail-archives.apache.org/mod_mbox/httpd-dev/201002.mbox/%3Ca96c392f1002180232t4ab2873o13106fa4e2bee80a@mail.gmail.com%3E"
given by Nicolas Normand.

Well, after researching (or I should say playing) a bit in with apache
source code, I can say that proxy server could bind to the non-local IPv4
mapped address as long as the socket is AF_INET6.

The problem I am facing over here is, Apache is able to bind to an ipv6
socket and accepts ipv4 connections on it.
**********************************************************
   addr.sin6_family = AF_INET6;
   addr.sin6_port = htons(portnum);
   inet_pton(AF_INET6, "0::0", &addr.sin6_addr)
   bind(sd, (struct sockaddr*)&addr, sizeof(addr)) != 0 )
   listen(sd, 15) != 0 )
**********************************************************
Due to this, web traffic coming from the IPv4 client is converted to the
"IPv4 mapped address" traffic .

So,  when I bind it to the non-local IP prior to connect() to the origin
server the bind couldn't understand the IPv4 mapped address as the other
socket opened for server side is a AF_INET(I requested IPv4 address from the
client) and transparency fails.

Regards,
Puneet Mohan

This results in IPv4 mapped addresses in the access.log like
"::ffff:127.0.0.1

On Tue, Mar 1, 2011 at 4:23 PM, JeHo Park <li...@gmail.com> wrote:

> Hello Puneet Mohan,
>
> 2011-03-01 오후 6:51, Puneet Mohan 쓴 글:
>
>
>> Hi Jeff Trawick,
>>
>> I am presently implementing transparency in Apache source code. So the
>> strange thing I noticed that while binding to a non-local IP prior to
>> connect (), the remote addr(i.e. the client_addr) it binds to is in the IPv4
>> mapped address whereas the socket descriptor created is IPv4 type only.
>>
>>  did you apply tproxy version2 to your apache proxy code ?
> if so, i wonder whether tproxy2 core can support IPv4 mapped IPv6 address
> or not
>
>
>
>  As a result of this I couldn’t able to bind to the non-local IP.
>>
>>
>> The work around I tried is manipulating the bits of IPv4 mapped address,
>> but I don’t feel it to be convincing.
>>
>>
>> Regards,
>>
>> Puneet Mohan
>>
>>
>