--------------------- PatchSet 4569 Date: 2007/05/17 10:51:01 Author: amosjeffries Branch: squid3-ipv6 Tag: (none) Log: Rollout into HttpRequest fully for request generation. Members: NOTES-IPv6:1.1.2.18->1.1.2.19 src/ACLChecklist.cc:1.22.4.12->1.22.4.13 src/HttpRequest.cc:1.15.6.7->1.15.6.8 src/HttpRequest.h:1.10.6.10->1.10.6.11 src/access_log.cc:1.23.4.12->1.23.4.13 src/client_side.cc:1.68.2.24->1.68.2.25 src/client_side_request.cc:1.33.4.11->1.33.4.12 src/comm.cc:1.47.2.23->1.47.2.24 src/external_acl.cc:1.37.6.9->1.37.6.10 src/forward.cc:1.35.4.19->1.35.4.20 src/http.cc:1.43.4.16->1.43.4.17 src/icp_v2.cc:1.17.8.15->1.17.8.16 src/icp_v3.cc:1.5.8.7->1.5.8.8 src/internal.cc:1.5.8.7->1.5.8.8 src/neighbors.cc:1.23.4.19->1.23.4.20 src/net_db.cc:1.13.4.14->1.13.4.15 src/tunnel.cc:1.13.4.9->1.13.4.10 src/urn.cc:1.11.8.3->1.11.8.4 src/auth/digest/auth_digest.cc:1.18.4.11->1.18.4.12 Index: squid3/NOTES-IPv6 =================================================================== RCS file: /cvsroot/squid-sf//squid3/Attic/NOTES-IPv6,v retrieving revision 1.1.2.18 retrieving revision 1.1.2.19 diff -u -r1.1.2.18 -r1.1.2.19 --- squid3/NOTES-IPv6 16 May 2007 07:07:02 -0000 1.1.2.18 +++ squid3/NOTES-IPv6 17 May 2007 10:51:01 -0000 1.1.2.19 @@ -1,4 +1,4 @@ -$Id: NOTES-IPv6,v 1.1.2.18 2007/05/16 07:07:02 amosjeffries Exp $ +$Id: NOTES-IPv6,v 1.1.2.19 2007/05/17 10:51:01 amosjeffries Exp $ KNOWN BUGS: @@ -8,7 +8,43 @@ Solved for all known events now, but this may reccur at any time until conversion is completed. -PROBLEM: Pinger Rollout is not complete. + +... And a number of problems caused by the URI handling in Squid. (bug #1961) + +PROBLEM: Error page displays + "While trying to retrieve the URL: http://2001:200:0:8002:203:47ff:fea5:3085/" +TEST: Visit http://[2006:200:0:8002:203:47ff:fea5:3085]/ (a bad IPv6 address) + +PROBLEM: Wireshark reports DNS queries looking up hostname A record for + '2001:200:0:8002:203:47ff:fea5:3085' +Cause: Something is building the NtoA of IP and assuming its valid hostname. + (should be usng ToHostname() at the point the hostname is needed.) + +PROBLEM: www.kame.net resolves 203.*.*.* + We want it to prefer the IPv6 address in that result. + Find out why the AAAA lookup is not short-circuiting the A lookup. +TEST: Visit http://www.kame.net/ +TEST: Visit http://[2001:200:0:8002:203:47ff:fea5:3085]/ (aka www.kame.net) + + +.... cache.log lines detected showing problems: + (after a request for http://[2001:200:0:8002:203:47ff:fea5:3085]/ ) + + idnsRead: FD 7 recvfrom: (14) Bad address + + httpRequestFree: http://2001:200:0:8002:203:47ff:fea5:3085/ + + forward.cc(192) FwdState destructor done +2007/05/17 20:21:54.013| fd_close FD 16 http://2001:200:0:8002:203:47ff:fea5:3085/ +2007/05/17 20:21:54.013| commSetSelect: FD 16 type 1 + + commio_call_callback: called for 13 +2007/05/17 20:21:54.013| clientWriteComplete: FD 13, sz 2541, err 0, off 2541, len 0xb7b7bb9c +2007/05/17 20:21:54.013| clientReplyStatus: transfer is DONE +2007/05/17 20:21:54.013| clientReplyStatus: stream was not expected to complete! +2007/05/17 20:21:54.013| client_side.cc(1556) initiateClose: closing for STREAM_UNPLANNED_COMPLETE|STREAM_FAILED +2007/05/17 20:21:54.014| comm_close: FD 13 + TODO: Index: squid3/src/ACLChecklist.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ACLChecklist.cc,v retrieving revision 1.22.4.12 retrieving revision 1.22.4.13 diff -u -r1.22.4.12 -r1.22.4.13 --- squid3/src/ACLChecklist.cc 11 May 2007 16:05:40 -0000 1.22.4.12 +++ squid3/src/ACLChecklist.cc 17 May 2007 10:51:03 -0000 1.22.4.13 @@ -1,5 +1,5 @@ /* - * $Id: ACLChecklist.cc,v 1.22.4.12 2007/05/11 16:05:40 amosjeffries Exp $ + * $Id: ACLChecklist.cc,v 1.22.4.13 2007/05/17 10:51:03 amosjeffries Exp $ * * DEBUG: section 28 Access Control * AUTHOR: Duane Wessels @@ -571,7 +571,6 @@ checklist->request = HTTPMSGLOCK(request); checklist->src_addr = request->client_addr; checklist->my_addr = request->my_addr; - checklist->my_addr.SetPort(request->my_port); } #if USE_IDENT Index: squid3/src/HttpRequest.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/HttpRequest.cc,v retrieving revision 1.15.6.7 retrieving revision 1.15.6.8 diff -u -r1.15.6.7 -r1.15.6.8 --- squid3/src/HttpRequest.cc 11 May 2007 16:05:41 -0000 1.15.6.7 +++ squid3/src/HttpRequest.cc 17 May 2007 10:51:04 -0000 1.15.6.8 @@ -1,6 +1,6 @@ /* - * $Id: HttpRequest.cc,v 1.15.6.7 2007/05/11 16:05:41 amosjeffries Exp $ + * $Id: HttpRequest.cc,v 1.15.6.8 2007/05/17 10:51:04 amosjeffries Exp $ * * DEBUG: section 73 HTTP Request * AUTHOR: Duane Wessels @@ -82,10 +82,8 @@ imslen = 0; lastmod = -1; max_forwards = -1; - client_addr = no_addr; - my_addr = no_addr; - my_port = 0; - client_port = 0; + client_addr.SetEmpty(); + my_addr.SetEmpty(); body_pipe = NULL; // hier errType = ERR_NONE; Index: squid3/src/HttpRequest.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/HttpRequest.h,v retrieving revision 1.10.6.10 retrieving revision 1.10.6.11 diff -u -r1.10.6.10 -r1.10.6.11 --- squid3/src/HttpRequest.h 11 May 2007 16:05:41 -0000 1.10.6.10 +++ squid3/src/HttpRequest.h 17 May 2007 10:51:05 -0000 1.10.6.11 @@ -1,6 +1,6 @@ /* - * $Id: HttpRequest.h,v 1.10.6.10 2007/05/11 16:05:41 amosjeffries Exp $ + * $Id: HttpRequest.h,v 1.10.6.11 2007/05/17 10:51:05 amosjeffries Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -77,7 +77,7 @@ if(test.IsAnyAddr()) xstrncpy(host, src, SQUIDHOSTNAMELEN); else { - test.ToHostname(host, SQUIDHOSTNAMELEN); +// AYJ: DEBUG see what happends without this. test.ToHostname(host, SQUIDHOSTNAMELEN); } }; inline const char* GetHost(void) const { return host; }; @@ -114,15 +114,9 @@ int max_forwards; - /* these in_addr's could probably be sockaddr_in's */ + IPAddress client_addr; - struct IN_ADDR client_addr; - - struct IN_ADDR my_addr; - - unsigned short my_port; - - unsigned short client_port; + IPAddress my_addr; HierarchyLogEntry hier; Index: squid3/src/access_log.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/access_log.cc,v retrieving revision 1.23.4.12 retrieving revision 1.23.4.13 diff -u -r1.23.4.12 -r1.23.4.13 --- squid3/src/access_log.cc 16 May 2007 16:04:57 -0000 1.23.4.12 +++ squid3/src/access_log.cc 17 May 2007 10:51:06 -0000 1.23.4.13 @@ -1,6 +1,6 @@ /* - * $Id: access_log.cc,v 1.23.4.12 2007/05/16 16:04:57 amosjeffries Exp $ + * $Id: access_log.cc,v 1.23.4.13 2007/05/17 10:51:06 amosjeffries Exp $ * * DEBUG: section 46 Access Log * AUTHOR: Duane Wessels @@ -558,7 +558,7 @@ case LFT_CLIENT_PORT: if (al->request) { - outint = al->request->client_port; + outint = al->request->client_addr.GetPort(); doint = 1; } break; @@ -574,13 +574,13 @@ case LFT_LOCAL_IP: if (al->request) - out = inet_ntoa(al->request->my_addr); + out = al->request->my_addr.NtoA(tmp,MAX_IPSTRLEN); break; case LFT_LOCAL_PORT: if (al->request) { - outint = al->request->my_port; + outint = al->request->my_addr.GetPort(); doint = 1; } Index: squid3/src/client_side.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/client_side.cc,v retrieving revision 1.68.2.24 retrieving revision 1.68.2.25 diff -u -r1.68.2.24 -r1.68.2.25 --- squid3/src/client_side.cc 16 May 2007 16:04:57 -0000 1.68.2.24 +++ squid3/src/client_side.cc 17 May 2007 10:51:06 -0000 1.68.2.25 @@ -1,6 +1,6 @@ /* - * $Id: client_side.cc,v 1.68.2.24 2007/05/16 16:04:57 amosjeffries Exp $ + * $Id: client_side.cc,v 1.68.2.25 2007/05/17 10:51:06 amosjeffries Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -2193,7 +2193,7 @@ request->port == getMyPort()) { http->flags.internal = 1; } else if (Config.onoff.global_internal_static && internalStaticCheck(request->urlpath.buf())) { - request->SetHost(internalHostname()); // xstrncpy(request->host, internalHostname(), SQUIDHOSTNAMELEN); + request->SetHost(internalHostname()); request->port = getMyPort(); http->flags.internal = 1; } @@ -2206,10 +2206,8 @@ 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 = conn->peer; + request->my_addr = conn->me; request->http_ver = http_ver; if (!urlCheckRequest(request) || Index: squid3/src/client_side_request.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/client_side_request.cc,v retrieving revision 1.33.4.11 retrieving revision 1.33.4.12 diff -u -r1.33.4.11 -r1.33.4.12 --- squid3/src/client_side_request.cc 11 May 2007 16:05:42 -0000 1.33.4.11 +++ squid3/src/client_side_request.cc 17 May 2007 10:51:08 -0000 1.33.4.12 @@ -1,6 +1,6 @@ /* - * $Id: client_side_request.cc,v 1.33.4.11 2007/05/11 16:05:42 amosjeffries Exp $ + * $Id: client_side_request.cc,v 1.33.4.12 2007/05/17 10:51:08 amosjeffries Exp $ * * DEBUG: section 85 Client-side Request Routines * AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c) @@ -342,11 +342,11 @@ /* Internally created requests cannot have bodies today */ request->content_length = 0; - request->client_addr = no_addr; + request->client_addr.SetNoAddr(); - request->my_addr = no_addr; /* undefined for internal requests */ + request->my_addr.SetNoAddr(); /* undefined for internal requests */ - request->my_port = 0; + request->my_addr.SetPort(0); request->http_ver = http_ver; @@ -816,9 +816,7 @@ new_request->http_ver = old_request->http_ver; new_request->header.append(&old_request->header); new_request->client_addr = old_request->client_addr; - new_request->client_port = old_request->client_port; new_request->my_addr = old_request->my_addr; - new_request->my_port = old_request->my_port; new_request->flags = old_request->flags; new_request->flags.redirected = 1; Index: squid3/src/comm.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/comm.cc,v retrieving revision 1.47.2.23 retrieving revision 1.47.2.24 diff -u -r1.47.2.23 -r1.47.2.24 --- squid3/src/comm.cc 1 May 2007 08:32:30 -0000 1.47.2.23 +++ squid3/src/comm.cc 17 May 2007 10:51:08 -0000 1.47.2.24 @@ -1,6 +1,6 @@ /* - * $Id: comm.cc,v 1.47.2.23 2007/05/01 08:32:30 amosjeffries Exp $ + * $Id: comm.cc,v 1.47.2.24 2007/05/17 10:51:08 amosjeffries Exp $ * * DEBUG: section 5 Socket Functions * AUTHOR: Harvest Derived @@ -725,6 +725,7 @@ if( from.IsIPv6() ) { struct sockaddr_in6 s6addr; 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)); } #endif @@ -732,6 +733,7 @@ if( from.IsIPv4() ) { struct sockaddr_in s4addr; 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)); } Index: squid3/src/external_acl.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/external_acl.cc,v retrieving revision 1.37.6.9 retrieving revision 1.37.6.10 diff -u -r1.37.6.9 -r1.37.6.10 --- squid3/src/external_acl.cc 10 May 2007 12:57:41 -0000 1.37.6.9 +++ squid3/src/external_acl.cc 17 May 2007 10:51:13 -0000 1.37.6.10 @@ -1,6 +1,6 @@ /* - * $Id: external_acl.cc,v 1.37.6.9 2007/05/10 12:57:41 amosjeffries Exp $ + * $Id: external_acl.cc,v 1.37.6.10 2007/05/17 10:51:13 amosjeffries Exp $ * * DEBUG: section 82 External ACL * AUTHOR: Henrik Nordstrom, MARA Systems AB @@ -785,16 +785,16 @@ break; case _external_acl_format::EXT_ACL_SRCPORT: - snprintf(buf, sizeof(buf), "%d", request->client_port); + snprintf(buf, sizeof(buf), "%d", request->client_addr.GetPort()); str = buf; break; case _external_acl_format::EXT_ACL_MYADDR: - str = inet_ntoa(request->my_addr); + str = request->my_addr.NtoA(buf, sizeof(buf)); break; case _external_acl_format::EXT_ACL_MYPORT: - snprintf(buf, sizeof(buf), "%d", request->my_port); + snprintf(buf, sizeof(buf), "%d", request->my_addr.GetPort()); str = buf; break; Index: squid3/src/forward.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/forward.cc,v retrieving revision 1.35.4.19 retrieving revision 1.35.4.20 diff -u -r1.35.4.19 -r1.35.4.20 --- squid3/src/forward.cc 11 May 2007 16:05:42 -0000 1.35.4.19 +++ squid3/src/forward.cc 17 May 2007 10:51:13 -0000 1.35.4.20 @@ -1,6 +1,6 @@ /* - * $Id: forward.cc,v 1.35.4.19 2007/05/11 16:05:42 amosjeffries Exp $ + * $Id: forward.cc,v 1.35.4.20 2007/05/17 10:51:13 amosjeffries Exp $ * * DEBUG: section 17 Request Forwarding * AUTHOR: Duane Wessels @@ -206,14 +206,13 @@ * be allowed. yuck, I know. */ - if (request->client_addr.s_addr != no_addr.s_addr && request->protocol != PROTO_INTERNAL && request->protocol != PROTO_CACHEOBJ) { + if ( !request->client_addr.IsNoAddr() && request->protocol != PROTO_INTERNAL && request->protocol != PROTO_CACHEOBJ) { /* * Check if this host is allowed to fetch MISSES from us (miss_access) */ ACLChecklist ch; ch.src_addr = request->client_addr; ch.my_addr = request->my_addr; - ch.my_addr.SetPort(request->my_port); ch.request = HTTPMSGLOCK(request); ch.accessList = cbdataReference(Config.accessList.miss); /* cbdataReferenceDone() happens in either fastCheck() or ~ACLCheckList */ @@ -1221,7 +1220,6 @@ { ch.src_addr = request->client_addr; ch.my_addr = request->my_addr; - ch.my_addr.SetPort(request->my_port); ch.request = HTTPMSGLOCK(request); } @@ -1236,7 +1234,6 @@ if (request) { ch.src_addr = request->client_addr; ch.my_addr = request->my_addr; - ch.my_addr.SetPort(request->my_port); ch.request = HTTPMSGLOCK(request); } Index: squid3/src/http.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/http.cc,v retrieving revision 1.43.4.16 retrieving revision 1.43.4.17 diff -u -r1.43.4.16 -r1.43.4.17 --- squid3/src/http.cc 10 May 2007 12:57:42 -0000 1.43.4.16 +++ squid3/src/http.cc 17 May 2007 10:51:14 -0000 1.43.4.17 @@ -1,6 +1,6 @@ /* - * $Id: http.cc,v 1.43.4.16 2007/05/10 12:57:42 amosjeffries Exp $ + * $Id: http.cc,v 1.43.4.17 2007/05/17 10:51:14 amosjeffries Exp $ * * DEBUG: section 11 Hypertext Transfer Protocol (HTTP) * AUTHOR: Harvest Derived @@ -1414,8 +1414,10 @@ /* append X-Forwarded-For */ strFwd = hdr_in->getList(HDR_X_FORWARDED_FOR); - if (opt_forwarded_for && orig_request->client_addr.s_addr != no_addr.s_addr) - strListAdd(&strFwd, inet_ntoa(orig_request->client_addr), ','); + if (opt_forwarded_for && !orig_request->client_addr.IsNoAddr()) { + orig_request->client_addr.NtoA(bbuf,MAX_IPSTRLEN); + strListAdd(&strFwd, bbuf, ','); + } else strListAdd(&strFwd, "unknown", ','); @@ -1885,7 +1887,7 @@ if (flags.headers_parsed && !flags.abuse_detected) { flags.abuse_detected = 1; - debugs(11, 1, "http handleMoreRequestBodyAvailable: Likely proxy abuse detected '" << inet_ntoa(orig_request->client_addr) << "' -> '" << entry->url() << "'" ); + debugs(11, 1, "http handleMoreRequestBodyAvailable: Likely proxy abuse detected '" << orig_request->client_addr << "' -> '" << entry->url() << "'" ); if (getReply()->sline.status == HTTP_INVALID_HEADER) { comm_close(fd); Index: squid3/src/icp_v2.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/icp_v2.cc,v retrieving revision 1.17.8.15 retrieving revision 1.17.8.16 diff -u -r1.17.8.15 -r1.17.8.16 --- squid3/src/icp_v2.cc 16 May 2007 16:04:57 -0000 1.17.8.15 +++ squid3/src/icp_v2.cc 17 May 2007 10:51:15 -0000 1.17.8.16 @@ -1,8 +1,8 @@ /* - * $Id: icp_v2.cc,v 1.17.8.15 2007/05/16 16:04:57 amosjeffries Exp $ + * $Id: icp_v2.cc,v 1.17.8.16 2007/05/17 10:51:15 amosjeffries Exp $ * - * DEBUG: section 12 Internet Cache Protocol + * DEBUG: section 12 Internet Cache Protocol (ICP) * AUTHOR: Duane Wessels * * SQUID Web Proxy Cache http://www.squid-cache.org/ Index: squid3/src/icp_v3.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/icp_v3.cc,v retrieving revision 1.5.8.7 retrieving revision 1.5.8.8 diff -u -r1.5.8.7 -r1.5.8.8 --- squid3/src/icp_v3.cc 16 May 2007 16:04:57 -0000 1.5.8.7 +++ squid3/src/icp_v3.cc 17 May 2007 10:51:15 -0000 1.5.8.8 @@ -1,8 +1,8 @@ /* - * $Id: icp_v3.cc,v 1.5.8.7 2007/05/16 16:04:57 amosjeffries Exp $ + * $Id: icp_v3.cc,v 1.5.8.8 2007/05/17 10:51:15 amosjeffries Exp $ * - * DEBUG: section 12 Internet Cache Protocol + * DEBUG: section 12 Internet Cache Protocol (ICP) * AUTHOR: Duane Wessels * * SQUID Web Proxy Cache http://www.squid-cache.org/ Index: squid3/src/internal.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/internal.cc,v retrieving revision 1.5.8.7 retrieving revision 1.5.8.8 diff -u -r1.5.8.7 -r1.5.8.8 --- squid3/src/internal.cc 10 May 2007 12:57:46 -0000 1.5.8.7 +++ squid3/src/internal.cc 17 May 2007 10:51:15 -0000 1.5.8.8 @@ -1,6 +1,6 @@ /* - * $Id: internal.cc,v 1.5.8.7 2007/05/10 12:57:46 amosjeffries Exp $ + * $Id: internal.cc,v 1.5.8.8 2007/05/17 10:51:15 amosjeffries Exp $ * * DEBUG: section 76 Internal Squid Object handling * AUTHOR: Duane, Alex, Henrik @@ -51,7 +51,7 @@ { ErrorState *err; const char *upath = request->urlpath.buf(); - debugs(76, 3, "internalStart: " << inet_ntoa(request->client_addr) << " requesting '" << upath << "'"); + debugs(76, 3, "internalStart: " << request->client_addr << " requesting '" << upath << "'"); if (0 == strcmp(upath, "/squid-internal-dynamic/netdb")) { netdbBinaryExchange(entry); Index: squid3/src/neighbors.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/neighbors.cc,v retrieving revision 1.23.4.19 retrieving revision 1.23.4.20 diff -u -r1.23.4.19 -r1.23.4.20 --- squid3/src/neighbors.cc 16 May 2007 16:04:57 -0000 1.23.4.19 +++ squid3/src/neighbors.cc 17 May 2007 10:51:15 -0000 1.23.4.20 @@ -1,6 +1,6 @@ /* - * $Id: neighbors.cc,v 1.23.4.19 2007/05/16 16:04:57 amosjeffries Exp $ + * $Id: neighbors.cc,v 1.23.4.20 2007/05/17 10:51:15 amosjeffries Exp $ * * DEBUG: section 15 Neighbor Routines * AUTHOR: Harvest Derived @@ -183,8 +183,6 @@ checklist.my_addr = request->my_addr; - checklist.my_addr.SetPort(request->my_port); - checklist.request = HTTPMSGLOCK(request); checklist.accessList = cbdataReference(p->access); Index: squid3/src/net_db.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/net_db.cc,v retrieving revision 1.13.4.14 retrieving revision 1.13.4.15 diff -u -r1.13.4.14 -r1.13.4.15 --- squid3/src/net_db.cc 16 May 2007 07:07:02 -0000 1.13.4.14 +++ squid3/src/net_db.cc 17 May 2007 10:51:16 -0000 1.13.4.15 @@ -1,6 +1,6 @@ /* - * $Id: net_db.cc,v 1.13.4.14 2007/05/16 07:07:02 amosjeffries Exp $ + * $Id: net_db.cc,v 1.13.4.15 2007/05/17 10:51:16 amosjeffries Exp $ * * DEBUG: section 38 Network Measurement Database * AUTHOR: Duane Wessels @@ -85,7 +85,7 @@ static hash_table *addr_table = NULL; static hash_table *host_table = NULL; -static IPAddress networkFromInaddr(IPAddress &a); +IPAddress networkFromInaddr(const IPAddress &a); static void netdbRelease(netdbEntry * n); static void netdbHashInsert(netdbEntry * n, IPAddress &addr); @@ -250,7 +250,7 @@ } static netdbEntry * -netdbLookupAddr(IPAddress addr) +netdbLookupAddr(const IPAddress &addr) { netdbEntry *n; char *key = new char [MAX_IPSTRLEN]; @@ -345,18 +345,20 @@ xfree(hostname); } -static IPAddress -networkFromInaddr(IPAddress &in) +IPAddress +networkFromInaddr(const IPAddress &in) { - IPAddress out = in; + IPAddress out; + out = in; #if USE_IPV6 /* in IPv6 the 'network' should be the routing section. */ - if(!in.IsIPv4() && in.IsIPv6()) + if( in.IsIPv6() ) { out.ApplyMask(64, IPv6); + debugs(14, 5, "networkFromInaddr : Masked IPv6 Address to " << in << "/64 routing part."); return out; } #endif @@ -377,8 +379,11 @@ #endif + debugs(14, 5, "networkFromInaddr : Masked IPv4 Address to " << out << "/24."); + /* use /24 for everything under IPv4 */ out.ApplyMask(24, IPv4); + debugs(14, 5, "networkFromInaddr : Masked IPv4 Address to " << in << "/24."); return out; } Index: squid3/src/tunnel.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/tunnel.cc,v retrieving revision 1.13.4.9 retrieving revision 1.13.4.10 diff -u -r1.13.4.9 -r1.13.4.10 --- squid3/src/tunnel.cc 10 May 2007 12:57:47 -0000 1.13.4.9 +++ squid3/src/tunnel.cc 17 May 2007 10:51:16 -0000 1.13.4.10 @@ -1,6 +1,6 @@ /* - * $Id: tunnel.cc,v 1.13.4.9 2007/05/10 12:57:47 amosjeffries Exp $ + * $Id: tunnel.cc,v 1.13.4.10 2007/05/17 10:51:16 amosjeffries Exp $ * * DEBUG: section 26 Secure Sockets Layer Proxy * AUTHOR: Duane Wessels @@ -586,19 +586,18 @@ HttpRequest *request = http->request; char *url = http->uri; /* - * client_addr == no_addr indicates this is an "internal" request + * client_addr.IsNoAddr() indicates this is an "internal" request * from peer_digest.c, asn.c, netdb.c, etc and should always * be allowed. yuck, I know. */ - if (request->client_addr.s_addr != no_addr.s_addr) { + if (!request->client_addr.IsNoAddr()) { /* * Check if this host is allowed to fetch MISSES from us (miss_access) */ ACLChecklist ch; ch.src_addr = request->client_addr; ch.my_addr = request->my_addr; - ch.my_addr.SetPort(request->my_port); ch.request = HTTPMSGLOCK(request); ch.accessList = cbdataReference(Config.accessList.miss); /* cbdataReferenceDone() happens in either fastCheck() or ~ACLCheckList */ Index: squid3/src/urn.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/urn.cc,v retrieving revision 1.11.8.3 retrieving revision 1.11.8.4 diff -u -r1.11.8.3 -r1.11.8.4 --- squid3/src/urn.cc 29 Apr 2007 03:01:40 -0000 1.11.8.3 +++ squid3/src/urn.cc 17 May 2007 10:51:16 -0000 1.11.8.4 @@ -1,6 +1,6 @@ /* - * $Id: urn.cc,v 1.11.8.3 2007/04/29 03:01:40 amosjeffries Exp $ + * $Id: urn.cc,v 1.11.8.4 2007/05/17 10:51:16 amosjeffries Exp $ * * DEBUG: section 52 URN Parsing * AUTHOR: Kostas Anagnostakis @@ -179,6 +179,9 @@ char * result; char const *t; +/* FIXME: this appears to be parsing the URL. *very* badly. */ +/* FIXME: a proper encapsulated URI/URL type needs to clear this up. */ + if ((t = urlpath.pos(':')) != NULL) { urlpath.set(t, '\0'); result = xstrdup(urlpath.buf()); Index: squid3/src/auth/digest/auth_digest.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/auth/digest/auth_digest.cc,v retrieving revision 1.18.4.11 retrieving revision 1.18.4.12 diff -u -r1.18.4.11 -r1.18.4.12 --- squid3/src/auth/digest/auth_digest.cc 11 May 2007 16:05:47 -0000 1.18.4.11 +++ squid3/src/auth/digest/auth_digest.cc 17 May 2007 10:51:17 -0000 1.18.4.12 @@ -1,6 +1,6 @@ /* - * $Id: auth_digest.cc,v 1.18.4.11 2007/05/11 16:05:47 amosjeffries Exp $ + * $Id: auth_digest.cc,v 1.18.4.12 2007/05/17 10:51:17 amosjeffries Exp $ * * DEBUG: section 29 Authenticator * AUTHOR: Robert Collins @@ -645,17 +645,17 @@ } else { const char *useragent = request->header.getStr(HDR_USER_AGENT); - static struct IN_ADDR last_broken_addr; + static IPAddress last_broken_addr; static int seen_broken_client = 0; if (!seen_broken_client) { - last_broken_addr = no_addr; + last_broken_addr.SetNoAddr(); seen_broken_client = 1; } - if (memcmp(&last_broken_addr, &request->client_addr, sizeof(last_broken_addr)) != 0) { + if (last_broken_addr != request->client_addr) { debugs(29, 1, "\nDigest POST bug detected from " << - inet_ntoa(request->client_addr) << " using '" << + request->client_addr << " using '" << (useragent ? useragent : "-") << "'. Please upgrade browser. See Bug #630 for details.");