--------------------- PatchSet 4632 Date: 2007/05/20 11:07:11 Author: amosjeffries Branch: squid3-ipv6 Tag: (none) Log: Rollout to pconn, forward, ESI, and other areas. Members: src/ESI.cc:1.12.4.4->1.12.4.5 src/client_side.cc:1.68.2.28->1.68.2.29 src/client_side.h:1.7.10.6->1.7.10.7 src/client_side_reply.cc:1.57.4.16->1.57.4.17 src/client_side_reply.h:1.6.10.3->1.6.10.4 src/client_side_request.cc:1.33.4.14->1.33.4.15 src/comm.cc:1.47.2.25->1.47.2.26 src/forward.cc:1.35.4.20->1.35.4.21 src/forward.h:1.9.4.4->1.9.4.5 src/http.cc:1.43.4.18->1.43.4.19 src/pconn.cc:1.10.6.6->1.10.6.7 src/pconn.h:1.2.8.4->1.2.8.5 src/redirect.cc:1.15.4.9->1.15.4.10 src/stat.cc:1.24.4.10->1.24.4.11 Index: squid3/src/ESI.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ESI.cc,v retrieving revision 1.12.4.4 retrieving revision 1.12.4.5 diff -u -r1.12.4.4 -r1.12.4.5 --- squid3/src/ESI.cc 18 May 2007 17:40:55 -0000 1.12.4.4 +++ squid3/src/ESI.cc 20 May 2007 11:07:11 -0000 1.12.4.5 @@ -1,6 +1,6 @@ /* - * $Id: ESI.cc,v 1.12.4.4 2007/05/18 17:40:55 amosjeffries Exp $ + * $Id: ESI.cc,v 1.12.4.5 2007/05/20 11:07:11 amosjeffries Exp $ * * DEBUG: section 86 ESI processing * AUTHOR: Robert Collins @@ -53,6 +53,7 @@ #include "ESIExpression.h" #include "HttpRequest.h" #include "MemBuf.h" +#include "IPAddress.h" /* quick reference on behaviour here. * The ESI specification 1.0 requires the ESI processor to be able to @@ -1451,7 +1452,7 @@ /* don't touch incoming, it's a pointer into buffered anyway */ } -extern ErrorState *clientBuildError (err_type, http_status, char const *, struct IN_ADDR *, HttpRequest *); +extern ErrorState *clientBuildError (err_type, http_status, char const *, IPAddress &, HttpRequest *); /* This can ONLY be used before we have sent *any* data to the client */ Index: squid3/src/client_side.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/client_side.cc,v retrieving revision 1.68.2.28 retrieving revision 1.68.2.29 diff -u -r1.68.2.28 -r1.68.2.29 --- squid3/src/client_side.cc 19 May 2007 16:02:12 -0000 1.68.2.28 +++ squid3/src/client_side.cc 20 May 2007 11:07:14 -0000 1.68.2.29 @@ -1,6 +1,6 @@ /* - * $Id: client_side.cc,v 1.68.2.28 2007/05/19 16:02:12 amosjeffries Exp $ + * $Id: client_side.cc,v 1.68.2.29 2007/05/20 11:07:14 amosjeffries Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -161,7 +161,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(const IPAddress &peer, const IPAddress &me, int fd, http_port_list *port); int ClientSocketContext::fd() const @@ -602,8 +602,7 @@ { debugs(33, 3, "ConnStateData::close: FD " << fd); openReference = NULL; -/* FIXME INET6 : drop temp conversion */ IPAddress tmp(peer.sin_addr); - clientdbEstablished(tmp, -1); /* decrement */ + clientdbEstablished(peer, -1); /* decrement */ assert(areAllContextsForThisConnection()); freeAllContexts(); @@ -1712,6 +1711,7 @@ int vhost = conn->port->vhost; int vport = conn->port->vport; char *host; + char ntoabuf[MAX_IPSTRLEN]; http->flags.accel = 1; @@ -1764,8 +1764,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); + http->getConn()->me.NtoA(ntoabuf,MAX_IPSTRLEN), + http->getConn()->me.GetPort(), url); debugs(33, 5, "ACCEL VPORT REWRITE: '" << http->uri << "'"); } else if (vport > 0) { /* Put the local socket IP address as the hostname, but static port */ @@ -1773,7 +1773,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), + http->getConn()->me.NtoA(ntoabuf,MAX_IPSTRLEN), vport, url); debugs(33, 5, "ACCEL VPORT REWRITE: '" << http->uri << "'"); } @@ -1783,6 +1783,7 @@ prepareTransparentURL(ConnStateData::Pointer & conn, ClientHttpRequest *http, char *url, const char *req_hdr) { char *host; + char ntoabuf[MAX_IPSTRLEN]; http->flags.transparent = 1; @@ -1804,8 +1805,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); + http->getConn()->me.NtoA(ntoabuf,MAX_IPSTRLEN), + http->getConn()->me.GetPort(), url); debugs(33, 5, "TRANSPARENT REWRITE: '" << http->uri << "'"); } } @@ -2086,9 +2087,10 @@ debugs(33, 1, "Config 'request_header_max_size'= " << Config.maxRequestHeaderSize << " bytes."); clientReplyContext *repContext = dynamic_cast(node->data.getRaw()); assert (repContext); +/* FIXME INET6 : drop temp conversion */ IPAddress tmp(conn->peer); repContext->setReplyToError(ERR_TOO_BIG, HTTP_REQUEST_ENTITY_TOO_LARGE, METHOD_NONE, NULL, - &conn->peer.sin_addr, NULL, NULL, NULL); + tmp, NULL, NULL, NULL); context->registerWithConn(); context->pullData(); } @@ -2139,8 +2141,7 @@ debugs(33, 1, "clientProcessRequest: Invalid Request"); 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); + repContext->setReplyToError(ERR_INVALID_REQ, HTTP_BAD_REQUEST, method, NULL, conn->peer, NULL, conn->in.buf, NULL); assert(context->http->out.offset == 0); context->pullData(); conn->flags.readMoreRequests = false; @@ -2152,9 +2153,7 @@ debugs(33, 5, "Invalid URL: " << http->uri); clientReplyContext *repContext = dynamic_cast(node->data.getRaw()); assert (repContext); - repContext->setReplyToError( - ERR_INVALID_URL, HTTP_BAD_REQUEST, method, http->uri, - &conn->peer.sin_addr, NULL, NULL, NULL); + repContext->setReplyToError(ERR_INVALID_URL, HTTP_BAD_REQUEST, method, http->uri, conn->peer, NULL, NULL, NULL); assert(context->http->out.offset == 0); context->pullData(); conn->flags.readMoreRequests = false; @@ -2169,9 +2168,7 @@ debugs(33, 5, "Failed to parse request headers:\n" << HttpParserHdrBuf(hp)); clientReplyContext *repContext = dynamic_cast(node->data.getRaw()); assert (repContext); - repContext->setReplyToError( - ERR_INVALID_URL, HTTP_BAD_REQUEST, method, http->uri, - &conn->peer.sin_addr, NULL, NULL, NULL); + repContext->setReplyToError(ERR_INVALID_URL, HTTP_BAD_REQUEST, method, http->uri, conn->peer, NULL, NULL, NULL); assert(context->http->out.offset == 0); context->pullData(); conn->flags.readMoreRequests = false; @@ -2216,7 +2213,7 @@ assert (repContext); repContext->setReplyToError(ERR_UNSUP_REQ, HTTP_NOT_IMPLEMENTED, request->method, NULL, - &conn->peer.sin_addr, request, NULL, NULL); + conn->peer, request, NULL, NULL); assert(context->http->out.offset == 0); context->pullData(); conn->flags.readMoreRequests = false; @@ -2230,7 +2227,7 @@ assert (repContext); repContext->setReplyToError(ERR_INVALID_REQ, HTTP_LENGTH_REQUIRED, request->method, NULL, - &conn->peer.sin_addr, request, NULL, NULL); + conn->peer, request, NULL, NULL); assert(context->http->out.offset == 0); context->pullData(); conn->flags.readMoreRequests = false; @@ -2263,7 +2260,7 @@ assert (repContext); repContext->setReplyToError(ERR_TOO_BIG, HTTP_REQUEST_ENTITY_TOO_LARGE, METHOD_NONE, NULL, - &conn->peer.sin_addr, http->request, NULL, NULL); + conn->peer, http->request, NULL, NULL); assert(context->http->out.offset == 0); context->pullData(); conn->flags.readMoreRequests = false; @@ -2650,8 +2647,7 @@ clientLifetimeTimeout(int fd, void *data) { ClientHttpRequest *http = (ClientHttpRequest *)data; - debugs(33, 1, "WARNING: Closing client " << inet_ntoa(http->getConn()->peer.sin_addr) << - " connection due to lifetime timeout"); + debugs(33, 1, "WARNING: Closing client " << http->getConn()->peer << " connection due to lifetime timeout"); debugs(33, 1, "\t" << http->uri); comm_close(fd); } @@ -2674,13 +2670,14 @@ ConnStateData * -connStateCreate(struct sockaddr_in *peer, struct sockaddr_in *me, int fd, http_port_list *port) +connStateCreate(const IPAddress &peer, const IPAddress &me, int fd, http_port_list *port) { ConnStateData *result = new ConnStateData; - result->peer = *peer; - result->log_addr = peer->sin_addr; - result->log_addr.s_addr &= Config.Addrs.client_netmask.s_addr; - result->me = *me; + result->peer = peer; + result->log_addr = peer; +/* FIXME INET6 : drop temp conversion when netmask is an unsigned int */ IPAddress tmp(Config.Addrs.client_netmask); + result->log_addr.ApplyMask(tmp.GetCIDR()); + result->me = me; result->fd = fd; result->in.buf = (char *)memAllocBuf(CLIENT_REQ_BUF_SZ, &result->in.allocatedSize); result->port = cbdataReference(port); @@ -2690,9 +2687,8 @@ IPAddress dst; -/* FIXME INET6 : drop temp conversion */ IPAddress tmpme(*me); IPAddress tmppeer(*peer); - if (clientNatLookup(fd, tmpme, tmppeer, dst) == 0) { - dst.GetSockAddr(result->me); /* XXX This should be moved to another field */ + if (clientNatLookup(fd, me, peer, dst) == 0) { + result-> me = dst; /* XXX This should be moved to another field */ result->transparent(true); } } @@ -2746,7 +2742,8 @@ debugs(33, 4, "httpAccept: FD " << newfd << ": accepted"); fd_note(newfd, "client http connect"); - connState = connStateCreate(&details->peer, &details->me, newfd, s); +/* FIXME INET6 : drop tem conversion */ IPAddress tmppeer(details->peer), tmpme(details->me); + connState = connStateCreate(tmppeer, tmpme, newfd, s); comm_add_close_handler(newfd, connStateFree, connState); if (Config.onoff.log_fqdn) Index: squid3/src/client_side.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/client_side.h,v retrieving revision 1.7.10.6 retrieving revision 1.7.10.7 diff -u -r1.7.10.6 -r1.7.10.7 --- squid3/src/client_side.h 11 May 2007 16:05:41 -0000 1.7.10.6 +++ squid3/src/client_side.h 20 May 2007 11:07:15 -0000 1.7.10.7 @@ -1,6 +1,6 @@ /* - * $Id: client_side.h,v 1.7.10.6 2007/05/11 16:05:41 amosjeffries Exp $ + * $Id: client_side.h,v 1.7.10.7 2007/05/20 11:07:15 amosjeffries Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -126,7 +126,6 @@ bool connRegistered_; }; - /* A connection to a socket */ class ConnStateData : public BodyProducer, public RefCountable { @@ -179,11 +178,11 @@ */ ClientSocketContext::Pointer currentobject; - struct sockaddr_in peer; + IPAddress peer; - struct sockaddr_in me; + IPAddress me; - struct IN_ADDR log_addr; + IPAddress log_addr; char rfc931[USER_IDENT_SZ]; int nrequests; Index: squid3/src/client_side_reply.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/client_side_reply.cc,v retrieving revision 1.57.4.16 retrieving revision 1.57.4.17 diff -u -r1.57.4.16 -r1.57.4.17 --- squid3/src/client_side_reply.cc 19 May 2007 16:02:12 -0000 1.57.4.16 +++ squid3/src/client_side_reply.cc 20 May 2007 11:07:15 -0000 1.57.4.17 @@ -1,6 +1,6 @@ /* - * $Id: client_side_reply.cc,v 1.57.4.16 2007/05/19 16:02:12 amosjeffries Exp $ + * $Id: client_side_reply.cc,v 1.57.4.17 2007/05/20 11:07:15 amosjeffries Exp $ * * DEBUG: section 88 Client-side Reply Routines * AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c) @@ -60,9 +60,7 @@ /* Local functions */ extern "C" CSS clientReplyStatus; -extern ErrorState *clientBuildError(err_type, http_status, char const *, - - struct IN_ADDR *, HttpRequest *); +extern ErrorState *clientBuildError(err_type, http_status, char const *, IPAddress &, HttpRequest *); /* privates */ @@ -91,7 +89,7 @@ void clientReplyContext::setReplyToError( err_type err, http_status status, method_t method, char const *uri, - struct IN_ADDR *addr, HttpRequest * failedrequest, char *unparsedrequest, + IPAddress &addr, HttpRequest * failedrequest, char *unparsedrequest, AuthUserRequest * auth_user_request) { ErrorState *errstate = @@ -681,9 +679,7 @@ */ if (http->flags.accel && r->flags.loopdetect) { http->al.http.code = HTTP_FORBIDDEN; - err = - clientBuildError(ERR_ACCESS_DENIED, HTTP_FORBIDDEN, NULL, - &http->getConn()->peer.sin_addr, http->request); + err = clientBuildError(ERR_ACCESS_DENIED, HTTP_FORBIDDEN, NULL, http->getConn()->peer, http->request); createStoreEntry(r->method, request_flags()); errorAppendEntry(http->storeEntry(), err); triggerInitialStoreRead(); @@ -729,8 +725,7 @@ debugs(88, 4, "clientProcessOnlyIfCachedMiss: '" << 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); + err = clientBuildError(ERR_ONLY_IF_CACHED_MISS, HTTP_GATEWAY_TIMEOUT, NULL, http->getConn()->peer, http->request); removeClientStoreReference(&sc, http); startError(err); } @@ -785,9 +780,7 @@ if (EBIT_TEST(entry->flags, ENTRY_SPECIAL)) { http->logType = LOG_TCP_DENIED; - ErrorState *err = - clientBuildError(ERR_ACCESS_DENIED, HTTP_FORBIDDEN, NULL, - &http->getConn()->peer.sin_addr, http->request); + ErrorState *err = clientBuildError(ERR_ACCESS_DENIED, HTTP_FORBIDDEN, NULL, http->getConn()->peer, http->request); startError(err); return; } @@ -827,9 +820,7 @@ if (!Config2.onoff.enable_purge) { http->logType = LOG_TCP_DENIED; - ErrorState *err = - clientBuildError(ERR_ACCESS_DENIED, HTTP_FORBIDDEN, NULL, - &http->getConn()->peer.sin_addr, http->request); + ErrorState *err = clientBuildError(ERR_ACCESS_DENIED, HTTP_FORBIDDEN, NULL, http->getConn()->peer, http->request); startError(err); return; } @@ -1037,7 +1028,7 @@ if (http->out.size > 0x7FFF0000) { debugs(88, 1, "WARNING: closing FD " << fd << " to prevent counter overflow" ); - debugs(88, 1, "\tclient " << (inet_ntoa(http->getConn() != NULL ? http->getConn()->peer.sin_addr : no_addr)) ); + debugs(88, 1, "\tclient " << http->getConn()->peer ); debugs(88, 1, "\treceived " << http->out.size << " bytes" ); debugs(88, 1, "\tURI " << http->log_uri ); return 1; @@ -1047,7 +1038,7 @@ #if SIZEOF_OFF_T == 4 if (http->out.offset > 0x7FFF0000) { debugs(88, 1, "WARNING: closing FD " << fd << " to prevent counter overflow" ); - debugs(88, 1, "\tclient " << (inet_ntoa(http->getConn() != NULL ? http->getConn()->peer.sin_addr : no_addr)) ); + debugs(88, 1, "\tclient " << http->getConn()->peer ); debugs(88, 1, "\treceived " << http->out.size << " bytes (offset " << http->out.offset << ")" ); debugs(88, 1, "\tURI " << http->log_uri ); return 1; @@ -1740,10 +1731,11 @@ buildMaxBodySize(reply); if (http->isReplyBodyTooLarge(reply->content_length)) { - ErrorState *err = - clientBuildError(ERR_TOO_BIG, HTTP_FORBIDDEN, NULL, - http->getConn() != NULL ? &http->getConn()->peer.sin_addr : &no_addr, - http->request); +/* FIXME INET6 : check this getConn() usage is right after conversion */ + IPAddress tmp_noaddr; tmp_noaddr.SetNoAddr(); + ErrorState *err = clientBuildError(ERR_TOO_BIG, HTTP_FORBIDDEN, NULL, + http->getConn() != NULL ? http->getConn()->peer : tmp_noaddr, + http->request); removeClientStoreReference(&sc, http); HTTPMSGUNLOCK(reply); startError(err); @@ -1785,9 +1777,10 @@ if (page_id == ERR_NONE) page_id = ERR_ACCESS_DENIED; - err = - clientBuildError(page_id, HTTP_FORBIDDEN, NULL, - http->getConn() != NULL ? &http->getConn()->peer.sin_addr : &no_addr, +/* FIXME INET6 : check this getConn() usage is right after conversion. */ + IPAddress tmp_noaddr; tmp_noaddr.SetNoAddr(); + err = clientBuildError(page_id, HTTP_FORBIDDEN, NULL, + http->getConn() != NULL ? http->getConn()->peer : tmp_noaddr, http->request); removeClientStoreReference(&sc, http); @@ -2044,11 +2037,10 @@ ErrorState * clientBuildError(err_type page_id, http_status status, char const *url, - - struct IN_ADDR * src_addr, HttpRequest * request) + IPAddress &src_addr, HttpRequest * request) { ErrorState *err = errorCon(page_id, status, request); - err->src_addr = *src_addr; + err->src_addr = src_addr; if (url) err->url = xstrdup(url); Index: squid3/src/client_side_reply.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/client_side_reply.h,v retrieving revision 1.6.10.3 retrieving revision 1.6.10.4 diff -u -r1.6.10.3 -r1.6.10.4 --- squid3/src/client_side_reply.h 11 May 2007 16:05:41 -0000 1.6.10.3 +++ squid3/src/client_side_reply.h 20 May 2007 11:07:15 -0000 1.6.10.4 @@ -1,6 +1,6 @@ /* - * $Id: client_side_reply.h,v 1.6.10.3 2007/05/11 16:05:41 amosjeffries Exp $ + * $Id: client_side_reply.h,v 1.6.10.4 2007/05/20 11:07:15 amosjeffries Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -40,7 +40,7 @@ #include "clientStream.h" #include "StoreClient.h" #include "client_side_request.h" - +#include "IPAddress.h" class ErrorState; @@ -76,7 +76,7 @@ int storeOKTransferDone() const; int storeNotOKTransferDone() const; - void setReplyToError(err_type, http_status, method_t, char const *, struct IN_ADDR *, HttpRequest *, char *, AuthUserRequest *); + void setReplyToError(err_type, http_status, method_t, char const *, IPAddress &, HttpRequest *, char *, AuthUserRequest *); void createStoreEntry(method_t m, request_flags flags); void removeStoreReference(store_client ** scp, StoreEntry ** ep); void removeClientStoreReference(store_client **scp, ClientHttpRequest *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.14 retrieving revision 1.33.4.15 diff -u -r1.33.4.14 -r1.33.4.15 --- squid3/src/client_side_request.cc 19 May 2007 16:02:13 -0000 1.33.4.14 +++ squid3/src/client_side_request.cc 20 May 2007 11:07:15 -0000 1.33.4.15 @@ -1,6 +1,6 @@ /* - * $Id: client_side_request.cc,v 1.33.4.14 2007/05/19 16:02:13 amosjeffries Exp $ + * $Id: client_side_request.cc,v 1.33.4.15 2007/05/20 11:07:15 amosjeffries Exp $ * * DEBUG: section 85 Client-side Request Routines * AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c) @@ -460,12 +460,16 @@ clientStreamNode *node = (clientStreamNode *)http->client_stream.tail->prev->data; clientReplyContext *repContext = dynamic_cast(node->data.getRaw()); assert (repContext); +/* FIXME INET6 : check getConn()->peer usage correct after conversion */ + IPAddress tmpnoaddr; tmpnoaddr.SetNoAddr(); repContext->setReplyToError(page_id, status, http->request->method, NULL, - http->getConn() != NULL ? &http->getConn()->peer.sin_addr : &no_addr, http->request, - NULL, http->getConn() != NULL - && http->getConn()->auth_user_request ? http->getConn()-> - auth_user_request : http->request->auth_user_request); + http->getConn() != NULL ? http->getConn()->peer : tmpnoaddr, + http->request, + NULL, + http->getConn() != NULL && http->getConn()->auth_user_request ? + http->getConn()->auth_user_request : http->request->auth_user_request); + node = (clientStreamNode *)http->client_stream.tail->data; clientStreamRead(node, http, node->readBuffer); return; Index: squid3/src/comm.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/comm.cc,v retrieving revision 1.47.2.25 retrieving revision 1.47.2.26 diff -u -r1.47.2.25 -r1.47.2.26 --- squid3/src/comm.cc 17 May 2007 13:28:12 -0000 1.47.2.25 +++ squid3/src/comm.cc 20 May 2007 11:07:15 -0000 1.47.2.26 @@ -1,6 +1,6 @@ /* - * $Id: comm.cc,v 1.47.2.25 2007/05/17 13:28:12 amosjeffries Exp $ + * $Id: comm.cc,v 1.47.2.26 2007/05/20 11:07:15 amosjeffries Exp $ * * DEBUG: section 5 Socket Functions * AUTHOR: Harvest Derived @@ -720,21 +720,24 @@ comm_udp_recvfrom(int fd, void *buf, size_t len, int flags, IPAddress &from) { statCounter.syscalls.sock.recvfroms++; + socklen_t sz = 0; #if USE_IPV6 if( from.IsIPv6() ) { struct sockaddr_in6 s6addr; + sz = sizeof(struct sockaddr_in6); from.GetSockAddr(s6addr); debugs(5,8, "comm_udp_recvfrom: FD " << fd << " from IPv6 " << from); - return recvfrom(fd, buf, len, flags, (struct sockaddr*)&s6addr, (socklen_t*)sizeof(s6addr)); + return recvfrom(fd, buf, len, flags, (struct sockaddr*)&s6addr, &sz); } #endif if( from.IsIPv4() ) { struct sockaddr_in s4addr; + sz = sizeof(struct sockaddr_in); from.GetSockAddr(s4addr); debugs(5,8, "comm_udp_recvfrom: FD " << fd << " from IPv4 " << from); - return recvfrom(fd, buf, len, flags, (struct sockaddr*)&s4addr, (socklen_t*)sizeof(s4addr)); + return recvfrom(fd, buf, len, flags, (struct sockaddr*)&s4addr, &sz); } debugs( 5, 0, "ERROR: comm_udp_recvfrom does not understand the sockaddr* type of : " << from ); Index: squid3/src/forward.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/forward.cc,v retrieving revision 1.35.4.20 retrieving revision 1.35.4.21 diff -u -r1.35.4.20 -r1.35.4.21 --- squid3/src/forward.cc 17 May 2007 10:51:13 -0000 1.35.4.20 +++ squid3/src/forward.cc 20 May 2007 11:07:17 -0000 1.35.4.21 @@ -1,6 +1,6 @@ /* - * $Id: forward.cc,v 1.35.4.20 2007/05/17 10:51:13 amosjeffries Exp $ + * $Id: forward.cc,v 1.35.4.21 2007/05/20 11:07:17 amosjeffries Exp $ * * DEBUG: section 17 Request Forwarding * AUTHOR: Duane Wessels @@ -749,10 +749,10 @@ struct in_tproxy itp; #endif - struct IN_ADDR outgoing; + IPAddress outgoing; unsigned short tos; - struct IN_ADDR *client_addr = NULL; + IPAddress client_addr; assert(fs); assert(server_fd == -1); debugs(17, 3, "fwdConnectStart: " << url); @@ -773,7 +773,7 @@ #if LINUX_TPROXY if (request->flags.tproxy) - client_addr = &request->client_addr; + client_addr = request->client_addr; #endif @@ -808,11 +808,12 @@ tos = getOutgoingTOS(request); - debugs(17, 3, "fwdConnectStart: got addr " << inet_ntoa(outgoing) << ", tos " << tos); + debugs(17, 3, "fwdConnectStart: got addr " << outgoing << ", tos " << tos); +/* FIXM INET6 : drop temp conversion */ struct IN_ADDR tmp; outgoing.GetInAddr(tmp); fd = comm_openex(SOCK_STREAM, IPPROTO_TCP, - outgoing, + tmp, 0, COMM_NONBLOCKING, tos, @@ -1113,7 +1114,7 @@ void -FwdState::pconnPush(int fd, const char *host, int port, const char *domain, struct IN_ADDR *client_addr) +FwdState::pconnPush(int fd, const char *host, int port, const char *domain, IPAddress &client_addr) { fwdPconnPool->push(fd, host, port, domain, client_addr); } Index: squid3/src/forward.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/forward.h,v retrieving revision 1.9.4.4 retrieving revision 1.9.4.5 diff -u -r1.9.4.4 -r1.9.4.5 --- squid3/src/forward.h 22 Apr 2007 08:06:13 -0000 1.9.4.4 +++ squid3/src/forward.h 20 May 2007 11:07:17 -0000 1.9.4.5 @@ -7,6 +7,7 @@ class ErrorState; #include "comm.h" +#include "IPAddress.h" class FwdServer { @@ -43,7 +44,7 @@ bool checkRetry(); bool checkRetriable(); void dispatch(); - void pconnPush(int fd, const char *host, int port, const char *domain, struct IN_ADDR *client_addr); + void pconnPush(int fd, const char *host, int port, const char *domain, IPAddress &client_addr); bool dontRetry() { return flags.dont_retry; } @@ -104,7 +105,7 @@ flags; #if LINUX_NETFILTER - struct sockaddr_in src; + IPAddress src; #endif }; Index: squid3/src/http.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/http.cc,v retrieving revision 1.43.4.18 retrieving revision 1.43.4.19 diff -u -r1.43.4.18 -r1.43.4.19 --- squid3/src/http.cc 18 May 2007 17:41:00 -0000 1.43.4.18 +++ squid3/src/http.cc 20 May 2007 11:07:18 -0000 1.43.4.19 @@ -1,6 +1,6 @@ /* - * $Id: http.cc,v 1.43.4.18 2007/05/18 17:41:00 amosjeffries Exp $ + * $Id: http.cc,v 1.43.4.19 2007/05/20 11:07:18 amosjeffries Exp $ * * DEBUG: section 11 Hypertext Transfer Protocol (HTTP) * AUTHOR: Harvest Derived @@ -1149,7 +1149,7 @@ HttpStateData::processReplyBody() { - struct IN_ADDR *client_addr = NULL; + IPAddress client_addr; if (!flags.headers_parsed) { flags.do_next_read = 1; @@ -1204,7 +1204,7 @@ #if LINUX_TPROXY if (orig_request->flags.tproxy) - client_addr = &orig_request->client_addr; + client_addr = orig_request->client_addr; #endif Index: squid3/src/pconn.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/pconn.cc,v retrieving revision 1.10.6.6 retrieving revision 1.10.6.7 diff -u -r1.10.6.6 -r1.10.6.7 --- squid3/src/pconn.cc 18 May 2007 17:41:01 -0000 1.10.6.6 +++ squid3/src/pconn.cc 20 May 2007 11:07:18 -0000 1.10.6.7 @@ -1,6 +1,6 @@ /* - * $Id: pconn.cc,v 1.10.6.6 2007/05/18 17:41:01 amosjeffries Exp $ + * $Id: pconn.cc,v 1.10.6.7 2007/05/20 11:07:18 amosjeffries Exp $ * * DEBUG: section 48 Persistent Connections * AUTHOR: Duane Wessels @@ -175,17 +175,17 @@ /* ========== PconnPool PRIVATE FUNCTIONS ============================================ */ const char * - -PconnPool::key(const char *host, u_short port, const char *domain, struct IN_ADDR *client_address) +PconnPool::key(const char *host, u_short port, const char *domain, IPAddress &client_address) { LOCAL_ARRAY(char, buf, SQUIDHOSTNAMELEN * 2 + 10); + char ntoabuf[MAX_IPSTRLEN]; - if (domain && client_address) - snprintf(buf, SQUIDHOSTNAMELEN * 2 + 10, "%s:%d-%s/%s", host, (int) port, inet_ntoa(*client_address), domain); - else if (domain && (!client_address)) + if (domain && !client_address.IsAnyAddr()) + snprintf(buf, SQUIDHOSTNAMELEN * 2 + 10, "%s:%d-%s/%s", host, (int) port, client_address.NtoA(ntoabuf,MAX_IPSTRLEN), domain); + else if (domain && client_address.IsAnyAddr()) snprintf(buf, SQUIDHOSTNAMELEN * 2 + 10, "%s:%d/%s", host, (int) port, domain); - else if ((!domain) && client_address) - snprintf(buf, SQUIDHOSTNAMELEN * 2 + 10, "%s:%d-%s", host, (int) port, inet_ntoa(*client_address)); + else if ((!domain) && !client_address.IsAnyAddr()) + snprintf(buf, SQUIDHOSTNAMELEN * 2 + 10, "%s:%d-%s", host, (int) port, client_address.NtoA(ntoabuf,MAX_IPSTRLEN)); else snprintf(buf, SQUIDHOSTNAMELEN * 2 + 10, "%s:%d", host, (int) port); @@ -227,8 +227,7 @@ } void - -PconnPool::push(int fd, const char *host, u_short port, const char *domain, struct IN_ADDR *client_address) +PconnPool::push(int fd, const char *host, u_short port, const char *domain, IPAddress &client_address) { IdleConnList *list; @@ -275,7 +274,7 @@ */ int -PconnPool::pop(const char *host, u_short port, const char *domain, struct IN_ADDR *client_address, bool isRetriable) +PconnPool::pop(const char *host, u_short port, const char *domain, IPAddress &client_address, bool isRetriable) { IdleConnList *list; const char * aKey = key(host, port, domain, client_address); Index: squid3/src/pconn.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/pconn.h,v retrieving revision 1.2.8.4 retrieving revision 1.2.8.5 diff -u -r1.2.8.4 -r1.2.8.5 --- squid3/src/pconn.h 11 May 2007 16:05:42 -0000 1.2.8.4 +++ squid3/src/pconn.h 20 May 2007 11:07:18 -0000 1.2.8.5 @@ -48,15 +48,15 @@ PconnPool(const char *); void moduleInit(); - void push(int fd, const char *host, u_short port, const char *domain, struct IN_ADDR *client_address); - int pop(const char *host, u_short port, const char *domain, struct IN_ADDR *client_address, bool retriable); + void push(int fd, const char *host, u_short port, const char *domain, IPAddress &client_address); + int pop(const char *host, u_short port, const char *domain, IPAddress &client_address, bool retriable); void count(int uses); void dumpHist(StoreEntry *e); void unlinkList(IdleConnList *list) const; private: - static const char *key(const char *host, u_short port, const char *domain, struct IN_ADDR *client_address); + static const char *key(const char *host, u_short port, const char *domain, IPAddress &client_address); int hist[PCONN_HIST_SZ]; hash_table *table; Index: squid3/src/redirect.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/redirect.cc,v retrieving revision 1.15.4.9 retrieving revision 1.15.4.10 diff -u -r1.15.4.9 -r1.15.4.10 --- squid3/src/redirect.cc 18 May 2007 17:41:02 -0000 1.15.4.9 +++ squid3/src/redirect.cc 20 May 2007 11:07:18 -0000 1.15.4.10 @@ -1,6 +1,6 @@ /* - * $Id: redirect.cc,v 1.15.4.9 2007/05/18 17:41:02 amosjeffries Exp $ + * $Id: redirect.cc,v 1.15.4.10 2007/05/20 11:07:18 amosjeffries Exp $ * * DEBUG: section 61 Redirector * AUTHOR: Duane Wessels @@ -130,7 +130,11 @@ r = cbdataAlloc(redirectStateData); r->orig_url = xstrdup(http->uri); - r->client_addr = conn != NULL ? conn->log_addr : no_addr; + if(conn != NULL) +// FIXME INET6 : drop temp conversion should be: r->client_addr = conn->log_addr; + conn->log_addr.GetInAddr(r->client_addr); + else + r->client_addr = no_addr; r->client_ident = NULL; if (http->request->auth_user_request) Index: squid3/src/stat.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/stat.cc,v retrieving revision 1.24.4.10 retrieving revision 1.24.4.11 diff -u -r1.24.4.10 -r1.24.4.11 --- squid3/src/stat.cc 18 May 2007 17:41:02 -0000 1.24.4.10 +++ squid3/src/stat.cc 20 May 2007 11:07:18 -0000 1.24.4.11 @@ -1,5 +1,5 @@ /* - * $Id: stat.cc,v 1.24.4.10 2007/05/18 17:41:02 amosjeffries Exp $ + * $Id: stat.cc,v 1.24.4.11 2007/05/20 11:07:18 amosjeffries Exp $ * * DEBUG: section 18 Cache Manager Statistics * AUTHOR: Harvest Derived @@ -1647,6 +1647,7 @@ ClientHttpRequest *http; StoreEntry *e; int fd; + char buf[MAX_IPSTRLEN]; for (i = ClientActiveRequests.head; i; i = i->next) { const char *p = NULL; @@ -1663,11 +1664,11 @@ storeAppendPrintf(s, "\tin: buf %p, offset %ld, size %ld\n", conn->in.buf, (long int) conn->in.notYetUsed, (long int) conn->in.allocatedSize); storeAppendPrintf(s, "\tpeer: %s:%d\n", - inet_ntoa(conn->peer.sin_addr), - ntohs(conn->peer.sin_port)); + conn->peer.NtoA(buf,MAX_IPSTRLEN), + conn->peer.GetPort()); storeAppendPrintf(s, "\tme: %s:%d\n", - inet_ntoa(conn->me.sin_addr), - ntohs(conn->me.sin_port)); + conn->me.NtoA(buf,MAX_IPSTRLEN), + conn->me.GetPort()); storeAppendPrintf(s, "\tnrequests: %d\n", conn->nrequests); }