This is an automated email from the ASF dual-hosted git repository.
cmcfarlen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new d967264281 Keep a copy of the effective client ip for logging (#12818)
d967264281 is described below
commit d9672642810655bd488ece6a76a19eaf9ab7bc54
Author: Chris McFarlen <[email protected]>
AuthorDate: Tue Jan 20 16:02:49 2026 -0600
Keep a copy of the effective client ip for logging (#12818)
---
include/proxy/http/HttpTransact.h | 3 +++
src/proxy/http/HttpSM.cc | 1 +
src/proxy/logging/LogAccess.cc | 11 +----------
3 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/include/proxy/http/HttpTransact.h
b/include/proxy/http/HttpTransact.h
index 64e13a991d..d01a7b10e1 100644
--- a/include/proxy/http/HttpTransact.h
+++ b/include/proxy/http/HttpTransact.h
@@ -713,6 +713,9 @@ public:
ConnectionAttributes client_info;
ConnectionAttributes parent_info;
ConnectionAttributes server_info;
+ // This is a copy of the effective client IP address (see pp-clnt) to
+ // ensure this is available for logging
+ IpEndpoint effective_client_addr;
Source_t source = Source_t::NONE;
Source_t pre_transform_source = Source_t::NONE;
diff --git a/src/proxy/http/HttpSM.cc b/src/proxy/http/HttpSM.cc
index 0a9ed2c994..80251d83d7 100644
--- a/src/proxy/http/HttpSM.cc
+++ b/src/proxy/http/HttpSM.cc
@@ -448,6 +448,7 @@ HttpSM::attach_client_session(ProxyTransaction *txn)
ats_ip_copy(&t_state.client_info.src_addr, netvc->get_remote_addr());
ats_ip_copy(&t_state.client_info.dst_addr, netvc->get_local_addr());
+ ats_ip_copy(&t_state.effective_client_addr,
netvc->get_effective_remote_addr());
t_state.client_info.is_transparent = netvc->get_is_transparent();
t_state.client_info.port_attribute =
static_cast<HttpProxyPort::TransportType>(netvc->attributes);
diff --git a/src/proxy/logging/LogAccess.cc b/src/proxy/logging/LogAccess.cc
index 0754be1c21..f043cb8514 100644
--- a/src/proxy/logging/LogAccess.cc
+++ b/src/proxy/logging/LogAccess.cc
@@ -1442,16 +1442,7 @@ LogAccess::marshal_plugin_identity_tag(char *buf)
int
LogAccess::marshal_client_host_ip(char *buf)
{
- if (m_http_sm) {
- auto txn = m_http_sm->get_ua_txn();
- if (txn) {
- sockaddr const *addr = txn->get_client_addr();
- if (addr && ats_is_ip(addr)) {
- return marshal_ip(buf, addr);
- }
- }
- }
- return INK_MIN_ALIGN;
+ return marshal_ip(buf, &m_http_sm->t_state.effective_client_addr.sa);
}
int