Re: Ip::Address::IsAnyAddr

From: Alex Rousskov <rousskov_at_measurement-factory.com>
Date: Mon, 11 Jul 2011 17:26:38 -0600

On 07/11/2011 01:35 PM, Tsantilas Christos wrote:
> On 07/11/2011 08:52 AM, Amos Jeffries wrote:
>> 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. :(

We need to decide whether a single address can be both IPv4 and IPv6 at
the same time. If yes, then IsIPv*() can return true for IsNoAddr().
Otherwise, IsIPv*() should assert that the address is defined and the
caller has to be more careful.

There are about 40 calls for IsIPv4() and 30 calls for IsIPv6(). Do we
have a lot of code that thinks that "not IPv4" implies "IPv6" and "not
IPv6" implies "IPv4"? Perhaps we should rename IsIP* to IsIp* and
carefully check each case for IsNoAddr()?

Thank you,

Alex.
Received on Mon Jul 11 2011 - 23:28:14 MDT

This archive was generated by hypermail 2.2.0 : Fri Jul 22 2011 - 12:00:09 MDT