trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject [trafficserver] branch master updated: TS-4987: Don't prefer loopback over API set origin server address.
Date Thu, 24 Nov 2016 16:33:15 GMT
This is an automated email from the ASF dual-hosted git repository.

amc pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

The following commit(s) were added to refs/heads/master by this push:
       new  5485e15   TS-4987: Don't prefer loopback over API set origin server address.
5485e15 is described below

commit 5485e1568a278d5b03879d53f7ad438be3a803e0
Author: Alan M. Carroll <solidwallofcode@yahoo-inc.com>
AuthorDate: Wed Oct 19 10:16:15 2016 -0500

    TS-4987: Don't prefer loopback over API set origin server address.
---
 proxy/http/HttpSM.cc | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index 046810b..d5f60cc 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -7229,15 +7229,7 @@ HttpSM::set_next_state()
   case HttpTransact::SM_ACTION_DNS_LOOKUP: {
     sockaddr const *addr;
 
-    if ((strncmp(t_state.dns_info.lookup_name, "127.0.0.1", 9) == 0 || strncmp(t_state.dns_info.lookup_name,
"::1", 3) == 0) &&
-        ats_ip_pton(t_state.dns_info.lookup_name, t_state.host_db_info.ip()) == 0) {
-      // If it's 127.0.0.1 or ::1 don't bother with hostdb
-      DebugSM("dns", "[HttpTransact::HandleRequest] Skipping DNS lookup for %s because it's
loopback",
-              t_state.dns_info.lookup_name);
-      t_state.dns_info.lookup_success = true;
-      call_transact_and_set_next_state(nullptr);
-      break;
-    } else if (t_state.api_server_addr_set) {
+    if (t_state.api_server_addr_set) {
       /* If the API has set the server address before the OS DNS lookup
        * then we can skip the lookup
        */
@@ -7249,6 +7241,14 @@ HttpSM::set_next_state()
       t_state.dns_info.lookup_success = true;
       call_transact_and_set_next_state(nullptr);
       break;
+    } else if (0 == ats_ip_pton(t_state.dns_info.lookup_name, t_state.host_db_info.ip())
&&
+               ats_is_ip_loopback(t_state.host_db_info.ip())) {
+      // If it's 127.0.0.1 or ::1 don't bother with hostdb
+      DebugSM("dns", "[HttpTransact::HandleRequest] Skipping DNS lookup for %s because it's
loopback",
+              t_state.dns_info.lookup_name);
+      t_state.dns_info.lookup_success = true;
+      call_transact_and_set_next_state(NULL);
+      break;
     } else if (url_remap_mode == HttpTransact::URL_REMAP_FOR_OS && t_state.first_dns_lookup)
{
       DebugSM("cdn", "Skipping DNS Lookup");
       // skip the DNS lookup

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].

Mime
View raw message