]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 4567: Strange IPv6 shown in access.log
authorAmos Jeffries <squid3@treenet.co.nz>
Fri, 28 Oct 2016 11:55:44 +0000 (00:55 +1300)
committerAmos Jeffries <squid3@treenet.co.nz>
Fri, 28 Oct 2016 11:55:44 +0000 (00:55 +1300)
src/AccessLogEntry.cc

index 1bc599c1610e116a8c80100055f64fb903015060..2791506c8b28761fb7ca1c0534b5738df1d7d8d2 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