]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix Regression: SMP broke ICP outgoing IP lookup if no udp_outgoing_addr set
authorAmos Jeffries <amosjeffries@squid-cache.org>
Sun, 17 Oct 2010 10:20:35 +0000 (04:20 -0600)
committerAmos Jeffries <amosjeffries@squid-cache.org>
Sun, 17 Oct 2010 10:20:35 +0000 (04:20 -0600)
src/icp_v2.cc

index 692eed66b29249bf722f4835f45eaa159abfc75b..4ac84b08fc9c4635fd507ecfe28337ae0e478175 100644 (file)
@@ -676,9 +676,6 @@ icpConnectionsOpen(void)
     uint16_t port;
     Ip::Address addr;
 
-    struct addrinfo *xai = NULL;
-    int x;
-
     if ((port = Config.Port.icp) <= 0)
         return;
 
@@ -738,15 +735,18 @@ icpConnectionsOpen(void)
         debugs(12, 1, "Outgoing ICP messages on port " << addr.GetPort() << ", FD " << theOutIcpConnection << ".");
 
         fd_note(theOutIcpConnection, "Outgoing ICP socket");
+        icpGetOutgoingIpAddress();
     }
+}
 
+static void
+icpGetOutgoingIpAddress()
+{
+    struct addrinfo *xai = NULL;
     theOutICPAddr.SetEmpty();
-
     theOutICPAddr.InitAddrInfo(xai);
 
-    x = getsockname(theOutIcpConnection, xai->ai_addr, &xai->ai_addrlen);
-
-    if (x < 0)
+    if (getsockname(theOutIcpConnection, xai->ai_addr, &xai->ai_addrlen) < 0)
         debugs(50, 1, "theOutIcpConnection FD " << theOutIcpConnection << ": getsockname: " << xstrerror());
     else
         theOutICPAddr = *xai;
@@ -775,8 +775,10 @@ icpIncomingConnectionOpened(int fd, int errNo, Ip::Address& addr)
 
     fd_note(theInIcpConnection, "Incoming ICP socket");
 
-    if (Config.Addrs.udp_outgoing.IsNoAddr())
+    if (Config.Addrs.udp_outgoing.IsNoAddr()) {
         theOutIcpConnection = theInIcpConnection;
+        icpGetOutgoingIpAddress();
+    }
 }
 
 /**