--------------------- PatchSet 4118 Date: 2007/03/24 06:05:04 Author: amosjeffries Branch: squid3-ipv6 Tag: (none) Log: conversion code cleanup Roll conversion further into fqdncache Members: include/config.h:1.7.4.10->1.7.4.11 src/ACLIP.cc:1.8.2.14->1.8.2.15 src/ACLMaxConnection.cc:1.4.6.2->1.4.6.3 src/client_db.cc:1.5.4.4->1.5.4.5 src/client_side.cc:1.68.2.10->1.68.2.11 src/protos.h:1.48.4.9->1.48.4.10 Index: squid3/include/config.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/include/config.h,v retrieving revision 1.7.4.10 retrieving revision 1.7.4.11 diff -u -r1.7.4.10 -r1.7.4.11 --- squid3/include/config.h 13 Mar 2007 07:00:31 -0000 1.7.4.10 +++ squid3/include/config.h 24 Mar 2007 06:05:04 -0000 1.7.4.11 @@ -1,5 +1,5 @@ /* - * $Id: config.h,v 1.7.4.10 2007/03/13 07:00:31 amosjeffries Exp $ + * $Id: config.h,v 1.7.4.11 2007/03/24 06:05:04 amosjeffries Exp $ * * AUTHOR: Duane Wessels * @@ -199,44 +199,18 @@ * This is hack to allow compiling IPv6-IPv4 version, * not disturbing branches others than squid3-ipv6 * FIXME: - * I know most part of this macros have to be - * moved into "inline" functions and moved into "squid.h" - * Some of them, must be also renamed for clarify. * Let them here until merging the Beta IPv6-branch - * so you can control de compilation modes from this _only_ file */ typedef int ASN; -//#ifdef INET6 -//#define IN_ADDR in6_addr -//#define SOCKADDR_IN sockaddr_in6 -//#define IP_MREQ ipv6_mreq -//#define INADDR_ANY_ASSIGN in6addr_any -//#define INADDR_ANY_INIT IN6ADR_ANY_INIT -//#define MAXIPSTRLEN INET6_ADDRSTRLEN -//#define AF_FAMILY AF_INET6 -//#define PF_FAMILY PF_INET6 //#define SA_IS_ANYADDR(s) (memcmp(&(s).sin6_addr, &in6addr_any, sizeof(in6addr_any)) == 0) //#define INET_NTOA(s) inet6_ntoa(s) //#define SA_NTOA(s) inet6_ntoa((s).sin6_addr) -//#define ADDR_FROM_SA(s) ((s).sin6_addr) -//#define PORT_FROM_SA(s) ((s).sin6_port) -//#define FAMILY_FROM_SA(s) ((s).sin6_family) //#define SAFE_INET_ADDR(host, addr) safe_inet6_addr(host,addr) -//#define ADDR_EQUALS(s1,s2) (memcmp(&(s1), &(s2), sizeof(struct IN_ADDR)) == 0) -//#define ADDR_IS_ANYADDR(s) (memcmp(&(s), &in6addr_any, sizeof(in6addr_any)) == 0) -//#define ADDR_IS_NOADDR(s) (memcmp(&(s), &no_addr, sizeof(no_addr)) == 0) //#define GETHOSTBYNAME(name) gethostbyname2(name, AF_INET6) //#define NEEDS_BRACKETS(s) SAFE_INET_ADDR(s,NULL) -//#define RFC1035BUILD_A_QUERY rfc1035BuildAAAAQuery -//#else -/* - * FIXME: - * Before merging the Beta IPv6-branch redefine - * the above macros for IPv4. - * If transition is O.K, at least IPv4 will be kept - */ + #define IN_ADDR in_addr #define SOCKADDR_IN sockaddr_in #define IP_MREQ ip_mreq @@ -258,7 +232,6 @@ #define GETHOSTBYNAME(name) gethostbyname(name) #define NEEDS_BRACKETS(s) 0 #define RFC1035BUILD_A_QUERY rfc1035BuildAQuery -//#endif /* Typedefs for missing entries on a system */ Index: squid3/src/ACLIP.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ACLIP.cc,v retrieving revision 1.8.2.14 retrieving revision 1.8.2.15 diff -u -r1.8.2.14 -r1.8.2.15 --- squid3/src/ACLIP.cc 19 Mar 2007 12:18:15 -0000 1.8.2.14 +++ squid3/src/ACLIP.cc 24 Mar 2007 06:05:05 -0000 1.8.2.15 @@ -1,5 +1,5 @@ /* - * $Id: ACLIP.cc,v 1.8.2.14 2007/03/19 12:18:15 amosjeffries Exp $ + * $Id: ACLIP.cc,v 1.8.2.15 2007/03/24 06:05:05 amosjeffries Exp $ * * DEBUG: section 28 Access Control * AUTHOR: Duane Wessels @@ -291,7 +291,6 @@ * ipcache hasn't been initialized */ - /* FIXME INET6 : wondering about making this lookup a public library function provided by IPAddress */ struct hostent *hp; if ((hp = gethostbyname(l_addr1)) == NULL) { @@ -315,8 +314,8 @@ case AF_INET6: { -#ifdef INET6 - IPAddress ipv6(*((in6_addr*)x)) +#ifdef USE_IPV6 + IPAddress ipv6(*((in6_addr*)x)); r->addr1 = ipv6; #else // Drop the IPv6 Address Index: squid3/src/ACLMaxConnection.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ACLMaxConnection.cc,v retrieving revision 1.4.6.2 retrieving revision 1.4.6.3 diff -u -r1.4.6.2 -r1.4.6.3 --- squid3/src/ACLMaxConnection.cc 21 Mar 2007 08:55:10 -0000 1.4.6.2 +++ squid3/src/ACLMaxConnection.cc 24 Mar 2007 06:05:05 -0000 1.4.6.3 @@ -1,5 +1,5 @@ /* - * $Id: ACLMaxConnection.cc,v 1.4.6.2 2007/03/21 08:55:10 amosjeffries Exp $ + * $Id: ACLMaxConnection.cc,v 1.4.6.3 2007/03/24 06:05:05 amosjeffries Exp $ * * DEBUG: section 28 Access Control * AUTHOR: Duane Wessels @@ -95,8 +95,7 @@ int ACLMaxConnection::match(ACLChecklist *checklist) { - /* FIXME INET6 : drop temp conversion */ struct IN_ADDR tmp; checklist->src_addr.GetInAddr(tmp); - return (clientdbEstablished(tmp, 0) > limit ? 1 : 0); + return (clientdbEstablished(checklist->src_addr, 0) > limit ? 1 : 0); } wordlist * Index: squid3/src/client_db.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/client_db.cc,v retrieving revision 1.5.4.4 retrieving revision 1.5.4.5 diff -u -r1.5.4.4 -r1.5.4.5 --- squid3/src/client_db.cc 5 Jan 2007 16:59:09 -0000 1.5.4.4 +++ squid3/src/client_db.cc 24 Mar 2007 06:05:05 -0000 1.5.4.5 @@ -1,6 +1,6 @@ /* - * $Id: client_db.cc,v 1.5.4.4 2007/01/05 16:59:09 hno Exp $ + * $Id: client_db.cc,v 1.5.4.5 2007/03/24 06:05:05 amosjeffries Exp $ * * DEBUG: section 0 Client Database * AUTHOR: Duane Wessels @@ -141,21 +141,23 @@ * -1. To get the current value, simply call with delta = 0. */ int - -clientdbEstablished(struct IN_ADDR addr, int delta) +clientdbEstablished(IPAddress &addr, int delta) { - char *key; + char key[MAX_IPSTRLEN]; ClientInfo *c; if (!Config.onoff.client_db) return 0; - key = (char *)INET_NTOA(addr); + addr.NtoA(key,MAX_IPSTRLEN); c = (ClientInfo *) hash_lookup(client_table, key); if (c == NULL) - c = clientdbAdd(addr); + { + /* FIXME INET6 : drop temporary conversion */ struct IN_ADDR tmp; addr.GetInAddr(tmp); + c = clientdbAdd(tmp); + } if (c == NULL) debug_trap("clientdbUpdate: Failed to add entry"); Index: squid3/src/client_side.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/client_side.cc,v retrieving revision 1.68.2.10 retrieving revision 1.68.2.11 diff -u -r1.68.2.10 -r1.68.2.11 --- squid3/src/client_side.cc 23 Mar 2007 06:35:18 -0000 1.68.2.10 +++ squid3/src/client_side.cc 24 Mar 2007 06:05:06 -0000 1.68.2.11 @@ -1,6 +1,6 @@ /* - * $Id: client_side.cc,v 1.68.2.10 2007/03/23 06:35:18 amosjeffries Exp $ + * $Id: client_side.cc,v 1.68.2.11 2007/03/24 06:05:06 amosjeffries Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -621,7 +621,8 @@ { debug(33, 3) ("ConnStateData::close: FD %d\n", fd); openReference = NULL; - clientdbEstablished(peer.sin_addr, -1); /* decrement */ + /* FIXME INET6 : drop temp conversion */ IPAddress tmp(peer.sin_addr); + clientdbEstablished(tmp, -1); /* decrement */ assert(areAllContextsForThisConnection()); freeAllContexts(); @@ -2814,7 +2815,8 @@ connState->readSomeData(); - clientdbEstablished(ADDR_FROM_SA(details->peer), 1); +/* FIXME INET6 : drop temp conversion */ IPAddress tmp(details->peer); + clientdbEstablished(tmp, 1); incoming_sockets_accepted++; } Index: squid3/src/protos.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/protos.h,v retrieving revision 1.48.4.9 retrieving revision 1.48.4.10 diff -u -r1.48.4.9 -r1.48.4.10 --- squid3/src/protos.h 23 Mar 2007 13:03:29 -0000 1.48.4.9 +++ squid3/src/protos.h 24 Mar 2007 06:05:07 -0000 1.48.4.10 @@ -1,6 +1,6 @@ /* - * $Id: protos.h,v 1.48.4.9 2007/03/23 13:03:29 amosjeffries Exp $ + * $Id: protos.h,v 1.48.4.10 2007/03/24 06:05:07 amosjeffries Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -91,7 +91,7 @@ SQUIDCEXTERN void clientdbDump(StoreEntry *); SQUIDCEXTERN void clientdbFreeMemory(void); -SQUIDCEXTERN int clientdbEstablished(struct IN_ADDR, int); +SQUIDCEXTERN int clientdbEstablished(IPAddress &, int); SQUIDCEXTERN void clientOpenListenSockets(void); SQUIDCEXTERN void clientHttpConnectionsClose(void); SQUIDCEXTERN void httpRequestFree(void *);