Re: IPv6 Squid Package available
Hi Kalle,
On 16-Jun-2003 00:13 +0300, Kalle Olavi Niemitalo was heard to say:
> #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.
I have added those changes as dpatch. The new packages are available at
http://init.ca/debian/squid-IPv6/ . I apologize for the change in the
version numbering, but I think now it is "more correct".
> Finally, the query should be made in ip6.arpa.
ip6.int is correct.
Somebody also provides an apt source for the packages:
deb http://people.hypercore.co.jp/~nsaito/squid/ ./
there are still the old packages, but I think they will be updated soon.
Regards,
Oliver
Reply to: