From 5c00dcd8849c4912dd5f1220b7b3fb0456aefe01 Mon Sep 17 00:00:00 2001 From: Arthur Passos Date: Mon, 4 Jul 2022 09:08:45 -0300 Subject: [PATCH] Link cpp-dns/udns unconditionally and update submodules to clickhouse fork --- .gitmodules | 4 ++-- contrib/cpp-dns-cmake/CMakeLists.txt | 4 ++-- contrib/udns-cmake/CMakeLists.txt | 20 ++++++++++---------- src/CMakeLists.txt | 10 ++-------- src/Common/DNSResolver.cpp | 4 ++-- 5 files changed, 18 insertions(+), 24 deletions(-) diff --git a/.gitmodules b/.gitmodules index f212a901b8a..0b813722c60 100644 --- a/.gitmodules +++ b/.gitmodules @@ -276,7 +276,7 @@ url = https://github.com/ClickHouse/base-x.git [submodule "contrib/udns"] path = contrib/udns - url = https://github.com/arthurpassos/udns.git + url = https://github.com/ClickHouse/udns [submodule "contrib/cpp-dns"] path = contrib/cpp-dns - url = https://github.com/YukiWorkshop/cpp-dns.git \ No newline at end of file + url = https://github.com/ClickHouse/cpp-dns \ No newline at end of file diff --git a/contrib/cpp-dns-cmake/CMakeLists.txt b/contrib/cpp-dns-cmake/CMakeLists.txt index 96669df9e26..2ba803c28df 100644 --- a/contrib/cpp-dns-cmake/CMakeLists.txt +++ b/contrib/cpp-dns-cmake/CMakeLists.txt @@ -2,9 +2,9 @@ set(LIBRARY_DIR "${ClickHouse_SOURCE_DIR}/contrib/cpp-dns") set(SRCS "${LIBRARY_DIR}/DNSResolver.cpp") -set(HDRS "${LIBRARY_DIR}/DNSResolver.hpp") +#set(HDRS "${LIBRARY_DIR}/DNSResolver.hpp") -add_library(_cpp-dns ${SRCS} ${HDRS}) +add_library(_cpp-dns ${SRCS}) target_link_libraries(_cpp-dns boost::system boost::headers_only ch_contrib::udns) diff --git a/contrib/udns-cmake/CMakeLists.txt b/contrib/udns-cmake/CMakeLists.txt index 8a3e9bc4f8f..1266ea2b847 100644 --- a/contrib/udns-cmake/CMakeLists.txt +++ b/contrib/udns-cmake/CMakeLists.txt @@ -1,22 +1,22 @@ set(LIBRARY_DIR "${ClickHouse_SOURCE_DIR}/contrib/udns") add_library(_udns - "${LIBRARY_DIR}/udns_dn.c" + "${LIBRARY_DIR}/udns_bl.c" + "${LIBRARY_DIR}/udns_codes.c" "${LIBRARY_DIR}/udns_dntosp.c" + "${LIBRARY_DIR}/udns_init.c" + "${LIBRARY_DIR}/udns_jran.c" + "${LIBRARY_DIR}/udns_misc.c" "${LIBRARY_DIR}/udns_parse.c" "${LIBRARY_DIR}/udns_resolver.c" - "${LIBRARY_DIR}/udns_init.c" - "${LIBRARY_DIR}/udns_misc.c" - "${LIBRARY_DIR}/udns_XtoX.c" "${LIBRARY_DIR}/udns_rr_a.c" - "${LIBRARY_DIR}/udns_rr_ptr.c" "${LIBRARY_DIR}/udns_rr_mx.c" - "${LIBRARY_DIR}/udns_rr_txt.c" - "${LIBRARY_DIR}/udns_bl.c" - "${LIBRARY_DIR}/udns_rr_srv.c" "${LIBRARY_DIR}/udns_rr_naptr.c" - "${LIBRARY_DIR}/udns_codes.c" - "${LIBRARY_DIR}/udns_jran.c" + "${LIBRARY_DIR}/udns_rr_ptr.c" + "${LIBRARY_DIR}/udns_rr_srv.c" + "${LIBRARY_DIR}/udns_rr_txt.c" + "${LIBRARY_DIR}/udns_XtoX.c" + "${LIBRARY_DIR}/udns_dn.c" ) target_compile_definitions(_udns PRIVATE -DHAVE_CONFIG_H) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f66ffe4a5ee..dfff3bcfa1d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -439,14 +439,8 @@ if (TARGET ch_contrib::avrocpp) dbms_target_link_libraries(PRIVATE ch_contrib::avrocpp) endif () -if (TARGET ch_contrib::udns) - target_link_libraries (clickhouse_common_io PRIVATE ch_contrib::udns) -endif () - - -if (TARGET ch_contrib::cpp-dns) - target_link_libraries (clickhouse_common_io PRIVATE ch_contrib::cpp-dns) -endif () +target_link_libraries (clickhouse_common_io PRIVATE ch_contrib::udns) +target_link_libraries (clickhouse_common_io PRIVATE ch_contrib::cpp-dns) if (TARGET OpenSSL::Crypto) dbms_target_link_libraries (PRIVATE OpenSSL::Crypto) diff --git a/src/Common/DNSResolver.cpp b/src/Common/DNSResolver.cpp index 3f328768148..dff1f8e7521 100644 --- a/src/Common/DNSResolver.cpp +++ b/src/Common/DNSResolver.cpp @@ -147,12 +147,12 @@ static std::vector reverseResolveImpl(const Poco::Net::IPAddress & addre std::vector ptr_records; - resolver.resolve_a4ptr(boost::asio::ip::address_v4::from_string(address.toString()), [&](int err, auto& hosts, auto&, auto&, uint) { + resolver.resolve_a4ptr(boost::asio::ip::address_v4::from_string(address.toString()), [&](int err, auto & hosts, auto &, auto &, uint) { if (err) { throw Exception("Cannot resolve: " + address.toString() + YukiWorkshop::DNSResolver::error_string(err), ErrorCodes::DNS_ERROR); } - for (auto &it : hosts) { + for (auto & it : hosts) { ptr_records.emplace_back(it); }