aboutsummaryrefslogtreecommitdiff
path: root/src/p2p
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:55:09 -0600
commitfaaf2af43ba448454449f9aa3df240fd9af9e4d0 (patch)
treebb20825d758800181a70f27762b68e5760fce440 /src/p2p
parentMerge pull request #8593 (diff)
downloadmonero-faaf2af43ba448454449f9aa3df240fd9af9e4d0.tar.xz
p2p: fix exclusive node DNS resolution for certain hosts
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/p2p')
-rw-r--r--src/p2p/net_node.inl16
1 files changed, 3 insertions, 13 deletions
diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl
index f33ce977d..b2486431a 100644
--- a/src/p2p/net_node.inl
+++ b/src/p2p/net_node.inl
@@ -645,20 +645,10 @@ namespace nodetool
{
using namespace boost::asio;
- std::string host = addr;
+ // Split addr string into host string and port string
+ std::string host;
std::string port = std::to_string(default_port);
- size_t colon_pos = addr.find_last_of(':');
- size_t dot_pos = addr.find_last_of('.');
- size_t square_brace_pos = addr.find('[');
-
- // IPv6 will have colons regardless. IPv6 and IPv4 address:port will have a colon but also either a . or a [
- // as IPv6 addresses specified as address:port are to be specified as "[addr:addr:...:addr]:port"
- // One may also specify an IPv6 address as simply "[addr:addr:...:addr]" without the port; in that case
- // the square braces will be stripped here.
- if ((std::string::npos != colon_pos && std::string::npos != dot_pos) || std::string::npos != square_brace_pos)
- {
- net::get_network_address_host_and_port(addr, host, port);
- }
+ net::get_network_address_host_and_port(addr, host, port);
MINFO("Resolving node address: host=" << host << ", port=" << port);
io_service io_srv;