This is an automated email from the ASF dual-hosted git repository.
cmcfarlen pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/10.1.x by this push:
new 6d36bdbae2 Fix ppa log field (#12863)
6d36bdbae2 is described below
commit 6d36bdbae25b6e70529085cde702f2a30d233d4f
Author: Masakazu Kitajo <[email protected]>
AuthorDate: Mon Feb 9 16:30:48 2026 -0700
Fix ppa log field (#12863)
- Copy a whole pp_info for logging
- Calculate the length with alignment in consideration
- Put null terminator at the end of the log field value
(cherry picked from commit 24e01700a50dfda344ad5e3857f6fb426f37fd56)
---
src/proxy/http/HttpTransact.cc | 6 +-----
src/proxy/logging/LogAccess.cc | 14 +++++++++-----
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/proxy/http/HttpTransact.cc b/src/proxy/http/HttpTransact.cc
index 473245a345..e7050ebe1f 100644
--- a/src/proxy/http/HttpTransact.cc
+++ b/src/proxy/http/HttpTransact.cc
@@ -5744,11 +5744,7 @@
HttpTransact::initialize_state_variables_from_request(State *s, HTTPHdr *obsolet
memset(&s->request_data.dest_ip, 0, sizeof(s->request_data.dest_ip));
if (vc) {
s->request_data.incoming_port = vc->get_local_port();
- s->pp_info.version = vc->get_proxy_protocol_version();
- if (s->pp_info.version != ProxyProtocolVersion::UNDEFINED) {
- ats_ip_copy(s->pp_info.src_addr, vc->get_proxy_protocol_src_addr());
- ats_ip_copy(s->pp_info.dst_addr, vc->get_proxy_protocol_dst_addr());
- }
+ s->pp_info = vc->get_proxy_protocol_info();
}
s->request_data.xact_start = s->client_request_time;
s->request_data.api_info = &s->api_info;
diff --git a/src/proxy/logging/LogAccess.cc b/src/proxy/logging/LogAccess.cc
index b2fc8d0da2..667f8eaf49 100644
--- a/src/proxy/logging/LogAccess.cc
+++ b/src/proxy/logging/LogAccess.cc
@@ -1609,14 +1609,18 @@ LogAccess::marshal_proxy_protocol_dst_ip(char *buf)
int
LogAccess::marshal_proxy_protocol_authority(char *buf)
{
- if (buf && m_http_sm) {
+ int len = INK_MIN_ALIGN;
+
+ if (m_http_sm) {
if (auto authority =
m_http_sm->t_state.pp_info.get_tlv(PP2_TYPE_AUTHORITY)) {
- int len = static_cast<int>(authority->size());
- marshal_str(buf, authority->data(), len);
- return len;
+ len = padded_length(authority->size() + 1);
+ if (buf) {
+ marshal_str(buf, authority->data(), len);
+ buf[authority->size()] = '\0';
+ }
}
}
- return 0;
+ return len;
}
/*-------------------------------------------------------------------------