From 0288875f6c1ffe53c656c3adc78caa9da1c2f846 Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Mon, 6 Jun 2011 20:13:37 -0600 Subject: [PATCH] Bug 3236: Port of %oa, %type can not be LFT_PEER_LOCAL_IP_OLD_27 + // but compiler complains if ommited + case LFT_PEER_LOCAL_IP_OLD_27: + case LFT_PEER_LOCAL_IP: + if (!al->hier.peer_local_addr.IsAnyAddr()) { + out = al->hier.peer_local_addr.NtoA(tmp,sizeof(tmp)); + } + break; + + case LFT_PEER_LOCAL_PORT: + if ((outint = al->hier.peer_local_addr.GetPort())) { + doint = 1; + } + + break; + case LFT_TIME_SECONDS_SINCE_EPOCH: // some platforms store time in 32-bit, some 64-bit... outoff = static_cast(current_time.tv_sec); @@ -1498,6 +1521,12 @@ done: debugs(46, 0, "WARNING: the \"Hs\" formating code is deprecated use the \">Hs\" instead"); lt->type = LFT_HTTP_SENT_STATUS_CODE; break; + + case LFT_PEER_LOCAL_IP_OLD_27: + debugs(46, 0, "WARNING: The \"oa\" formatting code is deprecated. Use the \"type = LFT_PEER_LOCAL_IP; + break; + default: break; } @@ -2049,7 +2078,8 @@ HierarchyLogEntry::HierarchyLogEntry() : n_ichoices(0), peer_reply_status(HTTP_STATUS_NONE), peer_response_time(-1), - total_response_time(-1) + total_response_time(-1), + peer_local_addr() { memset(host, '\0', SQUIDHOSTNAMELEN); memset(cd_host, '\0', SQUIDHOSTNAMELEN); diff --git a/src/cf.data.pre b/src/cf.data.pre index 23a7dd91e6..6383ca86ca 100644 --- a/src/cf.data.pre +++ b/src/cf.data.pre @@ -2535,6 +2535,8 @@ DOC_START hier.peer_local_addr = fd_table[fd].local_addr; + dispatch(); return; @@ -950,6 +953,9 @@ FwdState::connectStart() if (!fs->_peer) origin_tries++; + if (comm_local_port(fd)) + request->hier.peer_local_addr = fd_table[fd].local_addr; + /* * stats.conn_open is used to account for the number of * connections that we have open to the peer, so we can limit diff --git a/src/tunnel.cc b/src/tunnel.cc index eb34ce568b..d1719ecc08 100644 --- a/src/tunnel.cc +++ b/src/tunnel.cc @@ -676,6 +676,10 @@ tunnelStart(ClientHttpRequest * http, int64_t * size_ptr, int *status_ptr) return; } + // record local IP:port for %hier.peer_local_addr = fd_table[sock].local_addr; + tunnelState = new TunnelStateData; #if DELAY_POOLS -- 2.47.2