From 705c36c6c582dc5b097a2f5efe8d5e6a3bc70ffc Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Sat, 29 Oct 2016 00:55:44 +1300 Subject: [PATCH] Bug 4567: Strange IPv6 shown in access.log --- src/AccessLogEntry.cc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) 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 -- 2.47.3