]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Make comm_local_port record local IP in fde table if unknown
authorAmos Jeffries <squid3@treenet.co.nz>
Sun, 18 Jul 2010 08:21:22 +0000 (20:21 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Sun, 18 Jul 2010 08:21:22 +0000 (20:21 +1200)
src/comm.cc

index f3fde6ab78898b865154c44925ea8e03b4e089f0..12f0fbc7baeb8f121c4a6ad4f026252d5e3c204a 100644 (file)
@@ -521,16 +521,12 @@ comm_local_port(int fd)
 
     temp.FreeAddrInfo(addr);
 
-    F->local_addr.SetPort(temp.GetPort());
-
-#if 0 // seems to undo comm_open actions on the FD ...
-    // grab default socket information for this address
-    temp.GetAddrInfo(addr);
-
-    F->sock_family = addr->ai_family;
-
-    temp.FreeAddrInfo(addr);
-#endif
+    if (F->local_addr.IsAnyAddr()) {
+        /* save the whole local address, not just the port. */
+        F->local_addr = temp;
+    } else {
+        F->local_addr.SetPort(temp.GetPort());
+    }
 
     debugs(5, 6, "comm_local_port: FD " << fd << ": port " << F->local_addr.GetPort() << "(family=" << F->sock_family << ")");
     return F->local_addr.GetPort();