ignore remote-random-hostname if a numeric host is provided
PATCH 1/1 ignore remote-random-hostname if a numeric host is provided
Although it does not make sense to specify remote-random-hostname when a numeric hostname is provided (being it the remote, the http proxy or the socks server), this is still a valid configuration.
For this reason, this combination should still work as expected, which means ignoring the randomization and directly using the numeric IP.
Signed-off-by Antonio Quartulli <[email protected]...>
--- src/openvpn/socket.c | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-)
src/openvpn/socket.c +18 -14
@@ -338,20 +338,6 @@ openvpn_getaddrinfo(unsigned int flags,ASSERT (hostname || servname);ASSERT (!(flags &GETADDR_HOST_ORDER )); -if (hostname && (flags &GETADDR_RANDOMIZE )) - { - hostname =hostname_randomize (hostname, &gc); - } - -if (hostname) - { - print_hostname = hostname; - } -else - { - print_hostname ="undefined" ; - } -if (servname) { print_servname = servname;
@@ -402,6 +388,20 @@ openvpn_getaddrinfo(unsigned int flags,const char *fmt;int level =0 ; +if (hostname && (flags &GETADDR_RANDOMIZE )) + { + hostname =hostname_randomize (hostname, &gc); + } + +if (hostname) + { + print_hostname = hostname; + } +else + { + print_hostname ="undefined" ; + } + fmt ="RESOLVE: Cannot resolve host address: %s:%s (%s)" ;if ((flags &GETADDR_MENTION_RESOLVE_RETRY ) && !resolve_retry_seconds)
@@ -512,6 +512,10 @@ openvpn_getaddrinfo(unsigned int flags,else {/* IP address parse succeeded */ +if (flags &GETADDR_RANDOMIZE ) + { +msg (M_WARN ,"WARNING: ignoring --remote-random-hostname because the hostname is an IP address" ); + } } done:
Signature · 1 line
2.11.0
ACK. "Makes sense and the code does what it says on the lid" (tested!)
Your patch has been applied to the master and release/2.4 branch.
commit 3c748aeb5e4b82c449e7de28846a3915ab45aeec (master) commit 0dc790818876dac6e1cf1a82eda8ea15a538a333 (master)
Author: Antonio Quartulli Date: Mon Jan 30 23:26:58 2017 +0800
ignore remote-random-hostname if a numeric host is provided
Signed-off-by: Antonio Quartulli <[email protected]...>
Acked-by: Gert Doering <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg13993.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering