]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Cleanup: make getOutgoingAddress fix local/remote protocol
authorAmos Jeffries <squid3@treenet.co.nz>
Fri, 9 Sep 2011 09:24:28 +0000 (03:24 -0600)
committerAmos Jeffries <squid3@treenet.co.nz>
Fri, 9 Sep 2011 09:24:28 +0000 (03:24 -0600)
src/adaptation/icap/Xaction.cc
src/forward.cc
src/peer_select.cc

index 1f2d4f935ac3dccfc086a3a87094d7cd26e888a3..4a13a596c34991cd3af072d088ed291aea84eac3 100644 (file)
@@ -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<Adaptation::Icap::Xaction, CommConnectCbParams> ConnectDialer;
index 941418c5b1264ea041546e4e6e4694b616ed9079..cbada6fa16485bf234004ea27290be30bb036fad 100644 (file)
@@ -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) {
index 6dc11447add98b6da0c6668211909ef755a1b940..0c512c0d230acf6840d7b96704eec32bde7ebf38 100644 (file)
@@ -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());