From: Amos Jeffries Date: Fri, 9 Sep 2011 09:24:28 +0000 (-0600) Subject: Cleanup: make getOutgoingAddress fix local/remote protocol X-Git-Tag: take08~4^2~11 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=07f889c1311897b9b97f25d11f7a9aa65a5dc8b0;p=thirdparty%2Fsquid.git Cleanup: make getOutgoingAddress fix local/remote protocol --- diff --git a/src/adaptation/icap/Xaction.cc b/src/adaptation/icap/Xaction.cc index 1f2d4f935a..4a13a596c3 100644 --- a/src/adaptation/icap/Xaction.cc +++ b/src/adaptation/icap/Xaction.cc @@ -161,11 +161,6 @@ Adaptation::Icap::Xaction::dnsLookupDone(const ipcache_addrs *ia) connection->remote = ia->in_addrs[ia->cur]; connection->remote.SetPort(s.cfg().port); getOutgoingAddress(NULL, connection); - if (connection->remote.IsIPv4() && !connection->local.SetIPv4()) { - // This should never happen. getOutgoing should match by family or skip. - Must(connection->local.IsAnyAddr()); - return; - } // TODO: service bypass status may differ from that of a transaction typedef CommCbMemFunT ConnectDialer; diff --git a/src/forward.cc b/src/forward.cc index 941418c5b1..cbada6fa16 100644 --- a/src/forward.cc +++ b/src/forward.cc @@ -1199,9 +1199,13 @@ aclMapNfmark(acl_nfmark * head, ACLChecklist * ch) void getOutgoingAddress(HttpRequest * request, Comm::ConnectionPointer conn) { - /* skip if an outgoing address is already set. */ + // skip if an outgoing address is already set. if (!conn->local.IsAnyAddr()) return; + // ensure that at minimum the wildcard local matches remote protocol + if (conn->remote.IsIPv4()) + conn->local.SetIPv4(); + // maybe use TPROXY client address if (request && request->flags.spoof_client_ip) { if (!conn->getPeer() || !conn->getPeer()->options.no_tproxy) { diff --git a/src/peer_select.cc b/src/peer_select.cc index 6dc11447ad..0c512c0d23 100644 --- a/src/peer_select.cc +++ b/src/peer_select.cc @@ -279,13 +279,7 @@ peerSelectDnsResults(const ipcache_addrs *ia, const DnsLookupDetails &details, v // check for a configured outgoing address for this destination... getOutgoingAddress(psstate->request, p); - if (p->remote.IsIPv4() && !p->local.SetIPv4()) { - // This should never happen. getOutgoing should match by family or skip. - assert(p->local.IsAnyAddr()); - continue; - } else { - psstate->paths->push_back(p); - } + psstate->paths->push_back(p); } } else { debugs(44, 3, HERE << "Unknown host: " << fs->_peer ? fs->_peer->host : psstate->request->GetHost());