Re: IPv6 support

From: Xuân Baldauf <development--squid-dev--squid-cache.org@dont-contact.us>
Date: Thu, 03 Mar 2005 01:02:21 +0100

Henrik Nordstrom wrote:

> On Thu, 24 Feb 2005, [ISO-8859-1] Xuân Baldauf wrote:
>
>> Also, it would be nice if Henrik could start with some comments he
>> said to have on these first IPv6 steps. :-)
>
>
> I am still here ;-)
>
> The main comment is that we should try to cut down on the number of
> #ifdefs. I prefer introducing a new class to abstract the address info
> even if this is just a thin or almost transparent wrapper around
> sockaddr_in or in_addr when ipv6 is not enabled.

Hehe,

I'm not a friend of #ifdefs. In my programming language of choice,
#ifdefs are unknown. But the current CVS HEAD is only partially "object
orientized", and especially the code which does address handling and the
like is currently not enough "object orientized" to do just a "drop in
replacement" of a class.

The "#if ENABLE_IPV6" conditions are to provide a more smooth transition
to enabled IPv6 support. The idea is: When "ENABLE_IPV6==0", then
everything is as before. But when ENABLE_IPV6==1, every variable and
every struct which refers IPv4 adresses (the old way) just do not exist.
This triggers compiler error messages, which show automagically where
those variables and structs where referenced. This is used to find the
next places where conversion work has to be done. If no compiler error
messages are left, we either are finished or at least have converted a
complete, independent subsystem.

This approach (of breaking compileability with intent) has the side
effect that, until IPv6 support has been provided nearly completely, the
modified code would not compile. Thus, the modification is encapsulated
by "#if ENABLE_IPV6" to protect uninterested developers to be forced to
fix IPv6 generated compiler error messages. Because IP address
encapsulation is lacking, just subclassing an "Address" class to an
"IPv6Address" class is not possible (the "Address" class is missing...
;-)). That is why I think that this, under these circumstances, is a
good approach. (I think that this is also better than letting IPv6
support dangle in a separate branch, because if someone hacks on the
main branch and wand wants to change code within an "#if ENABLE_IPV6"
... "#endif" section, then this guy then has the opportunity to Do It
Right The First Time (tm) if he|she likes. If not, then changing the
"#else".."#endif" subsection will still be fine. At least nobody hacking
the HEAD tree would be able to create a failed sync between "HEAD" and
"squid-ipv6" branches, because a separate "squid-ipv6" branch would not
exist, the "#if ENABLE_IPV6" sections are the branch.)

Having "#if ENABLE_IPV6" statements should be only temporary. When there
are no IPv6 support compile error messages anymore, ENABLE_IPV6==1
should become the default. After some more testing, all

#if ENABLE_IPV6
  /* new code */
#else
  /* old code */
#endif

sections in the sourcecode shall be replaced by

  /* new code */

so the "#if ENABLE_IPV6" statements will then be removed, too.

This will be possible, because "ENABLE_IPV6" does not really mean that
we are going away from IPv4, but just that the software will be IP
version neutral, explicitly supporting both IPv4 and IPv6.

>
> Regards
> Henrik

So far,
Xuân. :-)
Received on Wed Mar 02 2005 - 17:02:35 MST

This archive was generated by hypermail pre-2.1.9 : Fri Apr 01 2005 - 12:00:04 MST