You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2021/02/11 03:52:33 UTC

[trafficserver] branch 9.1.x updated: Fixing DNS local_ipv* config option (#7507)

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

zwoop pushed a commit to branch 9.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/9.1.x by this push:
     new 74b9e6f  Fixing DNS local_ipv* config option (#7507)
74b9e6f is described below

commit 74b9e6fb89cbc11e90b207a9dbe17e68aed6314e
Author: Evan Zelkowitz <ez...@apache.org>
AuthorDate: Tue Feb 9 14:16:14 2021 -0700

    Fixing DNS local_ipv* config option (#7507)
    
    The DNS local ip setting currently does not work. It gets overwritten with a default ANY address when we, by default, go to choose a random port. This removes the shadowing of the local variable that already has the local address either set via parameter or set to ANY if a parameter is not set.
    
    Also adding records docs to make this a real parameter that people can know about
    
    (cherry picked from commit 5feefebddc430322c1c3b6bec37e6fbce1c4b06a)
---
 doc/admin-guide/files/records.config.en.rst |  9 +++++++++
 iocore/dns/DNSConnection.cc                 | 11 -----------
 2 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/doc/admin-guide/files/records.config.en.rst b/doc/admin-guide/files/records.config.en.rst
index 6f78682..7050389 100644
--- a/doc/admin-guide/files/records.config.en.rst
+++ b/doc/admin-guide/files/records.config.en.rst
@@ -2596,6 +2596,15 @@ DNS
 
    Maximum number of retries made by |TS| on a given DNS query
 
+.. ts:cv:: CONFIG proxy.config.dns.local_ipv4 STRING NULL
+
+   Local IPV4 address to bind to in order to make DNS requests
+
+.. ts:cv:: CONFIG proxy.config.dns.local_ipv6 STRING NULL
+
+   Local IPV6 address to bind to in order to make DNS requests
+
+
 HostDB
 ======
 
diff --git a/iocore/dns/DNSConnection.cc b/iocore/dns/DNSConnection.cc
index 1f2dab6..35e49a2 100644
--- a/iocore/dns/DNSConnection.cc
+++ b/iocore/dns/DNSConnection.cc
@@ -140,17 +140,6 @@ DNSConnection::connect(sockaddr const *addr, Options const &opt)
 
   if (opt._bind_random_port) {
     int retries = 0;
-    IpEndpoint bind_addr;
-    size_t bind_size = 0;
-    memset(&bind_addr, 0, sizeof bind_addr);
-    bind_addr.sa.sa_family = af;
-    if (AF_INET6 == af) {
-      bind_addr.sin6.sin6_addr = in6addr_any;
-      bind_size                = sizeof bind_addr.sin6;
-    } else {
-      bind_addr.sin.sin_addr.s_addr = INADDR_ANY;
-      bind_size                     = sizeof bind_addr.sin;
-    }
     while (retries++ < 10000) {
       ip_port_text_buffer b;
       uint32_t p                      = generator.random();