]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 4567: Strange IPv6 shown in access.log
authorAmos Jeffries <squid3@treenet.co.nz>
Sun, 30 Oct 2016 09:39:20 +0000 (22:39 +1300)
committerAmos Jeffries <squid3@treenet.co.nz>
Sun, 30 Oct 2016 09:39:20 +0000 (22:39 +1300)
src/AccessLogEntry.cc

index 32d015a44b7cd249331cb0106fee705efe634343..0d2a3e90015ad2ba313b794529b358adb1e42bf2 100644 (file)
@@ -30,14 +30,17 @@ AccessLogEntry::getLogClientIp(char *buf, size_t bufsz) const
         log_ip = request->indirect_client_addr;
     else
 #endif
-        if (tcpClient != NULL)
+        if (tcpClient)
             log_ip = tcpClient->remote;
-        else if (cache.caddr.isNoAddr()) { // e.g., ICAP OPTIONS lack client
-            strncpy(buf, "-", bufsz);
-            return;
-        } else
+        else
             log_ip = cache.caddr;
 
+    // internally generated requests (and some ICAP) lack client IP
+    if (log_ip.isNoAddr()) {
+        strncpy(buf, "-", bufsz);
+        return;
+    }
+
     // Apply so-called 'privacy masking' to IPv4 clients
     // - localhost IP is always shown in full
     // - IPv4 clients masked with client_netmask