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  8ac42b1   TS-4533 Support port numbers in resolv.conf (#709)
8ac42b1 is described below

commit 8ac42b1cdcd1086c4e3435ad06812333d51bb300
Author: Thomas Jackson <[email protected]>
AuthorDate: Tue Jun 14 11:42:36 2016 -0700

    TS-4533 Support port numbers in resolv.conf (#709)
    
    This feature is a HUGE benefit while testing (since test DNS servers don't 
need to run as root)-- but it might also be useful for other as well. To 
implement this we follow the convention everyone else seems to be following 
(namely the delimiter is `:` for ipv4, and `.` for ipv6):
    
        1.2.3.4:5553
        1::.5553
    
    this closes #709
---
 lib/ts/ink_res_init.cc | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

diff --git a/lib/ts/ink_res_init.cc b/lib/ts/ink_res_init.cc
index 1376ed0..b9de715 100644
--- a/lib/ts/ink_res_init.cc
+++ b/lib/ts/ink_res_init.cc
@@ -491,23 +491,13 @@ ink_res_init(ink_res_state statp,         ///< State 
object to update.
       }
       /* read nameservers to query */
       if (MATCH(buf, "nameserver") && nserv < maxns) {
-        struct addrinfo hints, *ai;
-        char sbuf[NI_MAXSERV];
-
         cp = buf + sizeof("nameserver") - 1;
         while (*cp == ' ' || *cp == '\t')
           cp++;
-        cp[strcspn(cp, ";# \t\n")] = '\0';
         if ((*cp != '\0') && (*cp != '\n')) {
-          memset(&hints, 0, sizeof(hints));
-          hints.ai_family = PF_UNSPEC;
-          hints.ai_socktype = SOCK_DGRAM; /*dummy*/
-          hints.ai_flags = AI_NUMERICHOST;
-          sprintf(sbuf, "%d", NAMESERVER_PORT);
-          if (getaddrinfo(cp, sbuf, &hints, &ai) == 0) {
-            if (ats_ip_copy(&statp->nsaddr_list[nserv].sa, ai->ai_addr))
-              ++nserv;
-            freeaddrinfo(ai);
+          ts::ConstBuffer host(cp, strcspn(cp, ";# \t\n"));
+          if (0 == ats_ip_pton(host, &statp->nsaddr_list[nserv].sa)) {
+            ++nserv;
           }
         }
         continue;

-- 
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].

Reply via email to