--------------------- PatchSet 4161 Date: 2007/04/05 06:49:04 Author: amosjeffries Branch: squid3-ipv6 Tag: (none) Log: patch cleaning. Rollout from client_side and client_db Members: src/client_db.cc:1.5.4.6->1.5.4.7 src/client_side.cc:1.68.2.12->1.68.2.13 src/client_side.h:1.7.10.3->1.7.10.4 Index: squid3/src/client_db.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/client_db.cc,v retrieving revision 1.5.4.6 retrieving revision 1.5.4.7 diff -u -r1.5.4.6 -r1.5.4.7 --- squid3/src/client_db.cc 5 Apr 2007 06:15:16 -0000 1.5.4.6 +++ squid3/src/client_db.cc 5 Apr 2007 06:49:04 -0000 1.5.4.7 @@ -1,6 +1,6 @@ /* - * $Id: client_db.cc,v 1.5.4.6 2007/04/05 06:15:16 amosjeffries Exp $ + * $Id: client_db.cc,v 1.5.4.7 2007/04/05 06:49:04 amosjeffries Exp $ * * DEBUG: section 0 Client Database * AUTHOR: Duane Wessels @@ -181,7 +181,7 @@ if (!Config.onoff.client_db) return 0; - key = (char *)INET_NTOA(addr); + key = inet_ntoa(addr); c = (ClientInfo *) hash_lookup(client_table, key); @@ -386,19 +386,15 @@ #if SQUID_SNMP -#ifdef INET6 -#error "Error. SQUID_SNMP is not ready for IPv6" -#endif struct IN_ADDR * - - client_entry(struct IN_ADDR *current) +client_entry(struct IN_ADDR *current) { ClientInfo *c = NULL; char *key; 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.12 retrieving revision 1.68.2.13 diff -u -r1.68.2.12 -r1.68.2.13 --- squid3/src/client_side.cc 1 Apr 2007 05:38:34 -0000 1.68.2.12 +++ squid3/src/client_side.cc 5 Apr 2007 06:49:04 -0000 1.68.2.13 @@ -1,6 +1,6 @@ /* - * $Id: client_side.cc,v 1.68.2.12 2007/04/01 05:38:34 amosjeffries Exp $ + * $Id: client_side.cc,v 1.68.2.13 2007/04/05 06:49:04 amosjeffries Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -166,7 +166,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 @@ -621,7 +621,7 @@ { debug(33, 3) ("ConnStateData::close: FD %d\n", fd); openReference = NULL; - /* FIXME INET6 : drop temp conversion */ IPAddress tmp(peer.sin_addr); +/* FIXME INET6 : drop temp conversion */ IPAddress tmp(peer.sin_addr); clientdbEstablished(tmp, -1); /* decrement */ assert(areAllContextsForThisConnection()); freeAllContexts(); @@ -1784,8 +1784,8 @@ http->uri = (char *)xcalloc(url_sz, 1); snprintf(http->uri, url_sz, "%s://%s:%d%s", http->getConn()->port->protocol, - SA_NTOA(http->getConn()->me), - ntohs(PORT_FROM_SA(http->getConn()->me)), url); + 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) { /* Put the local socket IP address as the hostname, but static port */ @@ -2149,7 +2149,7 @@ clientReplyContext *repContext = dynamic_cast(node->data.getRaw()); assert (repContext); repContext->setReplyToError(ERR_INVALID_REQ, HTTP_BAD_REQUEST, method, NULL, - &ADDR_FROM_SA(conn->peer), NULL, conn->in.buf, NULL); + &conn->peer.sin_addr, NULL, conn->in.buf, NULL); assert(context->http->out.offset == 0); context->pullData(); conn->flags.readMoreRequests = false; @@ -2163,7 +2163,7 @@ assert (repContext); repContext->setReplyToError( ERR_INVALID_URL, HTTP_BAD_REQUEST, method, http->uri, - &ADDR_FROM_SA(conn->peer), NULL, NULL, NULL); + &conn->peer.sin_addr, NULL, NULL, NULL); assert(context->http->out.offset == 0); context->pullData(); conn->flags.readMoreRequests = false; @@ -2180,7 +2180,7 @@ assert (repContext); repContext->setReplyToError( ERR_INVALID_URL, HTTP_BAD_REQUEST, method, http->uri, - &ADDR_FROM_SA(conn->peer), NULL, NULL, NULL); + &conn->peer.sin_addr, NULL, NULL, NULL); assert(context->http->out.offset == 0); context->pullData(); conn->flags.readMoreRequests = false; @@ -2210,10 +2210,10 @@ request->flags.internal = http->flags.internal; setLogUri (http, urlCanonicalClean(request)); - 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->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->http_ver = http_ver; if (!urlCheckRequest(request) || @@ -2223,7 +2223,7 @@ assert (repContext); repContext->setReplyToError(ERR_UNSUP_REQ, HTTP_NOT_IMPLEMENTED, request->method, NULL, - &ADDR_FROM_SA(conn->peer), request, NULL, NULL); + &conn->peer.sin_addr, request, NULL, NULL); assert(context->http->out.offset == 0); context->pullData(); conn->flags.readMoreRequests = false; @@ -2237,7 +2237,7 @@ assert (repContext); repContext->setReplyToError(ERR_INVALID_REQ, HTTP_LENGTH_REQUIRED, request->method, NULL, - &ADDR_FROM_SA(conn->peer), request, NULL, NULL); + &conn->peer.sin_addr, request, NULL, NULL); assert(context->http->out.offset == 0); context->pullData(); conn->flags.readMoreRequests = false; @@ -2275,7 +2275,7 @@ assert (repContext); repContext->setReplyToError(ERR_TOO_BIG, HTTP_REQUEST_ENTITY_TOO_LARGE, METHOD_NONE, NULL, - &ADDR_FROM_SA(conn->peer), http->request, NULL, NULL); + &conn->peer.sin_addr, http->request, NULL, NULL); assert(context->http->out.offset == 0); context->pullData(); conn->flags.readMoreRequests = false; @@ -2636,7 +2636,7 @@ clientReplyContext *repContext = dynamic_cast(node->data.getRaw()); assert (repContext); repContext->setReplyToError(ERR_LIFETIME_EXP, - HTTP_REQUEST_TIMEOUT, METHOD_NONE, "N/A", &ADDR_FROM_SA(conn->peer), + HTTP_REQUEST_TIMEOUT, METHOD_NONE, "N/A", &conn->peer.sin_addr, NULL, NULL, NULL); /* No requests can be outstanded */ assert(conn->chr == NULL); @@ -2683,7 +2683,7 @@ ClientHttpRequest *http = (ClientHttpRequest *)data; debug(33, 1) ("WARNING: Closing client %s connection due to lifetime timeout\n", - SA_NTOA(http->getConn()->peer)); + inet_ntoa(http->getConn()->peer.sin_addr)); debug(33, 1) ("\t%s\n", http->uri); comm_close(fd); } @@ -2706,21 +2706,12 @@ 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; - result->log_addr = ADDR_FROM_SA(*peer); - - unsigned int i; - char *p1,*p2; - /* apply netmask ** FIXME... review this ** */ - p1 = (char *)&result->log_addr; - p2 = (char *)&Config.Addrs.client_netmask; - for (i = 0; i < sizeof(struct IN_ADDR); i++) { - *(p1++) &= *(p2++); - } - + result->log_addr = peer->sin_addr; + result->log_addr.s_addr &= Config.Addrs.client_netmask.s_addr; result->me = *me; result->fd = fd; result->in.buf = (char *)memAllocBuf(CLIENT_REQ_BUF_SZ, &result->in.allocatedSize); @@ -2729,7 +2720,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 */ @@ -2810,7 +2801,6 @@ if (identChecklist.fastCheck()) identStart(&details->me, &details->peer, clientIdentDone, connState); - #endif connState->readSomeData(); @@ -2980,7 +2970,7 @@ comm_add_close_handler(newfd, connStateFree, connState); if (Config.onoff.log_fqdn) - fqdncache_gethostbyaddr(ADDR_FROM_SA(details->peer), FQDN_LOOKUP_IF_MISS); + fqdncache_gethostbyaddr(details->peer.sin_addr, FQDN_LOOKUP_IF_MISS); commSetTimeout(newfd, Config.Timeout.request, requestTimeout, connState); @@ -2988,11 +2978,11 @@ ACLChecklist identChecklist; - identChecklist.src_addr = ADDR_FROM_SA(details->peer); + identChecklist.src_addr = details->peer.sin_addr; - identChecklist.my_addr = ADDR_FROM_SA(details->me); + identChecklist.my_addr = details->me.sin_addr; - identChecklist.my_port = ntohs(PORT_FROM_SA(details->me)); + identChecklist.my_port = ntohs(details->me.sin_port); identChecklist.accessList = cbdataReference(Config.accessList.identLookup); @@ -3005,7 +2995,7 @@ commSetSelect(newfd, COMM_SELECT_READ, clientNegotiateSSL, connState, 0); - clientdbEstablished(ADDR_FROM_SA(details->peer), 1); + clientdbEstablished(details->peer.sin_addr, 1); incoming_sockets_accepted++; } @@ -3029,8 +3019,8 @@ enter_suid(); fd = comm_open(SOCK_STREAM, IPPROTO_TCP, - ADDR_FROM_SA(s->s), - ntohs(PORT_FROM_SA(s->s)), COMM_NONBLOCKING, "HTTP Socket"); + s->s.sin_addr, + ntohs(s->s.sin_port), COMM_NONBLOCKING, "HTTP Socket"); leave_suid(); if (fd < 0) @@ -3044,7 +3034,7 @@ s->transparent ? "transparently proxied" : s->accel ? "accelerated" : "", - SA_NTOA(s->s), (int) ntohs(PORT_FROM_SA(s->s)), fd); + inet_ntoa(s->s.sin_addr), (int) ntohs(s->s.sin_port), fd); HttpSockets[NHttpSockets++] = fd; } @@ -3066,14 +3056,14 @@ if (s->sslContext == NULL) { debug(1, 1) ("Can not accept HTTPS connections at %s, port %d\n", - SA_NTOA(s->http.s), (int) ntohs(PORT_FROM_SA(s->http.s))); + inet_ntoa(s->http.s.sin_addr), (int) ntohs(s->http.s.sin_port)); } enter_suid(); fd = comm_open(SOCK_STREAM, IPPROTO_TCP, - ADDR_FROM_SA(s->http.s), - ntohs(PORT_FROM_SA(s->http.s)), COMM_NONBLOCKING, "HTTPS Socket"); + s->http.s.sin_addr, + ntohs(s->http.s.sin_port), COMM_NONBLOCKING, "HTTPS Socket"); leave_suid(); if (fd < 0) @@ -3084,7 +3074,7 @@ comm_accept(fd, httpsAccept, s); debug(1, 1) ("Accepting HTTPS connections at %s, port %d, FD %d.\n", - SA_NTOA(s->http.s), (int) ntohs(PORT_FROM_SA(s->http.s)), 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.3 retrieving revision 1.7.10.4 diff -u -r1.7.10.3 -r1.7.10.4 --- squid3/src/client_side.h 5 Jan 2007 16:59:10 -0000 1.7.10.3 +++ squid3/src/client_side.h 5 Apr 2007 06:49:05 -0000 1.7.10.4 @@ -1,6 +1,6 @@ /* - * $Id: client_side.h,v 1.7.10.3 2007/01/05 16:59:10 hno Exp $ + * $Id: client_side.h,v 1.7.10.4 2007/04/05 06:49:05 amosjeffries Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -186,9 +186,9 @@ */ ClientSocketContext::Pointer currentobject; - 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];