This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/9.0.x by this push:
     new a4090bf  Update Server IP in Transaction when attaching a session from 
the pool
a4090bf is described below

commit a4090bfa6b32a075d573ab7e7ddfb967708621ca
Author: Sudheer Vinukonda <[email protected]>
AuthorDate: Tue Sep 3 14:05:44 2019 -0700

    Update Server IP in Transaction when attaching a session from the pool
    
    IP may be mismatched when using Host based matching as the DNS IP is
    ignored which may cause txn logging (nhi) to be inaccurate
    
    Fix build
    
    (cherry picked from commit 9de4f2481556b3d7eca9c63813c5d4a8be23cbf1)
---
 proxy/http/HttpSM.cc | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index 62cbb75..62775ce 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -5842,6 +5842,17 @@ HttpSM::attach_server_session(Http1ServerSession *s)
   hsm_release_assert(s->state == HSS_ACTIVE);
   server_session        = s;
   server_transact_count = server_session->transact_count++;
+
+  // update the dst_addr when using an existing session
+  // for e.g using Host based session pools may ignore the DNS IP
+  if (!ats_ip_addr_eq(&t_state.current.server->dst_addr, 
&server_session->get_server_ip())) {
+    ip_port_text_buffer ipb1, ipb2;
+    Debug("http_ss", "updating ip when attaching server session from %s to %s",
+          ats_ip_ntop(&t_state.current.server->dst_addr.sa, ipb1, 
sizeof(ipb1)),
+          ats_ip_ntop(&server_session->get_server_ip(), ipb2, sizeof(ipb2)));
+    ats_ip_copy(&t_state.current.server->dst_addr, 
&server_session->get_server_ip());
+  }
+
   // Propagate the per client IP debugging
   if (ua_txn) {
     s->get_netvc()->control_flags.set_flags(get_cont_flags().get_flags());

Reply via email to