--------------------- PatchSet 1345 Date: 2005/05/06 10:45:15 Author: rmartinez Branch: squid3-ipv6 Tag: (none) Log: Masking issues. Shorters Macros. Module ready Members: src/client_side.cc:1.68.2.4->1.68.2.5 Index: squid3/src/client_side.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/client_side.cc,v retrieving revision 1.68.2.4 retrieving revision 1.68.2.5 diff -u -r1.68.2.4 -r1.68.2.5 --- squid3/src/client_side.cc 5 May 2005 09:19:04 -0000 1.68.2.4 +++ squid3/src/client_side.cc 6 May 2005 10:45:15 -0000 1.68.2.5 @@ -1,6 +1,6 @@ /* - * $Id: client_side.cc,v 1.68.2.4 2005/05/05 09:19:04 rmartinez Exp $ + * $Id: client_side.cc,v 1.68.2.5 2005/05/06 10:45:15 rmartinez Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -1786,7 +1786,7 @@ http->uri = (char *)xcalloc(url_sz, 1); snprintf(http->uri, url_sz, "%s://%s:%d%s", http->getConn()->port->protocol, - INET_NTOA(ADDR_FROM_SA(http->getConn()->me)), + SA_NTOA(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) { @@ -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(ADDR_FROM_SA(http->getConn()->me)), + SA_NTOA(http->getConn()->me), vport, url); debug(33, 5) ("ACCEL VPORT REWRITE: '%s'\n", http->uri); } @@ -1830,7 +1830,7 @@ http->uri = (char *)xcalloc(url_sz, 1); snprintf(http->uri, url_sz, "%s://%s:%d%s", http->getConn()->port->protocol, - INET_NTOA(ADDR_FROM_SA(http->getConn()->me)), + SA_NTOA(http->getConn()->me), ntohs(PORT_FROM_SA(http->getConn()->me)), url); debug(33, 5) ("TRANSPARENT REWRITE: '%s'\n", http->uri); } @@ -2759,7 +2759,7 @@ clientHttpRequest *http = (clientHttpRequest *)data; debug(33, 1) ("WARNING: Closing client %s connection due to lifetime timeout\n", - INET_NTOA(ADDR_FROM_SA(http->getConn()->peer))); + SA_NTOA(http->getConn()->peer)); debug(33, 1) ("\t%s\n", http->uri); comm_close(fd); } @@ -2787,10 +2787,16 @@ ConnStateData *result = new ConnStateData; result->peer = *peer; result->log_addr = ADDR_FROM_SA(*peer); -#ifdef INET6 -#else - result->log_addr.s_addr &= Config.Addrs.client_netmask.s_addr; -#endif + + 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->me = *me; result->fd = fd; result->in.buf = (char *)memAllocBuf(CLIENT_REQ_BUF_SZ, &result->in.allocatedSize); @@ -3096,7 +3102,7 @@ s->transparent ? "transparently proxied" : s->accel ? "accelerated" : "", - INET_NTOA(ADDR_FROM_SA(s->s)), (int) ntohs(PORT_FROM_SA(s->s)), fd); + SA_NTOA(s->s), (int) ntohs(PORT_FROM_SA(s->s)), fd); HttpSockets[NHttpSockets++] = fd; } @@ -3118,7 +3124,7 @@ if (s->sslContext == NULL) { debug(1, 1) ("Can not accept HTTPS connections at %s, port %d\n", - INET_NTOA(ADDR_FROM_SA(s->http.s)), (int) ntohs(PORT_FROM_SA(s->http.s))); + SA_NTOA(s->http.s), (int) ntohs(PORT_FROM_SA(s->http.s))); } enter_suid(); @@ -3136,7 +3142,7 @@ comm_accept(fd, httpsAccept, s); debug(1, 1) ("Accepting HTTPS connections at %s, port %d, FD %d.\n", - INET_NTOA(ADDR_FROM_SA(s->http.s)), (int) ntohs(PORT_FROM_SA(s->http.s)), fd); + SA_NTOA(s->http.s), (int) ntohs(PORT_FROM_SA(s->http.s)), fd); HttpSockets[NHttpSockets++] = fd; }