aboutsummaryrefslogtreecommitdiff
path: root/src/net/parse.cpp
diff options
context:
space:
mode:
authorJeffrey Ryan <jeffreyryan@tutanota.com>2022-11-16 15:53:15 -0600
committerJeffrey Ryan <jeffreyryan@tutanota.com>2022-11-17 18:57:04 -0600
commit38d4811c890997f20f4a3eea1b429e18bbfb4024 (patch)
treedcc2cc83c9359ff2ad7638dd34137bbbeab5344a /src/net/parse.cpp
parentMerge pull request #8594 (diff)
downloadmonero-38d4811c890997f20f4a3eea1b429e18bbfb4024.tar.xz
p2p: fix exclusive node DNS resolution for certain hosts [release]
Fixes #8633. The function `append_net_address` did not parse hostname + port addresses (e.g. `bar:29080`) correctly if the hostname did not contain a `'.'` character. @vtnerd comments 1 clear up 2nd conditional statement
Diffstat (limited to 'src/net/parse.cpp')
-rw-r--r--src/net/parse.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/net/parse.cpp b/src/net/parse.cpp
index 1df6175b4..92be492a3 100644
--- a/src/net/parse.cpp
+++ b/src/net/parse.cpp
@@ -38,7 +38,7 @@ namespace net
{
void get_network_address_host_and_port(const std::string& address, std::string& host, std::string& port)
{
- // require ipv6 address format "[addr:addr:addr:...:addr]:port"
+ // If IPv6 address format with port "[addr:addr:addr:...:addr]:port"
if (address.find(']') != std::string::npos)
{
host = address.substr(1, address.rfind(']') - 1);
@@ -47,6 +47,12 @@ namespace net
port = address.substr(address.rfind(':') + 1);
}
}
+ // Else if IPv6 address format without port e.g. "addr:addr:addr:...:addr"
+ else if (std::count(address.begin(), address.end(), ':') >= 2)
+ {
+ host = address;
+ }
+ // Else IPv4, Tor, I2P address or hostname
else
{
host = address.substr(0, address.rfind(':'));