Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package c-ares for openSUSE:Factory checked 
in at 2026-01-06 17:41:21
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/c-ares (Old)
 and      /work/SRC/openSUSE:Factory/.c-ares.new.1928 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "c-ares"

Tue Jan  6 17:41:21 2026 rev:28 rq:1325392 version:1.34.6

Changes:
--------
--- /work/SRC/openSUSE:Factory/c-ares/c-ares.changes    2025-04-09 
21:50:03.329575416 +0200
+++ /work/SRC/openSUSE:Factory/.c-ares.new.1928/c-ares.changes  2026-01-06 
17:41:29.586033683 +0100
@@ -1,0 +2,9 @@
+Thu Jan  1 19:06:23 UTC 2026 - Andreas Stieger <[email protected]>
+
+- c-ares 1.35.6:
+  * CVE-2025-62408: use-after-free in read_answers() (boo#1254738)
+  * Ignore Windows IDN Search Domains until proper IDN support is
+    added
+  * Various bug fixes
+
+-------------------------------------------------------------------

Old:
----
  c-ares-1.34.5.tar.gz
  c-ares-1.34.5.tar.gz.asc

New:
----
  c-ares-1.34.6.tar.gz
  c-ares-1.34.6.tar.gz.asc

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ c-ares.spec ++++++
--- /var/tmp/diff_new_pack.XfMIQU/_old  2026-01-06 17:41:30.286062405 +0100
+++ /var/tmp/diff_new_pack.XfMIQU/_new  2026-01-06 17:41:30.286062405 +0100
@@ -2,7 +2,7 @@
 # spec file for package c-ares
 #
 # Copyright (c) 2024 SUSE LLC
-# Copyright (c) 2024 Andreas Stieger <[email protected]>
+# Copyright (c) 2026 Andreas Stieger <[email protected]>
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -26,7 +26,7 @@
 %endif
 
 Name:           c-ares%pkg_suffix
-Version:        1.34.5
+Version:        1.34.6
 Release:        0
 Summary:        Library for asynchronous name resolves
 License:        MIT

++++++ _scmsync.obsinfo ++++++
--- /var/tmp/diff_new_pack.XfMIQU/_old  2026-01-06 17:41:30.338064539 +0100
+++ /var/tmp/diff_new_pack.XfMIQU/_new  2026-01-06 17:41:30.342064703 +0100
@@ -1,5 +1,5 @@
-mtime: 1744128051
-commit: 5353240e2fda3d2bfedef524f0ced66ac78f6dcee2ba708d0ac19234a68b1ca7
+mtime: 1767294812
+commit: 54d0a413f84c4a1cdf16b2d437162cf8a55445410f6aa0aa12899c525dbca273
 url: https://src.opensuse.org/adamm/c-ares.git
 revision: factory
 

++++++ build.specials.obscpio ++++++

++++++ build.specials.obscpio ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/.gitignore new/.gitignore
--- old/.gitignore      1970-01-01 01:00:00.000000000 +0100
+++ new/.gitignore      2026-01-05 12:45:24.000000000 +0100
@@ -0,0 +1 @@
+.osc

++++++ c-ares-1.34.5.tar.gz -> c-ares-1.34.6.tar.gz ++++++
++++ 3586 lines of diff (skipped)
++++    retrying with extended exclude list
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/c-ares-1.34.5/CMakeLists.txt new/c-ares-1.34.6/CMakeLists.txt
--- old/c-ares-1.34.5/CMakeLists.txt    2025-04-08 14:12:25.000000000 +0200
+++ new/c-ares-1.34.6/CMakeLists.txt    2025-12-08 17:21:36.000000000 +0100
@@ -12,7 +12,7 @@
 INCLUDE (CheckStructHasMember)
 INCLUDE (CheckLibraryExists)
 
-PROJECT (c-ares LANGUAGES C VERSION "1.34.5" )
+PROJECT (c-ares LANGUAGES C VERSION "1.34.6" )
 
 # Set this version before release
 SET (CARES_VERSION "${PROJECT_VERSION}")
@@ -30,7 +30,7 @@
 # For example, a version of 4:0:2 would generate output such as:
 #    libname.so   -> libname.so.2
 #    libname.so.2 -> libname.so.2.2.0
-SET (CARES_LIB_VERSIONINFO "21:4:19")
+SET (CARES_LIB_VERSIONINFO "21:5:19")
 
 
 OPTION (CARES_STATIC        "Build as a static library"                        
                     OFF)
@@ -45,15 +45,6 @@
 OPTION (CARES_COVERAGE      "Build for code coverage"                          
                     OFF)
 SET    (CARES_RANDOM_FILE "/dev/urandom" CACHE STRING "Suitable File / Device 
Path for entropy, such as /dev/urandom")
 
-
-# Tests require a C++14 compiler
-IF (CARES_BUILD_TESTS OR CARES_BUILD_CONTAINER_TESTS)
-       set(CMAKE_CXX_STANDARD 14)
-       set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
-       set(CMAKE_CXX_EXTENSIONS FALSE)
-       enable_language(CXX)
-ENDIF ()
-
 # Tests require static to be enabled on Windows to be able to access otherwise 
hidden symbols
 IF ((CARES_BUILD_TESTS OR CARES_BUILD_CONTAINER_TESTS) AND (NOT CARES_STATIC) 
AND WIN32)
        SET (CARES_STATIC ON)
@@ -269,7 +260,7 @@
        LIST (APPEND SYSFLAGS -D__EXTENSIONS__ -D_REENTRANT -D_XOPEN_SOURCE=600)
 ELSEIF (CMAKE_SYSTEM_NAME STREQUAL "AIX")
        LIST (APPEND SYSFLAGS -D_ALL_SOURCE -D_XOPEN_SOURCE=700 -D_USE_IRS)
-ELSEIF (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
+ELSEIF (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR CMAKE_SYSTEM_NAME STREQUAL 
"MidnightBSD")
        # Don't define _XOPEN_SOURCE on FreeBSD, it actually reduces visibility 
instead of increasing it
 ELSEIF (CMAKE_SYSTEM_NAME STREQUAL "QNX")
        LIST (APPEND SYSFLAGS -D_QNX_SOURCE)
@@ -630,6 +621,7 @@
                CMAKE_SYSTEM_NAME STREQUAL "NetBSD" OR
                CMAKE_SYSTEM_NAME STREQUAL "SunOS" OR
                CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR
+               CMAKE_SYSTEM_NAME STREQUAL "MidnightBSD" OR
                CMAKE_SYSTEM_NAME STREQUAL "AIX" OR
                WIN32)
                        SET (HAVE_GETADDRINFO_THREADSAFE 1)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/c-ares-1.34.5/RELEASE-NOTES.md new/c-ares-1.34.6/RELEASE-NOTES.md
--- old/c-ares-1.34.5/RELEASE-NOTES.md  2025-04-08 14:12:25.000000000 +0200
+++ new/c-ares-1.34.6/RELEASE-NOTES.md  2025-12-08 17:21:36.000000000 +0100
@@ -1,28 +1,42 @@
-## c-ares version 1.34.5 - April 8 2025
+## c-ares version 1.34.6 - December 8 2025
 
 This is a security release.
 
 Security:
-* CVE-2025-31498. A use-after-free bug has been uncovered in read_answers() 
that
-  was introduced in v1.32.3.  Please see 
https://github.com/c-ares/c-ares/security/advisories/GHSA-6hxc-62jh-p29v
+* CVE-2025-62408. A use-after-free bug has been uncovered in read_answers() 
that
+  was introduced in v1.32.3. Please see 
https://github.com/c-ares/c-ares/security/advisories/GHSA-jq53-42q6-pqr5
 
 Changes:
-* Restore Windows XP support. [PR 
#958](https://github.com/c-ares/c-ares/pull/958)
+* Ignore Windows IDN Search Domains until proper IDN support is added. [PR 
#1034](https://github.com/c-ares/c-ares/pull/1034)
 
 Bugfixes:
-* A missing mutex initialization would make busy polling for configuration
-  changes (platforms other than Windows, Linux, MacOS) eat too much CPU
-  [PR #974](https://github.com/c-ares/c-ares/pull/974)
-* Pkgconfig may be generated wrong for static builds in relation to `-pthread`
-  [PR #965](https://github.com/c-ares/c-ares/pull/965)
-* Localhost resolution can fail if only one address family is in `/etc/hosts`
-  [PR #947](https://github.com/c-ares/c-ares/pull/947)
+* Event Thread could stall when not notified of new queries on existing
+  connections that are in a bad state
+  [PR #1032](https://github.com/c-ares/c-ares/pull/1032)
+* fix conversion of invalid service to port number in ares_getaddrinfo()
+  [PR #1029](https://github.com/c-ares/c-ares/pull/1029)
+* fix memory leak in ares_uri
+  [PR #1012](https://github.com/c-ares/c-ares/pull/1012)
+* Ignore ares_event_configchg_init failures
+  [PR #1009](https://github.com/c-ares/c-ares/pull/1009)
+* Use XOR for random seed generation on fallback logic.
+  [PR #994](https://github.com/c-ares/c-ares/pull/994)
+* Fix clang build on windows.
+  [PR #996](https://github.com/c-ares/c-ares/pull/996)
+* Fix IPv6 link-local nameservers in /etc/resolv.conf
+  [PR #996](https://github.com/c-ares/c-ares/pull/997)
+* Fix a few build issues on MidnightBSD.
+  [PR #983](https://github.com/c-ares/c-ares/pull/983)
 
 Thanks go to these friendly people for their efforts and contributions for this
 release:
 
 * Brad House (@bradh352)
-* Erik Lax (@eriklax)
-* Florian Pfisterer (@FlorianPfisterer)
-* Kai Pastor (@dg0yt)
+* (@F3lixTheCat)
+* Lucas Holt (@laffer1)
+* @oargon
+* Pavel P (@pps83)
+* Sean Harmer (@seanharmer)
+* Uwe (@nixblik)
+
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/c-ares-1.34.5/aminclude_static.am new/c-ares-1.34.6/aminclude_static.am
--- old/c-ares-1.34.5/aminclude_static.am       2025-04-08 14:12:30.000000000 
+0200
+++ new/c-ares-1.34.6/aminclude_static.am       2025-12-08 17:21:41.000000000 
+0100
@@ -1,6 +1,6 @@
 
 # aminclude_static.am generated automatically by Autoconf
-# from AX_AM_MACROS_STATIC on Tue Apr  8 12:12:30 UTC 2025
+# from AX_AM_MACROS_STATIC on Mon Dec  8 16:21:41 UTC 2025
 
 
 # Code coverage
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/c-ares-1.34.5/configure.ac new/c-ares-1.34.6/configure.ac
--- old/c-ares-1.34.5/configure.ac      2025-04-08 14:12:25.000000000 +0200
+++ new/c-ares-1.34.6/configure.ac      2025-12-08 17:21:36.000000000 +0100
@@ -2,10 +2,10 @@
 dnl SPDX-License-Identifier: MIT
 AC_PREREQ([2.69])
 
-AC_INIT([c-ares], [1.34.5],
+AC_INIT([c-ares], [1.34.6],
   [c-ares mailing list: http://lists.haxx.se/listinfo/c-ares])
 
-CARES_VERSION_INFO="21:4:19"
+CARES_VERSION_INFO="21:5:19"
 dnl This flag accepts an argument of the form current[:revision[:age]]. So,
 dnl passing -version-info 3:12:1 sets current to 3, revision to 12, and age to
 dnl 1.
@@ -40,7 +40,8 @@
 AC_CONFIG_AUX_DIR(config)
 AC_CONFIG_MACRO_DIR([m4])
 AC_USE_SYSTEM_EXTENSIONS
-AX_CXX_COMPILE_STDCXX_14([noext],[optional])
+AX_CXX_COMPILE_STDCXX(14,[noext],[optional])
+AX_CXX_COMPILE_STDCXX(17,[noext],[optional])
 AM_INIT_AUTOMAKE([foreign subdir-objects 1.9.6])
 LT_INIT([win32-dll,pic,disable-fast-install,aix-soname=svr4])
 AC_LANG([C])
@@ -806,14 +807,6 @@
 
 dnl ******** TESTS *******
 
-if test "x$build_tests" != "xno" -a "x$HAVE_CXX14" = "0" ; then
-  if test "x$build_tests" = "xmaybe" ; then
-    AC_MSG_WARN([cannot build tests without a CXX14 compiler])
-    build_tests=no
-  else
-    AC_MSG_ERROR([*** Building tests requires a CXX14 compiler])
-  fi
-fi
 if test "x$build_tests" != "xno" -a "x$cross_compiling" = "xyes" ; then
   if test "x$build_tests" = "xmaybe" ; then
     AC_MSG_WARN([cannot build tests when cross compiling])
@@ -844,12 +837,19 @@
       ARES_CHECK_USER_NAMESPACE
       ARES_CHECK_UTS_NAMESPACE
     fi
+    PKG_CHECK_MODULES([GMOCK117], [gmock >= 1.17.0], [ have_gmock_v117=yes ], 
[ have_gmock_v117=no ])
+    if test "x$have_gmock_v117" = "xyes" ; then
+      dnl GMock v1.17.0 requires C++17 or higher
+      AX_CXX_COMPILE_STDCXX(17,[noext],[mandatory])
+    else
+      dnl older version needed v1.14.0
+      AX_CXX_COMPILE_STDCXX(14,[noext],[mandatory])
+    fi
   fi
 fi
 if test "x$build_tests" != "xno" ; then
   build_tests=yes
 
-  AX_CXX_COMPILE_STDCXX_14([noext],[mandatory])
   if test "$ac_cv_native_windows" != "yes" ; then
     AX_PTHREAD([ CARES_TEST_PTHREADS="yes" ], [ AC_MSG_ERROR([threading 
required for tests]) ])
   fi
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/c-ares-1.34.5/include/ares_version.h 
new/c-ares-1.34.6/include/ares_version.h
--- old/c-ares-1.34.5/include/ares_version.h    2025-04-08 14:12:25.000000000 
+0200
+++ new/c-ares-1.34.6/include/ares_version.h    2025-12-08 17:21:36.000000000 
+0100
@@ -28,12 +28,12 @@
 #define ARES__VERSION_H
 
 /* This is the global package copyright */
-#define ARES_COPYRIGHT "2004 - 2024 Daniel Stenberg, <[email protected]>."
+#define ARES_COPYRIGHT "2004 - 2025 Daniel Stenberg, <[email protected]>."
 
 #define ARES_VERSION_MAJOR 1
 #define ARES_VERSION_MINOR 34
-#define ARES_VERSION_PATCH 5
-#define ARES_VERSION_STR "1.34.5"
+#define ARES_VERSION_PATCH 6
+#define ARES_VERSION_STR "1.34.6"
 
 /* NOTE: We cannot make the version string a C preprocessor stringify operation
  *       due to assumptions made by integrators that aren't properly using
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/c-ares-1.34.5/m4/ax_cxx_compile_stdcxx_14.m4 
new/c-ares-1.34.6/m4/ax_cxx_compile_stdcxx_14.m4
--- old/c-ares-1.34.5/m4/ax_cxx_compile_stdcxx_14.m4    2025-04-08 
14:12:25.000000000 +0200
+++ new/c-ares-1.34.6/m4/ax_cxx_compile_stdcxx_14.m4    1970-01-01 
01:00:00.000000000 +0100
@@ -1,34 +0,0 @@
-# =============================================================================
-#  https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_14.html
-# =============================================================================
-#
-# SYNOPSIS
-#
-#   AX_CXX_COMPILE_STDCXX_14([ext|noext], [mandatory|optional])
-#
-# DESCRIPTION
-#
-#   Check for baseline language coverage in the compiler for the C++14
-#   standard; if necessary, add switches to CXX and CXXCPP to enable
-#   support.
-#
-#   This macro is a convenience alias for calling the AX_CXX_COMPILE_STDCXX
-#   macro with the version set to C++14.  The two optional arguments are
-#   forwarded literally as the second and third argument respectively.
-#   Please see the documentation for the AX_CXX_COMPILE_STDCXX macro for
-#   more information.  If you want to use this macro, you also need to
-#   download the ax_cxx_compile_stdcxx.m4 file.
-#
-# LICENSE
-#
-#   Copyright (c) 2015 Moritz Klammler <[email protected]>
-#
-#   Copying and distribution of this file, with or without modification, are
-#   permitted in any medium without royalty provided the copyright notice
-#   and this notice are preserved. This file is offered as-is, without any
-#   warranty.
-
-#serial 5
-
-AX_REQUIRE_DEFINED([AX_CXX_COMPILE_STDCXX])
-AC_DEFUN([AX_CXX_COMPILE_STDCXX_14], [AX_CXX_COMPILE_STDCXX([14], [$1], [$2])])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/c-ares-1.34.5/m4/ax_pthread.m4 new/c-ares-1.34.6/m4/ax_pthread.m4
--- old/c-ares-1.34.5/m4/ax_pthread.m4  2025-04-08 14:12:25.000000000 +0200
+++ new/c-ares-1.34.6/m4/ax_pthread.m4  2025-12-08 17:21:36.000000000 +0100
@@ -160,7 +160,7 @@
 
 case $host_os in
 
-        freebsd*)
+        freebsd*|midnightbsd*)
 
         # -kthread: FreeBSD kernel threads (preferred to -pthread since 
SMP-able)
         # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/c-ares-1.34.5/src/lib/CMakeLists.txt 
new/c-ares-1.34.6/src/lib/CMakeLists.txt
--- old/c-ares-1.34.5/src/lib/CMakeLists.txt    2025-04-08 14:12:25.000000000 
+0200
+++ new/c-ares-1.34.6/src/lib/CMakeLists.txt    2025-12-08 17:21:36.000000000 
+0100
@@ -15,6 +15,14 @@
        # Include resource file in windows builds for versioned DLLs
        IF (WIN32)
                TARGET_SOURCES (${PROJECT_NAME} PRIVATE cares.rc)
+               
+               # Check for use of llvm-rc (implies clang is being used). We 
need to set the
+               # compile flags to use the correct codepage for the resource 
compiler.
+               # This is needed for the copyright symbol to be encoded 
correctly.
+               # The default codepage is 1252 (Windows Latin-1) but llvm-rc 
defaults to UTF-8.
+               if (CMAKE_RC_COMPILER MATCHES "llvm-rc")
+                       set_source_files_properties(cares.rc PROPERTIES 
COMPILE_FLAGS "/C 1252")
+               endif()
        ENDIF()
 
        # Convert CARES_LIB_VERSIONINFO libtool version format into VERSION and 
SOVERSION
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/c-ares-1.34.5/src/lib/ares_config.h.in 
new/c-ares-1.34.6/src/lib/ares_config.h.in
--- old/c-ares-1.34.5/src/lib/ares_config.h.in  2025-04-08 14:12:30.000000000 
+0200
+++ new/c-ares-1.34.6/src/lib/ares_config.h.in  2025-12-08 17:21:41.000000000 
+0100
@@ -87,6 +87,9 @@
 /* define if the compiler supports basic C++14 syntax */
 #undef HAVE_CXX14
 
+/* define if the compiler supports basic C++17 syntax */
+#undef HAVE_CXX17
+
 /* Define to 1 if you have the <dlfcn.h> header file. */
 #undef HAVE_DLFCN_H
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/c-ares-1.34.5/src/lib/ares_getaddrinfo.c 
new/c-ares-1.34.6/src/lib/ares_getaddrinfo.c
--- old/c-ares-1.34.5/src/lib/ares_getaddrinfo.c        2025-04-08 
14:12:25.000000000 +0200
+++ new/c-ares-1.34.6/src/lib/ares_getaddrinfo.c        2025-12-08 
17:21:36.000000000 +0100
@@ -575,6 +575,23 @@
   /* at this point we keep on waiting for the next query to finish */
 }
 
+static ares_bool_t numeric_service_to_port(const char *service,
+                                           unsigned short *port)
+{
+  char *end;
+  unsigned long val;
+
+  errno = 0;
+  val   = strtoul(service, &end, 10);
+
+  if (errno == 0 && *end == '\0' && val <= 65535) {
+    *port = (unsigned short)val;
+    return ARES_TRUE;
+  }
+
+  return ARES_FALSE;
+}
+
 static void ares_getaddrinfo_int(ares_channel_t *channel, const char *name,
                                  const char                       *service,
                                  const struct ares_addrinfo_hints *hints,
@@ -606,25 +623,17 @@
 
   if (service) {
     if (hints->ai_flags & ARES_AI_NUMERICSERV) {
-      unsigned long val;
-      errno = 0;
-      val   = strtoul(service, NULL, 0);
-      if ((val == 0 && errno != 0) || val > 65535) {
+      if (!numeric_service_to_port(service, &port)) {
         callback(arg, ARES_ESERVICE, 0, NULL);
         return;
       }
-      port = (unsigned short)val;
     } else {
       port = lookup_service(service, 0);
       if (!port) {
-        unsigned long val;
-        errno = 0;
-        val   = strtoul(service, NULL, 0);
-        if ((val == 0 && errno != 0) || val > 65535) {
+        if (!numeric_service_to_port(service, &port)) {
           callback(arg, ARES_ESERVICE, 0, NULL);
           return;
         }
-        port = (unsigned short)val;
       }
     }
   }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/c-ares-1.34.5/src/lib/ares_hosts_file.c 
new/c-ares-1.34.6/src/lib/ares_hosts_file.c
--- old/c-ares-1.34.5/src/lib/ares_hosts_file.c 2025-04-08 14:12:25.000000000 
+0200
+++ new/c-ares-1.34.6/src/lib/ares_hosts_file.c 2025-12-08 17:21:36.000000000 
+0100
@@ -41,6 +41,11 @@
 #endif
 #include <time.h>
 
+#ifdef USE_WINSOCK
+#  define DATABASEPATH         "DatabasePath"
+#  define WIN_PATH_HOSTS       "\\hosts"
+#endif
+
 /* HOSTS FILE PROCESSING OVERVIEW
  * ==============================
  * The hosts file on the system contains static entries to be processed locally
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/c-ares-1.34.5/src/lib/ares_init.c new/c-ares-1.34.6/src/lib/ares_init.c
--- old/c-ares-1.34.5/src/lib/ares_init.c       2025-04-08 14:12:25.000000000 
+0200
+++ new/c-ares-1.34.6/src/lib/ares_init.c       2025-12-08 17:21:36.000000000 
+0100
@@ -271,6 +271,8 @@
     goto done;
   }
 
+  ares_set_socket_functions_def(channel);
+
   /* Initialize Server List */
   channel->servers =
     ares_slist_create(channel->rand_state, server_sort_cb, server_destroy_cb);
@@ -346,8 +348,6 @@
     goto done;
   }
 
-  ares_set_socket_functions_def(channel);
-
   /* Initialize the event thread */
   if (channel->optmask & ARES_OPT_EVENT_THREAD) {
     ares_event_thread_t *e = NULL;
@@ -362,7 +362,8 @@
     e      = channel->sock_state_cb_data;
     status = ares_event_configchg_init(&e->configchg, e);
     if (status != ARES_SUCCESS && status != ARES_ENOTIMP) {
-      goto done; /* LCOV_EXCL_LINE: UntestablePath */
+      DEBUGF(fprintf(stderr, "Error: ares_event_configchg_init failed: %s\n",
+                     ares_strerror(status)));
     }
     status = ARES_SUCCESS;
   }
@@ -484,16 +485,20 @@
   ares_channel_lock(src);
   /* Now clone the options that ares_save_options() doesn't support, but are
    * user-provided */
-  (*dest)->sock_create_cb            = src->sock_create_cb;
-  (*dest)->sock_create_cb_data       = src->sock_create_cb_data;
-  (*dest)->sock_config_cb            = src->sock_config_cb;
-  (*dest)->sock_config_cb_data       = src->sock_config_cb_data;
+  (*dest)->sock_create_cb               = src->sock_create_cb;
+  (*dest)->sock_create_cb_data          = src->sock_create_cb_data;
+  (*dest)->sock_config_cb               = src->sock_config_cb;
+  (*dest)->sock_config_cb_data          = src->sock_config_cb_data;
   memcpy(&(*dest)->sock_funcs, &(src->sock_funcs), 
sizeof((*dest)->sock_funcs));
-  (*dest)->sock_func_cb_data         = src->sock_func_cb_data;
-  (*dest)->legacy_sock_funcs         = src->legacy_sock_funcs;
-  (*dest)->legacy_sock_funcs_cb_data = src->legacy_sock_funcs_cb_data;
-  (*dest)->server_state_cb           = src->server_state_cb;
-  (*dest)->server_state_cb_data      = src->server_state_cb_data;
+  (*dest)->sock_func_cb_data            = src->sock_func_cb_data;
+  (*dest)->legacy_sock_funcs            = src->legacy_sock_funcs;
+  (*dest)->legacy_sock_funcs_cb_data    = src->legacy_sock_funcs_cb_data;
+  (*dest)->server_state_cb              = src->server_state_cb;
+  (*dest)->server_state_cb_data         = src->server_state_cb_data;
+  (*dest)->notify_pending_write_cb      = src->notify_pending_write_cb;
+  (*dest)->notify_pending_write_cb_data = src->notify_pending_write_cb_data;
+  (*dest)->query_enqueue_cb             = src->query_enqueue_cb;
+  (*dest)->query_enqueue_cb_data        = src->query_enqueue_cb_data;
 
   ares_strcpy((*dest)->local_dev_name, src->local_dev_name,
               sizeof((*dest)->local_dev_name));
@@ -598,3 +603,15 @@
   ares_channel_unlock(channel);
   return (int)status;
 }
+
+void ares_set_query_enqueue_cb(ares_channel_t       *channel,
+                               ares_query_enqueue_cb callback,
+                               void                 *user_data)
+{
+  if (channel == NULL) {
+    return;
+  }
+
+  channel->query_enqueue_cb      = callback;
+  channel->query_enqueue_cb_data = user_data;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/c-ares-1.34.5/src/lib/ares_private.h 
new/c-ares-1.34.6/src/lib/ares_private.h
--- old/c-ares-1.34.5/src/lib/ares_private.h    2025-04-08 14:12:25.000000000 
+0200
+++ new/c-ares-1.34.6/src/lib/ares_private.h    2025-12-08 17:21:36.000000000 
+0100
@@ -83,21 +83,7 @@
 #define CARES_INADDR_CAST(type, var) ((type)((const void *)var))
 
 #if defined(USE_WINSOCK)
-
-#  define WIN_NS_9X     "System\\CurrentControlSet\\Services\\VxD\\MSTCP"
 #  define WIN_NS_NT_KEY 
"System\\CurrentControlSet\\Services\\Tcpip\\Parameters"
-#  define WIN_DNSCLIENT "Software\\Policies\\Microsoft\\System\\DNSClient"
-#  define WIN_NT_DNSCLIENT \
-    "Software\\Policies\\Microsoft\\Windows NT\\DNSClient"
-#  define NAMESERVER           "NameServer"
-#  define DHCPNAMESERVER       "DhcpNameServer"
-#  define DATABASEPATH         "DatabasePath"
-#  define WIN_PATH_HOSTS       "\\hosts"
-#  define SEARCHLIST_KEY       "SearchList"
-#  define PRIMARYDNSSUFFIX_KEY "PrimaryDNSSuffix"
-#  define INTERFACES_KEY       "Interfaces"
-#  define DOMAIN_KEY           "Domain"
-#  define DHCPDOMAIN_KEY       "DhcpDomain"
 #  define PATH_RESOLV_CONF     ""
 #elif defined(WATT32)
 
@@ -145,6 +131,8 @@
 #define DEFAULT_SERVER_RETRY_CHANCE 10
 #define DEFAULT_SERVER_RETRY_DELAY  5000
 
+typedef void (*ares_query_enqueue_cb)(void *data);
+
 struct ares_query;
 typedef struct ares_query ares_query_t;
 
@@ -269,6 +257,9 @@
   void                               *notify_pending_write_cb_data;
   ares_bool_t                         notify_pending_write;
 
+  ares_query_enqueue_cb               query_enqueue_cb;
+  void                               *query_enqueue_cb_data;
+
   /* Path for resolv.conf file, configurable via ares_options */
   char                               *resolvconf_path;
 
@@ -321,7 +312,7 @@
 ares_status_t ares_requeue_query(ares_query_t *query, const ares_timeval_t 
*now,
                                  ares_status_t            status,
                                  ares_bool_t              inc_try_count,
-                                 const ares_dns_record_t *dnsrec,
+                                 ares_dns_record_t       *dnsrec,
                                  ares_array_t           **requeue);
 
 /*! Count the number of labels (dots+1) in a domain */
@@ -367,6 +358,9 @@
 ares_status_t  ares_init_by_options(ares_channel_t            *channel,
                                     const struct ares_options *options,
                                     int                        optmask);
+void ares_set_query_enqueue_cb(ares_channel_t       *channel,
+                               ares_query_enqueue_cb callback,
+                               void                 *user_data);
 ares_status_t  ares_init_by_sysconfig(ares_channel_t *channel);
 void           ares_set_socket_functions_def(ares_channel_t *channel);
 
@@ -594,10 +588,10 @@
                                  unsigned int     max_ttl,
                                  ares_qcache_t  **cache_out);
 void          ares_qcache_flush(ares_qcache_t *cache);
-ares_status_t ares_qcache_insert(ares_channel_t       *channel,
-                                 const ares_timeval_t *now,
-                                 const ares_query_t   *query,
-                                 ares_dns_record_t    *dnsrec);
+ares_status_t ares_qcache_insert(ares_channel_t          *channel,
+                                 const ares_timeval_t    *now,
+                                 const ares_query_t      *query,
+                                 const ares_dns_record_t *dnsrec);
 ares_status_t ares_qcache_fetch(ares_channel_t           *channel,
                                 const ares_timeval_t     *now,
                                 const ares_dns_record_t  *dnsrec,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/c-ares-1.34.5/src/lib/ares_process.c 
new/c-ares-1.34.6/src/lib/ares_process.c
--- old/c-ares-1.34.5/src/lib/ares_process.c    2025-04-08 14:12:25.000000000 
+0200
+++ new/c-ares-1.34.6/src/lib/ares_process.c    2025-12-08 17:21:36.000000000 
+0100
@@ -64,7 +64,8 @@
                                   const ares_dns_record_t *arec);
 static void        end_query(ares_channel_t *channel, ares_server_t *server,
                              ares_query_t *query, ares_status_t status,
-                             const ares_dns_record_t *dnsrec);
+                             ares_dns_record_t *dnsrec,
+                             ares_array_t **requeue);
 
 static void        ares_query_remove_from_conn(ares_query_t *query)
 {
@@ -230,11 +231,14 @@
   }
 
   if (!(flags & ARES_PROCESS_FLAG_SKIP_NON_FD)) {
-    ares_check_cleanup_conns(channel);
     status = process_timeouts(channel, &now);
     if (status == ARES_ENOMEM) {
       goto done;
     }
+
+    /* Cleanup should be done after processing timeouts as it may invalidate
+     * connections */
+    ares_check_cleanup_conns(channel);
   }
 
 done:
@@ -511,16 +515,27 @@
   return ARES_SUCCESS;
 }
 
+typedef enum {
+  REQUEUE_REQUEUE  = 1,
+  REQUEUE_ENDQUERY = 2
+} requeue_type_t;
+
 /* Simple data structure to store a query that needs to be requeued with
  * optional server */
 typedef struct {
-  unsigned short qid;
-  ares_server_t *server; /* optional */
+  requeue_type_t     type;   /* type of entry, requeue or endquery */
+  unsigned short     qid;    /* query id */
+  ares_server_t     *server; /* requeue only: optional */
+  ares_status_t      status; /* endquery only */
+  ares_dns_record_t *dnsrec; /* endquery only: optional */
 } ares_requeue_t;
 
-static ares_status_t ares_append_requeue(ares_array_t **requeue,
-                                         ares_query_t *query,
-                                         ares_server_t *server)
+static ares_status_t ares_append_requeue_int(ares_array_t     **requeue,
+                                             requeue_type_t     type,
+                                             ares_query_t      *query,
+                                             ares_server_t     *server,
+                                             ares_status_t      status,
+                                             ares_dns_record_t *dnsrec)
 {
   ares_requeue_t entry;
 
@@ -533,16 +548,36 @@
 
   ares_query_remove_from_conn(query);
 
+  entry.type   = type;
   entry.qid    = query->qid;
   entry.server = server;
+  entry.status = status;
+  entry.dnsrec = dnsrec;
   return ares_array_insertdata_last(*requeue, &entry);
 }
 
+static ares_status_t ares_append_requeue(ares_array_t **requeue,
+                                         ares_query_t  *query,
+                                         ares_server_t *server)
+{
+  return ares_append_requeue_int(requeue, REQUEUE_REQUEUE, query, server, 0,
+    NULL);
+}
+
+static ares_status_t ares_append_endqueue(ares_array_t     **requeue,
+                                          ares_query_t      *query,
+                                          ares_status_t      status,
+                                          ares_dns_record_t *dnsrec)
+{
+  return ares_append_requeue_int(requeue, REQUEUE_ENDQUERY, query, NULL, 
status,
+    dnsrec);
+}
+
 static ares_status_t read_answers(ares_conn_t *conn, const ares_timeval_t *now)
 {
   ares_status_t   status;
-  ares_channel_t *channel = conn->server->channel;
-  ares_array_t   *requeue = NULL;
+  ares_channel_t *channel  = conn->server->channel;
+  ares_array_t   *requeue  = NULL;
 
   /* Process all queued answers */
   while (1) {
@@ -602,18 +637,30 @@
       break;
     }
 
-    /* Query disappeared */
     query = ares_htable_szvp_get_direct(channel->queries_by_qid, entry.qid);
-    if (query == NULL) {
-      continue;
-    }
 
-    internal_status = ares_send_query(entry.server, query, now);
-    /* We only care about ARES_ENOMEM */
-    if (internal_status == ARES_ENOMEM) {
-      status = ARES_ENOMEM;
+    if (entry.type == REQUEUE_REQUEUE) {
+      /* query disappeared */
+      if (query == NULL) {
+        continue;
+      }
+      internal_status = ares_send_query(entry.server, query, now);
+      /* We only care about ARES_ENOMEM */
+      if (internal_status == ARES_ENOMEM) {
+        status = ARES_ENOMEM;
+      }
+    } else { /* REQUEUE_ENDQUERY */
+      if (query != NULL) {
+        query->callback(query->arg, entry.status, query->timeouts, 
entry.dnsrec);
+        ares_free_query(query);
+      }
+      ares_dns_record_destroy(entry.dnsrec);
     }
   }
+  /* Don't forget to send notification if queue emptied */
+  if (requeue != NULL) {
+    ares_queue_notify_empty(channel);
+  }
   ares_array_destroy(requeue);
 
   return status;
@@ -669,7 +716,7 @@
     conn = query->conn;
     server_increment_failures(conn->server, query->using_tcp);
     status = ares_requeue_query(query, now, ARES_ETIMEOUT, ARES_TRUE, NULL,
-                                NULL);
+      NULL);
     if (status == ARES_ENOMEM) {
       goto done;
     }
@@ -824,7 +871,7 @@
   if (issue_might_be_edns(query->query, rdnsrec)) {
     status = rewrite_without_edns(query);
     if (status != ARES_SUCCESS) {
-      end_query(channel, server, query, status, NULL);
+      end_query(channel, server, query, status, NULL, NULL);
       goto cleanup;
     }
 
@@ -869,7 +916,9 @@
       }
 
       server_increment_failures(server, query->using_tcp);
-      status = ares_requeue_query(query, now, status, ARES_TRUE, rdnsrec, 
requeue);
+      status = ares_requeue_query(query, now, status, ARES_TRUE, rdnsrec,
+        requeue);
+      rdnsrec = NULL; /* Free'd by ares_requeue_query() */
 
       if (status != ARES_ENOMEM) {
         /* Should any of these cause a connection termination?
@@ -882,12 +931,11 @@
 
   /* If cache insertion was successful, it took ownership.  We ignore
    * other cache insertion failures. */
-  if (ares_qcache_insert(channel, now, query, rdnsrec) == ARES_SUCCESS) {
-    is_cached = ARES_TRUE;
-  }
+  ares_qcache_insert(channel, now, query, rdnsrec);
 
   server_set_good(server, query->using_tcp);
-  end_query(channel, server, query, ARES_SUCCESS, rdnsrec);
+  end_query(channel, server, query, ARES_SUCCESS, rdnsrec, requeue);
+  rdnsrec = NULL; /* Free'd by the requeue */
 
   status = ARES_SUCCESS;
 
@@ -922,7 +970,7 @@
 ares_status_t ares_requeue_query(ares_query_t *query, const ares_timeval_t 
*now,
                                  ares_status_t            status,
                                  ares_bool_t              inc_try_count,
-                                 const ares_dns_record_t *dnsrec,
+                                 ares_dns_record_t       *dnsrec,
                                  ares_array_t           **requeue)
 {
   ares_channel_t *channel   = query->channel;
@@ -939,6 +987,7 @@
   }
 
   if (query->try_count < max_tries && !query->no_retries) {
+    ares_dns_record_destroy(dnsrec);
     if (requeue != NULL) {
       return ares_append_requeue(requeue, query, NULL);
     }
@@ -950,7 +999,7 @@
     query->error_status = ARES_ETIMEOUT;
   }
 
-  end_query(channel, NULL, query, query->error_status, dnsrec);
+  end_query(channel, NULL, query, query->error_status, dnsrec, requeue);
   return ARES_ETIMEOUT;
 }
 
@@ -1156,6 +1205,12 @@
     return NULL;
   }
 
+  /* If the associated server has failures, don't use it.  It should be cleaned
+   * up later. */
+  if (conn->server->consec_failures > 0) {
+    return NULL;
+  }
+
   /* Used too many times */
   if (channel->udp_max_queries > 0 &&
       conn->total_queries >= channel->udp_max_queries) {
@@ -1217,7 +1272,6 @@
   ares_status_t   status;
   ares_bool_t     probe_downed_server = ARES_TRUE;
 
-
   /* Choose the server to send the query to */
   if (requested_server != NULL) {
     server = requested_server;
@@ -1232,7 +1286,7 @@
   }
 
   if (server == NULL) {
-    end_query(channel, server, query, ARES_ENOSERVER /* ? */, NULL);
+    end_query(channel, server, query, ARES_ENOSERVER /* ? */, NULL, NULL);
     return ARES_ENOSERVER;
   }
 
@@ -1260,7 +1314,7 @@
 
       /* Anything else is not retryable, likely ENOMEM */
       default:
-        end_query(channel, server, query, status, NULL);
+        end_query(channel, server, query, status, NULL, NULL);
         return status;
     }
   }
@@ -1274,7 +1328,7 @@
 
     case ARES_ENOMEM:
       /* Not retryable */
-      end_query(channel, server, query, status, NULL);
+      end_query(channel, server, query, status, NULL, NULL);
       return status;
 
     /* These conditions are retryable as they are server-specific
@@ -1306,7 +1360,7 @@
     ares_slist_insert(channel->queries_by_timeout, query);
   if (!query->node_queries_by_timeout) {
     /* LCOV_EXCL_START: OutOfMemory */
-    end_query(channel, server, query, ARES_ENOMEM, NULL);
+    end_query(channel, server, query, ARES_ENOMEM, NULL, NULL);
     return ARES_ENOMEM;
     /* LCOV_EXCL_STOP */
   }
@@ -1319,7 +1373,7 @@
 
   if (query->node_queries_to_conn == NULL) {
     /* LCOV_EXCL_START: OutOfMemory */
-    end_query(channel, server, query, ARES_ENOMEM, NULL);
+    end_query(channel, server, query, ARES_ENOMEM, NULL, NULL);
     return ARES_ENOMEM;
     /* LCOV_EXCL_STOP */
   }
@@ -1333,6 +1387,10 @@
     ares_probe_failed_server(channel, server, query);
   }
 
+  if (channel->query_enqueue_cb) {
+    channel->query_enqueue_cb(channel->query_enqueue_cb_data);
+  }
+
   return ARES_SUCCESS;
 }
 
@@ -1407,7 +1465,7 @@
 
 static void end_query(ares_channel_t *channel, ares_server_t *server,
                       ares_query_t *query, ares_status_t status,
-                      const ares_dns_record_t *dnsrec)
+                      ares_dns_record_t *dnsrec, ares_array_t **requeue)
 {
   /* If we were probing for the server to come back online, lets mark it as
    * no longer being probed */
@@ -1417,6 +1475,12 @@
 
   ares_metrics_record(query, server, status, dnsrec);
 
+  /* Delay calling the query callback */
+  if (requeue != NULL) {
+    ares_append_endqueue(requeue, query, status, dnsrec);
+    return;
+  }
+
   /* Invoke the callback. */
   query->callback(query->arg, status, query->timeouts, dnsrec);
   ares_free_query(query);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/c-ares-1.34.5/src/lib/ares_qcache.c new/c-ares-1.34.6/src/lib/ares_qcache.c
--- old/c-ares-1.34.5/src/lib/ares_qcache.c     2025-04-08 14:12:25.000000000 
+0200
+++ new/c-ares-1.34.6/src/lib/ares_qcache.c     2025-12-08 17:21:36.000000000 
+0100
@@ -421,10 +421,20 @@
   return status;
 }
 
-ares_status_t ares_qcache_insert(ares_channel_t       *channel,
-                                 const ares_timeval_t *now,
-                                 const ares_query_t   *query,
-                                 ares_dns_record_t    *dnsrec)
+ares_status_t ares_qcache_insert(ares_channel_t          *channel,
+                                 const ares_timeval_t    *now,
+                                 const ares_query_t      *query,
+                                 const ares_dns_record_t *dnsrec)
 {
-  return ares_qcache_insert_int(channel->qcache, dnsrec, query->query, now);
+  ares_dns_record_t *dupdns = ares_dns_record_duplicate(dnsrec);
+  ares_status_t      status;
+
+  if (dupdns == NULL) {
+    return ARES_ENOMEM;
+  }
+  status = ares_qcache_insert_int(channel->qcache, dupdns, query->query, now);
+  if (status != ARES_SUCCESS) {
+    ares_dns_record_destroy(dupdns);
+  }
+  return status;
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/c-ares-1.34.5/src/lib/ares_set_socket_functions.c 
new/c-ares-1.34.6/src/lib/ares_set_socket_functions.c
--- old/c-ares-1.34.5/src/lib/ares_set_socket_functions.c       2025-04-08 
14:12:25.000000000 +0200
+++ new/c-ares-1.34.6/src/lib/ares_set_socket_functions.c       2025-12-08 
17:21:36.000000000 +0100
@@ -61,7 +61,7 @@
 #  define TFO_USE_SENDTO     0
 #  define TFO_USE_CONNECTX   0
 #  define TFO_CLIENT_SOCKOPT TCP_FASTOPEN_CONNECT
-#elif defined(__FreeBSD__) && defined(TCP_FASTOPEN)
+#elif (defined(__MidnightBSD__) || defined(__FreeBSD__)) && 
defined(TCP_FASTOPEN)
 #  define TFO_SUPPORTED      1
 #  define TFO_SKIP_CONNECT   1
 #  define TFO_USE_SENDTO     1
@@ -127,6 +127,8 @@
     channel->sock_funcs.asendto      = funcs->asendto;
     channel->sock_funcs.agetsockname = funcs->agetsockname;
     channel->sock_funcs.abind        = funcs->abind;
+    channel->sock_funcs.aif_nametoindex = funcs->aif_nametoindex;
+    channel->sock_funcs.aif_indextoname = funcs->aif_indextoname;
   }
 
   /* Implement newer versions here ...*/
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/c-ares-1.34.5/src/lib/ares_sysconfig_win.c 
new/c-ares-1.34.6/src/lib/ares_sysconfig_win.c
--- old/c-ares-1.34.5/src/lib/ares_sysconfig_win.c      2025-04-08 
14:12:25.000000000 +0200
+++ new/c-ares-1.34.6/src/lib/ares_sysconfig_win.c      2025-12-08 
17:21:36.000000000 +0100
@@ -55,6 +55,19 @@
 #include "ares_inet_net_pton.h"
 
 #if defined(USE_WINSOCK)
+
+#  define WIN_NS_9X     "System\\CurrentControlSet\\Services\\VxD\\MSTCP"
+#  define WIN_DNSCLIENT "Software\\Policies\\Microsoft\\System\\DNSClient"
+#  define WIN_NT_DNSCLIENT \
+    "Software\\Policies\\Microsoft\\Windows NT\\DNSClient"
+#  define NAMESERVER           "NameServer"
+#  define DHCPNAMESERVER       "DhcpNameServer"
+#  define SEARCHLIST_KEY       L"SearchList"
+#  define PRIMARYDNSSUFFIX_KEY L"PrimaryDNSSuffix"
+#  define INTERFACES_KEY       "Interfaces"
+#  define DOMAIN_KEY           L"Domain"
+#  define DHCPDOMAIN_KEY       L"DhcpDomain"
+
 /*
  * get_REG_SZ()
  *
@@ -69,38 +82,48 @@
  *
  * Supported on Windows NT 3.5 and newer.
  */
-static ares_bool_t get_REG_SZ(HKEY hKey, const char *leafKeyName, char 
**outptr)
+static ares_bool_t get_REG_SZ(HKEY hKey, const WCHAR *leafKeyName, char 
**outptr)
 {
-  DWORD size = 0;
-  int   res;
+  DWORD  size = 0;
+  int    res;
+  int    len;
+  WCHAR *val = NULL;
 
   *outptr = NULL;
 
   /* Find out size of string stored in registry */
-  res = RegQueryValueExA(hKey, leafKeyName, 0, NULL, NULL, &size);
+  res = RegQueryValueExW(hKey, leafKeyName, 0, NULL, NULL, &size);
   if ((res != ERROR_SUCCESS && res != ERROR_MORE_DATA) || !size) {
     return ARES_FALSE;
   }
 
   /* Allocate buffer of indicated size plus one given that string
      might have been stored without null termination */
-  *outptr = ares_malloc(size + 1);
-  if (!*outptr) {
+  val = ares_malloc_zero(size + sizeof(WCHAR));
+  if (val == NULL) {
     return ARES_FALSE;
   }
 
   /* Get the value for real */
-  res = RegQueryValueExA(hKey, leafKeyName, 0, NULL, (unsigned char *)*outptr,
-                         &size);
-  if ((res != ERROR_SUCCESS) || (size == 1)) {
+  res = RegQueryValueExW(hKey, leafKeyName, 0, NULL, (BYTE *)val, &size);
+  if (res != ERROR_SUCCESS || size == 1) {
+    ares_free(val);
+    return ARES_FALSE;
+  }
+
+  /* Convert to UTF8 */
+  len = WideCharToMultiByte(CP_UTF8, 0, val, -1, NULL, 0, NULL, NULL);
+  if (len == 0) {
+    return ARES_FALSE;
+  }
+  *outptr = ares_malloc_zero((size_t)len + 1);
+  if (WideCharToMultiByte(CP_UTF8, 0, val, -1, *outptr, len, NULL, NULL)
+    == 0) {
     ares_free(*outptr);
     *outptr = NULL;
     return ARES_FALSE;
   }
 
-  /* Null terminate buffer always */
-  *(*outptr + size) = '\0';
-
   return ARES_TRUE;
 }
 
@@ -135,6 +158,14 @@
   commanjoin(dst, src, ares_strlen(src));
 }
 
+static void commajoin_asciionly(char **dst, const char *src)
+{
+  if (!ares_str_isprint(src, ares_strlen(src))) {
+    return;
+  }
+  commanjoin(dst, src, ares_strlen(src));
+}
+
 /* A structure to hold the string form of IPv4 and IPv6 addresses so we can
  * sort them by a metric.
  */
@@ -523,7 +554,7 @@
       ERROR_SUCCESS) {
     get_REG_SZ(hKey, SEARCHLIST_KEY, outptr);
     if (get_REG_SZ(hKey, DOMAIN_KEY, &p)) {
-      commajoin(outptr, p);
+      commajoin_asciionly(outptr, p);
       ares_free(p);
       p = NULL;
     }
@@ -533,7 +564,7 @@
   if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, WIN_NT_DNSCLIENT, 0, KEY_READ, &hKey) 
==
       ERROR_SUCCESS) {
     if (get_REG_SZ(hKey, SEARCHLIST_KEY, &p)) {
-      commajoin(outptr, p);
+      commajoin_asciionly(outptr, p);
       ares_free(p);
       p = NULL;
     }
@@ -545,7 +576,7 @@
   if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, WIN_DNSCLIENT, 0, KEY_READ, &hKey) ==
       ERROR_SUCCESS) {
     if (get_REG_SZ(hKey, PRIMARYDNSSUFFIX_KEY, &p)) {
-      commajoin(outptr, p);
+      commajoin_asciionly(outptr, p);
       ares_free(p);
       p = NULL;
     }
@@ -567,17 +598,17 @@
       }
       /* p can be comma separated (SearchList) */
       if (get_REG_SZ(hKeyEnum, SEARCHLIST_KEY, &p)) {
-        commajoin(outptr, p);
+        commajoin_asciionly(outptr, p);
         ares_free(p);
         p = NULL;
       }
       if (get_REG_SZ(hKeyEnum, DOMAIN_KEY, &p)) {
-        commajoin(outptr, p);
+        commajoin_asciionly(outptr, p);
         ares_free(p);
         p = NULL;
       }
       if (get_REG_SZ(hKeyEnum, DHCPDOMAIN_KEY, &p)) {
-        commajoin(outptr, p);
+        commajoin_asciionly(outptr, p);
         ares_free(p);
         p = NULL;
       }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/c-ares-1.34.5/src/lib/cares.rc new/c-ares-1.34.6/src/lib/cares.rc
--- old/c-ares-1.34.5/src/lib/cares.rc  2025-04-08 14:12:25.000000000 +0200
+++ new/c-ares-1.34.6/src/lib/cares.rc  2025-12-08 17:21:36.000000000 +0100
@@ -63,7 +63,7 @@
 #endif
       VALUE "ProductName",      "The c-ares library\0"
       VALUE "ProductVersion",   ARES_VERSION_STR "\0"
-      VALUE "LegalCopyright",   "� " ARES_COPYRIGHT "\0"
+      VALUE "LegalCopyright",   "Copyright (c) " ARES_COPYRIGHT "\0"
       VALUE "License",          "https://c-ares.org/license.html\0";
     END
   END
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/c-ares-1.34.5/src/lib/event/ares_event_configchg.c 
new/c-ares-1.34.6/src/lib/event/ares_event_configchg.c
--- old/c-ares-1.34.5/src/lib/event/ares_event_configchg.c      2025-04-08 
14:12:25.000000000 +0200
+++ new/c-ares-1.34.6/src/lib/event/ares_event_configchg.c      2025-12-08 
17:21:36.000000000 +0100
@@ -383,6 +383,7 @@
 
 #  include <sys/types.h>
 #  include <unistd.h>
+#  include <stdbool.h>
 #  include <notify.h>
 #  include <dlfcn.h>
 #  include <fcntl.h>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/c-ares-1.34.5/src/lib/event/ares_event_thread.c 
new/c-ares-1.34.6/src/lib/event/ares_event_thread.c
--- old/c-ares-1.34.5/src/lib/event/ares_event_thread.c 2025-04-08 
14:12:25.000000000 +0200
+++ new/c-ares-1.34.6/src/lib/event/ares_event_thread.c 2025-12-08 
17:21:36.000000000 +0100
@@ -235,6 +235,12 @@
   ares_event_thread_wake(e);
 }
 
+static void notifyenqueue_cb(void *data)
+{
+  ares_event_thread_t *e = data;
+  ares_event_thread_wake(e);
+}
+
 static void ares_event_process_updates(ares_event_thread_t *e)
 {
   ares_llist_node_t *node;
@@ -415,6 +421,7 @@
   channel->sock_state_cb                = NULL;
   channel->notify_pending_write_cb      = NULL;
   channel->notify_pending_write_cb_data = NULL;
+  ares_set_query_enqueue_cb(channel, NULL, NULL);
 }
 
 static const ares_event_sys_t *ares_event_fetch_sys(ares_evsys_t evsys)
@@ -521,6 +528,7 @@
   channel->sock_state_cb_data           = e;
   channel->notify_pending_write_cb      = notifywrite_cb;
   channel->notify_pending_write_cb_data = e;
+  ares_set_query_enqueue_cb(channel, notifyenqueue_cb, e);
 
   if (!e->ev_sys->init(e)) {
     /* LCOV_EXCL_START: UntestablePath */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/c-ares-1.34.5/src/lib/util/ares_math.h 
new/c-ares-1.34.6/src/lib/util/ares_math.h
--- old/c-ares-1.34.5/src/lib/util/ares_math.h  2025-04-08 14:12:25.000000000 
+0200
+++ new/c-ares-1.34.6/src/lib/util/ares_math.h  2025-12-08 17:21:36.000000000 
+0100
@@ -26,13 +26,21 @@
 #ifndef __ARES_MATH_H
 #define __ARES_MATH_H
 
-#ifdef _MSC_VER
-typedef __int64          ares_int64_t;
-typedef unsigned __int64 ares_uint64_t;
-#else
-typedef long long          ares_int64_t;
-typedef unsigned long long ares_uint64_t;
-#endif
+#include "ares_setup.h"
+
+#ifdef HAVE_STDINT_H
+#  include <stdint.h>
+   typedef int64_t  ares_int64_t;
+   typedef uint64_t ares_uint64_t;
+#else /* HAVE_STDINT_H */
+#  ifdef _MSC_VER
+     typedef __int64          ares_int64_t;
+     typedef unsigned __int64 ares_uint64_t;
+#  else
+     typedef long long          ares_int64_t;
+     typedef unsigned long long ares_uint64_t;
+#  endif /* _MSC_VER */
+#endif   /* HAVE_STDINT_H */
 
 ares_bool_t   ares_is_64bit(void);
 size_t        ares_round_up_pow2(size_t n);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/c-ares-1.34.5/src/lib/util/ares_rand.c 
new/c-ares-1.34.6/src/lib/util/ares_rand.c
--- old/c-ares-1.34.5/src/lib/util/ares_rand.c  2025-04-08 14:12:25.000000000 
+0200
+++ new/c-ares-1.34.6/src/lib/util/ares_rand.c  2025-12-08 17:21:36.000000000 
+0100
@@ -56,7 +56,7 @@
 {
   /* LCOV_EXCL_START: FallbackCode */
   if (ares_is_64bit()) {
-    return (unsigned int)((((ares_uint64_t)addr >> 32) & 0xFFFFFFFF) |
+    return (unsigned int)((((ares_uint64_t)addr >> 32) & 0xFFFFFFFF) ^
                           ((ares_uint64_t)addr & 0xFFFFFFFF));
   }
   return (unsigned int)((size_t)addr & 0xFFFFFFFF);
@@ -94,12 +94,12 @@
   len += sizeof(data);
 
   ares_tvnow(&tv);
-  data = (unsigned int)((tv.sec | tv.usec) & 0xFFFFFFFF);
+  data = (unsigned int)((tv.sec ^ tv.usec) & 0xFFFFFFFF);
   memcpy(key + len, &data, sizeof(data));
   len += sizeof(data);
 
-  srand(ares_u32_from_ptr(rc4_state) | ares_u32_from_ptr(&i) |
-        (unsigned int)((tv.sec | tv.usec) & 0xFFFFFFFF));
+  srand(ares_u32_from_ptr(rc4_state) ^ ares_u32_from_ptr(&i) ^
+        (unsigned int)((tv.sec ^ tv.usec) & 0xFFFFFFFF));
 #endif
 
   for (i = len; i < key_len; i++) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/c-ares-1.34.5/src/lib/util/ares_uri.c 
new/c-ares-1.34.6/src/lib/util/ares_uri.c
--- old/c-ares-1.34.5/src/lib/util/ares_uri.c   2025-04-08 14:12:25.000000000 
+0200
+++ new/c-ares-1.34.6/src/lib/util/ares_uri.c   2025-12-08 17:21:36.000000000 
+0100
@@ -533,7 +533,7 @@
   status = ares_buf_split_str_array(inpath, (const unsigned char *)"/", 1,
                                     ARES_BUF_SPLIT_TRIM, 0, &arr);
   if (status != ARES_SUCCESS) {
-    return NULL;
+    goto done;
   }
 
   for (i = 0; i < (ares_ssize_t)ares_array_len(arr); i++) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/c-ares-1.34.5/test/CMakeLists.txt new/c-ares-1.34.6/test/CMakeLists.txt
--- old/c-ares-1.34.5/test/CMakeLists.txt       2025-04-08 14:12:25.000000000 
+0200
+++ new/c-ares-1.34.6/test/CMakeLists.txt       2025-12-08 17:21:36.000000000 
+0100
@@ -1,6 +1,8 @@
 # Copyright (C) The c-ares project and its contributors
 # SPDX-License-Identifier: MIT
 
+enable_language(CXX)
+
 # Get rid of: warning C4530: C++ exception handler used, but unwind semantics 
are not enabled. Specify /EHsc
 IF (MSVC)
   SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc")
@@ -50,6 +52,7 @@
 ELSE ()
   target_link_libraries(arestest PRIVATE caresinternal GTest::gmock)
 ENDIF()
+target_compile_features(arestest PRIVATE cxx_std_14)
 target_compile_definitions(arestest PRIVATE CARES_NO_DEPRECATED)
 
 IF (CARES_BUILD_CONTAINER_TESTS)
@@ -75,6 +78,7 @@
 
 add_executable(dnsdump ${DUMPSOURCES})
 target_compile_definitions(dnsdump PRIVATE CARES_NO_DEPRECATED)
+target_compile_features(dnsdump PRIVATE cxx_std_14)
 target_link_libraries(dnsdump PRIVATE caresinternal)
 # Avoid "fatal error C1041: cannot open program database" due to multiple
 # targets trying to use the same PDB.  /FS does NOT resolve this issue.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/c-ares-1.34.5/test/ares-test-internal.cc 
new/c-ares-1.34.6/test/ares-test-internal.cc
--- old/c-ares-1.34.5/test/ares-test-internal.cc        2025-04-08 
14:12:25.000000000 +0200
+++ new/c-ares-1.34.6/test/ares-test-internal.cc        2025-12-08 
17:21:36.000000000 +0100
@@ -594,6 +594,18 @@
   EXPECT_EQ("{ipv6.com addr=[[0000:0000:0000:0000:0000:0000:0000:0001]]}", 
ss.str());
 }
 
+TEST_F(FileChannelTest, GetAddrInfoInvalidService) {
+  TempFile hostsfile("1.2.3.4 example.com");
+  EnvValue with_env("CARES_HOSTS", hostsfile.filename());
+  struct ares_addrinfo_hints hints{};
+  AddrInfoResult result{};
+  hints.ai_family = AF_INET;
+  hints.ai_flags = ARES_AI_CANONNAME | ARES_AI_ENVHOSTS | ARES_AI_NOSORT;
+  ares_getaddrinfo(channel_, "example.com", "invalid", &hints, 
AddrInfoCallback, &result);
+  Process();
+  EXPECT_TRUE(result.done_);
+  EXPECT_EQ(result.status_, ARES_ESERVICE);
+}
 
 TEST_F(FileChannelTest, GetAddrInfoAllocFail) {
   TempFile hostsfile("1.2.3.4 example.com alias1 alias2\n");
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/c-ares-1.34.5/test/ares-test-mock-ai.cc 
new/c-ares-1.34.6/test/ares-test-mock-ai.cc
--- old/c-ares-1.34.5/test/ares-test-mock-ai.cc 2025-04-08 14:12:25.000000000 
+0200
+++ new/c-ares-1.34.6/test/ares-test-mock-ai.cc 2025-12-08 17:21:36.000000000 
+0100
@@ -805,7 +805,39 @@
   EXPECT_THAT(result.ai_, 
IncludesV6Address("2121:0000:0000:0000:0000:0000:0000:0303"));
 }
 
+TEST_P(MockUDPChannelTestAI, ConnectionRefusedOnSearchDomainRetry) {
+  DNSPacket badrsp4;
+  badrsp4.set_response().set_aa()
+    .add_question(new DNSQuestion("www.google.com", T_A))
+    .set_rcode(NXDOMAIN);
 
+  EXPECT_CALL(server_, OnRequest("www.google.com", T_A))
+    .WillOnce(SetReplyAndFailSend(&server_, &badrsp4));
+
+  DNSPacket goodrsp4;
+  goodrsp4.set_response().set_aa()
+    .add_question(new DNSQuestion("www.google.com.first.com", T_A))
+    .add_answer(new DNSARR("www.google.com.first.com", 0x0100, {0x01, 0x02, 
0x03, 0x04}));
+
+  EXPECT_CALL(server_, OnRequest("www.google.com.first.com", T_A))
+    .WillOnce(SetReply(&server_, &goodrsp4));
+
+  ares_socket_functions sock_funcs;
+  memset(&sock_funcs, 0, sizeof(sock_funcs));
+
+  sock_funcs.asendv = ares_sendv_fail;
+
+  ares_set_socket_functions(channel_, &sock_funcs, NULL);
+
+  AddrInfoResult result;
+  struct ares_addrinfo_hints hints = {0, 0, 0, 0};
+  hints.ai_family = AF_INET;
+  hints.ai_flags = ARES_AI_NOSORT;
+  ares_getaddrinfo(channel_, "www.google.com", NULL, &hints,
+                   AddrInfoCallback, &result);
+
+  Process();
+}
 
 class MockEDNSChannelTestAI : public MockFlagsChannelOptsTestAI {
  public:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/c-ares-1.34.5/test/ares-test-mock-et.cc 
new/c-ares-1.34.6/test/ares-test-mock-et.cc
--- old/c-ares-1.34.5/test/ares-test-mock-et.cc 2025-04-08 14:12:25.000000000 
+0200
+++ new/c-ares-1.34.6/test/ares-test-mock-et.cc 2025-12-08 17:21:36.000000000 
+0100
@@ -112,6 +112,114 @@
   }
 }
 
+static int noop_close(ares_socket_t sock, void *user_data)
+{
+  (void)user_data;
+#if defined(HAVE_CLOSESOCKET)
+  return closesocket(sock);
+#elif defined(HAVE_CLOSESOCKET_CAMEL)
+  return CloseSocket(sock);
+#elif defined(HAVE_CLOSE_S)
+  return close_s(sock);
+#else
+  return close(sock);
+#endif
+  return 0;
+}
+
+static ares_socket_t noop_socket(int domain, int type, int protocol,
+                                 void *user_data)
+{
+  (void)user_data;
+  return socket(domain, type, protocol);
+}
+
+static int noop_setsockopt(ares_socket_t sock, ares_socket_opt_t opt,
+                           const void *val, ares_socklen_t val_size,
+                           void *user_data)
+{
+  (void)sock;
+  (void)opt;
+  (void)val;
+  (void)val_size;
+  (void)user_data;
+  return 0;
+}
+
+static int noop_connect(ares_socket_t sock, const struct sockaddr *address,
+                        ares_socklen_t address_len, unsigned int flags,
+                        void *user_data)
+{
+  (void)sock;
+  (void)address;
+  (void)address_len;
+  (void)flags;
+  (void)user_data;
+
+  return 0;
+}
+
+static ares_ssize_t noop_recvfrom(ares_socket_t sock, void *buffer,
+                                  size_t length, int flags,
+                                  struct sockaddr *address,
+                                  ares_socklen_t  *address_len,
+                                  void            *user_data)
+{
+  (void)sock;
+  (void)buffer;
+  (void)length;
+  (void)flags;
+  (void)address;
+  (void)address_len;
+  (void)user_data;
+
+  errno = EAGAIN;
+  return 0;
+}
+
+static ares_ssize_t noop_sendto(ares_socket_t sock, const void *buffer,
+                                size_t length, int flags,
+                                const struct sockaddr *address,
+                                ares_socklen_t address_len, void *user_data)
+{
+  (void)sock;
+  (void)buffer;
+  (void)flags;
+  (void)address;
+  (void)address_len;
+  (void)user_data;
+  /* Eat all data */
+  return (ares_ssize_t)length;
+}
+
+// Issue #1000 Event Thread stall on temporarily downed server.
+TEST_P(MockUDPEventThreadTest, DownServer) {
+  struct ares_socket_functions_ex noop_sock_funcs;
+  memset(&noop_sock_funcs, 0, sizeof(noop_sock_funcs));
+  noop_sock_funcs.version     = 1;
+  noop_sock_funcs.asocket     = noop_socket;
+  noop_sock_funcs.aclose      = noop_close;
+  noop_sock_funcs.asetsockopt = noop_setsockopt;
+  noop_sock_funcs.aconnect    = noop_connect;
+  noop_sock_funcs.arecvfrom   = noop_recvfrom;
+  noop_sock_funcs.asendto     = noop_sendto;
+  ares_set_socket_functions_ex(channel_, &noop_sock_funcs, NULL);
+
+  QueryResult result;
+  ares_query_dnsrec(channel_, "www.google.com", ARES_CLASS_IN, 
ARES_REC_TYPE_A, QueryCallback, &result, NULL);
+  // no need to call Process() since we're not actually connecting
+  ares_queue_wait_empty(channel_, -1);
+  EXPECT_TRUE(result.done_);
+  EXPECT_NE(0, result.timeouts_);
+
+  // Issue states second query stalls
+  ares_query_dnsrec(channel_, "www.google.com", ARES_CLASS_IN, 
ARES_REC_TYPE_A, QueryCallback, &result, NULL);
+  // no need to call Process() since we're not actually connecting
+  ares_queue_wait_empty(channel_, -1);
+  EXPECT_TRUE(result.done_);
+  EXPECT_NE(0, result.timeouts_);
+}
+
 // UDP to TCP specific test
 TEST_P(MockUDPEventThreadTest, TruncationRetry) {
   DNSPacket rsptruncated;

Reply via email to