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

sudheerv 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 9de4f24  Update Server IP in Transaction when attaching a session from 
the pool
9de4f24 is described below

commit 9de4f2481556b3d7eca9c63813c5d4a8be23cbf1
Author: Sudheer Vinukonda <sudhe...@apache.org>
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
---
 proxy/http/HttpSM.cc | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index a7c9a3d..793b82f 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -5888,6 +5888,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