--------------------- PatchSet 1315 Date: 2005/04/25 13:34:38 Author: rmartinez Branch: squid3-ipv6 Tag: (none) Log: Fixing some conflicts with HEAD. Renaming inet_toa into INET_TOA Members: src/asn.cc:1.16.6.1->1.16.6.2 src/cache_cf.cc:1.40.2.2->1.40.2.3 src/cachemgr.cc:1.8.4.4->1.8.4.5 src/client.cc:1.10->1.10.4.1 src/client_db.cc:1.5.4.1->1.5.4.2 src/client_side.cc:1.68.2.2->1.68.2.3 src/client_side.h:1.7.10.1->1.7.10.2 src/client_side_reply.cc:1.57.4.2->1.57.4.3 src/comm.cc:1.47.2.2->1.47.2.3 src/dns_internal.cc:1.15.6.1->1.15.6.2 src/dnsserver.cc:1.7.4.1->1.7.4.2 src/errorpage.cc:1.23->1.23.6.1 src/external_acl.cc:1.37.6.1->1.37.6.2 src/forward.cc:1.35.4.2->1.35.4.3 src/fqdncache.cc:1.9.2.4->1.9.2.5 src/ftp.cc:1.26.2.1->1.26.2.2 src/globals.h:1.17.2.4->1.17.2.5 src/htcp.cc:1.15->1.15.6.1 src/htcp.h:1.4->1.4.8.1 src/http.cc:1.43.4.2->1.43.4.3 src/icmp.cc:1.8.8.1->1.8.8.2 src/icp_v2.cc:1.17.8.1->1.17.8.2 src/icp_v3.cc:1.5->1.5.8.1 src/ident.cc:1.11->1.11.8.1 src/internal.cc:1.5->1.5.8.1 src/ipc.cc:1.9->1.9.4.1 src/ipcache.cc:1.9.2.4->1.9.2.5 src/main.cc:1.42.4.1->1.42.4.2 src/multicast.cc:1.2->1.2.10.1 src/neighbors.cc:1.23.4.2->1.23.4.3 src/net_db.cc:1.13.4.1->1.13.4.2 src/peer_select.cc:1.9.4.1->1.9.4.2 src/pinger.cc:1.9.8.1->1.9.8.2 src/protos.h:1.48.4.4->1.48.4.5 src/recv-announce.cc:1.2->1.2.10.1 src/redirect.cc:1.15.4.1->1.15.4.2 src/send-announce.cc:1.3->1.3.10.1 src/snmp_core.cc:1.10.8.1->1.10.8.2 src/stat.cc:1.24->1.24.4.1 src/structs.h:1.66.2.6->1.66.2.7 src/tools.cc:1.22.2.1->1.22.2.2 src/wccp.cc:1.10.2.1->1.10.2.2 Index: squid3/src/asn.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/asn.cc,v retrieving revision 1.16.6.1 retrieving revision 1.16.6.2 diff -u -r1.16.6.1 -r1.16.6.2 --- squid3/src/asn.cc 19 Apr 2005 10:57:56 -0000 1.16.6.1 +++ squid3/src/asn.cc 25 Apr 2005 13:34:38 -0000 1.16.6.2 @@ -1,6 +1,6 @@ /* - * $Id: asn.cc,v 1.16.6.1 2005/04/19 10:57:56 rmartinez Exp $ + * $Id: asn.cc,v 1.16.6.2 2005/04/25 13:34:38 rmartinez Exp $ * * DEBUG: section 53 AS Number handling * AUTHOR: Duane Wessels, Kostas Anagnostakis @@ -140,7 +140,7 @@ List *a = NULL; List *b = NULL; lh = ntohl(addr.s_addr); - debug(53, 3) ("asnMatchIp: Called for %s.\n", inet_ntoa(addr)); + debug(53, 3) ("asnMatchIp: Called for %s.\n", INET_NTOA(addr)); if (AS_tree_head == NULL) return 0; @@ -421,9 +421,9 @@ in_m.s_addr = mask; - xstrncpy(dbg1, inet_ntoa(in_a), 32); + xstrncpy(dbg1, INET_NTOA(in_a), 32); - xstrncpy(dbg2, inet_ntoa(in_m), 32); + xstrncpy(dbg2, INET_NTOA(in_m), 32); addr = ntohl(addr); @@ -547,7 +547,7 @@ (void) get_m_int(addr.s_addr, e->e_addr); (void) get_m_int(mask.s_addr, e->e_mask); storeAppendPrintf(sentry, "%15s/%d\t", - inet_ntoa(addr), mask_len(ntohl(mask.s_addr))); + INET_NTOA(addr), mask_len(ntohl(mask.s_addr))); asinfo = e->e_info; assert(asinfo->as_number); Index: squid3/src/cache_cf.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/cache_cf.cc,v retrieving revision 1.40.2.2 retrieving revision 1.40.2.3 diff -u -r1.40.2.2 -r1.40.2.3 --- squid3/src/cache_cf.cc 19 Apr 2005 10:57:56 -0000 1.40.2.2 +++ squid3/src/cache_cf.cc 25 Apr 2005 13:34:52 -0000 1.40.2.3 @@ -1,6 +1,6 @@ /* - * $Id: cache_cf.cc,v 1.40.2.2 2005/04/19 10:57:56 rmartinez Exp $ + * $Id: cache_cf.cc,v 1.40.2.3 2005/04/25 13:34:52 rmartinez Exp $ * * DEBUG: section 3 Configuration File Parsing * AUTHOR: Harvest Derived @@ -648,7 +648,7 @@ https_port_list *s; for (s = Config.Sockaddr.https; s != NULL; s = (https_port_list *) s->http.next) { - debug(3, 1) ("Initializing https_port %s:%d SSL context\n", inet_ntoa(s->http.s.sin_addr), ntohs(s->http.s.sin_port)); + debug(3, 1) ("Initializing https_port %s:%d SSL context\n", INET_NTOA(s->http.s.sin_addr), ntohs(s->http.s.sin_port)); s->sslContext = sslCreateServerContext(s->cert, s->key, s->version, s->cipher, s->options, s->sslflags, s->clientca, s->cafile, s->capath, s->crlfile, s->dhfile, s->sslcontext); } } @@ -863,7 +863,7 @@ dump_address(StoreEntry * entry, const char *name, struct IN_ADDR addr) { - storeAppendPrintf(entry, "%s %s\n", name, inet_ntoa(addr)); + storeAppendPrintf(entry, "%s %s\n", name, INET_NTOA(addr)); } static void @@ -877,7 +877,11 @@ if (token == NULL) self_destruct(); +#ifdef INET6 + if (safe_inet6_addr(token, addr) == 1) +#else if (safe_inet_addr(token, addr) == 1) +#endif (void) 0; else if ((hp = gethostbyname(token))) /* dont use ipcache */ *addr = inaddrFromHostent(hp); @@ -902,7 +906,7 @@ for (l = head; l; l = l->next) { if (l->addr.s_addr != INADDR_ANY) - storeAppendPrintf(entry, "%s %s", name, inet_ntoa(l->addr)); + storeAppendPrintf(entry, "%s %s", name, INET_NTOA(l->addr)); else storeAppendPrintf(entry, "%s autoselect", name); @@ -2610,7 +2614,7 @@ } s = static_cast(xcalloc(1, sizeof(*s))); - s->s.sin_port = htons(port); + PORT_FROM_SA(s->s) = htons(port); if (NULL == host) s->s.sin_addr = any_addr; @@ -2643,7 +2647,7 @@ while (s) { storeAppendPrintf(e, "%s %s:%d\n", n, - inet_ntoa(s->s.sin_addr), + INET_NTOA(s->s.sin_addr), ntohs(s->s.sin_port)); s = s->next; } @@ -2693,7 +2697,7 @@ self_destruct(); } - s->s.sin_port = htons(port); + PORT_FROM_SA(s->s) = htons(port); if (NULL == host) s->s.sin_addr = any_addr; @@ -2808,7 +2812,7 @@ { storeAppendPrintf(e, "%s %s:%d", n, - inet_ntoa(s->s.sin_addr), + INET_NTOA(s->s.sin_addr), ntohs(s->s.sin_port)); if (s->defaultsite) Index: squid3/src/cachemgr.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/Attic/cachemgr.cc,v retrieving revision 1.8.4.4 retrieving revision 1.8.4.5 diff -u -r1.8.4.4 -r1.8.4.5 --- squid3/src/cachemgr.cc 19 Apr 2005 10:57:57 -0000 1.8.4.4 +++ squid3/src/cachemgr.cc 25 Apr 2005 13:35:06 -0000 1.8.4.5 @@ -1,6 +1,6 @@ /* - * $Id: cachemgr.cc,v 1.8.4.4 2005/04/19 10:57:57 rmartinez Exp $ + * $Id: cachemgr.cc,v 1.8.4.5 2005/04/25 13:35:06 rmartinez Exp $ * * DEBUG: section 0 CGI Cache Manager * AUTHOR: Duane Wessels @@ -162,14 +162,7 @@ static const char *progname = NULL; static time_t now; -<<<<<<< cachemgr.cc -#if ENABLE_IPV6 -#else -static struct in_addr no_addr; -#endif -======= static struct IN_ADDR no_addr; ->>>>>>> 1.11 /* * Function prototypes @@ -680,7 +673,9 @@ process_request(cachemgr_request * req) { + const struct hostent *hp; + static struct SOCKADDR_IN S; int s; int l; #ifdef _SQUID_MSWIN_ @@ -718,83 +713,27 @@ return 1; } -#if ENABLE_IPV6 - // Implemented as in http://ftp.gnu.org/savannah/files/ffss/doc/ipv6-app-port.html, gethostbyname() - { - struct sockaddr * sa; - struct addrinfo hints; - struct addrinfo * addrinfo; - int error; - - /* - * getaddrinfo() case. You can get IPv6 address and IPv4 address - * at the same time. - */ - memset(&hints, 0, sizeof(hints)); - /* set-up hints structure */ - hints.ai_family = PF_UNSPEC; - error = getaddrinfo(req->hostname, NULL, &hints, &addrinfo); - if (error) { - snprintf(buf, 1024, "Unable to resolve host %s: %s\n", req->hostname,gai_strerror(error)); - error_html(buf); - return 1; - } else { - struct addrinfo * entry = addrinfo; - int connected = 0; - - - while (entry) { - sa = (struct sockaddr *)entry->ai_addr; - /* do what you want */ - - - if (connect(s,sa,sizeof(struct sockaddr)) < 0) { - // some error - } else { - connected = 1; - break; - } - - entry = entry->ai_next; - } - - freeaddrinfo(addrinfo); - - if (!connected) { // we tried all adresses, but failed - snprintf(buf, 1024, "connect: %s\n", xstrerror()); - error_html(buf); - return 1; - } - } + memset(&S, '\0', sizeof(struct SOCKADDR_IN)); + FAMILY_FROM_SA(S) = AF_INET; + + if ((hp = gethostbyname(req->hostname)) != NULL) { + assert(hp->h_length >= 0 && (size_t)hp->h_length <= sizeof(S.sin_addr.s_addr)); + xmemcpy(&S.sin_addr.s_addr, hp->h_addr, hp->h_length); + } else if (safe_inet_addr(req->hostname, &S.sin_addr)) + (void) 0; + else { + snprintf(buf, 1024, "Unknown host: %s\n", req->hostname); + error_html(buf); + return 1; } -#else - { - static struct sockaddr_in S; - const struct hostent * hp; - - memset(&S, '\0', sizeof(struct sockaddr_in)); - S.sin_family = AF_INET; - - if ((hp = gethostbyname(req->hostname)) != NULL) { - assert(hp->h_length >= 0 && (size_t)hp->h_length <= sizeof(S.sin_addr.s_addr)); - xmemcpy(&S.sin_addr.s_addr, hp->h_addr, hp->h_length); - } else if (safe_inet_addr(req->hostname, &S.sin_addr)) - (void) 0; - else { - snprintf(buf, 1024, "Unknown host: %s\n", req->hostname); - error_html(buf); - return 1; - } - - S.sin_port = htons(req->port); - - if (connect(s, (struct sockaddr *) &S, sizeof(struct sockaddr_in)) < 0) { - snprintf(buf, 1024, "connect: %s\n", xstrerror()); - error_html(buf); - return 1; - } + + PORT_FROM_SA(S) = htons(req->port); + + if (connect(s, (struct sockaddr *) &S, sizeof(struct SOCKADDR_IN)) < 0) { + snprintf(buf, 1024, "connect: %s\n", xstrerror()); + error_html(buf); + return 1; } -#endif l = snprintf(buf, sizeof(buf), "GET cache_object://%s/%s HTTP/1.0\r\n" @@ -827,10 +766,7 @@ int answer; #endif -#if ENABLE_IPV6 -#else - safe_inet_addr("255.255.255.255", &no_addr); -#endif + memset(&no_addr, '\xFF', sizeof(no_addr)); now = time(NULL); #ifdef _SQUID_MSWIN_ Index: squid3/src/client.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/Attic/client.cc,v retrieving revision 1.10 retrieving revision 1.10.4.1 diff -u -r1.10 -r1.10.4.1 --- squid3/src/client.cc 7 Jan 2005 03:13:20 -0000 1.10 +++ squid3/src/client.cc 25 Apr 2005 13:35:20 -0000 1.10.4.1 @@ -1,6 +1,6 @@ /* - * $Id: client.cc,v 1.10 2005/01/07 03:13:20 squidadm Exp $ + * $Id: client.cc,v 1.10.4.1 2005/04/25 13:35:20 rmartinez Exp $ * * DEBUG: section 0 WWW Client * AUTHOR: Harvest Derived @@ -547,22 +547,23 @@ static const struct hostent *hp = NULL; - static struct sockaddr_in from_addr; + static struct SOCKADDR_IN from_addr; /* Set up the source socket address from which to send. */ if (hp == NULL) { - from_addr.sin_family = AF_INET; + + FAMILY_FROM_SA(from_addr)= AF_FAMILY; if ((hp = gethostbyname(local_host)) == 0) { return (-1); } xmemcpy(&from_addr.sin_addr, hp->h_addr, hp->h_length); - from_addr.sin_port = 0; + PORT_FROM_SA(from_addr) = 0; } - return bind(sock, (struct sockaddr *) &from_addr, sizeof(struct sockaddr_in)); + return bind(sock, (struct sockaddr *) &from_addr, sizeof(struct SOCKADDR_IN)); } static int @@ -571,26 +572,26 @@ static const struct hostent *hp = NULL; - static struct sockaddr_in to_addr; + static struct SOCKADDR_IN to_addr; /* Set up the destination socket address for message to send to. */ if (hp == NULL) { - to_addr.sin_family = AF_INET; + FAMILY_FROM_SA(to_addr) = AF_INET; if ((hp = gethostbyname(dest_host)) == 0) { return (-1); } xmemcpy(&to_addr.sin_addr, hp->h_addr, hp->h_length); - to_addr.sin_port = htons(dest_port); + PORT_FROM_SA(to_addr) = htons(dest_port); } if (tvp) (void) Now(tvp); - return connect(sock, (struct sockaddr *) &to_addr, sizeof(struct sockaddr_in)); + return connect(sock, (struct sockaddr *) &to_addr, sizeof(struct SOCKADDR_IN)); } static int Index: squid3/src/client_db.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/client_db.cc,v retrieving revision 1.5.4.1 retrieving revision 1.5.4.2 diff -u -r1.5.4.1 -r1.5.4.2 --- squid3/src/client_db.cc 19 Apr 2005 10:57:57 -0000 1.5.4.1 +++ squid3/src/client_db.cc 25 Apr 2005 13:35:30 -0000 1.5.4.2 @@ -1,6 +1,6 @@ /* - * $Id: client_db.cc,v 1.5.4.1 2005/04/19 10:57:57 rmartinez Exp $ + * $Id: client_db.cc,v 1.5.4.2 2005/04/25 13:35:30 rmartinez Exp $ * * DEBUG: section 0 Client Database * AUTHOR: Duane Wessels @@ -57,7 +57,7 @@ { ClientInfo *c; c = (ClientInfo *)memAllocate(MEM_CLIENT_INFO); - c->hash.key = xstrdup(inet_ntoa(addr)); + c->hash.key = xstrdup(INET_NTOA(addr)); c->addr = addr; hash_join(client_table, &c->hash); statCounter.client_http.clients++; @@ -95,7 +95,7 @@ if (!Config.onoff.client_db) return; - key = inet_ntoa(addr); + key = ( char*)INET_NTOA(addr); c = (ClientInfo *) hash_lookup(client_table, key); @@ -143,7 +143,7 @@ if (!Config.onoff.client_db) return 0; - key = inet_ntoa(addr); + key = (char *)INET_NTOA(addr); c = (ClientInfo *) hash_lookup(client_table, key); @@ -172,7 +172,7 @@ if (!Config.onoff.client_db) return 0; - key = inet_ntoa(addr); + key = (char *)INET_NTOA(addr); c = (ClientInfo *) hash_lookup(client_table, key); @@ -386,7 +386,7 @@ if (current) { - key = inet_ntoa(*current); + key = INET_NTOA(*current); hash_first(client_table); while ((c = (ClientInfo *) hash_next(client_table))) { Index: squid3/src/client_side.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/client_side.cc,v retrieving revision 1.68.2.2 retrieving revision 1.68.2.3 diff -u -r1.68.2.2 -r1.68.2.3 --- squid3/src/client_side.cc 19 Apr 2005 10:57:57 -0000 1.68.2.2 +++ squid3/src/client_side.cc 25 Apr 2005 13:35:40 -0000 1.68.2.3 @@ -1,6 +1,6 @@ /* - * $Id: client_side.cc,v 1.68.2.2 2005/04/19 10:57:57 rmartinez Exp $ + * $Id: client_side.cc,v 1.68.2.3 2005/04/25 13:35:40 rmartinez Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -165,7 +165,7 @@ static int connKeepReadingIncompleteRequest(ConnStateData::Pointer & conn); static void connCancelIncompleteRequests(ConnStateData::Pointer & conn); -static ConnStateData *connStateCreate(struct sockaddr_in *peer, struct sockaddr_in *me, int fd, http_port_list *port); +static ConnStateData *connStateCreate(struct SOCKADDR_IN *peer, struct SOCKADDR_IN *me, int fd, http_port_list *port); int ClientSocketContext::fd() const @@ -1786,7 +1786,7 @@ http->uri = (char *)xcalloc(url_sz, 1); snprintf(http->uri, url_sz, "%s://%s:%d%s", http->getConn()->port->protocol, - inet_ntoa(http->getConn()->me.sin_addr), + INET_NTOA(http->getConn()->me.sin_addr), ntohs(http->getConn()->me.sin_port), url); debug(33, 5) ("ACCEL VPORT REWRITE: '%s'\n", http->uri); } else if (vport > 0) { @@ -1795,7 +1795,7 @@ http->uri = (char *)xcalloc(url_sz, 1); snprintf(http->uri, url_sz, "%s://%s:%d%s", http->getConn()->port->protocol, - inet_ntoa(http->getConn()->me.sin_addr), + INET_NTOA(http->getConn()->me.sin_addr), vport, url); debug(33, 5) ("ACCEL VPORT REWRITE: '%s'\n", http->uri); } @@ -1830,7 +1830,7 @@ http->uri = (char *)xcalloc(url_sz, 1); snprintf(http->uri, url_sz, "%s://%s:%d%s", http->getConn()->port->protocol, - inet_ntoa(http->getConn()->me.sin_addr), + INET_NTOA(http->getConn()->me.sin_addr), ntohs(http->getConn()->me.sin_port), url); debug(33, 5) ("TRANSPARENT REWRITE: '%s'\n", http->uri); } @@ -2759,7 +2759,7 @@ clientHttpRequest *http = (clientHttpRequest *)data; debug(33, 1) ("WARNING: Closing client %s connection due to lifetime timeout\n", - inet_ntoa(http->getConn()->peer.sin_addr)); + INET_NTOA(http->getConn()->peer.sin_addr)); debug(33, 1) ("\t%s\n", http->uri); comm_close(fd); } @@ -2782,7 +2782,7 @@ ConnStateData * -connStateCreate(struct sockaddr_in *peer, struct sockaddr_in *me, int fd, http_port_list *port) +connStateCreate(struct SOCKADDR_IN *peer, struct SOCKADDR_IN *me, int fd, http_port_list *port) { ConnStateData *result = new ConnStateData; result->peer = *peer; @@ -2796,7 +2796,7 @@ if (port->transparent) { - struct sockaddr_in dst; + struct SOCKADDR_IN dst; if (clientNatLookup(fd, *me, *peer, &dst) == 0) { result->me = dst; /* XXX This should be moved to another field */ @@ -3093,7 +3093,7 @@ s->transparent ? "transparently proxied" : s->accel ? "accelerated" : "", - inet_ntoa(s->s.sin_addr), (int) ntohs(s->s.sin_port), fd); + INET_NTOA(s->s.sin_addr), (int) ntohs(s->s.sin_port), fd); HttpSockets[NHttpSockets++] = fd; } @@ -3115,7 +3115,7 @@ if (s->sslContext == NULL) { debug(1, 1) ("Can not accept HTTPS connections at %s, port %d\n", - inet_ntoa(s->http.s.sin_addr), (int) ntohs(s->http.s.sin_port)); + INET_NTOA(s->http.s.sin_addr), (int) ntohs(s->http.s.sin_port)); } enter_suid(); @@ -3133,7 +3133,7 @@ comm_accept(fd, httpsAccept, s); debug(1, 1) ("Accepting HTTPS connections at %s, port %d, FD %d.\n", - inet_ntoa(s->http.s.sin_addr), (int) ntohs(s->http.s.sin_port), fd); + INET_NTOA(s->http.s.sin_addr), (int) ntohs(s->http.s.sin_port), fd); HttpSockets[NHttpSockets++] = fd; } Index: squid3/src/client_side.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/client_side.h,v retrieving revision 1.7.10.1 retrieving revision 1.7.10.2 diff -u -r1.7.10.1 -r1.7.10.2 --- squid3/src/client_side.h 19 Apr 2005 10:58:13 -0000 1.7.10.1 +++ squid3/src/client_side.h 25 Apr 2005 13:35:57 -0000 1.7.10.2 @@ -1,6 +1,6 @@ /* - * $Id: client_side.h,v 1.7.10.1 2005/04/19 10:58:13 rmartinez Exp $ + * $Id: client_side.h,v 1.7.10.2 2005/04/25 13:35:57 rmartinez Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -178,9 +178,9 @@ /* TODO: generalise the connection owner concept */ ClientSocketContext::Pointer currentobject; /* used by the owner of the connection. Opaque otherwise */ - struct sockaddr_in peer; + struct SOCKADDR_IN peer; - struct sockaddr_in me; + struct SOCKADDR_IN me; struct IN_ADDR log_addr; char rfc931[USER_IDENT_SZ]; Index: squid3/src/client_side_reply.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/client_side_reply.cc,v retrieving revision 1.57.4.2 retrieving revision 1.57.4.3 diff -u -r1.57.4.2 -r1.57.4.3 --- squid3/src/client_side_reply.cc 19 Apr 2005 10:58:13 -0000 1.57.4.2 +++ squid3/src/client_side_reply.cc 25 Apr 2005 13:36:15 -0000 1.57.4.3 @@ -1,6 +1,6 @@ /* - * $Id: client_side_reply.cc,v 1.57.4.2 2005/04/19 10:58:13 rmartinez Exp $ + * $Id: client_side_reply.cc,v 1.57.4.3 2005/04/25 13:36:15 rmartinez Exp $ * * DEBUG: section 88 Client-side Reply Routines * AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c) @@ -1154,7 +1154,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 ? http->getConn()->peer.sin_addr : 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; @@ -1166,7 +1166,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 ? http->getConn()->peer.sin_addr : 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); Index: squid3/src/comm.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/comm.cc,v retrieving revision 1.47.2.2 retrieving revision 1.47.2.3 diff -u -r1.47.2.2 -r1.47.2.3 --- squid3/src/comm.cc 19 Apr 2005 10:58:15 -0000 1.47.2.2 +++ squid3/src/comm.cc 25 Apr 2005 13:36:27 -0000 1.47.2.3 @@ -1,6 +1,6 @@ /* - * $Id: comm.cc,v 1.47.2.2 2005/04/19 10:58:15 rmartinez Exp $ + * $Id: comm.cc,v 1.47.2.3 2005/04/25 13:36:27 rmartinez Exp $ * * DEBUG: section 5 Socket Functions * AUTHOR: Harvest Derived @@ -63,7 +63,7 @@ char *host; u_short port; - struct sockaddr_in S; + struct SOCKADDR_IN S; CallBack callback; struct IN_ADDR in_addr; @@ -987,7 +987,7 @@ comm_local_port(int fd) { - struct sockaddr_in addr; + struct SOCKADDR_IN addr; socklen_t addr_len = 0; fde *F = &fd_table[fd]; @@ -1018,11 +1018,11 @@ commBind(int s, struct IN_ADDR in_addr, u_short port) { - struct sockaddr_in S; + struct SOCKADDR_IN S; memset(&S, '\0', sizeof(S)); - S.sin_family = AF_INET; - S.sin_port = htons(port); + FAMILY_FROM_SA(S) = AF_INET; + PORT_FROM_SA(S) = htons(port); S.sin_addr = in_addr; statCounter.syscalls.sock.binds++; @@ -1031,7 +1031,7 @@ debug(50, 0) ("commBind: Cannot bind socket FD %d to %s:%d: %s\n", s, - S.sin_addr.s_addr == INADDR_ANY ? "*" : inet_ntoa(S.sin_addr), + S.sin_addr.s_addr == INADDR_ANY ? "*" : INET_NTOA(S.sin_addr), (int) port, xstrerror()); @@ -1390,9 +1390,9 @@ void ConnectStateData::defaults() { - S.sin_family = AF_INET; + FAMILY_FROM_SA(S) = AF_INET; S.sin_addr = in_addr; - S.sin_port = htons(port); + PORT_FROM_SA(S) = htons(port); } void @@ -1458,7 +1458,7 @@ int -comm_connect_addr(int sock, const struct sockaddr_in *address) +comm_connect_addr(int sock, const struct SOCKADDR_IN *address) { comm_err_t status = COMM_OK; fde *F = &fd_table[sock]; @@ -1526,7 +1526,7 @@ else return COMM_ERROR; - xstrncpy(F->ipaddr, inet_ntoa(address->sin_addr), 16); + xstrncpy(F->ipaddr, INET_NTOA(address->sin_addr), 16); F->remote_port = ntohs(address->sin_port); @@ -1581,7 +1581,7 @@ fdd_table[sock].close_line = 0; fdc_table[sock].active = 1; fde *F = &fd_table[sock]; - xstrncpy(F->ipaddr, inet_ntoa(details.peer.sin_addr), 16); + xstrncpy(F->ipaddr, INET_NTOA(details.peer.sin_addr), 16); F->remote_port = htons(details.peer.sin_port); F->local_port = htons(details.me.sin_port); commSetNonBlocking(sock); @@ -1826,7 +1826,7 @@ int comm_udp_sendto(int fd, - const struct sockaddr_in *to_addr, + const struct SOCKADDR_IN *to_addr, int addr_len, const void *buf, int len) @@ -1848,7 +1848,7 @@ debug(50, 1) ("comm_udp_sendto: FD %d, %s, port %d: %s\n", fd, - inet_ntoa(to_addr->sin_addr), + INET_NTOA(to_addr->sin_addr), (int) htons(to_addr->sin_port), xstrerror()); Index: squid3/src/dns_internal.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/dns_internal.cc,v retrieving revision 1.15.6.1 retrieving revision 1.15.6.2 diff -u -r1.15.6.1 -r1.15.6.2 --- squid3/src/dns_internal.cc 19 Apr 2005 10:58:16 -0000 1.15.6.1 +++ squid3/src/dns_internal.cc 25 Apr 2005 13:36:42 -0000 1.15.6.2 @@ -1,6 +1,6 @@ /* - * $Id: dns_internal.cc,v 1.15.6.1 2005/04/19 10:58:16 rmartinez Exp $ + * $Id: dns_internal.cc,v 1.15.6.2 2005/04/25 13:36:42 rmartinez Exp $ * * DEBUG: section 78 DNS lookups; interacts with lib/rfc1035.c * AUTHOR: Duane Wessels @@ -85,7 +85,7 @@ struct _ns { - struct sockaddr_in S; + struct SOCKADDR_IN S; int nqueries; int nreplies; int large_pkts; @@ -110,7 +110,7 @@ #endif static void idnsSendQuery(idns_query * q); -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; @@ -124,15 +124,25 @@ struct IN_ADDR A; +#ifdef INET6 + if (!safe_inet6_addr(buf, &A)) { +#else if (!safe_inet_addr(buf, &A)) { +#endif debug(78, 0) ("WARNING: rejecting '%s' as a name server, because it is not a numeric IP address\n", buf); return; } - if (A.s_addr == 0) { + if (ADDR_IS_ANYADDR(A)) { +#ifdef INET6 + debug(78, 0) ("WARNING: Squid does not accept :: in DNS server specifications.\n"); + debug(78, 0) ("Will be using ::1 instead, assuming you meant that DNS is running on the same machine\n"); + safe_inet6_addr("::1", &A); +#else debug(78, 0) ("WARNING: Squid does not accept 0.0.0.0 in DNS server specifications.\n"); debug(78, 0) ("Will be using 127.0.0.1 instead, assuming you meant that DNS is running on the same machine\n"); safe_inet_addr("127.0.0.1", &A); +#endif } if (nns == nns_alloc) { @@ -154,11 +164,11 @@ } assert(nns < nns_alloc); - nameservers[nns].S.sin_family = AF_INET; - nameservers[nns].S.sin_port = htons(DOMAIN_PORT); + FAMILY_FROM_SA(nameservers[nns].S) = AF_INET; + PORT_FROM_SA(nameservers[nns].S) = htons(DOMAIN_PORT); nameservers[nns].S.sin_addr.s_addr = A.s_addr; debug(78, 3) ("idnsAddNameserver: Added nameserver #%d: %s\n", - nns, inet_ntoa(nameservers[nns].S.sin_addr)); + nns, INET_NTOA(nameservers[nns].S.sin_addr)); nns++; } @@ -428,7 +438,7 @@ for (i = 0; i < nns; i++) { storeAppendPrintf(sentry, "%-15s %9d %9d\n", - inet_ntoa(nameservers[i].S.sin_addr), + INET_NTOA(nameservers[i].S.sin_addr), nameservers[i].nqueries, nameservers[i].nreplies); } @@ -514,7 +524,7 @@ static int -idnsFromKnownNameserver(struct sockaddr_in *from) +idnsFromKnownNameserver(struct SOCKADDR_IN *from) { int i; @@ -523,7 +533,7 @@ if (nameservers[i].S.sin_addr.s_addr != from->sin_addr.s_addr) continue; - if (nameservers[i].S.sin_port != from->sin_port) + PORT_FROM_SA(if (nameservers[i].S) != from->sin_port) continue; return i; @@ -642,7 +652,7 @@ int *N = &incoming_sockets_accepted; ssize_t 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]; @@ -681,7 +691,7 @@ debug(78, 3) ("idnsRead: FD %d: received %d bytes from %s.\n", fd, (int) len, - inet_ntoa(from.sin_addr)); + INET_NTOA(from.sin_addr)); ns = idnsFromKnownNameserver(&from); if (ns >= 0) { @@ -691,7 +701,7 @@ if (squid_curtime - last_warning > 60) { debug(78, 1) ("WARNING: Reply from unknown nameserver [%s]\n", - inet_ntoa(from.sin_addr)); + INET_NTOA(from.sin_addr)); last_warning = squid_curtime; } @@ -713,7 +723,7 @@ if (isPowTen(x)) debug(78, 1) ("WARNING: Got %d large DNS replies from %s\n", - x, inet_ntoa(from.sin_addr)); + x, INET_NTOA(from.sin_addr)); len = 512; } @@ -797,7 +807,7 @@ struct IN_ADDR addr; - if (Config.Addrs.udp_outgoing.s_addr != no_addr.s_addr) + if (!ADDR_IS_NOADDR(Config.Addrs.udp_outgoing)) addr = Config.Addrs.udp_outgoing; else addr = Config.Addrs.udp_incoming; @@ -818,7 +828,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); } @@ -937,7 +947,7 @@ { idns_query *q; - const char *ip = inet_ntoa(addr); + const char *ip = INET_NTOA(addr); if (idnsCachedLookup(ip, callback, data)) return; Index: squid3/src/dnsserver.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/dnsserver.cc,v retrieving revision 1.7.4.1 retrieving revision 1.7.4.2 diff -u -r1.7.4.1 -r1.7.4.2 --- squid3/src/dnsserver.cc 19 Apr 2005 10:58:16 -0000 1.7.4.1 +++ squid3/src/dnsserver.cc 25 Apr 2005 13:36:51 -0000 1.7.4.2 @@ -1,6 +1,6 @@ /* - * $Id: dnsserver.cc,v 1.7.4.1 2005/04/19 10:58:16 rmartinez Exp $ + * $Id: dnsserver.cc,v 1.7.4.2 2005/04/25 13:36:51 rmartinez Exp $ * * DEBUG: section 0 DNS Resolver * AUTHOR: Harvest Derived @@ -262,7 +262,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 retrieving revision 1.23.6.1 diff -u -r1.23 -r1.23.6.1 --- squid3/src/errorpage.cc 4 Sep 2004 02:13:21 -0000 1.23 +++ squid3/src/errorpage.cc 25 Apr 2005 13:37:10 -0000 1.23.6.1 @@ -1,6 +1,6 @@ /* - * $Id: errorpage.cc,v 1.23 2004/09/04 02:13:21 squidadm Exp $ + * $Id: errorpage.cc,v 1.23.6.1 2005/04/25 13:37:10 rmartinez Exp $ * * DEBUG: section 4 Error Generation * AUTHOR: Duane Wessels @@ -512,7 +512,7 @@ memBufPrintf(&str, "TimeStamp: %s\r\n\r\n", mkrfc1123(squid_curtime)); /* - IP stuff */ - memBufPrintf(&str, "ClientIP: %s\r\n", inet_ntoa(err->src_addr)); + memBufPrintf(&str, "ClientIP: %s\r\n", INET_NTOA(err->src_addr)); if (err->host) { memBufPrintf(&str, "ServerIP: %s\r\n", err->host); @@ -656,7 +656,7 @@ break; case 'i': - memBufPrintf(&mb, "%s", inet_ntoa(err->src_addr)); + memBufPrintf(&mb, "%s", INET_NTOA(err->src_addr)); break; Index: squid3/src/external_acl.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/external_acl.cc,v retrieving revision 1.37.6.1 retrieving revision 1.37.6.2 diff -u -r1.37.6.1 -r1.37.6.2 --- squid3/src/external_acl.cc 19 Apr 2005 10:58:16 -0000 1.37.6.1 +++ squid3/src/external_acl.cc 25 Apr 2005 13:37:19 -0000 1.37.6.2 @@ -1,6 +1,6 @@ /* - * $Id: external_acl.cc,v 1.37.6.1 2005/04/19 10:58:16 rmartinez Exp $ + * $Id: external_acl.cc,v 1.37.6.2 2005/04/25 13:37:19 rmartinez Exp $ * * DEBUG: section 82 External ACL * AUTHOR: Henrik Nordstrom, MARA Systems AB @@ -741,7 +741,7 @@ #endif case _external_acl_format::EXT_ACL_SRC: - str = inet_ntoa(ch->src_addr); + str = INET_NTOA(ch->src_addr); break; case _external_acl_format::EXT_ACL_SRCPORT: @@ -750,7 +750,7 @@ break; case _external_acl_format::EXT_ACL_MYADDR: - str = inet_ntoa(request->my_addr); + str = INET_NTOA(request->my_addr); break; case _external_acl_format::EXT_ACL_MYPORT: Index: squid3/src/forward.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/forward.cc,v retrieving revision 1.35.4.2 retrieving revision 1.35.4.3 diff -u -r1.35.4.2 -r1.35.4.3 --- squid3/src/forward.cc 19 Apr 2005 10:58:16 -0000 1.35.4.2 +++ squid3/src/forward.cc 25 Apr 2005 13:37:29 -0000 1.35.4.3 @@ -1,6 +1,6 @@ /* - * $Id: forward.cc,v 1.35.4.2 2005/04/19 10:58:16 rmartinez Exp $ + * $Id: forward.cc,v 1.35.4.3 2005/04/25 13:37:29 rmartinez Exp $ * * DEBUG: section 17 Request Forwarding * AUTHOR: Duane Wessels @@ -618,7 +618,7 @@ tos = getOutgoingTOS(fwdState->request); debug(17, 3) ("fwdConnectStart: got addr %s, tos %d\n", - inet_ntoa(outgoing), tos); + INET_NTOA(outgoing), tos); fd = comm_openex(SOCK_STREAM, IPPROTO_TCP, Index: squid3/src/fqdncache.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/fqdncache.cc,v retrieving revision 1.9.2.4 retrieving revision 1.9.2.5 diff -u -r1.9.2.4 -r1.9.2.5 --- squid3/src/fqdncache.cc 19 Apr 2005 10:58:16 -0000 1.9.2.4 +++ squid3/src/fqdncache.cc 25 Apr 2005 13:37:39 -0000 1.9.2.5 @@ -1,6 +1,6 @@ /* - * $Id: fqdncache.cc,v 1.9.2.4 2005/04/19 10:58:16 rmartinez Exp $ + * $Id: fqdncache.cc,v 1.9.2.5 2005/04/25 13:37:39 rmartinez Exp $ * * DEBUG: section 35 FQDN Cache * AUTHOR: Harvest Derived @@ -430,32 +430,13 @@ fqdncacheCallback(f); } -#if ENABLE_IPV6 - char fqdncache_nbgethostbyaddr_namebuf[NI_MAXHOST]; -#endif - void -<<<<<<< fqdncache.cc -#if ENABLE_IPV6 -fqdncache_nbgethostbyaddr(struct inaddr_storage * addr6, FQDNH * handler, void *handlerData) -#else -fqdncache_nbgethostbyaddr(struct in_addr addr, FQDNH * handler, void *handlerData) -#endif -======= fqdncache_nbgethostbyaddr(struct IN_ADDR addr, FQDNH * handler, void *handlerData) ->>>>>>> 1.12 { fqdncache_entry *f = NULL; - char * name; + char *name = (char *)INET_NTOA(addr); generic_cbdata *c; - -#if ENABLE_IPV6 - name = inet6_network_byte_order_to_address_string(addr6); -#else - name = inet_ntoa(addr); -#endif - assert(handler); debug(35, 4) ("fqdncache_nbgethostbyaddr: Name '%s'.\n", name); FqdncacheStats.requests++; @@ -511,12 +492,8 @@ dnsSubmit(hashKeyStr(&f->hash), fqdncacheHandleReply, c); #else -#if ENABLE_IPV6 - idnsPTRLookup(addr6, fqdncacheHandleReply, c); -#else idnsPTRLookup(addr, fqdncacheHandleReply, c); #endif -#endif } /* initialize the fqdncache */ @@ -552,30 +529,14 @@ sizeof(fqdncache_entry), 0); } - const char * -<<<<<<< fqdncache.cc -#if ENABLE_IPV6 -fqdncache_gethostbyaddr(struct inaddr_storage * addr6, int flags) -#else -fqdncache_gethostbyaddr(struct in_addr addr, int flags) -#endif -======= fqdncache_gethostbyaddr(struct IN_ADDR addr, int flags) ->>>>>>> 1.12 { -#if ENABLE_IPV6 - char * name = inet6_network_byte_order_to_address_string(addr6); -#else - char * name = inet_ntoa(addr); -#endif + char *name = (char *)INET_NTOA(addr); fqdncache_entry *f = NULL; -<<<<<<< fqdncache.cc -======= struct IN_ADDR ip; ->>>>>>> 1.12 assert(name); FqdncacheStats.requests++; f = fqdncache_get(name); @@ -604,7 +565,11 @@ /* check if it's already a FQDN address in text form. */ - if (!is_numeric_ip_address(name)) +#ifdef INET6 + if (!safe_inet6_addr(name, &ip)) +#else + if (!safe_inet_addr(name, &ip)) +#endif return name; FqdncacheStats.misses++; @@ -683,7 +648,7 @@ if (Config.onoff.log_fqdn && (n = fqdncache_gethostbyaddr(addr, 0))) return n; - xstrncpy(buf, inet_ntoa(addr), 32); + xstrncpy(buf, INET_NTOA(addr), 32); return buf; } Index: squid3/src/ftp.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ftp.cc,v retrieving revision 1.26.2.1 retrieving revision 1.26.2.2 diff -u -r1.26.2.1 -r1.26.2.2 --- squid3/src/ftp.cc 12 Mar 2005 03:19:50 -0000 1.26.2.1 +++ squid3/src/ftp.cc 25 Apr 2005 13:37:48 -0000 1.26.2.2 @@ -1,6 +1,6 @@ /* - * $Id: ftp.cc,v 1.26.2.1 2005/03/12 03:19:50 mediumnet Exp $ + * $Id: ftp.cc,v 1.26.2.2 2005/04/25 13:37:48 rmartinez Exp $ * * DEBUG: section 9 File Transfer Protocol (FTP) * AUTHOR: Harvest Derived @@ -2102,7 +2102,7 @@ { int fd; - struct sockaddr_in addr; + struct SOCKADDR_IN addr; socklen_t addr_len; if (ftpState->request->method == METHOD_HEAD) { @@ -2281,7 +2281,7 @@ { int fd; - struct sockaddr_in addr; + struct SOCKADDR_IN addr; socklen_t addr_len; int on = 1; u_short port = 0; @@ -2345,7 +2345,7 @@ { int fd; - struct sockaddr_in addr; + struct SOCKADDR_IN addr; socklen_t addr_len; unsigned char *addrptr; unsigned char *portptr; @@ -2402,7 +2402,7 @@ } if (Config.Ftp.sanitycheck) { - char *ipaddr = inet_ntoa(details->peer.sin_addr); + char *ipaddr = 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(details->peer.sin_port), fd_table[ftpState->ctrl.fd].ipaddr); @@ -2428,7 +2428,7 @@ ftpState->data.port = ntohs(details->peer.sin_port); - ftpState->data.host = xstrdup(inet_ntoa(details->peer.sin_addr)); + ftpState->data.host = xstrdup(INET_NTOA(details->peer.sin_addr)); commSetTimeout(ftpState->ctrl.fd, -1, NULL, NULL); Index: squid3/src/globals.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/globals.h,v retrieving revision 1.17.2.4 retrieving revision 1.17.2.5 diff -u -r1.17.2.4 -r1.17.2.5 --- squid3/src/globals.h 19 Apr 2005 10:58:16 -0000 1.17.2.4 +++ squid3/src/globals.h 25 Apr 2005 13:38:09 -0000 1.17.2.5 @@ -1,6 +1,6 @@ /* - * $Id: globals.h,v 1.17.2.4 2005/04/19 10:58:16 rmartinez Exp $ + * $Id: globals.h,v 1.17.2.5 2005/04/25 13:38:09 rmartinez Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -103,14 +103,7 @@ extern struct _acl_deny_info_list *DenyInfoList; /* NULL */ -<<<<<<< globals.h -#if ENABLE_IPV6 -extern struct inaddr_storage no_addr6; -#else -extern struct in_addr any_addr; -======= extern struct IN_ADDR any_addr; ->>>>>>> 1.21 extern struct IN_ADDR local_addr; @@ -118,12 +111,7 @@ extern struct IN_ADDR theOutICPAddr; -<<<<<<< globals.h -extern struct in_addr theOutSNMPAddr; -#endif -======= extern struct IN_ADDR theOutSNMPAddr; ->>>>>>> 1.21 extern struct timeval current_time; Index: squid3/src/htcp.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/htcp.cc,v retrieving revision 1.15 retrieving revision 1.15.6.1 diff -u -r1.15 -r1.15.6.1 --- squid3/src/htcp.cc 31 Aug 2004 02:14:28 -0000 1.15 +++ squid3/src/htcp.cc 25 Apr 2005 13:38:18 -0000 1.15.6.1 @@ -1,6 +1,6 @@ /* - * $Id: htcp.cc,v 1.15 2004/08/31 02:14:28 squidadm Exp $ + * $Id: htcp.cc,v 1.15.6.1 2005/04/25 13:38:18 rmartinez Exp $ * * DEBUG: section 31 Hypertext Caching Protocol * AUTHOR: Duane Wesssels @@ -132,7 +132,7 @@ void checkHit(); void checkedHit(StoreEntry *e); - void setFrom (struct sockaddr_in *from); + void setFrom (struct SOCKADDR_IN *from); void setDataHeader (htcpDataHeader *); char *method; char *uri; @@ -142,7 +142,7 @@ private: HttpRequest *checkHitRequest; - struct sockaddr_in *from; + struct SOCKADDR_IN *from; htcpDataHeader *dhdr; }; @@ -227,26 +227,26 @@ static void htcpFreeSpecifier(htcpSpecifier * s); static void htcpFreeDetail(htcpDetail * s); -static void htcpHandle(char *buf, int sz, struct sockaddr_in *from); +static void htcpHandle(char *buf, int sz, struct SOCKADDR_IN *from); -static void htcpHandleData(char *buf, int sz, struct sockaddr_in *from); +static void htcpHandleData(char *buf, int sz, struct SOCKADDR_IN *from); -static void htcpHandleMon(htcpDataHeader *, char *buf, int sz, struct sockaddr_in *from); +static void htcpHandleMon(htcpDataHeader *, char *buf, int sz, struct SOCKADDR_IN *from); -static void htcpHandleNop(htcpDataHeader *, char *buf, int sz, struct sockaddr_in *from); +static void htcpHandleNop(htcpDataHeader *, char *buf, int sz, struct SOCKADDR_IN *from); -static void htcpHandleSet(htcpDataHeader *, char *buf, int sz, struct sockaddr_in *from); +static void htcpHandleSet(htcpDataHeader *, char *buf, int sz, struct SOCKADDR_IN *from); -static void htcpHandleTst(htcpDataHeader *, char *buf, int sz, struct sockaddr_in *from); +static void htcpHandleTst(htcpDataHeader *, char *buf, int sz, struct SOCKADDR_IN *from); static void htcpRecv(int fd, void *data); -static void htcpSend(const char *buf, int len, struct sockaddr_in *to); +static void htcpSend(const char *buf, int len, struct SOCKADDR_IN *to); -static void htcpTstReply(htcpDataHeader *, StoreEntry *, htcpSpecifier *, struct sockaddr_in *); +static void htcpTstReply(htcpDataHeader *, StoreEntry *, htcpSpecifier *, struct SOCKADDR_IN *); -static void htcpHandleTstRequest(htcpDataHeader *, char *buf, int sz, struct sockaddr_in *from); +static void htcpHandleTstRequest(htcpDataHeader *, char *buf, int sz, struct SOCKADDR_IN *from); -static void htcpHandleTstResponse(htcpDataHeader *, char *, int, struct sockaddr_in *); +static void htcpHandleTstResponse(htcpDataHeader *, char *, int, struct SOCKADDR_IN *); static void htcpHexdump(const char *tag, const char *s, int sz) @@ -529,16 +529,16 @@ static void -htcpSend(const char *buf, int len, struct sockaddr_in *to) +htcpSend(const char *buf, int len, struct SOCKADDR_IN *to) { int x; debug(31, 3) ("htcpSend: %s/%d\n", - inet_ntoa(to->sin_addr), (int) ntohs(to->sin_port)); + INET_NTOA(to->sin_addr), (int) ntohs(to->sin_port)); htcpHexdump("htcpSend", buf, len); x = comm_udp_sendto(htcpOutSocket, to, - sizeof(struct sockaddr_in), + sizeof(struct SOCKADDR_IN), buf, len); @@ -554,7 +554,7 @@ void -htcpSpecifier::setFrom (struct sockaddr_in *aSocket) +htcpSpecifier::setFrom (struct SOCKADDR_IN *aSocket) { from = aSocket; } @@ -708,7 +708,7 @@ static void -htcpTstReply(htcpDataHeader * dhdr, StoreEntry * e, htcpSpecifier * spec, struct sockaddr_in *from) +htcpTstReply(htcpDataHeader * dhdr, StoreEntry * e, htcpSpecifier * spec, struct SOCKADDR_IN *from) { htcpStuff stuff; char *pkt; @@ -794,7 +794,7 @@ static void -htcpHandleNop(htcpDataHeader * hdr, char *buf, int sz, struct sockaddr_in *from) +htcpHandleNop(htcpDataHeader * hdr, char *buf, int sz, struct SOCKADDR_IN *from) { debug(31, 3) ("htcpHandleNop: Unimplemented\n"); } @@ -856,7 +856,7 @@ static void -htcpHandleTst(htcpDataHeader * hdr, char *buf, int sz, struct sockaddr_in *from) +htcpHandleTst(htcpDataHeader * hdr, char *buf, int sz, struct SOCKADDR_IN *from) { debug(31, 3) ("htcpHandleTst: sz = %d\n", (int) sz); @@ -871,7 +871,7 @@ static void -htcpHandleTstResponse(htcpDataHeader * hdr, char *buf, int sz, struct sockaddr_in *from) +htcpHandleTstResponse(htcpDataHeader * hdr, char *buf, int sz, struct SOCKADDR_IN *from) { htcpReplyData htcpReply; cache_key *key = NULL; @@ -922,7 +922,7 @@ static void -htcpHandleTstRequest(htcpDataHeader * dhdr, char *buf, int sz, struct sockaddr_in *from) +htcpHandleTstRequest(htcpDataHeader * dhdr, char *buf, int sz, struct SOCKADDR_IN *from) { /* buf should be a SPECIFIER */ htcpSpecifier *s; @@ -970,21 +970,21 @@ static void -htcpHandleMon(htcpDataHeader * hdr, char *buf, int sz, struct sockaddr_in *from) +htcpHandleMon(htcpDataHeader * hdr, char *buf, int sz, struct SOCKADDR_IN *from) { debug(31, 3) ("htcpHandleMon: Unimplemented\n"); } static void -htcpHandleSet(htcpDataHeader * hdr, char *buf, int sz, struct sockaddr_in *from) +htcpHandleSet(htcpDataHeader * hdr, char *buf, int sz, struct SOCKADDR_IN *from) { debug(31, 3) ("htcpHandleSet: Unimplemented\n"); } static void -htcpHandleData(char *buf, int sz, struct sockaddr_in *from) +htcpHandleData(char *buf, int sz, struct SOCKADDR_IN *from) { htcpDataHeader hdr; assert (sz >= 0); @@ -1004,7 +1004,7 @@ if (hdr.opcode >= HTCP_END) { debug(31, 0) ("htcpHandleData: client %s, opcode %d out of range\n", - inet_ntoa(from->sin_addr), + INET_NTOA(from->sin_addr), (int) hdr.opcode); return; } @@ -1057,7 +1057,7 @@ case HTCP_CLR: debug(31, 1) ("htcpHandleData: client %s, CLR not supported\n", - inet_ntoa(from->sin_addr)); + INET_NTOA(from->sin_addr)); break; default: @@ -1068,7 +1068,7 @@ static void -htcpHandle(char *buf, int sz, struct sockaddr_in *from) +htcpHandle(char *buf, int sz, struct SOCKADDR_IN *from) { htcpHeader htcpHdr; assert (sz >= 0); @@ -1090,7 +1090,7 @@ { debug(31, 1) ("htcpHandle: sz/%d != htcpHdr.length/%d from %s:%d\n", sz, htcpHdr.length, - inet_ntoa(from->sin_addr), (int) ntohs(from->sin_port)); + INET_NTOA(from->sin_addr), (int) ntohs(from->sin_port)); return; } @@ -1105,14 +1105,14 @@ static char buf[8192]; int len; - static struct sockaddr_in from; + static struct SOCKADDR_IN from; - socklen_t flen = sizeof(struct sockaddr_in); + socklen_t flen = sizeof(struct SOCKADDR_IN); memset(&from, '\0', flen); len = comm_udp_recvfrom(fd, buf, 8192, 0, (struct sockaddr *) &from, &flen); debug(31, 3) ("htcpRecv: FD %d, %d bytes from %s:%d\n", - fd, len, inet_ntoa(from.sin_addr), ntohs(from.sin_port)); + fd, len, INET_NTOA(from.sin_addr), ntohs(from.sin_port)); if (len) statCounter.htcp.pkts_recv++; Index: squid3/src/htcp.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/htcp.h,v retrieving revision 1.4 retrieving revision 1.4.8.1 diff -u -r1.4 -r1.4.8.1 --- squid3/src/htcp.h 11 Aug 2003 02:13:03 -0000 1.4 +++ squid3/src/htcp.h 25 Apr 2005 13:39:00 -0000 1.4.8.1 @@ -1,6 +1,6 @@ /* - * $Id: htcp.h,v 1.4 2003/08/11 02:13:03 squidadm Exp $ + * $Id: htcp.h,v 1.4.8.1 2005/04/25 13:39:00 rmartinez Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -60,7 +60,7 @@ typedef class HtcpReplyData htcpReplyData; -SQUIDCEXTERN void neighborsHtcpReply(const cache_key *, htcpReplyData *, const struct sockaddr_in *); +SQUIDCEXTERN void neighborsHtcpReply(const cache_key *, htcpReplyData *, const struct SOCKADDR_IN *); SQUIDCEXTERN void htcpInit(void); SQUIDCEXTERN void htcpQuery(StoreEntry * e, HttpRequest * req, peer * p); SQUIDCEXTERN void htcpSocketShutdown(void); Index: squid3/src/http.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/http.cc,v retrieving revision 1.43.4.2 retrieving revision 1.43.4.3 diff -u -r1.43.4.2 -r1.43.4.3 --- squid3/src/http.cc 19 Apr 2005 10:58:16 -0000 1.43.4.2 +++ squid3/src/http.cc 25 Apr 2005 13:39:13 -0000 1.43.4.3 @@ -1,6 +1,6 @@ /* - * $Id: http.cc,v 1.43.4.2 2005/04/19 10:58:16 rmartinez Exp $ + * $Id: http.cc,v 1.43.4.3 2005/04/25 13:39:13 rmartinez Exp $ * * DEBUG: section 11 Hypertext Transfer Protocol (HTTP) * AUTHOR: Harvest Derived @@ -1311,8 +1311,8 @@ /* append X-Forwarded-For */ strFwd = httpHeaderGetList(hdr_in, HDR_X_FORWARDED_FOR); - if (opt_forwarded_for && orig_request->client_addr.s_addr != no_addr.s_addr) - strListAdd(&strFwd, inet_ntoa(orig_request->client_addr), ','); + if (opt_forwarded_for && !ADDR_IS_NOADDR(orig_request->client_addr)) + strListAdd(&strFwd, INET_NTOA(orig_request->client_addr), ','); else strListAdd(&strFwd, "unknown", ','); @@ -1830,7 +1830,7 @@ if (httpState->reply_hdr_state >= 2 && !httpState->flags.abuse_detected) { httpState->flags.abuse_detected = 1; debug(11, 1) ("httpSendRequestEntryDone: Likely proxy abuse detected '%s' -> '%s'\n", - inet_ntoa(httpState->orig_request->client_addr), + INET_NTOA(httpState->orig_request->client_addr), storeUrl(httpState->entry)); if (httpState->entry->getReply()->sline.status == HTTP_INVALID_HEADER) { Index: squid3/src/icmp.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/icmp.cc,v retrieving revision 1.8.8.1 retrieving revision 1.8.8.2 diff -u -r1.8.8.1 -r1.8.8.2 --- squid3/src/icmp.cc 19 Apr 2005 10:58:16 -0000 1.8.8.1 +++ squid3/src/icmp.cc 25 Apr 2005 13:39:23 -0000 1.8.8.2 @@ -1,6 +1,6 @@ /* - * $Id: icmp.cc,v 1.8.8.1 2005/04/19 10:58:16 rmartinez Exp $ + * $Id: icmp.cc,v 1.8.8.2 2005/04/25 13:39:23 rmartinez Exp $ * * DEBUG: section 37 ICMP Routines * AUTHOR: Duane Wessels @@ -49,7 +49,7 @@ static void icmpSend(pingerEchoData * pkt, int len); #if ALLOW_SOURCE_PING -static void icmpHandleSourcePing(const struct sockaddr_in *from, const char *buf); +static void icmpHandleSourcePing(const struct SOCKADDR_IN *from, const char *buf); #endif static void @@ -81,7 +81,7 @@ static int fail_count = 0; pingerReplyData preply; - static struct sockaddr_in F; + static struct SOCKADDR_IN F; commSetSelect(icmp_sock, COMM_SELECT_READ, icmpRecv, NULL, 0); memset(&preply, '\0', sizeof(pingerReplyData)); n = comm_udp_recv(icmp_sock, @@ -103,11 +103,11 @@ if (n == 0) /* test probe from pinger */ return; - F.sin_family = AF_INET; + FAMILY_FROM_SA(F) = AF_INET; F.sin_addr = preply.from; - F.sin_port = 0; + PORT_FROM_SA(F) = 0; switch (preply.opcode) { @@ -139,7 +139,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); @@ -158,7 +158,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; @@ -167,7 +167,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.1 retrieving revision 1.17.8.2 diff -u -r1.17.8.1 -r1.17.8.2 --- squid3/src/icp_v2.cc 19 Apr 2005 10:58:16 -0000 1.17.8.1 +++ squid3/src/icp_v2.cc 25 Apr 2005 13:39:33 -0000 1.17.8.2 @@ -1,6 +1,6 @@ /* - * $Id: icp_v2.cc,v 1.17.8.1 2005/04/19 10:58:16 rmartinez Exp $ + * $Id: icp_v2.cc,v 1.17.8.2 2005/04/25 13:39:33 rmartinez Exp $ * * DEBUG: section 12 Internet Cache Protocol * AUTHOR: Duane Wessels @@ -44,7 +44,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); /* @@ -252,7 +252,7 @@ int icpUdpSend(int fd, - const struct sockaddr_in *to, + const struct SOCKADDR_IN *to, icp_common_t * msg, log_type logcode, int delay) @@ -265,7 +265,7 @@ fd, icp_opcode_str[msg->opcode], len, - inet_ntoa(to->sin_addr), + INET_NTOA(to->sin_addr), ntohs(to->sin_port)); x = comm_udp_sendto(fd, to, sizeof(*to), msg, len); @@ -364,7 +364,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); @@ -372,10 +372,10 @@ 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", - inet_ntoa(from->sin_addr), AclMatchedName); + INET_NTOA(from->sin_addr), AclMatchedName); if (clientdbCutoffDenied(from->sin_addr)) { @@ -392,7 +392,7 @@ int -icpAccessAllowed(struct sockaddr_in *from, HttpRequest * icp_request) +icpAccessAllowed(struct SOCKADDR_IN *from, HttpRequest * icp_request) { ACLChecklist checklist; checklist.src_addr = from->sin_addr; @@ -415,7 +415,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)) { @@ -435,7 +435,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; @@ -484,12 +484,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", - inet_ntoa(from->sin_addr)); + INET_NTOA(from->sin_addr)); debug(12, 0) ("icpHandleIcpV2: Disabling use of private keys\n"); neighbors_do_private_keys = 0; } @@ -497,7 +497,7 @@ char *url = buf + sizeof(icp_common_t); debug(12, 3) ("icpHandleIcpV2: %s from %s for '%s'\n", icp_opcode_str[opcode], - inet_ntoa(from->sin_addr), + INET_NTOA(from->sin_addr), url); const cache_key *key = icpGetCacheKey(url, (int) reqnum); /* call neighborsUdpAck even if ping_status != PING_WAITING */ @@ -506,7 +506,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) { @@ -556,7 +556,7 @@ default: debug(12, 0) ("icpHandleIcpV2: UNKNOWN OPCODE: %d from %s\n", - header.opcode, inet_ntoa(from.sin_addr)); + header.opcode, INET_NTOA(from.sin_addr)); break; } } @@ -576,7 +576,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)); } @@ -587,7 +587,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); size_t len; @@ -633,7 +633,7 @@ debug(12, 4) ("icpHandleUdp: FD %d: received %lu bytes from %s.\n", sock, (unsigned long int)len, - inet_ntoa(from.sin_addr)); + INET_NTOA(from.sin_addr)); #ifdef ICP_PACKET_DUMP icpPktDump(buf); @@ -653,7 +653,7 @@ else debug(12, 1) ("WARNING: Unused ICP version %d received from %s:%d\n", icp_version, - inet_ntoa(from.sin_addr), + INET_NTOA(from.sin_addr), ntohs(from.sin_port)); } } @@ -665,7 +665,7 @@ struct IN_ADDR addr; - struct sockaddr_in xaddr; + struct SOCKADDR_IN xaddr; int x; socklen_t len; wordlist *s; @@ -697,7 +697,7 @@ 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); if ((addr = Config.Addrs.udp_outgoing).s_addr != no_addr.s_addr) { @@ -731,7 +731,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, Index: squid3/src/icp_v3.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/icp_v3.cc,v retrieving revision 1.5 retrieving revision 1.5.8.1 diff -u -r1.5 -r1.5.8.1 --- squid3/src/icp_v3.cc 11 Aug 2003 02:13:03 -0000 1.5 +++ squid3/src/icp_v3.cc 25 Apr 2005 13:39:43 -0000 1.5.8.1 @@ -1,6 +1,6 @@ /* - * $Id: icp_v3.cc,v 1.5 2003/08/11 02:13:03 squidadm Exp $ + * $Id: icp_v3.cc,v 1.5.8.1 2005/04/25 13:39:43 rmartinez 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, inet_ntoa(from.sin_addr)); + 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 retrieving revision 1.11.8.1 diff -u -r1.11 -r1.11.8.1 --- squid3/src/ident.cc 4 Mar 2003 03:14:45 -0000 1.11 +++ squid3/src/ident.cc 25 Apr 2005 13:40:01 -0000 1.11.8.1 @@ -1,6 +1,6 @@ /* - * $Id: ident.cc,v 1.11 2003/03/04 03:14:45 squidadm Exp $ + * $Id: ident.cc,v 1.11.8.1 2005/04/25 13:40:01 rmartinez Exp $ * * DEBUG: section 30 Ident (RFC 931) * AUTHOR: Duane Wessels @@ -54,9 +54,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]; } @@ -106,7 +106,7 @@ { IdentStateData *state = (IdentStateData *)data; debug(30, 3) ("identTimeout: FD %d, %s\n", fd, - inet_ntoa(state->my_peer.sin_addr)); + INET_NTOA(state->my_peer.sin_addr)); comm_close(fd); } @@ -211,7 +211,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; @@ -219,10 +219,10 @@ char key2[IDENT_KEY_SZ]; char key[IDENT_KEY_SZ]; snprintf(key1, IDENT_KEY_SZ, "%s:%d", - inet_ntoa(me->sin_addr), + INET_NTOA(me->sin_addr), ntohs(me->sin_port)); snprintf(key2, IDENT_KEY_SZ, "%s:%d", - inet_ntoa(my_peer->sin_addr), + INET_NTOA(my_peer->sin_addr), ntohs(my_peer->sin_port)); snprintf(key, IDENT_KEY_SZ, "%s,%s", key1, key2); @@ -259,7 +259,7 @@ state); commSetTimeout(fd, Config.Timeout.ident, identTimeout, state); commConnectStart(fd, - inet_ntoa(state->my_peer.sin_addr), + 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 retrieving revision 1.5.8.1 diff -u -r1.5 -r1.5.8.1 --- squid3/src/internal.cc 2 Sep 2003 02:12:39 -0000 1.5 +++ squid3/src/internal.cc 25 Apr 2005 13:40:11 -0000 1.5.8.1 @@ -1,6 +1,6 @@ /* - * $Id: internal.cc,v 1.5 2003/09/02 02:12:39 squidadm Exp $ + * $Id: internal.cc,v 1.5.8.1 2005/04/25 13:40:11 rmartinez Exp $ * * DEBUG: section 76 Internal Squid Object handling * AUTHOR: Duane, Alex, Henrik @@ -48,7 +48,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); Index: squid3/src/ipc.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ipc.cc,v retrieving revision 1.9 retrieving revision 1.9.4.1 diff -u -r1.9 -r1.9.4.1 --- squid3/src/ipc.cc 8 Nov 2004 03:13:46 -0000 1.9 +++ squid3/src/ipc.cc 25 Apr 2005 13:40:19 -0000 1.9.4.1 @@ -1,6 +1,6 @@ /* - * $Id: ipc.cc,v 1.9 2004/11/08 03:13:46 squidadm Exp $ + * $Id: ipc.cc,v 1.9.4.1 2005/04/25 13:40:19 rmartinez Exp $ * * DEBUG: section 54 Interprocess Communication * AUTHOR: Duane Wessels @@ -78,9 +78,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; @@ -203,7 +203,7 @@ } debug(54, 3) ("ipcCreate: FD %d sockaddr %s:%d\n", - pwfd, inet_ntoa(PaS.sin_addr), ntohs(PaS.sin_port)); + pwfd, INET_NTOA(PaS.sin_addr), ntohs(PaS.sin_port)); len = sizeof(ChS); memset(&ChS, '\0', len); @@ -213,7 +213,7 @@ } debug(54, 3) ("ipcCreate: FD %d sockaddr %s:%d\n", - crfd, inet_ntoa(ChS.sin_addr), ntohs(ChS.sin_port)); + 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.4 retrieving revision 1.9.2.5 diff -u -r1.9.2.4 -r1.9.2.5 --- squid3/src/ipcache.cc 19 Apr 2005 10:58:16 -0000 1.9.2.4 +++ squid3/src/ipcache.cc 25 Apr 2005 13:40:33 -0000 1.9.2.5 @@ -1,6 +1,6 @@ /* - * $Id: ipcache.cc,v 1.9.2.4 2005/04/19 10:58:16 rmartinez Exp $ + * $Id: ipcache.cc,v 1.9.2.5 2005/04/25 13:40:33 rmartinez Exp $ * * DEBUG: section 14 IP Cache * AUTHOR: Harvest Derived @@ -437,7 +437,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])); } assert(j == na); @@ -639,7 +639,7 @@ (int) i->addrs.badcount); for (k = 0; k < (int) i->addrs.count; k++) { - storeAppendPrintf(sentry, " %15s-%3s", inet_ntoa(i->addrs.in_addrs[k]), + storeAppendPrintf(sentry, " %15s-%3s", INET_NTOA(i->addrs.in_addrs[k]), i->addrs.bad_mask[k] ? "BAD" : "OK "); } @@ -796,7 +796,7 @@ } debug(14, 3) ("ipcacheCycleAddr: %s now at %s\n", name, - inet_ntoa(ia->in_addrs[ia->cur])); + INET_NTOA(ia->in_addrs[ia->cur])); } /* @@ -830,7 +830,7 @@ ia->bad_mask[k] = TRUE; ia->badcount++; i->expires = XMIN(squid_curtime + XMAX((time_t)60, Config.negativeDnsTtl), i->expires); - debug(14, 2) ("ipcacheMarkBadAddr: %s [%s]\n", name, inet_ntoa(addr)); + debug(14, 2) ("ipcacheMarkBadAddr: %s [%s]\n", name, INET_NTOA(addr)); } ipcacheCycleAddr(name, ia); @@ -865,7 +865,7 @@ ia->badcount--; - debug(14, 2) ("ipcacheMarkGoodAddr: %s [%s]\n", name, inet_ntoa(addr)); + debug(14, 2) ("ipcacheMarkGoodAddr: %s [%s]\n", name, INET_NTOA(addr)); } static void Index: squid3/src/main.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/main.cc,v retrieving revision 1.42.4.1 retrieving revision 1.42.4.2 diff -u -r1.42.4.1 -r1.42.4.2 --- squid3/src/main.cc 19 Apr 2005 10:58:17 -0000 1.42.4.1 +++ squid3/src/main.cc 25 Apr 2005 13:40:42 -0000 1.42.4.2 @@ -1,6 +1,6 @@ /* - * $Id: main.cc,v 1.42.4.1 2005/04/19 10:58:17 rmartinez Exp $ + * $Id: main.cc,v 1.42.4.2 2005/04/25 13:40:42 rmartinez Exp $ * * DEBUG: section 1 Startup and Main Loop * AUTHOR: Harvest Derived @@ -931,17 +931,21 @@ if (oldmask) umask(oldmask); +#ifdef INET6 + memset(&local_addr, '\0', sizeof(struct IN_ADDR)); + safe_inet6_addr(localhost, &local_addr); + memset(&any_addr, '\0', sizeof(struct IN_ADDR)); + safe_inet6_addr("::", &any_addr); + memset(&no_addr, '\0', sizeof(struct IN_ADDR)); + memset(&no_addr, '\xFF', sizeof(no_addr)); +#else memset(&local_addr, '\0', sizeof(struct IN_ADDR)); - safe_inet_addr(localhost, &local_addr); - memset(&any_addr, '\0', sizeof(struct IN_ADDR)); - safe_inet_addr("0.0.0.0", &any_addr); - memset(&no_addr, '\0', sizeof(struct IN_ADDR)); - safe_inet_addr("255.255.255.255", &no_addr); +#endif squid_srandom(time(NULL)); Index: squid3/src/multicast.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/multicast.cc,v retrieving revision 1.2 retrieving revision 1.2.10.1 diff -u -r1.2 -r1.2.10.1 --- squid3/src/multicast.cc 22 Feb 2003 03:14:34 -0000 1.2 +++ squid3/src/multicast.cc 25 Apr 2005 13:40:53 -0000 1.2.10.1 @@ -1,6 +1,6 @@ /* - * $Id: multicast.cc,v 1.2 2003/02/22 03:14:34 squidadm Exp $ + * $Id: multicast.cc,v 1.2.10.1 2005/04/25 13:40:53 rmartinez Exp $ * * DEBUG: section 7 Multicast * AUTHOR: Martin Hamilton @@ -68,7 +68,7 @@ for (i = 0; i < (int) ia->count; i++) { debug(7, 10) ("Listening for ICP requests on %s\n", - inet_ntoa(*(ia->in_addrs + i))); + INET_NTOA(*(ia->in_addrs + i))); mr.imr_multiaddr.s_addr = (ia->in_addrs + i)->s_addr; mr.imr_interface.s_addr = INADDR_ANY; x = setsockopt(fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, @@ -77,7 +77,7 @@ if (x < 0) debug(7, 1) ("comm_join_mcast_groups: FD %d, [%s]\n", - fd, inet_ntoa(*(ia->in_addrs + i))); + fd, INET_NTOA(*(ia->in_addrs + i))); x = setsockopt(fd, IPPROTO_IP, IP_MULTICAST_LOOP, &c, 1); Index: squid3/src/neighbors.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/neighbors.cc,v retrieving revision 1.23.4.2 retrieving revision 1.23.4.3 diff -u -r1.23.4.2 -r1.23.4.3 --- squid3/src/neighbors.cc 19 Apr 2005 10:58:17 -0000 1.23.4.2 +++ squid3/src/neighbors.cc 25 Apr 2005 13:41:05 -0000 1.23.4.3 @@ -1,6 +1,6 @@ /* - * $Id: neighbors.cc,v 1.23.4.2 2005/04/19 10:58:17 rmartinez Exp $ + * $Id: neighbors.cc,v 1.23.4.3 2005/04/25 13:41:05 rmartinez Exp $ * * DEBUG: section 15 Neighbor Routines * AUTHOR: Harvest Derived @@ -62,7 +62,7 @@ static void peerCountMcastPeersSchedule(peer * p, time_t when); static IRCB peerCountHandleIcpReply; -static void neighborIgnoreNonPeer(const struct sockaddr_in *, icp_opcode); +static void neighborIgnoreNonPeer(const struct SOCKADDR_IN *, icp_opcode); static OBJH neighborDumpPeers; static OBJH neighborDumpNonPeers; static void dump_peers(StoreEntry * sentry, peer * peers); @@ -91,14 +91,14 @@ peer * -whichPeer(const struct sockaddr_in * from) +whichPeer(const struct SOCKADDR_IN * from) { int j; u_short port = ntohs(from->sin_port); struct IN_ADDR ip = from->sin_addr; peer *p = NULL; - debug(15, 3) ("whichPeer: from %s port %d\n", inet_ntoa(ip), port); + debug(15, 3) ("whichPeer: from %s port %d\n", INET_NTOA(ip), port); for (p = Config.peers; p; p = p->next) { @@ -515,9 +515,9 @@ neighbors_init(void) { - struct sockaddr_in name; + struct SOCKADDR_IN name; - socklen_t len = sizeof(struct sockaddr_in); + socklen_t len = sizeof(struct SOCKADDR_IN); struct servent *sep = NULL; const char *me = getMyHostname(); @@ -527,7 +527,7 @@ if (fd >= 0) { - memset(&name, '\0', sizeof(struct sockaddr_in)); + memset(&name, '\0', sizeof(struct SOCKADDR_IN)); if (getsockname(fd, (struct sockaddr *) &name, &len) < 0) debug(15, 1) ("getsockname(%d,%p,%p) failed.\n", fd, &name, &len); @@ -717,7 +717,7 @@ if (Config.npeers) { const ipcache_addrs *ia = NULL; - struct sockaddr_in to_addr; + struct SOCKADDR_IN to_addr; char *host = request->host; if (!Config.onoff.source_ping) { @@ -730,9 +730,9 @@ if (icmp_sock != -1) { icmpSourcePing(ia->in_addrs[ia->cur], &echo_hdr, url); } else { - to_addr.sin_family = AF_INET; + FAMILY_FROM_SA(to_addr) = AF_INET; to_addr.sin_addr = ia->in_addrs[ia->cur]; - to_addr.sin_port = htons(echo_port); + PORT_FROM_SA(to_addr) = htons(echo_port); query = _icp_common_t::createMessage(ICP_SECHO, 0, url, reqnum, 0); icpUdpSend(theOutIcpConnection, &to_addr, @@ -986,7 +986,7 @@ static void -neighborIgnoreNonPeer(const struct sockaddr_in *from, icp_opcode opcode) +neighborIgnoreNonPeer(const struct SOCKADDR_IN *from, icp_opcode opcode) { peer *np; @@ -995,7 +995,7 @@ if (np->in_addr.sin_addr.s_addr != from->sin_addr.s_addr) continue; - if (np->in_addr.sin_port != from->sin_port) + PORT_FROM_SA(if (np->in_addr) != from->sin_port) continue; break; @@ -1005,10 +1005,10 @@ { np = (peer *)xcalloc(1, sizeof(peer)); np->in_addr.sin_addr = from->sin_addr; - np->in_addr.sin_port = from->sin_port; + PORT_FROM_SA(np->in_addr) = from->sin_port; np->icp.port = ntohl(from->sin_port); np->type = PEER_NONE; - np->host = xstrdup(inet_ntoa(from->sin_addr)); + np->host = xstrdup(INET_NTOA(from->sin_addr)); np->next = non_peers; non_peers = np; } @@ -1049,7 +1049,7 @@ */ void -neighborsUdpAck(const cache_key * key, icp_common_t * header, const struct sockaddr_in *from) +neighborsUdpAck(const cache_key * key, icp_common_t * header, const struct SOCKADDR_IN *from) { peer *p = NULL; StoreEntry *entry; @@ -1165,7 +1165,7 @@ #endif } else { - debug(15, 1) ("Unsolicited SECHO from %s\n", inet_ntoa(from->sin_addr)); + debug(15, 1) ("Unsolicited SECHO from %s\n", INET_NTOA(from->sin_addr)); } } else if (opcode == ICP_DENIED) { @@ -1286,7 +1286,7 @@ { peer *p = (peer *)data; - struct sockaddr_in *ap; + struct SOCKADDR_IN *ap; int j; if (p->n_addresses == 0) { @@ -1311,14 +1311,14 @@ for (j = 0; j < (int) ia->count && j < PEER_MAX_ADDRESSES; j++) { p->addresses[j] = ia->in_addrs[j]; - debug(15, 2) ("--> IP address #%d: %s\n", j, inet_ntoa(p->addresses[j])); + debug(15, 2) ("--> IP address #%d: %s\n", j, INET_NTOA(p->addresses[j])); p->n_addresses++; } ap = &p->in_addr; - memset(ap, '\0', sizeof(struct sockaddr_in)); - ap->sin_family = AF_INET; + memset(ap, '\0', sizeof(struct SOCKADDR_IN)); + FAMILY_FROM_SA(*ap)=AF_INET; ap->sin_addr = p->addresses[0]; ap->sin_port = htons(p->icp.port); @@ -1479,7 +1479,7 @@ LOCAL_ARRAY(char, url, MAX_URL); assert(p->type == PEER_MULTICAST); p->mcast.flags.count_event_pending = 0; - snprintf(url, MAX_URL, "http://%s/", inet_ntoa(p->in_addr.sin_addr)); + snprintf(url, MAX_URL, "http://%s/", INET_NTOA(p->in_addr.sin_addr)); fake = storeCreateEntry(url, url, request_flags(), METHOD_GET); psstate = new ps_state; psstate->request = requestLink(urlParse(METHOD_GET, url)); @@ -1676,7 +1676,7 @@ for (i = 0; i < e->n_addresses; i++) { storeAppendPrintf(sentry, "Address[%d] : %s\n", i, - inet_ntoa(e->addresses[i])); + INET_NTOA(e->addresses[i])); } storeAppendPrintf(sentry, "Status : %s\n", @@ -1762,7 +1762,7 @@ #if USE_HTCP void -neighborsHtcpReply(const cache_key * key, htcpReplyData * htcp, const struct sockaddr_in *from) +neighborsHtcpReply(const cache_key * key, htcpReplyData * htcp, const struct SOCKADDR_IN *from) { StoreEntry *e = Store::Root().get(key); MemObject *mem = NULL; Index: squid3/src/net_db.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/net_db.cc,v retrieving revision 1.13.4.1 retrieving revision 1.13.4.2 diff -u -r1.13.4.1 -r1.13.4.2 --- squid3/src/net_db.cc 19 Apr 2005 10:58:17 -0000 1.13.4.1 +++ squid3/src/net_db.cc 25 Apr 2005 13:41:31 -0000 1.13.4.2 @@ -1,6 +1,6 @@ /* - * $Id: net_db.cc,v 1.13.4.1 2005/04/19 10:58:17 rmartinez Exp $ + * $Id: net_db.cc,v 1.13.4.2 2005/04/25 13:41:31 rmartinez Exp $ * * DEBUG: section 38 Network Measurement Database * AUTHOR: Duane Wessels @@ -110,7 +110,7 @@ netdbHashInsert(netdbEntry * n, struct IN_ADDR addr) { - xstrncpy(n->network, inet_ntoa(networkFromInaddr(addr)), 16); + xstrncpy(n->network, INET_NTOA(networkFromInaddr(addr)), 16); n->hash.key = n->network; assert(hash_lookup(addr_table, n->network) == NULL); hash_join(addr_table, &n->hash); @@ -248,7 +248,7 @@ netdbLookupAddr(struct IN_ADDR addr) { netdbEntry *n; - char *key = inet_ntoa(networkFromInaddr(addr)); + char *key = INET_NTOA(networkFromInaddr(addr)); n = (netdbEntry *) hash_lookup(addr_table, key); return n; } @@ -927,12 +927,12 @@ void -netdbHandlePingReply(const struct sockaddr_in *from, int hops, int rtt) +netdbHandlePingReply(const struct SOCKADDR_IN *from, int hops, int rtt) { #if USE_ICMP netdbEntry *n; int N; - debug(38, 3) ("netdbHandlePingReply: from %s\n", inet_ntoa(from->sin_addr)); + debug(38, 3) ("netdbHandlePingReply: from %s\n", INET_NTOA(from->sin_addr)); if ((n = netdbLookupAddr(from->sin_addr)) == NULL) return; @@ -1149,7 +1149,7 @@ netdbEntry *n; net_db_peer *p; debug(38, 5) ("netdbExchangeUpdatePeer: '%s', %0.1f hops, %0.1f rtt\n", - inet_ntoa(addr), hops, rtt); + INET_NTOA(addr), hops, rtt); n = netdbLookupAddr(addr); if (n == NULL) Index: squid3/src/peer_select.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/peer_select.cc,v retrieving revision 1.9.4.1 retrieving revision 1.9.4.2 diff -u -r1.9.4.1 -r1.9.4.2 --- squid3/src/peer_select.cc 19 Apr 2005 10:58:18 -0000 1.9.4.1 +++ squid3/src/peer_select.cc 25 Apr 2005 13:41:46 -0000 1.9.4.2 @@ -1,6 +1,6 @@ /* - * $Id: peer_select.cc,v 1.9.4.1 2005/04/19 10:58:18 rmartinez Exp $ + * $Id: peer_select.cc,v 1.9.4.2 2005/04/25 13:41:46 rmartinez Exp $ * * DEBUG: section 44 Peer Selection Algorithm * AUTHOR: Duane Wessels @@ -466,7 +466,7 @@ code = SOURCE_FASTEST; } else #endif - if (ps->closest_parent_miss.sin_addr.s_addr != any_addr.s_addr) { + if (!ADDR_IS_ANYADDR(ps->closest_parent_miss.sin_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) { Index: squid3/src/pinger.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/pinger.cc,v retrieving revision 1.9.8.1 retrieving revision 1.9.8.2 diff -u -r1.9.8.1 -r1.9.8.2 --- squid3/src/pinger.cc 19 Apr 2005 10:58:18 -0000 1.9.8.1 +++ squid3/src/pinger.cc 25 Apr 2005 13:41:55 -0000 1.9.8.2 @@ -1,6 +1,6 @@ /* - * $Id: pinger.cc,v 1.9.8.1 2005/04/19 10:58:18 rmartinez Exp $ + * $Id: pinger.cc,v 1.9.8.2 2005/04/25 13:41:55 rmartinez Exp $ * * DEBUG: section 42 ICMP Pinger program * AUTHOR: Duane Wessels @@ -218,7 +218,7 @@ char buf[sizeof(wpi)]; int x; - struct sockaddr_in PS; + struct SOCKADDR_IN PS; WSAStartup(2, &wsaData); @@ -333,7 +333,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; @@ -370,12 +370,12 @@ } icmp->icmp_cksum = in_cksum((u_short *) icmp, icmp_pktsize); - S.sin_family = AF_INET; + FAMILY_FROM_SA(S) = AF_INET; /* * cevans: alert: trusting to-host, was supplied in network packet */ S.sin_addr = to; - S.sin_port = 0; + PORT_FROM_SA(S) = 0; assert(icmp_pktsize <= MAX_PKT_SZ); sendto(icmp_sock, pkt, @@ -384,7 +384,7 @@ (struct sockaddr *) &S, - sizeof(struct sockaddr_in)); + sizeof(struct SOCKADDR_IN)); pingerLog(icmp, to, 0, 0); } @@ -394,7 +394,7 @@ int n; socklen_t fromlen; - struct sockaddr_in from; + struct SOCKADDR_IN from; int iphdrlen = 20; struct iphdr *ip = NULL; @@ -429,7 +429,7 @@ #endif - debug(42, 9) ("pingerRecv: %d bytes from %s\n", n, inet_ntoa(from.sin_addr)); + debug(42, 9) ("pingerRecv: %d bytes from %s\n", n, INET_NTOA(from.sin_addr)); ip = (struct iphdr *) (void *) pkt; @@ -507,7 +507,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/protos.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/protos.h,v retrieving revision 1.48.4.4 retrieving revision 1.48.4.5 diff -u -r1.48.4.4 -r1.48.4.5 --- squid3/src/protos.h 19 Apr 2005 10:58:18 -0000 1.48.4.4 +++ squid3/src/protos.h 25 Apr 2005 13:42:20 -0000 1.48.4.5 @@ -1,6 +1,6 @@ /* - * $Id: protos.h,v 1.48.4.4 2005/04/19 10:58:18 rmartinez Exp $ + * $Id: protos.h,v 1.48.4.5 2005/04/25 13:42:20 rmartinez Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -127,7 +127,7 @@ #endif SQUIDCEXTERN void commConnectStart(int fd, const char *, u_short, CNCB *, void *); -SQUIDCEXTERN int comm_connect_addr(int sock, const struct sockaddr_in *); +SQUIDCEXTERN int comm_connect_addr(int sock, const struct SOCKADDR_IN *); SQUIDCEXTERN void comm_init(void); SQUIDCEXTERN int comm_open(int, int, struct IN_ADDR, u_short port, int, const char *note); @@ -137,7 +137,7 @@ SQUIDCEXTERN void commSetSelect(int, unsigned int, PF *, void *, time_t); -SQUIDCEXTERN int comm_udp_sendto(int, const struct sockaddr_in *, int, const void *, int); +SQUIDCEXTERN int comm_udp_sendto(int, const struct SOCKADDR_IN *, int, const void *, int); SQUIDCEXTERN void comm_old_write(int fd, const char *buf, int size, @@ -258,19 +258,9 @@ SQUIDCEXTERN void filemapFreeMemory(fileMap *); -<<<<<<< protos.h -#if ENABLE_IPV6 -SQUIDCEXTERN void fqdncache_nbgethostbyaddr(struct inaddr_storage * addr6, FQDNH *, void *); -SQUIDCEXTERN const char *fqdncache_gethostbyaddr(struct inaddr_storage * addr6, int flags); -#else -SQUIDCEXTERN void fqdncache_nbgethostbyaddr(struct in_addr, FQDNH *, void *); -SQUIDCEXTERN const char *fqdncache_gethostbyaddr(struct in_addr, int flags); -#endif -======= SQUIDCEXTERN void fqdncache_nbgethostbyaddr(struct IN_ADDR, FQDNH *, void *); SQUIDCEXTERN const char *fqdncache_gethostbyaddr(struct IN_ADDR, int flags); ->>>>>>> 1.52 SQUIDCEXTERN void fqdncache_init(void); SQUIDCEXTERN void fqdnStats(StoreEntry *); SQUIDCEXTERN void fqdncacheReleaseInvalid(const char *); @@ -543,7 +533,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); SQUIDCEXTERN peer *peerFindByName(const char *); @@ -566,11 +556,11 @@ 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); -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 *); @@ -645,7 +635,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 retrieving revision 1.2.10.1 diff -u -r1.2 -r1.2.10.1 --- squid3/src/recv-announce.cc 22 Feb 2003 03:14:35 -0000 1.2 +++ squid3/src/recv-announce.cc 25 Apr 2005 13:42:29 -0000 1.2.10.1 @@ -1,6 +1,6 @@ /* - * $Id: recv-announce.cc,v 1.2 2003/02/22 03:14:35 squidadm Exp $ + * $Id: recv-announce.cc,v 1.2.10.1 2005/04/25 13:42:29 rmartinez 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.1 retrieving revision 1.15.4.2 diff -u -r1.15.4.1 -r1.15.4.2 --- squid3/src/redirect.cc 19 Apr 2005 10:58:18 -0000 1.15.4.1 +++ squid3/src/redirect.cc 25 Apr 2005 13:42:41 -0000 1.15.4.2 @@ -1,6 +1,6 @@ /* - * $Id: redirect.cc,v 1.15.4.1 2005/04/19 10:58:18 rmartinez Exp $ + * $Id: redirect.cc,v 1.15.4.2 2005/04/25 13:42:41 rmartinez Exp $ * * DEBUG: section 61 Redirector * AUTHOR: Duane Wessels @@ -142,7 +142,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/send-announce.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/send-announce.cc,v retrieving revision 1.3 retrieving revision 1.3.10.1 diff -u -r1.3 -r1.3.10.1 --- squid3/src/send-announce.cc 22 Feb 2003 03:14:35 -0000 1.3 +++ squid3/src/send-announce.cc 25 Apr 2005 13:43:01 -0000 1.3.10.1 @@ -1,6 +1,6 @@ /* - * $Id: send-announce.cc,v 1.3 2003/02/22 03:14:35 squidadm Exp $ + * $Id: send-announce.cc,v 1.3.10.1 2005/04/25 13:43:01 rmartinez Exp $ * * DEBUG: section 27 Cache Announcer * AUTHOR: Duane Wessels @@ -58,7 +58,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; @@ -108,8 +108,8 @@ } memset(&S, '\0', sizeof(S)); - S.sin_family = AF_INET; - S.sin_port = htons(port); + FAMILY_FROM_SA(S) = AF_INET; + PORT_FROM_SA(S) = htons(port); S.sin_addr = ia->in_addrs[0]; assert(theOutIcpConnection > 0); x = comm_udp_sendto(theOutIcpConnection, Index: squid3/src/snmp_core.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/snmp_core.cc,v retrieving revision 1.10.8.1 retrieving revision 1.10.8.2 diff -u -r1.10.8.1 -r1.10.8.2 --- squid3/src/snmp_core.cc 19 Apr 2005 10:58:18 -0000 1.10.8.1 +++ squid3/src/snmp_core.cc 25 Apr 2005 13:43:14 -0000 1.10.8.2 @@ -1,6 +1,6 @@ /* - * $Id: snmp_core.cc,v 1.10.8.1 2005/04/19 10:58:18 rmartinez Exp $ + * $Id: snmp_core.cc,v 1.10.8.2 2005/04/25 13:43:14 rmartinez Exp $ * * DEBUG: section 49 SNMP support * AUTHOR: Glenn Chisholm @@ -354,7 +354,7 @@ { u_short port; - struct sockaddr_in xaddr; + struct SOCKADDR_IN xaddr; socklen_t len; int x; @@ -408,7 +408,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, @@ -474,7 +474,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; @@ -483,7 +483,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); @@ -500,7 +500,7 @@ debug(49, 3) ("snmpHandleUdp: FD %d: received %d bytes from %s.\n", sock, len, - inet_ntoa(from.sin_addr)); + INET_NTOA(from.sin_addr)); snmp_rq = (snmp_request_t *)xcalloc(1, sizeof(snmp_request_t)); snmp_rq->buf = (u_char *) buf; @@ -508,7 +508,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); @@ -554,7 +554,7 @@ snmpConstructReponse(rq); } else { debug(49, 1) ("Failed SNMP agent query from : %s.\n", - inet_ntoa(rq->from.sin_addr)); + INET_NTOA(rq->from.sin_addr)); snmp_free_pdu(PDU); } @@ -875,15 +875,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 = inet_ntoa(peers->in_addr.sin_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 = inet_ntoa(peers->in_addr.sin_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 retrieving revision 1.24.4.1 diff -u -r1.24 -r1.24.4.1 --- squid3/src/stat.cc 4 Jan 2005 03:13:39 -0000 1.24 +++ squid3/src/stat.cc 25 Apr 2005 13:43:24 -0000 1.24.4.1 @@ -1,5 +1,5 @@ /* - * $Id: stat.cc,v 1.24 2005/01/04 03:13:39 squidadm Exp $ + * $Id: stat.cc,v 1.24.4.1 2005/04/25 13:43:24 rmartinez Exp $ * * DEBUG: section 18 Cache Manager Statistics * AUTHOR: Harvest Derived @@ -1611,10 +1611,10 @@ 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", - inet_ntoa(conn->peer.sin_addr), + INET_NTOA(conn->peer.sin_addr), ntohs(conn->peer.sin_port)); storeAppendPrintf(s, "\tme: %s:%d\n", - inet_ntoa(conn->me.sin_addr), + INET_NTOA(conn->me.sin_addr), ntohs(conn->me.sin_port)); storeAppendPrintf(s, "\tnrequests: %d\n", conn->nrequests); Index: squid3/src/structs.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/structs.h,v retrieving revision 1.66.2.6 retrieving revision 1.66.2.7 diff -u -r1.66.2.6 -r1.66.2.7 --- squid3/src/structs.h 19 Apr 2005 10:58:19 -0000 1.66.2.6 +++ squid3/src/structs.h 25 Apr 2005 13:43:40 -0000 1.66.2.7 @@ -1,6 +1,6 @@ /* - * $Id: structs.h,v 1.66.2.6 2005/04/19 10:58:19 rmartinez Exp $ + * $Id: structs.h,v 1.66.2.7 2005/04/25 13:43:40 rmartinez Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -103,7 +103,7 @@ long reqid; int outlen; - struct sockaddr_in from; + struct SOCKADDR_IN from; struct snmp_pdu *PDU; ACLChecklist *acl_checklist; @@ -118,15 +118,7 @@ acl_address *next; acl_list *aclList; -<<<<<<< structs.h -#if ENABLE_IPV6 - struct inaddr_storage addr6; -#else - struct in_addr addr; -#endif -======= struct IN_ADDR addr; ->>>>>>> 1.74 }; struct _acl_tos @@ -164,11 +156,8 @@ struct _sockaddr_in_list { -#if ENABLE_IPV6 - struct sockaddr_storage sockaddr; -#else - struct sockaddr_in s; -#endif + + struct SOCKADDR_IN s; sockaddr_in_list *next; }; @@ -176,11 +165,7 @@ { http_port_list *next; -#if ENABLE_IPV6 - struct sockaddr_storage sockaddr; -#else - struct sockaddr_in s; -#endif + struct SOCKADDR_IN s; char *protocol; /* protocol name */ char *name; /* visible name */ char *defaultsite; /* default web site */ @@ -356,27 +341,11 @@ struct { -<<<<<<< structs.h -#if ENABLE_IPV6 - struct inaddr_storage router6; - - struct inaddr_storage incoming6; - - struct inaddr_storage outgoing6; -#else - struct in_addr router; -======= struct IN_ADDR router; ->>>>>>> 1.74 struct IN_ADDR incoming; -<<<<<<< structs.h - struct in_addr outgoing; -#endif -======= struct IN_ADDR outgoing; ->>>>>>> 1.74 int version; } @@ -484,24 +453,7 @@ struct { -<<<<<<< structs.h -#if ENABLE_IPV6 - struct inaddr_storage udp_incoming6; - - struct inaddr_storage udp_outgoing6; -#if SQUID_SNMP - - struct inaddr_storage snmp_incoming6; - - struct inaddr_storage snmp_outgoing6; -#endif - - struct inaddr_storage client_netmask6; -#else - struct in_addr udp_incoming; -======= struct IN_ADDR udp_incoming; ->>>>>>> 1.74 struct IN_ADDR udp_outgoing; #if SQUID_SNMP @@ -511,12 +463,7 @@ struct IN_ADDR snmp_outgoing; #endif -<<<<<<< structs.h - struct in_addr client_netmask; -#endif -======= struct IN_ADDR client_netmask; ->>>>>>> 1.74 } Addrs; @@ -735,18 +682,9 @@ struct { -<<<<<<< structs.h -#if ENABLE_IPV6 - struct sockaddr_storage sockaddr; - int ttl; -#else - struct in_addr addr; -======= struct IN_ADDR addr; ->>>>>>> 1.74 int ttl; unsigned short port; -#endif char *encode_key; } @@ -1046,15 +984,7 @@ struct _ipcache_addrs { -<<<<<<< structs.h -#if ENABLE_IPV6 - struct inaddr_storage *in_addr6s; -#else - struct in_addr *in_addrs; -#endif -======= struct IN_ADDR *in_addrs; ->>>>>>> 1.74 unsigned char *bad_mask; unsigned char count; unsigned char cur; @@ -1206,11 +1136,7 @@ char *host; peer_t type; -#if ENABLE_IPV6 - struct sockaddr_storage in_addr6; -#else - struct sockaddr_in in_addr; -#endif + struct SOCKADDR_IN in_addr; struct { @@ -1346,15 +1272,7 @@ int tcp_up; /* 0 if a connect() fails */ -<<<<<<< structs.h -#if ENABLE_IPV6 - struct inaddr_storage address6es[10]; -#else - struct in_addr addresses[10]; -#endif -======= struct IN_ADDR addresses[10]; ->>>>>>> 1.74 int n_addresses; int rr_count; int rr_lastcount; @@ -1434,15 +1352,7 @@ struct _pingerEchoData { -<<<<<<< structs.h -#if ENABLE_IPV6 - struct inaddr_storage to6; -#else - struct in_addr to; -#endif -======= struct IN_ADDR to; ->>>>>>> 1.74 unsigned char opcode; int psize; char payload[PINGER_PAYLOAD_SZ]; @@ -1451,15 +1361,7 @@ struct _pingerReplyData { -<<<<<<< structs.h -#if ENABLE_IPV6 - struct inaddr_storage from6; -#else - struct in_addr from; -#endif -======= struct IN_ADDR from; ->>>>>>> 1.74 unsigned char opcode; int rtt; int hops; @@ -1693,15 +1595,7 @@ char *dnsserver_msg; time_t ttl; -<<<<<<< structs.h -#if ENABLE_IPV6 - struct inaddr_storage src_addr6; -#else - struct in_addr src_addr; -#endif -======= struct IN_ADDR src_addr; ->>>>>>> 1.74 char *redirect_url; ERCB *callback; void *callback_data; @@ -1947,15 +1841,7 @@ { hash_link hash; /* must be first */ -<<<<<<< structs.h -#if ENABLE_IPV6 - struct inaddr_storage addr6; -#else - struct in_addr addr; -#endif -======= struct IN_ADDR addr; ->>>>>>> 1.74 struct { Index: squid3/src/tools.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/tools.cc,v retrieving revision 1.22.2.1 retrieving revision 1.22.2.2 diff -u -r1.22.2.1 -r1.22.2.2 --- squid3/src/tools.cc 19 Apr 2005 10:58:20 -0000 1.22.2.1 +++ squid3/src/tools.cc 25 Apr 2005 13:43:51 -0000 1.22.2.2 @@ -1,6 +1,6 @@ /* - * $Id: tools.cc,v 1.22.2.1 2005/04/19 10:58:20 rmartinez Exp $ + * $Id: tools.cc,v 1.22.2.2 2005/04/25 13:43:51 rmartinez Exp $ * * DEBUG: section 21 Misc Functions * AUTHOR: Harvest Derived @@ -590,7 +590,7 @@ /* use the official name from DNS lookup */ xstrncpy(host, h->h_name, SQUIDHOSTNAMELEN); debug(50, 4) ("getMyHostname: resolved %s to '%s'\n", - inet_ntoa(sa), + INET_NTOA(sa), host); present = 1; @@ -600,7 +600,7 @@ } debug(50, 1) ("WARNING: failed to resolve %s to a fully qualified hostname\n", - inet_ntoa(sa)); + INET_NTOA(sa)); } /* Index: squid3/src/wccp.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/wccp.cc,v retrieving revision 1.10.2.1 retrieving revision 1.10.2.2 diff -u -r1.10.2.1 -r1.10.2.2 --- squid3/src/wccp.cc 19 Apr 2005 10:58:20 -0000 1.10.2.1 +++ squid3/src/wccp.cc 25 Apr 2005 13:44:03 -0000 1.10.2.2 @@ -1,6 +1,6 @@ /* - * $Id: wccp.cc,v 1.10.2.1 2005/04/19 10:58:20 rmartinez Exp $ + * $Id: wccp.cc,v 1.10.2.2 2005/04/25 13:44:03 rmartinez Exp $ * * DEBUG: section 80 WCCP Support * AUTHOR: Glenn Chisholm @@ -134,7 +134,7 @@ { u_short port = WCCP_PORT; - struct sockaddr_in router, local; + struct SOCKADDR_IN router, local; socklen_t local_len, router_len; debug(80, 5) ("wccpConnectionOpen: Called\n"); @@ -190,8 +190,8 @@ router_len = sizeof(router); memset(&router, '\0', router_len); - router.sin_family = AF_INET; - router.sin_port = htons(port); + FAMILY_FROM_SA(router) = AF_INET; + PORT_FROM_SA(router) = htons(port); router.sin_addr = Config.Wccp.router; if (connect(theOutWccpConnection, (struct sockaddr *) &router, router_len)) @@ -245,7 +245,7 @@ wccpHandleUdp(int sock, void *not_used) { - struct sockaddr_in from; + struct SOCKADDR_IN from; socklen_t from_len; int len; @@ -253,7 +253,7 @@ commSetSelect(sock, COMM_SELECT_READ, wccpHandleUdp, NULL, 0); - from_len = sizeof(struct sockaddr_in); + from_len = sizeof(struct SOCKADDR_IN); memset(&from, '\0', from_len); memset(&wccp_i_see_you, '\0', sizeof(wccp_i_see_you)); @@ -266,7 +266,7 @@ &from_len); debug(80, 3) ("wccpHandleUdp: %d bytes WCCP pkt from %s: type=%u, version=%u, change=%u, id=%u, number=%u\n", len, - inet_ntoa(from.sin_addr), + INET_NTOA(from.sin_addr), (unsigned) ntohl(wccp_i_see_you.type), (unsigned) ntohl(wccp_i_see_you.version), (unsigned) ntohl(wccp_i_see_you.change), @@ -287,7 +287,7 @@ if (ntohl(wccp_i_see_you.number) > WCCP_ACTIVE_CACHES || ntohl(wccp_i_see_you.number) < 0) { debug(80, 1) ("Ignoring WCCP_I_SEE_YOU from %s with number of caches set to %d\n", - inet_ntoa(from.sin_addr), (int) ntohl(wccp_i_see_you.number)); + INET_NTOA(from.sin_addr), (int) ntohl(wccp_i_see_you.number)); return; }