--------------------- PatchSet 4164 Date: 2007/04/05 09:23:57 Author: amosjeffries Branch: squid3-ipv6 Tag: (none) Log: patch cleaning. Backout of old conversion code. Members: src/ipc.cc:1.9.4.6->1.9.4.7 src/ipcache.cc:1.9.2.16->1.9.2.17 src/net_db.cc:1.13.4.5->1.13.4.6 src/protos.h:1.48.4.10->1.48.4.11 src/recv-announce.cc:1.2.10.1->1.2.10.2 src/redirect.cc:1.15.4.3->1.15.4.4 src/snmp_agent.cc:1.7.4.3->1.7.4.4 src/structs.h:1.66.2.10->1.66.2.11 src/tools.cc:1.22.2.8->1.22.2.9 src/tunnel.cc:1.13.4.4->1.13.4.5 src/url.cc:1.9.8.6->1.9.8.7 Index: squid3/src/ipc.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ipc.cc,v retrieving revision 1.9.4.6 retrieving revision 1.9.4.7 diff -u -r1.9.4.6 -r1.9.4.7 --- squid3/src/ipc.cc 9 Mar 2007 05:48:32 -0000 1.9.4.6 +++ squid3/src/ipc.cc 5 Apr 2007 09:23:57 -0000 1.9.4.7 @@ -1,6 +1,6 @@ /* - * $Id: ipc.cc,v 1.9.4.6 2007/03/09 05:48:32 amosjeffries Exp $ + * $Id: ipc.cc,v 1.9.4.7 2007/04/05 09:23:57 amosjeffries Exp $ * * DEBUG: section 54 Interprocess Communication * AUTHOR: Duane Wessels @@ -79,9 +79,9 @@ { pid_t pid; - struct SOCKADDR_IN ChS; + struct sockaddr_in ChS; - struct SOCKADDR_IN PaS; + struct sockaddr_in PaS; int crfd = -1; int prfd = -1; int cwfd = -1; @@ -207,7 +207,7 @@ } debug(54, 3) ("ipcCreate: FD %d sockaddr %s:%d\n", - pwfd, SA_NTOA(PaS), ntohs(PORT_FROM_SA(PaS))); + pwfd, inet_ntoa(PaS.sin_addr), ntohs(PaS.sin_port)); len = sizeof(ChS); memset(&ChS, '\0', len); @@ -217,7 +217,7 @@ } debug(54, 3) ("ipcCreate: FD %d sockaddr %s:%d\n", - crfd, SA_NTOA(ChS), ntohs(PORT_FROM_SA(ChS))); + crfd, inet_ntoa(ChS.sin_addr), ntohs(ChS.sin_port)); } if (type == IPC_TCP_SOCKET) { Index: squid3/src/ipcache.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ipcache.cc,v retrieving revision 1.9.2.16 retrieving revision 1.9.2.17 diff -u -r1.9.2.16 -r1.9.2.17 --- squid3/src/ipcache.cc 23 Mar 2007 06:57:33 -0000 1.9.2.16 +++ squid3/src/ipcache.cc 5 Apr 2007 09:23:58 -0000 1.9.2.17 @@ -1,6 +1,6 @@ /* - * $Id: ipcache.cc,v 1.9.2.16 2007/03/23 06:57:33 amosjeffries Exp $ + * $Id: ipcache.cc,v 1.9.2.17 2007/04/05 09:23:58 amosjeffries Exp $ * * DEBUG: section 14 IP Cache * AUTHOR: Harvest Derived @@ -343,7 +343,7 @@ i->addrs.bad_mask = (unsigned char *)xcalloc(ipcount, sizeof(unsigned char)); for (j = 0, k = 0; k < ipcount; k++) { - if (SAFE_INET_ADDR(A[k], &i->addrs.in_addrs[j])) + if (safe_inet_addr(A[k], &i->addrs.in_addrs[j])) j++; else debug(14, 1) ("ipcacheParse: Invalid IP address '%s' in response to '%s'\n", A[k], name); @@ -416,7 +416,6 @@ } #endif -#if !defined(INET6) || defined(INET6DUALSTACK) if (answers[k].type == RFC1035_TYPE_A) { if (answers[k].rdlength != sizeof(struct in_addr)) { debug(14, 1)("ipcacheParse: Invalid IPv4 address in response to '%s'\n", name); @@ -425,7 +424,6 @@ na++; continue; } -#endif } if (na == 0) { @@ -441,9 +439,8 @@ if (answers[k]._class != RFC1035_CLASS_IN) continue; -#if !defined(INET6) || defined(INET6DUALSTACK) if (answers[k].type == RFC1035_TYPE_A) { - if (answers[k].rdlength != 4) + if (answers[k].rdlength != sizeof(struct in_addr)) continue; #ifdef INET6 @@ -965,7 +962,6 @@ ipaddr); #endif - return 1; } Index: squid3/src/net_db.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/net_db.cc,v retrieving revision 1.13.4.5 retrieving revision 1.13.4.6 diff -u -r1.13.4.5 -r1.13.4.6 --- squid3/src/net_db.cc 17 Feb 2007 11:03:39 -0000 1.13.4.5 +++ squid3/src/net_db.cc 5 Apr 2007 09:23:58 -0000 1.13.4.6 @@ -1,6 +1,6 @@ /* - * $Id: net_db.cc,v 1.13.4.5 2007/02/17 11:03:39 amosjeffries Exp $ + * $Id: net_db.cc,v 1.13.4.6 2007/04/05 09:23:58 amosjeffries Exp $ * * DEBUG: section 38 Network Measurement Database * AUTHOR: Duane Wessels @@ -115,7 +115,7 @@ netdbHashInsert(netdbEntry * n, struct IN_ADDR addr) { - xstrncpy(n->network, INET_NTOA(networkFromInaddr(addr)), MAXIPSTRLEN); + xstrncpy(n->network, inet_ntoa(networkFromInaddr(addr)), MAXIPSTRLEN); n->hash.key = n->network; assert(hash_lookup(addr_table, n->network) == NULL); hash_join(addr_table, &n->hash); @@ -249,17 +249,15 @@ } static netdbEntry * - netdbLookupAddr(IPAddress addr) { netdbEntry *n; - char *key = (char *)INET_NTOA(networkFromInaddr(addr)); + char *key = inet_ntoa(networkFromInaddr(addr)); n = (netdbEntry *) hash_lookup(addr_table, key); return n; } static netdbEntry * - netdbAdd(struct IN_ADDR addr) { netdbEntry *n; @@ -347,8 +345,7 @@ } static struct IN_ADDR - - networkFromInaddr(IPAddress in) +networkFromInaddr(IPAddress in) { struct IN_ADDR a; in.GetInAddr(a); Index: squid3/src/protos.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/protos.h,v retrieving revision 1.48.4.10 retrieving revision 1.48.4.11 diff -u -r1.48.4.10 -r1.48.4.11 --- squid3/src/protos.h 24 Mar 2007 06:05:07 -0000 1.48.4.10 +++ squid3/src/protos.h 5 Apr 2007 09:23:58 -0000 1.48.4.11 @@ -1,6 +1,6 @@ /* - * $Id: protos.h,v 1.48.4.10 2007/03/24 06:05:07 amosjeffries Exp $ + * $Id: protos.h,v 1.48.4.11 2007/04/05 09:23:58 amosjeffries Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -367,7 +367,7 @@ int *timeout); SQUIDCEXTERN void neighborAddAcl(const char *, const char *); -SQUIDCEXTERN void neighborsUdpAck(const cache_key *, icp_common_t *, const struct SOCKADDR_IN *); +SQUIDCEXTERN void neighborsUdpAck(const cache_key *, icp_common_t *, const struct sockaddr_in *); SQUIDCEXTERN void neighborAdd(const char *, const char *, int, int, int, int, int); SQUIDCEXTERN void neighbors_init(void); extern void neighborsRegisterWithCacheManager(CacheManager & manager); @@ -391,12 +391,12 @@ SQUIDCEXTERN void dump_peer_options(StoreEntry *, peer *); SQUIDCEXTERN int peerHTTPOkay(const peer *, HttpRequest *); -SQUIDCEXTERN peer *whichPeer(const struct SOCKADDR_IN *from); +SQUIDCEXTERN peer *whichPeer(const struct sockaddr_in *from); SQUIDCEXTERN void netdbInit(void); extern void netdbRegisterWitHCacheManager(CacheManager & manager); -SQUIDCEXTERN void netdbHandlePingReply(const struct SOCKADDR_IN *from, int hops, int rtt); +SQUIDCEXTERN void netdbHandlePingReply(const struct sockaddr_in *from, int hops, int rtt); SQUIDCEXTERN void netdbPingSite(const char *hostname); SQUIDCEXTERN void netdbDump(StoreEntry *); @@ -455,7 +455,7 @@ /* ident.c */ #if USE_IDENT -SQUIDCEXTERN void identStart(struct SOCKADDR_IN *me, struct SOCKADDR_IN *my_peer, +SQUIDCEXTERN void identStart(struct sockaddr_in *me, struct sockaddr_in *my_peer, IDCB * callback, void *cbdata); SQUIDCEXTERN void identInit(void); #endif Index: squid3/src/recv-announce.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/recv-announce.cc,v retrieving revision 1.2.10.1 retrieving revision 1.2.10.2 diff -u -r1.2.10.1 -r1.2.10.2 --- squid3/src/recv-announce.cc 25 Apr 2005 13:42:29 -0000 1.2.10.1 +++ squid3/src/recv-announce.cc 5 Apr 2007 09:23:59 -0000 1.2.10.2 @@ -1,6 +1,6 @@ /* - * $Id: recv-announce.cc,v 1.2.10.1 2005/04/25 13:42:29 rmartinez Exp $ + * $Id: recv-announce.cc,v 1.2.10.2 2007/04/05 09:23:59 amosjeffries Exp $ * * DEBUG: section 0 Announcement Server * AUTHOR: Harvest Derived @@ -86,7 +86,7 @@ { char buf[RECV_BUF_SIZE]; - struct SOCKADDR_IN R; + struct sockaddr_in R; socklen_t len; struct hostent *hp = NULL; @@ -127,7 +127,7 @@ hp = gethostbyaddr(ip, 4, AF_INET); printf("==============================================================================\n"); printf("Received from %s [%s]\n", - INET_NTOA(R.sin_addr), + inet_ntoa(R.sin_addr), (hp && hp->h_name) ? hp->h_name : "Unknown"); fputs(buf, stdout); fflush(stdout); Index: squid3/src/redirect.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/redirect.cc,v retrieving revision 1.15.4.3 retrieving revision 1.15.4.4 diff -u -r1.15.4.3 -r1.15.4.4 --- squid3/src/redirect.cc 5 Jan 2007 16:59:32 -0000 1.15.4.3 +++ squid3/src/redirect.cc 5 Apr 2007 09:23:59 -0000 1.15.4.4 @@ -1,6 +1,6 @@ /* - * $Id: redirect.cc,v 1.15.4.3 2007/01/05 16:59:32 hno Exp $ + * $Id: redirect.cc,v 1.15.4.4 2007/04/05 09:23:59 amosjeffries Exp $ * * DEBUG: section 61 Redirector * AUTHOR: Duane Wessels @@ -164,7 +164,7 @@ snprintf(buf, 8192, "%s %s/%s %s %s\n", r->orig_url, - INET_NTOA(r->client_addr), + inet_ntoa(r->client_addr), fqdn, r->client_ident[0] ? rfc1738_escape(r->client_ident) : dash_str, r->method_s); Index: squid3/src/snmp_agent.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/snmp_agent.cc,v retrieving revision 1.7.4.3 retrieving revision 1.7.4.4 diff -u -r1.7.4.3 -r1.7.4.4 --- squid3/src/snmp_agent.cc 5 Jan 2007 16:59:33 -0000 1.7.4.3 +++ squid3/src/snmp_agent.cc 5 Apr 2007 09:23:59 -0000 1.7.4.4 @@ -1,6 +1,6 @@ /* - * $Id: snmp_agent.cc,v 1.7.4.3 2007/01/05 16:59:33 hno Exp $ + * $Id: snmp_agent.cc,v 1.7.4.4 2007/04/05 09:23:59 amosjeffries Exp $ * * DEBUG: section 49 SNMP Interface * AUTHOR: Kostas Anagnostakis @@ -197,7 +197,7 @@ laddr = oid2addr(&Var->name[LEN_SQ_MESH + 3]); for (p = Config.peers; p != NULL; p = p->next, cnt++) - if (ADDR_EQUALS(ADDR_FROM_SA(p->in_addr),*laddr)) + if (p->in_addr.sin_addr.s_addr == laddr->s_addr) break; if (p == NULL) { Index: squid3/src/structs.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/structs.h,v retrieving revision 1.66.2.10 retrieving revision 1.66.2.11 diff -u -r1.66.2.10 -r1.66.2.11 --- squid3/src/structs.h 1 Mar 2007 09:25:47 -0000 1.66.2.10 +++ squid3/src/structs.h 5 Apr 2007 09:24:00 -0000 1.66.2.11 @@ -1,6 +1,6 @@ /* - * $Id: structs.h,v 1.66.2.10 2007/03/01 09:25:47 amosjeffries Exp $ + * $Id: structs.h,v 1.66.2.11 2007/04/05 09:24:00 amosjeffries Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -76,7 +76,7 @@ long reqid; int outlen; - struct SOCKADDR_IN from; + struct sockaddr_in from; struct snmp_pdu *PDU; ACLChecklist *acl_checklist; @@ -125,8 +125,7 @@ struct _sockaddr_in_list { - - struct SOCKADDR_IN s; + struct sockaddr_in s; sockaddr_in_list *next; }; @@ -134,7 +133,7 @@ { http_port_list *next; - struct SOCKADDR_IN s; + struct sockaddr_in s; char *protocol; /* protocol name */ char *name; /* visible name */ char *defaultsite; /* default web site */ @@ -975,7 +974,7 @@ char *host; peer_t type; - struct SOCKADDR_IN in_addr; + struct sockaddr_in in_addr; struct { @@ -1174,7 +1173,7 @@ struct _netdbEntry { hash_link hash; /* must be first */ - char network[MAXIPSTRLEN]; + char network[MAX_IPSTRLEN]; int pings_sent; int pings_recv; double hops; Index: squid3/src/tools.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/tools.cc,v retrieving revision 1.22.2.8 retrieving revision 1.22.2.9 diff -u -r1.22.2.8 -r1.22.2.9 --- squid3/src/tools.cc 31 Mar 2007 03:02:41 -0000 1.22.2.8 +++ squid3/src/tools.cc 5 Apr 2007 09:24:00 -0000 1.22.2.9 @@ -1,6 +1,6 @@ /* - * $Id: tools.cc,v 1.22.2.8 2007/03/31 03:02:41 amosjeffries Exp $ + * $Id: tools.cc,v 1.22.2.9 2007/04/05 09:24:00 amosjeffries Exp $ * * DEBUG: section 21 Misc Functions * AUTHOR: Harvest Derived @@ -609,7 +609,7 @@ if (h != NULL) { /* DNS lookup successful */ /* use the official name from DNS lookup */ - xstrncpy(host, h->h_name, SQUIDHOSTNAMELEN ); + xstrncpy(host, h->h_name, SQUIDHOSTNAMELEN); debug(50, 4) ("getMyHostname: resolved IP %s to '%s'\n", sa.NtoA(buf,MAX_IPSTRLEN), host); @@ -619,7 +619,8 @@ return host; } - debug(50, 1) ("WARNING: failed to resolve %s to a fully qualified hostname\n", sa.NtoA(buf,MAX_IPSTRLEN) ); + debug(50, 1) ("WARNING: failed to resolve %s to a fully qualified hostname\n", + sa.NtoA(buf,MAX_IPSTRLEN) ); } /* @@ -1004,15 +1005,9 @@ struct IN_ADDR inaddrFromHostent(const struct hostent *hp) { -/* FIXME INET6 : intention is to do away with this function entirey. Its not needed in new object. */ +/* FIXME INET6 : intention is to do away with this function entirley. Its not really needed. */ IPAddress s(hp->h_addr_list[0]); struct IN_ADDR res; -/* - struct IN_ADDR s; - xmemcpy(&s, hp->h_addr, sizeof(s)); // old conversion - xmemcpy(&s.s_addr, hp->h_addr, sizeof(s.s_addr)); // original from HEAD - return s; -*/ s.GetInAddr(res); return res; } @@ -1247,12 +1242,12 @@ getMyPort(void) { if (Config.Sockaddr.http) - return ntohs(PORT_FROM_SA(Config.Sockaddr.http->s)); + return ntohs(Config.Sockaddr.http->s.sin_port); #if USE_SSL if (Config.Sockaddr.https) - return ntohs(PORT_FROM_SA(Config.Sockaddr.https->http.s)); + return ntohs(Config.Sockaddr.https->s.sin_port); #endif Index: squid3/src/tunnel.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/tunnel.cc,v retrieving revision 1.13.4.4 retrieving revision 1.13.4.5 diff -u -r1.13.4.4 -r1.13.4.5 --- squid3/src/tunnel.cc 21 Mar 2007 08:55:12 -0000 1.13.4.4 +++ squid3/src/tunnel.cc 5 Apr 2007 09:24:00 -0000 1.13.4.5 @@ -1,6 +1,6 @@ /* - * $Id: tunnel.cc,v 1.13.4.4 2007/03/21 08:55:12 amosjeffries Exp $ + * $Id: tunnel.cc,v 1.13.4.5 2007/04/05 09:24:00 amosjeffries Exp $ * * DEBUG: section 26 Secure Sockets Layer Proxy * AUTHOR: Duane Wessels @@ -588,7 +588,7 @@ * be allowed. yuck, I know. */ - if (!ADDR_IS_NOADDR(request->client_addr)) { + if (request->client_addr.s_addr != no_addr.s_addr) { /* * Check if this host is allowed to fetch MISSES from us (miss_access) */ Index: squid3/src/url.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/url.cc,v retrieving revision 1.9.8.6 retrieving revision 1.9.8.7 diff -u -r1.9.8.6 -r1.9.8.7 --- squid3/src/url.cc 7 Jan 2007 13:19:06 -0000 1.9.8.6 +++ squid3/src/url.cc 5 Apr 2007 09:24:00 -0000 1.9.8.7 @@ -1,6 +1,6 @@ /* - * $Id: url.cc,v 1.9.8.6 2007/01/07 13:19:06 amosjeffries Exp $ + * $Id: url.cc,v 1.9.8.7 2007/04/05 09:24:00 amosjeffries Exp $ * * DEBUG: section 23 URL Parsing * AUTHOR: Duane Wessels @@ -401,7 +401,6 @@ if (request->canonical) return request->canonical; - if (request->protocol == PROTO_URN) { snprintf(urlbuf, MAX_URL, "urn:%s", request->urlpath.buf()); } else {