--------------------- PatchSet 1473 Date: 2005/06/27 12:40:27 Author: rmartinez Branch: squid3-ipv6 Tag: (none) Log: Arranging code to keep IPv4 Members: src/ACLIP.cc:1.8.2.6->1.8.2.7 Index: squid3/src/ACLIP.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ACLIP.cc,v retrieving revision 1.8.2.6 retrieving revision 1.8.2.7 diff -u -r1.8.2.6 -r1.8.2.7 --- squid3/src/ACLIP.cc 25 May 2005 14:43:32 -0000 1.8.2.6 +++ squid3/src/ACLIP.cc 27 Jun 2005 12:40:27 -0000 1.8.2.7 @@ -1,5 +1,5 @@ /* - * $Id: ACLIP.cc,v 1.8.2.6 2005/05/25 14:43:32 rmartinez Exp $ + * $Id: ACLIP.cc,v 1.8.2.7 2005/06/27 12:40:27 rmartinez Exp $ * * DEBUG: section 28 Access Control * AUTHOR: Duane Wessels @@ -190,10 +190,6 @@ char junk; int a1 = 0; - /* dotted notation 2003:800::3 */ - /* 255.255.255.0 */ - if (SAFE_INET_ADDR(asc, mask)) - return 1; memset(mask, 0xff, sizeof(*mask)); @@ -202,23 +198,32 @@ return 1; } - unsigned int bp; - /* An int mask 128, 32 */ if ((sscanf(asc, "%d%c", &a1,&junk)==1) && (a1 <= (AF_FAMILY==AF_INET6)? 128:32) && (a1 >= 0)) { +#ifdef INET6 + unsigned int bp; for (bp = a1/8; bp < sizeof(struct IN_ADDR); bp++) { int clearbits = (bp+1)*8 - a1; if (clearbits > 0) { - if (clearbits >= 8) + if (clearbits >= 8) mask->s6_addr[bp] = 0x00; else mask->s6_addr[bp] = 0xff << clearbits; } } +#else + mask->s_addr = a1 ? htonl(0xfffffffful << (32 - a1)) : 0; +#endif return 1; } + /* dotted notation 2003:800::3 */ + /* 255.255.255.0 */ + if (SAFE_INET_ADDR(asc, mask)) + return 1; + + debug(28, 0) ("DecodeAddress: Invalid IP address: '%s'\n", asc); return 0;