--------------------- PatchSet 1340 Date: 2005/05/05 09:18:28 Author: rmartinez Branch: squid3-ipv6 Tag: (none) Log: Last massive patch before tunning. Version compilable Members: lib/rfc1035.c:1.5.2.1->1.5.2.2 src/cache_cf.cc:1.40.2.3->1.40.2.4 src/cachemgr.cc:1.8.4.5->1.8.4.6 src/client.cc:1.10.4.1->1.10.4.2 src/client_side.cc:1.68.2.3->1.68.2.4 src/client_side_reply.cc:1.57.4.3->1.57.4.4 src/client_side_request.cc:1.33.4.1->1.33.4.2 src/comm.cc:1.47.2.3->1.47.2.4 src/dns_internal.cc:1.15.6.2->1.15.6.3 src/forward.cc:1.35.4.3->1.35.4.4 src/ftp.cc:1.26.2.2->1.26.2.3 src/icp_v2.cc:1.17.8.2->1.17.8.3 src/icp_v3.cc:1.5.8.1->1.5.8.2 src/ident.cc:1.11.8.1->1.11.8.2 src/ipc.cc:1.9.4.1->1.9.4.2 src/ipcache.cc:1.9.2.5->1.9.2.6 src/multicast.cc:1.2.10.1->1.2.10.2 src/neighbors.cc:1.23.4.3->1.23.4.4 src/send-announce.cc:1.3.10.1->1.3.10.2 src/stat.cc:1.24.4.1->1.24.4.2 src/tools.cc:1.22.2.2->1.22.2.3 src/tunnel.cc:1.13->1.13.4.1 src/wccp.cc:1.10.2.2->1.10.2.3 Index: squid3/lib/rfc1035.c =================================================================== RCS file: /cvsroot/squid-sf//squid3/lib/rfc1035.c,v retrieving revision 1.5.2.1 retrieving revision 1.5.2.2 diff -u -r1.5.2.1 -r1.5.2.2 --- squid3/lib/rfc1035.c 19 Apr 2005 10:57:54 -0000 1.5.2.1 +++ squid3/lib/rfc1035.c 5 May 2005 09:23:23 -0000 1.5.2.2 @@ -1,6 +1,6 @@ /* - * $Id: rfc1035.c,v 1.5.2.1 2005/04/19 10:57:54 rmartinez Exp $ + * $Id: rfc1035.c,v 1.5.2.2 2005/05/05 09:23:23 rmartinez Exp $ * * Low level DNS protocol routines * AUTHOR: Duane Wessels @@ -644,12 +644,16 @@ static char rev[32]; unsigned int i; memset(&h, '\0', sizeof(h)); +#ifndef INET6 i = (unsigned int) ntohl(addr.s_addr); snprintf(rev, 32, "%u.%u.%u.%u.in-addr.arpa.", i & 255, (i >> 8) & 255, (i >> 16) & 255, (i >> 24) & 255); +#else + i = 4; +#endif h.id = rfc1035Qid(); h.qr = 0; h.rd = 1; Index: squid3/src/cache_cf.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/cache_cf.cc,v retrieving revision 1.40.2.3 retrieving revision 1.40.2.4 diff -u -r1.40.2.3 -r1.40.2.4 --- squid3/src/cache_cf.cc 25 Apr 2005 13:34:52 -0000 1.40.2.3 +++ squid3/src/cache_cf.cc 5 May 2005 09:18:28 -0000 1.40.2.4 @@ -1,6 +1,6 @@ /* - * $Id: cache_cf.cc,v 1.40.2.3 2005/04/25 13:34:52 rmartinez Exp $ + * $Id: cache_cf.cc,v 1.40.2.4 2005/05/05 09:18:28 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", SA_NTOA(s->http.s), ntohs(PORT_FROM_SA(s->http.s))); 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); } } @@ -877,13 +877,9 @@ if (token == NULL) self_destruct(); -#ifdef INET6 - if (safe_inet6_addr(token, addr) == 1) -#else - if (safe_inet_addr(token, addr) == 1) -#endif + if (SAFE_INET_ADDR(token, addr) == 1) (void) 0; - else if ((hp = gethostbyname(token))) /* dont use ipcache */ + else if ((hp = GETHOSTBYNAME(token))) /* dont use ipcache */ *addr = inaddrFromHostent(hp); else self_destruct(); @@ -905,7 +901,7 @@ acl_address *l; for (l = head; l; l = l->next) { - if (l->addr.s_addr != INADDR_ANY) + if (!ADDR_IS_ANYADDR(l->addr)) storeAppendPrintf(entry, "%s %s", name, INET_NTOA(l->addr)); else storeAppendPrintf(entry, "%s autoselect", name); @@ -2696,16 +2692,16 @@ } else { self_destruct(); } - + PORT_FROM_SA(s->s) = htons(port); if (NULL == host) - s->s.sin_addr = any_addr; - else if (1 == safe_inet_addr(host, &s->s.sin_addr)) + ADDR_FROM_SA(s->s) = any_addr; + else if (1 == safe_inet_addr(host, &ADDR_FROM_SA(s->s))) (void) 0; else if ((hp = gethostbyname(host))) { /* dont use ipcache */ - s->s.sin_addr = inaddrFromHostent(hp); + ADDR_FROM_SA(s->s) = inaddrFromHostent(hp); s->defaultsite = xstrdup(host); } else self_destruct(); @@ -2810,10 +2806,14 @@ static void dump_generic_http_port(StoreEntry * e, const char *n, const http_port_list * s) { +#ifdef INET6 + storeAppendPrintf(e, "%s [%s]:%d", +#else storeAppendPrintf(e, "%s %s:%d", +#endif n, - INET_NTOA(s->s.sin_addr), - ntohs(s->s.sin_port)); + INET_NTOA(ADDR_FROM_SA(s->s)), + ntohs(PORT_FROM_SA(s->s))); if (s->defaultsite) storeAppendPrintf(e, " defaultsite=%s", s->defaultsite); Index: squid3/src/cachemgr.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/Attic/cachemgr.cc,v retrieving revision 1.8.4.5 retrieving revision 1.8.4.6 diff -u -r1.8.4.5 -r1.8.4.6 --- squid3/src/cachemgr.cc 25 Apr 2005 13:35:06 -0000 1.8.4.5 +++ squid3/src/cachemgr.cc 5 May 2005 09:18:39 -0000 1.8.4.6 @@ -1,6 +1,6 @@ /* - * $Id: cachemgr.cc,v 1.8.4.5 2005/04/25 13:35:06 rmartinez Exp $ + * $Id: cachemgr.cc,v 1.8.4.6 2005/05/05 09:18:39 rmartinez Exp $ * * DEBUG: section 0 CGI Cache Manager * AUTHOR: Duane Wessels @@ -717,9 +717,13 @@ 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)) + assert(hp->h_length >= 0 && (size_t)hp->h_length <= sizeof(ADDR_FROM_SA(S))); + xmemcpy(&ADDR_FROM_SA(S), hp->h_addr, hp->h_length); +#ifdef INET6 + } else if (safe_inet6_addr(req->hostname, &ADDR_FROM_SA(S))) +#else + } else if (safe_inet_addr(req->hostname, &ADDR_FROM_SA(S))) +#endif (void) 0; else { snprintf(buf, 1024, "Unknown host: %s\n", req->hostname); Index: squid3/src/client.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/Attic/client.cc,v retrieving revision 1.10.4.1 retrieving revision 1.10.4.2 diff -u -r1.10.4.1 -r1.10.4.2 --- squid3/src/client.cc 25 Apr 2005 13:35:20 -0000 1.10.4.1 +++ squid3/src/client.cc 5 May 2005 09:18:49 -0000 1.10.4.2 @@ -1,6 +1,6 @@ /* - * $Id: client.cc,v 1.10.4.1 2005/04/25 13:35:20 rmartinez Exp $ + * $Id: client.cc,v 1.10.4.2 2005/05/05 09:18:49 rmartinez Exp $ * * DEBUG: section 0 WWW Client * AUTHOR: Harvest Derived @@ -559,7 +559,7 @@ return (-1); } - xmemcpy(&from_addr.sin_addr, hp->h_addr, hp->h_length); + xmemcpy(&ADDR_FROM_SA(from_addr), hp->h_addr, hp->h_length); PORT_FROM_SA(from_addr) = 0; } @@ -584,7 +584,7 @@ return (-1); } - xmemcpy(&to_addr.sin_addr, hp->h_addr, hp->h_length); + xmemcpy(&ADDR_FROM_SA(to_addr), hp->h_addr, hp->h_length); PORT_FROM_SA(to_addr) = htons(dest_port); } Index: squid3/src/client_side.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/client_side.cc,v retrieving revision 1.68.2.3 retrieving revision 1.68.2.4 diff -u -r1.68.2.3 -r1.68.2.4 --- squid3/src/client_side.cc 25 Apr 2005 13:35:40 -0000 1.68.2.3 +++ squid3/src/client_side.cc 5 May 2005 09:19:04 -0000 1.68.2.4 @@ -1,6 +1,6 @@ /* - * $Id: client_side.cc,v 1.68.2.3 2005/04/25 13:35:40 rmartinez Exp $ + * $Id: client_side.cc,v 1.68.2.4 2005/05/05 09:19:04 rmartinez Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -520,7 +520,7 @@ updateCounters(); if (getConn().getRaw() != NULL) - clientdbUpdate(getConn()->peer.sin_addr, logType, PROTO_HTTP, out.size); + clientdbUpdate(ADDR_FROM_SA(getConn()->peer), logType, PROTO_HTTP, out.size); } delete checklist; @@ -594,7 +594,7 @@ { debug(33, 3) ("ConnStateData::close: FD %d\n", fd); openReference = NULL; - clientdbEstablished(peer.sin_addr, -1); /* decrement */ + clientdbEstablished(ADDR_FROM_SA(peer), -1); /* decrement */ assert(areAllContextsForThisConnection()); freeAllContexts(); @@ -1786,8 +1786,8 @@ 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), - ntohs(http->getConn()->me.sin_port), url); + INET_NTOA(ADDR_FROM_SA(http->getConn()->me)), + ntohs(PORT_FROM_SA(http->getConn()->me)), url); debug(33, 5) ("ACCEL VPORT REWRITE: '%s'\n", http->uri); } else if (vport > 0) { /* Put the local socket IP address as the hostname, but static port */ @@ -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(ADDR_FROM_SA(http->getConn()->me)), vport, url); debug(33, 5) ("ACCEL VPORT REWRITE: '%s'\n", http->uri); } @@ -1830,8 +1830,8 @@ 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), - ntohs(http->getConn()->me.sin_port), url); + INET_NTOA(ADDR_FROM_SA(http->getConn()->me)), + ntohs(PORT_FROM_SA(http->getConn()->me)), url); debug(33, 5) ("TRANSPARENT REWRITE: '%s'\n", http->uri); } } @@ -2139,7 +2139,7 @@ assert (repContext); repContext->setReplyToError(ERR_TOO_BIG, HTTP_REQUEST_ENTITY_TOO_LARGE, METHOD_NONE, NULL, - &conn->peer.sin_addr, NULL, NULL, NULL); + &ADDR_FROM_SA(conn->peer), NULL, NULL, NULL); context->registerWithConn(); context->pullData(); } @@ -2190,7 +2190,7 @@ clientReplyContext *repContext = dynamic_cast(node->data.getRaw()); assert (repContext); repContext->setReplyToError(ERR_INVALID_REQ, HTTP_BAD_REQUEST, method, NULL, - &conn->peer.sin_addr, NULL, conn->in.buf, NULL); + &ADDR_FROM_SA(conn->peer), NULL, conn->in.buf, NULL); assert(context->http->out.offset == 0); context->pullData(); conn->flags.readMoreRequests = 0; @@ -2204,7 +2204,7 @@ assert (repContext); repContext->setReplyToError( ERR_INVALID_URL, HTTP_BAD_REQUEST, method, http->uri, - &conn->peer.sin_addr, NULL, NULL, NULL); + &ADDR_FROM_SA(conn->peer), NULL, NULL, NULL); assert(context->http->out.offset == 0); context->pullData(); conn->flags.readMoreRequests = 0; @@ -2220,7 +2220,7 @@ assert (repContext); repContext->setReplyToError( ERR_INVALID_URL, HTTP_BAD_REQUEST, method, http->uri, - &conn->peer.sin_addr, NULL, NULL, NULL); + &ADDR_FROM_SA(conn->peer), NULL, NULL, NULL); assert(context->http->out.offset == 0); context->pullData(); conn->flags.readMoreRequests = 0; @@ -2252,10 +2252,10 @@ request->flags.internal = http->flags.internal; setLogUri (http, urlCanonicalClean(request)); - request->client_addr = conn->peer.sin_addr; - request->client_port = ntohs(conn->peer.sin_port); - request->my_addr = conn->me.sin_addr; - request->my_port = ntohs(conn->me.sin_port); + request->client_addr = ADDR_FROM_SA(conn->peer); + request->client_port = ntohs(PORT_FROM_SA(conn->peer)); + request->my_addr = ADDR_FROM_SA(conn->me); + request->my_port = ntohs(PORT_FROM_SA(conn->me)); request->http_ver = http->http_ver; if (!urlCheckRequest(request) || @@ -2265,7 +2265,7 @@ assert (repContext); repContext->setReplyToError(ERR_UNSUP_REQ, HTTP_NOT_IMPLEMENTED, request->method, NULL, - &conn->peer.sin_addr, request, NULL, NULL); + &ADDR_FROM_SA(conn->peer), request, NULL, NULL); assert(context->http->out.offset == 0); context->pullData(); conn->flags.readMoreRequests = 0; @@ -2279,7 +2279,7 @@ assert (repContext); repContext->setReplyToError(ERR_INVALID_REQ, HTTP_LENGTH_REQUIRED, request->method, NULL, - &conn->peer.sin_addr, request, NULL, NULL); + &ADDR_FROM_SA(conn->peer), request, NULL, NULL); assert(context->http->out.offset == 0); context->pullData(); conn->flags.readMoreRequests = 0; @@ -2302,7 +2302,7 @@ assert (repContext); repContext->setReplyToError(ERR_TOO_BIG, HTTP_REQUEST_ENTITY_TOO_LARGE, METHOD_NONE, NULL, - &conn->peer.sin_addr, http->request, NULL, NULL); + &ADDR_FROM_SA(conn->peer), http->request, NULL, NULL); assert(context->http->out.offset == 0); context->pullData(); conn->flags.readMoreRequests = 0; @@ -2712,7 +2712,7 @@ clientReplyContext *repContext = dynamic_cast(node->data.getRaw()); assert (repContext); repContext->setReplyToError(ERR_LIFETIME_EXP, - HTTP_REQUEST_TIMEOUT, METHOD_NONE, "N/A", &conn->peer.sin_addr, + HTTP_REQUEST_TIMEOUT, METHOD_NONE, "N/A", &ADDR_FROM_SA(conn->peer), NULL, NULL, NULL); /* No requests can be outstanded */ assert(conn->chr == NULL); @@ -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(ADDR_FROM_SA(http->getConn()->peer))); debug(33, 1) ("\t%s\n", http->uri); comm_close(fd); } @@ -2786,8 +2786,11 @@ { ConnStateData *result = new ConnStateData; result->peer = *peer; - result->log_addr = peer->sin_addr; + result->log_addr = ADDR_FROM_SA(*peer); +#ifdef INET6 +#else result->log_addr.s_addr &= Config.Addrs.client_netmask.s_addr; +#endif result->me = *me; result->fd = fd; result->in.buf = (char *)memAllocBuf(CLIENT_REQ_BUF_SZ, &result->in.allocatedSize); @@ -2858,7 +2861,7 @@ comm_add_close_handler(newfd, connStateFree, connState); if (Config.onoff.log_fqdn) - fqdncache_gethostbyaddr(details->peer.sin_addr, FQDN_LOOKUP_IF_MISS); + fqdncache_gethostbyaddr(ADDR_FROM_SA(details->peer), FQDN_LOOKUP_IF_MISS); commSetTimeout(newfd, Config.Timeout.request, requestTimeout, connState); @@ -2866,11 +2869,11 @@ ACLChecklist identChecklist; - identChecklist.src_addr = details->peer.sin_addr; + identChecklist.src_addr = ADDR_FROM_SA(details->peer); - identChecklist.my_addr = details->me.sin_addr; + identChecklist.my_addr = ADDR_FROM_SA(details->me); - identChecklist.my_port = ntohs(details->me.sin_port); + identChecklist.my_port = ntohs(PORT_FROM_SA(details->me)); identChecklist.accessList = Config.accessList.identLookup; @@ -2883,7 +2886,7 @@ connState->readSomeData(); - clientdbEstablished(details->peer.sin_addr, 1); + clientdbEstablished(ADDR_FROM_SA(details->peer), 1); incoming_sockets_accepted++; } @@ -3029,7 +3032,7 @@ comm_add_close_handler(newfd, connStateFree, connState); if (Config.onoff.log_fqdn) - fqdncache_gethostbyaddr(details->peer.sin_addr, FQDN_LOOKUP_IF_MISS); + fqdncache_gethostbyaddr(ADDR_FROM_SA(details->peer), FQDN_LOOKUP_IF_MISS); commSetTimeout(newfd, Config.Timeout.request, requestTimeout, connState); @@ -3037,11 +3040,11 @@ ACLChecklist identChecklist; - identChecklist.src_addr = details->peer.sin_addr; + identChecklist.src_addr = ADDR_FROM_SA(details->peer); - identChecklist.my_addr = details->me.sin_addr; + identChecklist.my_addr = ADDR_FROM_SA(details->me); - identChecklist.my_port = ntohs(details->me.sin_port); + identChecklist.my_port = ntohs(PORT_FROM_SA(details->me)); identChecklist.accessList = Config.accessList.identLookup; @@ -3054,7 +3057,7 @@ commSetSelect(newfd, COMM_SELECT_READ, clientNegotiateSSL, connState, 0); - clientdbEstablished(details->peer.sin_addr, 1); + clientdbEstablished(ADDR_FROM_SA(details->peer), 1); incoming_sockets_accepted++; } @@ -3078,8 +3081,8 @@ enter_suid(); fd = comm_open(SOCK_STREAM, IPPROTO_TCP, - s->s.sin_addr, - ntohs(s->s.sin_port), COMM_NONBLOCKING, "HTTP Socket"); + ADDR_FROM_SA(s->s), + ntohs(PORT_FROM_SA(s->s)), COMM_NONBLOCKING, "HTTP Socket"); leave_suid(); if (fd < 0) @@ -3093,7 +3096,7 @@ s->transparent ? "transparently proxied" : s->accel ? "accelerated" : "", - INET_NTOA(s->s.sin_addr), (int) ntohs(s->s.sin_port), fd); + INET_NTOA(ADDR_FROM_SA(s->s)), (int) ntohs(PORT_FROM_SA(s->s)), fd); HttpSockets[NHttpSockets++] = fd; } @@ -3115,14 +3118,14 @@ 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(ADDR_FROM_SA(s->http.s)), (int) ntohs(PORT_FROM_SA(s->http.s))); } enter_suid(); fd = comm_open(SOCK_STREAM, IPPROTO_TCP, - s->http.s.sin_addr, - ntohs(s->http.s.sin_port), COMM_NONBLOCKING, "HTTPS Socket"); + ADDR_FROM_SA(s->http.s), + ntohs(PORT_FROM_SA(s->http.s)), COMM_NONBLOCKING, "HTTPS Socket"); leave_suid(); if (fd < 0) @@ -3133,7 +3136,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(ADDR_FROM_SA(s->http.s)), (int) ntohs(PORT_FROM_SA(s->http.s)), fd); HttpSockets[NHttpSockets++] = fd; } Index: squid3/src/client_side_reply.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/client_side_reply.cc,v retrieving revision 1.57.4.3 retrieving revision 1.57.4.4 diff -u -r1.57.4.3 -r1.57.4.4 --- squid3/src/client_side_reply.cc 25 Apr 2005 13:36:15 -0000 1.57.4.3 +++ squid3/src/client_side_reply.cc 5 May 2005 09:19:17 -0000 1.57.4.4 @@ -1,6 +1,6 @@ /* - * $Id: client_side_reply.cc,v 1.57.4.3 2005/04/25 13:36:15 rmartinez Exp $ + * $Id: client_side_reply.cc,v 1.57.4.4 2005/05/05 09:19:17 rmartinez Exp $ * * DEBUG: section 88 Client-side Reply Routines * AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c) @@ -805,7 +805,7 @@ http->al.http.code = HTTP_FORBIDDEN; err = clientBuildError(ERR_ACCESS_DENIED, HTTP_FORBIDDEN, NULL, - &http->getConn()->peer.sin_addr, http->request); + &ADDR_FROM_SA(http->getConn()->peer), http->request); createStoreEntry(r->method, request_flags()); errorAppendEntry(http->storeEntry(), err); triggerInitialStoreRead(); @@ -851,7 +851,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, - &http->getConn()->peer.sin_addr, http->request); + &ADDR_FROM_SA(http->getConn()->peer), http->request); removeClientStoreReference(&sc, http); startError(err); } @@ -908,7 +908,7 @@ http->logType = LOG_TCP_DENIED; ErrorState *err = clientBuildError(ERR_ACCESS_DENIED, HTTP_FORBIDDEN, NULL, - &http->getConn()->peer.sin_addr, http->request); + &ADDR_FROM_SA(http->getConn()->peer), http->request); startError(err); return; } @@ -939,7 +939,7 @@ http->logType = LOG_TCP_DENIED; ErrorState *err = clientBuildError(ERR_ACCESS_DENIED, HTTP_FORBIDDEN, NULL, - &http->getConn()->peer.sin_addr, http->request); + &ADDR_FROM_SA(http->getConn()->peer), http->request); startError(err); return; } @@ -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 ? ADDR_FROM_SA(http->getConn()->peer) : 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 ? ADDR_FROM_SA(http->getConn()->peer) : 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); @@ -1852,7 +1852,7 @@ if (http->isReplyBodyTooLarge(rep->content_length)) { ErrorState *err = clientBuildError(ERR_TOO_BIG, HTTP_FORBIDDEN, NULL, - http->getConn().getRaw() != NULL ? &http->getConn()->peer.sin_addr : &no_addr, + http->getConn().getRaw() != NULL ? &ADDR_FROM_SA(http->getConn()->peer) : &no_addr, http->request); removeClientStoreReference(&sc, http); startError(err); @@ -1899,7 +1899,7 @@ err = clientBuildError(page_id, HTTP_FORBIDDEN, NULL, - http->getConn().getRaw() != NULL ? &http->getConn()->peer.sin_addr : &no_addr, + http->getConn().getRaw() != NULL ? &ADDR_FROM_SA(http->getConn()->peer) : &no_addr, http->request); removeClientStoreReference(&sc, http); Index: squid3/src/client_side_request.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/client_side_request.cc,v retrieving revision 1.33.4.1 retrieving revision 1.33.4.2 diff -u -r1.33.4.1 -r1.33.4.2 --- squid3/src/client_side_request.cc 12 Mar 2005 03:19:50 -0000 1.33.4.1 +++ squid3/src/client_side_request.cc 5 May 2005 09:19:28 -0000 1.33.4.2 @@ -1,6 +1,6 @@ /* - * $Id: client_side_request.cc,v 1.33.4.1 2005/03/12 03:19:50 mediumnet Exp $ + * $Id: client_side_request.cc,v 1.33.4.2 2005/05/05 09:19:28 rmartinez Exp $ * * DEBUG: section 85 Client-side Request Routines * AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c) @@ -429,7 +429,7 @@ assert (repContext); repContext->setReplyToError(page_id, status, http->request->method, NULL, - http->getConn().getRaw() != NULL ? &http->getConn()->peer.sin_addr : &no_addr, http->request, + http->getConn().getRaw() != NULL ? &ADDR_FROM_SA(http->getConn()->peer) : &no_addr, http->request, NULL, http->getConn().getRaw() != NULL && http->getConn()->auth_user_request ? http->getConn()-> auth_user_request : http->request->auth_user_request); Index: squid3/src/comm.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/comm.cc,v retrieving revision 1.47.2.3 retrieving revision 1.47.2.4 diff -u -r1.47.2.3 -r1.47.2.4 --- squid3/src/comm.cc 25 Apr 2005 13:36:27 -0000 1.47.2.3 +++ squid3/src/comm.cc 5 May 2005 09:19:38 -0000 1.47.2.4 @@ -1,6 +1,6 @@ /* - * $Id: comm.cc,v 1.47.2.3 2005/04/25 13:36:27 rmartinez Exp $ + * $Id: comm.cc,v 1.47.2.4 2005/05/05 09:19:38 rmartinez Exp $ * * DEBUG: section 5 Socket Functions * AUTHOR: Harvest Derived @@ -1008,7 +1008,7 @@ return 0; } - F->local_port = ntohs(addr.sin_port); + F->local_port = ntohs(PORT_FROM_SA(addr)); debug(5, 6) ("comm_local_port: FD %d: port %d\n", fd, (int) F->local_port); return F->local_port; } @@ -1023,7 +1023,7 @@ memset(&S, '\0', sizeof(S)); FAMILY_FROM_SA(S) = AF_INET; PORT_FROM_SA(S) = htons(port); - S.sin_addr = in_addr; + ADDR_FROM_SA(S) = in_addr; statCounter.syscalls.sock.binds++; if (bind(s, (struct sockaddr *) &S, sizeof(S)) == 0) @@ -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), + ADDR_IS_ANYADDR(ADDR_FROM_SA(S)) ? "*" : INET_NTOA(ADDR_FROM_SA(S)), (int) port, xstrerror()); @@ -1151,7 +1151,7 @@ commSetReuseAddr(new_socket); } - if (addr.s_addr != no_addr.s_addr) + if (!ADDR_IS_NOADDR(addr)) { if (commBind(new_socket, addr, port) != COMM_OK) { comm_close(new_socket); @@ -1391,14 +1391,14 @@ ConnectStateData::defaults() { FAMILY_FROM_SA(S) = AF_INET; - S.sin_addr = in_addr; + ADDR_FROM_SA(S) = in_addr; PORT_FROM_SA(S) = htons(port); } void ConnectStateData::connect() { - if (S.sin_addr.s_addr == 0) + if (ADDR_IS_ANYADDR(ADDR_FROM_SA(S))) defaults(); switch (comm_connect_addr(fd, &S)) { @@ -1409,16 +1409,16 @@ break; case COMM_OK: - ipcacheMarkGoodAddr(host, S.sin_addr); + ipcacheMarkGoodAddr(host, ADDR_FROM_SA(S)); callCallback(COMM_OK, 0); break; default: tries++; - ipcacheMarkBadAddr(host, S.sin_addr); + ipcacheMarkBadAddr(host, ADDR_FROM_SA(S)); if (Config.onoff.test_reachability) - netdbDeleteAddrNetwork(S.sin_addr); + netdbDeleteAddrNetwork(ADDR_FROM_SA(S)); if (commRetryConnect(this)) { eventAdd("commReconnect", commReconnect, this, this->addrcount == 1 ? 0.05 : 0.0, 0); @@ -1465,7 +1465,7 @@ int x; int err = 0; socklen_t errlen; - assert(ntohs(address->sin_port) != 0); + assert(ntohs(PORT_FROM_SA(*address)) != 0); PROF_start(comm_connect_addr); /* Establish connection. */ errno = 0; @@ -1526,9 +1526,9 @@ else return COMM_ERROR; - xstrncpy(F->ipaddr, INET_NTOA(address->sin_addr), 16); + xstrncpy(F->ipaddr, INET_NTOA(ADDR_FROM_SA(*address)), 16); - F->remote_port = ntohs(address->sin_port); + F->remote_port = ntohs(PORT_FROM_SA(*address)); if (status == COMM_OK) { @@ -1581,9 +1581,9 @@ 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); - F->remote_port = htons(details.peer.sin_port); - F->local_port = htons(details.me.sin_port); + xstrncpy(F->ipaddr, INET_NTOA(ADDR_FROM_SA(details.peer)), 16); + F->remote_port = htons(PORT_FROM_SA(details.peer)); + F->local_port = htons(PORT_FROM_SA(details.me)); commSetNonBlocking(sock); PROF_stop(comm_accept); return sock; @@ -1848,8 +1848,8 @@ debug(50, 1) ("comm_udp_sendto: FD %d, %s, port %d: %s\n", fd, - INET_NTOA(to_addr->sin_addr), - (int) htons(to_addr->sin_port), + INET_NTOA(ADDR_FROM_SA(*to_addr)), + (int) htons(PORT_FROM_SA(*to_addr)), xstrerror()); return COMM_ERROR; Index: squid3/src/dns_internal.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/dns_internal.cc,v retrieving revision 1.15.6.2 retrieving revision 1.15.6.3 diff -u -r1.15.6.2 -r1.15.6.3 --- squid3/src/dns_internal.cc 25 Apr 2005 13:36:42 -0000 1.15.6.2 +++ squid3/src/dns_internal.cc 5 May 2005 09:20:05 -0000 1.15.6.3 @@ -1,6 +1,6 @@ /* - * $Id: dns_internal.cc,v 1.15.6.2 2005/04/25 13:36:42 rmartinez Exp $ + * $Id: dns_internal.cc,v 1.15.6.3 2005/05/05 09:20:05 rmartinez Exp $ * * DEBUG: section 78 DNS lookups; interacts with lib/rfc1035.c * AUTHOR: Duane Wessels @@ -164,11 +164,11 @@ } assert(nns < nns_alloc); - FAMILY_FROM_SA(nameservers[nns].S) = AF_INET; + FAMILY_FROM_SA(nameservers[nns].S) = AF_FAMILY; PORT_FROM_SA(nameservers[nns].S) = htons(DOMAIN_PORT); - nameservers[nns].S.sin_addr.s_addr = A.s_addr; + ADDR_FROM_SA(nameservers[nns].S) = A; debug(78, 3) ("idnsAddNameserver: Added nameserver #%d: %s\n", - nns, INET_NTOA(nameservers[nns].S.sin_addr)); + nns, INET_NTOA(ADDR_FROM_SA(nameservers[nns].S))); nns++; } @@ -438,7 +438,7 @@ for (i = 0; i < nns; i++) { storeAppendPrintf(sentry, "%-15s %9d %9d\n", - INET_NTOA(nameservers[i].S.sin_addr), + INET_NTOA(ADDR_FROM_SA(nameservers[i].S)), nameservers[i].nqueries, nameservers[i].nreplies); } @@ -530,10 +530,10 @@ for (i = 0; i < nns; i++) { - if (nameservers[i].S.sin_addr.s_addr != from->sin_addr.s_addr) + if (!ADDR_EQUALS(ADDR_FROM_SA(nameservers[i].S), ADDR_FROM_SA(*from))) continue; - PORT_FROM_SA(if (nameservers[i].S) != from->sin_port) + if (PORT_FROM_SA(nameservers[i].S) != PORT_FROM_SA(*from)) continue; return i; @@ -691,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(ADDR_FROM_SA(from))); ns = idnsFromKnownNameserver(&from); if (ns >= 0) { @@ -701,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(ADDR_FROM_SA(from))); last_warning = squid_curtime; } @@ -723,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(ADDR_FROM_SA(from))); len = 512; } Index: squid3/src/forward.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/forward.cc,v retrieving revision 1.35.4.3 retrieving revision 1.35.4.4 diff -u -r1.35.4.3 -r1.35.4.4 --- squid3/src/forward.cc 25 Apr 2005 13:37:29 -0000 1.35.4.3 +++ squid3/src/forward.cc 5 May 2005 09:20:22 -0000 1.35.4.4 @@ -1,6 +1,6 @@ /* - * $Id: forward.cc,v 1.35.4.3 2005/04/25 13:37:29 rmartinez Exp $ + * $Id: forward.cc,v 1.35.4.4 2005/05/05 09:20:22 rmartinez Exp $ * * DEBUG: section 17 Request Forwarding * AUTHOR: Duane Wessels @@ -497,7 +497,7 @@ return l->addr; } - addr.s_addr = INADDR_ANY; + addr = INADDR_ANY_ASSIGN; return addr; } @@ -870,7 +870,7 @@ * be allowed. yuck, I know. */ - if (r->client_addr.s_addr != no_addr.s_addr && r->protocol != PROTO_INTERNAL && r->protocol != PROTO_CACHEOBJ) { + if (!ADDR_IS_NOADDR(r->client_addr) && r->protocol != PROTO_INTERNAL && r->protocol != PROTO_CACHEOBJ) { /* * Check if this host is allowed to fetch MISSES from us (miss_access) */ Index: squid3/src/ftp.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ftp.cc,v retrieving revision 1.26.2.2 retrieving revision 1.26.2.3 diff -u -r1.26.2.2 -r1.26.2.3 --- squid3/src/ftp.cc 25 Apr 2005 13:37:48 -0000 1.26.2.2 +++ squid3/src/ftp.cc 5 May 2005 09:20:32 -0000 1.26.2.3 @@ -1,6 +1,6 @@ /* - * $Id: ftp.cc,v 1.26.2.2 2005/04/25 13:37:48 rmartinez Exp $ + * $Id: ftp.cc,v 1.26.2.3 2005/05/05 09:20:32 rmartinez Exp $ * * DEBUG: section 9 File Transfer Protocol (FTP) * AUTHOR: Harvest Derived @@ -2146,7 +2146,7 @@ /* Open data channel with the same local address as control channel */ fd = comm_open(SOCK_STREAM, IPPROTO_TCP, - addr.sin_addr, + ADDR_FROM_SA(addr), 0, COMM_NONBLOCKING, storeUrl(ftpState->entry)); @@ -2313,12 +2313,12 @@ */ if (fallback) { setsockopt(ftpState->ctrl.fd, SOL_SOCKET, SO_REUSEADDR, (char *) &on, sizeof(on)); - port = ntohs(addr.sin_port); + port = ntohs(PORT_FROM_SA(addr)); } fd = comm_open(SOCK_STREAM, IPPROTO_TCP, - addr.sin_addr, + ADDR_FROM_SA(addr), port, COMM_NONBLOCKING | (fallback ? COMM_REUSEADDR : 0), storeUrl(ftpState->entry)); @@ -2361,8 +2361,8 @@ return; } - addrptr = (unsigned char *) &addr.sin_addr.s_addr; - portptr = (unsigned char *) &addr.sin_port; + addrptr = (unsigned char *) &ADDR_FROM_SA(addr); + portptr = (unsigned char *) &PORT_FROM_SA(addr); snprintf(cbuf, 1024, "PORT %d,%d,%d,%d,%d,%d\r\n", addrptr[0], addrptr[1], addrptr[2], addrptr[3], portptr[0], portptr[1]); @@ -2402,10 +2402,10 @@ } if (Config.Ftp.sanitycheck) { - char *ipaddr = INET_NTOA(details->peer.sin_addr); + char *ipaddr = (char *)INET_NTOA(ADDR_FROM_SA(details->peer)); 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); + 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); comm_close(newfd); comm_accept(ftpState->data.fd, ftpAcceptDataConnection, ftpState); return; @@ -2426,9 +2426,9 @@ ftpState->data.fd = newfd; - ftpState->data.port = ntohs(details->peer.sin_port); + ftpState->data.port = ntohs(PORT_FROM_SA(details->peer)); - ftpState->data.host = xstrdup(INET_NTOA(details->peer.sin_addr)); + ftpState->data.host = xstrdup(INET_NTOA(ADDR_FROM_SA(details->peer))); commSetTimeout(ftpState->ctrl.fd, -1, NULL, NULL); Index: squid3/src/icp_v2.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/icp_v2.cc,v retrieving revision 1.17.8.2 retrieving revision 1.17.8.3 diff -u -r1.17.8.2 -r1.17.8.3 --- squid3/src/icp_v2.cc 25 Apr 2005 13:39:33 -0000 1.17.8.2 +++ squid3/src/icp_v2.cc 5 May 2005 09:21:01 -0000 1.17.8.3 @@ -1,6 +1,6 @@ /* - * $Id: icp_v2.cc,v 1.17.8.2 2005/04/25 13:39:33 rmartinez Exp $ + * $Id: icp_v2.cc,v 1.17.8.3 2005/05/05 09:21:01 rmartinez Exp $ * * DEBUG: section 12 Internet Cache Protocol * AUTHOR: Duane Wessels @@ -237,7 +237,7 @@ headerp->pad = htonl(pad); - headerp->shostid = theOutICPAddr.s_addr; +// Rafa headerp->shostid = theOutICPAddr.s_addr; urloffset = buf + sizeof(icp_common_t); @@ -265,14 +265,14 @@ fd, icp_opcode_str[msg->opcode], len, - INET_NTOA(to->sin_addr), - ntohs(to->sin_port)); + SA_NTOA(*to), + ntohs(PORT_FROM_SA(*to))); x = comm_udp_sendto(fd, to, sizeof(*to), msg, len); if (x >= 0) { /* successfully written */ - icpLogIcp(to->sin_addr, logcode, len, (char *) (msg + 1), delay); + icpLogIcp(ADDR_FROM_SA(*to), logcode, len, (char *) (msg + 1), delay); icpCount(msg, SENT, (size_t) len, delay); safe_free(msg); } else if (0 == delay) @@ -375,15 +375,15 @@ 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); + SA_NTOA(*from), AclMatchedName); - if (clientdbCutoffDenied(from->sin_addr)) + if (clientdbCutoffDenied(ADDR_FROM_SA(*from))) { /* * count this DENIED query in the clientdb, even though * we're not sending an ICP reply... */ - clientdbUpdate(from->sin_addr, LOG_UDP_DENIED, PROTO_ICP, 0); + clientdbUpdate(ADDR_FROM_SA(*from), LOG_UDP_DENIED, PROTO_ICP, 0); } else { icpCreateAndSend(ICP_DENIED, 0, url, reqnum, 0, fd, from); @@ -395,7 +395,7 @@ icpAccessAllowed(struct SOCKADDR_IN *from, HttpRequest * icp_request) { ACLChecklist checklist; - checklist.src_addr = from->sin_addr; + checklist.src_addr = ADDR_FROM_SA(*from); checklist.my_addr = no_addr; checklist.request = requestLink(icp_request); checklist.accessList = Config.accessList.icp; @@ -489,7 +489,7 @@ if (neighbors_do_private_keys && reqnum == 0) { debug(12, 0) ("icpHandleIcpV2: Neighbor %s returned reqnum = 0\n", - INET_NTOA(from->sin_addr)); + SA_NTOA(*from)); 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), + SA_NTOA(*from), url); const cache_key *key = icpGetCacheKey(url, (int) reqnum); /* call neighborsUdpAck even if ping_status != PING_WAITING */ @@ -556,7 +556,7 @@ default: debug(12, 0) ("icpHandleIcpV2: UNKNOWN OPCODE: %d from %s\n", - header.opcode, INET_NTOA(from.sin_addr)); + header.opcode, SA_NTOA(from)); break; } } @@ -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)); + SA_NTOA(from)); #ifdef ICP_PACKET_DUMP icpPktDump(buf); @@ -653,8 +653,8 @@ else debug(12, 1) ("WARNING: Unused ICP version %d received from %s:%d\n", icp_version, - INET_NTOA(from.sin_addr), - ntohs(from.sin_port)); + SA_NTOA(from), + ntohs(PORT_FROM_SA(from))); } } @@ -700,7 +700,8 @@ INET_NTOA(Config.Addrs.udp_incoming), (int) port, theInIcpConnection); - if ((addr = Config.Addrs.udp_outgoing).s_addr != no_addr.s_addr) { + addr = Config.Addrs.udp_outgoing; + if (!ADDR_EQUALS(addr,no_addr)) { enter_suid(); theOutIcpConnection = comm_open(SOCK_DGRAM, IPPROTO_UDP, @@ -741,7 +742,7 @@ debug(50, 1) ("theOutIcpConnection FD %d: getsockname: %s\n", theOutIcpConnection, xstrerror()); else - theOutICPAddr = xaddr.sin_addr; + theOutICPAddr = ADDR_FROM_SA(xaddr); } /* Index: squid3/src/icp_v3.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/icp_v3.cc,v retrieving revision 1.5.8.1 retrieving revision 1.5.8.2 diff -u -r1.5.8.1 -r1.5.8.2 --- squid3/src/icp_v3.cc 25 Apr 2005 13:39:43 -0000 1.5.8.1 +++ squid3/src/icp_v3.cc 5 May 2005 09:21:14 -0000 1.5.8.2 @@ -1,6 +1,6 @@ /* - * $Id: icp_v3.cc,v 1.5.8.1 2005/04/25 13:39:43 rmartinez Exp $ + * $Id: icp_v3.cc,v 1.5.8.2 2005/05/05 09:21:14 rmartinez Exp $ * * DEBUG: section 12 Internet Cache Protocol * AUTHOR: Duane Wessels @@ -155,7 +155,7 @@ default: debug(12, 0) ("icpHandleIcpV3: UNKNOWN OPCODE: %d from %s\n", - header.opcode, INET_NTOA(from.sin_addr)); + header.opcode, SA_NTOA(from)); break; } } Index: squid3/src/ident.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ident.cc,v retrieving revision 1.11.8.1 retrieving revision 1.11.8.2 diff -u -r1.11.8.1 -r1.11.8.2 --- squid3/src/ident.cc 25 Apr 2005 13:40:01 -0000 1.11.8.1 +++ squid3/src/ident.cc 5 May 2005 09:21:24 -0000 1.11.8.2 @@ -1,6 +1,6 @@ /* - * $Id: ident.cc,v 1.11.8.1 2005/04/25 13:40:01 rmartinez Exp $ + * $Id: ident.cc,v 1.11.8.2 2005/05/05 09:21:24 rmartinez Exp $ * * DEBUG: section 30 Ident (RFC 931) * AUTHOR: Duane Wessels @@ -106,7 +106,7 @@ { IdentStateData *state = (IdentStateData *)data; debug(30, 3) ("identTimeout: FD %d, %s\n", fd, - INET_NTOA(state->my_peer.sin_addr)); + SA_NTOA(state->my_peer)); comm_close(fd); } @@ -139,8 +139,8 @@ memBufDefInit(&mb); memBufPrintf(&mb, "%d, %d\r\n", - ntohs(state->my_peer.sin_port), - ntohs(state->me.sin_port)); + ntohs(PORT_FROM_SA(state->my_peer)), + ntohs(PORT_FROM_SA(state->me))); comm_old_write_mbuf(fd, mb, NULL, state); comm_read(fd, state->buf, BUFSIZ, identReadReply, state); commSetTimeout(fd, Config.Timeout.ident, identTimeout, state); @@ -218,12 +218,20 @@ char key1[IDENT_KEY_SZ]; char key2[IDENT_KEY_SZ]; char key[IDENT_KEY_SZ]; +#ifdef INET6 + snprintf(key1, IDENT_KEY_SZ, "[%s]:%d", +#else snprintf(key1, IDENT_KEY_SZ, "%s:%d", - INET_NTOA(me->sin_addr), - ntohs(me->sin_port)); +#endif + SA_NTOA(*me), + ntohs(PORT_FROM_SA(*me))); +#ifdef INET6 + snprintf(key2, IDENT_KEY_SZ, "[%s]:%d", +#else snprintf(key2, IDENT_KEY_SZ, "%s:%d", - INET_NTOA(my_peer->sin_addr), - ntohs(my_peer->sin_port)); +#endif + SA_NTOA(*my_peer), + ntohs(PORT_FROM_SA(*my_peer))); snprintf(key, IDENT_KEY_SZ, "%s,%s", key1, key2); if ((state = (IdentStateData *)hash_lookup(ident_hash, key)) != NULL) @@ -234,7 +242,7 @@ fd = comm_open(SOCK_STREAM, IPPROTO_TCP, - me->sin_addr, + ADDR_FROM_SA(*me), 0, COMM_NONBLOCKING, "ident"); @@ -259,7 +267,7 @@ state); commSetTimeout(fd, Config.Timeout.ident, identTimeout, state); commConnectStart(fd, - INET_NTOA(state->my_peer.sin_addr), + SA_NTOA(state->my_peer), IDENT_PORT, identConnectDone, state); Index: squid3/src/ipc.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ipc.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/ipc.cc 25 Apr 2005 13:40:19 -0000 1.9.4.1 +++ squid3/src/ipc.cc 5 May 2005 09:21:34 -0000 1.9.4.2 @@ -1,6 +1,6 @@ /* - * $Id: ipc.cc,v 1.9.4.1 2005/04/25 13:40:19 rmartinez Exp $ + * $Id: ipc.cc,v 1.9.4.2 2005/05/05 09:21:34 rmartinez Exp $ * * DEBUG: section 54 Interprocess Communication * AUTHOR: Duane Wessels @@ -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, SA_NTOA(PaS), ntohs(PORT_FROM_SA(PaS))); 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, SA_NTOA(ChS), ntohs(PORT_FROM_SA(ChS))); } 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.5 retrieving revision 1.9.2.6 diff -u -r1.9.2.5 -r1.9.2.6 --- squid3/src/ipcache.cc 25 Apr 2005 13:40:33 -0000 1.9.2.5 +++ squid3/src/ipcache.cc 5 May 2005 09:21:44 -0000 1.9.2.6 @@ -1,6 +1,6 @@ /* - * $Id: ipcache.cc,v 1.9.2.5 2005/04/25 13:40:33 rmartinez Exp $ + * $Id: ipcache.cc,v 1.9.2.6 2005/05/05 09:21:44 rmartinez Exp $ * * DEBUG: section 14 IP Cache * AUTHOR: Harvest Derived @@ -722,14 +722,14 @@ 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; static_addrs.cur = 0; - static_addrs.in_addrs[0].s_addr = ip.s_addr; + static_addrs.in_addrs[0] = ip; static_addrs.bad_mask[0] = FALSE; @@ -818,7 +818,7 @@ for (k = 0; k < (int) ia->count; k++) { - if (ia->in_addrs[k].s_addr == addr.s_addr) + if (ADDR_EQUALS(ia->in_addrs[k], addr)) break; } @@ -851,7 +851,7 @@ for (k = 0; k < (int) ia->count; k++) { - if (ia->in_addrs[k].s_addr == addr.s_addr) + if (ADDR_EQUALS(ia->in_addrs[k], addr)) break; } @@ -909,13 +909,18 @@ struct IN_ADDR ip; - if (!safe_inet_addr(ipaddr, &ip)) { + if (!SAFE_INET_ADDR(ipaddr, &ip)) { +#ifdef INET6 + debug(14, 1) ("ipcacheAddEntryFromHosts: Bad IP address '%s'\n", + ipaddr); +#else if (strchr(ipaddr, ':') && strspn(ipaddr, "0123456789abcdefABCDEF:") == strlen(ipaddr)) { debug(14, 3) ("ipcacheAddEntryFromHosts: Skipping IPv6 address '%s'\n", ipaddr); } else { debug(14, 1) ("ipcacheAddEntryFromHosts: Bad IP address '%s'\n", ipaddr); } +#endif return 1; } @@ -939,7 +944,7 @@ i->addrs.in_addrs = (struct IN_ADDR *)xcalloc(1, sizeof(struct IN_ADDR)); i->addrs.bad_mask = (unsigned char *)xcalloc(1, sizeof(unsigned char)); - i->addrs.in_addrs[0].s_addr = ip.s_addr; + i->addrs.in_addrs[0] = ip; i->addrs.bad_mask[0] = FALSE; i->flags.fromhosts = 1; ipcacheAddEntry(i); Index: squid3/src/multicast.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/multicast.cc,v retrieving revision 1.2.10.1 retrieving revision 1.2.10.2 diff -u -r1.2.10.1 -r1.2.10.2 --- squid3/src/multicast.cc 25 Apr 2005 13:40:53 -0000 1.2.10.1 +++ squid3/src/multicast.cc 5 May 2005 09:21:53 -0000 1.2.10.2 @@ -1,6 +1,6 @@ /* - * $Id: multicast.cc,v 1.2.10.1 2005/04/25 13:40:53 rmartinez Exp $ + * $Id: multicast.cc,v 1.2.10.2 2005/05/05 09:21:53 rmartinez Exp $ * * DEBUG: section 7 Multicast * AUTHOR: Martin Hamilton @@ -41,7 +41,11 @@ #ifdef IP_MULTICAST_TTL char ttl = (char) mcast_ttl; +#if INET6 + if (setsockopt(fd, IPPROTO_IPV6, IP_MULTICAST_TTL, &ttl, 1) < 0) +#else /* INET6 */ if (setsockopt(fd, IPPROTO_IP, IP_MULTICAST_TTL, &ttl, 1) < 0) +#endif /* INET6 */ debug(50, 1) ("comm_set_mcast_ttl: FD %d, TTL: %d: %s\n", fd, mcast_ttl, xstrerror()); @@ -55,8 +59,11 @@ { #ifdef IP_MULTICAST_TTL int fd = theInIcpConnection; - +#if INET6 + struct ipv6_mreq mr; +#else struct ip_mreq mr; +#endif int i; int x; char c = 0; @@ -69,17 +76,27 @@ for (i = 0; i < (int) ia->count; i++) { debug(7, 10) ("Listening for ICP requests on %s\n", 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, - - (char *) &mr, sizeof(struct ip_mreq)); +#if INET6 + mr.ipv6mr_multiaddr = *(ia->in_addrs + i); + mr.ipv6mr_interface = -1; /* ** FIXME ** we need specify an interface number */ + x = setsockopt(fd, IPPROTO_IPV6, IPV6_ADD_MEMBERSHIP /*IP_JOIN_GROUP*/, /* ** FIXME ** */ + (char *) &mr, sizeof(struct ipv6_mreq)); +#else + mr.imr_multiaddr = *(ia->in_addrs + i); + mr.imr_interface = INADDR_ANY_ASSIGN; + x = setsockopt(fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, + (char *) &mr, sizeof(struct ip_mreq)); +#endif if (x < 0) debug(7, 1) ("comm_join_mcast_groups: FD %d, [%s]\n", fd, INET_NTOA(*(ia->in_addrs + i))); - x = setsockopt(fd, IPPROTO_IP, IP_MULTICAST_LOOP, &c, 1); +#if INET6 + x = setsockopt(fd, IPPROTO_IPV6, IP_MULTICAST_LOOP, &c, 1); +#else + x = setsockopt(fd, IPPROTO_IP, IP_MULTICAST_LOOP, &c, 1); +#endif if (x < 0) debug(7, 1) ("Can't disable multicast loopback: %s\n", xstrerror()); Index: squid3/src/neighbors.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/neighbors.cc,v retrieving revision 1.23.4.3 retrieving revision 1.23.4.4 diff -u -r1.23.4.3 -r1.23.4.4 --- squid3/src/neighbors.cc 25 Apr 2005 13:41:05 -0000 1.23.4.3 +++ squid3/src/neighbors.cc 5 May 2005 09:22:02 -0000 1.23.4.4 @@ -1,6 +1,6 @@ /* - * $Id: neighbors.cc,v 1.23.4.3 2005/04/25 13:41:05 rmartinez Exp $ + * $Id: neighbors.cc,v 1.23.4.4 2005/05/05 09:22:02 rmartinez Exp $ * * DEBUG: section 15 Neighbor Routines * AUTHOR: Harvest Derived @@ -94,16 +94,16 @@ whichPeer(const struct SOCKADDR_IN * from) { int j; - u_short port = ntohs(from->sin_port); + u_short port = ntohs(PORT_FROM_SA(*from)); - struct IN_ADDR ip = from->sin_addr; + struct IN_ADDR ip = ADDR_FROM_SA(*from); peer *p = NULL; debug(15, 3) ("whichPeer: from %s port %d\n", INET_NTOA(ip), port); for (p = Config.peers; p; p = p->next) { for (j = 0; j < p->n_addresses; j++) { - if (ip.s_addr == p->addresses[j].s_addr && port == p->icp.port) { + if (ADDR_EQUALS(ip, p->addresses[j]) && port == p->icp.port) { return p; } } @@ -540,7 +540,7 @@ continue; for (s = Config.Sockaddr.http; s; s = s->next) { - if (thisPeer->http_port != ntohs(s->s.sin_port)) + if (thisPeer->http_port != ntohs(PORT_FROM_SA(s->s))) continue; debug(15, 1) ("WARNING: Peer looks like this host\n"); @@ -563,7 +563,7 @@ echo_hdr.reqnum = 0; echo_hdr.flags = 0; echo_hdr.pad = 0; - echo_hdr.shostid = name.sin_addr.s_addr; +// Rafa echo_hdr.shostid = name.sin_addr.s_addr; sep = getservbyname("echo", "udp"); echo_port = sep ? ntohs((u_short) sep->s_port) : 7; } @@ -731,7 +731,7 @@ icmpSourcePing(ia->in_addrs[ia->cur], &echo_hdr, url); } else { FAMILY_FROM_SA(to_addr) = AF_INET; - to_addr.sin_addr = ia->in_addrs[ia->cur]; + ADDR_FROM_SA(to_addr) = ia->in_addrs[ia->cur]; PORT_FROM_SA(to_addr) = htons(echo_port); query = _icp_common_t::createMessage(ICP_SECHO, 0, url, reqnum, 0); icpUdpSend(theOutIcpConnection, @@ -992,10 +992,10 @@ for (np = non_peers; np; np = np->next) { - if (np->in_addr.sin_addr.s_addr != from->sin_addr.s_addr) + if (!ADDR_EQUALS(np->in_addr,ADDR_FROM_SA(*from))) continue; - PORT_FROM_SA(if (np->in_addr) != from->sin_port) + if (PORT_FROM_SA(np->in_addr) != PORT_FROM_SA(*from)) continue; break; @@ -1004,11 +1004,11 @@ if (np == NULL) { np = (peer *)xcalloc(1, sizeof(peer)); - np->in_addr.sin_addr = from->sin_addr; - PORT_FROM_SA(np->in_addr) = from->sin_port; - np->icp.port = ntohl(from->sin_port); + ADDR_FROM_SA(np->in_addr) = ADDR_FROM_SA(*from); + PORT_FROM_SA(np->in_addr) = PORT_FROM_SA(*from); + np->icp.port = ntohl(PORT_FROM_SA(*from)); np->type = PEER_NONE; - np->host = xstrdup(INET_NTOA(from->sin_addr)); + np->host = xstrdup(SA_NTOA(*from)); np->next = non_peers; non_peers = np; } @@ -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", SA_NTOA(*from)); } } else if (opcode == ICP_DENIED) { @@ -1319,8 +1319,8 @@ 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); + ADDR_FROM_SA(*ap) = p->addresses[0]; + PORT_FROM_SA(*ap) = htons(p->icp.port); if (p->type == PEER_MULTICAST) peerCountMcastPeersSchedule(p, 10); @@ -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/", SA_NTOA(p->in_addr)); fake = storeCreateEntry(url, url, request_flags(), METHOD_GET); psstate = new ps_state; psstate->request = requestLink(urlParse(METHOD_GET, url)); Index: squid3/src/send-announce.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/send-announce.cc,v retrieving revision 1.3.10.1 retrieving revision 1.3.10.2 diff -u -r1.3.10.1 -r1.3.10.2 --- squid3/src/send-announce.cc 25 Apr 2005 13:43:01 -0000 1.3.10.1 +++ squid3/src/send-announce.cc 5 May 2005 09:22:11 -0000 1.3.10.2 @@ -1,6 +1,6 @@ /* - * $Id: send-announce.cc,v 1.3.10.1 2005/04/25 13:43:01 rmartinez Exp $ + * $Id: send-announce.cc,v 1.3.10.2 2005/05/05 09:22:11 rmartinez Exp $ * * DEBUG: section 27 Cache Announcer * AUTHOR: Duane Wessels @@ -110,7 +110,7 @@ memset(&S, '\0', sizeof(S)); FAMILY_FROM_SA(S) = AF_INET; PORT_FROM_SA(S) = htons(port); - S.sin_addr = ia->in_addrs[0]; + ADDR_FROM_SA(S) = ia->in_addrs[0]; assert(theOutIcpConnection > 0); x = comm_udp_sendto(theOutIcpConnection, &S, sizeof(S), Index: squid3/src/stat.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/stat.cc,v retrieving revision 1.24.4.1 retrieving revision 1.24.4.2 diff -u -r1.24.4.1 -r1.24.4.2 --- squid3/src/stat.cc 25 Apr 2005 13:43:24 -0000 1.24.4.1 +++ squid3/src/stat.cc 5 May 2005 09:22:21 -0000 1.24.4.2 @@ -1,5 +1,5 @@ /* - * $Id: stat.cc,v 1.24.4.1 2005/04/25 13:43:24 rmartinez Exp $ + * $Id: stat.cc,v 1.24.4.2 2005/05/05 09:22:21 rmartinez Exp $ * * DEBUG: section 18 Cache Manager Statistics * AUTHOR: Harvest Derived @@ -1611,11 +1611,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", - INET_NTOA(conn->peer.sin_addr), - ntohs(conn->peer.sin_port)); + SA_NTOA(conn->peer), + ntohs(PORT_FROM_SA(conn->peer))); storeAppendPrintf(s, "\tme: %s:%d\n", - INET_NTOA(conn->me.sin_addr), - ntohs(conn->me.sin_port)); + SA_NTOA(conn->me), + ntohs(PORT_FROM_SA(conn->me))); storeAppendPrintf(s, "\tnrequests: %d\n", conn->nrequests); } Index: squid3/src/tools.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/tools.cc,v retrieving revision 1.22.2.2 retrieving revision 1.22.2.3 diff -u -r1.22.2.2 -r1.22.2.3 --- squid3/src/tools.cc 25 Apr 2005 13:43:51 -0000 1.22.2.2 +++ squid3/src/tools.cc 5 May 2005 09:22:33 -0000 1.22.2.3 @@ -1,6 +1,6 @@ /* - * $Id: tools.cc,v 1.22.2.2 2005/04/25 13:43:51 rmartinez Exp $ + * $Id: tools.cc,v 1.22.2.3 2005/05/05 09:22:33 rmartinez Exp $ * * DEBUG: section 21 Misc Functions * AUTHOR: Harvest Derived @@ -568,22 +568,22 @@ memcpy(&sa, &any_addr, sizeof(sa)); - if (Config.Sockaddr.http && sa.s_addr == any_addr.s_addr) - memcpy(&sa, &Config.Sockaddr.http->s.sin_addr, sizeof(sa)); + if (Config.Sockaddr.http && ADDR_IS_ANYADDR(sa)) + memcpy(&sa, &ADDR_FROM_SA(Config.Sockaddr.http->s), sizeof(sa)); #if USE_SSL - if (Config.Sockaddr.https && sa.s_addr == any_addr.s_addr) - memcpy(&sa, &Config.Sockaddr.https->http.s.sin_addr, sizeof(sa)); + if (Config.Sockaddr.https && ADDR_IS_ANYADDR(sa)) + memcpy(&sa, &ADDR_FROM_SA(Config.Sockaddr.https->http.s), sizeof(sa)); #endif /* * If the first http_port address has a specific address, try a * reverse DNS lookup on it. */ - if (sa.s_addr != any_addr.s_addr) { + if (!ADDR_IS_ANYADDR(sa)) { h = gethostbyaddr((char *) &sa, - sizeof(sa), AF_INET); + sizeof(sa), AF_FAMILY); /* FIXME, since we search for all */ if (h != NULL) { /* DNS lookup successful */ Index: squid3/src/tunnel.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/tunnel.cc,v retrieving revision 1.13 retrieving revision 1.13.4.1 diff -u -r1.13 -r1.13.4.1 --- squid3/src/tunnel.cc 28 Dec 2004 03:13:36 -0000 1.13 +++ squid3/src/tunnel.cc 5 May 2005 09:22:44 -0000 1.13.4.1 @@ -1,6 +1,6 @@ /* - * $Id: tunnel.cc,v 1.13 2004/12/28 03:13:36 squidadm Exp $ + * $Id: tunnel.cc,v 1.13.4.1 2005/05/05 09:22:44 rmartinez Exp $ * * DEBUG: section 26 Secure Sockets Layer Proxy * AUTHOR: Duane Wessels @@ -593,7 +593,7 @@ * be allowed. yuck, I know. */ - if (request->client_addr.s_addr != no_addr.s_addr) { + if (!ADDR_IS_NOADDR(request->client_addr)) { /* * Check if this host is allowed to fetch MISSES from us (miss_access) */ Index: squid3/src/wccp.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/wccp.cc,v retrieving revision 1.10.2.2 retrieving revision 1.10.2.3 diff -u -r1.10.2.2 -r1.10.2.3 --- squid3/src/wccp.cc 25 Apr 2005 13:44:03 -0000 1.10.2.2 +++ squid3/src/wccp.cc 5 May 2005 09:22:54 -0000 1.10.2.3 @@ -1,6 +1,6 @@ /* - * $Id: wccp.cc,v 1.10.2.2 2005/04/25 13:44:03 rmartinez Exp $ + * $Id: wccp.cc,v 1.10.2.3 2005/05/05 09:22:54 rmartinez Exp $ * * DEBUG: section 80 WCCP Support * AUTHOR: Glenn Chisholm @@ -32,6 +32,14 @@ * 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 ? */ +#endif #include "squid.h" #include "comm.h" @@ -124,7 +132,7 @@ last_assign_buckets_change = 0; number_caches = 0; - if (Config.Wccp.router.s_addr != any_addr.s_addr) + if (!ADDR_EQUALS(Config.Wccp.router, any_addr)) if (!eventFind(wccpHereIam, NULL)) eventAdd("wccpHereIam", wccpHereIam, NULL, 5.0, 1); } @@ -138,7 +146,7 @@ socklen_t local_len, router_len; debug(80, 5) ("wccpConnectionOpen: Called\n"); - if (Config.Wccp.router.s_addr == any_addr.s_addr) { + if (ADDR_IS_ANYADDR(Config.Wccp.router)) { debug(1, 1) ("WCCP Disabled.\n"); return; } @@ -162,7 +170,7 @@ debug(1, 1) ("Accepting WCCP messages on port %d, FD %d.\n", (int) port, theInWccpConnection); - if (Config.Wccp.outgoing.s_addr != no_addr.s_addr) { + if (!ADDR_IS_NOADDR(Config.Wccp.outgoing)) { theOutWccpConnection = comm_open(SOCK_DGRAM, IPPROTO_UDP, Config.Wccp.outgoing, @@ -192,7 +200,7 @@ memset(&router, '\0', router_len); FAMILY_FROM_SA(router) = AF_INET; PORT_FROM_SA(router) = htons(port); - router.sin_addr = Config.Wccp.router; + ADDR_FROM_SA(router) = Config.Wccp.router; if (connect(theOutWccpConnection, (struct sockaddr *) &router, router_len)) fatal("Unable to connect WCCP out socket"); @@ -204,7 +212,7 @@ if (getsockname(theOutWccpConnection, (struct sockaddr *) &local, &local_len)) fatal("Unable to getsockname on WCCP out socket"); - local_ip.s_addr = local.sin_addr.s_addr; + local_ip = ADDR_FROM_SA(local); } void @@ -266,7 +274,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), + SA_NTOA(from), (unsigned) ntohl(wccp_i_see_you.type), (unsigned) ntohl(wccp_i_see_you.version), (unsigned) ntohl(wccp_i_see_you.change), @@ -276,7 +284,7 @@ if (len < 0) return; - if (Config.Wccp.router.s_addr != from.sin_addr.s_addr) + if (!ADDR_EQUALS(Config.Wccp.router,ADDR_FROM_SA(from))) return; if ((unsigned) ntohl(wccp_i_see_you.version) != (unsigned) Config.Wccp.version) @@ -287,7 +295,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)); + SA_NTOA(from), (int) ntohl(wccp_i_see_you.number)); return; } @@ -333,11 +341,15 @@ for (loop = 0; loop < (unsigned) ntohl(wccp_i_see_you.number); loop++) { assert(loop < WCCP_ACTIVE_CACHES); +#ifdef INET6 +// Rafa +#else if (wccp_i_see_you.wccp_cache_entry[loop].ip_addr.s_addr < local_ip.s_addr) return 0; - if (wccp_i_see_you.wccp_cache_entry[loop].ip_addr.s_addr == local_ip.s_addr) found = 1; +#endif + } return found; @@ -368,6 +380,7 @@ int buckets_per_cache; unsigned int loop; int bucket = 0; +// Rafa int *caches; int cache_len; char *buf; @@ -401,7 +414,7 @@ for (loop = 0; loop < number_caches; loop++) { int i; xmemcpy(&caches[loop], - &wccp_i_see_you.wccp_cache_entry[loop].ip_addr.s_addr, + &wccp_i_see_you.wccp_cache_entry[loop].ip_addr, sizeof(*caches)); for (i = 0; i < buckets_per_cache; i++) {