diff --git a/a531524a3d085fcd9a5e25d5f6cbdb953082c2b9.patch b/a531524a3d085fcd9a5e25d5f6cbdb953082c2b9.patch new file mode 100644 index 0000000..570870e --- /dev/null +++ b/a531524a3d085fcd9a5e25d5f6cbdb953082c2b9.patch @@ -0,0 +1,318 @@ +commit a531524a3d085fcd9a5e25d5f6cbdb953082c2b9 +Author: Brad House +Date: Fri Jan 3 12:55:54 2025 -0500 + + tests: Convert some live tests to Mock tests (#954) + + In Issue #953 `GetTCPSock` and `VerifySocketFunctionCallback` tests + might rely on the fact that `connect()` doesn't return an immediate + failure. If `connect()` returned `EWOULDBLOCK`/`EAGAIN` the test would + succeed, but on systems that check on the call for available routes or + listening servers on localhost the `connect()` function would return an + immediate failure. + + These functions were not actually tagged with a `Live` prefix so they + would run even callers exclude Live tests. These are testing functions + that shouldn't be limited to live scenarios so we need to move them to + the Mock frameworks and test appropriately. + + Fixes #953 + Signed-off-by: Brad House (@bradh352) + +diff --git a/test/ares-test-live.cc b/test/ares-test-live.cc +index e23dadfe..557c485e 100644 +--- a/test/ares-test-live.cc ++++ b/test/ares-test-live.cc +@@ -669,115 +669,7 @@ VIRT_NONVIRT_TEST_F(DefaultChannelTest, LiveGetNameInfoAllocFail) { + EXPECT_EQ(ARES_ENOMEM, result.status_); + } + +-VIRT_NONVIRT_TEST_F(DefaultChannelTest, GetSock) { +- ares_socket_t socks[3] = {ARES_SOCKET_BAD, ARES_SOCKET_BAD, ARES_SOCKET_BAD}; +- int bitmask = ares_getsock(channel_, socks, 3); +- EXPECT_EQ(0, bitmask); +- bitmask = ares_getsock(channel_, nullptr, 0); +- EXPECT_EQ(0, bitmask); +- +- // Ask again with a pending query. +- HostResult result; +- ares_gethostbyname(channel_, "www.google.com.", AF_INET, HostCallback, &result); +- bitmask = ares_getsock(channel_, socks, 3); +- EXPECT_NE(0, bitmask); +- +- size_t sock_cnt = 0; +- for (size_t i=0; i<3; i++) { +- if (ARES_GETSOCK_READABLE(bitmask, i) || ARES_GETSOCK_WRITABLE(bitmask, i)) { +- EXPECT_NE(ARES_SOCKET_BAD, socks[i]); +- if (socks[i] != ARES_SOCKET_BAD) +- sock_cnt++; +- } +- } +- EXPECT_NE((size_t)0, sock_cnt); +- +- bitmask = ares_getsock(channel_, nullptr, 0); +- EXPECT_EQ(0, bitmask); +- +- Process(); +-} +- +-TEST_F(LibraryTest, GetTCPSock) { +- ares_channel_t *channel; +- struct ares_options opts; +- memset(&opts, 0, sizeof(opts)); +- opts.tcp_port = 53; +- opts.flags = ARES_FLAG_USEVC; +- int optmask = ARES_OPT_TCP_PORT | ARES_OPT_FLAGS; +- EXPECT_EQ(ARES_SUCCESS, ares_init_options(&channel, &opts, optmask)); +- EXPECT_NE(nullptr, channel); +- +- ares_socket_t socks[3] = {ARES_SOCKET_BAD, ARES_SOCKET_BAD, ARES_SOCKET_BAD}; +- int bitmask = ares_getsock(channel, socks, 3); +- EXPECT_EQ(0, bitmask); +- bitmask = ares_getsock(channel, nullptr, 0); +- EXPECT_EQ(0, bitmask); +- +- // Ask again with a pending query. +- HostResult result; +- ares_gethostbyname(channel, "www.google.com.", AF_INET, HostCallback, &result); +- bitmask = ares_getsock(channel, socks, 3); +- EXPECT_NE(0, bitmask); +- +- size_t sock_cnt = 0; +- for (size_t i=0; i<3; i++) { +- if (ARES_GETSOCK_READABLE(bitmask, i) || ARES_GETSOCK_WRITABLE(bitmask, i)) { +- EXPECT_NE(ARES_SOCKET_BAD, socks[i]); +- if (socks[i] != ARES_SOCKET_BAD) +- sock_cnt++; +- } +- } +- EXPECT_NE((size_t)0, sock_cnt); +- +- bitmask = ares_getsock(channel, nullptr, 0); +- EXPECT_EQ(0, bitmask); +- +- ProcessWork(channel, NoExtraFDs, nullptr); + +- ares_destroy(channel); +-} +- +-TEST_F(DefaultChannelTest, VerifySocketFunctionCallback) { +- VirtualizeIO vio(channel_); +- +- auto my_functions = VirtualizeIO::default_functions; +- size_t count = 0; +- +- my_functions.asocket = [](int af, int type, int protocol, void * p) -> ares_socket_t { +- EXPECT_NE(nullptr, p); +- (*reinterpret_cast(p))++; +- return ::socket(af, type, protocol); +- }; +- +- ares_set_socket_functions(channel_, &my_functions, &count); +- +- { +- count = 0; +- HostResult result; +- ares_gethostbyname(channel_, "www.google.com.", AF_INET, HostCallback, &result); +- Process(); +- +- EXPECT_TRUE(result.done_); +- EXPECT_NE((size_t)0, count); +- } +- +- { +- count = 0; +- ares_channel_t *copy; +- EXPECT_EQ(ARES_SUCCESS, ares_dup(©, channel_)); +- +- HostResult result; +- ares_gethostbyname(copy, "www.google.com.", AF_INET, HostCallback, &result); +- +- ProcessWork(copy, NoExtraFDs, nullptr); +- +- EXPECT_TRUE(result.done_); +- ares_destroy(copy); +- EXPECT_NE((size_t)0, count); +- } +- +-} + + TEST_F(DefaultChannelTest, LiveSetServers) { + struct ares_addr_node server1; +diff --git a/test/ares-test-mock.cc b/test/ares-test-mock.cc +index 8c74c05f..ebae7140 100644 +--- a/test/ares-test-mock.cc ++++ b/test/ares-test-mock.cc +@@ -1662,6 +1662,135 @@ TEST_P(MockChannelTest, GetHostByAddrDestroy) { + EXPECT_EQ(0, result.timeouts_); + } + ++TEST_P(MockUDPChannelTest, GetSock) { ++ DNSPacket reply; ++ reply.set_response().set_aa() ++ .add_question(new DNSQuestion("www.google.com", T_A)) ++ .add_answer(new DNSARR("www.google.com", 0x0100, {0x01, 0x02, 0x03, 0x04})); ++ ON_CALL(server_, OnRequest("www.google.com", T_A)) ++ .WillByDefault(SetReply(&server_, &reply)); ++ ++ ares_socket_t socks[3] = {ARES_SOCKET_BAD, ARES_SOCKET_BAD, ARES_SOCKET_BAD}; ++ int bitmask; ++ ++ bitmask = ares_getsock(channel_, socks, 3); ++ EXPECT_EQ(0, bitmask); ++ bitmask = ares_getsock(channel_, nullptr, 0); ++ EXPECT_EQ(0, bitmask); ++ ++ // Ask again with a pending query. ++ HostResult result; ++ ares_gethostbyname(channel_, "www.google.com.", AF_INET, HostCallback, &result); ++ bitmask = ares_getsock(channel_, socks, 3); ++ EXPECT_NE(0, bitmask); ++ ++ size_t sock_cnt = 0; ++ for (size_t i=0; i<3; i++) { ++ if (ARES_GETSOCK_READABLE(bitmask, i) || ARES_GETSOCK_WRITABLE(bitmask, i)) { ++ EXPECT_NE(ARES_SOCKET_BAD, socks[i]); ++ if (socks[i] != ARES_SOCKET_BAD) ++ sock_cnt++; ++ } ++ } ++ EXPECT_NE((size_t)0, sock_cnt); ++ ++ Process(); ++ ++ bitmask = ares_getsock(channel_, nullptr, 0); ++ EXPECT_EQ(0, bitmask); ++} ++ ++TEST_P(MockTCPChannelTest, GetSock) { ++ DNSPacket reply; ++ reply.set_response().set_aa() ++ .add_question(new DNSQuestion("www.google.com", T_A)) ++ .add_answer(new DNSARR("www.google.com", 0x0100, {0x01, 0x02, 0x03, 0x04})); ++ ON_CALL(server_, OnRequest("www.google.com", T_A)) ++ .WillByDefault(SetReply(&server_, &reply)); ++ ++ ares_socket_t socks[3] = {ARES_SOCKET_BAD, ARES_SOCKET_BAD, ARES_SOCKET_BAD}; ++ int bitmask; ++ ++ bitmask = ares_getsock(channel_, socks, 3); ++ EXPECT_EQ(0, bitmask); ++ bitmask = ares_getsock(channel_, nullptr, 0); ++ EXPECT_EQ(0, bitmask); ++ ++ // Ask again with a pending query. ++ HostResult result; ++ ares_gethostbyname(channel_, "www.google.com.", AF_INET, HostCallback, &result); ++ bitmask = ares_getsock(channel_, socks, 3); ++ EXPECT_NE(0, bitmask); ++ ++ size_t sock_cnt = 0; ++ for (size_t i=0; i<3; i++) { ++ if (ARES_GETSOCK_READABLE(bitmask, i) || ARES_GETSOCK_WRITABLE(bitmask, i)) { ++ EXPECT_NE(ARES_SOCKET_BAD, socks[i]); ++ if (socks[i] != ARES_SOCKET_BAD) ++ sock_cnt++; ++ } ++ } ++ EXPECT_NE((size_t)0, sock_cnt); ++ ++ Process(); ++ ++ bitmask = ares_getsock(channel_, nullptr, 0); ++ EXPECT_EQ(0, bitmask); ++} ++ ++ ++TEST_P(MockChannelTest, VerifySocketFunctionCallback) { ++ ares_socket_functions sock_funcs; ++ memset(&sock_funcs, 0, sizeof(sock_funcs)); ++ ++ DNSPacket reply; ++ reply.set_response().set_aa() ++ .add_question(new DNSQuestion("www.google.com", T_A)) ++ .add_answer(new DNSARR("www.google.com", 0x0100, {0x01, 0x02, 0x03, 0x04})); ++ ON_CALL(server_, OnRequest("www.google.com", T_A)) ++ .WillByDefault(SetReply(&server_, &reply)); ++ ++ size_t count = 0; ++ ++ sock_funcs.asocket = [](int af, int type, int protocol, void * p) -> ares_socket_t { ++ EXPECT_NE(nullptr, p); ++ (*reinterpret_cast(p))++; ++ return ::socket(af, type, protocol); ++ }; ++ ++ ares_set_socket_functions(channel_, &sock_funcs, &count); ++ ++ { ++ count = 0; ++ HostResult result; ++ ares_gethostbyname(channel_, "www.google.com.", AF_INET, HostCallback, &result); ++ Process(); ++ ++ EXPECT_TRUE(result.done_); ++ EXPECT_EQ(ARES_SUCCESS, result.status_); ++ EXPECT_EQ(0, result.timeouts_); ++ EXPECT_NE((size_t)0, count); ++ } ++ ++ { ++ count = 0; ++ ares_channel_t *copy; ++ EXPECT_EQ(ARES_SUCCESS, ares_dup(©, channel_)); ++ ++ HostResult result; ++ ares_gethostbyname(copy, "www.google.com.", AF_INET, HostCallback, &result); ++ ++ ProcessAltChannel(copy); ++ ++ EXPECT_TRUE(result.done_); ++ ares_destroy(copy); ++ EXPECT_NE((size_t)0, count); ++ EXPECT_EQ(ARES_SUCCESS, result.status_); ++ EXPECT_EQ(0, result.timeouts_); ++ } ++ ++} ++ + static const unsigned char * + fetch_server_cookie(const ares_dns_record_t *dnsrec, size_t *len) + { +diff --git a/test/ares-test.cc b/test/ares-test.cc +index 99ab0a00..f383ecbe 100644 +--- a/test/ares-test.cc ++++ b/test/ares-test.cc +@@ -888,14 +888,18 @@ void MockChannelOptsTest::ProcessFD(ares_socket_t fd) { + } + } + +-void MockChannelOptsTest::Process(unsigned int cancel_ms) { ++void MockChannelOptsTest::ProcessAltChannel(ares_channel_t *chan, unsigned int cancel_ms) { + using namespace std::placeholders; +- ProcessWork(channel_, ++ ProcessWork(chan, + std::bind(&MockChannelOptsTest::fds, this), + std::bind(&MockChannelOptsTest::ProcessFD, this, _1), + cancel_ms); + } + ++void MockChannelOptsTest::Process(unsigned int cancel_ms) { ++ ProcessAltChannel(channel_, cancel_ms); ++} ++ + void MockEventThreadOptsTest::Process(unsigned int cancel_ms) { + std::set fds; + +diff --git a/test/ares-test.h b/test/ares-test.h +index 61275921..77baa902 100644 +--- a/test/ares-test.h ++++ b/test/ares-test.h +@@ -328,6 +328,7 @@ public: + + // Process all pending work on ares-owned and mock-server-owned file + // descriptors. ++ void ProcessAltChannel(ares_channel_t *chan, unsigned int cancel_ms = 0); + void Process(unsigned int cancel_ms = 0); + + protected: diff --git a/c-ares-1.30.0.tar.gz b/c-ares-1.30.0.tar.gz deleted file mode 100644 index 597ca03..0000000 --- a/c-ares-1.30.0.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:4fea312112021bcef081203b1ea020109842feb58cd8a36a3d3f7e0d8bc1138c -size 1009440 diff --git a/c-ares-1.30.0.tar.gz.asc b/c-ares-1.30.0.tar.gz.asc deleted file mode 100644 index c6da82c..0000000 --- a/c-ares-1.30.0.tar.gz.asc +++ /dev/null @@ -1,7 +0,0 @@ ------BEGIN PGP SIGNATURE----- - -iHUEABYKAB0WIQR162yg5j6QxP8sho/B0VYRsuRyCwUCZmLmtQAKCRDB0VYRsuRy -CzQKAQDCSS0EUT08hI7KC3KmqrWQGEU0UN2rddaz9Lg3k67MUAD8Cmq7tr8XOCRH -FKd2USXldyCwePWqfTZ5EJzXMuhemgw= -=utMN ------END PGP SIGNATURE----- diff --git a/c-ares-1.34.4.tar.gz b/c-ares-1.34.4.tar.gz new file mode 100644 index 0000000..428b404 --- /dev/null +++ b/c-ares-1.34.4.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fa38dbed659ee4cc5a32df5e27deda575fa6852c79a72ba1af85de35a6ae222f +size 1001209 diff --git a/c-ares-1.34.4.tar.gz.asc b/c-ares-1.34.4.tar.gz.asc new file mode 100644 index 0000000..3acb0c7 --- /dev/null +++ b/c-ares-1.34.4.tar.gz.asc @@ -0,0 +1,7 @@ +-----BEGIN PGP SIGNATURE----- + +iHUEABYKAB0WIQR162yg5j6QxP8sho/B0VYRsuRyCwUCZ12h2wAKCRDB0VYRsuRy +CxKEAP91aSsfGvFmgxEI6MAwR+RpqGG3rd4BrbWPyyiOfZ1t4wD/dDpVlP48TvqG +QlzCeji6ngkysUh2hXqVhrLmyb8HWgY= +=wI3w +-----END PGP SIGNATURE----- diff --git a/c-ares.changes b/c-ares.changes index 26abbf8..bb60e4f 100644 --- a/c-ares.changes +++ b/c-ares.changes @@ -1,3 +1,127 @@ +------------------------------------------------------------------- +Fri Jan 3 22:36:24 UTC 2025 - Adam Majer + +- skip-test.patch replaced with upstream unit test fix + a531524a3d085fcd9a5e25d5f6cbdb953082c2b9.patch + +------------------------------------------------------------------- +Mon Dec 30 11:13:26 UTC 2024 - Adam Majer + +- c-ares 1.34.4 +This is a bugfix release. +Changes: + + QNX Port: Port to QNX 8, add primary config reading support, add CI build. PR #934, PR #937, PR #938 + +Bugfixes: + Empty TXT records were not being preserved. PR #922 + docs: update deprecation notices for ares_create_query() and ares_mkquery(). PR #910 + license: some files weren't properly updated. PR #920 + Fix bind local device regression from 1.34.0. PR #929, PR #931, PR #935 + CMake: set policy version to prevent deprecation warnings. PR #932 + CMake: shared and static library names should be the same on unix platforms like autotools uses. PR #933 + Update to latest autoconf archive macros for enhanced system compatibility. PR #936 + +In version 1.34.3 +This is a bugfix release. +Changes: + Build the release package in an automated way so we can provide provenance as per SLSA3. PR #906 + +Bugfixes: + Some upstream servers are non-compliant with EDNS options, resend queries without EDNS. Issue #911 + TSAN warns on missing lock, but lock isn't actually necessary. PR #915 + ares_getaddrinfo() for AF_UNSPEC should retry IPv4 if only IPv6 is received. 765d558 + ares_send() shouldn't return ARES_EBADRESP, its ARES_EBADQUERY. 91519e7 + Fix typos in man pages. PR #905 + +- skip-test.patch: fix failing tests + +------------------------------------------------------------------- +Tue Oct 29 09:24:43 UTC 2024 - Adam Majer + +- c-ares 1.34.2 + +Features: +* adig: read arguments from adigrc. [PR #856] +* Add new pending write callback optimization via `ares_set_pending_write_cb`. [PR #857] +* New function `ares_process_fds()`. [PR #875] +* Failed servers should be probed rather than redirecting queries which could + cause unexpected latency. [PR #877] +* adig: rework command line arguments to mimic dig from bind. [PR #890] +* Add new method for overriding network functions + `ares_set_socket_function_ex()` to properly support all new functionality. + [PR #894] +* Fix regression with custom socket callbacks due to DNS cookie support. [PR #895] +* ares_socket: set IP_BIND_ADDRESS_NO_PORT on ares_set_local_ip* tcp sockets [PR #887] +* URI parser/writer for ares_set_servers_csv()/ares_get_servers_csv(). [PR #882] + +Changes: +* Connection handling modularization. [PR #857], [PR #876] +* Expose library/utility functions to tools. [PR #860] +* Remove `ares__` prefix, just use `ares_` for internal functions. [PR #872] + +Bugfixes: +* fix: potential WIN32_LEAN_AND_MEAN redefinition. + [PR #869] +* Fix googletest v1.15 compatibility. + [PR #874] +* Fix pkgconfig thread dependencies. + [PR #884] + +Features in 1.33.0: +* Add DNS cookie support (RFC7873 + RFC9018) to help prevent off-path cache + poisoning attacks. [PR #833] +* Implement TCP FastOpen (TFO) RFC7413, which will make TCP reconnects 0-RTT + on supported systems. [PR #840] + +Changes: +* Reorganize source tree. [PR #822] +* Refactoring of connection handling to prevent code duplication. [PR #839] +* New dynamic array data structure to prevent simple logic flaws in array + handling in various code paths. [PR #841] + +Bugfixes: +* `ares_destroy()` race condition during shutdown due to missing lock. [PR #831] + +Features in 1.32: + +* Add support for DNS 0x20 to help prevent cache poisoning attacks, enabled + by specifying `ARES_FLAG_DNS0x20`. Disabled by default. [PR #800] +* Rework query timeout logic to automatically adjust timeouts based on network + conditions. The timeout specified now is only used as a hint until there + is enough history to calculate a more valid timeout. [PR #794] + +Changes: + +* DNS RR TXT strings should not be automatically concatenated as there are use + cases outside of RFC 7208. In order to maintain ABI compliance, the ability + to retrieve TXT strings concatenated is retained as well as a new API to + retrieve the individual strings. This restores behavior from c-ares 1.20.0. + [PR #801] +* Clean up header inclusion logic to make hacking on code easier. [PR #797] +* GCC/Clang: Enable even more strict warnings to catch more coding flaws. [253bdee] + +Bugfixes: + +* Tests: Fix thread race condition in test cases for EventThread. [PR #803] +* Thread Saftey: `ares_timeout()` was missing lock. [74a64e4] + +------------------------------------------------------------------- +Tue Jun 18 13:51:01 UTC 2024 - Adam Majer + +- c-ares 1.31.0 + +Changes: +* Enable Query Cache by default. [PR #786] + +Bugfixes: +* Enhance Windows DNS configuration change detection to also + detect manual DNS configuration changes. [PR #785] +* Various legacy MacOS Build fixes. [Issue #782] +* Ndots value of zero in resolv.conf was not being honored. [852a60a] +* Watt-32 build support had been broken for some time. [PR #781] +* Distribute `ares_dns_rec_type_tostr` manpage. [PR #778] + ------------------------------------------------------------------- Mon Jun 10 11:36:09 UTC 2024 - Adam Majer diff --git a/c-ares.spec b/c-ares.spec index 51d78c1..26be8ce 100644 --- a/c-ares.spec +++ b/c-ares.spec @@ -26,7 +26,7 @@ %endif Name: c-ares%pkg_suffix -Version: 1.30.0 +Version: 1.34.4 Release: 0 Summary: Library for asynchronous name resolves License: MIT @@ -35,6 +35,8 @@ Source0: https://github.com/c-ares/c-ares/releases/download/v%{version}/c Source1: https://github.com/c-ares/c-ares/releases/download/v%{version}/c-ares-%{version}.tar.gz.asc Source3: c-ares.keyring Source4: baselibs.conf +Source5: series +Patch1: a531524a3d085fcd9a5e25d5f6cbdb953082c2b9.patch BuildRequires: c++_compiler BuildRequires: cmake # Needed for getservbyport_r function to work properly. @@ -91,7 +93,7 @@ to build packages that depend on c-ares. %endif %prep -%autosetup -n c-ares-%{version} +%autosetup -n c-ares-%{version} -p1 %build %cmake \ diff --git a/series b/series new file mode 100644 index 0000000..ee9480c --- /dev/null +++ b/series @@ -0,0 +1 @@ +skip-test.patch