From b8a59df8d8d03a94557995e39f626e96cae81b2d75bb237a88ac7bb829361610 Mon Sep 17 00:00:00 2001 From: Adam Majer Date: Tue, 18 Jun 2024 15:52:24 +0200 Subject: [PATCH 1/5] Update to 1.31.0 --- c-ares-1.30.0.tar.gz | 3 --- c-ares-1.30.0.tar.gz.asc | 7 ------- c-ares-1.31.0.tar.gz | 3 +++ c-ares-1.31.0.tar.gz.asc | 7 +++++++ c-ares.changes | 16 ++++++++++++++++ c-ares.spec | 2 +- 6 files changed, 27 insertions(+), 11 deletions(-) delete mode 100644 c-ares-1.30.0.tar.gz delete mode 100644 c-ares-1.30.0.tar.gz.asc create mode 100644 c-ares-1.31.0.tar.gz create mode 100644 c-ares-1.31.0.tar.gz.asc 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.31.0.tar.gz b/c-ares-1.31.0.tar.gz new file mode 100644 index 0000000..9baf9c7 --- /dev/null +++ b/c-ares-1.31.0.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0167a33dba96ca8de29f3f598b1e6cabe531799269fd63d0153aa0e6f5efeabd +size 1012373 diff --git a/c-ares-1.31.0.tar.gz.asc b/c-ares-1.31.0.tar.gz.asc new file mode 100644 index 0000000..698f4b5 --- /dev/null +++ b/c-ares-1.31.0.tar.gz.asc @@ -0,0 +1,7 @@ +-----BEGIN PGP SIGNATURE----- + +iHUEABYKAB0WIQR162yg5j6QxP8sho/B0VYRsuRyCwUCZnFZJwAKCRDB0VYRsuRy +Cw+yAP0XG2csOJAUMxNr0VcnEoel4i2zHTshaIFBI9tn8eJM4QD6ArOpAhZe9Tnt +fJdIewCmCBuytNtH1E3Dok1Up50FoQA= +=oLjf +-----END PGP SIGNATURE----- diff --git a/c-ares.changes b/c-ares.changes index 26abbf8..50b506a 100644 --- a/c-ares.changes +++ b/c-ares.changes @@ -1,3 +1,19 @@ +------------------------------------------------------------------- +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..b8a11f6 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.31.0 Release: 0 Summary: Library for asynchronous name resolves License: MIT -- 2.45.2 From 2046744ef4d314ae0956c99c129b94ee916633a6cd0f4e4087d6366021cf7cef Mon Sep 17 00:00:00 2001 From: Adam Majer Date: Tue, 29 Oct 2024 10:54:51 +0100 Subject: [PATCH 2/5] Update to 1.34.2 --- c-ares-1.31.0.tar.gz | 3 -- c-ares-1.31.0.tar.gz.asc | 7 ---- c-ares-1.34.2.tar.gz | 3 ++ c-ares-1.34.2.tar.gz.asc | 7 ++++ c-ares.changes | 70 ++++++++++++++++++++++++++++++++++++++++ c-ares.spec | 2 +- 6 files changed, 81 insertions(+), 11 deletions(-) delete mode 100644 c-ares-1.31.0.tar.gz delete mode 100644 c-ares-1.31.0.tar.gz.asc create mode 100644 c-ares-1.34.2.tar.gz create mode 100644 c-ares-1.34.2.tar.gz.asc diff --git a/c-ares-1.31.0.tar.gz b/c-ares-1.31.0.tar.gz deleted file mode 100644 index 9baf9c7..0000000 --- a/c-ares-1.31.0.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:0167a33dba96ca8de29f3f598b1e6cabe531799269fd63d0153aa0e6f5efeabd -size 1012373 diff --git a/c-ares-1.31.0.tar.gz.asc b/c-ares-1.31.0.tar.gz.asc deleted file mode 100644 index 698f4b5..0000000 --- a/c-ares-1.31.0.tar.gz.asc +++ /dev/null @@ -1,7 +0,0 @@ ------BEGIN PGP SIGNATURE----- - -iHUEABYKAB0WIQR162yg5j6QxP8sho/B0VYRsuRyCwUCZnFZJwAKCRDB0VYRsuRy -Cw+yAP0XG2csOJAUMxNr0VcnEoel4i2zHTshaIFBI9tn8eJM4QD6ArOpAhZe9Tnt -fJdIewCmCBuytNtH1E3Dok1Up50FoQA= -=oLjf ------END PGP SIGNATURE----- diff --git a/c-ares-1.34.2.tar.gz b/c-ares-1.34.2.tar.gz new file mode 100644 index 0000000..e1b6204 --- /dev/null +++ b/c-ares-1.34.2.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:35410aa625cc9ee95b66475f54aea7c81c673fb63d75fad5eee267711503b72a +size 1008432 diff --git a/c-ares-1.34.2.tar.gz.asc b/c-ares-1.34.2.tar.gz.asc new file mode 100644 index 0000000..11a394f --- /dev/null +++ b/c-ares-1.34.2.tar.gz.asc @@ -0,0 +1,7 @@ +-----BEGIN PGP SIGNATURE----- + +iHUEABYKAB0WIQR162yg5j6QxP8sho/B0VYRsuRyCwUCZw4/vQAKCRDB0VYRsuRy +C7N2AP9DTluIueO0OIl8bm4oufkYlOmMTWVcxRmcZ9enUL0XdAEAqA34I6CJ01lp +TXsmIQ3x9V7nuvaLUygrz5D3QyrbJgA= +=ncWz +-----END PGP SIGNATURE----- diff --git a/c-ares.changes b/c-ares.changes index 50b506a..13e75b2 100644 --- a/c-ares.changes +++ b/c-ares.changes @@ -1,3 +1,73 @@ +------------------------------------------------------------------- +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 diff --git a/c-ares.spec b/c-ares.spec index b8a11f6..7a9c74e 100644 --- a/c-ares.spec +++ b/c-ares.spec @@ -26,7 +26,7 @@ %endif Name: c-ares%pkg_suffix -Version: 1.31.0 +Version: 1.34.2 Release: 0 Summary: Library for asynchronous name resolves License: MIT -- 2.45.2 From d0790b568d9a22e490f0699aa2636531e080d64d021c49c4160cab289965d7f9 Mon Sep 17 00:00:00 2001 From: Adam Majer Date: Mon, 30 Dec 2024 12:16:38 +0100 Subject: [PATCH 3/5] update to 1.34.4 --- c-ares-1.34.2.tar.gz | 3 --- c-ares-1.34.2.tar.gz.asc | 7 ------- c-ares-1.34.4.tar.gz | 3 +++ c-ares-1.34.4.tar.gz.asc | 7 +++++++ c-ares.changes | 30 ++++++++++++++++++++++++++++++ c-ares.spec | 2 +- 6 files changed, 41 insertions(+), 11 deletions(-) delete mode 100644 c-ares-1.34.2.tar.gz delete mode 100644 c-ares-1.34.2.tar.gz.asc create mode 100644 c-ares-1.34.4.tar.gz create mode 100644 c-ares-1.34.4.tar.gz.asc diff --git a/c-ares-1.34.2.tar.gz b/c-ares-1.34.2.tar.gz deleted file mode 100644 index e1b6204..0000000 --- a/c-ares-1.34.2.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:35410aa625cc9ee95b66475f54aea7c81c673fb63d75fad5eee267711503b72a -size 1008432 diff --git a/c-ares-1.34.2.tar.gz.asc b/c-ares-1.34.2.tar.gz.asc deleted file mode 100644 index 11a394f..0000000 --- a/c-ares-1.34.2.tar.gz.asc +++ /dev/null @@ -1,7 +0,0 @@ ------BEGIN PGP SIGNATURE----- - -iHUEABYKAB0WIQR162yg5j6QxP8sho/B0VYRsuRyCwUCZw4/vQAKCRDB0VYRsuRy -C7N2AP9DTluIueO0OIl8bm4oufkYlOmMTWVcxRmcZ9enUL0XdAEAqA34I6CJ01lp -TXsmIQ3x9V7nuvaLUygrz5D3QyrbJgA= -=ncWz ------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 13e75b2..5eb036c 100644 --- a/c-ares.changes +++ b/c-ares.changes @@ -1,3 +1,33 @@ +------------------------------------------------------------------- +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 + ------------------------------------------------------------------- Tue Oct 29 09:24:43 UTC 2024 - Adam Majer diff --git a/c-ares.spec b/c-ares.spec index 7a9c74e..ce82357 100644 --- a/c-ares.spec +++ b/c-ares.spec @@ -26,7 +26,7 @@ %endif Name: c-ares%pkg_suffix -Version: 1.34.2 +Version: 1.34.4 Release: 0 Summary: Library for asynchronous name resolves License: MIT -- 2.45.2 From 966d0cfb8f0a94ec018ac57cd9bb2201406bb22f1427e9b358a023b44b451702 Mon Sep 17 00:00:00 2001 From: Adam Majer Date: Mon, 30 Dec 2024 13:29:37 +0100 Subject: [PATCH 4/5] Skip failing online test skip-test.patch: forwarded to https://github.com/c-ares/c-ares/issues/953 --- c-ares.changes | 2 ++ c-ares.spec | 5 ++++- series | 1 + skip-test.patch | 22 ++++++++++++++++++++++ 4 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 series create mode 100644 skip-test.patch diff --git a/c-ares.changes b/c-ares.changes index 5eb036c..b426780 100644 --- a/c-ares.changes +++ b/c-ares.changes @@ -28,6 +28,8 @@ Bugfixes: 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 diff --git a/c-ares.spec b/c-ares.spec index ce82357..e375cf1 100644 --- a/c-ares.spec +++ b/c-ares.spec @@ -35,6 +35,9 @@ 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 +# forwarded: https://github.com/c-ares/c-ares/issues/953 +Patch1: skip-test.patch BuildRequires: c++_compiler BuildRequires: cmake # Needed for getservbyport_r function to work properly. @@ -91,7 +94,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 diff --git a/skip-test.patch b/skip-test.patch new file mode 100644 index 0000000..fe73759 --- /dev/null +++ b/skip-test.patch @@ -0,0 +1,22 @@ +Index: c-ares-1.34.4/test/ares-test-live.cc +=================================================================== +--- c-ares-1.34.4.orig/test/ares-test-live.cc ++++ c-ares-1.34.4/test/ares-test-live.cc +@@ -718,7 +718,7 @@ TEST_F(LibraryTest, GetTCPSock) { + HostResult result; + ares_gethostbyname(channel, "www.google.com.", AF_INET, HostCallback, &result); + bitmask = ares_getsock(channel, socks, 3); +- EXPECT_NE(0, bitmask); ++ // EXPECT_NE(0, bitmask); + + size_t sock_cnt = 0; + for (size_t i=0; i<3; i++) { +@@ -728,7 +728,7 @@ TEST_F(LibraryTest, GetTCPSock) { + sock_cnt++; + } + } +- EXPECT_NE((size_t)0, sock_cnt); ++ // EXPECT_NE((size_t)0, sock_cnt); + + bitmask = ares_getsock(channel, nullptr, 0); + EXPECT_EQ(0, bitmask); -- 2.45.2 From 642897f8dd9ec9c30bf8b91bfd64940334473fc5dc81a41f82074bc1ea11d8db Mon Sep 17 00:00:00 2001 From: Adam Majer Date: Fri, 3 Jan 2025 23:37:04 +0100 Subject: [PATCH 5/5] unit test fix from upstream --- ...524a3d085fcd9a5e25d5f6cbdb953082c2b9.patch | 318 ++++++++++++++++++ c-ares.changes | 6 + c-ares.spec | 3 +- skip-test.patch | 22 -- 4 files changed, 325 insertions(+), 24 deletions(-) create mode 100644 a531524a3d085fcd9a5e25d5f6cbdb953082c2b9.patch delete mode 100644 skip-test.patch 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.changes b/c-ares.changes index b426780..bb60e4f 100644 --- a/c-ares.changes +++ b/c-ares.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +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 diff --git a/c-ares.spec b/c-ares.spec index e375cf1..26be8ce 100644 --- a/c-ares.spec +++ b/c-ares.spec @@ -36,8 +36,7 @@ Source1: https://github.com/c-ares/c-ares/releases/download/v%{version}/c Source3: c-ares.keyring Source4: baselibs.conf Source5: series -# forwarded: https://github.com/c-ares/c-ares/issues/953 -Patch1: skip-test.patch +Patch1: a531524a3d085fcd9a5e25d5f6cbdb953082c2b9.patch BuildRequires: c++_compiler BuildRequires: cmake # Needed for getservbyport_r function to work properly. diff --git a/skip-test.patch b/skip-test.patch deleted file mode 100644 index fe73759..0000000 --- a/skip-test.patch +++ /dev/null @@ -1,22 +0,0 @@ -Index: c-ares-1.34.4/test/ares-test-live.cc -=================================================================== ---- c-ares-1.34.4.orig/test/ares-test-live.cc -+++ c-ares-1.34.4/test/ares-test-live.cc -@@ -718,7 +718,7 @@ TEST_F(LibraryTest, GetTCPSock) { - HostResult result; - ares_gethostbyname(channel, "www.google.com.", AF_INET, HostCallback, &result); - bitmask = ares_getsock(channel, socks, 3); -- EXPECT_NE(0, bitmask); -+ // EXPECT_NE(0, bitmask); - - size_t sock_cnt = 0; - for (size_t i=0; i<3; i++) { -@@ -728,7 +728,7 @@ TEST_F(LibraryTest, GetTCPSock) { - sock_cnt++; - } - } -- EXPECT_NE((size_t)0, sock_cnt); -+ // EXPECT_NE((size_t)0, sock_cnt); - - bitmask = ares_getsock(channel, nullptr, 0); - EXPECT_EQ(0, bitmask); -- 2.45.2