From: Amos Jeffries Date: Fri, 28 Oct 2016 11:55:44 +0000 (+1300) Subject: Bug 4567: Strange IPv6 shown in access.log X-Git-Tag: SQUID_4_0_16~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=705c36c6c582dc5b097a2f5efe8d5e6a3bc70ffc;p=thirdparty%2Fsquid.git Bug 4567: Strange IPv6 shown in access.log --- diff --git a/src/AccessLogEntry.cc b/src/AccessLogEntry.cc index 1bc599c161..2791506c8b 100644 --- a/src/AccessLogEntry.cc +++ b/src/AccessLogEntry.cc @@ -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