aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/debug_utilities/dns_checks.cpp4
-rw-r--r--src/p2p/net_node.inl27
2 files changed, 27 insertions, 4 deletions
diff --git a/src/debug_utilities/dns_checks.cpp b/src/debug_utilities/dns_checks.cpp
index a59a08209..eebb35fc5 100644
--- a/src/debug_utilities/dns_checks.cpp
+++ b/src/debug_utilities/dns_checks.cpp
@@ -42,7 +42,7 @@
namespace po = boost::program_options;
-enum lookup_t { LOOKUP_A, LOOKUP_TXT };
+enum lookup_t { LOOKUP_A, LOOKUP_AAAA, LOOKUP_TXT };
static std::vector<std::string> lookup(lookup_t type, const char *hostname)
{
@@ -51,6 +51,7 @@ static std::vector<std::string> lookup(lookup_t type, const char *hostname)
switch (type)
{
case LOOKUP_A: res = tools::DNSResolver::instance().get_ipv4(hostname, dnssec_available, dnssec_valid); break;
+ case LOOKUP_AAAA: res = tools::DNSResolver::instance().get_ipv6(hostname, dnssec_available, dnssec_valid); break;
case LOOKUP_TXT: res = tools::DNSResolver::instance().get_txt_record(hostname, dnssec_available, dnssec_valid); break;
default: MERROR("Invalid lookup type: " << (int)type); return {};
}
@@ -130,6 +131,7 @@ int main(int argc, char* argv[])
mlog_set_categories("+" MONERO_DEFAULT_LOG_CATEGORY ":INFO");
lookup(LOOKUP_A, {"seeds.moneroseeds.se", "seeds.moneroseeds.ae.org", "seeds.moneroseeds.ch", "seeds.moneroseeds.li"});
+ lookup(LOOKUP_AAAA, {"seeds.moneroseeds.se", "seeds.moneroseeds.ae.org", "seeds.moneroseeds.ch", "seeds.moneroseeds.li"});
lookup(LOOKUP_TXT, {"updates.moneropulse.org", "updates.moneropulse.net", "updates.moneropulse.co", "updates.moneropulse.se", "updates.moneropulse.fr", "updates.moneropulse.de", "updates.moneropulse.no", "updates.moneropulse.ch"});
diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl
index 1a43c8ac2..f357c6037 100644
--- a/src/p2p/net_node.inl
+++ b/src/p2p/net_node.inl
@@ -779,8 +779,6 @@ namespace nodetool
// for each hostname in the seed nodes list, attempt to DNS resolve and
// add the result addresses as seed nodes
- // TODO: at some point add IPv6 support, but that won't be relevant
- // for some time yet.
std::vector<std::vector<std::string>> dns_results;
dns_results.resize(m_seed_nodes_list.size());
@@ -802,10 +800,12 @@ namespace nodetool
// TODO: care about dnssec avail/valid
bool avail, valid;
std::vector<std::string> addr_list;
+ std::vector<std::string> addr_list_ipv4;
+ std::vector<std::string> addr_list_ipv6;
try
{
- addr_list = tools::DNSResolver::instance().get_ipv4(addr_str, avail, valid);
+ addr_list_ipv4 = tools::DNSResolver::instance().get_ipv4(addr_str, avail, valid);
MDEBUG("dns_threads[" << result_index << "] DNS resolve done");
boost::this_thread::interruption_point();
}
@@ -815,9 +815,30 @@ namespace nodetool
// even if we now have results, finish thread without setting
// result variables, which are now out of scope in main thread
MWARNING("dns_threads[" << result_index << "] interrupted");
+ }
+
+ try
+ {
+ addr_list_ipv6 = tools::DNSResolver::instance().get_ipv6(addr_str, avail, valid);
+ MDEBUG("dns_threads[" << result_index << "] DNS resolve done");
+ boost::this_thread::interruption_point();
+ }
+ catch(const boost::thread_interrupted&)
+ {
+ // thread interruption request
+ // even if we now have results, finish thread without setting
+ // result variables, which are now out of scope in main thread
+ MWARNING("dns_threads[" << result_index << "] interrupted");
+ }
+
+ if (addr_list_ipv4.empty() && addr_list_ipv6.empty())
+ {
return;
}
+ addr_list.insert(addr_list.end(), addr_list_ipv4.begin(), addr_list_ipv4.end());
+ addr_list.insert(addr_list.end(), addr_list_ipv6.begin(), addr_list_ipv6.end());
+
MINFO("dns_threads[" << result_index << "] addr_str: " << addr_str << " number of results: " << addr_list.size());
dns_results[result_index] = addr_list;
});