From: Amos Jeffries Date: Sun, 18 Jul 2010 08:21:22 +0000 (+1200) Subject: Make comm_local_port record local IP in fde table if unknown X-Git-Tag: take08~55^2~124^2~110 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3d031c35eea4875d614f8610da92614589b4aeb4;p=thirdparty%2Fsquid.git Make comm_local_port record local IP in fde table if unknown --- diff --git a/src/comm.cc b/src/comm.cc index f3fde6ab78..12f0fbc7ba 100644 --- a/src/comm.cc +++ b/src/comm.cc @@ -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();