[asterisk-dev] [asterisk-commits] simon.perreault: branch group/v6-new r274766 - /team/group/v6-new/main/

Tilghman Lesher tlesher at digium.com
Thu Jul 8 12:44:19 CDT 2010


On Thursday 08 July 2010 11:43:28 Simon Perreault wrote:
> On 2010-07-08 12:27, Tilghman Lesher wrote:
> > I had proposed that before in a code review, and he replied that it was
> > intentionally ugly, since the port numbers were not aligned with one
> > another in the union, thus making a port assignment to the wrong address
> > type a coding error.
>
> This interpretation is a bit narrow. The rationale has nothing to do
> with ports. It has to do with mistakenly using an IPv4 address as an
> IPv6 address and vice-versa. I realize now that my example given on the
> review board had to do with ports and could be misleading.

That's true, but if you buffer the header such that the port numbers between
the two items in the union match up, you can similarly use the IPv4-mapped
addresses within IPv6 to create an address which is backward-compatible with
using the IPv4 address, assuming the upper bits are set correctly.  Of course,
if the upper bits aren't set to the IPv4 mapping, the least significant
32-bits isn't an IPv4 address, but we can deal with that situation at least
better.

-- 
Tilghman Lesher
Digium, Inc. | Senior Software Developer
twitter: Corydon76 | IRC: Corydon76-dig (Freenode)
Check us out at: www.digium.com & www.asterisk.org



More information about the asterisk-dev mailing list