--------------------- PatchSet 4095 Date: 2007/03/12 10:37:48 Author: amosjeffries Branch: squid3-ipv6 Tag: (none) Log: Backout old partial IPv6 conversion from WCCP and WCCPv2 These protocols are presently IPv4-only and should be left as defined Members: src/wccp.cc:1.10.2.6->1.10.2.7 src/wccp2.cc:1.13.2.2->1.13.2.3 Index: squid3/src/wccp.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/wccp.cc,v retrieving revision 1.10.2.6 retrieving revision 1.10.2.7 diff -u -r1.10.2.6 -r1.10.2.7 --- squid3/src/wccp.cc 25 Jan 2007 10:43:24 -0000 1.10.2.6 +++ squid3/src/wccp.cc 12 Mar 2007 10:37:48 -0000 1.10.2.7 @@ -1,6 +1,6 @@ /* - * $Id: wccp.cc,v 1.10.2.6 2007/01/25 10:43:24 amosjeffries Exp $ + * $Id: wccp.cc,v 1.10.2.7 2007/03/12 10:37:48 amosjeffries Exp $ * * DEBUG: section 80 WCCP Support * AUTHOR: Glenn Chisholm @@ -38,8 +38,8 @@ * with IPv4 addresses, operating them as 32 bit int. (s_addr) * Unfortunately, we cannot any longer to keep this, since IPv6 * addrs are 128 bits. Hence we have to compare byte-a-byte four bites. - * Is wccp protocol documented for IPv6 ? */ -#error "Error. SQUID_WCCP is not ready for IPv6. Protocol not ready?" + * Is wccp protocol documented for IPv6 ? No. */ +#error "Error. WCCP Protocol does not presently support IPv6." #endif #include "squid.h" #include "comm.h" @@ -133,7 +133,7 @@ last_assign_buckets_change = 0; number_caches = 0; - if (!ADDR_EQUALS(Config.Wccp.router, any_addr)) + if (Config.Wccp.router.s_addr != any_addr.s_addr) if (!eventFind(wccpHereIam, NULL)) eventAdd("wccpHereIam", wccpHereIam, NULL, 5.0, 1); } @@ -143,11 +143,11 @@ { u_short port = WCCP_PORT; - struct SOCKADDR_IN router, local; + struct sockaddr_in router, local; socklen_t local_len, router_len; debug(80, 5) ("wccpConnectionOpen: Called\n"); - if (ADDR_IS_ANYADDR(Config.Wccp.router)) { + if (Config.Wccp.router.s_addr == any_addr.s_addr) { debug(1, 1) ("WCCP Disabled.\n"); return; } @@ -175,9 +175,12 @@ router_len = sizeof(router); memset(&router, '\0', router_len); - FAMILY_FROM_SA(router) = AF_INET; - PORT_FROM_SA(router) = htons(port); - ADDR_FROM_SA(router) = Config.Wccp.router; + + router.sin_family = AF_INET; + + router.sin_port = htons(port); + + router.sin_addr = Config.Wccp.router; if (connect(theWccpConnection, (struct sockaddr *) &router, router_len)) fatal("Unable to connect WCCP out socket"); @@ -189,7 +192,7 @@ if (getsockname(theWccpConnection, (struct sockaddr *) &local, &local_len)) fatal("Unable to getsockname on WCCP out socket"); - local_ip = ADDR_FROM_SA(local); + local_ip.s_addr = local.sin_addr.s_addr; } @@ -214,7 +217,7 @@ wccpHandleUdp(int sock, void *not_used) { - struct SOCKADDR_IN from; + struct sockaddr_in from; socklen_t from_len; int len; @@ -222,7 +225,7 @@ commSetSelect(sock, COMM_SELECT_READ, wccpHandleUdp, NULL, 0); - from_len = sizeof(struct SOCKADDR_IN); + from_len = sizeof(struct sockaddr_in); memset(&from, '\0', from_len); memset(&wccp_i_see_you, '\0', sizeof(wccp_i_see_you)); @@ -235,7 +238,7 @@ &from_len); debug(80, 3) ("wccpHandleUdp: %d bytes WCCP pkt from %s: type=%u, version=%u, change=%u, id=%u, number=%u\n", len, - SA_NTOA(from), + inet_ntoa(from.sin_addr), (unsigned) ntohl(wccp_i_see_you.type), (unsigned) ntohl(wccp_i_see_you.version), (unsigned) ntohl(wccp_i_see_you.change), @@ -245,7 +248,7 @@ if (len < 0) return; - if (!ADDR_EQUALS(Config.Wccp.router,ADDR_FROM_SA(from))) + if (Config.Wccp.router.s_addr != from.sin_addr.s_addr) return; if ((unsigned) ntohl(wccp_i_see_you.version) != (unsigned) Config.Wccp.version) @@ -256,7 +259,7 @@ if (ntohl(wccp_i_see_you.number) > WCCP_ACTIVE_CACHES) { debug(80, 1) ("Ignoring WCCP_I_SEE_YOU from %s with number of caches set to %d\n", - SA_NTOA(from), (int) ntohl(wccp_i_see_you.number)); + inet_ntoa(from.sin_addr), (int) ntohl(wccp_i_see_you.number)); return; } @@ -302,15 +305,11 @@ for (loop = 0; loop < (unsigned) ntohl(wccp_i_see_you.number); loop++) { assert(loop < WCCP_ACTIVE_CACHES); -#ifdef INET6 -// FIXME -#else if (wccp_i_see_you.wccp_cache_entry[loop].ip_addr.s_addr < local_ip.s_addr) return 0; + if (wccp_i_see_you.wccp_cache_entry[loop].ip_addr.s_addr == local_ip.s_addr) found = 1; -#endif - } return found; @@ -341,7 +340,6 @@ int buckets_per_cache; unsigned int loop; int bucket = 0; -// FIXME INET6 int *caches; int cache_len; char *buf; @@ -375,7 +373,7 @@ for (loop = 0; loop < number_caches; loop++) { int i; xmemcpy(&caches[loop], - &wccp_i_see_you.wccp_cache_entry[loop].ip_addr, + &wccp_i_see_you.wccp_cache_entry[loop].ip_addr.s_addr, sizeof(*caches)); for (i = 0; i < buckets_per_cache; i++) { Index: squid3/src/wccp2.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/wccp2.cc,v retrieving revision 1.13.2.2 retrieving revision 1.13.2.3 diff -u -r1.13.2.2 -r1.13.2.3 --- squid3/src/wccp2.cc 5 Jan 2007 16:59:43 -0000 1.13.2.2 +++ squid3/src/wccp2.cc 12 Mar 2007 10:37:49 -0000 1.13.2.3 @@ -1,6 +1,6 @@ /* - * $Id: wccp2.cc,v 1.13.2.2 2007/01/05 16:59:43 hno Exp $ + * $Id: wccp2.cc,v 1.13.2.3 2007/03/12 10:37:49 amosjeffries Exp $ * * DEBUG: section 80 WCCP Support * AUTHOR: Steven Wilton @@ -32,6 +32,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. * */ +#ifdef INET6 +/* This protocol seems to be very efficently programmed to deal + * with IPv4 addresses, operating them as 32 bit int. (s_addr) + * Unfortunately, we cannot any longer to keep this, since IPv6 + * addrs are 128 bits. Hence we have to compare byte-a-byte four bites. + * Is wccp2 protocol documented for IPv6 ? No. */ +#error "Error. WCCPv2 Protocol does not presently support IPv6." +#endif + #include "squid.h" #include "comm.h" #include "event.h"