]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix Comm::TcpAcceptor::status() reporting of listening address (#1891)
authorAlex Rousskov <rousskov@measurement-factory.com>
Wed, 21 Aug 2024 18:51:29 +0000 (18:51 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Thu, 22 Aug 2024 18:38:58 +0000 (18:38 +0000)
Buggy "static" caching optimization led to TcpAcceptor X reporting
listening address of TcpAcceptor Y or an incorrect 0.0.0.0 address.
TcpAcceptor status is visible in mgr:jobs and level-5+ debugs() output.

Side effect: For a listening port configured without an explicit IP
address, the listening address part of status() is now reported using
"[::]" rather than "0.0.0.0" string.

Broken since 2011 commit cbff89ba.

src/comm/TcpAcceptor.cc

index 081761fc2a14a26878b0db67f24f094c53bc1414..9ba0e0d25d4e9b4dd7189da36c87997904edb0ba 100644 (file)
@@ -126,9 +126,8 @@ Comm::TcpAcceptor::status() const
     if (conn == nullptr)
         return "[nil connection]";
 
-    static char ipbuf[MAX_IPSTRLEN] = {'\0'};
-    if (ipbuf[0] == '\0')
-        conn->local.toHostStr(ipbuf, MAX_IPSTRLEN);
+    char ipbuf[MAX_IPSTRLEN];
+    conn->local.toHostStr(ipbuf, MAX_IPSTRLEN); // XXX: report port using toUrl()
 
     static MemBuf buf;
     buf.reset();