You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by ja...@apache.org on 2016/07/21 14:36:49 UTC

[trafficserver] branch master updated: TS-4688 handle DNS compression labels in SRV responses (#812)

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

jacksontj 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  6574400   TS-4688 handle DNS compression labels in SRV responses (#812)
6574400 is described below

commit 65744001b7a6f604246584954dfa3caa66771949
Author: Thomas Jackson <ja...@gmail.com>
AuthorDate: Thu Jul 21 07:36:42 2016 -0700

    TS-4688 handle DNS compression labels in SRV responses (#812)
    
    This closes #812
---
 iocore/dns/DNS.cc | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/iocore/dns/DNS.cc b/iocore/dns/DNS.cc
index a774fed..c2fa8a1 100644
--- a/iocore/dns/DNS.cc
+++ b/iocore/dns/DNS.cc
@@ -1514,24 +1514,24 @@ dns_process(DNSHandler *handler, HostEnt *buf, int len)
         cp += dn_skipname(cp, eom);
         here     = cp; /* hack */
         SRV *srv = &buf->srv_hosts.hosts[num_srv];
-        int r    = ink_ns_name_ntop(srv_off + SRV_SERVER, srv->host, MAXDNAME);
-        if (r <= 0) {
-          /* FIXME: is this really an error? or just a continue; */
+
+        // expand the name
+        n = ink_dn_expand((u_char *)h, eom, srv_off + SRV_SERVER, (u_char *)srv->host, MAXDNAME);
+        if (n < 0) {
           ++error;
-          goto Lerror;
+          break;
         }
         Debug("dns_srv", "Discovered SRV record [from NS lookup] with cost:%d weight:%d port:%d with host:%s",
               ink_get16(srv_off + SRV_COST), ink_get16(srv_off + SRV_WEIGHT), ink_get16(srv_off + SRV_PORT), srv->host);
 
-        srv->port        = ink_get16(srv_off + SRV_PORT);
-        srv->priority    = ink_get16(srv_off + SRV_COST);
-        srv->weight      = ink_get16(srv_off + SRV_WEIGHT);
-        srv->host_len    = r;
-        srv->host[r - 1] = '\0';
-        srv->key         = makeHostHash(srv->host);
+        srv->port     = ink_get16(srv_off + SRV_PORT);
+        srv->priority = ink_get16(srv_off + SRV_COST);
+        srv->weight   = ink_get16(srv_off + SRV_WEIGHT);
+        srv->host_len = ::strlen(srv->host) + 1;
+        srv->key      = makeHostHash(srv->host);
 
         if (srv->host[0] != '\0')
-          buf->srv_hosts.srv_hosts_length += r;
+          buf->srv_hosts.srv_hosts_length += srv->host_len;
         else
           continue;
         ++num_srv;

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