Skip to content

Commit 74b9e6f

Browse files
ezelkow1zwoop
authored andcommitted
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 5feefeb)
1 parent b044950 commit 74b9e6f

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

doc/admin-guide/files/records.config.en.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2596,6 +2596,15 @@ DNS
25962596
25972597
Maximum number of retries made by |TS| on a given DNS query
25982598

2599+
.. ts:cv:: CONFIG proxy.config.dns.local_ipv4 STRING NULL
2600+
2601+
Local IPV4 address to bind to in order to make DNS requests
2602+
2603+
.. ts:cv:: CONFIG proxy.config.dns.local_ipv6 STRING NULL
2604+
2605+
Local IPV6 address to bind to in order to make DNS requests
2606+
2607+
25992608
HostDB
26002609
======
26012610

iocore/dns/DNSConnection.cc

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -140,17 +140,6 @@ DNSConnection::connect(sockaddr const *addr, Options const &opt)
140140

141141
if (opt._bind_random_port) {
142142
int retries = 0;
143-
IpEndpoint bind_addr;
144-
size_t bind_size = 0;
145-
memset(&bind_addr, 0, sizeof bind_addr);
146-
bind_addr.sa.sa_family = af;
147-
if (AF_INET6 == af) {
148-
bind_addr.sin6.sin6_addr = in6addr_any;
149-
bind_size = sizeof bind_addr.sin6;
150-
} else {
151-
bind_addr.sin.sin_addr.s_addr = INADDR_ANY;
152-
bind_size = sizeof bind_addr.sin;
153-
}
154143
while (retries++ < 10000) {
155144
ip_port_text_buffer b;
156145
uint32_t p = generator.random();

0 commit comments

Comments
 (0)