--------------------- PatchSet 4329 Date: 2007/04/22 07:48:21 Author: amosjeffries Branch: squid3-ipv6 Tag: (none) Log: Many minor fixes. Members: include/IPAddress.h:1.1.2.14->1.1.2.15 include/config.h:1.7.4.15->1.7.4.16 src/ACLIP.cc:1.8.2.22->1.8.2.23 src/ICP.h:1.6.8.3->1.6.8.4 src/IPInterception.cc:1.4.4.2->1.4.4.3 src/IPInterception.h:1.2.10.1->1.2.10.2 src/access_log.cc:1.23.4.6->1.23.4.7 src/client_side_reply.cc:1.57.4.6->1.57.4.7 src/delay_pools.cc:1.15.8.4->1.15.8.5 src/dns_internal.cc:1.15.6.9->1.15.6.10 src/dnsserver.cc:1.7.4.5->1.7.4.6 src/errorpage.cc:1.23.6.2->1.23.6.3 src/ftp.cc:1.26.2.8->1.26.2.9 src/http.cc:1.43.4.8->1.43.4.9 src/icmp.cc:1.8.8.5->1.8.8.6 src/icp_v2.cc:1.17.8.8->1.17.8.9 src/icp_v3.cc:1.5.8.3->1.5.8.4 src/ident.cc:1.11.8.3->1.11.8.4 src/internal.cc:1.5.8.3->1.5.8.4 src/ipcache.cc:1.9.2.18->1.9.2.19 src/peer_digest.cc:1.11.4.3->1.11.4.4 src/peer_select.cc:1.9.4.5->1.9.4.6 src/pinger.cc:1.9.8.4->1.9.8.5 src/send-announce.cc:1.3.10.3->1.3.10.4 src/snmp_core.cc:1.10.8.5->1.10.8.6 src/stat.cc:1.24.4.6->1.24.4.7 src/url.cc:1.9.8.9->1.9.8.10 src/wccp.cc:1.10.2.7->1.10.2.8 src/wccp2.cc:1.13.2.4->1.13.2.5 src/tests/testUfs.cc:1.1.6.1->1.1.6.2 Index: squid3/include/IPAddress.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/include/Attic/IPAddress.h,v retrieving revision 1.1.2.14 retrieving revision 1.1.2.15 diff -u -r1.1.2.14 -r1.1.2.15 --- squid3/include/IPAddress.h 11 Apr 2007 13:23:22 -0000 1.1.2.14 +++ squid3/include/IPAddress.h 22 Apr 2007 07:48:21 -0000 1.1.2.15 @@ -1,6 +1,6 @@ /* - * $Id: IPAddress.h,v 1.1.2.14 2007/04/11 13:23:22 amosjeffries Exp $ + * $Id: IPAddress.h,v 1.1.2.15 2007/04/22 07:48:21 amosjeffries Exp $ * * DEBUG: section 14 IP Storage and Handling * AUTHOR: Amos Jeffries @@ -287,10 +287,10 @@ /* Conversion for dual-type internals */ bool GetReverseString4(char buf[], struct in_addr &) const; -#ifdef USE_IPV6 void check4Mapped(); +#ifdef USE_IPV6 bool GetReverseString6(char buf[], struct in6_addr &) const; void Map4to6(const struct in_addr &src, struct in6_addr &dest) const; Index: squid3/include/config.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/include/config.h,v retrieving revision 1.7.4.15 retrieving revision 1.7.4.16 diff -u -r1.7.4.15 -r1.7.4.16 --- squid3/include/config.h 12 Apr 2007 12:44:46 -0000 1.7.4.15 +++ squid3/include/config.h 22 Apr 2007 07:48:21 -0000 1.7.4.16 @@ -1,5 +1,5 @@ /* - * $Id: config.h,v 1.7.4.15 2007/04/12 12:44:46 amosjeffries Exp $ + * $Id: config.h,v 1.7.4.16 2007/04/22 07:48:21 amosjeffries Exp $ * * AUTHOR: Duane Wessels * @@ -205,19 +205,6 @@ typedef int ASN; #define IN_ADDR in_addr -#define SOCKADDR_IN sockaddr_in -#define AF_FAMILY AF_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 NEEDS_BRACKETS(s) 0 /* 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.22 retrieving revision 1.8.2.23 diff -u -r1.8.2.22 -r1.8.2.23 --- squid3/src/ACLIP.cc 12 Apr 2007 10:08:49 -0000 1.8.2.22 +++ squid3/src/ACLIP.cc 22 Apr 2007 07:48:21 -0000 1.8.2.23 @@ -1,5 +1,5 @@ /* - * $Id: ACLIP.cc,v 1.8.2.22 2007/04/12 10:08:49 amosjeffries Exp $ + * $Id: ACLIP.cc,v 1.8.2.23 2007/04/22 07:48:21 amosjeffries Exp $ * * DEBUG: section 28 Access Control * AUTHOR: Duane Wessels @@ -204,7 +204,7 @@ /* An int mask 128, 32 */ if ((sscanf(asc, "%d%c", &a1,&junk)==1) && - (a1 <= (AF_FAMILY==AF_INET6)? 128:32) && (a1 >= 0) + (a1 <= 128) && (a1 >= 0) ) { return mask.ApplyMask(a1, ctype); Index: squid3/src/ICP.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ICP.h,v retrieving revision 1.6.8.3 retrieving revision 1.6.8.4 diff -u -r1.6.8.3 -r1.6.8.4 --- squid3/src/ICP.h 22 May 2005 15:18:23 -0000 1.6.8.3 +++ squid3/src/ICP.h 22 Apr 2007 07:48:21 -0000 1.6.8.4 @@ -1,6 +1,6 @@ /* - * $Id: ICP.h,v 1.6.8.3 2005/05/22 15:18:23 rmartinez Exp $ + * $Id: ICP.h,v 1.6.8.4 2007/04/22 07:48:21 amosjeffries Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -50,18 +50,12 @@ u_int32_t flags; u_int32_t pad; u_int32_t shostid; /* sender host id */ -/* FIXME: RFC2186 - The IPv4 address of the host sending the ICP message. - There is some ambiguity over the original purpose of this field. In practice it is not used. We keep it unchaged for IPv6 */ - - - #ifdef __cplusplus _icp_common_t(); _icp_common_t(char *buf, unsigned int len); - void handleReply(char *buf, struct SOCKADDR_IN *from); + void handleReply(char *buf, struct sockaddr_in *from); static _icp_common_t *createMessage(icp_opcode opcode, int flags, const char *url, int reqnum, int pad); icp_opcode getOpCode() const; #endif @@ -89,7 +83,7 @@ HttpRequest *request; int fd; - struct SOCKADDR_IN from; + struct sockaddr_in from; char *url; }; @@ -100,7 +94,7 @@ struct _icpUdpData { - struct SOCKADDR_IN address; + struct sockaddr_in address; void *msg; size_t len; icpUdpData *next; @@ -117,21 +111,21 @@ HttpRequest * -icpGetRequest(char *url, int reqnum, int fd, struct SOCKADDR_IN *from); +icpGetRequest(char *url, int reqnum, int fd, struct sockaddr_in *from); -int icpAccessAllowed(struct SOCKADDR_IN *from, HttpRequest * icp_request); +int icpAccessAllowed(struct sockaddr_in *from, HttpRequest * icp_request); -SQUIDCEXTERN void icpCreateAndSend(icp_opcode, int flags, char const *url, int reqnum, int pad, int fd, const struct SOCKADDR_IN *from); +SQUIDCEXTERN void icpCreateAndSend(icp_opcode, int flags, char const *url, int reqnum, int pad, int fd, const struct sockaddr_in *from); extern icp_opcode icpGetCommonOpcode(); -SQUIDCEXTERN int icpUdpSend(int, const struct SOCKADDR_IN *, icp_common_t *, log_type, int); +SQUIDCEXTERN int icpUdpSend(int, const struct sockaddr_in *, icp_common_t *, log_type, int); SQUIDCEXTERN log_type icpLogFromICPCode(icp_opcode opcode); -void icpDenyAccess(struct SOCKADDR_IN *from, char *url, int reqnum, int fd); +void icpDenyAccess(struct sockaddr_in *from, char *url, int reqnum, int fd); SQUIDCEXTERN PF icpHandleUdp; SQUIDCEXTERN PF icpUdpSendQueue; -SQUIDCEXTERN void icpHandleIcpV3(int, struct SOCKADDR_IN, char *, int); +SQUIDCEXTERN void icpHandleIcpV3(int, struct sockaddr_in, char *, int); SQUIDCEXTERN int icpCheckUdpHit(StoreEntry *, HttpRequest * request); SQUIDCEXTERN void icpConnectionsOpen(void); SQUIDCEXTERN void icpConnectionShutdown(void); Index: squid3/src/IPInterception.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/IPInterception.cc,v retrieving revision 1.4.4.2 retrieving revision 1.4.4.3 diff -u -r1.4.4.2 -r1.4.4.3 --- squid3/src/IPInterception.cc 5 Jan 2007 16:58:50 -0000 1.4.4.2 +++ squid3/src/IPInterception.cc 22 Apr 2007 07:48:21 -0000 1.4.4.3 @@ -1,6 +1,6 @@ /* - * $Id: IPInterception.cc,v 1.4.4.2 2007/01/05 16:58:50 hno Exp $ + * $Id: IPInterception.cc,v 1.4.4.3 2007/04/22 07:48:21 amosjeffries Exp $ * * DEBUG: section 89 NAT / IP Interception * AUTHOR: Robert Collins @@ -87,7 +87,7 @@ #if IPF_TRANSPARENT int -clientNatLookup(int fd, struct SOCKADDR_IN me, struct SOCKADDR_IN peer, struct SOCKADDR_IN *dst) +clientNatLookup(int fd, struct sockaddr_in me, struct sockaddr_in peer, struct sockaddr_in *dst) { #if defined(IPFILTER_VERSION) && (IPFILTER_VERSION >= 4000027) @@ -184,7 +184,7 @@ } else { if (me.sin_addr.s_addr != natLookup.nl_realip.s_addr) - FAMILY_FROM_SA(*dst) = AF_INET; + dst->sin_family = AF_INET; dst->sin_port = natLookup.nl_realport; @@ -197,7 +197,7 @@ #elif LINUX_NETFILTER int -clientNatLookup(int fd, struct SOCKADDR_IN me, struct SOCKADDR_IN peer, struct SOCKADDR_IN *dst) +clientNatLookup(int fd, struct sockaddr_in me, struct sockaddr_in peer, struct sockaddr_in *dst) { static time_t last_reported = 0; socklen_t sock_sz = sizeof(*dst); @@ -213,7 +213,7 @@ return -1; } - debug(33, 5) ("clientNatLookup: addr = %s", INET_NTOA(dst->sin_addr)); + debug(33, 5) ("clientNatLookup: addr = %s", inet_ntoa(dst->sin_addr)); if (me.sin_addr.s_addr != dst->sin_addr.s_addr) return 0; @@ -224,7 +224,7 @@ #elif PF_TRANSPARENT int -clientNatLookup(int fd, struct SOCKADDR_IN me, struct SOCKADDR_IN peer, struct SOCKADDR_IN *dst) +clientNatLookup(int fd, struct sockaddr_in me, struct sockaddr_in peer, struct sockaddr_in *dst) { struct pfioc_natlook nl; @@ -273,7 +273,7 @@ } else { int natted = me.sin_addr.s_addr != nl.rdaddr.v4.s_addr; - FAMILY_FROM_SA(*dst) = AF_INET; + dst->sin_family = AF_INET; dst->sin_port = nl.rdport; dst->sin_addr = nl.rdaddr.v4; @@ -287,7 +287,7 @@ #else int -clientNatLookup(int fd, struct SOCKADDR_IN me, struct SOCKADDR_IN peer, struct SOCKADDR_IN *dst) +clientNatLookup(int fd, struct sockaddr_in me, struct sockaddr_in peer, struct sockaddr_in *dst) { debug(89, 1) ("WARNING: transparent proxying not supported\n"); return -1; Index: squid3/src/IPInterception.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/IPInterception.h,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/IPInterception.h 25 Apr 2005 13:28:09 -0000 1.2.10.1 +++ squid3/src/IPInterception.h 22 Apr 2007 07:48:21 -0000 1.2.10.2 @@ -1,6 +1,6 @@ /* - * $Id: IPInterception.h,v 1.2.10.1 2005/04/25 13:28:09 rmartinez Exp $ + * $Id: IPInterception.h,v 1.2.10.2 2007/04/22 07:48:21 amosjeffries Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -36,6 +36,6 @@ SQUIDCEXTERN int -clientNatLookup(int fd, struct SOCKADDR_IN me, struct SOCKADDR_IN peer, struct SOCKADDR_IN *dst); +clientNatLookup(int fd, struct sockaddr_in me, struct sockaddr_in peer, struct sockaddr_in *dst); #endif /* SQUID_IPINTERCEPTION_H */ Index: squid3/src/access_log.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/access_log.cc,v retrieving revision 1.23.4.6 retrieving revision 1.23.4.7 diff -u -r1.23.4.6 -r1.23.4.7 --- squid3/src/access_log.cc 25 Jan 2007 10:43:24 -0000 1.23.4.6 +++ squid3/src/access_log.cc 22 Apr 2007 07:48:21 -0000 1.23.4.7 @@ -1,6 +1,6 @@ /* - * $Id: access_log.cc,v 1.23.4.6 2007/01/25 10:43:24 amosjeffries Exp $ + * $Id: access_log.cc,v 1.23.4.7 2007/04/22 07:48:21 amosjeffries Exp $ * * DEBUG: section 46 Access Log * AUTHOR: Duane Wessels @@ -58,7 +58,7 @@ #if MULTICAST_MISS_STREAM static int mcast_miss_fd = -1; -static struct SOCKADDR_IN mcast_miss_to; +static struct sockaddr_in mcast_miss_to; static void mcast_encode(unsigned int *, size_t, const unsigned int *); #endif @@ -538,14 +538,14 @@ break; case LFT_CLIENT_IP_ADDRESS: - out = INET_NTOA(al->cache.caddr); + out = inet_ntoa(al->cache.caddr); break; case LFT_CLIENT_FQDN: out = fqdncache_gethostbyaddr(al->cache.caddr, FQDN_LOOKUP_IF_MISS); if (!out) - out = INET_NTOA(al->cache.caddr); + out = inet_ntoa(al->cache.caddr); break; @@ -567,7 +567,7 @@ case LFT_LOCAL_IP: if (al->request) - out = INET_NTOA(al->request->my_addr); + out = inet_ntoa(al->request->my_addr); break; @@ -1257,7 +1257,7 @@ } if (client == NULL) { - client = INET_NTOA(al->cache.caddr); + client = inet_ntoa(al->cache.caddr); } user = accessLogFormatName(al->cache.authuser); @@ -1332,7 +1332,7 @@ } if (client == NULL) { - client = INET_NTOA(al->cache.caddr); + client = inet_ntoa(al->cache.caddr); } user1 = accessLogFormatName(al->cache.authuser); @@ -1561,8 +1561,8 @@ if (Config.mcast_miss.addr.s_addr != no_addr.s_addr) { memset(&mcast_miss_to, '\0', sizeof(mcast_miss_to)); - FAMILY_FROM_SA(mcast_miss_to) = AF_INET; - PORT_FROM_SA(mcast_miss_to) = htons(Config.mcast_miss.port); + mcast_miss_to.sin_family = AF_INET; + mcast_miss_to.sin_port = htons(Config.mcast_miss.port); mcast_miss_to.sin_addr.s_addr = Config.mcast_miss.addr.s_addr; mcast_miss_fd = comm_open(SOCK_DGRAM, IPPROTO_UDP, Index: squid3/src/client_side_reply.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/client_side_reply.cc,v retrieving revision 1.57.4.6 retrieving revision 1.57.4.7 diff -u -r1.57.4.6 -r1.57.4.7 --- squid3/src/client_side_reply.cc 2 Feb 2007 22:52:44 -0000 1.57.4.6 +++ squid3/src/client_side_reply.cc 22 Apr 2007 07:48:22 -0000 1.57.4.7 @@ -1,6 +1,6 @@ /* - * $Id: client_side_reply.cc,v 1.57.4.6 2007/02/02 22:52:44 amosjeffries Exp $ + * $Id: client_side_reply.cc,v 1.57.4.7 2007/04/22 07:48:22 amosjeffries Exp $ * * DEBUG: section 88 Client-side Reply Routines * AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c) @@ -693,7 +693,7 @@ http->al.http.code = HTTP_FORBIDDEN; err = clientBuildError(ERR_ACCESS_DENIED, HTTP_FORBIDDEN, NULL, - &ADDR_FROM_SA(http->getConn()->peer), http->request); + &http->getConn()->peer.sin_addr, http->request); createStoreEntry(r->method, request_flags()); errorAppendEntry(http->storeEntry(), err); triggerInitialStoreRead(); @@ -740,7 +740,7 @@ RequestMethodStr[http->request->method], http->uri); http->al.http.code = HTTP_GATEWAY_TIMEOUT; err = clientBuildError(ERR_ONLY_IF_CACHED_MISS, HTTP_GATEWAY_TIMEOUT, NULL, - &ADDR_FROM_SA(http->getConn()->peer), http->request); + &http->getConn()->peer.sin_addr, http->request); removeClientStoreReference(&sc, http); startError(err); } @@ -797,7 +797,7 @@ http->logType = LOG_TCP_DENIED; ErrorState *err = clientBuildError(ERR_ACCESS_DENIED, HTTP_FORBIDDEN, NULL, - &ADDR_FROM_SA(http->getConn()->peer), http->request); + &http->getConn()->peer.sin_addr, http->request); startError(err); return; } @@ -839,7 +839,7 @@ http->logType = LOG_TCP_DENIED; ErrorState *err = clientBuildError(ERR_ACCESS_DENIED, HTTP_FORBIDDEN, NULL, - &ADDR_FROM_SA(http->getConn()->peer), http->request); + &http->getConn()->peer.sin_addr, http->request); startError(err); return; } @@ -1051,7 +1051,7 @@ debug(88, 1) ("WARNING: closing FD %d to prevent counter overflow\n", fd); debug(88, 1) ("\tclient %s\n", - INET_NTOA(http->getConn().getRaw() != NULL ? ADDR_FROM_SA(http->getConn()->peer) : no_addr)); + inet_ntoa(http->getConn().getRaw() != NULL ? http->getConn()->peer.sin_addr : no_addr)); debug(88, 1) ("\treceived %d bytes\n", (int) http->out.size); debug(88, 1) ("\tURI %s\n", http->log_uri); return 1; @@ -1063,7 +1063,7 @@ debug(88, 1) ("WARNING: closing FD %d to prevent counter overflow\n", fd); debug(88, 1) ("\tclient %s\n", - INET_NTOA(http->getConn().getRaw() != NULL ? ADDR_FROM_SA(http->getConn()->peer) : no_addr)); + inet_ntoa(http->getConn().getRaw() != NULL ? http->getConn()->peer.sin_addr : no_addr)); debug(88, 1) ("\treceived %d bytes (offset %d)\n", (int) http->out.size, (int) http->out.offset); debug(88, 1) ("\tURI %s\n", http->log_uri); @@ -1754,7 +1754,7 @@ if (http->isReplyBodyTooLarge(reply->content_length)) { ErrorState *err = clientBuildError(ERR_TOO_BIG, HTTP_FORBIDDEN, NULL, - http->getConn().getRaw() != NULL ? &ADDR_FROM_SA(http->getConn()->peer) : &no_addr, + http->getConn().getRaw() != NULL ? &http->getConn()->peer.sin_addr : &no_addr, http->request); removeClientStoreReference(&sc, http); HTTPMSGUNLOCK(reply); @@ -1798,7 +1798,7 @@ err = clientBuildError(page_id, HTTP_FORBIDDEN, NULL, - http->getConn().getRaw() != NULL ? &ADDR_FROM_SA(http->getConn()->peer) : &no_addr, + http->getConn().getRaw() != NULL ? &http->getConn()->peer.sin_addr : &no_addr, http->request); removeClientStoreReference(&sc, http); Index: squid3/src/delay_pools.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/delay_pools.cc,v retrieving revision 1.15.8.4 retrieving revision 1.15.8.5 diff -u -r1.15.8.4 -r1.15.8.5 --- squid3/src/delay_pools.cc 21 Jan 2007 08:40:32 -0000 1.15.8.4 +++ squid3/src/delay_pools.cc 22 Apr 2007 07:48:22 -0000 1.15.8.5 @@ -1,6 +1,6 @@ /* - * $Id: delay_pools.cc,v 1.15.8.4 2007/01/21 08:40:32 amosjeffries Exp $ + * $Id: delay_pools.cc,v 1.15.8.5 2007/04/22 07:48:22 amosjeffries Exp $ * * DEBUG: section 77 Delay Pools * AUTHOR: Robert Collins @@ -40,11 +40,6 @@ #include "config.h" #if DELAY_POOLS - -#ifdef INET6 -#error "Error. Not ready for compiling with --enable-delay-pools" -#endif - #include "squid.h" #include "CacheManager.h" #include "DelaySpec.h" Index: squid3/src/dns_internal.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/dns_internal.cc,v retrieving revision 1.15.6.9 retrieving revision 1.15.6.10 diff -u -r1.15.6.9 -r1.15.6.10 --- squid3/src/dns_internal.cc 14 Apr 2007 04:00:12 -0000 1.15.6.9 +++ squid3/src/dns_internal.cc 22 Apr 2007 07:48:22 -0000 1.15.6.10 @@ -1,6 +1,6 @@ /* - * $Id: dns_internal.cc,v 1.15.6.9 2007/04/14 04:00:12 amosjeffries Exp $ + * $Id: dns_internal.cc,v 1.15.6.10 2007/04/22 07:48:22 amosjeffries Exp $ * * DEBUG: section 78 DNS lookups; interacts with lib/rfc1035.c * AUTHOR: Duane Wessels @@ -132,7 +132,7 @@ struct _ns { - struct SOCKADDR_IN S; + struct sockaddr_in S; int nqueries; int nreplies; nsvc *vc; @@ -176,7 +176,7 @@ static IOCB idnsReadVCHeader; static void idnsDoSendQueryVC(nsvc *vc); -static int idnsFromKnownNameserver(struct SOCKADDR_IN *from); +static int idnsFromKnownNameserver(struct sockaddr_in *from); static idns_query *idnsFindQuery(unsigned short id); static void idnsGrokReply(const char *buf, size_t sz); static PF idnsRead; @@ -187,18 +187,18 @@ static void idnsAddNameserver(const char *buf) { + char ntoabuf[MAX_IPSTRLEN]; + IPAddress A; - struct IN_ADDR A; - - if (!SAFE_INET_ADDR(buf, &A)) { + if (!(A = buf)) { debug(78, 0) ("WARNING: rejecting '%s' as a name server, because it is not a numeric IP address\n", buf); return; } - if (ADDR_IS_ANYADDR(A)) { - debug(78, 0) ("WARNING: Squid does not accept %s in DNS server specifications.\n",INET_NTOA(any_addr)); - debug(78, 0) ("Will be using %s instead, assuming you meant that DNS is running on the same machine\n",INET_NTOA(local_addr)); - SAFE_INET_ADDR(INET_NTOA(local_addr), &A); /* FIXME: Just A = local_addr */ + if (A.IsAnyAddr()) { + debug(78, 0) ("WARNING: Squid does not accept %s in DNS server specifications.\n",A.NtoA(ntoabuf,MAX_IPSTRLEN)); + A = "127.0.0.1"; + debug(78, 0) ("Will be using %s instead, assuming you meant that DNS is running on the same machine\n", A.NtoA(ntoabuf,MAX_IPSTRLEN)); } if (nns == nns_alloc) { @@ -220,11 +220,12 @@ } assert(nns < nns_alloc); - FAMILY_FROM_SA(nameservers[nns].S) = AF_FAMILY; - PORT_FROM_SA(nameservers[nns].S) = htons(NS_DEFAULTPORT); - ADDR_FROM_SA(nameservers[nns].S) = A; + A.SetPort(NS_DEFAULTPORT); +/* FIXME INET6 : remove temporary conversion: final version: nameservers[nns].S = A; */ + A.GetSockAddr(nameservers[nns].S); + debug(78, 3) ("idnsAddNameserver: Added nameserver #%d: %s\n", - nns, INET_NTOA(ADDR_FROM_SA(nameservers[nns].S))); + nns, A.NtoA(ntoabuf,MAX_IPSTRLEN)); nns++; } @@ -589,7 +590,7 @@ for (i = 0; i < nns; i++) { storeAppendPrintf(sentry, "%-45s %9d %9d\n", /* Let's take the maximum: (15 IPv4/45 IPv6) */ - SA_NTOA(nameservers[i].S), + inet_ntoa(nameservers[i].S.sin_addr), nameservers[i].nqueries, nameservers[i].nreplies); } @@ -805,16 +806,16 @@ static int -idnsFromKnownNameserver(struct SOCKADDR_IN *from) +idnsFromKnownNameserver(struct sockaddr_in *from) { int i; for (i = 0; i < nns; i++) { - if (!ADDR_EQUALS(ADDR_FROM_SA(nameservers[i].S), ADDR_FROM_SA(*from))) + if (nameservers[i].S.sin_addr.s_addr != from->sin_addr.s_addr) continue; - if (PORT_FROM_SA(nameservers[i].S) != PORT_FROM_SA(*from)) + if (nameservers[i].S.sin_port != from->sin_port) continue; return i; @@ -995,7 +996,7 @@ int *N = &incoming_sockets_accepted; int len; - struct SOCKADDR_IN from; + struct sockaddr_in from; socklen_t from_len; int max = INCOMING_DNS_MAX; static char rbuf[SQUID_UDP_SO_RCVBUF]; @@ -1034,7 +1035,7 @@ debug(78, 3) ("idnsRead: FD %d: received %d bytes from %s.\n", fd, (int) len, - INET_NTOA(ADDR_FROM_SA(from))); + inet_ntoa(from.sin_addr)); ns = idnsFromKnownNameserver(&from); if (ns >= 0) { @@ -1044,7 +1045,7 @@ if (squid_curtime - last_warning > 60) { debug(78, 1) ("WARNING: Reply from unknown nameserver [%s]\n", - INET_NTOA(ADDR_FROM_SA(from))); + inet_ntoa(from.sin_addr)); last_warning = squid_curtime; } @@ -1193,7 +1194,7 @@ struct IN_ADDR addr; - if (!ADDR_IS_NOADDR(Config.Addrs.udp_outgoing)) + if (Config.Addrs.udp_outgoing.s_addr != no_addr.s_addr) addr = Config.Addrs.udp_outgoing; else addr = Config.Addrs.udp_incoming; @@ -1214,7 +1215,7 @@ port = comm_local_port(DnsSocket); debug(78, 1) ("DNS Socket created at %s, port %d, FD %d\n", - INET_NTOA(addr), + inet_ntoa(addr), port, DnsSocket); } @@ -1378,7 +1379,7 @@ { idns_query *q; - const char *ip = INET_NTOA(addr); + const char *ip = inet_ntoa(addr); q = cbdataAlloc(idns_query); Index: squid3/src/dnsserver.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/dnsserver.cc,v retrieving revision 1.7.4.5 retrieving revision 1.7.4.6 diff -u -r1.7.4.5 -r1.7.4.6 --- squid3/src/dnsserver.cc 7 Apr 2007 14:05:22 -0000 1.7.4.5 +++ squid3/src/dnsserver.cc 22 Apr 2007 07:48:22 -0000 1.7.4.6 @@ -1,6 +1,6 @@ /* - * $Id: dnsserver.cc,v 1.7.4.5 2007/04/07 14:05:22 amosjeffries Exp $ + * $Id: dnsserver.cc,v 1.7.4.6 2007/04/22 07:48:22 amosjeffries Exp $ * * DEBUG: section 0 DNS Resolver * AUTHOR: Harvest Derived @@ -204,7 +204,7 @@ for (;;) { if (safe_inet_addr(buf, &addr)) { reverse = 1; - result = gethostbyaddr((char *) &addr, sizeof(struct IN_ADDR), AF_FAMILY); + result = gethostbyaddr((char *) &addr, 4, AF_INET); } else { result = gethostbyname(buf); } @@ -254,7 +254,7 @@ xmemcpy(&addr, result->h_addr_list[i], sizeof(addr)); - printf(" %s", INET_NTOA(addr)); + printf(" %s", inet_ntoa(addr)); } printf("\n"); Index: squid3/src/errorpage.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/errorpage.cc,v retrieving revision 1.23.6.2 retrieving revision 1.23.6.3 diff -u -r1.23.6.2 -r1.23.6.3 --- squid3/src/errorpage.cc 5 Jan 2007 16:59:17 -0000 1.23.6.2 +++ squid3/src/errorpage.cc 22 Apr 2007 07:48:22 -0000 1.23.6.3 @@ -1,6 +1,6 @@ /* - * $Id: errorpage.cc,v 1.23.6.2 2007/01/05 16:59:17 hno Exp $ + * $Id: errorpage.cc,v 1.23.6.3 2007/04/22 07:48:22 amosjeffries Exp $ * * DEBUG: section 4 Error Generation * AUTHOR: Duane Wessels @@ -527,7 +527,7 @@ str.Printf("TimeStamp: %s\r\n\r\n", mkrfc1123(squid_curtime)); /* - IP stuff */ - str.Printf("ClientIP: %s\r\n", INET_NTOA(err->src_addr)); + str.Printf("ClientIP: %s\r\n", inet_ntoa(err->src_addr)); if (r && r->hier.host) { str.Printf("ServerIP: %s\r\n", r->hier.host); @@ -691,7 +691,7 @@ break; case 'i': - mb.Printf("%s", INET_NTOA(err->src_addr)); + mb.Printf("%s", inet_ntoa(err->src_addr)); break; Index: squid3/src/ftp.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ftp.cc,v retrieving revision 1.26.2.8 retrieving revision 1.26.2.9 diff -u -r1.26.2.8 -r1.26.2.9 --- squid3/src/ftp.cc 6 Apr 2007 22:58:49 -0000 1.26.2.8 +++ squid3/src/ftp.cc 22 Apr 2007 07:48:22 -0000 1.26.2.9 @@ -1,6 +1,6 @@ /* - * $Id: ftp.cc,v 1.26.2.8 2007/04/06 22:58:49 amosjeffries Exp $ + * $Id: ftp.cc,v 1.26.2.9 2007/04/22 07:48:22 amosjeffries Exp $ * * DEBUG: section 9 File Transfer Protocol (FTP) * AUTHOR: Harvest Derived @@ -2185,7 +2185,7 @@ ftpSendPasv(FtpStateData * ftpState) { - struct SOCKADDR_IN addr; + struct sockaddr_in addr; socklen_t addr_len; debugs(9, 3, HERE << "ftpSendPasv started"); @@ -2230,11 +2230,11 @@ /* Open data channel with the same local address as control channel */ int fd = comm_open(SOCK_STREAM, - IPPROTO_TCP, - ADDR_FROM_SA(addr), - 0, - COMM_NONBLOCKING, - storeUrl(ftpState->entry)); + IPPROTO_TCP, + addr.sin_addr, + 0, + COMM_NONBLOCKING, + storeUrl(ftpState->entry)); debug(9, 3) ("ftpSendPasv: Unconnected data socket created on FD %d\n", fd); @@ -2325,7 +2325,7 @@ snprintf(ipaddr, 1024, "%d.%d.%d.%d", h1, h2, h3, h4); #endif - if (!SAFE_INET_ADDR(ipaddr, NULL)) { + if (!safe_inet_addr(ipaddr, NULL)) { debug(9, 1) ("Unsafe PASV reply from %s: %s\n", fd_table[ftpState->ctrl.fd].ipaddr, ftpState->ctrl.last_reply); ftpSendPort(ftpState); return; @@ -2388,7 +2388,7 @@ { int fd; - struct SOCKADDR_IN addr; + struct sockaddr_in addr; socklen_t addr_len; int on = 1; u_short port = 0; @@ -2420,12 +2420,12 @@ */ if (fallback) { setsockopt(ftpState->ctrl.fd, SOL_SOCKET, SO_REUSEADDR, (char *) &on, sizeof(on)); - port = ntohs(PORT_FROM_SA(addr)); + port = ntohs(addr.sin_port); } fd = comm_open(SOCK_STREAM, IPPROTO_TCP, - ADDR_FROM_SA(addr), + addr.sin_addr, port, COMM_NONBLOCKING | (fallback ? COMM_REUSEADDR : 0), storeUrl(ftpState->entry)); @@ -2452,7 +2452,7 @@ { int fd; - struct SOCKADDR_IN addr; + struct sockaddr_in addr; socklen_t addr_len; unsigned char *addrptr; unsigned char *portptr; @@ -2468,8 +2468,8 @@ return; } - addrptr = (unsigned char *) &ADDR_FROM_SA(addr); - portptr = (unsigned char *) &PORT_FROM_SA(addr); + addrptr = (unsigned char *) &addr.sin_addr; + portptr = (unsigned char *) &addr.sin_port; #ifdef INET6 // FIXME?....is this rigth on IPv6 ? snprintf(cbuf, 1024, "PORT %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\r\n", @@ -2519,10 +2519,10 @@ } if (Config.Ftp.sanitycheck) { - char *ipaddr = (char *)INET_NTOA(ADDR_FROM_SA(details->peer)); + char *ipaddr = (char *)inet_ntoa(details->peer.sin_addr); if (strcmp(fd_table[ftpState->ctrl.fd].ipaddr, ipaddr) != 0) { - debug(9, 1) ("FTP data connection from unexpected server (%s:%d), expecting %s\n", ipaddr, (int) ntohs(PORT_FROM_SA(details->peer)), fd_table[ftpState->ctrl.fd].ipaddr); + debug(9, 1) ("FTP data connection from unexpected server (%s:%d), expecting %s\n", ipaddr, (int) ntohs(details->peer.sin_port), fd_table[ftpState->ctrl.fd].ipaddr); comm_close(newfd); comm_accept(ftpState->data.fd, ftpAcceptDataConnection, ftpState); return; @@ -2543,9 +2543,9 @@ ftpState->data.fd = newfd; - ftpState->data.port = ntohs(PORT_FROM_SA(details->peer)); + ftpState->data.port = ntohs(details->peer.sin_port); - ftpState->data.host = xstrdup(SA_NTOA(details->peer)); + ftpState->data.host = xstrdup(inet_ntoa(details->peer.sin_addr)); commSetTimeout(ftpState->ctrl.fd, -1, NULL, NULL); @@ -3239,6 +3239,7 @@ strcat(loginbuf, "@"); } +#ifdef INET6 snprintf(buf, MAX_URL, "%s://%s%s%s%s%s%s%s", ProtocolStr[request->protocol], NEEDS_BRACKETS(request->host) ? "[": null_string, @@ -3248,6 +3249,15 @@ portbuf, "/%2f", request->urlpath.buf()); +#else + snprintf(buf, MAX_URL, "%s://%s%s%s%s%s", + ProtocolStr[request->protocol], + loginbuf, + request->host, + portbuf, + "/%2f", + request->urlpath.buf()); +#endif if ((t = strchr(buf, '?'))) *t = '\0'; Index: squid3/src/http.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/http.cc,v retrieving revision 1.43.4.8 retrieving revision 1.43.4.9 diff -u -r1.43.4.8 -r1.43.4.9 --- squid3/src/http.cc 6 Apr 2007 22:58:49 -0000 1.43.4.8 +++ squid3/src/http.cc 22 Apr 2007 07:48:22 -0000 1.43.4.9 @@ -1,6 +1,6 @@ /* - * $Id: http.cc,v 1.43.4.8 2007/04/06 22:58:49 amosjeffries Exp $ + * $Id: http.cc,v 1.43.4.9 2007/04/22 07:48:22 amosjeffries Exp $ * * DEBUG: section 11 Hypertext Transfer Protocol (HTTP) * AUTHOR: Harvest Derived @@ -1384,8 +1384,8 @@ /* append X-Forwarded-For */ strFwd = hdr_in->getList(HDR_X_FORWARDED_FOR); - if (opt_forwarded_for && !ADDR_IS_NOADDR(orig_request->client_addr)) - strListAdd(&strFwd, INET_NTOA(orig_request->client_addr), ','); + if (opt_forwarded_for && orig_request->client_addr.s_addr != no_addr.s_addr) + strListAdd(&strFwd, inet_ntoa(orig_request->client_addr), ','); else strListAdd(&strFwd, "unknown", ','); @@ -1401,11 +1401,17 @@ /* use port# only if not default */ hdr_out->putStr(HDR_HOST, orig_request->host); } else { +#ifdef INET6 httpHeaderPutStrf(hdr_out, HDR_HOST, "%s%s%s:%d", - NEEDS_BRACKETS(orig_request->host) ? "[": null_string, + NEEDS_BRACKETS(orig_request->host) ? "[": null_string, orig_request->host, - NEEDS_BRACKETS(orig_request->host) ? "]": null_string, - (int) orig_request->port); + NEEDS_BRACKETS(orig_request->host) ? "]": null_string, + (int) orig_request->port); +#else + httpHeaderPutStrf(hdr_out, HDR_HOST, "%s:%d", + orig_request->host, + (int) orig_request->port); +#endif } } @@ -1600,11 +1606,17 @@ if (orig_request->port == urlDefaultPort(orig_request->protocol)) { hdr_out->putStr(HDR_HOST, orig_request->host); } else { +#ifdef INET6 httpHeaderPutStrf(hdr_out, HDR_HOST, "%s%s%s:%d", - NEEDS_BRACKETS(orig_request->host) ? "[" : null_string , + NEEDS_BRACKETS(orig_request->host) ? "[" : null_string , orig_request->host, - NEEDS_BRACKETS(orig_request->host) ? "]" : null_string , - (int) orig_request->port); + NEEDS_BRACKETS(orig_request->host) ? "]" : null_string , + (int) orig_request->port); +#else + httpHeaderPutStrf(hdr_out, HDR_HOST, "%s:%d", + orig_request->host, + (int) orig_request->port); +#endif } } Index: squid3/src/icmp.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/icmp.cc,v retrieving revision 1.8.8.5 retrieving revision 1.8.8.6 diff -u -r1.8.8.5 -r1.8.8.6 --- squid3/src/icmp.cc 11 Apr 2007 13:23:23 -0000 1.8.8.5 +++ squid3/src/icmp.cc 22 Apr 2007 07:48:22 -0000 1.8.8.6 @@ -1,6 +1,6 @@ /* - * $Id: icmp.cc,v 1.8.8.5 2007/04/11 13:23:23 amosjeffries Exp $ + * $Id: icmp.cc,v 1.8.8.6 2007/04/22 07:48:22 amosjeffries Exp $ * * DEBUG: section 37 ICMP Routines * AUTHOR: Duane Wessels @@ -150,7 +150,7 @@ return; debug(37, 2) ("icmpSend: to %s, opcode %d, len %d\n", - INET_NTOA(pkt->to), (int) pkt->opcode, pkt->psize); + inet_ntoa(pkt->to), (int) pkt->opcode, pkt->psize); x = comm_udp_send(icmp_sock, (char *) pkt, len, 0); @@ -169,7 +169,7 @@ #if ALLOW_SOURCE_PING static void -icmpHandleSourcePing(const struct SOCKADDR_IN *from, const char *buf) +icmpHandleSourcePing(const struct sockaddr_in *from, const char *buf) { const cache_key *key; icp_common_t header; @@ -178,7 +178,7 @@ url = buf + sizeof(icp_common_t); key = icpGetCacheKey(url, (int) header.reqnum); debug(37, 3) ("icmpHandleSourcePing: from %s, key '%s'\n", - INET_NTOA(from->sin_addr), storeKeyText(key)); + inet_ntoa(from->sin_addr), storeKeyText(key)); /* call neighborsUdpAck even if ping_status != PING_WAITING */ neighborsUdpAck(key, &header, from); } Index: squid3/src/icp_v2.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/icp_v2.cc,v retrieving revision 1.17.8.8 retrieving revision 1.17.8.9 diff -u -r1.17.8.8 -r1.17.8.9 --- squid3/src/icp_v2.cc 14 Apr 2007 04:00:12 -0000 1.17.8.8 +++ squid3/src/icp_v2.cc 22 Apr 2007 07:48:22 -0000 1.17.8.9 @@ -1,6 +1,6 @@ /* - * $Id: icp_v2.cc,v 1.17.8.8 2007/04/14 04:00:12 amosjeffries Exp $ + * $Id: icp_v2.cc,v 1.17.8.9 2007/04/22 07:48:22 amosjeffries Exp $ * * DEBUG: section 12 Internet Cache Protocol * AUTHOR: Duane Wessels @@ -47,7 +47,7 @@ static void icpLogIcp(struct IN_ADDR, log_type, int, const char *, int); -static void icpHandleIcpV2(int, struct SOCKADDR_IN, char *, int); +static void icpHandleIcpV2(int, struct sockaddr_in, char *, int); static void icpCount(void *, int, size_t, int); /* @@ -240,11 +240,7 @@ headerp->pad = htonl(pad); -#ifdef INET6 - headerp->shostid = 0; -#else - headerp->shostid = theOutICPAddr.s_addr; /* FIXME: Could be assumed in the above branch */ -#endif + headerp->shostid = theOutICPAddr.s_addr; urloffset = buf + sizeof(icp_common_t); @@ -259,7 +255,7 @@ int icpUdpSend(int fd, - const struct SOCKADDR_IN *to, + const struct sockaddr_in *to, icp_common_t * msg, log_type logcode, int delay) @@ -272,14 +268,14 @@ fd, icp_opcode_str[msg->opcode], len, - SA_NTOA(*to), - ntohs(PORT_FROM_SA(*to))); + inet_ntoa(to->sin_addr), + ntohs(to->sin_port)); x = comm_udp_sendto(fd, to, sizeof(*to), msg, len); if (x >= 0) { /* successfully written */ - icpLogIcp(ADDR_FROM_SA(*to), logcode, len, (char *) (msg + 1), delay); + icpLogIcp(to->sin_addr, logcode, len, (char *) (msg + 1), delay); icpCount(msg, SENT, (size_t) len, delay); safe_free(msg); } else if (0 == delay) @@ -374,7 +370,7 @@ void -icpCreateAndSend(icp_opcode opcode, int flags, char const *url, int reqnum, int pad, int fd, const struct SOCKADDR_IN *from) +icpCreateAndSend(icp_opcode opcode, int flags, char const *url, int reqnum, int pad, int fd, const struct sockaddr_in *from) { icp_common_t *reply = _icp_common_t::createMessage(opcode, flags, url, reqnum, pad); icpUdpSend(fd, from, reply, icpLogFromICPCode(opcode), 0); @@ -382,18 +378,18 @@ void -icpDenyAccess(struct SOCKADDR_IN *from, char *url, int reqnum, int fd) +icpDenyAccess(struct sockaddr_in *from, char *url, int reqnum, int fd) { debug(12, 2) ("icpDenyAccess: Access Denied for %s by %s.\n", - SA_NTOA(*from), AclMatchedName); + inet_ntoa(from->sin_addr), AclMatchedName); - if (clientdbCutoffDenied(ADDR_FROM_SA(*from))) + if (clientdbCutoffDenied(from->sin_addr)) { /* * count this DENIED query in the clientdb, even though * we're not sending an ICP reply... */ - clientdbUpdate(ADDR_FROM_SA(*from), LOG_UDP_DENIED, PROTO_ICP, 0); + clientdbUpdate(from->sin_addr, LOG_UDP_DENIED, PROTO_ICP, 0); } else { icpCreateAndSend(ICP_DENIED, 0, url, reqnum, 0, fd, from); @@ -402,10 +398,10 @@ int -icpAccessAllowed(struct SOCKADDR_IN *from, HttpRequest * icp_request) +icpAccessAllowed(struct sockaddr_in *from, HttpRequest * icp_request) { ACLChecklist checklist; - checklist.src_addr = ADDR_FROM_SA(*from); + checklist.src_addr = from->sin_addr; checklist.my_addr = no_addr; checklist.request = HTTPMSGLOCK(icp_request); checklist.accessList = cbdataReference(Config.accessList.icp); @@ -425,7 +421,7 @@ HttpRequest * -icpGetRequest(char *url, int reqnum, int fd, struct SOCKADDR_IN * from) +icpGetRequest(char *url, int reqnum, int fd, struct sockaddr_in * from) { if (strpbrk(url, w_space)) { @@ -445,7 +441,7 @@ static void -doV2Query(int fd, struct SOCKADDR_IN from, char *buf, icp_common_t header) +doV2Query(int fd, struct sockaddr_in from, char *buf, icp_common_t header) { int rtt = 0; int src_rtt = 0; @@ -498,12 +494,12 @@ void -_icp_common_t::handleReply(char *buf, struct SOCKADDR_IN *from) +_icp_common_t::handleReply(char *buf, struct sockaddr_in *from) { if (neighbors_do_private_keys && reqnum == 0) { debug(12, 0) ("icpHandleIcpV2: Neighbor %s returned reqnum = 0\n", - SA_NTOA(*from)); + inet_ntoa(from->sin_addr)); debug(12, 0) ("icpHandleIcpV2: Disabling use of private keys\n"); neighbors_do_private_keys = 0; } @@ -511,7 +507,7 @@ char *url = buf + sizeof(icp_common_t); debug(12, 3) ("icpHandleIcpV2: %s from %s for '%s'\n", icp_opcode_str[opcode], - SA_NTOA(*from), + inet_ntoa(from->sin_addr), url); const cache_key *key = icpGetCacheKey(url, (int) reqnum); /* call neighborsUdpAck even if ping_status != PING_WAITING */ @@ -520,7 +516,7 @@ static void -icpHandleIcpV2(int fd, struct SOCKADDR_IN from, char *buf, int len) +icpHandleIcpV2(int fd, struct sockaddr_in from, char *buf, int len) { if (len <= 0) { @@ -570,7 +566,7 @@ default: debug(12, 0) ("icpHandleIcpV2: UNKNOWN OPCODE: %d from %s\n", - header.opcode, SA_NTOA(from)); + header.opcode, inet_ntoa(from.sin_addr)); break; } } @@ -590,7 +586,7 @@ debug(12, 9) ("reqnum: %-8d\n", ntohl(pkt->reqnum)); debug(12, 9) ("flags: %-8x\n", ntohl(pkt->flags)); a.s_addr = pkt->shostid; - debug(12, 9) ("shostid: %s\n", INET_NTOA(a)); + debug(12, 9) ("shostid: %s\n", inet_ntoa(a)); debug(12, 9) ("payload: %s\n", (char *) pkt + sizeof(icp_common_t)); } @@ -601,7 +597,7 @@ { int *N = &incoming_sockets_accepted; - struct SOCKADDR_IN from; + struct sockaddr_in from; socklen_t from_len; LOCAL_ARRAY(char, buf, SQUID_UDP_SO_RCVBUF); int len; @@ -647,7 +643,7 @@ debug(12, 4) ("icpHandleUdp: FD %d: received %lu bytes from %s.\n", sock, (unsigned long int)len, - SA_NTOA(from)); + inet_ntoa(from.sin_addr)); #ifdef ICP_PACKET_DUMP icpPktDump(buf); @@ -667,8 +663,8 @@ else debug(12, 1) ("WARNING: Unused ICP version %d received from %s:%d\n", icp_version, - SA_NTOA(from), - ntohs(PORT_FROM_SA(from))); + inet_ntoa(from.sin_addr), + ntohs(from.sin_port)); } } @@ -679,7 +675,7 @@ struct IN_ADDR addr; - struct SOCKADDR_IN xaddr; + struct sockaddr_in xaddr; int x; socklen_t len; wordlist *s; @@ -711,11 +707,10 @@ ipcache_nbgethostbyname(s->key, mcastJoinGroups, NULL); debug(12, 1) ("Accepting ICP messages at %s, port %d, FD %d.\n", - INET_NTOA(Config.Addrs.udp_incoming), + inet_ntoa(Config.Addrs.udp_incoming), (int) port, theInIcpConnection); - addr = Config.Addrs.udp_outgoing; - if (!ADDR_EQUALS(addr,no_addr)) { + if ((addr = Config.Addrs.udp_outgoing).s_addr != no_addr.s_addr) { enter_suid(); theOutIcpConnection = comm_open(SOCK_DGRAM, IPPROTO_UDP, @@ -746,7 +741,7 @@ memset(&theOutICPAddr, '\0', sizeof(struct IN_ADDR)); - len = sizeof(struct SOCKADDR_IN); + len = sizeof(struct sockaddr_in); memset(&xaddr, '\0', len); x = getsockname(theOutIcpConnection, @@ -756,7 +751,7 @@ debug(50, 1) ("theOutIcpConnection FD %d: getsockname: %s\n", theOutIcpConnection, xstrerror()); else - theOutICPAddr = ADDR_FROM_SA(xaddr); + theOutICPAddr = xaddr.sin_addr; } /* Index: squid3/src/icp_v3.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/icp_v3.cc,v retrieving revision 1.5.8.3 retrieving revision 1.5.8.4 diff -u -r1.5.8.3 -r1.5.8.4 --- squid3/src/icp_v3.cc 5 Jan 2007 16:59:23 -0000 1.5.8.3 +++ squid3/src/icp_v3.cc 22 Apr 2007 07:48:22 -0000 1.5.8.4 @@ -1,6 +1,6 @@ /* - * $Id: icp_v3.cc,v 1.5.8.3 2007/01/05 16:59:23 hno Exp $ + * $Id: icp_v3.cc,v 1.5.8.4 2007/04/22 07:48:22 amosjeffries Exp $ * * DEBUG: section 12 Internet Cache Protocol * AUTHOR: Duane Wessels @@ -50,7 +50,7 @@ static void -doV3Query(int fd, struct SOCKADDR_IN from, char *buf, icp_common_t header) +doV3Query(int fd, struct sockaddr_in from, char *buf, icp_common_t header) { /* We have a valid packet */ char *url = buf + sizeof(icp_common_t) + sizeof(u_int32_t); @@ -106,7 +106,7 @@ /* Currently Harvest cached-2.x uses ICP_VERSION_3 */ void -icpHandleIcpV3(int fd, struct SOCKADDR_IN from, char *buf, int len) +icpHandleIcpV3(int fd, struct sockaddr_in from, char *buf, int len) { if (len <= 0) { @@ -155,7 +155,7 @@ default: debug(12, 0) ("icpHandleIcpV3: UNKNOWN OPCODE: %d from %s\n", - header.opcode, SA_NTOA(from)); + header.opcode, inet_ntoa(from.sin_addr)); break; } } Index: squid3/src/ident.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ident.cc,v retrieving revision 1.11.8.3 retrieving revision 1.11.8.4 diff -u -r1.11.8.3 -r1.11.8.4 --- squid3/src/ident.cc 5 Jan 2007 16:59:23 -0000 1.11.8.3 +++ squid3/src/ident.cc 22 Apr 2007 07:48:22 -0000 1.11.8.4 @@ -1,6 +1,6 @@ /* - * $Id: ident.cc,v 1.11.8.3 2007/01/05 16:59:23 hno Exp $ + * $Id: ident.cc,v 1.11.8.4 2007/04/22 07:48:22 amosjeffries Exp $ * * DEBUG: section 30 Ident (RFC 931) * AUTHOR: Duane Wessels @@ -55,9 +55,9 @@ hash_link hash; /* must be first */ int fd; /* IDENT fd */ - struct SOCKADDR_IN me; + struct sockaddr_in me; - struct SOCKADDR_IN my_peer; + struct sockaddr_in my_peer; IdentClient *clients; char buf[4096]; } @@ -108,7 +108,7 @@ { IdentStateData *state = (IdentStateData *)data; debug(30, 3) ("identTimeout: FD %d, %s\n", fd, - SA_NTOA(state->my_peer)); + inet_ntoa(state->my_peer.sin_addr)); comm_close(fd); } @@ -141,8 +141,8 @@ MemBuf mb; mb.init(); mb.Printf("%d, %d\r\n", - ntohs(PORT_FROM_SA(state->my_peer)), - ntohs(PORT_FROM_SA(state->me))); + ntohs(state->my_peer.sin_port), + ntohs(state->me.sin_port)); comm_write_mbuf(fd, &mb, NULL, state); comm_read(fd, state->buf, BUFSIZ, identReadReply, state); commSetTimeout(fd, Config.Timeout.ident, identTimeout, state); @@ -213,7 +213,7 @@ */ void -identStart(struct SOCKADDR_IN *me, struct SOCKADDR_IN *my_peer, IDCB * callback, void *data) +identStart(struct sockaddr_in *me, struct sockaddr_in *my_peer, IDCB * callback, void *data) { IdentStateData *state; int fd; @@ -225,15 +225,15 @@ #else snprintf(key1, IDENT_KEY_SZ, "%s:%d", #endif - SA_NTOA(*me), - ntohs(PORT_FROM_SA(*me))); + inet_ntoa(me->sin_addr), + ntohs(me->sin_port)); #ifdef INET6 snprintf(key2, IDENT_KEY_SZ, "[%s]:%d", #else snprintf(key2, IDENT_KEY_SZ, "%s:%d", #endif - SA_NTOA(*my_peer), - ntohs(PORT_FROM_SA(*my_peer))); + inet_ntoa(my_peer->sin_addr), + ntohs(my_peer->sin_port)); snprintf(key, IDENT_KEY_SZ, "%s,%s", key1, key2); if ((state = (IdentStateData *)hash_lookup(ident_hash, key)) != NULL) @@ -244,7 +244,7 @@ fd = comm_open(SOCK_STREAM, IPPROTO_TCP, - ADDR_FROM_SA(*me), + me->sin_addr, 0, COMM_NONBLOCKING, "ident"); @@ -269,7 +269,7 @@ state); commSetTimeout(fd, Config.Timeout.ident, identTimeout, state); commConnectStart(fd, - SA_NTOA(state->my_peer), + inet_ntoa(state->my_peer.sin_addr), IDENT_PORT, identConnectDone, state); Index: squid3/src/internal.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/internal.cc,v retrieving revision 1.5.8.3 retrieving revision 1.5.8.4 diff -u -r1.5.8.3 -r1.5.8.4 --- squid3/src/internal.cc 5 Jan 2007 16:59:23 -0000 1.5.8.3 +++ squid3/src/internal.cc 22 Apr 2007 07:48:22 -0000 1.5.8.4 @@ -1,6 +1,6 @@ /* - * $Id: internal.cc,v 1.5.8.3 2007/01/05 16:59:23 hno Exp $ + * $Id: internal.cc,v 1.5.8.4 2007/04/22 07:48:22 amosjeffries Exp $ * * DEBUG: section 76 Internal Squid Object handling * AUTHOR: Duane, Alex, Henrik @@ -52,7 +52,7 @@ ErrorState *err; const char *upath = request->urlpath.buf(); debug(76, 3) ("internalStart: %s requesting '%s'\n", - INET_NTOA(request->client_addr), upath); + inet_ntoa(request->client_addr), upath); if (0 == strcmp(upath, "/squid-internal-dynamic/netdb")) { netdbBinaryExchange(entry); @@ -120,12 +120,15 @@ static MemBuf mb; mb.reset(); - +#ifdef INET6 if (NEEDS_BRACKETS(lc_host)) { mb.Printf("http://[%s]", lc_host); } else { mb.Printf("http://%s", lc_host); } +#else + mb.Printf("http://%s", lc_host); +#endif /* append port if not default */ if (port && port != urlDefaultPort(PROTO_HTTP)) Index: squid3/src/ipcache.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ipcache.cc,v retrieving revision 1.9.2.18 retrieving revision 1.9.2.19 diff -u -r1.9.2.18 -r1.9.2.19 --- squid3/src/ipcache.cc 5 Apr 2007 09:47:57 -0000 1.9.2.18 +++ squid3/src/ipcache.cc 22 Apr 2007 07:48:22 -0000 1.9.2.19 @@ -1,6 +1,6 @@ /* - * $Id: ipcache.cc,v 1.9.2.18 2007/04/05 09:47:57 amosjeffries Exp $ + * $Id: ipcache.cc,v 1.9.2.19 2007/04/22 07:48:22 amosjeffries Exp $ * * DEBUG: section 14 IP Cache * AUTHOR: Harvest Derived @@ -444,7 +444,7 @@ continue; #ifdef INET6 - xmemcpy(&i->addr.in_addrs[j], "\0\0\0\0\0\0\0\0\0\0\0xff\0xff", 12); + xmemcpy(&i->addr.in_addrs[j], "\0\0\0\0\0\0\0\0\0\0\0xff\0xff", 12); xmemcpy(((char *)&i->addrs.in_addrs[j++]) + 12, answers[k].rdata, 4); #else xmemcpy(&i->addrs.in_addrs[j++], answers[k].rdata, 4); @@ -452,7 +452,7 @@ debug(14, 3) ("ipcacheParse: #%d %s\n", j - 1, - INET_NTOA(i->addrs.in_addrs[j - 1])); + inet_ntoa(i->addrs.in_addrs[j - 1])); #ifdef INET6 } else if (answers[k].type == RFC1035_TYPE_AAAA) { if (answers[k].rdlength != sizeof(struct in6_addr)) @@ -462,7 +462,7 @@ debug(14, 3) ("ipcacheParse: #%d %s\n", j - 1, - INET_NTOA(i->addrs.in_addrs[j - 1])); + inet_ntoa(i->addrs.in_addrs[j - 1])); #endif } else if (answers[k].type != RFC1035_TYPE_CNAME) continue; @@ -676,7 +676,7 @@ (int) i->addrs.badcount); for (k = 0; k < (int) i->addrs.count; k++) { - storeAppendPrintf(sentry, " %45s-%3s", INET_NTOA(i->addrs.in_addrs[k]), + storeAppendPrintf(sentry, " %45s-%3s", inet_ntoa(i->addrs.in_addrs[k]), i->addrs.bad_mask[k] ? "BAD" : "OK "); /* Max. between 15 IPv4 / 45 IPv6 address length */ } @@ -759,7 +759,7 @@ struct IN_ADDR ip; /* check if it's already a IP address in text form. */ - if (!SAFE_INET_ADDR(name, &ip)) + if (!safe_inet_addr(name, &ip)) return NULL; static_addrs.count = 1; Index: squid3/src/peer_digest.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/peer_digest.cc,v retrieving revision 1.11.4.3 retrieving revision 1.11.4.4 diff -u -r1.11.4.3 -r1.11.4.4 --- squid3/src/peer_digest.cc 14 Apr 2007 04:00:12 -0000 1.11.4.3 +++ squid3/src/peer_digest.cc 22 Apr 2007 07:48:22 -0000 1.11.4.4 @@ -1,6 +1,6 @@ /* - * $Id: peer_digest.cc,v 1.11.4.3 2007/04/14 04:00:12 amosjeffries Exp $ + * $Id: peer_digest.cc,v 1.11.4.4 2007/04/22 07:48:22 amosjeffries Exp $ * * DEBUG: section 72 Peer Digest Routines * AUTHOR: Alex Rousskov @@ -261,6 +261,7 @@ { PeerDigest *pd = (PeerDigest *)data; time_t req_time; + char buf[MAX_IPSTRLEN]; assert(!pd->flags.requested); @@ -271,11 +272,8 @@ return; } - debug(72, 3) ("peerDigestCheck: peer %s%s%s:%d\n", - NEEDS_BRACKETS(pd->peer->host)? "[" : null_string, - pd->peer->host, - NEEDS_BRACKETS(pd->peer->host)? "]" : null_string, - pd->peer->http_port); +/* FIXME INET6 : drop temp conversion */ IPAddress tmp(pd->peer->host); tmp.SetPort(pd->peer->http_port); + debugs(72, 3, "peerDigestCheck: peer %s\n" << tmp.ToURL(buf,MAX_IPSTRLEN) ); debug(72, 3) ("peerDigestCheck: time: %ld, last received: %ld (%+d)\n", (long int) squid_curtime, (long int) pd->times.received, (int) (squid_curtime - pd->times.received)); Index: squid3/src/peer_select.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/peer_select.cc,v retrieving revision 1.9.4.5 retrieving revision 1.9.4.6 diff -u -r1.9.4.5 -r1.9.4.6 --- squid3/src/peer_select.cc 1 Mar 2007 09:25:47 -0000 1.9.4.5 +++ squid3/src/peer_select.cc 22 Apr 2007 07:48:22 -0000 1.9.4.6 @@ -1,6 +1,6 @@ /* - * $Id: peer_select.cc,v 1.9.4.5 2007/03/01 09:25:47 amosjeffries Exp $ + * $Id: peer_select.cc,v 1.9.4.6 2007/04/22 07:48:22 amosjeffries Exp $ * * DEBUG: section 44 Peer Selection Algorithm * AUTHOR: Duane Wessels @@ -471,13 +471,13 @@ code = SOURCE_FASTEST; } else #endif - if (!SA_IS_ANYADDR(ps->closest_parent_miss)) { - p = whichPeer(&ps->closest_parent_miss); - code = CLOSEST_PARENT_MISS; - } else if (!SA_IS_ANYADDR(ps->first_parent_miss)) { - p = whichPeer(&ps->first_parent_miss); - code = FIRST_PARENT_MISS; - } + if (ps->closest_parent_miss.sin_addr.s_addr != any_addr.s_addr) { + p = whichPeer(&ps->closest_parent_miss); + code = CLOSEST_PARENT_MISS; + } else if (ps->first_parent_miss.sin_addr.s_addr != any_addr.s_addr) { + p = whichPeer(&ps->first_parent_miss); + code = FIRST_PARENT_MISS; + } if (p && code != HIER_NONE) { debug(44, 3) ("peerSelect: %s/%s\n", hier_strings[code], p->host); peerAddFwdServer(&ps->servers, p, code); @@ -631,7 +631,7 @@ return; /* set FIRST_MISS if there is no CLOSEST parent */ - if (!SA_IS_ANYADDR(ps->closest_parent_miss)) + if (ps->closest_parent_miss.sin_addr.s_addr != any_addr.s_addr) return; rtt = (tvSubMsec(ps->ping.start, current_time) - p->basetime) / p->weight; @@ -639,7 +639,7 @@ if (rtt < 1) rtt = 1; - if (SA_IS_ANYADDR(ps->first_parent_miss) || + if (ps->first_parent_miss.sin_addr.s_addr == any_addr.s_addr || rtt < ps->ping.w_rtt) { ps->first_parent_miss = p->in_addr; ps->ping.w_rtt = rtt; Index: squid3/src/pinger.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/pinger.cc,v retrieving revision 1.9.8.4 retrieving revision 1.9.8.5 diff -u -r1.9.8.4 -r1.9.8.5 --- squid3/src/pinger.cc 5 Jan 2007 16:59:32 -0000 1.9.8.4 +++ squid3/src/pinger.cc 22 Apr 2007 07:48:22 -0000 1.9.8.5 @@ -1,6 +1,6 @@ /* - * $Id: pinger.cc,v 1.9.8.4 2007/01/05 16:59:32 hno Exp $ + * $Id: pinger.cc,v 1.9.8.5 2007/04/22 07:48:22 amosjeffries Exp $ * * DEBUG: section 42 ICMP Pinger program * AUTHOR: Duane Wessels @@ -235,7 +235,7 @@ char buf[sizeof(wpi)]; int x; - struct SOCKADDR_IN PS; + struct sockaddr_in PS; WSAStartup(2, &wsaData); @@ -350,7 +350,7 @@ size_t icmp_pktsize = sizeof(struct icmphdr); - struct SOCKADDR_IN S; + struct sockaddr_in S; memset(pkt, '\0', MAX_PKT_SZ); icmp = (struct icmphdr *) (void *) pkt; @@ -387,12 +387,12 @@ } icmp->icmp_cksum = in_cksum((u_short *) icmp, icmp_pktsize); - FAMILY_FROM_SA(S) = AF_INET; + S.sin_family = AF_INET; /* * cevans: alert: trusting to-host, was supplied in network packet */ - ADDR_FROM_SA(S) = to; - PORT_FROM_SA(S) = 0; + S.sin_addr = to; + S.sin_port = 0; assert(icmp_pktsize <= MAX_PKT_SZ); sendto(icmp_sock, (const void *) pkt, @@ -401,7 +401,7 @@ (struct sockaddr *) &S, - sizeof(struct SOCKADDR_IN)); + sizeof(struct sockaddr_in)); pingerLog(icmp, to, 0, 0); } @@ -411,7 +411,7 @@ int n; socklen_t fromlen; - struct SOCKADDR_IN from; + struct sockaddr_in from; int iphdrlen = 20; struct iphdr *ip = NULL; @@ -446,7 +446,7 @@ #endif - debug(42, 9) ("pingerRecv: %d bytes from %s\n", n, SA_NTOA(from)); + debug(42, 9) ("pingerRecv: %d bytes from %s\n", n, inet_ntoa(from.sin_addr)); ip = (struct iphdr *) (void *) pkt; @@ -476,7 +476,7 @@ echo = (icmpEchoData *) (void *) (icmp + 1); - preply.from = ADDR_FROM_SA(from); + preply.from = from.sin_addr; preply.opcode = echo->opcode; @@ -488,7 +488,7 @@ pingerSendtoSquid(&preply); - pingerLog(icmp, ADDR_FROM_SA(from), preply.rtt, preply.hops); + pingerLog(icmp, from.sin_addr, preply.rtt, preply.hops); } @@ -524,7 +524,7 @@ debug(42, 2) ("pingerLog: %9d.%06d %-16s %d %-15.15s %dms %d hops\n", (int) current_time.tv_sec, (int) current_time.tv_usec, - INET_NTOA(addr), + inet_ntoa(addr), (int) icmp->icmp_type, icmpPktStr[icmp->icmp_type], rtt, Index: squid3/src/send-announce.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/send-announce.cc,v retrieving revision 1.3.10.3 retrieving revision 1.3.10.4 diff -u -r1.3.10.3 -r1.3.10.4 --- squid3/src/send-announce.cc 5 Jan 2007 16:59:33 -0000 1.3.10.3 +++ squid3/src/send-announce.cc 22 Apr 2007 07:48:22 -0000 1.3.10.4 @@ -1,6 +1,6 @@ /* - * $Id: send-announce.cc,v 1.3.10.3 2007/01/05 16:59:33 hno Exp $ + * $Id: send-announce.cc,v 1.3.10.4 2007/04/22 07:48:22 amosjeffries Exp $ * * DEBUG: section 27 Cache Announcer * AUTHOR: Duane Wessels @@ -60,7 +60,7 @@ LOCAL_ARRAY(char, tbuf, 256); LOCAL_ARRAY(char, sndbuf, BUFSIZ); - struct SOCKADDR_IN S; + struct sockaddr_in S; char *host = Config.Announce.host; char *file = NULL; u_short port = Config.Announce.port; @@ -110,9 +110,9 @@ } memset(&S, '\0', sizeof(S)); - FAMILY_FROM_SA(S) = AF_INET; - PORT_FROM_SA(S) = htons(port); - ADDR_FROM_SA(S) = ia->in_addrs[0]; + S.sin_family = AF_INET; + S.sin_port = htons(port); + S.sin_addr = ia->in_addrs[0]; assert(theOutIcpConnection > 0); x = comm_udp_sendto(theOutIcpConnection, &S, sizeof(S), Index: squid3/src/snmp_core.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/snmp_core.cc,v retrieving revision 1.10.8.5 retrieving revision 1.10.8.6 diff -u -r1.10.8.5 -r1.10.8.6 --- squid3/src/snmp_core.cc 5 Jan 2007 16:59:34 -0000 1.10.8.5 +++ squid3/src/snmp_core.cc 22 Apr 2007 07:48:22 -0000 1.10.8.6 @@ -1,6 +1,6 @@ /* - * $Id: snmp_core.cc,v 1.10.8.5 2007/01/05 16:59:34 hno Exp $ + * $Id: snmp_core.cc,v 1.10.8.6 2007/04/22 07:48:22 amosjeffries Exp $ * * DEBUG: section 49 SNMP support * AUTHOR: Glenn Chisholm @@ -362,7 +362,7 @@ { u_short port; - struct SOCKADDR_IN xaddr; + struct sockaddr_in xaddr; socklen_t len; int x; @@ -386,7 +386,7 @@ debug(1, 1) ("Accepting SNMP messages on port %d, FD %d.\n", (int) port, theInSnmpConnection); - if (!ADDR_EQUALS(Config.Addrs.snmp_outgoing, no_addr)) { + if (Config.Addrs.snmp_outgoing.s_addr != no_addr.s_addr) { enter_suid(); theOutSnmpConnection = comm_open(SOCK_DGRAM, IPPROTO_UDP, @@ -416,7 +416,7 @@ memset(&theOutSNMPAddr, '\0', sizeof(struct IN_ADDR)); - len = sizeof(struct SOCKADDR_IN); + len = sizeof(struct sockaddr_in); memset(&xaddr, '\0', len); x = getsockname(theOutSnmpConnection, @@ -426,7 +426,7 @@ debug(51, 1) ("theOutSnmpConnection FD %d: getsockname: %s\n", theOutSnmpConnection, xstrerror()); else - theOutSNMPAddr = ADDR_FROM_SA(xaddr); + theOutSNMPAddr = xaddr.sin_addr; } } @@ -482,7 +482,7 @@ { LOCAL_ARRAY(char, buf, SNMP_REQUEST_SIZE); - struct SOCKADDR_IN from; + struct sockaddr_in from; socklen_t from_len; snmp_request_t *snmp_rq; int len; @@ -491,7 +491,7 @@ commSetSelect(sock, COMM_SELECT_READ, snmpHandleUdp, NULL, 0); - from_len = sizeof(struct SOCKADDR_IN); + from_len = sizeof(struct sockaddr_in); memset(&from, '\0', from_len); memset(buf, '\0', SNMP_REQUEST_SIZE); @@ -508,7 +508,7 @@ debug(49, 3) ("snmpHandleUdp: FD %d: received %d bytes from %s.\n", sock, len, - SA_NTOA(from)); + inet_ntoa(from.sin_addr)); snmp_rq = (snmp_request_t *)xcalloc(1, sizeof(snmp_request_t)); snmp_rq->buf = (u_char *) buf; @@ -516,7 +516,7 @@ snmp_rq->sock = sock; snmp_rq->outbuf = (unsigned char *)xmalloc(snmp_rq->outlen = SNMP_REQUEST_SIZE); - xmemcpy(&snmp_rq->from, &from, sizeof(struct SOCKADDR_IN)); + xmemcpy(&snmp_rq->from, &from, sizeof(struct sockaddr_in)); snmpDecodePacket(snmp_rq); xfree(snmp_rq->outbuf); xfree(snmp_rq); @@ -561,7 +561,7 @@ snmpConstructReponse(rq); } else { debug(49, 1) ("Failed SNMP agent query from : %s.\n", - SA_NTOA(rq->from)); + inet_ntoa(rq->from.sin_addr)); snmp_free_pdu(PDU); } @@ -876,15 +876,15 @@ *len += 4; } else { laddr = oid2addr(&name[*len - 4]); - host_addr = INET_NTOA(*laddr); + host_addr = inet_ntoa(*laddr); last_addr = (char *)xmalloc(strlen(host_addr)); strncpy(last_addr, host_addr, strlen(host_addr)); - current_addr = SA_NTOA(peers->in_addr); + current_addr = inet_ntoa(peers->in_addr.sin_addr); while ((peers) && (strncmp(last_addr, current_addr, strlen(current_addr)))) { if (peers->next) { peers = peers->next; - current_addr = SA_NTOA(peers->in_addr); + current_addr = inet_ntoa(peers->in_addr.sin_addr); } else { peers = NULL; } Index: squid3/src/stat.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/stat.cc,v retrieving revision 1.24.4.6 retrieving revision 1.24.4.7 diff -u -r1.24.4.6 -r1.24.4.7 --- squid3/src/stat.cc 14 Apr 2007 04:00:13 -0000 1.24.4.6 +++ squid3/src/stat.cc 22 Apr 2007 07:48:22 -0000 1.24.4.7 @@ -1,5 +1,5 @@ /* - * $Id: stat.cc,v 1.24.4.6 2007/04/14 04:00:13 amosjeffries Exp $ + * $Id: stat.cc,v 1.24.4.7 2007/04/22 07:48:22 amosjeffries Exp $ * * DEBUG: section 18 Cache Manager Statistics * AUTHOR: Harvest Derived @@ -1664,11 +1664,11 @@ storeAppendPrintf(s, "\tin: buf %p, offset %ld, size %ld\n", conn->in.buf, (long int) conn->in.notYetUsed, (long int) conn->in.allocatedSize); storeAppendPrintf(s, "\tpeer: %s:%d\n", - SA_NTOA(conn->peer), - ntohs(PORT_FROM_SA(conn->peer))); + inet_ntoa(conn->peer.sin_addr), + ntohs(conn->peer.sin_port)); storeAppendPrintf(s, "\tme: %s:%d\n", - SA_NTOA(conn->me), - ntohs(PORT_FROM_SA(conn->me))); + inet_ntoa(conn->me.sin_addr), + ntohs(conn->me.sin_port)); storeAppendPrintf(s, "\tnrequests: %d\n", conn->nrequests); } Index: squid3/src/url.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/url.cc,v retrieving revision 1.9.8.9 retrieving revision 1.9.8.10 diff -u -r1.9.8.9 -r1.9.8.10 --- squid3/src/url.cc 15 Apr 2007 13:32:04 -0000 1.9.8.9 +++ squid3/src/url.cc 22 Apr 2007 07:48:23 -0000 1.9.8.10 @@ -1,6 +1,6 @@ /* - * $Id: url.cc,v 1.9.8.9 2007/04/15 13:32:04 amosjeffries Exp $ + * $Id: url.cc,v 1.9.8.10 2007/04/22 07:48:23 amosjeffries Exp $ * * DEBUG: section 23 URL Parsing * AUTHOR: Duane Wessels @@ -401,17 +401,22 @@ if (stringHasWhitespace(urlpath)) { debug(23, 2) ("urlParse: URI has whitespace: {%s}\n", url); switch (Config.uri_whitespace) { + case URI_WHITESPACE_DENY: return NULL; + case URI_WHITESPACE_ALLOW: break; + case URI_WHITESPACE_ENCODE: t = rfc1738_escape_unescaped(urlpath); xstrncpy(urlpath, t, MAX_URL); break; + case URI_WHITESPACE_CHOP: *(urlpath + strcspn(urlpath, w_space)) = '\0'; break; + case URI_WHITESPACE_STRIP: default: t = q = urlpath; @@ -458,11 +463,15 @@ switch (request->method) { case METHOD_CONNECT: +#ifdef INET6 snprintf(urlbuf, MAX_URL, "%s%s%s:%d", NEEDS_BRACKETS(request->host) ? "[" : null_string, request->host, NEEDS_BRACKETS(request->host) ? "]" : null_string, request->port); +#else + snprintf(urlbuf, MAX_URL, "%s:%d", request->host, request->port); +#endif break; default: @@ -471,7 +480,7 @@ if (request->port != urlDefaultPort(request->protocol)) snprintf(portbuf, 32, ":%d", request->port); - +#ifdef INET6 snprintf(urlbuf, MAX_URL, "%s://%s%s%s%s%s%s%s", ProtocolStr[request->protocol], NEEDS_BRACKETS(request->host) ? "[" : null_string, @@ -481,7 +490,15 @@ NEEDS_BRACKETS(request->host) ? "]" : null_string, portbuf, request->urlpath.buf()); - +#else + snprintf(urlbuf, MAX_URL, "%s://%s%s%s%s%s", + ProtocolStr[request->protocol], + request->login, + *request->login ? "@" : null_string, + request->host, + portbuf, + request->urlpath.buf()); +#endif break; } } @@ -503,11 +520,17 @@ switch (request->method) { case METHOD_CONNECT: +#ifdef INET6 snprintf(buf, MAX_URL, "%s%s%s:%d", - NEEDS_BRACKETS(request->host) ? "[" : null_string, - request->host, - NEEDS_BRACKETS(request->host) ? "]" : null_string, - request->port); + NEEDS_BRACKETS(request->host) ? "[" : null_string, + request->host, + NEEDS_BRACKETS(request->host) ? "]" : null_string, + request->port); +#else + snprintf(buf, MAX_URL, "%s:%d", + request->host, + request->port); +#endif break; default: @@ -527,14 +550,23 @@ strcat(loginbuf, "@"); } +#ifdef INET6 snprintf(buf, MAX_URL, "%s://%s%s%s%s%s%s", ProtocolStr[request->protocol], - NEEDS_BRACKETS(request->host) ? "[" : null_string, + NEEDS_BRACKETS(request->host) ? "[" : null_string, loginbuf, request->host, - NEEDS_BRACKETS(request->host) ? "]" : null_string, + NEEDS_BRACKETS(request->host) ? "]" : null_string, portbuf, request->urlpath.buf()); +#else + snprintf(buf, MAX_URL, "%s://%s%s%s%s", + ProtocolStr[request->protocol], + loginbuf, + request->host, + portbuf, + request->urlpath.buf()); +#endif /* * strip arguments AFTER a question-mark */ Index: squid3/src/wccp.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/wccp.cc,v retrieving revision 1.10.2.7 retrieving revision 1.10.2.8 diff -u -r1.10.2.7 -r1.10.2.8 --- squid3/src/wccp.cc 12 Mar 2007 10:37:48 -0000 1.10.2.7 +++ squid3/src/wccp.cc 22 Apr 2007 07:48:23 -0000 1.10.2.8 @@ -1,6 +1,6 @@ /* - * $Id: wccp.cc,v 1.10.2.7 2007/03/12 10:37:48 amosjeffries Exp $ + * $Id: wccp.cc,v 1.10.2.8 2007/04/22 07:48:23 amosjeffries Exp $ * * DEBUG: section 80 WCCP Support * AUTHOR: Glenn Chisholm @@ -32,15 +32,6 @@ * 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 wccp protocol documented for IPv6 ? No. */ -#error "Error. WCCP Protocol does not presently support IPv6." -#endif #include "squid.h" #include "comm.h" #include "event.h" Index: squid3/src/wccp2.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/wccp2.cc,v retrieving revision 1.13.2.4 retrieving revision 1.13.2.5 diff -u -r1.13.2.4 -r1.13.2.5 --- squid3/src/wccp2.cc 7 Apr 2007 11:33:35 -0000 1.13.2.4 +++ squid3/src/wccp2.cc 22 Apr 2007 07:48:23 -0000 1.13.2.5 @@ -1,6 +1,6 @@ /* - * $Id: wccp2.cc,v 1.13.2.4 2007/04/07 11:33:35 amosjeffries Exp $ + * $Id: wccp2.cc,v 1.13.2.5 2007/04/22 07:48:23 amosjeffries Exp $ * * DEBUG: section 80 WCCP Support * AUTHOR: Steven Wilton @@ -32,15 +32,6 @@ * 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" Index: squid3/src/tests/testUfs.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/tests/testUfs.cc,v retrieving revision 1.1.6.1 retrieving revision 1.1.6.2 diff -u -r1.1.6.1 -r1.1.6.2 --- squid3/src/tests/testUfs.cc 5 Jan 2007 17:01:36 -0000 1.1.6.1 +++ squid3/src/tests/testUfs.cc 22 Apr 2007 07:48:24 -0000 1.1.6.2 @@ -84,6 +84,8 @@ if (0 > system ("rm -rf " TESTDIR)) throw std::runtime_error("Failed to clean test work directory"); +//#ifdef AYJ_DONT_DO_FOLLOWING_IT_ASSERTS +#if true StorePointer aRoot (new StoreController); Store::Root(aRoot); @@ -210,6 +212,7 @@ Store::Root(NULL); safe_free(Config.replPolicy->type); delete Config.replPolicy; +#endif /* AYJ debug hold to see where failure starts */ if (0 > system ("rm -rf " TESTDIR)) throw std::runtime_error("Failed to clean test work directory");