=== modified file 'src/icp_v2.cc' --- src/icp_v2.cc 2011-07-16 15:21:48 +0000 +++ src/icp_v2.cc 2011-07-27 08:56:04 +0000 @@ -83,9 +83,6 @@ /// \ingroup ServerProtocolICPInternal2 static void icpCount(void *, int, size_t, int); -/// \ingroup ServerProtocolICPInternal2 -static void icpGetOutgoingIpAddress(); - /** \ingroup ServerProtocolICPInternal2 * IcpQueueHead is global so comm_incoming() knows whether or not @@ -100,21 +97,6 @@ /// \ingroup ServerProtocolICPInternal2 Comm::ConnectionPointer icpOutgoingConn = NULL; -/** \ingroup ServerProtocolICPInternal2 - * ICP v2 uses the outgoing address as host ID. - * NP: this *may* be identical to icpOutgoingConn->local - * but when IN/OUT sockets are shared we can't guarantee that - * so a separate variable is used for now. - * - * We have one for private use (sent only by this local cache) - * and one for public use (for external caches to contact us) - */ -Ip::Address theIcpPrivateHostID; - -/// \see theIcpPrivateHostID -Ip::Address theIcpPublicHostID; - - /* icp_common_t */ _icp_common_t::_icp_common_t() : opcode(ICP_INVALID), version(0), length(0), reqnum(0), flags(0), pad(0), shostid(0) {} @@ -299,7 +281,7 @@ headerp->pad = htonl(pad); - theIcpPrivateHostID.GetInAddr( *((struct in_addr*)&headerp->shostid) ); + headerp->shostid = 0; urloffset = buf + sizeof(icp_common_t); @@ -745,26 +727,9 @@ Comm::SetSelect(icpOutgoingConn->fd, COMM_SELECT_READ, icpHandleUdp, NULL, 0); fd_note(icpOutgoingConn->fd, "Outgoing ICP socket"); - icpGetOutgoingIpAddress(); } } -// Ensure that we have the IP address(es) to use for Host ID. -// The outgoing address is used as 'private' host ID used only on packets we send -static void -icpGetOutgoingIpAddress() -{ - struct addrinfo *xai = NULL; - theIcpPrivateHostID.SetEmpty(); - theIcpPrivateHostID.InitAddrInfo(xai); - if (getsockname(icpOutgoingConn->fd, xai->ai_addr, &xai->ai_addrlen) < 0) - debugs(50, DBG_IMPORTANT, "ERROR: Unable to identify ICP host ID to use for " << icpOutgoingConn - << ": getsockname: " << xstrerror()); - else - theIcpPrivateHostID = *xai; - theIcpPrivateHostID.FreeAddrInfo(xai); -} - static void icpIncomingConnectionOpened(int errNo) { @@ -783,19 +748,7 @@ if (Config.Addrs.udp_outgoing.IsNoAddr()) { icpOutgoingConn = icpIncomingConn; debugs(12, DBG_IMPORTANT, "Sending ICP messages from " << icpOutgoingConn->local); - icpGetOutgoingIpAddress(); } - - // Ensure that we have the IP address(es) to use for Host ID. - // The listening address is used as 'public' host ID which can be used to contact us - struct addrinfo *xai = NULL; - theIcpPublicHostID.InitAddrInfo(xai); // reset xai - if (getsockname(icpIncomingConn->fd, xai->ai_addr, &xai->ai_addrlen) < 0) - debugs(50, DBG_IMPORTANT, "ERROR: Unable to identify ICP host ID to use for " << icpIncomingConn - << ": getsockname: " << xstrerror()); - else - theIcpPublicHostID = *xai; - theIcpPublicHostID.FreeAddrInfo(xai); } /** === modified file 'src/neighbors.cc' --- src/neighbors.cc 2011-07-20 07:35:53 +0000 +++ src/neighbors.cc 2011-07-26 10:08:56 +0000 @@ -77,7 +77,6 @@ static OBJH neighborDumpNonPeers; static void dump_peers(StoreEntry * sentry, peer * peers); -static icp_common_t echo_hdr; static u_short echo_port; static int NLateReplies = 0; @@ -565,17 +564,8 @@ peerRefreshDNS((void *) 1); - if (echo_hdr.opcode == ICP_INVALID) { - echo_hdr.opcode = ICP_SECHO; - echo_hdr.version = ICP_VERSION_CURRENT; - echo_hdr.length = 0; - echo_hdr.reqnum = 0; - echo_hdr.flags = 0; - echo_hdr.pad = 0; - theIcpPublicHostID.GetInAddr( *((struct in_addr*)&echo_hdr.shostid) ); - sep = getservbyname("echo", "udp"); - echo_port = sep ? ntohs((u_short) sep->s_port) : 7; - } + sep = getservbyname("echo", "udp"); + echo_port = sep ? ntohs((u_short) sep->s_port) : 7; first_ping = Config.peers; } @@ -653,7 +643,6 @@ if (p->icp.port == echo_port) { debugs(15, 4, "neighborsUdpPing: Looks like a dumb cache, send DECHO ping"); - echo_hdr.reqnum = reqnum; query = _icp_common_t::createMessage(ICP_DECHO, 0, url, reqnum, 0); icpUdpSend(icpOutgoingConn->fd, p->in_addr, query, LOG_ICP_QUERY, 0); } else {