[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: IPv6 Squid Package available



Oliver Baltzer <obaltzer@cs.dal.ca> writes:

> On 07-Jun-2003 23:21 +0300, Kalle Olavi Niemitalo was heard to say:
>> Could you put the source packages there too?
>
> Done...

Thanks.

It seems to me that there are several bugs in lib/rfc1035.c,
function rfc1035BuildPTRQuery.  The first one is here:

#if INET6
    if (IN6_IS_ADDR_V4MAPPED(&addr)) {
      i = (unsigned int) ntohl(addr.s6_addr[3]);
#else
      i = (unsigned int) ntohl(addr.s_addr);
#endif

In the v4-mapped case, this reads addr.s6_addr[3], which is just
one byte.  addr.s6_addr32[3] ought to work better.

Then, the function does this:

        unsigned char * a = (unsigned char *)rev;
        snprintf(rev, 72,
            "%x.%x.%x.%x.%x.%x.%x.%x."
            "%x.%x.%x.%x.%x.%x.%x.%x."
            "%x.%x.%x.%x.%x.%x.%x.%x."
            "%x.%x.%x.%x.%x.%x.%x.%x.ip6.int",
            a[0] & 0x0f, a[0] & 0xf0,
            a[1] & 0x0f, a[1] & 0xf0,
            a[2] & 0x0f, a[2] & 0xf0,
            /* etc. up to a[15] */);

This is the real nest.  The code tries to read the octets of the
address from rev[], which does not contain the address yet.  It
should use addr.s6_addr instead.

The octets are in the wrong order.  In IN6ADDR_LOOPBACK_INIT
which denotes ::1, the 1 is in s6_addr[15].  This is the least
significant octet and should end up in the leftmost DNS labels.

For the high nibbles, the code masks unneeded bits off but fails
to shift the rest to the right, so there will be extra zeroes in
the output.  It should use a[0] >> 4 instead of a[0] & 0xf0.

Finally, the query should be made in ip6.arpa.

I haven't actually tested this yet.



Reply to: