--------------------- PatchSet 4097 Date: 2007/03/13 07:00:31 Author: amosjeffries Branch: squid3-ipv6 Tag: (none) Log: Dropped unnessesary ASN changes. Disabled alternate Macro definitions under --enable-ipv6 * Now builds the same stable code for IPv6 and IPv4 in old-transition areas. Members: include/config.h:1.7.4.9->1.7.4.10 src/ACLASN.h:1.5.6.4->1.5.6.5 src/asn.cc:1.16.6.8->1.16.6.9 Index: squid3/include/config.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/include/config.h,v retrieving revision 1.7.4.9 retrieving revision 1.7.4.10 diff -u -r1.7.4.9 -r1.7.4.10 --- squid3/include/config.h 5 Jan 2007 16:57:38 -0000 1.7.4.9 +++ squid3/include/config.h 13 Mar 2007 07:00:31 -0000 1.7.4.10 @@ -1,5 +1,5 @@ /* - * $Id: config.h,v 1.7.4.9 2007/01/05 16:57:38 hno Exp $ + * $Id: config.h,v 1.7.4.10 2007/03/13 07:00:31 amosjeffries Exp $ * * AUTHOR: Duane Wessels * @@ -208,103 +208,57 @@ 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 +//#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 #define INADDR_ANY_ASSIGN any_addr -#define INADDR_ANY_INIT htonl(INADDR_ANY) -#define MAXIPSTRLEN INET_ADDRSTRLEN -#define AF_FAMILY AF_INET -#define PF_FAMILY PF_INET -#define SA_IS_ANYADDR(s) \ - ((s).sin_addr.s_addr == INADDR_ANY) -#define INET_NTOA(s) \ - inet_ntoa(s) -#define SA_NTOA(s) \ - inet_ntoa((s).sin_addr) -#define ADDR_FROM_SA(s) \ - ((s).sin_addr) -#define PORT_FROM_SA(s) \ - ((s).sin_port) -#define FAMILY_FROM_SA(s) \ - ((s).sin_family) - -#define SAFE_INET_ADDR(host, addr) \ - safe_inet_addr(host,addr) - -#define ADDR_EQUALS(s1,s2) \ - (memcmp(&(s1), &(s2), sizeof(struct IN_ADDR)) == 0) - -#define ADDR_IS_ANYADDR(s) \ - ((s).s_addr == 0x00000000) - -#define ADDR_IS_NOADDR(s) \ - ((s).s_addr == 0xFFFFFFFF) - -#define GETHOSTBYNAME(name) \ - gethostbyname(name) - -#define NEEDS_BRACKETS(s) \ - 0 - -#define RFC1035BUILD_A_QUERY \ - rfc1035BuildAQuery - -#endif +#define INADDR_ANY_INIT htonl(INADDR_ANY) +#define MAXIPSTRLEN INET_ADDRSTRLEN +#define AF_FAMILY AF_INET +#define PF_FAMILY PF_INET +#define SA_IS_ANYADDR(s) ((s).sin_addr.s_addr == INADDR_ANY) +#define INET_NTOA(s) inet_ntoa(s) +#define SA_NTOA(s) inet_ntoa((s).sin_addr) +#define ADDR_FROM_SA(s) ((s).sin_addr) +#define PORT_FROM_SA(s) ((s).sin_port) +#define FAMILY_FROM_SA(s) ((s).sin_family) +#define SAFE_INET_ADDR(host, addr) safe_inet_addr(host,addr) +#define ADDR_EQUALS(s1,s2) (memcmp(&(s1), &(s2), sizeof(struct IN_ADDR)) == 0) +#define ADDR_IS_ANYADDR(s) ((s).s_addr == 0x00000000) +#define ADDR_IS_NOADDR(s) ((s).s_addr == 0xFFFFFFFF) +#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/ACLASN.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ACLASN.h,v retrieving revision 1.5.6.4 retrieving revision 1.5.6.5 diff -u -r1.5.6.4 -r1.5.6.5 --- squid3/src/ACLASN.h 25 Jan 2007 09:26:59 -0000 1.5.6.4 +++ squid3/src/ACLASN.h 13 Mar 2007 07:00:31 -0000 1.5.6.5 @@ -1,6 +1,6 @@ /* - * $Id: ACLASN.h,v 1.5.6.4 2007/01/25 09:26:59 amosjeffries Exp $ + * $Id: ACLASN.h,v 1.5.6.5 2007/03/13 07:00:31 amosjeffries Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -44,7 +44,7 @@ class CacheManager; -SQUIDCEXTERN int asnMatchIp(List *, struct IN_ADDR); +SQUIDCEXTERN int asnMatchIp(List *, struct IN_ADDR); SQUIDCEXTERN void asnInit(void); extern void asnRegisterWithCacheManager(CacheManager & manager); SQUIDCEXTERN void asnFreeMemory(void); @@ -69,7 +69,7 @@ static ACLStrategised SourceRegistryEntry_; static ACL::Prototype DestinationRegistryProtoype; static ACLStrategised DestinationRegistryEntry_; - List *data; + List *data; }; MEMPROXY_CLASS_INLINE(ACLASN) Index: squid3/src/asn.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/asn.cc,v retrieving revision 1.16.6.8 retrieving revision 1.16.6.9 diff -u -r1.16.6.8 -r1.16.6.9 --- squid3/src/asn.cc 25 Jan 2007 10:43:24 -0000 1.16.6.8 +++ squid3/src/asn.cc 13 Mar 2007 07:00:31 -0000 1.16.6.9 @@ -1,6 +1,6 @@ /* - * $Id: asn.cc,v 1.16.6.8 2007/01/25 10:43:24 amosjeffries Exp $ + * $Id: asn.cc,v 1.16.6.9 2007/03/13 07:00:31 amosjeffries Exp $ * * DEBUG: section 53 AS Number handling * AUTHOR: Duane Wessels, Kostas Anagnostakis @@ -68,7 +68,7 @@ /* explicit instantiation required for some systems */ -template cbdata_type List +template cbdata_type List ::CBDATA_List; /* @@ -79,7 +79,7 @@ struct _as_info { - List *as_number; + List *as_number; time_t expires; /* NOTUSED */ }; @@ -88,7 +88,7 @@ StoreEntry *entry; store_client *sc; HttpRequest *request; - ASN as_number; + int as_number; off_t offset; int reqofs; char reqbuf[AS_REQBUF_SZ]; @@ -112,9 +112,9 @@ typedef struct _rtentry rtentry_t; -static int asnAddNet(char *, ASN ); +static int asnAddNet(char *, int ); -static void asnCacheStart(ASN as); +static void asnCacheStart(int as); static STCB asHandleReply; @@ -133,20 +133,13 @@ /* PUBLIC */ int -asnMatchIp(List *data, struct IN_ADDR addr) +asnMatchIp(List *data, struct IN_ADDR addr) { - struct squid_radix_node *rn; as_info *e; m_IN_ADDR m_addr; - List *a = NULL; - List *b = NULL; - -#if 0 - unsigned long lh; - lh = ntohl(addr.s_addr); /* FIXME: Now point-less */ -#endif - + List *a = NULL; + List *b = NULL; debug(53, 3) ("asnMatchIp: Called for %s.\n", INET_NTOA(addr)); @@ -186,7 +179,7 @@ void ACLASN::prepareForUse() { - for (List *i = data; i; i = i-> + for (List *i = data; i; i = i-> next) asnCacheStart(i->element); } @@ -397,14 +390,14 @@ * number */ static int -asnAddNet(char *as_string, ASN as_number) +asnAddNet(char *as_string, int as_number) { rtentry_t *e; struct squid_radix_node *rn; char dbg1[MAXIPSTRLEN], dbg2[MAXIPSTRLEN]; - List **Tail = NULL; - List *q = NULL; + List **Tail = NULL; + List *q = NULL; as_info *asinfo = NULL; struct IN_ADDR in_a, in_m; @@ -486,7 +479,7 @@ for (Tail = &asinfo->as_number; *Tail; Tail = &(*Tail)->next) ; - q = new List (as_number); + q = new List (as_number); *(Tail) = q; @@ -540,8 +533,8 @@ static void destroyRadixNodeInfo(as_info * e_info) { - List *prev = NULL; - List *data = e_info->as_number; + List *prev = NULL; + List *data = e_info->as_number; while (data) { prev = data; @@ -587,7 +580,7 @@ { StoreEntry *sentry = (StoreEntry *)_sentry; rtentry_t *e = (rtentry_t *) rn; - List *q; + List *q; as_info *asinfo; struct IN_ADDR addr; @@ -632,7 +625,7 @@ { wordlist *W = NULL; char buf[32]; /* FIXME: Is this an arbitrary length ? */ - List *ldata = data; + List *ldata = data; while (ldata != NULL) { snprintf(buf, sizeof(buf), "%d", ldata->element); @@ -652,16 +645,16 @@ void ACLASN::parse() { - List **curlist = &data; - List **Tail; - List *q = NULL; + List **curlist = &data; + List **Tail; + List *q = NULL; char *t = NULL; for (Tail = curlist; *Tail; Tail = &((*Tail)->next)) ; while ((t = strtokFile())) { - q = new List (atoi(t)); + q = new List (atoi(t)); *(Tail) = q; Tail = &q->next; }