--------------------- PatchSet 5022 Date: 2007/07/15 09:18:11 Author: amosjeffries Branch: squid3-ipv6 Tag: (none) Log: Cleanup a IPv4-IPv6 boundary in WCCP2 component. Blockout some apparently unused code in SNMP component. Members: src/net_db.cc:1.13.4.23->1.13.4.24 src/protos.h:1.48.4.27->1.48.4.28 src/snmp_core.cc:1.10.8.11->1.10.8.12 src/wccp2.cc:1.13.2.9->1.13.2.10 Index: squid3/src/net_db.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/net_db.cc,v retrieving revision 1.13.4.23 retrieving revision 1.13.4.24 diff -u -r1.13.4.23 -r1.13.4.24 --- squid3/src/net_db.cc 11 Jun 2007 13:05:45 -0000 1.13.4.23 +++ squid3/src/net_db.cc 15 Jul 2007 09:18:11 -0000 1.13.4.24 @@ -1,6 +1,6 @@ /* - * $Id: net_db.cc,v 1.13.4.23 2007/06/11 13:05:45 amosjeffries Exp $ + * $Id: net_db.cc,v 1.13.4.24 2007/07/15 09:18:11 amosjeffries Exp $ * * DEBUG: section 38 Network Measurement Database * AUTHOR: Duane Wessels @@ -995,8 +995,9 @@ #endif } -int +#if 0 // AYJ: Looks to be unused code. +int netdbHops(IPAddress &addr) { #if USE_ICMP @@ -1011,6 +1012,7 @@ #endif return 256; } +#endif void netdbDump(StoreEntry * sentry) Index: squid3/src/protos.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/protos.h,v retrieving revision 1.48.4.27 retrieving revision 1.48.4.28 diff -u -r1.48.4.27 -r1.48.4.28 --- squid3/src/protos.h 11 Jun 2007 13:05:45 -0000 1.48.4.27 +++ squid3/src/protos.h 15 Jul 2007 09:18:11 -0000 1.48.4.28 @@ -1,6 +1,6 @@ /* - * $Id: protos.h,v 1.48.4.27 2007/06/11 13:05:45 amosjeffries Exp $ + * $Id: protos.h,v 1.48.4.28 2007/07/15 09:18:11 amosjeffries Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -279,9 +279,10 @@ SQUIDCEXTERN void snmpConnectionClose(void); SQUIDCEXTERN void snmpDebugOid(int lvl, oid * Name, snint Len); -SQUIDCEXTERN void addr2oid(struct IN_ADDR addr, oid * Dest); - -SQUIDCEXTERN struct IN_ADDR *oid2addr(oid * id); +#if 0 // INET6 : Apears to be unused code. +SQUIDCEXTERN void addr2oid(IPAddress addr, oid * Dest); +#endif +SQUIDCEXTERN IPAddress &oid2addr(oid * id); SQUIDCEXTERN IPAddress *client_entry(IPAddress *current); SQUIDCEXTERN variable_list *snmp_basicFn(variable_list *, snint *); @@ -400,7 +401,9 @@ SQUIDCEXTERN void netdbPingSite(const char *hostname); SQUIDCEXTERN void netdbDump(StoreEntry *); -SQUIDCEXTERN int netdbHops(struct IN_ADDR); +#if 0 // AYJ: Looks to be unused now. +SQUIDCEXTERN int netdbHops(IPAddress &); +#endif SQUIDCEXTERN void netdbFreeMemory(void); SQUIDCEXTERN int netdbHostHops(const char *host); SQUIDCEXTERN int netdbHostRtt(const char *host); Index: squid3/src/snmp_core.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/snmp_core.cc,v retrieving revision 1.10.8.11 retrieving revision 1.10.8.12 diff -u -r1.10.8.11 -r1.10.8.12 --- squid3/src/snmp_core.cc 12 Jul 2007 22:22:05 -0000 1.10.8.11 +++ squid3/src/snmp_core.cc 15 Jul 2007 09:18:11 -0000 1.10.8.12 @@ -1,6 +1,6 @@ /* - * $Id: snmp_core.cc,v 1.10.8.11 2007/07/12 22:22:05 amosjeffries Exp $ + * $Id: snmp_core.cc,v 1.10.8.12 2007/07/15 09:18:11 amosjeffries Exp $ * * DEBUG: section 49 SNMP support * AUTHOR: Glenn Chisholm @@ -1113,30 +1113,38 @@ debug(49, lvl) ("%s", buf); } +#if 0 // INET6 : Appears to be unused code. void - -addr2oid(struct IN_ADDR addr, oid * Dest) +addr2oid(IPAddress &addr, oid * Dest) { u_char *cp; - cp = (u_char *) & (addr.s_addr); + + if(!addr.IsIPv4()) { + // FIXME INET6 : SNMP for IPv6 has not yet bee coded. + assert(false); + return; + } + cp = (u_char *) &(addr.s_addr); Dest[0] = *cp++; Dest[1] = *cp++; Dest[2] = *cp++; Dest[3] = *cp++; } +#endif -struct IN_ADDR - * - oid2addr(oid * id) +IPAddress & +oid2addr(oid * id) { - - static struct IN_ADDR laddr; - u_char *cp = (u_char *) & (laddr.s_addr); + // FIXME INET6 : SNMP for IPv6 has not yet been coded. + static IPAddress laddr; + struct in_addr iaddr; + u_char *cp = (u_char *) &(iaddr.s_addr); cp[0] = id[0]; cp[1] = id[1]; cp[2] = id[2]; cp[3] = id[3]; - return &laddr; + laddr = iaddr; + return laddr; } /* SNMP checklists */ Index: squid3/src/wccp2.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/wccp2.cc,v retrieving revision 1.13.2.9 retrieving revision 1.13.2.10 diff -u -r1.13.2.9 -r1.13.2.10 --- squid3/src/wccp2.cc 8 Jun 2007 13:29:11 -0000 1.13.2.9 +++ squid3/src/wccp2.cc 15 Jul 2007 09:18:11 -0000 1.13.2.10 @@ -1,6 +1,6 @@ /* - * $Id: wccp2.cc,v 1.13.2.9 2007/06/08 13:29:11 amosjeffries Exp $ + * $Id: wccp2.cc,v 1.13.2.10 2007/07/15 09:18:11 amosjeffries Exp $ * * DEBUG: section 80 WCCP Support * AUTHOR: Steven Wilton @@ -1518,9 +1518,7 @@ struct wccp2_mask_identity_info_t *wccp2_mask_identity_info_ptr; - struct sockaddr_in router; - int router_len; - u_short port = WCCP_PORT; + IPAddress router; debugs(80, 6, "wccp2HereIam: Called"); @@ -1535,10 +1533,7 @@ return; } - router_len = sizeof(router); - memset(&router, '\0', router_len); - router.sin_family = AF_INET; - router.sin_port = htons(port); + router.SetPort(WCCP_PORT); /* for each router on each service send a packet */ service_list_ptr = wccp2_service_list_head; @@ -1547,7 +1542,7 @@ debugs(80, 5, "wccp2HereIam: sending to service id " << service_list_ptr->info.service_id); for (router_list_ptr = &service_list_ptr->router_list_head; router_list_ptr->next != NULL; router_list_ptr = router_list_ptr->next) { - router.sin_addr = router_list_ptr->router_sendto_address; + router = router_list_ptr->router_sendto_address; /* Set the cache id (ip) */ @@ -1579,9 +1574,8 @@ /* Send the packet */ if (wccp2_numrouters > 1) { -/* FIXME INET6 : drop temp convesion baoundary */ IPAddress tmp_rtr(router); comm_udp_sendto(theWccp2Connection, - tmp_rtr, + router, &service_list_ptr->wccp_packet, service_list_ptr->wccp_packet_size); } else {