Re: Ip::Address::IsAnyAddr

From: Tsantilas Christos <chtsanti_at_users.sourceforge.net>
Date: Mon, 11 Jul 2011 22:35:36 +0300

On 07/11/2011 08:52 AM, Amos Jeffries wrote:
> On 08/07/11 02:08, Tsantilas Christos wrote:
>> On 07/04/2011 01:35 PM, Amos Jeffries wrote:
>>> On 29/06/11 23:23, Amos Jeffries wrote:
>>>> On 29/06/11 21:26, Tsantilas Christos wrote:
>>>>>
>>>>> Hi all,
>>>>> I am having a small problem with Ip::Address::IsAnyAddr method. As
>>>>> it is
>>>>> implemented in the case the ipaddress is an IPv4 address and it is
>>>>> AnyAddr, the IsAnyAddr method will return false.
>>>>>
>>>>> I believe we should fix it as follows:
>>>>>
>>>
>>> Actually that led to blocker regression issues with bind() of 0.0.0.0.
>>> Reverted it for now.
>>>
>>> What exactly was the "small problem" you mentioned?
>>
>> I am trying to fix %la and %lp log formating codes to log the squid
>> listening port ip address and port number in the case of intercepted
>> connections. Currently they print the remote server ip address and port
>> number.
>>
>> So I need to print the ip address using the related http_port_list
>> structure.
>>
>> I need to do a test here http_port_list::s.IsAnyAddr to see it is
>> listening to anyaddr (0.0.0.0), to print a "-", or not to print its ip
>> address.
>> Looks that when no ip address specified it is set to IPv4 anyAddr.
>>
>> Is it normal to the IsAnyAddr to not return true if it is an ipv4
>> anyaddr?
>
> Not really. This is a side effect of retrofitting split-stack changes
> into dual-stack designed code where 0.0.0.0 implies ::ffff:/96 rather
> than ANYADDR.

The joke is that I can not find an easy workaround. In the worst case
is it OK to add a new member (eg. isAnyAddr2() ) to the Ip::Address class?

>
> The change you made was the right fix, but it now appears we are going
> to have to do a deeper check of side effects before it can go in. I
> think the DNS issues that popped up immediately are due to IsIPv6()
> being true when IsAnyAddr().

If IsIPv6 is the only problem, it has an easy solution. Just removing
the IsAnyAddr check from IsIPv6 should be enough:

Ip::Address::IsIPv6() const
{
  return IsNoAddr() || !IN6_IS_ADDR_V4MAPPED( &m_SocketAddr.sin6_addr );
}

But there are many many checks with IsAnyAddr in squid in various
places, we may have other problems...

> Disconnecting the Is*() from each other will have to be the first
> minimal step. Then checking the code which ises them to see that no
> other assumptions are made. :(
>
> Amos
Received on Mon Jul 11 2011 - 19:35:55 MDT

This archive was generated by hypermail 2.2.0 : Tue Jul 12 2011 - 12:00:03 MDT