mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00
deps: update c-ares to v1.32.0
PR-URL: https://github.com/nodejs/node/pull/53722 Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
This commit is contained in:
parent
ea711876ca
commit
8736e9f653
140 changed files with 3592 additions and 2802 deletions
11
deps/cares/CMakeLists.txt
vendored
11
deps/cares/CMakeLists.txt
vendored
|
@ -12,7 +12,7 @@ INCLUDE (CheckCSourceCompiles)
|
|||
INCLUDE (CheckStructHasMember)
|
||||
INCLUDE (CheckLibraryExists)
|
||||
|
||||
PROJECT (c-ares LANGUAGES C VERSION "1.31.0" )
|
||||
PROJECT (c-ares LANGUAGES C VERSION "1.32.0" )
|
||||
|
||||
# Set this version before release
|
||||
SET (CARES_VERSION "${PROJECT_VERSION}")
|
||||
|
@ -30,7 +30,7 @@ INCLUDE (GNUInstallDirs) # include this *AFTER* PROJECT(), otherwise paths are w
|
|||
# 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 "18:0:16")
|
||||
SET (CARES_LIB_VERSIONINFO "19:0:17")
|
||||
|
||||
|
||||
OPTION (CARES_STATIC "Build as a static library" OFF)
|
||||
|
@ -62,8 +62,8 @@ ENDIF ()
|
|||
|
||||
INCLUDE (EnableWarnings)
|
||||
|
||||
# allow linking against the static runtime library in msvc
|
||||
IF (MSVC)
|
||||
# allow linking against the static runtime library in msvc
|
||||
OPTION (CARES_MSVC_STATIC_RUNTIME "Link against the static runtime library" OFF)
|
||||
IF (CARES_MSVC_STATIC_RUNTIME)
|
||||
# CMAKE_CONFIGURATION_TYPES is empty on non-IDE generators (Ninja, NMake)
|
||||
|
@ -564,7 +564,7 @@ SET (RECVFROM_TYPE_ARG5 "struct sockaddr *")
|
|||
SET (RECV_TYPE_ARG4 int)
|
||||
SET (GETNAMEINFO_TYPE_ARG1 "struct sockaddr *")
|
||||
SET (GETNAMEINFO_TYPE_ARG7 int)
|
||||
SET (SEND_TYPE_ARG2 "void *")
|
||||
SET (SEND_TYPE_ARG2 "const void *")
|
||||
SET (SEND_TYPE_ARG4 int)
|
||||
################################################################################
|
||||
|
||||
|
@ -663,6 +663,9 @@ ENDIF ()
|
|||
IF (HAVE_SYS_SOCKET_H)
|
||||
SET (CARES_HAVE_SYS_SOCKET_H 1)
|
||||
ENDIF()
|
||||
IF (HAVE_SYS_SELECT_H)
|
||||
SET (CARES_HAVE_SYS_SELECT_H 1)
|
||||
ENDIF()
|
||||
IF (HAVE_WS2TCPIP_H)
|
||||
SET (CARES_HAVE_WS2TCPIP_H 1)
|
||||
ENDIF()
|
||||
|
|
55
deps/cares/INSTALL.md
vendored
55
deps/cares/INSTALL.md
vendored
|
@ -42,7 +42,7 @@ unpacked the source archive):
|
|||
You probably need to be root when doing the last command.
|
||||
|
||||
If you have checked out the sources from the git repository, read the
|
||||
[GIT-INFO](GIT_INFO) on how to proceed.
|
||||
[GIT-INFO](GIT-INFO) on how to proceed.
|
||||
|
||||
Get a full listing of all available configure options by invoking it like:
|
||||
|
||||
|
@ -307,6 +307,16 @@ first to rebuild every single library your app uses as well as your
|
|||
app using the debug multithreaded dynamic C runtime.
|
||||
|
||||
|
||||
### MSYS
|
||||
|
||||
Building is supported for native windows via both AutoTools and CMake. When
|
||||
building with autotools, you can only build either a shared version or a static
|
||||
version (use `--disable-shared` or `--disable-static`). CMake can build both
|
||||
simultaneously.
|
||||
|
||||
All of the MSYS environments are supported: `MINGW32`, `MINGW64`, `UCRT64`,
|
||||
`CLANG32`, `CLANG64`, `CLANGARM64`.
|
||||
|
||||
### MingW32
|
||||
|
||||
Make sure that MinGW32's bin dir is in the search path, for example:
|
||||
|
@ -339,6 +349,26 @@ add `-DCARES_STATICLIB` to your `CFLAGS`. Otherwise the linker will look for
|
|||
dynamic import symbols.
|
||||
|
||||
|
||||
DOS
|
||||
---
|
||||
|
||||
c-ares supports building as a 32bit protected mode application via
|
||||
[DJGPP](https://www.delorie.com/djgpp/). It is recommended to use a DJGPP
|
||||
cross compiler from [Andrew Wu](https://github.com/andrewwutw/build-djgpp)
|
||||
as building directly in a DOS environment can be difficult.
|
||||
|
||||
It is required to also have [Watt-32](https://www.watt-32.net/) available
|
||||
built using the same compiler. It is recommended to build the latest `master`
|
||||
branch from [GitHub](https://github.com/sezero/watt32/tree/master).
|
||||
|
||||
Finally, the `DJ_PREFIX` and `WATT_ROOT` environment variables must be set
|
||||
appropriately before calling `make Makefile.dj` to build c-ares.
|
||||
|
||||
Please refer to our CI
|
||||
[GitHub Actions Workflow](https://github.com/c-ares/c-ares/blob/main/.github/workflows/djgpp.yml)
|
||||
for a full build example, including building the latest Watt-32 release.
|
||||
|
||||
|
||||
IBM OS/2
|
||||
--------
|
||||
|
||||
|
@ -418,20 +448,25 @@ This is a probably incomplete list of known hardware and operating systems
|
|||
that c-ares has been compiled for. If you know a system c-ares compiles and
|
||||
runs on, that isn't listed, please let us know!
|
||||
|
||||
- Alpha Tru64 v5.0 5.1
|
||||
- ARM Android 1.5, 2.1, 2.3
|
||||
- MIPS IRIX 6.2, 6.5
|
||||
- Power AIX 3.2.5, 4.2, 4.3.1, 4.3.2, 5.1, 5.2
|
||||
- i386 Linux 1.3, 2.0, 2.2, 2.3, 2.4, 2.6
|
||||
- i386 Novell NetWare
|
||||
- i386 Windows 95, 98, ME, NT, 2000, XP, 2003
|
||||
- x86_64 Linux
|
||||
- Linux (i686, x86_64, AARCH64, and more)
|
||||
- MacOS 10.4+
|
||||
- iOS
|
||||
- Windows 8+ (i686, x86_64)
|
||||
- Android (ARM, AARCH64, x86_64)
|
||||
- FreeBSD
|
||||
- NetBSD
|
||||
- OpenBSD
|
||||
- Solaris (SPARC, x86_64)
|
||||
- AIX (POWER)
|
||||
- Tru64 (Alpha)
|
||||
- IRIX (MIPS)
|
||||
- Novell NetWare (i386)
|
||||
|
||||
|
||||
Useful URLs
|
||||
===========
|
||||
|
||||
- c-ares: https://c-ares.org/
|
||||
- MingW: http://www.mingw.org/
|
||||
- MinGW-w64: http://mingw-w64.sourceforge.net/
|
||||
- MSYS2: https://msys2.org
|
||||
- OpenWatcom: http://www.openwatcom.org/
|
||||
|
|
43
deps/cares/Makefile.dj
vendored
43
deps/cares/Makefile.dj
vendored
|
@ -20,10 +20,51 @@ WATT32_LIB = $(WATT32_ROOT)/lib/libwatt.a
|
|||
OBJ_DIR = djgpp
|
||||
|
||||
CFLAGS = -g -O2 -I./include -I./src/lib \
|
||||
-I$(WATT32_ROOT)/inc -Wall \
|
||||
-I$(WATT32_ROOT)/inc \
|
||||
-Wall \
|
||||
-Wextra \
|
||||
-Waggregate-return \
|
||||
-Wcast-align \
|
||||
-Wcast-qual \
|
||||
-Wconversion \
|
||||
-Wdeclaration-after-statement \
|
||||
-Wdouble-promotion \
|
||||
-Wfloat-equal \
|
||||
-Winit-self \
|
||||
-Wjump-misses-init \
|
||||
-Wlogical-op \
|
||||
-Wmissing-braces \
|
||||
-Wmissing-declarations \
|
||||
-Wmissing-format-attribute \
|
||||
-Wmissing-include-dirs \
|
||||
-Wmissing-prototypes \
|
||||
-Wnested-externs \
|
||||
-Wno-coverage-mismatch \
|
||||
-Wold-style-definition \
|
||||
-Wpacked \
|
||||
-Wpointer-arith \
|
||||
-Wshadow \
|
||||
-Wsign-conversion \
|
||||
-Wstrict-overflow \
|
||||
-Wstrict-prototypes \
|
||||
-Wtrampolines \
|
||||
-Wundef \
|
||||
-Wunreachable-code \
|
||||
-Wunused \
|
||||
-Wvariadic-macros \
|
||||
-Wvla \
|
||||
-Wwrite-strings \
|
||||
-Werror=implicit-int \
|
||||
-Werror=implicit-function-declaration \
|
||||
-Wno-long-long \
|
||||
-DWATT32 -DHAVE_CONFIG_H \
|
||||
-D_REENTRANT \
|
||||
-DCARES_NO_DEPRECATED \
|
||||
-Dselect=select_s
|
||||
|
||||
# Can't enable -Wredundant-decls due to WATT32 issues
|
||||
|
||||
|
||||
LDFLAGS = -s
|
||||
|
||||
ifeq ($(OS),Windows_NT)
|
||||
|
|
1
deps/cares/Makefile.m32
vendored
1
deps/cares/Makefile.m32
vendored
|
@ -64,7 +64,6 @@ install:
|
|||
${INSTALL} -m 444 ${srcdir}/include/ares.h ${DESTDIR}${includedir}
|
||||
${INSTALL} -m 444 ${srcdir}/include/ares_build.h ${DESTDIR}${includedir}
|
||||
${INSTALL} -m 444 ${srcdir}/include/ares_dns_record.h ${DESTDIR}${includedir}
|
||||
${INSTALL} -m 444 ${srcdir}/include/ares_rules.h ${DESTDIR}${includedir}
|
||||
${INSTALL} -m 444 ${srcdir}/include/ares_version.h ${DESTDIR}${includedir}
|
||||
(for man in $(MANPAGES); do \
|
||||
${INSTALL} -m 444 ${srcdir}/$${man} ${DESTDIR}${mandir}/man3; \
|
||||
|
|
3
deps/cares/Makefile.msvc
vendored
3
deps/cares/Makefile.msvc
vendored
|
@ -214,7 +214,7 @@ RT_ERROR_CHECKING = /RTCsu
|
|||
|
||||
CC_CMD_REL = cl.exe /nologo $(RTLIB) /DNDEBUG /O2
|
||||
CC_CMD_DBG = cl.exe /nologo $(RTLIBD) /D_DEBUG /Od /Zi $(RT_ERROR_CHECKING)
|
||||
CC_CFLAGS = $(CFLAGS) /I.\src\lib /I.\include /W3 /EHsc /FD
|
||||
CC_CFLAGS = $(CFLAGS) /D_REENTRANT /I.\src\lib /I.\include /W3 /EHsc /FD
|
||||
|
||||
RC_CMD_REL = rc.exe /l 0x409 /d "NDEBUG"
|
||||
RC_CMD_DBG = rc.exe /l 0x409 /d "_DEBUG"
|
||||
|
@ -440,7 +440,6 @@ install:
|
|||
@copy /y $(CARES_OUTDIR)\*.* "$(INSTALL_DIR_LIB)" >NUL
|
||||
@copy /y $(SRCDIR)\include\ares.h "$(INSTALL_DIR_INC)" >NUL
|
||||
@copy /y $(SRCDIR)\include\ares_build.h "$(INSTALL_DIR_INC)" >NUL
|
||||
@copy /y $(SRCDIR)\include\ares_rules.h "$(INSTALL_DIR_INC)" >NUL
|
||||
@copy /y $(SRCDIR)\include\ares_version.h "$(INSTALL_DIR_INC)" >NUL
|
||||
@copy /y $(SRCDIR)\include\ares_dns_record.h "$(INSTALL_DIR_INC)" >NUL
|
||||
@echo Installed c-ares $(CFG)
|
||||
|
|
3
deps/cares/Makefile.netware
vendored
3
deps/cares/Makefile.netware
vendored
|
@ -299,9 +299,8 @@ ifeq ($(LIBARCH),CLIB)
|
|||
@echo $(DL)#define RECVFROM_TYPE_ARG5 struct sockaddr$(DL) >> $@
|
||||
@echo $(DL)#define RECVFROM_TYPE_ARG6 int$(DL) >> $@
|
||||
@echo $(DL)#define RECVFROM_TYPE_RETV int$(DL) >> $@
|
||||
@echo $(DL)#define SEND_QUAL_ARG2$(DL) >> $@
|
||||
@echo $(DL)#define SEND_TYPE_ARG1 int$(DL) >> $@
|
||||
@echo $(DL)#define SEND_TYPE_ARG2 char *$(DL) >> $@
|
||||
@echo $(DL)#define SEND_TYPE_ARG2 const char *$(DL) >> $@
|
||||
@echo $(DL)#define SEND_TYPE_ARG3 int$(DL) >> $@
|
||||
@echo $(DL)#define SEND_TYPE_ARG4 int$(DL) >> $@
|
||||
@echo $(DL)#define SEND_TYPE_RETV int$(DL) >> $@
|
||||
|
|
34
deps/cares/RELEASE-NOTES.md
vendored
34
deps/cares/RELEASE-NOTES.md
vendored
|
@ -1,24 +1,38 @@
|
|||
## c-ares version 1.31.0 - June 18 2024
|
||||
## c-ares version 1.32.0 - July 4 2024
|
||||
|
||||
This is a maintenance and bugfix release.
|
||||
This is a feature and bugfix release.
|
||||
|
||||
Features:
|
||||
|
||||
* Add support for DNS 0x20 to help prevent cache poisoning attacks, enabled
|
||||
by specifying `ARES_FLAG_DNS0x20`. Disabled by default. [PR #800](https://github.com/c-ares/c-ares/pull/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](https://github.com/c-ares/c-ares/pull/794)
|
||||
|
||||
Changes:
|
||||
|
||||
* Enable Query Cache by default. [PR #786](https://github.com/c-ares/c-ares/pull/786)
|
||||
* 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](https://github.com/c-ares/c-ares/pull/801)
|
||||
* Clean up header inclusion logic to make hacking on code easier. [PR #797](https://github.com/c-ares/c-ares/pull/797)
|
||||
* GCC/Clang: Enable even more strict warnings to catch more coding flaws. [253bdee](https://github.com/c-ares/c-ares/commit/253bdee)
|
||||
* MSVC: Enable `/W4` warning level. [PR #792](https://github.com/c-ares/c-ares/pull/792)
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* Enhance Windows DNS configuration change detection to also detect manual DNS
|
||||
configuration changes. [PR #785](https://github.com/c-ares/c-ares/issues/785)
|
||||
* Various legacy MacOS Build fixes. [Issue #782](https://github.com/c-ares/c-ares/issues/782)
|
||||
* Ndots value of zero in resolv.conf was not being honored. [852a60a](https://github.com/c-ares/c-ares/commit/852a60a)
|
||||
* Watt-32 build support had been broken for some time. [PR #781](https://github.com/c-ares/c-ares/pull/781)
|
||||
* Distribute `ares_dns_rec_type_tostr` manpage. [PR #778](https://github.com/c-ares/c-ares/pull/778)
|
||||
* Tests: Fix thread race condition in test cases for EventThread. [PR #803](https://github.com/c-ares/c-ares/pull/803)
|
||||
* Windows: Fix building with UNICODE. [PR #802](https://github.com/c-ares/c-ares/pull/802)
|
||||
* Thread Saftey: `ares_timeout()` was missing lock. [74a64e4](https://github.com/c-ares/c-ares/commit/74a64e4)
|
||||
* Fix building with DJGPP (32bit protected mode DOS). [PR #789](https://github.com/c-ares/c-ares/pull/789)
|
||||
|
||||
Thanks go to these friendly people for their efforts and contributions for this
|
||||
release:
|
||||
|
||||
* Brad House (@bradh352)
|
||||
* Gregor Jasny (@gjasny)
|
||||
* Cheng (@zcbenz)
|
||||
|
||||
|
||||
|
||||
|
|
2
deps/cares/aminclude_static.am
vendored
2
deps/cares/aminclude_static.am
vendored
|
@ -1,6 +1,6 @@
|
|||
|
||||
# aminclude_static.am generated automatically by Autoconf
|
||||
# from AX_AM_MACROS_STATIC on Tue Jun 18 05:51:32 EDT 2024
|
||||
# from AX_AM_MACROS_STATIC on Thu Jul 4 07:03:12 EDT 2024
|
||||
|
||||
|
||||
# Code coverage
|
||||
|
|
6
deps/cares/cares.gyp
vendored
6
deps/cares/cares.gyp
vendored
|
@ -5,7 +5,6 @@
|
|||
'include/ares_dns.h',
|
||||
'include/ares_dns_record.h',
|
||||
'include/ares_nameser.h',
|
||||
'include/ares_rules.h',
|
||||
'include/ares_version.h',
|
||||
'src/lib/ares__addrinfo2hostent.c',
|
||||
'src/lib/ares__addrinfo_localhost.c',
|
||||
|
@ -43,6 +42,8 @@
|
|||
'src/lib/ares_data.h',
|
||||
'src/lib/ares_destroy.c',
|
||||
'src/lib/ares_dns_mapping.c',
|
||||
'src/lib/ares_dns_multistring.c',
|
||||
'src/lib/ares_dns_multistring.h',
|
||||
'src/lib/ares_dns_name.c',
|
||||
'src/lib/ares_dns_parse.c',
|
||||
'src/lib/ares_dns_record.c',
|
||||
|
@ -76,6 +77,7 @@
|
|||
'src/lib/ares_library_init.c',
|
||||
'src/lib/ares_ipv6.h',
|
||||
'src/lib/ares_math.c',
|
||||
'src/lib/ares_metrics.c',
|
||||
'src/lib/ares_options.c',
|
||||
'src/lib/ares_parse_a_reply.c',
|
||||
'src/lib/ares_parse_aaaa_reply.c',
|
||||
|
@ -112,7 +114,6 @@
|
|||
'src/lib/ares_version.c',
|
||||
'src/lib/inet_net_pton.c',
|
||||
'src/lib/inet_ntop.c',
|
||||
'src/lib/setup_once.h',
|
||||
'src/tools/ares_getopt.c',
|
||||
'src/tools/ares_getopt.h',
|
||||
],
|
||||
|
@ -122,6 +123,7 @@
|
|||
'src/lib/thirdparty/apple/dnsinfo.h',
|
||||
],
|
||||
'cares_sources_win': [
|
||||
'src/lib/ares_sysconfig_win.c',
|
||||
'src/lib/config-win32.h',
|
||||
'src/lib/windows_port.c',
|
||||
],
|
||||
|
|
534
deps/cares/cmake/EnableWarnings.cmake
vendored
534
deps/cares/cmake/EnableWarnings.cmake
vendored
|
@ -39,254 +39,6 @@ include(CheckCXXCompilerFlag)
|
|||
|
||||
get_property(languages GLOBAL PROPERTY ENABLED_LANGUAGES)
|
||||
|
||||
# internal helper: _int_enable_warnings_set_flags_ex(langs_var configs_var [warnings flags])
|
||||
function(_int_enable_warnings_set_flags_ex langs_var configs_var)
|
||||
if (NOT ARGN)
|
||||
return()
|
||||
endif ()
|
||||
|
||||
if (NOT ${configs_var})
|
||||
set(${configs_var} "NONE")
|
||||
endif ()
|
||||
string(TOUPPER "${${configs_var}}" ${configs_var})
|
||||
|
||||
foreach(_flag ${ARGN})
|
||||
string(MAKE_C_IDENTIFIER "HAVE_${_flag}" varname)
|
||||
|
||||
if ("C" IN_LIST ${langs_var})
|
||||
check_c_compiler_flag(${_flag} ${varname})
|
||||
if (${varname})
|
||||
foreach (config IN LISTS ${configs_var})
|
||||
if (config STREQUAL "NONE")
|
||||
set(config)
|
||||
else ()
|
||||
set(config "_${config}")
|
||||
endif ()
|
||||
string(APPEND CMAKE_C_FLAGS${config} " ${_flag}")
|
||||
endforeach ()
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if ("CXX" IN_LIST ${langs_var})
|
||||
string(APPEND varname "_CXX")
|
||||
check_cxx_compiler_flag(${_flag} ${varname})
|
||||
if (${varname})
|
||||
foreach (config IN LISTS ${configs_var})
|
||||
if (config STREQUAL "NONE")
|
||||
set(config)
|
||||
else ()
|
||||
set(config "_${config}")
|
||||
endif ()
|
||||
string(APPEND CMAKE_CXX_FLAGS${config} " ${_flag}")
|
||||
endforeach ()
|
||||
endif ()
|
||||
endif ()
|
||||
endforeach()
|
||||
|
||||
foreach(lang C CXX)
|
||||
foreach (config IN LISTS ${configs_var})
|
||||
string(TOUPPER "${config}" config)
|
||||
if (config STREQUAL "NONE")
|
||||
set(config)
|
||||
else ()
|
||||
set(config "_${config}")
|
||||
endif ()
|
||||
string(STRIP "${CMAKE_${lang}_FLAGS${config}}" CMAKE_${lang}_FLAGS${config})
|
||||
set(CMAKE_${lang}_FLAGS${config} "${CMAKE_${lang}_FLAGS${config}}" PARENT_SCOPE)
|
||||
endforeach ()
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
# internal helper: _int_enable_warnings_set_flags(langs_var [warnings flags])
|
||||
macro(_int_enable_warnings_set_flags langs_var)
|
||||
set(configs "NONE")
|
||||
_int_enable_warnings_set_flags_ex(${langs_var} configs ${ARGN})
|
||||
endmacro()
|
||||
|
||||
set(_flags_C)
|
||||
set(_flags_CXX)
|
||||
set(_debug_flags_C)
|
||||
set(_debug_flags_CXX)
|
||||
|
||||
if (MSVC)
|
||||
# Visual Studio uses a completely different nomenclature for warnings than gcc/mingw/clang, so none of the
|
||||
# "-W[name]" warnings will work.
|
||||
|
||||
# W4 would be better but it produces unnecessary warnings like:
|
||||
# * warning C4706: assignment within conditional expression
|
||||
# Triggered when doing "while(1)"
|
||||
# * warning C4115: 'timeval' : named type definition in parentheses
|
||||
# * warning C4201: nonstandard extension used : nameless struct/union
|
||||
# Triggered by system includes (commctrl.h, shtypes.h, Shlobj.h)
|
||||
set(_flags
|
||||
/W3
|
||||
/we4013 # Treat "function undefined, assuming extern returning int" warning as an error. https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-3-c4013
|
||||
)
|
||||
|
||||
list(APPEND _flags_C ${_flags})
|
||||
list(APPEND _flags_CXX ${_flags})
|
||||
|
||||
elseif (CMAKE_C_COMPILER_ID MATCHES "Intel")
|
||||
# Intel's compiler warning flags are more like Visual Studio than GCC, though the numbers aren't the same.
|
||||
set(_flags
|
||||
# Use warning level 3, quite wordy.
|
||||
-w3
|
||||
# Disable warnings we don't care about (add more as they are encountered).
|
||||
-wd383 # Spammy warning about initializing from a temporary object in C++ (which is done all the time ...).
|
||||
-wd11074 # Diagnostic related to inlining.
|
||||
-wd11076 # Diagnostic related to inlining.
|
||||
)
|
||||
|
||||
list(APPEND _flags_C ${_flags})
|
||||
list(APPEND _flags_CXX ${_flags})
|
||||
|
||||
elseif (CMAKE_C_COMPILER_ID MATCHES "XL")
|
||||
set (_flags
|
||||
-qwarn64
|
||||
-qformat=all
|
||||
-qflag=i:i
|
||||
)
|
||||
list(APPEND _flags_C ${_flags})
|
||||
list(APPEND _flags_CXX ${_flags})
|
||||
|
||||
else ()
|
||||
# If we're compiling with GCC / Clang / MinGW (or anything else besides Visual Studio or Intel):
|
||||
# C Flags:
|
||||
list(APPEND _flags_C
|
||||
-Wall
|
||||
-Wextra
|
||||
|
||||
# Enable additional warnings not covered by Wall and Wextra.
|
||||
-Wcast-align
|
||||
-Wconversion
|
||||
-Wdeclaration-after-statement
|
||||
-Wdouble-promotion
|
||||
-Wfloat-equal
|
||||
-Wformat-security
|
||||
-Winit-self
|
||||
-Wjump-misses-init
|
||||
-Wlogical-op
|
||||
-Wmissing-braces
|
||||
-Wmissing-declarations
|
||||
-Wmissing-format-attribute
|
||||
-Wmissing-include-dirs
|
||||
-Wmissing-prototypes
|
||||
-Wnested-externs
|
||||
-Wno-coverage-mismatch
|
||||
-Wold-style-definition
|
||||
-Wpacked
|
||||
-Wpointer-arith
|
||||
-Wredundant-decls
|
||||
-Wshadow
|
||||
-Wsign-conversion
|
||||
-Wstrict-overflow
|
||||
-Wstrict-prototypes
|
||||
-Wtrampolines
|
||||
-Wundef
|
||||
-Wunused
|
||||
-Wvariadic-macros
|
||||
-Wvla
|
||||
-Wwrite-strings
|
||||
|
||||
# On Windows MinGW I think implicit fallthrough enabled by -Wextra must not default to 3
|
||||
-Wimplicit-fallthrough=3
|
||||
|
||||
# Treat implicit variable typing and implicit function declarations as errors.
|
||||
-Werror=implicit-int
|
||||
-Werror=implicit-function-declaration
|
||||
|
||||
# Make MacOSX honor -mmacosx-version-min
|
||||
-Werror=partial-availability
|
||||
|
||||
# Some clang versions might warn if an argument like "-I/path/to/headers" is unused,
|
||||
# silence these.
|
||||
-Qunused-arguments
|
||||
)
|
||||
|
||||
# C++ flags:
|
||||
list(APPEND _flags_CXX
|
||||
-Wall
|
||||
-Wextra
|
||||
|
||||
# Enable additional warnings not covered by Wall and Wextra.
|
||||
-Wcast-align
|
||||
-Wformat-security
|
||||
-Wmissing-declarations
|
||||
-Wmissing-format-attribute
|
||||
-Wpacked-bitfield-compat
|
||||
-Wredundant-decls
|
||||
-Wvla
|
||||
|
||||
# Turn off unused parameter warnings with C++ (they happen often in C++ and Qt).
|
||||
-Wno-unused-parameter
|
||||
|
||||
# Some clang versions might warn if an argument like "-I/path/to/headers" is unused,
|
||||
# silence these.
|
||||
-Qunused-arguments
|
||||
)
|
||||
|
||||
# Note: when cross-compiling to Windows from Cygwin, the Qt Mingw packages have a bunch of
|
||||
# noisy type-conversion warnings in headers. So, only enable those warnings if we're
|
||||
# not building that configuration.
|
||||
if (NOT (WIN32 AND (CMAKE_HOST_SYSTEM_NAME MATCHES "CYGWIN")))
|
||||
list(APPEND _flags_CXX
|
||||
-Wconversion
|
||||
-Wfloat-equal
|
||||
-Wsign-conversion
|
||||
)
|
||||
endif ()
|
||||
|
||||
# Add flags to force colored output even when output is redirected via pipe.
|
||||
if (CMAKE_GENERATOR MATCHES "Ninja")
|
||||
set(color_default TRUE)
|
||||
else ()
|
||||
set(color_default FALSE)
|
||||
endif ()
|
||||
option(FORCE_COLOR "Force compiler to always colorize, even when output is redirected." ${color_default})
|
||||
mark_as_advanced(FORCE FORCE_COLOR)
|
||||
if (FORCE_COLOR)
|
||||
set(_flags
|
||||
-fdiagnostics-color=always # GCC
|
||||
-fcolor-diagnostics # Clang
|
||||
)
|
||||
list(APPEND _flags_C ${_flags})
|
||||
list(APPEND _flags_CXX ${_flags})
|
||||
endif ()
|
||||
|
||||
# Add -fno-omit-frame-pointer (and optionally -fno-inline) to make debugging and stack dumps nicer.
|
||||
set(_flags
|
||||
-fno-omit-frame-pointer
|
||||
)
|
||||
option(M_NO_INLINE "Disable function inlining for RelWithDebInfo and Debug configurations?" FALSE)
|
||||
if (M_NO_INLINE)
|
||||
list(APPEND _flags
|
||||
-fno-inline
|
||||
)
|
||||
endif ()
|
||||
list(APPEND _debug_flags_C ${_flags})
|
||||
list(APPEND _debug_flags_CXX ${_flags})
|
||||
endif ()
|
||||
|
||||
# Check and set compiler flags.
|
||||
set(_debug_configs
|
||||
RelWithDebInfo
|
||||
Debug
|
||||
)
|
||||
foreach(_lang ${languages})
|
||||
_int_enable_warnings_set_flags(_lang ${_flags_${_lang}})
|
||||
_int_enable_warnings_set_flags_ex(_lang _debug_configs ${_debug_flags_${_lang}})
|
||||
|
||||
# Ensure pure Debug builds are NOT optimized (not possible on Visual Studio).
|
||||
# Any optimization of a Debug build will prevent debuggers like lldb from
|
||||
# fully displaying backtraces and stepping.
|
||||
if (NOT MSVC)
|
||||
set(_config Debug)
|
||||
_int_enable_warnings_set_flags_ex(_lang _config -O0)
|
||||
endif ()
|
||||
endforeach()
|
||||
|
||||
|
||||
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Helper functions
|
||||
|
||||
|
@ -397,3 +149,289 @@ function(pop_warnings)
|
|||
set(CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS}" PARENT_SCOPE)
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Runs when included automatically
|
||||
|
||||
# internal helper: _int_enable_warnings_set_flags_ex(langs_var configs_var [warnings flags])
|
||||
function(_int_enable_warnings_set_flags_ex langs_var configs_var)
|
||||
if (NOT ARGN)
|
||||
return()
|
||||
endif ()
|
||||
|
||||
if (NOT ${configs_var})
|
||||
set(${configs_var} "NONE")
|
||||
endif ()
|
||||
string(TOUPPER "${${configs_var}}" ${configs_var})
|
||||
|
||||
foreach(_flag ${ARGN})
|
||||
string(MAKE_C_IDENTIFIER "HAVE_${_flag}" varname)
|
||||
|
||||
if ("C" IN_LIST ${langs_var})
|
||||
check_c_compiler_flag(${_flag} ${varname})
|
||||
if (${varname})
|
||||
foreach (config IN LISTS ${configs_var})
|
||||
if (config STREQUAL "NONE")
|
||||
set(config)
|
||||
else ()
|
||||
set(config "_${config}")
|
||||
endif ()
|
||||
string(APPEND CMAKE_C_FLAGS${config} " ${_flag}")
|
||||
endforeach ()
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if ("CXX" IN_LIST ${langs_var})
|
||||
string(APPEND varname "_CXX")
|
||||
check_cxx_compiler_flag(${_flag} ${varname})
|
||||
if (${varname})
|
||||
foreach (config IN LISTS ${configs_var})
|
||||
if (config STREQUAL "NONE")
|
||||
set(config)
|
||||
else ()
|
||||
set(config "_${config}")
|
||||
endif ()
|
||||
string(APPEND CMAKE_CXX_FLAGS${config} " ${_flag}")
|
||||
endforeach ()
|
||||
endif ()
|
||||
endif ()
|
||||
endforeach()
|
||||
|
||||
foreach(lang C CXX)
|
||||
foreach (config IN LISTS ${configs_var})
|
||||
string(TOUPPER "${config}" config)
|
||||
if (config STREQUAL "NONE")
|
||||
set(config)
|
||||
else ()
|
||||
set(config "_${config}")
|
||||
endif ()
|
||||
string(STRIP "${CMAKE_${lang}_FLAGS${config}}" CMAKE_${lang}_FLAGS${config})
|
||||
set(CMAKE_${lang}_FLAGS${config} "${CMAKE_${lang}_FLAGS${config}}" PARENT_SCOPE)
|
||||
endforeach ()
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
# internal helper: _int_enable_warnings_set_flags(langs_var [warnings flags])
|
||||
macro(_int_enable_warnings_set_flags langs_var)
|
||||
set(configs "NONE")
|
||||
_int_enable_warnings_set_flags_ex(${langs_var} configs ${ARGN})
|
||||
endmacro()
|
||||
|
||||
set(_flags_C)
|
||||
set(_flags_CXX)
|
||||
set(_debug_flags_C)
|
||||
set(_debug_flags_CXX)
|
||||
|
||||
if (MSVC)
|
||||
# Don't automatically set /W3
|
||||
CMAKE_POLICY (SET CMP0092 NEW)
|
||||
|
||||
# Visual Studio uses a completely different nomenclature for warnings than gcc/mingw/clang, so none of the
|
||||
# "-W[name]" warnings will work.
|
||||
|
||||
set(_flags
|
||||
# Enable warnings
|
||||
/W4 # Baseline reasonable warnings
|
||||
/w14242 # 'identifier': conversion from 'type1' to 'type2', possible loss of data
|
||||
/w14254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data
|
||||
/w14263 # 'function': member function does not override any base class virtual member function
|
||||
/w14265 # 'classname': class has virtual functions, but destructor is not virtual instances of this class may
|
||||
# not be destructed correctly
|
||||
/w14287 # 'operator': unsigned/negative constant mismatch
|
||||
/we4289 # nonstandard extension used: 'variable': loop control variable declared in the for-loop is used outside
|
||||
# the for-loop scope
|
||||
/w14296 # 'operator': expression is always 'boolean_value'
|
||||
/w14311 # 'variable': pointer truncation from 'type1' to 'type2'
|
||||
/w14545 # expression before comma evaluates to a function which is missing an argument list
|
||||
/w14546 # function call before comma missing argument list
|
||||
/w14547 # 'operator': operator before comma has no effect; expected operator with side-effect
|
||||
/w14549 # 'operator': operator before comma has no effect; did you intend 'operator'?
|
||||
/w14555 # expression has no effect; expected expression with side- effect
|
||||
/w14619 # pragma warning: there is no warning number 'number'
|
||||
/w14640 # Enable warning on thread un-safe static member initialization
|
||||
/w14826 # Conversion from 'type1' to 'type2' is sign-extended. This may cause unexpected runtime behavior.
|
||||
/w14905 # wide string literal cast to 'LPSTR'
|
||||
/w14906 # string literal cast to 'LPWSTR'
|
||||
/w14928 # illegal copy-initialization; more than one user-defined conversion has been implicitly applied
|
||||
|
||||
# Disable some warnings
|
||||
/wd4201 # nonstandard extension used: nameless struct/union. Used in some windows headers, e.g. IO_STATUS_BLOCK,
|
||||
# disable.
|
||||
|
||||
# Turn some warnings into errors
|
||||
/we4013 # Treat "function undefined, assuming extern returning int" warning as an error. https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-3-c4013
|
||||
)
|
||||
|
||||
list(APPEND _flags_C ${_flags})
|
||||
list(APPEND _flags_CXX ${_flags})
|
||||
|
||||
elseif (CMAKE_C_COMPILER_ID MATCHES "Intel")
|
||||
# Intel's compiler warning flags are more like Visual Studio than GCC, though the numbers aren't the same.
|
||||
set(_flags
|
||||
# Use warning level 3, quite wordy.
|
||||
-w3
|
||||
# Disable warnings we don't care about (add more as they are encountered).
|
||||
-wd383 # Spammy warning about initializing from a temporary object in C++ (which is done all the time ...).
|
||||
-wd11074 # Diagnostic related to inlining.
|
||||
-wd11076 # Diagnostic related to inlining.
|
||||
)
|
||||
|
||||
list(APPEND _flags_C ${_flags})
|
||||
list(APPEND _flags_CXX ${_flags})
|
||||
|
||||
elseif (CMAKE_C_COMPILER_ID MATCHES "XL")
|
||||
set (_flags
|
||||
-qwarn64
|
||||
-qformat=all
|
||||
-qflag=i:i
|
||||
)
|
||||
list(APPEND _flags_C ${_flags})
|
||||
list(APPEND _flags_CXX ${_flags})
|
||||
|
||||
else ()
|
||||
# If we're compiling with GCC / Clang / MinGW (or anything else besides Visual Studio or Intel):
|
||||
# C Flags:
|
||||
list(APPEND _flags_C
|
||||
-Wall
|
||||
-Wextra
|
||||
|
||||
# Enable additional warnings not covered by Wall and Wextra.
|
||||
-Waggregate-return
|
||||
-Wcast-align
|
||||
-Wcast-qual
|
||||
-Wconversion
|
||||
-Wdeclaration-after-statement
|
||||
-Wdouble-promotion
|
||||
-Wfloat-equal
|
||||
-Wformat-security
|
||||
-Winit-self
|
||||
-Wjump-misses-init
|
||||
-Wlogical-op
|
||||
-Wmissing-braces
|
||||
-Wmissing-declarations
|
||||
-Wmissing-format-attribute
|
||||
-Wmissing-include-dirs
|
||||
-Wmissing-prototypes
|
||||
-Wnested-externs
|
||||
-Wno-coverage-mismatch
|
||||
-Wold-style-definition
|
||||
-Wpacked
|
||||
-Wpedantic
|
||||
-Wpointer-arith
|
||||
-Wredundant-decls
|
||||
-Wshadow
|
||||
-Wsign-conversion
|
||||
-Wstrict-overflow
|
||||
-Wstrict-prototypes
|
||||
-Wtrampolines
|
||||
-Wundef
|
||||
-Wunreachable-code
|
||||
-Wunused
|
||||
-Wvariadic-macros
|
||||
-Wvla
|
||||
-Wwrite-strings
|
||||
|
||||
# On Windows MinGW I think implicit fallthrough enabled by -Wextra must not default to 3
|
||||
-Wimplicit-fallthrough=3
|
||||
|
||||
# Treat implicit variable typing and implicit function declarations as errors.
|
||||
-Werror=implicit-int
|
||||
-Werror=implicit-function-declaration
|
||||
|
||||
# Make MacOSX honor -mmacosx-version-min
|
||||
-Werror=partial-availability
|
||||
|
||||
# Some clang versions might warn if an argument like "-I/path/to/headers" is unused,
|
||||
# silence these.
|
||||
-Qunused-arguments
|
||||
|
||||
-Wno-long-long
|
||||
)
|
||||
|
||||
# C++ flags:
|
||||
list(APPEND _flags_CXX
|
||||
-Wall
|
||||
-Wextra
|
||||
|
||||
# Enable additional warnings not covered by Wall and Wextra.
|
||||
-Wcast-align
|
||||
-Wformat-security
|
||||
-Wmissing-declarations
|
||||
-Wmissing-format-attribute
|
||||
-Wpacked-bitfield-compat
|
||||
-Wredundant-decls
|
||||
-Wvla
|
||||
|
||||
# Turn off unused parameter warnings with C++ (they happen often in C++ and Qt).
|
||||
-Wno-unused-parameter
|
||||
|
||||
# Some clang versions might warn if an argument like "-I/path/to/headers" is unused,
|
||||
# silence these.
|
||||
-Qunused-arguments
|
||||
)
|
||||
|
||||
# Note: when cross-compiling to Windows from Cygwin, the Qt Mingw packages have a bunch of
|
||||
# noisy type-conversion warnings in headers. So, only enable those warnings if we're
|
||||
# not building that configuration.
|
||||
if (NOT (WIN32 AND (CMAKE_HOST_SYSTEM_NAME MATCHES "CYGWIN")))
|
||||
list(APPEND _flags_CXX
|
||||
-Wconversion
|
||||
-Wfloat-equal
|
||||
-Wsign-conversion
|
||||
)
|
||||
endif ()
|
||||
|
||||
# Add flags to force colored output even when output is redirected via pipe.
|
||||
if (CMAKE_GENERATOR MATCHES "Ninja")
|
||||
set(color_default TRUE)
|
||||
else ()
|
||||
set(color_default FALSE)
|
||||
endif ()
|
||||
option(FORCE_COLOR "Force compiler to always colorize, even when output is redirected." ${color_default})
|
||||
mark_as_advanced(FORCE FORCE_COLOR)
|
||||
if (FORCE_COLOR)
|
||||
set(_flags
|
||||
-fdiagnostics-color=always # GCC
|
||||
-fcolor-diagnostics # Clang
|
||||
)
|
||||
list(APPEND _flags_C ${_flags})
|
||||
list(APPEND _flags_CXX ${_flags})
|
||||
endif ()
|
||||
|
||||
# Add -fno-omit-frame-pointer (and optionally -fno-inline) to make debugging and stack dumps nicer.
|
||||
set(_flags
|
||||
-fno-omit-frame-pointer
|
||||
)
|
||||
option(M_NO_INLINE "Disable function inlining for RelWithDebInfo and Debug configurations?" FALSE)
|
||||
if (M_NO_INLINE)
|
||||
list(APPEND _flags
|
||||
-fno-inline
|
||||
)
|
||||
endif ()
|
||||
list(APPEND _debug_flags_C ${_flags})
|
||||
list(APPEND _debug_flags_CXX ${_flags})
|
||||
endif ()
|
||||
|
||||
# Check and set compiler flags.
|
||||
set(_debug_configs
|
||||
RelWithDebInfo
|
||||
Debug
|
||||
)
|
||||
foreach(_lang ${languages})
|
||||
_int_enable_warnings_set_flags(_lang ${_flags_${_lang}})
|
||||
_int_enable_warnings_set_flags_ex(_lang _debug_configs ${_debug_flags_${_lang}})
|
||||
|
||||
# Ensure pure Debug builds are NOT optimized (not possible on Visual Studio).
|
||||
# Any optimization of a Debug build will prevent debuggers like lldb from
|
||||
# fully displaying backtraces and stepping.
|
||||
if (NOT MSVC)
|
||||
set(_config Debug)
|
||||
_int_enable_warnings_set_flags_ex(_lang _config -O0)
|
||||
endif ()
|
||||
endforeach()
|
||||
|
||||
# CMP0092 doesn't appear to really work, really remove the /W3 here.
|
||||
if (MSVC)
|
||||
remove_warnings(/W3)
|
||||
endif ()
|
||||
|
|
71
deps/cares/configure
vendored
71
deps/cares/configure
vendored
|
@ -1,6 +1,6 @@
|
|||
#! /bin/sh
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.72 for c-ares 1.31.0.
|
||||
# Generated by GNU Autoconf 2.72 for c-ares 1.32.0.
|
||||
#
|
||||
# Report bugs to <c-ares mailing list: http://lists.haxx.se/listinfo/c-ares>.
|
||||
#
|
||||
|
@ -614,8 +614,8 @@ MAKEFLAGS=
|
|||
# Identity of this package.
|
||||
PACKAGE_NAME='c-ares'
|
||||
PACKAGE_TARNAME='c-ares'
|
||||
PACKAGE_VERSION='1.31.0'
|
||||
PACKAGE_STRING='c-ares 1.31.0'
|
||||
PACKAGE_VERSION='1.32.0'
|
||||
PACKAGE_STRING='c-ares 1.32.0'
|
||||
PACKAGE_BUGREPORT='c-ares mailing list: http://lists.haxx.se/listinfo/c-ares'
|
||||
PACKAGE_URL=''
|
||||
|
||||
|
@ -1415,7 +1415,7 @@ if test "$ac_init_help" = "long"; then
|
|||
# Omit some internal or obsolete options to make the list less imposing.
|
||||
# This message is too long to be a string in the A/UX 3.1 sh.
|
||||
cat <<_ACEOF
|
||||
'configure' configures c-ares 1.31.0 to adapt to many kinds of systems.
|
||||
'configure' configures c-ares 1.32.0 to adapt to many kinds of systems.
|
||||
|
||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||
|
||||
|
@ -1486,7 +1486,7 @@ fi
|
|||
|
||||
if test -n "$ac_init_help"; then
|
||||
case $ac_init_help in
|
||||
short | recursive ) echo "Configuration of c-ares 1.31.0:";;
|
||||
short | recursive ) echo "Configuration of c-ares 1.32.0:";;
|
||||
esac
|
||||
cat <<\_ACEOF
|
||||
|
||||
|
@ -1623,7 +1623,7 @@ fi
|
|||
test -n "$ac_init_help" && exit $ac_status
|
||||
if $ac_init_version; then
|
||||
cat <<\_ACEOF
|
||||
c-ares configure 1.31.0
|
||||
c-ares configure 1.32.0
|
||||
generated by GNU Autoconf 2.72
|
||||
|
||||
Copyright (C) 2023 Free Software Foundation, Inc.
|
||||
|
@ -2267,7 +2267,7 @@ cat >config.log <<_ACEOF
|
|||
This file contains any messages produced by compilers while
|
||||
running configure, to aid debugging if configure makes a mistake.
|
||||
|
||||
It was created by c-ares $as_me 1.31.0, which was
|
||||
It was created by c-ares $as_me 1.32.0, which was
|
||||
generated by GNU Autoconf 2.72. Invocation command line was
|
||||
|
||||
$ $0$ac_configure_args_raw
|
||||
|
@ -3259,7 +3259,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
|||
|
||||
|
||||
|
||||
CARES_VERSION_INFO="18:0:16"
|
||||
CARES_VERSION_INFO="19:0:17"
|
||||
|
||||
|
||||
|
||||
|
@ -5999,7 +5999,7 @@ fi
|
|||
|
||||
# Define the identity of the package.
|
||||
PACKAGE='c-ares'
|
||||
VERSION='1.31.0'
|
||||
VERSION='1.32.0'
|
||||
|
||||
|
||||
printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h
|
||||
|
@ -20682,42 +20682,7 @@ fi
|
|||
if test "$enable_warnings" = "yes"; then
|
||||
|
||||
|
||||
for flag in -Wall \
|
||||
-Wextra \
|
||||
-Wcast-align \
|
||||
-Wconversion \
|
||||
-Wdeclaration-after-statement \
|
||||
-Wdouble-promotion \
|
||||
-Wfloat-equal \
|
||||
-Wformat-security \
|
||||
-Winit-self \
|
||||
-Wjump-misses-init \
|
||||
-Wlogical-op \
|
||||
-Wmissing-braces \
|
||||
-Wmissing-declarations \
|
||||
-Wmissing-format-attribute \
|
||||
-Wmissing-include-dirs \
|
||||
-Wmissing-prototypes \
|
||||
-Wnested-externs \
|
||||
-Wno-coverage-mismatch \
|
||||
-Wold-style-definition \
|
||||
-Wpacked \
|
||||
-Wpointer-arith \
|
||||
-Wredundant-decls \
|
||||
-Wshadow \
|
||||
-Wsign-conversion \
|
||||
-Wstrict-overflow \
|
||||
-Wstrict-prototypes \
|
||||
-Wtrampolines \
|
||||
-Wundef \
|
||||
-Wunused \
|
||||
-Wvariadic-macros \
|
||||
-Wvla \
|
||||
-Wwrite-strings \
|
||||
-Werror=implicit-int \
|
||||
-Werror=implicit-function-declaration \
|
||||
-Werror=partial-availability \
|
||||
; do
|
||||
for flag in -std=c90 -Wall -Wextra -Waggregate-return -Wcast-align -Wcast-qual -Wconversion -Wdeclaration-after-statement -Wdouble-promotion -Wfloat-equal -Wformat-security -Winit-self -Wjump-misses-init -Wlogical-op -Wmissing-braces -Wmissing-declarations -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-prototypes -Wnested-externs -Wno-coverage-mismatch -Wold-style-definition -Wpacked -Wpedantic -Wpointer-arith -Wredundant-decls -Wshadow -Wsign-conversion -Wstrict-overflow -Wstrict-prototypes -Wtrampolines -Wundef -Wunreachable-code -Wunused -Wvariadic-macros -Wvla -Wwrite-strings -Werror=implicit-int -Werror=implicit-function-declaration -Werror=partial-availability -Wno-long-long ; do
|
||||
as_CACHEVAR=`printf "%s\n" "ax_cv_check_cflags_-Werror_$flag" | sed "$as_sed_sh"`
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5
|
||||
printf %s "checking whether C compiler accepts $flag... " >&6; }
|
||||
|
@ -23002,7 +22967,7 @@ recvfrom_type_arg5="struct sockaddr *"
|
|||
recv_type_arg4=int
|
||||
getnameinfo_type_arg1="struct sockaddr *"
|
||||
getnameinfo_type_arg7=int
|
||||
send_type_arg2="void *"
|
||||
send_type_arg2="const void *"
|
||||
send_type_arg4=int
|
||||
|
||||
|
||||
|
@ -23053,9 +23018,6 @@ printf "%s\n" "#define SEND_TYPE_ARG1 ${send_type_arg1} " >>confdefs.h
|
|||
printf "%s\n" "#define SEND_TYPE_ARG2 ${send_type_arg2} " >>confdefs.h
|
||||
|
||||
|
||||
printf "%s\n" "#define SEND_QUAL_ARG2 " >>confdefs.h
|
||||
|
||||
|
||||
printf "%s\n" "#define SEND_TYPE_ARG3 ${send_type_arg3} " >>confdefs.h
|
||||
|
||||
|
||||
|
@ -23286,6 +23248,13 @@ cat >>confdefs.h <<_EOF
|
|||
#define CARES_HAVE_SYS_SOCKET_H 1
|
||||
_EOF
|
||||
|
||||
fi
|
||||
if test "x$ac_cv_header_sys_select_h" = "xyes" ; then
|
||||
|
||||
cat >>confdefs.h <<_EOF
|
||||
#define CARES_HAVE_SYS_SELECT_H 1
|
||||
_EOF
|
||||
|
||||
fi
|
||||
if test "x$ac_cv_header_ws2tcpip_h" = "xyes" ; then
|
||||
|
||||
|
@ -26370,7 +26339,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
|
|||
# report actual input values of CONFIG_FILES etc. instead of their
|
||||
# values after options handling.
|
||||
ac_log="
|
||||
This file was extended by c-ares $as_me 1.31.0, which was
|
||||
This file was extended by c-ares $as_me 1.32.0, which was
|
||||
generated by GNU Autoconf 2.72. Invocation command line was
|
||||
|
||||
CONFIG_FILES = $CONFIG_FILES
|
||||
|
@ -26438,7 +26407,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
|
|||
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
||||
ac_cs_config='$ac_cs_config_escaped'
|
||||
ac_cs_version="\\
|
||||
c-ares config.status 1.31.0
|
||||
c-ares config.status 1.32.0
|
||||
configured by $0, generated by GNU Autoconf 2.72,
|
||||
with options \\"\$ac_cs_config\\"
|
||||
|
||||
|
|
112
deps/cares/configure.ac
vendored
112
deps/cares/configure.ac
vendored
|
@ -2,10 +2,10 @@ dnl Copyright (C) The c-ares project and its contributors
|
|||
dnl SPDX-License-Identifier: MIT
|
||||
AC_PREREQ([2.69])
|
||||
|
||||
AC_INIT([c-ares], [1.31.0],
|
||||
AC_INIT([c-ares], [1.32.0],
|
||||
[c-ares mailing list: http://lists.haxx.se/listinfo/c-ares])
|
||||
|
||||
CARES_VERSION_INFO="18:0:16"
|
||||
CARES_VERSION_INFO="19:0:17"
|
||||
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.
|
||||
|
@ -245,42 +245,8 @@ AC_SUBST(CARES_SYMBOL_HIDING_CFLAG)
|
|||
|
||||
|
||||
if test "$enable_warnings" = "yes"; then
|
||||
AX_APPEND_COMPILE_FLAGS([-Wall \
|
||||
-Wextra \
|
||||
-Wcast-align \
|
||||
-Wconversion \
|
||||
-Wdeclaration-after-statement \
|
||||
-Wdouble-promotion \
|
||||
-Wfloat-equal \
|
||||
-Wformat-security \
|
||||
-Winit-self \
|
||||
-Wjump-misses-init \
|
||||
-Wlogical-op \
|
||||
-Wmissing-braces \
|
||||
-Wmissing-declarations \
|
||||
-Wmissing-format-attribute \
|
||||
-Wmissing-include-dirs \
|
||||
-Wmissing-prototypes \
|
||||
-Wnested-externs \
|
||||
-Wno-coverage-mismatch \
|
||||
-Wold-style-definition \
|
||||
-Wpacked \
|
||||
-Wpointer-arith \
|
||||
-Wredundant-decls \
|
||||
-Wshadow \
|
||||
-Wsign-conversion \
|
||||
-Wstrict-overflow \
|
||||
-Wstrict-prototypes \
|
||||
-Wtrampolines \
|
||||
-Wundef \
|
||||
-Wunused \
|
||||
-Wvariadic-macros \
|
||||
-Wvla \
|
||||
-Wwrite-strings \
|
||||
-Werror=implicit-int \
|
||||
-Werror=implicit-function-declaration \
|
||||
-Werror=partial-availability \
|
||||
], [AM_CFLAGS], [-Werror])
|
||||
AX_APPEND_COMPILE_FLAGS([-std=c90 -Wall -Wextra -Waggregate-return -Wcast-align -Wcast-qual -Wconversion -Wdeclaration-after-statement -Wdouble-promotion -Wfloat-equal -Wformat-security -Winit-self -Wjump-misses-init -Wlogical-op -Wmissing-braces -Wmissing-declarations -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-prototypes -Wnested-externs -Wno-coverage-mismatch -Wold-style-definition -Wpacked -Wpedantic -Wpointer-arith -Wredundant-decls -Wshadow -Wsign-conversion -Wstrict-overflow -Wstrict-prototypes -Wtrampolines -Wundef -Wunreachable-code -Wunused -Wvariadic-macros -Wvla -Wwrite-strings -Werror=implicit-int -Werror=implicit-function-declaration -Werror=partial-availability -Wno-long-long ],
|
||||
[AM_CFLAGS], [-Werror])
|
||||
fi
|
||||
|
||||
if test "$ax_cv_c_compiler_vendor" = "intel"; then
|
||||
|
@ -294,17 +260,7 @@ if test "$ac_cv_native_windows" = "yes" ; then
|
|||
dnl other headers, AC_CHECK_HEADERS only allows you to specify headers that
|
||||
dnl must be included *before* the header being checked.
|
||||
|
||||
AC_CHECK_HEADERS(
|
||||
windows.h \
|
||||
winsock2.h \
|
||||
ws2tcpip.h \
|
||||
iphlpapi.h \
|
||||
netioapi.h \
|
||||
ws2ipdef.h \
|
||||
winternl.h \
|
||||
ntdef.h \
|
||||
ntstatus.h \
|
||||
mswsock.h,
|
||||
AC_CHECK_HEADERS([windows.h winsock2.h ws2tcpip.h iphlpapi.h netioapi.h ws2ipdef.h winternl.h ntdef.h ntstatus.h mswsock.h ],
|
||||
[], [], [-])
|
||||
|
||||
dnl Windows builds require linking to iphlpapi
|
||||
|
@ -406,42 +362,10 @@ AS_HELP_STRING([--enable-libgcc],[use libgcc when linking]),
|
|||
AC_MSG_RESULT(no)
|
||||
)
|
||||
|
||||
dnl check for a few basic system headers we need
|
||||
AC_CHECK_HEADERS(
|
||||
malloc.h \
|
||||
memory.h \
|
||||
AvailabilityMacros.h \
|
||||
sys/types.h \
|
||||
sys/time.h \
|
||||
sys/select.h \
|
||||
sys/socket.h \
|
||||
sys/filio.h \
|
||||
sys/ioctl.h \
|
||||
sys/param.h \
|
||||
sys/uio.h \
|
||||
sys/random.h \
|
||||
sys/event.h \
|
||||
sys/epoll.h \
|
||||
assert.h \
|
||||
iphlpapi.h \
|
||||
netioapi.h \
|
||||
netdb.h \
|
||||
netinet/in.h \
|
||||
netinet6/in6.h \
|
||||
netinet/tcp.h \
|
||||
net/if.h \
|
||||
ifaddrs.h \
|
||||
fcntl.h \
|
||||
errno.h \
|
||||
socket.h \
|
||||
strings.h \
|
||||
stdbool.h \
|
||||
time.h \
|
||||
poll.h \
|
||||
limits.h \
|
||||
arpa/nameser.h \
|
||||
arpa/nameser_compat.h \
|
||||
arpa/inet.h,
|
||||
dnl check for a few basic system headers we need. It would be nice if we could
|
||||
dnl split these on separate lines, but for some reason autotools on Windows doesn't
|
||||
dnl allow this, even tried ending lines with a backslash.
|
||||
AC_CHECK_HEADERS([malloc.h memory.h AvailabilityMacros.h sys/types.h sys/time.h sys/select.h sys/socket.h sys/filio.h sys/ioctl.h sys/param.h sys/uio.h sys/random.h sys/event.h sys/epoll.h assert.h iphlpapi.h netioapi.h netdb.h netinet/in.h netinet6/in6.h netinet/tcp.h net/if.h ifaddrs.h fcntl.h errno.h socket.h strings.h stdbool.h time.h poll.h limits.h arpa/nameser.h arpa/nameser_compat.h arpa/inet.h ],
|
||||
dnl to do if not found
|
||||
[],
|
||||
dnl to do if found
|
||||
|
@ -705,7 +629,7 @@ recvfrom_type_arg5="struct sockaddr *"
|
|||
recv_type_arg4=int
|
||||
getnameinfo_type_arg1="struct sockaddr *"
|
||||
getnameinfo_type_arg7=int
|
||||
send_type_arg2="void *"
|
||||
send_type_arg2="const void *"
|
||||
send_type_arg4=int
|
||||
|
||||
AC_DEFINE_UNQUOTED([RECVFROM_TYPE_RETV], [ ${recvfrom_type_retv} ], [ recvfrom() return value ])
|
||||
|
@ -725,7 +649,6 @@ AC_DEFINE_UNQUOTED([RECV_TYPE_ARG4], [ ${recv_type_arg4} ], [ re
|
|||
AC_DEFINE_UNQUOTED([SEND_TYPE_RETV], [ ${send_type_retv} ], [ send() return value ])
|
||||
AC_DEFINE_UNQUOTED([SEND_TYPE_ARG1], [ ${send_type_arg1} ], [ send() arg1 type ])
|
||||
AC_DEFINE_UNQUOTED([SEND_TYPE_ARG2], [ ${send_type_arg2} ], [ send() arg2 type ])
|
||||
AC_DEFINE_UNQUOTED([SEND_QUAL_ARG2], [ ], [ send() arg2 qualifier ])
|
||||
AC_DEFINE_UNQUOTED([SEND_TYPE_ARG3], [ ${send_type_arg3} ], [ send() arg3 type ])
|
||||
AC_DEFINE_UNQUOTED([SEND_TYPE_ARG4], [ ${send_type_arg4} ], [ send() arg4 type ])
|
||||
|
||||
|
@ -808,6 +731,9 @@ fi
|
|||
if test "x$ac_cv_header_sys_socket_h" = "xyes" ; then
|
||||
CARES_DEFINE_UNQUOTED([CARES_HAVE_SYS_SOCKET_H],[1])
|
||||
fi
|
||||
if test "x$ac_cv_header_sys_select_h" = "xyes" ; then
|
||||
CARES_DEFINE_UNQUOTED([CARES_HAVE_SYS_SELECT_H],[1])
|
||||
fi
|
||||
if test "x$ac_cv_header_ws2tcpip_h" = "xyes" ; then
|
||||
CARES_DEFINE_UNQUOTED([CARES_HAVE_WS2TCPIP_H],[1])
|
||||
fi
|
||||
|
@ -902,12 +828,12 @@ AC_SUBST(AM_CPPFLAGS)
|
|||
AC_SUBST(PKGCONFIG_CFLAGS)
|
||||
AC_SUBST(BUILD_SUBDIRS)
|
||||
|
||||
AC_CONFIG_FILES([Makefile \
|
||||
include/Makefile \
|
||||
src/Makefile \
|
||||
src/lib/Makefile \
|
||||
src/tools/Makefile \
|
||||
docs/Makefile \
|
||||
AC_CONFIG_FILES([Makefile
|
||||
include/Makefile
|
||||
src/Makefile
|
||||
src/lib/Makefile
|
||||
src/tools/Makefile
|
||||
docs/Makefile
|
||||
libcares.pc ])
|
||||
AM_COND_IF([BUILD_TESTS],
|
||||
[AC_CONFIG_FILES([test/Makefile])])
|
||||
|
|
4
deps/cares/docs/Makefile.in
vendored
4
deps/cares/docs/Makefile.in
vendored
|
@ -378,6 +378,10 @@ MANPAGES = ares_cancel.3 \
|
|||
ares_dns_rec_type_tostr.3 \
|
||||
ares_dns_rec_type_t.3 \
|
||||
ares_dns_rr.3 \
|
||||
ares_dns_rr_add_abin.3 \
|
||||
ares_dns_rr_del_abin.3 \
|
||||
ares_dns_rr_get_abin.3 \
|
||||
ares_dns_rr_get_abin_cnt.3 \
|
||||
ares_dns_rr_get_addr.3 \
|
||||
ares_dns_rr_get_addr6.3 \
|
||||
ares_dns_rr_get_bin.3 \
|
||||
|
|
4
deps/cares/docs/Makefile.inc
vendored
4
deps/cares/docs/Makefile.inc
vendored
|
@ -40,6 +40,10 @@ MANPAGES = ares_cancel.3 \
|
|||
ares_dns_rec_type_tostr.3 \
|
||||
ares_dns_rec_type_t.3 \
|
||||
ares_dns_rr.3 \
|
||||
ares_dns_rr_add_abin.3 \
|
||||
ares_dns_rr_del_abin.3 \
|
||||
ares_dns_rr_get_abin.3 \
|
||||
ares_dns_rr_get_abin_cnt.3 \
|
||||
ares_dns_rr_get_addr.3 \
|
||||
ares_dns_rr_get_addr6.3 \
|
||||
ares_dns_rr_get_bin.3 \
|
||||
|
|
7
deps/cares/docs/ares_dns_mapping.3
vendored
7
deps/cares/docs/ares_dns_mapping.3
vendored
|
@ -89,6 +89,13 @@ set and \fIares_dns_rr_get_bin(3)\fP to get.
|
|||
- Array of options. 16bit identifier, Binary data. Use \fIares_dns_rr_set_opt(3)\fP to
|
||||
set and \fIares_dns_rr_get_opt(3)\fP to get.
|
||||
.br
|
||||
.B ARES_DATATYPE_ABINP
|
||||
- Array of binary data, but likely printable. Guaranteed to have a NULL terminator
|
||||
for convenience (not included in length). Use \fIares_dns_rr_add_abin(3)\fP to
|
||||
set and \fIares_dns_rr_get_abin(3)\fP to get. Can also use
|
||||
\fIares_dns_rr_set_bin(3)\fP and \fIares_dns_rr_get_bin(3)\fP if only concatenated
|
||||
strings are desired.
|
||||
.br
|
||||
.RE
|
||||
|
||||
.B ares_dns_opt_datatype_t -
|
||||
|
|
78
deps/cares/docs/ares_dns_rr.3
vendored
78
deps/cares/docs/ares_dns_rr.3
vendored
|
@ -5,12 +5,14 @@
|
|||
.SH NAME
|
||||
ares_dns_record_rr_add, ares_dns_record_rr_cnt, ares_dns_record_rr_del,
|
||||
ares_dns_record_rr_get, ares_dns_record_rr_get_const, ares_dns_rr_get_addr,
|
||||
ares_dns_rr_get_addr6, ares_dns_rr_get_bin, ares_dns_rr_get_class,
|
||||
ares_dns_rr_get_addr6, ares_dns_rr_get_bin, ares_dns_rr_get_abin_cnt,
|
||||
ares_dns_rr_get_abin, ares_dns_rr_get_class,
|
||||
ares_dns_rr_get_name, ares_dns_rr_get_opt, ares_dns_rr_get_opt_byid,
|
||||
ares_dns_rr_get_opt_cnt, ares_dns_rr_get_str, ares_dns_rr_get_ttl,
|
||||
ares_dns_rr_get_type, ares_dns_rr_get_u16, ares_dns_rr_get_u32,
|
||||
ares_dns_rr_get_u8, ares_dns_rr_key_t, ares_dns_rr_set_addr,
|
||||
ares_dns_rr_set_addr6, ares_dns_rr_set_bin, ares_dns_rr_set_opt,
|
||||
ares_dns_rr_set_addr6, ares_dns_rr_set_bin, ares_dns_rr_add_abin,
|
||||
ares_dns_rr_del_abin, ares_dns_rr_set_opt,
|
||||
ares_dns_rr_set_str, ares_dns_rr_set_u16, ares_dns_rr_set_u32,
|
||||
ares_dns_rr_set_u8, ares_dns_section_t, ares_tlsa_match_t,
|
||||
ares_tlsa_selector_t, ares_tlsa_usage_t \-
|
||||
|
@ -79,6 +81,15 @@ ares_status_t ares_dns_rr_set_bin(ares_dns_rr_t *dns_rr,
|
|||
const unsigned char *val,
|
||||
size_t len);
|
||||
|
||||
ares_status_t ares_dns_rr_add_abin(ares_dns_rr_t *dns_rr,
|
||||
ares_dns_rr_key_t key,
|
||||
const unsigned char *val,
|
||||
size_t len);
|
||||
|
||||
ares_status_t ares_dns_rr_del_abin(ares_dns_rr_t *dns_rr,
|
||||
ares_dns_rr_key_t key,
|
||||
size_t idx);
|
||||
|
||||
ares_status_t ares_dns_rr_set_opt(ares_dns_rr_t *dns_rr,
|
||||
ares_dns_rr_key_t key,
|
||||
unsigned short opt,
|
||||
|
@ -107,6 +118,13 @@ const unsigned char *ares_dns_rr_get_bin(const ares_dns_rr_t *dns_rr,
|
|||
ares_dns_rr_key_t key,
|
||||
size_t *len);
|
||||
|
||||
size_t ares_dns_rr_get_abin_cnt(const ares_dns_rr_t *dns_rr,
|
||||
ares_dns_rr_key_t key);
|
||||
|
||||
const unsigned char *ares_dns_rr_get_abin(const ares_dns_rr_t *dns_rr,
|
||||
ares_dns_rr_key_t key, size_t idx,
|
||||
size_t *len);
|
||||
|
||||
size_t ares_dns_rr_get_opt_cnt(const ares_dns_rr_t *dns_rr,
|
||||
ares_dns_rr_key_t key);
|
||||
|
||||
|
@ -188,7 +206,7 @@ Keys used for handling RR record parameters:
|
|||
- MX Record. Exchange, domain. Datatype: \fIARES_DATATYPE_NAME\fP
|
||||
.br
|
||||
.B ARES_RR_TXT_DATA
|
||||
- TXT Record. Data. Datatype: \fIARES_DATATYPE_BINP\fP
|
||||
- TXT Record. Data. Datatype: \fIARES_DATATYPE_ABINP\fP
|
||||
.br
|
||||
.B ARES_RR_SIG_TYPE_COVERED
|
||||
- SIG Record. Type Covered. Datatype: \fIARES_DATATYPE_U16\fP
|
||||
|
@ -497,7 +515,7 @@ parameter, and the value is provided in the
|
|||
.IR val
|
||||
parameter.
|
||||
|
||||
The \fIares_dns_rr_set_bin(3)\fP function is used to set an binary value for the
|
||||
The \fIares_dns_rr_set_bin(3)\fP function is used to set a binary value for the
|
||||
associated resource record key/parameter when the datatype is \fIARES_DATATYPE_BIN\fP
|
||||
or \fIARES_DATATYPE_BINP\fP.
|
||||
The resource record to be modified is provided in the
|
||||
|
@ -510,6 +528,30 @@ parameter. And the associated value length is provided in the
|
|||
.IR len
|
||||
parameter.
|
||||
|
||||
The \fIares_dns_rr_add_abin(3)\fP function is used to append a binary value in
|
||||
the array for the associated resource record key/parameter when the datatype
|
||||
is \fIARES_DATATYPE_ABINP\fP.
|
||||
The resource record to be modified is provided in the
|
||||
.IR dns_rr
|
||||
parameter, the key/parameter is provided in the
|
||||
.IR key
|
||||
parameter, and the value is provided in the
|
||||
.IR val
|
||||
parameter. And the associated value length is provided in the
|
||||
.IR len
|
||||
parameter.
|
||||
|
||||
The \fIares_dns_rr_del_abin(3)\fP function is used to delete a binary value in
|
||||
the array for the associated resource record key/parameter when the datatype
|
||||
is \fIARES_DATATYPE_ABINP\fP.
|
||||
The resource record to be modified is provided in the
|
||||
.IR dns_rr
|
||||
parameter, the key/parameter is provided in the
|
||||
.IR key
|
||||
parameter, and the index to remove is provided in the
|
||||
.IR idx
|
||||
parameter.
|
||||
|
||||
The \fIares_dns_rr_set_opt(3)\fP function is used to set option/parameter keys and
|
||||
values for the resource record when the datatype if \fIARES_DATATYPE_OPT\fP. The
|
||||
resource record to be modified is provided in the
|
||||
|
@ -584,6 +626,26 @@ parameter and the key/parameter to retrieve is provided in the
|
|||
parameter, and length is stored into the variable pointed to by
|
||||
.IR len.
|
||||
|
||||
The \fIares_dns_rr_get_abin_cnt(3)\fP function is used to retrieve the count
|
||||
of the array of stored binary values from the resource record when the datatype
|
||||
is \fIARES_DATATYPE_ABINP\fP.
|
||||
The resource record is provided in the
|
||||
.IR dns_rr
|
||||
parameter and the key/parameter to retrieve is provided in the
|
||||
.IR key
|
||||
parameter.
|
||||
|
||||
The \fIares_dns_rr_get_abin(3)\fP function is used to retrive binary data from
|
||||
the resource record array when the datatype is \fIARES_DATATYPE_ABINP\fP.
|
||||
The resource record is provided in the
|
||||
.IR dns_rr
|
||||
parameter and the key/parameter to retrieve is provided in the
|
||||
.IR key
|
||||
parameter, and the index to retrieve from the array is provided by the
|
||||
.IR idx
|
||||
parameter, and length is stored into the variable pointed to by
|
||||
.IR len.
|
||||
|
||||
The \fIares_dns_rr_get_opt_cnt(3)\fP function is used to retrieve the count
|
||||
of options/parameters associated with the resource record when the datatype
|
||||
is \fIARES_DATATYPE_OPT\fP.
|
||||
|
@ -630,8 +692,9 @@ respective counts.
|
|||
\fIares_dns_rr_set_addr(3)\fP, \fIares_dns_rr_set_addr6(3)\fP,
|
||||
\fIares_dns_rr_set_str(3)\fP, \fIares_dns_rr_set_u8(3)\fP,
|
||||
\fIares_dns_rr_set_u16(3)\fP, \fIares_dns_rr_set_u32(3)\fP,
|
||||
\fIares_dns_rr_set_bin(3)\fP, and \fIares_dns_rr_set_opt(3)\fP all
|
||||
return an \fIares_status_t\fP error code.
|
||||
\fIares_dns_rr_set_bin(3)\fP, \fIares_dns_rr_add_abin(3)\fP,
|
||||
\fIares_dns_rr_del_abin(3)\fP,
|
||||
and \fIares_dns_rr_set_opt(3)\fP all return an \fIares_status_t\fP error code.
|
||||
.B ARES_SUCCESS
|
||||
is returned on success,
|
||||
.B ARES_ENOMEM
|
||||
|
@ -645,7 +708,8 @@ is returned on misuse.
|
|||
\fIares_dns_rr_get_addr(3)\fP, \fIares_dns_rr_get_addr6(3)\fP,
|
||||
\fIares_dns_rr_get_str(3)\fP, \fIares_dns_rr_get_u8(3)\fP,
|
||||
\fIares_dns_rr_get_u16(3)\fP, \fIares_dns_rr_get_u32(3)\fP,
|
||||
\fIares_dns_rr_get_bin(3)\fP, \fIares_dns_rr_get_opt(3)\fP all return their
|
||||
\fIares_dns_rr_get_bin(3)\fP, \fIares_dns_rr_get_abin_cnt(3)\fP,
|
||||
\fIares_dns_rr_get_abin(3)\fP, \fIares_dns_rr_get_opt(3)\fP all return their
|
||||
prescribed datatype values and in general can't fail except for misuse cases,
|
||||
in which a 0 (or NULL) may be returned, however 0 can also be a valid return
|
||||
value for most of these functions.
|
||||
|
|
3
deps/cares/docs/ares_dns_rr_add_abin.3
vendored
Normal file
3
deps/cares/docs/ares_dns_rr_add_abin.3
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
.\" Copyright (C) 2023 The c-ares project and its contributors.
|
||||
.\" SPDX-License-Identifier: MIT
|
||||
.so man3/ares_dns_rr.3
|
3
deps/cares/docs/ares_dns_rr_del_abin.3
vendored
Normal file
3
deps/cares/docs/ares_dns_rr_del_abin.3
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
.\" Copyright (C) 2023 The c-ares project and its contributors.
|
||||
.\" SPDX-License-Identifier: MIT
|
||||
.so man3/ares_dns_rr.3
|
3
deps/cares/docs/ares_dns_rr_get_abin.3
vendored
Normal file
3
deps/cares/docs/ares_dns_rr_get_abin.3
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
.\" Copyright (C) 2023 The c-ares project and its contributors.
|
||||
.\" SPDX-License-Identifier: MIT
|
||||
.so man3/ares_dns_rr.3
|
3
deps/cares/docs/ares_dns_rr_get_abin_cnt.3
vendored
Normal file
3
deps/cares/docs/ares_dns_rr_get_abin_cnt.3
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
.\" Copyright (C) 2023 The c-ares project and its contributors.
|
||||
.\" SPDX-License-Identifier: MIT
|
||||
.so man3/ares_dns_rr.3
|
32
deps/cares/docs/ares_init_options.3
vendored
32
deps/cares/docs/ares_init_options.3
vendored
|
@ -130,27 +130,35 @@ v1.22, this is on by default if flags are otherwise not set.
|
|||
.B ARES_FLAG_NO_DFLT_SVR
|
||||
Do not attempt to add a default local named server if there are no other
|
||||
servers available. Instead, fail initialization with \fIARES_ENOSERVER\fP.
|
||||
.TP 23
|
||||
.B ARES_FLAG_DNS0x20
|
||||
Enable support for DNS 0x20 as per https://datatracker.ietf.org/doc/html/draft-vixie-dnsext-dns0x20-00
|
||||
which adds additional entropy to the request by randomizing the case of the
|
||||
query name. Integrators need to ensure they treat DNS name responses as
|
||||
case-insensitive. In rare circumstances this may cause the inability to lookup
|
||||
certain domains if the upstream server or the authoritative server for the
|
||||
domain is non-compliant.
|
||||
.RE
|
||||
.TP 18
|
||||
.B ARES_OPT_TIMEOUT
|
||||
.B int \fItimeout\fP;
|
||||
.br
|
||||
The number of seconds each name server is given to respond to a query on the
|
||||
first try. (After the first try, the timeout algorithm becomes more
|
||||
complicated, but scales linearly with the value of \fItimeout\fP.) The
|
||||
default is two seconds. This option is being deprecated by
|
||||
\fIARES_OPT_TIMEOUTMS\fP starting in c-ares 1.5.2.
|
||||
first try. See \fIARES_OPT_TIMEOUTMS\fP which this value is converted into.
|
||||
.TP 18
|
||||
.B ARES_OPT_TIMEOUTMS
|
||||
.B int \fItimeout\fP;
|
||||
.br
|
||||
The number of milliseconds each name server is given to respond to a query on
|
||||
the first try. (After the first try, the timeout algorithm becomes more
|
||||
complicated, but scales linearly with the value of \fItimeout\fP.) The
|
||||
default is two seconds. Note that this option is specified with the same
|
||||
struct field as the former \fIARES_OPT_TIMEOUT\fP, it is but the option bits
|
||||
that tell c-ares how to interpret the number. This option was added in c-ares
|
||||
1.5.2.
|
||||
the first try of any given server. The default is two seconds, however any
|
||||
value below 250ms will automatically be set to 250ms (roughly the RTT half-way
|
||||
around the world). Note that this option is specified with the same struct field
|
||||
as the former \fIARES_OPT_TIMEOUT\fP, it is but the option bits that tell c-ares
|
||||
how to interpret the number. This option was added in c-ares 1.5.2.
|
||||
|
||||
As of c-ares 1.32.0, this option is only honored on the first successful query
|
||||
to any given server, after that the timeout is automatically calculated based
|
||||
on prior query history.
|
||||
.TP 18
|
||||
.B ARES_OPT_TRIES
|
||||
.B int \fItries\fP;
|
||||
|
@ -227,7 +235,9 @@ The value of
|
|||
.I sock_state_cb_data
|
||||
will be passed as the
|
||||
.I data
|
||||
argument.
|
||||
argument. The channel lock is held during this callback, if in a multithreaded
|
||||
application, care must be taken to ensure lock order is correct to be able to
|
||||
handle this and avoid deadlocks.
|
||||
|
||||
Cannot be used with \fBARES_OPT_EVENT_THREAD\fP.
|
||||
.TP 18
|
||||
|
|
2
deps/cares/include/CMakeLists.txt
vendored
2
deps/cares/include/CMakeLists.txt
vendored
|
@ -5,6 +5,6 @@ CONFIGURE_FILE (ares_build.h.cmake ${PROJECT_BINARY_DIR}/ares_build.h)
|
|||
|
||||
# Headers installation target
|
||||
IF (CARES_INSTALL)
|
||||
SET (CARES_HEADERS ares.h ares_version.h "${PROJECT_BINARY_DIR}/ares_build.h" ares_rules.h ares_dns.h ares_dns_record.h ares_nameser.h)
|
||||
SET (CARES_HEADERS ares.h ares_version.h "${PROJECT_BINARY_DIR}/ares_build.h" ares_dns.h ares_dns_record.h ares_nameser.h)
|
||||
INSTALL (FILES ${CARES_HEADERS} COMPONENT Devel DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
ENDIF ()
|
||||
|
|
2
deps/cares/include/Makefile.am
vendored
2
deps/cares/include/Makefile.am
vendored
|
@ -4,6 +4,6 @@ AUTOMAKE_OPTIONS = foreign nostdinc 1.9.6
|
|||
ACLOCAL_AMFLAGS = -I m4 --install
|
||||
|
||||
# what headers to install on 'make install':
|
||||
include_HEADERS = ares.h ares_version.h ares_build.h ares_rules.h ares_dns.h ares_dns_record.h ares_nameser.h
|
||||
include_HEADERS = ares.h ares_version.h ares_build.h ares_dns.h ares_dns_record.h ares_nameser.h
|
||||
|
||||
EXTRA_DIST = ares_build.h.cmake ares_build.h.in ares_build.h.dist CMakeLists.txt
|
||||
|
|
2
deps/cares/include/Makefile.in
vendored
2
deps/cares/include/Makefile.in
vendored
|
@ -352,7 +352,7 @@ AUTOMAKE_OPTIONS = foreign nostdinc 1.9.6
|
|||
ACLOCAL_AMFLAGS = -I m4 --install
|
||||
|
||||
# what headers to install on 'make install':
|
||||
include_HEADERS = ares.h ares_version.h ares_build.h ares_rules.h ares_dns.h ares_dns_record.h ares_nameser.h
|
||||
include_HEADERS = ares.h ares_version.h ares_build.h ares_dns.h ares_dns_record.h ares_nameser.h
|
||||
EXTRA_DIST = ares_build.h.cmake ares_build.h.in ares_build.h.dist CMakeLists.txt
|
||||
all: ares_build.h
|
||||
$(MAKE) $(AM_MAKEFLAGS) all-am
|
||||
|
|
70
deps/cares/include/ares.h
vendored
70
deps/cares/include/ares.h
vendored
|
@ -30,9 +30,43 @@
|
|||
|
||||
#include "ares_version.h" /* c-ares version defines */
|
||||
#include "ares_build.h" /* c-ares build definitions */
|
||||
#include "ares_rules.h" /* c-ares rules enforcement */
|
||||
|
||||
#include <sys/types.h>
|
||||
#if defined(_WIN32)
|
||||
# ifndef WIN32_LEAN_AND_MEAN
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef CARES_HAVE_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#ifdef CARES_HAVE_SYS_SOCKET_H
|
||||
# include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
#ifdef CARES_HAVE_SYS_SELECT_H
|
||||
# include <sys/select.h>
|
||||
#endif
|
||||
|
||||
#ifdef CARES_HAVE_WINSOCK2_H
|
||||
# include <winsock2.h>
|
||||
/* To aid with linking against a static c-ares build, lets tell the microsoft
|
||||
* compiler to pull in needed dependencies */
|
||||
# ifdef _MSC_VER
|
||||
# pragma comment(lib, "ws2_32")
|
||||
# pragma comment(lib, "advapi32")
|
||||
# pragma comment(lib, "iphlpapi")
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef CARES_HAVE_WS2TCPIP_H
|
||||
# include <ws2tcpip.h>
|
||||
#endif
|
||||
|
||||
#ifdef CARES_HAVE_WINDOWS_H
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
/* HP-UX systems version 9, 10 and 11 lack sys/select.h and so does oldish
|
||||
libc5-based Linux systems. Only include it on system that are known to
|
||||
|
@ -43,43 +77,26 @@
|
|||
defined(__QNXNTO__) || defined(__MVS__) || defined(__HAIKU__)
|
||||
# include <sys/select.h>
|
||||
#endif
|
||||
|
||||
#if (defined(NETWARE) && !defined(__NOVELL_LIBC__))
|
||||
# include <sys/bsdskt.h>
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
# ifndef WIN32_LEAN_AND_MEAN
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# endif
|
||||
#if !defined(_WIN32)
|
||||
# include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
#if defined(WATT32)
|
||||
# include <netinet/in.h>
|
||||
# include <sys/socket.h>
|
||||
#ifdef WATT32
|
||||
# include <tcp.h>
|
||||
#elif defined(_WIN32_WCE)
|
||||
# include <windows.h>
|
||||
# include <winsock.h>
|
||||
#elif defined(_WIN32)
|
||||
# include <windows.h>
|
||||
# include <winsock2.h>
|
||||
# include <ws2tcpip.h>
|
||||
/* To aid with linking against a static c-ares build, lets tell the microsoft
|
||||
* compiler to pull in needed dependencies */
|
||||
# ifdef _MSC_VER
|
||||
# pragma comment(lib, "ws2_32")
|
||||
# pragma comment(lib, "advapi32")
|
||||
# pragma comment(lib, "iphlpapi")
|
||||
# endif
|
||||
#else
|
||||
# include <sys/socket.h>
|
||||
# include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
#if defined(ANDROID) || defined(__ANDROID__)
|
||||
# include <jni.h>
|
||||
#endif
|
||||
|
||||
typedef CARES_TYPEOF_ARES_SOCKLEN_T ares_socklen_t;
|
||||
typedef CARES_TYPEOF_ARES_SSIZE_T ares_ssize_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -221,6 +238,7 @@ typedef enum {
|
|||
#define ARES_FLAG_NOCHECKRESP (1 << 7)
|
||||
#define ARES_FLAG_EDNS (1 << 8)
|
||||
#define ARES_FLAG_NO_DFLT_SVR (1 << 9)
|
||||
#define ARES_FLAG_DNS0x20 (1 << 10)
|
||||
|
||||
/* Option mask values */
|
||||
#define ARES_OPT_FLAGS (1 << 0)
|
||||
|
|
62
deps/cares/include/ares_build.h
vendored
62
deps/cares/include/ares_build.h
vendored
|
@ -134,75 +134,61 @@
|
|||
#elif defined(_WIN32_WCE)
|
||||
# define CARES_TYPEOF_ARES_SOCKLEN_T int
|
||||
|
||||
#elif defined(__MINGW32__)
|
||||
# define CARES_TYPEOF_ARES_SOCKLEN_T int
|
||||
|
||||
#elif defined(__VMS)
|
||||
# define CARES_TYPEOF_ARES_SOCKLEN_T unsigned int
|
||||
|
||||
#elif defined(__OS400__)
|
||||
# if defined(__ILEC400__)
|
||||
# define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t
|
||||
# define CARES_PULL_SYS_TYPES_H 1
|
||||
# define CARES_PULL_SYS_SOCKET_H 1
|
||||
# define CARES_HAVE_SYS_TYPES_H 1
|
||||
# define CARES_HAVE_SYS_SOCKET_H 1
|
||||
# define CARES_HAVE_SYS_SELECT_H 1
|
||||
# endif
|
||||
|
||||
#elif defined(__MVS__)
|
||||
# if defined(__IBMC__) || defined(__IBMCPP__)
|
||||
# define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t
|
||||
# define CARES_PULL_SYS_TYPES_H 1
|
||||
# define CARES_PULL_SYS_SOCKET_H 1
|
||||
# define CARES_HAVE_SYS_TYPES_H 1
|
||||
# define CARES_HAVE_SYS_SOCKET_H 1
|
||||
# define CARES_HAVE_SYS_SELECT_H 1
|
||||
# endif
|
||||
|
||||
#elif defined(__370__)
|
||||
# if defined(__IBMC__) || defined(__IBMCPP__)
|
||||
# define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t
|
||||
# define CARES_PULL_SYS_TYPES_H 1
|
||||
# define CARES_PULL_SYS_SOCKET_H 1
|
||||
# define CARES_HAVE_SYS_TYPES_H 1
|
||||
# define CARES_HAVE_SYS_SOCKET_H 1
|
||||
# define CARES_HAVE_SYS_SELECT_H 1
|
||||
# endif
|
||||
|
||||
#elif defined(TPF)
|
||||
# define CARES_TYPEOF_ARES_SOCKLEN_T int
|
||||
|
||||
/* ===================================== */
|
||||
/* KEEP MSVC THE PENULTIMATE ENTRY */
|
||||
/* ===================================== */
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
#elif defined(_WIN32)
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# define CARES_TYPEOF_ARES_SOCKLEN_T int
|
||||
# define CARES_HAVE_WINDOWS_H 1
|
||||
# define CARES_HAVE_SYS_TYPES_H 1
|
||||
|
||||
/* ===================================== */
|
||||
/* KEEP GENERIC GCC THE LAST ENTRY */
|
||||
/* ===================================== */
|
||||
# if defined(WATT32)
|
||||
# define CARES_HAVE_SYS_SOCKET_H 1
|
||||
# define CARES_HAVE_SYS_SELECT_H 1
|
||||
# else
|
||||
# define CARES_HAVE_WS2TCPIP_H 1
|
||||
# define CARES_HAVE_WINSOCK2_H 1
|
||||
# endif
|
||||
|
||||
#elif defined(__GNUC__)
|
||||
# define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t
|
||||
# define CARES_PULL_SYS_TYPES_H 1
|
||||
# define CARES_PULL_SYS_SOCKET_H 1
|
||||
# define CARES_HAVE_SYS_TYPES_H 1
|
||||
# define CARES_HAVE_SYS_SOCKET_H 1
|
||||
# define CARES_HAVE_SYS_SELECT_H 1
|
||||
|
||||
#else
|
||||
# error "Unknown non-configure build target!"
|
||||
Error Compilation_aborted_Unknown_non_configure_build_target
|
||||
#endif
|
||||
|
||||
/* CARES_PULL_SYS_TYPES_H is defined above when inclusion of header file */
|
||||
/* sys/types.h is required here to properly make type definitions below. */
|
||||
#ifdef CARES_PULL_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
/* CARES_PULL_SYS_SOCKET_H is defined above when inclusion of header file */
|
||||
/* sys/socket.h is required here to properly make type definitions below. */
|
||||
#ifdef CARES_PULL_SYS_SOCKET_H
|
||||
# include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
/* Data type definition of ares_socklen_t. */
|
||||
|
||||
#ifdef CARES_TYPEOF_ARES_SOCKLEN_T
|
||||
typedef CARES_TYPEOF_ARES_SOCKLEN_T ares_socklen_t;
|
||||
#endif
|
||||
|
||||
/* Data type definition of ares_ssize_t. */
|
||||
#ifdef _WIN32
|
||||
# ifdef _WIN64
|
||||
|
@ -214,6 +200,4 @@
|
|||
# define CARES_TYPEOF_ARES_SSIZE_T ssize_t
|
||||
#endif
|
||||
|
||||
typedef CARES_TYPEOF_ARES_SSIZE_T ares_ssize_t;
|
||||
|
||||
#endif /* __CARES_BUILD_H */
|
||||
|
|
10
deps/cares/include/ares_build.h.cmake
vendored
10
deps/cares/include/ares_build.h.cmake
vendored
|
@ -13,10 +13,10 @@
|
|||
* for C-Ares */
|
||||
#cmakedefine CARES_HAVE_SYS_TYPES_H
|
||||
#cmakedefine CARES_HAVE_SYS_SOCKET_H
|
||||
#cmakedefine CARES_HAVE_SYS_SELECT_H
|
||||
#cmakedefine CARES_HAVE_WINDOWS_H
|
||||
#cmakedefine CARES_HAVE_WS2TCPIP_H
|
||||
#cmakedefine CARES_HAVE_WINSOCK2_H
|
||||
#cmakedefine CARES_HAVE_WINDOWS_H
|
||||
#cmakedefine CARES_HAVE_ARPA_NAMESER_H
|
||||
#cmakedefine CARES_HAVE_ARPA_NAMESER_COMPAT_H
|
||||
|
||||
|
@ -28,6 +28,10 @@
|
|||
# include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
#ifdef CARES_HAVE_SYS_SELECT_H
|
||||
# include <sys/select.h>
|
||||
#endif
|
||||
|
||||
#ifdef CARES_HAVE_WINSOCK2_H
|
||||
# include <winsock2.h>
|
||||
#endif
|
||||
|
@ -40,8 +44,4 @@
|
|||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
|
||||
typedef CARES_TYPEOF_ARES_SOCKLEN_T ares_socklen_t;
|
||||
typedef CARES_TYPEOF_ARES_SSIZE_T ares_ssize_t;
|
||||
|
||||
#endif /* __CARES_BUILD_H */
|
||||
|
|
10
deps/cares/include/ares_build.h.in
vendored
10
deps/cares/include/ares_build.h.in
vendored
|
@ -13,10 +13,10 @@
|
|||
* for C-Ares */
|
||||
#undef CARES_HAVE_SYS_TYPES_H
|
||||
#undef CARES_HAVE_SYS_SOCKET_H
|
||||
#undef CARES_HAVE_SYS_SELECT_H
|
||||
#undef CARES_HAVE_WINDOWS_H
|
||||
#undef CARES_HAVE_WS2TCPIP_H
|
||||
#undef CARES_HAVE_WINSOCK2_H
|
||||
#undef CARES_HAVE_WINDOWS_H
|
||||
#undef CARES_HAVE_ARPA_NAMESER_H
|
||||
#undef CARES_HAVE_ARPA_NAMESER_COMPAT_H
|
||||
|
||||
|
@ -28,6 +28,10 @@
|
|||
# include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
#ifdef CARES_HAVE_SYS_SELECT_H
|
||||
# include <sys/select.h>
|
||||
#endif
|
||||
|
||||
#ifdef CARES_HAVE_WINSOCK2_H
|
||||
# include <winsock2.h>
|
||||
#endif
|
||||
|
@ -40,8 +44,4 @@
|
|||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
|
||||
typedef CARES_TYPEOF_ARES_SOCKLEN_T ares_socklen_t;
|
||||
typedef CARES_TYPEOF_ARES_SSIZE_T ares_ssize_t;
|
||||
|
||||
#endif /* __CARES_BUILD_H */
|
||||
|
|
111
deps/cares/include/ares_dns_record.h
vendored
111
deps/cares/include/ares_dns_record.h
vendored
|
@ -94,7 +94,7 @@ typedef enum {
|
|||
ARES_OPCODE_IQUERY = 1, /*!< Inverse query. Obsolete. */
|
||||
ARES_OPCODE_STATUS = 2, /*!< Name server status query */
|
||||
ARES_OPCODE_NOTIFY = 4, /*!< Zone change notification (RFC 1996) */
|
||||
ARES_OPCODE_UPDATE = 5, /*!< Zone update message (RFC2136) */
|
||||
ARES_OPCODE_UPDATE = 5 /*!< Zone update message (RFC2136) */
|
||||
} ares_dns_opcode_t;
|
||||
|
||||
/*! DNS Header flags */
|
||||
|
@ -108,7 +108,7 @@ typedef enum {
|
|||
ARES_FLAG_AD = 1 << 5, /*!< RFC 2065. Authentic Data bit indicates in a
|
||||
* response that the data included has been verified by
|
||||
* the server providing it */
|
||||
ARES_FLAG_CD = 1 << 6, /*!< RFC 2065. Checking Disabled bit indicates in a
|
||||
ARES_FLAG_CD = 1 << 6 /*!< RFC 2065. Checking Disabled bit indicates in a
|
||||
* query that non-verified data is acceptable to the
|
||||
* resolver sending the query. */
|
||||
} ares_dns_flags_t;
|
||||
|
@ -152,25 +152,28 @@ typedef enum {
|
|||
ARES_RCODE_BADNAME = 20, /*!< RFC 2930. Duplicate Key Name */
|
||||
ARES_RCODE_BADALG = 21, /*!< RFC 2930. Algorithm not supported */
|
||||
ARES_RCODE_BADTRUNC = 22, /*!< RFC 8945. Bad Truncation */
|
||||
ARES_RCODE_BADCOOKIE = 23, /*!< RVC 7973. Bad/missing Server Cookie */
|
||||
ARES_RCODE_BADCOOKIE = 23 /*!< RVC 7973. Bad/missing Server Cookie */
|
||||
} ares_dns_rcode_t;
|
||||
|
||||
/*! Data types used */
|
||||
typedef enum {
|
||||
ARES_DATATYPE_INADDR = 1, /*!< struct in_addr * type */
|
||||
ARES_DATATYPE_INADDR6 = 2, /*!< struct ares_in6_addr * type */
|
||||
ARES_DATATYPE_U8 = 3, /*!< 8bit unsigned integer */
|
||||
ARES_DATATYPE_U16 = 4, /*!< 16bit unsigned integer */
|
||||
ARES_DATATYPE_U32 = 5, /*!< 32bit unsigned integer */
|
||||
ARES_DATATYPE_NAME = 6, /*!< Null-terminated string of a domain name */
|
||||
ARES_DATATYPE_STR = 7, /*!< Null-terminated string */
|
||||
ARES_DATATYPE_BIN = 8, /*!< Binary data */
|
||||
ARES_DATATYPE_BINP = 9, /*!< Officially defined as binary data, but likely
|
||||
* printable. Guaranteed to have a NULL
|
||||
* terminator for convenience (not included in
|
||||
* length) */
|
||||
ARES_DATATYPE_OPT = 10, /*!< Array of options. 16bit identifier, BIN
|
||||
* data. */
|
||||
ARES_DATATYPE_INADDR = 1, /*!< struct in_addr * type */
|
||||
ARES_DATATYPE_INADDR6 = 2, /*!< struct ares_in6_addr * type */
|
||||
ARES_DATATYPE_U8 = 3, /*!< 8bit unsigned integer */
|
||||
ARES_DATATYPE_U16 = 4, /*!< 16bit unsigned integer */
|
||||
ARES_DATATYPE_U32 = 5, /*!< 32bit unsigned integer */
|
||||
ARES_DATATYPE_NAME = 6, /*!< Null-terminated string of a domain name */
|
||||
ARES_DATATYPE_STR = 7, /*!< Null-terminated string */
|
||||
ARES_DATATYPE_BIN = 8, /*!< Binary data */
|
||||
ARES_DATATYPE_BINP = 9, /*!< Officially defined as binary data, but likely
|
||||
* printable. Guaranteed to have a NULL
|
||||
* terminator for convenience (not included in
|
||||
* length) */
|
||||
ARES_DATATYPE_OPT = 10, /*!< Array of options. 16bit identifier, BIN
|
||||
* data. */
|
||||
ARES_DATATYPE_ABINP = 11 /*!< Array of binary data, likely printable.
|
||||
* Guaranteed to have a NULL terminator for
|
||||
* convenience (not included in length) */
|
||||
} ares_dns_datatype_t;
|
||||
|
||||
/*! Keys used for all RR Types. We take the record type and multiply by 100
|
||||
|
@ -207,7 +210,7 @@ typedef enum {
|
|||
ARES_RR_MX_PREFERENCE = (ARES_REC_TYPE_MX * 100) + 1,
|
||||
/*! MX Record. Exchange, domain. Datatype: NAME */
|
||||
ARES_RR_MX_EXCHANGE = (ARES_REC_TYPE_MX * 100) + 2,
|
||||
/*! TXT Record. Data. Datatype: BINP */
|
||||
/*! TXT Record. Data. Datatype: ABINP */
|
||||
ARES_RR_TXT_DATA = (ARES_REC_TYPE_TXT * 100) + 1,
|
||||
/*! SIG Record. Type Covered. Datatype: U16 */
|
||||
ARES_RR_SIG_TYPE_COVERED = (ARES_REC_TYPE_SIG * 100) + 1,
|
||||
|
@ -292,7 +295,7 @@ typedef enum {
|
|||
/*! RAW Record. RR Type. Datatype: U16 */
|
||||
ARES_RR_RAW_RR_TYPE = (ARES_REC_TYPE_RAW_RR * 100) + 1,
|
||||
/*! RAW Record. RR Data. Datatype: BIN */
|
||||
ARES_RR_RAW_RR_DATA = (ARES_REC_TYPE_RAW_RR * 100) + 2,
|
||||
ARES_RR_RAW_RR_DATA = (ARES_REC_TYPE_RAW_RR * 100) + 2
|
||||
} ares_dns_rr_key_t;
|
||||
|
||||
/*! TLSA Record ARES_RR_TLSA_CERT_USAGE known values */
|
||||
|
@ -372,7 +375,7 @@ typedef enum {
|
|||
/*! RFC 8145. Signaling Trust Anchor Knowledge in DNSSEC */
|
||||
ARES_OPT_PARAM_EDNS_KEY_TAG = 14,
|
||||
/*! RFC 8914. Extended ERROR code and message */
|
||||
ARES_OPT_PARAM_EXTENDED_DNS_ERROR = 15,
|
||||
ARES_OPT_PARAM_EXTENDED_DNS_ERROR = 15
|
||||
} ares_opt_param_t;
|
||||
|
||||
/*! Data type for option records for keys like ARES_RR_OPT_OPTIONS and
|
||||
|
@ -600,6 +603,15 @@ CARES_EXTERN void ares_dns_record_destroy(ares_dns_record_t *dnsrec);
|
|||
CARES_EXTERN unsigned short
|
||||
ares_dns_record_get_id(const ares_dns_record_t *dnsrec);
|
||||
|
||||
/*! Overwrite the DNS query id
|
||||
*
|
||||
* \param[in] dnsrec Initialized record object
|
||||
* \param[in] id DNS query id
|
||||
* \return ARES_TRUE on success, ARES_FALSE on usage error
|
||||
*/
|
||||
CARES_EXTERN ares_bool_t
|
||||
ares_dns_record_set_id(ares_dns_record_t *dnsrec, unsigned short id);
|
||||
|
||||
/*! Get the DNS Record Flags
|
||||
*
|
||||
* \param[in] dnsrec Initialized record object
|
||||
|
@ -863,6 +875,34 @@ CARES_EXTERN ares_status_t ares_dns_rr_set_bin(ares_dns_rr_t *dns_rr,
|
|||
const unsigned char *val,
|
||||
size_t len);
|
||||
|
||||
/*! Add binary array value (ABINP) data for specified resource record and key.
|
||||
* Can only be used on keys with datatype ARES_DATATYPE_ABINP. The value will
|
||||
* Be added as the last element in the array.
|
||||
*
|
||||
* \param[in] dns_rr Pointer to resource record
|
||||
* \param[in] key DNS Resource Record Key
|
||||
* \param[in] val Pointer to binary data.
|
||||
* \param[in] len Length of binary data
|
||||
* \return ARES_SUCCESS on success
|
||||
*/
|
||||
CARES_EXTERN ares_status_t ares_dns_rr_add_abin(ares_dns_rr_t *dns_rr,
|
||||
ares_dns_rr_key_t key,
|
||||
const unsigned char *val,
|
||||
size_t len);
|
||||
|
||||
/*! Delete binary array value (ABINP) data for specified resource record and
|
||||
* key by specified index. Can only be used on keys with datatype
|
||||
* ARES_DATATYPE_ABINP. The value at the index will be deleted.
|
||||
*
|
||||
* \param[in] dns_rr Pointer to resource record
|
||||
* \param[in] key DNS Resource Record Key
|
||||
* \param[in] idx Index to delete
|
||||
* \return ARES_SUCCESS on success
|
||||
*/
|
||||
CARES_EXTERN ares_status_t ares_dns_rr_del_abin(ares_dns_rr_t *dns_rr,
|
||||
ares_dns_rr_key_t key,
|
||||
size_t idx);
|
||||
|
||||
/*! Set the option for the RR
|
||||
*
|
||||
* \param[in] dns_rr Pointer to resource record
|
||||
|
@ -939,8 +979,9 @@ CARES_EXTERN unsigned int ares_dns_rr_get_u32(const ares_dns_rr_t *dns_rr,
|
|||
ares_dns_rr_key_t key);
|
||||
|
||||
/*! Retrieve a pointer to the binary data. Can only be used on keys with
|
||||
* datatype ARES_DATATYPE_BIN or ARES_DATATYPE_BINP. If BINP, the data is
|
||||
* guaranteed to have a NULL terminator which is NOT included in the length.
|
||||
* datatype ARES_DATATYPE_BIN, ARES_DATATYPE_BINP, or ARES_DATATYPE_ABINP.
|
||||
* If BINP or ABINP, the data is guaranteed to have a NULL terminator which
|
||||
* is NOT included in the length.
|
||||
*
|
||||
* \param[in] dns_rr Pointer to resource record
|
||||
* \param[in] key DNS Resource Record Key
|
||||
|
@ -951,6 +992,32 @@ CARES_EXTERN const unsigned char *
|
|||
ares_dns_rr_get_bin(const ares_dns_rr_t *dns_rr, ares_dns_rr_key_t key,
|
||||
size_t *len);
|
||||
|
||||
/*! Retrieve the count of the array of stored binary values. Can only be used on
|
||||
* keys with datatype ARES_DATATYPE_ABINP.
|
||||
*
|
||||
* \param[in] dns_rr Pointer to resource record
|
||||
* \param[in] key DNS Resource Record Key
|
||||
* \return count of values
|
||||
*/
|
||||
CARES_EXTERN size_t ares_dns_rr_get_abin_cnt(const ares_dns_rr_t *dns_rr,
|
||||
ares_dns_rr_key_t key);
|
||||
|
||||
/*! Retrieve a pointer to the binary array data from the specified index. Can
|
||||
* only be used on keys with datatype ARES_DATATYPE_ABINP. If ABINP, the data
|
||||
* is guaranteed to have a NULL terminator which is NOT included in the length.
|
||||
* If want all array membersconcatenated, may use ares_dns_rr_get_bin()
|
||||
* instead.
|
||||
*
|
||||
* \param[in] dns_rr Pointer to resource record
|
||||
* \param[in] key DNS Resource Record Key
|
||||
* \param[in] idx Index of value to retrieve
|
||||
* \param[out] len Length of binary data returned
|
||||
* \return pointer binary data or NULL on error
|
||||
*/
|
||||
CARES_EXTERN const unsigned char *ares_dns_rr_get_abin(
|
||||
const ares_dns_rr_t *dns_rr, ares_dns_rr_key_t key, size_t idx, size_t *len);
|
||||
|
||||
|
||||
/*! Retrieve the number of options stored for the RR.
|
||||
*
|
||||
* \param[in] dns_rr Pointer to resource record
|
||||
|
|
133
deps/cares/include/ares_rules.h
vendored
133
deps/cares/include/ares_rules.h
vendored
|
@ -1,133 +0,0 @@
|
|||
/* MIT License
|
||||
*
|
||||
* Copyright (c) 2009 Daniel Stenberg
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
#ifndef __CARES_RULES_H
|
||||
#define __CARES_RULES_H
|
||||
|
||||
/* ================================================================ */
|
||||
/* COMPILE TIME SANITY CHECKS */
|
||||
/* ================================================================ */
|
||||
|
||||
/*
|
||||
* NOTE 1:
|
||||
* -------
|
||||
*
|
||||
* All checks done in this file are intentionally placed in a public
|
||||
* header file which is pulled by ares.h when an application is
|
||||
* being built using an already built c-ares library. Additionally
|
||||
* this file is also included and used when building the library.
|
||||
*
|
||||
* If compilation fails on this file it is certainly sure that the
|
||||
* problem is elsewhere. It could be a problem in the ares_build.h
|
||||
* header file, or simply that you are using different compilation
|
||||
* settings than those used to build the library.
|
||||
*
|
||||
* Nothing in this file is intended to be modified or adjusted by the
|
||||
* c-ares library user nor by the c-ares library builder.
|
||||
*
|
||||
* Do not deactivate any check, these are done to make sure that the
|
||||
* library is properly built and used.
|
||||
*
|
||||
* You can find further help on the c-ares development mailing list:
|
||||
* http://lists.haxx.se/listinfo/c-ares/
|
||||
*
|
||||
* NOTE 2
|
||||
* ------
|
||||
*
|
||||
* Some of the following compile time checks are based on the fact
|
||||
* that the dimension of a constant array can not be a negative one.
|
||||
* In this way if the compile time verification fails, the compilation
|
||||
* will fail issuing an error. The error description wording is compiler
|
||||
* dependent but it will be quite similar to one of the following:
|
||||
*
|
||||
* "negative subscript or subscript is too large"
|
||||
* "array must have at least one element"
|
||||
* "-1 is an illegal array size"
|
||||
* "size of array is negative"
|
||||
*
|
||||
* If you are building an application which tries to use an already
|
||||
* built c-ares library and you are getting this kind of errors on
|
||||
* this file, it is a clear indication that there is a mismatch between
|
||||
* how the library was built and how you are trying to use it for your
|
||||
* application. Your already compiled or binary library provider is the
|
||||
* only one who can give you the details you need to properly use it.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Verify that some macros are actually defined.
|
||||
*/
|
||||
|
||||
#ifndef CARES_TYPEOF_ARES_SOCKLEN_T
|
||||
# error "CARES_TYPEOF_ARES_SOCKLEN_T definition is missing!"
|
||||
Error Compilation_aborted_CARES_TYPEOF_ARES_SOCKLEN_T_is_missing
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Macros private to this header file.
|
||||
*/
|
||||
|
||||
#define CareschkszEQ(t, s) sizeof(t) == s ? 1 : -1
|
||||
|
||||
#define CareschkszGE(t1, t2) sizeof(t1) >= sizeof(t2) ? 1 : -1
|
||||
|
||||
/*
|
||||
* Verify that the size previously defined and expected for
|
||||
* ares_socklen_t is actually the same as the one reported
|
||||
* by sizeof() at compile time.
|
||||
*/
|
||||
|
||||
typedef char __cares_rule_02__[CareschkszEQ(
|
||||
ares_socklen_t, sizeof(CARES_TYPEOF_ARES_SOCKLEN_T))];
|
||||
|
||||
/*
|
||||
* Verify at compile time that the size of ares_socklen_t as reported
|
||||
* by sizeof() is greater or equal than the one reported for int for
|
||||
* the current compilation.
|
||||
*/
|
||||
|
||||
typedef char __cares_rule_03__[CareschkszGE(ares_socklen_t, int)];
|
||||
|
||||
/* ================================================================ */
|
||||
/* EXTERNALLY AND INTERNALLY VISIBLE DEFINITIONS */
|
||||
/* ================================================================ */
|
||||
|
||||
/*
|
||||
* Get rid of macros private to this header file.
|
||||
*/
|
||||
|
||||
#undef CareschkszEQ
|
||||
#undef CareschkszGE
|
||||
|
||||
/*
|
||||
* Get rid of macros not intended to exist beyond this point.
|
||||
*/
|
||||
|
||||
#undef CARES_PULL_WS2TCPIP_H
|
||||
#undef CARES_PULL_SYS_TYPES_H
|
||||
#undef CARES_PULL_SYS_SOCKET_H
|
||||
|
||||
#undef CARES_TYPEOF_ARES_SOCKLEN_T
|
||||
|
||||
#endif /* __CARES_RULES_H */
|
13
deps/cares/include/ares_version.h
vendored
13
deps/cares/include/ares_version.h
vendored
|
@ -31,19 +31,14 @@
|
|||
#define ARES_COPYRIGHT "2004 - 2024 Daniel Stenberg, <daniel@haxx.se>."
|
||||
|
||||
#define ARES_VERSION_MAJOR 1
|
||||
#define ARES_VERSION_MINOR 31
|
||||
#define ARES_VERSION_MINOR 32
|
||||
#define ARES_VERSION_PATCH 0
|
||||
#define ARES_VERSION \
|
||||
((ARES_VERSION_MAJOR << 16) | (ARES_VERSION_MINOR << 8) | \
|
||||
(ARES_VERSION_PATCH))
|
||||
#define ARES_VERSION_STR "1.31.0"
|
||||
#define ARES_VERSION_STR "1.32.0"
|
||||
|
||||
#if (ARES_VERSION >= 0x010700)
|
||||
# define CARES_HAVE_ARES_LIBRARY_INIT 1
|
||||
# define CARES_HAVE_ARES_LIBRARY_CLEANUP 1
|
||||
#else
|
||||
# undef CARES_HAVE_ARES_LIBRARY_INIT
|
||||
# undef CARES_HAVE_ARES_LIBRARY_CLEANUP
|
||||
#endif
|
||||
#define CARES_HAVE_ARES_LIBRARY_INIT 1
|
||||
#define CARES_HAVE_ARES_LIBRARY_CLEANUP 1
|
||||
|
||||
#endif
|
||||
|
|
65
deps/cares/src/lib/Makefile.in
vendored
65
deps/cares/src/lib/Makefile.in
vendored
|
@ -15,7 +15,7 @@
|
|||
@SET_MAKE@
|
||||
|
||||
# aminclude_static.am generated automatically by Autoconf
|
||||
# from AX_AM_MACROS_STATIC on Tue Jun 18 05:51:32 EDT 2024
|
||||
# from AX_AM_MACROS_STATIC on Thu Jul 4 07:03:12 EDT 2024
|
||||
|
||||
# Copyright (C) The c-ares project and its contributors
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
@ -175,6 +175,7 @@ am__objects_1 = libcares_la-ares__addrinfo2hostent.lo \
|
|||
libcares_la-ares__timeval.lo libcares_la-ares_android.lo \
|
||||
libcares_la-ares_cancel.lo libcares_la-ares_data.lo \
|
||||
libcares_la-ares_destroy.lo libcares_la-ares_dns_mapping.lo \
|
||||
libcares_la-ares_dns_multistring.lo \
|
||||
libcares_la-ares_dns_name.lo libcares_la-ares_dns_parse.lo \
|
||||
libcares_la-ares_dns_record.lo libcares_la-ares_dns_write.lo \
|
||||
libcares_la-ares_event_configchg.lo \
|
||||
|
@ -195,8 +196,9 @@ am__objects_1 = libcares_la-ares__addrinfo2hostent.lo \
|
|||
libcares_la-ares_gethostbyname.lo \
|
||||
libcares_la-ares_getnameinfo.lo libcares_la-ares_getsock.lo \
|
||||
libcares_la-ares_init.lo libcares_la-ares_library_init.lo \
|
||||
libcares_la-ares_math.lo libcares_la-ares_create_query.lo \
|
||||
libcares_la-ares_options.lo libcares_la-ares_parse_a_reply.lo \
|
||||
libcares_la-ares_math.lo libcares_la-ares_metrics.lo \
|
||||
libcares_la-ares_create_query.lo libcares_la-ares_options.lo \
|
||||
libcares_la-ares_parse_a_reply.lo \
|
||||
libcares_la-ares_parse_aaaa_reply.lo \
|
||||
libcares_la-ares_parse_caa_reply.lo \
|
||||
libcares_la-ares_parse_mx_reply.lo \
|
||||
|
@ -214,7 +216,8 @@ am__objects_1 = libcares_la-ares__addrinfo2hostent.lo \
|
|||
libcares_la-ares_str.lo libcares_la-ares_strerror.lo \
|
||||
libcares_la-ares_strsplit.lo libcares_la-ares_sysconfig.lo \
|
||||
libcares_la-ares_sysconfig_files.lo \
|
||||
libcares_la-ares_sysconfig_mac.lo libcares_la-ares_timeout.lo \
|
||||
libcares_la-ares_sysconfig_mac.lo \
|
||||
libcares_la-ares_sysconfig_win.lo libcares_la-ares_timeout.lo \
|
||||
libcares_la-ares_update_servers.lo libcares_la-ares_version.lo \
|
||||
libcares_la-inet_net_pton.lo libcares_la-inet_ntop.lo \
|
||||
libcares_la-windows_port.lo
|
||||
|
@ -268,6 +271,7 @@ am__depfiles_remade = \
|
|||
./$(DEPDIR)/libcares_la-ares_data.Plo \
|
||||
./$(DEPDIR)/libcares_la-ares_destroy.Plo \
|
||||
./$(DEPDIR)/libcares_la-ares_dns_mapping.Plo \
|
||||
./$(DEPDIR)/libcares_la-ares_dns_multistring.Plo \
|
||||
./$(DEPDIR)/libcares_la-ares_dns_name.Plo \
|
||||
./$(DEPDIR)/libcares_la-ares_dns_parse.Plo \
|
||||
./$(DEPDIR)/libcares_la-ares_dns_record.Plo \
|
||||
|
@ -295,6 +299,7 @@ am__depfiles_remade = \
|
|||
./$(DEPDIR)/libcares_la-ares_init.Plo \
|
||||
./$(DEPDIR)/libcares_la-ares_library_init.Plo \
|
||||
./$(DEPDIR)/libcares_la-ares_math.Plo \
|
||||
./$(DEPDIR)/libcares_la-ares_metrics.Plo \
|
||||
./$(DEPDIR)/libcares_la-ares_options.Plo \
|
||||
./$(DEPDIR)/libcares_la-ares_parse_a_reply.Plo \
|
||||
./$(DEPDIR)/libcares_la-ares_parse_aaaa_reply.Plo \
|
||||
|
@ -321,6 +326,7 @@ am__depfiles_remade = \
|
|||
./$(DEPDIR)/libcares_la-ares_sysconfig.Plo \
|
||||
./$(DEPDIR)/libcares_la-ares_sysconfig_files.Plo \
|
||||
./$(DEPDIR)/libcares_la-ares_sysconfig_mac.Plo \
|
||||
./$(DEPDIR)/libcares_la-ares_sysconfig_win.Plo \
|
||||
./$(DEPDIR)/libcares_la-ares_timeout.Plo \
|
||||
./$(DEPDIR)/libcares_la-ares_update_servers.Plo \
|
||||
./$(DEPDIR)/libcares_la-ares_version.Plo \
|
||||
|
@ -624,7 +630,7 @@ CSOURCES = ares__addrinfo2hostent.c \
|
|||
ares__addrinfo_localhost.c \
|
||||
ares__buf.c \
|
||||
ares__close_sockets.c \
|
||||
ares__hosts_file.c \
|
||||
ares__hosts_file.c \
|
||||
ares__htable.c \
|
||||
ares__htable_asvp.c \
|
||||
ares__htable_strvp.c \
|
||||
|
@ -643,11 +649,12 @@ CSOURCES = ares__addrinfo2hostent.c \
|
|||
ares_data.c \
|
||||
ares_destroy.c \
|
||||
ares_dns_mapping.c \
|
||||
ares_dns_multistring.c \
|
||||
ares_dns_name.c \
|
||||
ares_dns_parse.c \
|
||||
ares_dns_record.c \
|
||||
ares_dns_write.c \
|
||||
ares_event_configchg.c \
|
||||
ares_event_configchg.c \
|
||||
ares_event_epoll.c \
|
||||
ares_event_kqueue.c \
|
||||
ares_event_poll.c \
|
||||
|
@ -669,7 +676,8 @@ CSOURCES = ares__addrinfo2hostent.c \
|
|||
ares_getsock.c \
|
||||
ares_init.c \
|
||||
ares_library_init.c \
|
||||
ares_math.c \
|
||||
ares_math.c \
|
||||
ares_metrics.c \
|
||||
ares_create_query.c \
|
||||
ares_options.c \
|
||||
ares_parse_a_reply.c \
|
||||
|
@ -685,7 +693,7 @@ CSOURCES = ares__addrinfo2hostent.c \
|
|||
ares_parse_uri_reply.c \
|
||||
ares_platform.c \
|
||||
ares_process.c \
|
||||
ares_qcache.c \
|
||||
ares_qcache.c \
|
||||
ares_query.c \
|
||||
ares_rand.c \
|
||||
ares_search.c \
|
||||
|
@ -694,11 +702,12 @@ CSOURCES = ares__addrinfo2hostent.c \
|
|||
ares_str.c \
|
||||
ares_strerror.c \
|
||||
ares_strsplit.c \
|
||||
ares_sysconfig.c \
|
||||
ares_sysconfig_files.c \
|
||||
ares_sysconfig_mac.c \
|
||||
ares_sysconfig.c \
|
||||
ares_sysconfig_files.c \
|
||||
ares_sysconfig_mac.c \
|
||||
ares_sysconfig_win.c \
|
||||
ares_timeout.c \
|
||||
ares_update_servers.c \
|
||||
ares_update_servers.c \
|
||||
ares_version.c \
|
||||
inet_net_pton.c \
|
||||
inet_ntop.c \
|
||||
|
@ -716,6 +725,7 @@ HHEADERS = ares__buf.h \
|
|||
ares__threads.h \
|
||||
ares_android.h \
|
||||
ares_data.h \
|
||||
ares_dns_multistring.h \
|
||||
ares_dns_private.h \
|
||||
ares_event.h \
|
||||
ares_event_win32.h \
|
||||
|
@ -728,7 +738,6 @@ HHEADERS = ares__buf.h \
|
|||
ares_str.h \
|
||||
ares_strsplit.h \
|
||||
ares_setup.h \
|
||||
setup_once.h \
|
||||
thirdparty/apple/dnsinfo.h
|
||||
|
||||
|
||||
|
@ -853,6 +862,7 @@ distclean-compile:
|
|||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_data.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_destroy.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_dns_mapping.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_dns_multistring.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_dns_name.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_dns_parse.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_dns_record.Plo@am__quote@ # am--include-marker
|
||||
|
@ -880,6 +890,7 @@ distclean-compile:
|
|||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_init.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_library_init.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_math.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_metrics.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_options.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_parse_a_reply.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_parse_aaaa_reply.Plo@am__quote@ # am--include-marker
|
||||
|
@ -906,6 +917,7 @@ distclean-compile:
|
|||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_sysconfig.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_sysconfig_files.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_sysconfig_mac.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_sysconfig_win.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_timeout.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_update_servers.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_version.Plo@am__quote@ # am--include-marker
|
||||
|
@ -1104,6 +1116,13 @@ libcares_la-ares_dns_mapping.lo: ares_dns_mapping.c
|
|||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcares_la_CPPFLAGS) $(CPPFLAGS) $(libcares_la_CFLAGS) $(CFLAGS) -c -o libcares_la-ares_dns_mapping.lo `test -f 'ares_dns_mapping.c' || echo '$(srcdir)/'`ares_dns_mapping.c
|
||||
|
||||
libcares_la-ares_dns_multistring.lo: ares_dns_multistring.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcares_la_CPPFLAGS) $(CPPFLAGS) $(libcares_la_CFLAGS) $(CFLAGS) -MT libcares_la-ares_dns_multistring.lo -MD -MP -MF $(DEPDIR)/libcares_la-ares_dns_multistring.Tpo -c -o libcares_la-ares_dns_multistring.lo `test -f 'ares_dns_multistring.c' || echo '$(srcdir)/'`ares_dns_multistring.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcares_la-ares_dns_multistring.Tpo $(DEPDIR)/libcares_la-ares_dns_multistring.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ares_dns_multistring.c' object='libcares_la-ares_dns_multistring.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcares_la_CPPFLAGS) $(CPPFLAGS) $(libcares_la_CFLAGS) $(CFLAGS) -c -o libcares_la-ares_dns_multistring.lo `test -f 'ares_dns_multistring.c' || echo '$(srcdir)/'`ares_dns_multistring.c
|
||||
|
||||
libcares_la-ares_dns_name.lo: ares_dns_name.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcares_la_CPPFLAGS) $(CPPFLAGS) $(libcares_la_CFLAGS) $(CFLAGS) -MT libcares_la-ares_dns_name.lo -MD -MP -MF $(DEPDIR)/libcares_la-ares_dns_name.Tpo -c -o libcares_la-ares_dns_name.lo `test -f 'ares_dns_name.c' || echo '$(srcdir)/'`ares_dns_name.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcares_la-ares_dns_name.Tpo $(DEPDIR)/libcares_la-ares_dns_name.Plo
|
||||
|
@ -1293,6 +1312,13 @@ libcares_la-ares_math.lo: ares_math.c
|
|||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcares_la_CPPFLAGS) $(CPPFLAGS) $(libcares_la_CFLAGS) $(CFLAGS) -c -o libcares_la-ares_math.lo `test -f 'ares_math.c' || echo '$(srcdir)/'`ares_math.c
|
||||
|
||||
libcares_la-ares_metrics.lo: ares_metrics.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcares_la_CPPFLAGS) $(CPPFLAGS) $(libcares_la_CFLAGS) $(CFLAGS) -MT libcares_la-ares_metrics.lo -MD -MP -MF $(DEPDIR)/libcares_la-ares_metrics.Tpo -c -o libcares_la-ares_metrics.lo `test -f 'ares_metrics.c' || echo '$(srcdir)/'`ares_metrics.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcares_la-ares_metrics.Tpo $(DEPDIR)/libcares_la-ares_metrics.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ares_metrics.c' object='libcares_la-ares_metrics.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcares_la_CPPFLAGS) $(CPPFLAGS) $(libcares_la_CFLAGS) $(CFLAGS) -c -o libcares_la-ares_metrics.lo `test -f 'ares_metrics.c' || echo '$(srcdir)/'`ares_metrics.c
|
||||
|
||||
libcares_la-ares_create_query.lo: ares_create_query.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcares_la_CPPFLAGS) $(CPPFLAGS) $(libcares_la_CFLAGS) $(CFLAGS) -MT libcares_la-ares_create_query.lo -MD -MP -MF $(DEPDIR)/libcares_la-ares_create_query.Tpo -c -o libcares_la-ares_create_query.lo `test -f 'ares_create_query.c' || echo '$(srcdir)/'`ares_create_query.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcares_la-ares_create_query.Tpo $(DEPDIR)/libcares_la-ares_create_query.Plo
|
||||
|
@ -1482,6 +1508,13 @@ libcares_la-ares_sysconfig_mac.lo: ares_sysconfig_mac.c
|
|||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcares_la_CPPFLAGS) $(CPPFLAGS) $(libcares_la_CFLAGS) $(CFLAGS) -c -o libcares_la-ares_sysconfig_mac.lo `test -f 'ares_sysconfig_mac.c' || echo '$(srcdir)/'`ares_sysconfig_mac.c
|
||||
|
||||
libcares_la-ares_sysconfig_win.lo: ares_sysconfig_win.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcares_la_CPPFLAGS) $(CPPFLAGS) $(libcares_la_CFLAGS) $(CFLAGS) -MT libcares_la-ares_sysconfig_win.lo -MD -MP -MF $(DEPDIR)/libcares_la-ares_sysconfig_win.Tpo -c -o libcares_la-ares_sysconfig_win.lo `test -f 'ares_sysconfig_win.c' || echo '$(srcdir)/'`ares_sysconfig_win.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcares_la-ares_sysconfig_win.Tpo $(DEPDIR)/libcares_la-ares_sysconfig_win.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ares_sysconfig_win.c' object='libcares_la-ares_sysconfig_win.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcares_la_CPPFLAGS) $(CPPFLAGS) $(libcares_la_CFLAGS) $(CFLAGS) -c -o libcares_la-ares_sysconfig_win.lo `test -f 'ares_sysconfig_win.c' || echo '$(srcdir)/'`ares_sysconfig_win.c
|
||||
|
||||
libcares_la-ares_timeout.lo: ares_timeout.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcares_la_CPPFLAGS) $(CPPFLAGS) $(libcares_la_CFLAGS) $(CFLAGS) -MT libcares_la-ares_timeout.lo -MD -MP -MF $(DEPDIR)/libcares_la-ares_timeout.Tpo -c -o libcares_la-ares_timeout.lo `test -f 'ares_timeout.c' || echo '$(srcdir)/'`ares_timeout.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcares_la-ares_timeout.Tpo $(DEPDIR)/libcares_la-ares_timeout.Plo
|
||||
|
@ -1755,6 +1788,7 @@ distclean: distclean-recursive
|
|||
-rm -f ./$(DEPDIR)/libcares_la-ares_data.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_destroy.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_dns_mapping.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_dns_multistring.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_dns_name.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_dns_parse.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_dns_record.Plo
|
||||
|
@ -1782,6 +1816,7 @@ distclean: distclean-recursive
|
|||
-rm -f ./$(DEPDIR)/libcares_la-ares_init.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_library_init.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_math.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_metrics.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_options.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_parse_a_reply.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_parse_aaaa_reply.Plo
|
||||
|
@ -1808,6 +1843,7 @@ distclean: distclean-recursive
|
|||
-rm -f ./$(DEPDIR)/libcares_la-ares_sysconfig.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_sysconfig_files.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_sysconfig_mac.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_sysconfig_win.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_timeout.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_update_servers.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_version.Plo
|
||||
|
@ -1883,6 +1919,7 @@ maintainer-clean: maintainer-clean-recursive
|
|||
-rm -f ./$(DEPDIR)/libcares_la-ares_data.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_destroy.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_dns_mapping.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_dns_multistring.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_dns_name.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_dns_parse.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_dns_record.Plo
|
||||
|
@ -1910,6 +1947,7 @@ maintainer-clean: maintainer-clean-recursive
|
|||
-rm -f ./$(DEPDIR)/libcares_la-ares_init.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_library_init.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_math.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_metrics.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_options.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_parse_a_reply.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_parse_aaaa_reply.Plo
|
||||
|
@ -1936,6 +1974,7 @@ maintainer-clean: maintainer-clean-recursive
|
|||
-rm -f ./$(DEPDIR)/libcares_la-ares_sysconfig.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_sysconfig_files.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_sysconfig_mac.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_sysconfig_win.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_timeout.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_update_servers.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_version.Plo
|
||||
|
|
21
deps/cares/src/lib/Makefile.inc
vendored
21
deps/cares/src/lib/Makefile.inc
vendored
|
@ -5,7 +5,7 @@ CSOURCES = ares__addrinfo2hostent.c \
|
|||
ares__addrinfo_localhost.c \
|
||||
ares__buf.c \
|
||||
ares__close_sockets.c \
|
||||
ares__hosts_file.c \
|
||||
ares__hosts_file.c \
|
||||
ares__htable.c \
|
||||
ares__htable_asvp.c \
|
||||
ares__htable_strvp.c \
|
||||
|
@ -24,11 +24,12 @@ CSOURCES = ares__addrinfo2hostent.c \
|
|||
ares_data.c \
|
||||
ares_destroy.c \
|
||||
ares_dns_mapping.c \
|
||||
ares_dns_multistring.c \
|
||||
ares_dns_name.c \
|
||||
ares_dns_parse.c \
|
||||
ares_dns_record.c \
|
||||
ares_dns_write.c \
|
||||
ares_event_configchg.c \
|
||||
ares_event_configchg.c \
|
||||
ares_event_epoll.c \
|
||||
ares_event_kqueue.c \
|
||||
ares_event_poll.c \
|
||||
|
@ -50,7 +51,8 @@ CSOURCES = ares__addrinfo2hostent.c \
|
|||
ares_getsock.c \
|
||||
ares_init.c \
|
||||
ares_library_init.c \
|
||||
ares_math.c \
|
||||
ares_math.c \
|
||||
ares_metrics.c \
|
||||
ares_create_query.c \
|
||||
ares_options.c \
|
||||
ares_parse_a_reply.c \
|
||||
|
@ -66,7 +68,7 @@ CSOURCES = ares__addrinfo2hostent.c \
|
|||
ares_parse_uri_reply.c \
|
||||
ares_platform.c \
|
||||
ares_process.c \
|
||||
ares_qcache.c \
|
||||
ares_qcache.c \
|
||||
ares_query.c \
|
||||
ares_rand.c \
|
||||
ares_search.c \
|
||||
|
@ -75,11 +77,12 @@ CSOURCES = ares__addrinfo2hostent.c \
|
|||
ares_str.c \
|
||||
ares_strerror.c \
|
||||
ares_strsplit.c \
|
||||
ares_sysconfig.c \
|
||||
ares_sysconfig_files.c \
|
||||
ares_sysconfig_mac.c \
|
||||
ares_sysconfig.c \
|
||||
ares_sysconfig_files.c \
|
||||
ares_sysconfig_mac.c \
|
||||
ares_sysconfig_win.c \
|
||||
ares_timeout.c \
|
||||
ares_update_servers.c \
|
||||
ares_update_servers.c \
|
||||
ares_version.c \
|
||||
inet_net_pton.c \
|
||||
inet_ntop.c \
|
||||
|
@ -97,6 +100,7 @@ HHEADERS = ares__buf.h \
|
|||
ares__threads.h \
|
||||
ares_android.h \
|
||||
ares_data.h \
|
||||
ares_dns_multistring.h \
|
||||
ares_dns_private.h \
|
||||
ares_event.h \
|
||||
ares_event_win32.h \
|
||||
|
@ -109,6 +113,5 @@ HHEADERS = ares__buf.h \
|
|||
ares_str.h \
|
||||
ares_strsplit.h \
|
||||
ares_setup.h \
|
||||
setup_once.h \
|
||||
thirdparty/apple/dnsinfo.h
|
||||
|
||||
|
|
14
deps/cares/src/lib/ares__addrinfo2hostent.c
vendored
14
deps/cares/src/lib/ares__addrinfo2hostent.c
vendored
|
@ -27,7 +27,7 @@
|
|||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include "ares_setup.h"
|
||||
#include "ares_private.h"
|
||||
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
# include <netinet/in.h>
|
||||
|
@ -47,8 +47,6 @@
|
|||
# include <limits.h>
|
||||
#endif
|
||||
|
||||
#include "ares.h"
|
||||
#include "ares_private.h"
|
||||
|
||||
ares_status_t ares__addrinfo2hostent(const struct ares_addrinfo *ai, int family,
|
||||
struct hostent **host)
|
||||
|
@ -165,13 +163,13 @@ ares_status_t ares__addrinfo2hostent(const struct ares_addrinfo *ai, int family,
|
|||
if (family == AF_INET6) {
|
||||
memcpy(
|
||||
(*host)->h_addr_list[i],
|
||||
&(CARES_INADDR_CAST(struct sockaddr_in6 *, next->ai_addr)->sin6_addr),
|
||||
&(CARES_INADDR_CAST(const struct sockaddr_in6 *, next->ai_addr)->sin6_addr),
|
||||
(size_t)(*host)->h_length);
|
||||
}
|
||||
if (family == AF_INET) {
|
||||
memcpy(
|
||||
(*host)->h_addr_list[i],
|
||||
&(CARES_INADDR_CAST(struct sockaddr_in *, next->ai_addr)->sin_addr),
|
||||
&(CARES_INADDR_CAST(const struct sockaddr_in *, next->ai_addr)->sin_addr),
|
||||
(size_t)(*host)->h_length);
|
||||
}
|
||||
++i;
|
||||
|
@ -195,7 +193,7 @@ enomem:
|
|||
ares_free_hostent(*host);
|
||||
*host = NULL;
|
||||
return ARES_ENOMEM;
|
||||
/* LCOV_EXCL_STOP */
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
ares_status_t ares__addrinfo2addrttl(const struct ares_addrinfo *ai, int family,
|
||||
|
@ -256,7 +254,7 @@ ares_status_t ares__addrinfo2addrttl(const struct ares_addrinfo *ai, int family,
|
|||
|
||||
memcpy(
|
||||
&addr6ttls[*naddrttls].ip6addr,
|
||||
&(CARES_INADDR_CAST(struct sockaddr_in6 *, next->ai_addr)->sin6_addr),
|
||||
&(CARES_INADDR_CAST(const struct sockaddr_in6 *, next->ai_addr)->sin6_addr),
|
||||
sizeof(struct ares_in6_addr));
|
||||
} else {
|
||||
if (next->ai_ttl > cname_ttl) {
|
||||
|
@ -266,7 +264,7 @@ ares_status_t ares__addrinfo2addrttl(const struct ares_addrinfo *ai, int family,
|
|||
}
|
||||
memcpy(
|
||||
&addrttls[*naddrttls].ipaddr,
|
||||
&(CARES_INADDR_CAST(struct sockaddr_in *, next->ai_addr)->sin_addr),
|
||||
&(CARES_INADDR_CAST(const struct sockaddr_in *, next->ai_addr)->sin_addr),
|
||||
sizeof(struct in_addr));
|
||||
}
|
||||
(*naddrttls)++;
|
||||
|
|
12
deps/cares/src/lib/ares__addrinfo_localhost.c
vendored
12
deps/cares/src/lib/ares__addrinfo_localhost.c
vendored
|
@ -25,7 +25,7 @@
|
|||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include "ares_setup.h"
|
||||
#include "ares_private.h"
|
||||
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
# include <netinet/in.h>
|
||||
|
@ -49,10 +49,6 @@
|
|||
# endif
|
||||
#endif
|
||||
|
||||
#include "ares.h"
|
||||
#include "ares_inet_net_pton.h"
|
||||
#include "ares_private.h"
|
||||
|
||||
ares_status_t ares_append_ai_node(int aftype, unsigned short port,
|
||||
unsigned int ttl, const void *adata,
|
||||
struct ares_addrinfo_node **nodes)
|
||||
|
@ -140,7 +136,7 @@ static ares_status_t
|
|||
!defined(__WATCOMC__)
|
||||
PMIB_UNICASTIPADDRESS_TABLE table;
|
||||
unsigned int i;
|
||||
ares_status_t status;
|
||||
ares_status_t status = ARES_ENOTFOUND;
|
||||
|
||||
*nodes = NULL;
|
||||
|
||||
|
@ -208,7 +204,7 @@ ares_status_t ares__addrinfo_localhost(const char *name, unsigned short port,
|
|||
case AF_INET6:
|
||||
case AF_UNSPEC:
|
||||
break;
|
||||
default: /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
default: /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
return ARES_EBADFAMILY; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
}
|
||||
|
||||
|
@ -233,5 +229,5 @@ enomem:
|
|||
ares_free(ai->name);
|
||||
ai->name = NULL;
|
||||
return ARES_ENOMEM;
|
||||
/* LCOV_EXCL_STOP */
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
|
129
deps/cares/src/lib/ares__buf.c
vendored
129
deps/cares/src/lib/ares__buf.c
vendored
|
@ -23,8 +23,6 @@
|
|||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
#include "ares_setup.h"
|
||||
#include "ares.h"
|
||||
#include "ares_private.h"
|
||||
#include "ares__buf.h"
|
||||
#include <limits.h>
|
||||
|
@ -839,7 +837,7 @@ ares_status_t ares__buf_split(ares__buf_t *buf, const unsigned char *delims,
|
|||
}
|
||||
|
||||
if (flags & ARES_BUF_SPLIT_RTRIM) {
|
||||
while (len && ares__is_whitespace(ptr[len - 1], ARES_TRUE)) {
|
||||
while (len > 0 && ares__is_whitespace(ptr[len - 1], ARES_TRUE)) {
|
||||
len--;
|
||||
}
|
||||
}
|
||||
|
@ -939,13 +937,13 @@ ares_status_t ares__buf_set_position(ares__buf_t *buf, size_t idx)
|
|||
return ARES_SUCCESS;
|
||||
}
|
||||
|
||||
static ares_status_t ares__buf_parse_dns_binstr_int(
|
||||
ares__buf_t *buf, size_t remaining_len, unsigned char **bin, size_t *bin_len,
|
||||
ares_bool_t allow_multiple, ares_bool_t validate_printable)
|
||||
ares_status_t ares__buf_parse_dns_abinstr(ares__buf_t *buf,
|
||||
size_t remaining_len,
|
||||
ares__dns_multistring_t **strs,
|
||||
ares_bool_t validate_printable)
|
||||
{
|
||||
unsigned char len;
|
||||
ares_status_t status;
|
||||
ares__buf_t *binbuf = NULL;
|
||||
ares_status_t status = ARES_EBADRESP;
|
||||
size_t orig_len = ares__buf_len(buf);
|
||||
|
||||
if (buf == NULL) {
|
||||
|
@ -956,9 +954,11 @@ static ares_status_t ares__buf_parse_dns_binstr_int(
|
|||
return ARES_EBADRESP;
|
||||
}
|
||||
|
||||
binbuf = ares__buf_create();
|
||||
if (binbuf == NULL) {
|
||||
return ARES_ENOMEM;
|
||||
if (strs != NULL) {
|
||||
*strs = ares__dns_multistring_create();
|
||||
if (*strs == NULL) {
|
||||
return ARES_ENOMEM;
|
||||
}
|
||||
}
|
||||
|
||||
while (orig_len - ares__buf_len(buf) < remaining_len) {
|
||||
|
@ -979,22 +979,88 @@ static ares_status_t ares__buf_parse_dns_binstr_int(
|
|||
}
|
||||
}
|
||||
|
||||
if (bin != NULL) {
|
||||
status = ares__buf_fetch_bytes_into_buf(buf, binbuf, len);
|
||||
if (strs != NULL) {
|
||||
unsigned char *data = NULL;
|
||||
status = ares__buf_fetch_bytes_dup(buf, len, ARES_TRUE, &data);
|
||||
if (status != ARES_SUCCESS) {
|
||||
break;
|
||||
}
|
||||
status = ares__dns_multistring_add_own(*strs, data, len);
|
||||
if (status != ARES_SUCCESS) {
|
||||
ares_free(data);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
status = ares__buf_consume(buf, len);
|
||||
if (status != ARES_SUCCESS) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (status != ARES_SUCCESS) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!allow_multiple) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (status != ARES_SUCCESS && strs != NULL) {
|
||||
ares__dns_multistring_destroy(*strs);
|
||||
*strs = NULL;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
static ares_status_t
|
||||
ares__buf_parse_dns_binstr_int(ares__buf_t *buf, size_t remaining_len,
|
||||
unsigned char **bin, size_t *bin_len,
|
||||
ares_bool_t validate_printable)
|
||||
{
|
||||
unsigned char len;
|
||||
ares_status_t status = ARES_EBADRESP;
|
||||
ares__buf_t *binbuf = NULL;
|
||||
|
||||
if (buf == NULL) {
|
||||
return ARES_EFORMERR;
|
||||
}
|
||||
|
||||
if (remaining_len == 0) {
|
||||
return ARES_EBADRESP;
|
||||
}
|
||||
|
||||
binbuf = ares__buf_create();
|
||||
if (binbuf == NULL) {
|
||||
return ARES_ENOMEM;
|
||||
}
|
||||
|
||||
status = ares__buf_fetch_bytes(buf, &len, 1);
|
||||
if (status != ARES_SUCCESS) {
|
||||
goto done; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
}
|
||||
|
||||
remaining_len--;
|
||||
|
||||
if (len > remaining_len) {
|
||||
status = ARES_EBADRESP;
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (len) {
|
||||
/* When used by the _str() parser, it really needs to be validated to
|
||||
* be a valid printable ascii string. Do that here */
|
||||
if (validate_printable && ares__buf_len(buf) >= len) {
|
||||
size_t mylen;
|
||||
const char *data = (const char *)ares__buf_peek(buf, &mylen);
|
||||
if (!ares__str_isprint(data, len)) {
|
||||
status = ARES_EBADSTR;
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
if (bin != NULL) {
|
||||
status = ares__buf_fetch_bytes_into_buf(buf, binbuf, len);
|
||||
} else {
|
||||
status = ares__buf_consume(buf, len);
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
if (status != ARES_SUCCESS) {
|
||||
ares__buf_destroy(binbuf);
|
||||
} else {
|
||||
|
@ -1012,20 +1078,19 @@ static ares_status_t ares__buf_parse_dns_binstr_int(
|
|||
}
|
||||
|
||||
ares_status_t ares__buf_parse_dns_binstr(ares__buf_t *buf, size_t remaining_len,
|
||||
unsigned char **bin, size_t *bin_len,
|
||||
ares_bool_t allow_multiple)
|
||||
unsigned char **bin, size_t *bin_len)
|
||||
{
|
||||
return ares__buf_parse_dns_binstr_int(buf, remaining_len, bin, bin_len,
|
||||
allow_multiple, ARES_FALSE);
|
||||
ARES_FALSE);
|
||||
}
|
||||
|
||||
ares_status_t ares__buf_parse_dns_str(ares__buf_t *buf, size_t remaining_len,
|
||||
char **str, ares_bool_t allow_multiple)
|
||||
char **str)
|
||||
{
|
||||
size_t len;
|
||||
|
||||
return ares__buf_parse_dns_binstr_int(
|
||||
buf, remaining_len, (unsigned char **)str, &len, allow_multiple, ARES_TRUE);
|
||||
return ares__buf_parse_dns_binstr_int(buf, remaining_len,
|
||||
(unsigned char **)str, &len, ARES_TRUE);
|
||||
}
|
||||
|
||||
ares_status_t ares__buf_append_num_dec(ares__buf_t *buf, size_t num, size_t len)
|
||||
|
@ -1187,24 +1252,24 @@ ares_status_t ares__buf_load_file(const char *filename, ares__buf_t *buf)
|
|||
/* Get length portably, fstat() is POSIX, not C */
|
||||
if (fseek(fp, 0, SEEK_END) != 0) {
|
||||
status = ARES_EFILE; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
goto done; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
goto done; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
}
|
||||
|
||||
ftell_len = ftell(fp);
|
||||
if (ftell_len < 0) {
|
||||
status = ARES_EFILE; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
goto done; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
goto done; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
}
|
||||
len = (size_t)ftell_len;
|
||||
|
||||
if (fseek(fp, 0, SEEK_SET) != 0) {
|
||||
status = ARES_EFILE; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
goto done; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
goto done; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
}
|
||||
|
||||
if (len == 0) {
|
||||
status = ARES_SUCCESS; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
goto done; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
goto done; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
}
|
||||
|
||||
/* Read entire data into buffer */
|
||||
|
@ -1212,13 +1277,13 @@ ares_status_t ares__buf_load_file(const char *filename, ares__buf_t *buf)
|
|||
ptr = ares__buf_append_start(buf, &ptr_len);
|
||||
if (ptr == NULL) {
|
||||
status = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
ptr_len = fread(ptr, 1, len, fp);
|
||||
if (ptr_len != len) {
|
||||
status = ARES_EFILE; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
goto done; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
goto done; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
}
|
||||
|
||||
ares__buf_append_finish(buf, len);
|
||||
|
|
32
deps/cares/src/lib/ares__buf.h
vendored
32
deps/cares/src/lib/ares__buf.h
vendored
|
@ -554,13 +554,31 @@ size_t ares__buf_get_position(const ares__buf_t *buf);
|
|||
* \param[out] name Pointer passed by reference to be filled in with
|
||||
* allocated string of the parsed that must be
|
||||
* ares_free()'d by the caller.
|
||||
* \param[in] allow_multiple ARES_TRUE if it should attempt to parse multiple
|
||||
* strings back to back, and will concatenate in
|
||||
* the returned str.
|
||||
* \return ARES_SUCCESS on success
|
||||
*/
|
||||
ares_status_t ares__buf_parse_dns_str(ares__buf_t *buf, size_t remaining_len,
|
||||
char **name, ares_bool_t allow_multiple);
|
||||
char **name);
|
||||
|
||||
/*! Parse an array of character strings as defined in RFC1035, as binary,
|
||||
* however, for convenience this does guarantee a NULL terminator (that is
|
||||
* not included in the length for each value).
|
||||
*
|
||||
* \param[in] buf initialized buffer object
|
||||
* \param[in] remaining_len maximum length that should be used for
|
||||
* parsing the string, this is often less than
|
||||
* the remaining buffer and is based on the RR
|
||||
* record length.
|
||||
* \param[out] strs Pointer passed by reference to be filled in
|
||||
* with
|
||||
* the array of values.
|
||||
* \param[out] validate_printable Validate the strings contain only printable
|
||||
* data.
|
||||
* \return ARES_SUCCESS on success
|
||||
*/
|
||||
ares_status_t ares__buf_parse_dns_abinstr(ares__buf_t *buf,
|
||||
size_t remaining_len,
|
||||
ares__dns_multistring_t **strs,
|
||||
ares_bool_t validate_printable);
|
||||
|
||||
/*! Parse a character-string as defined in RFC1035, as binary, however for
|
||||
* convenience this does guarantee a NULL terminator (that is not included
|
||||
|
@ -574,14 +592,10 @@ ares_status_t ares__buf_parse_dns_str(ares__buf_t *buf, size_t remaining_len,
|
|||
* allocated string of the parsed that must be
|
||||
* ares_free()'d by the caller.
|
||||
* \param[out] bin_len Length of returned string.
|
||||
* \param[in] allow_multiple ARES_TRUE if it should attempt to parse multiple
|
||||
* strings back to back, and will concatenate in
|
||||
* the returned str.
|
||||
* \return ARES_SUCCESS on success
|
||||
*/
|
||||
ares_status_t ares__buf_parse_dns_binstr(ares__buf_t *buf, size_t remaining_len,
|
||||
unsigned char **bin, size_t *bin_len,
|
||||
ares_bool_t allow_multiple);
|
||||
unsigned char **bin, size_t *bin_len);
|
||||
|
||||
/*! Load data from specified file path into provided buffer. The entire file
|
||||
* is loaded into memory.
|
||||
|
|
7
deps/cares/src/lib/ares__close_sockets.c
vendored
7
deps/cares/src/lib/ares__close_sockets.c
vendored
|
@ -25,16 +25,15 @@
|
|||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include "ares_setup.h"
|
||||
|
||||
#include "ares.h"
|
||||
#include "ares_private.h"
|
||||
#include <assert.h>
|
||||
|
||||
static void ares__requeue_queries(struct server_connection *conn)
|
||||
{
|
||||
struct query *query;
|
||||
ares_timeval_t now = ares__tvnow();
|
||||
ares_timeval_t now;
|
||||
|
||||
ares__tvnow(&now);
|
||||
|
||||
while ((query = ares__llist_first_val(conn->queries_to_conn)) != NULL) {
|
||||
ares__requeue_query(query, &now);
|
||||
|
|
37
deps/cares/src/lib/ares__hosts_file.c
vendored
37
deps/cares/src/lib/ares__hosts_file.c
vendored
|
@ -23,8 +23,6 @@
|
|||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
#include "ares_setup.h"
|
||||
#include "ares.h"
|
||||
#include "ares_private.h"
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
|
@ -316,7 +314,7 @@ static ares_status_t ares__hosts_file_add(ares_hosts_file_t *hosts,
|
|||
status = ares__hosts_file_merge_entry(hosts, match, entry, matchtype);
|
||||
if (status != ARES_SUCCESS) {
|
||||
ares__hosts_entry_destroy(entry); /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
return status; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
return status; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
}
|
||||
/* entry was invalidated above by merging */
|
||||
entry = match;
|
||||
|
@ -617,7 +615,8 @@ static ares_bool_t ares__hosts_expired(const char *filename,
|
|||
|
||||
/* Expire every 60s if we can't get a time */
|
||||
if (mod_ts == 0) {
|
||||
mod_ts = time(NULL) - 60; /* LCOV_EXCL_LINE: only on systems without stat() */
|
||||
mod_ts =
|
||||
time(NULL) - 60; /* LCOV_EXCL_LINE: only on systems without stat() */
|
||||
}
|
||||
|
||||
/* If filenames are different, its expired */
|
||||
|
@ -779,7 +778,7 @@ ares_status_t ares__hosts_entry_to_hostent(const ares_hosts_entry_t *entry,
|
|||
*hostent = ares_malloc_zero(sizeof(**hostent));
|
||||
if (*hostent == NULL) {
|
||||
status = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto fail; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto fail; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
(*hostent)->h_addrtype = (HOSTENT_ADDRTYPE_TYPE)family;
|
||||
|
@ -814,7 +813,7 @@ ares_status_t ares__hosts_entry_to_hostent(const ares_hosts_entry_t *entry,
|
|||
(idx + 2) * sizeof(*(*hostent)->h_addr_list));
|
||||
if (temp == NULL) {
|
||||
status = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto fail; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto fail; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
(*hostent)->h_addr_list = temp;
|
||||
|
@ -822,7 +821,7 @@ ares_status_t ares__hosts_entry_to_hostent(const ares_hosts_entry_t *entry,
|
|||
(*hostent)->h_addr_list[idx] = ares_malloc(ptr_len);
|
||||
if ((*hostent)->h_addr_list[idx] == NULL) {
|
||||
status = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto fail; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto fail; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
memcpy((*hostent)->h_addr_list[idx], ptr, ptr_len);
|
||||
|
@ -840,7 +839,7 @@ ares_status_t ares__hosts_entry_to_hostent(const ares_hosts_entry_t *entry,
|
|||
(*hostent)->h_name = ares_strdup(ares__llist_first_val(entry->hosts));
|
||||
if ((*hostent)->h_name == NULL) {
|
||||
status = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto fail; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto fail; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
/* Copy aliases */
|
||||
|
@ -856,7 +855,7 @@ ares_status_t ares__hosts_entry_to_hostent(const ares_hosts_entry_t *entry,
|
|||
ares_malloc_zero((naliases + 1) * sizeof(*(*hostent)->h_aliases));
|
||||
if ((*hostent)->h_aliases == NULL) {
|
||||
status = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto fail; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto fail; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
/* Copy all entries to the alias except the first */
|
||||
|
@ -867,7 +866,7 @@ ares_status_t ares__hosts_entry_to_hostent(const ares_hosts_entry_t *entry,
|
|||
(*hostent)->h_aliases[idx] = ares_strdup(ares__llist_node_val(node));
|
||||
if ((*hostent)->h_aliases[idx] == NULL) {
|
||||
status = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto fail; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto fail; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
idx++;
|
||||
|
||||
|
@ -885,7 +884,7 @@ fail:
|
|||
ares_free_hostent(*hostent);
|
||||
*hostent = NULL;
|
||||
return status;
|
||||
/* LCOV_EXCL_STOP */
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
static ares_status_t
|
||||
|
@ -917,19 +916,19 @@ static ares_status_t
|
|||
cname = ares__append_addrinfo_cname(&cnames);
|
||||
if (cname == NULL) {
|
||||
status = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
cname->alias = ares_strdup(host);
|
||||
if (cname->alias == NULL) {
|
||||
status = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
cname->name = ares_strdup(primaryhost);
|
||||
if (cname->name == NULL) {
|
||||
status = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
node = ares__llist_node_next(node);
|
||||
|
@ -940,13 +939,13 @@ static ares_status_t
|
|||
cname = ares__append_addrinfo_cname(&cnames);
|
||||
if (cname == NULL) {
|
||||
status = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
cname->name = ares_strdup(primaryhost);
|
||||
if (cname->name == NULL) {
|
||||
status = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
}
|
||||
status = ARES_SUCCESS;
|
||||
|
@ -954,7 +953,7 @@ static ares_status_t
|
|||
done:
|
||||
if (status != ARES_SUCCESS) {
|
||||
ares__freeaddrinfo_cnames(cnames); /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
return status; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
return status; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
}
|
||||
|
||||
*cnames_out = cnames;
|
||||
|
@ -977,14 +976,14 @@ ares_status_t ares__hosts_entry_to_addrinfo(const ares_hosts_entry_t *entry,
|
|||
case AF_INET6:
|
||||
case AF_UNSPEC:
|
||||
break;
|
||||
default: /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
default: /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
return ARES_EBADFAMILY; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
}
|
||||
|
||||
ai->name = ares_strdup(name);
|
||||
if (ai->name == NULL) {
|
||||
status = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
for (node = ares__llist_node_first(entry->ips); node != NULL;
|
||||
|
|
10
deps/cares/src/lib/ares__htable.c
vendored
10
deps/cares/src/lib/ares__htable.c
vendored
|
@ -23,8 +23,6 @@
|
|||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
#include "ares_setup.h"
|
||||
#include "ares.h"
|
||||
#include "ares_private.h"
|
||||
#include "ares__llist.h"
|
||||
#include "ares__htable.h"
|
||||
|
@ -207,7 +205,7 @@ static ares_bool_t ares__htable_expand(ares__htable_t *htable)
|
|||
* middle, we wouldn't be able to recover. */
|
||||
buckets = ares_malloc_zero(sizeof(*buckets) * htable->size);
|
||||
if (buckets == NULL) {
|
||||
goto done; /* LCOV_EXCL_LINE */
|
||||
goto done; /* LCOV_EXCL_LINE */
|
||||
}
|
||||
|
||||
/* The maximum number of new llists we'll need is the number of collisions
|
||||
|
@ -270,7 +268,7 @@ static ares_bool_t ares__htable_expand(ares__htable_t *htable)
|
|||
if (buckets[idx] == NULL) {
|
||||
/* Silence static analysis, this isn't possible but it doesn't know */
|
||||
if (prealloc_llist == NULL || prealloc_llist_len == 0) {
|
||||
goto done; /* LCOV_EXCL_LINE */
|
||||
goto done; /* LCOV_EXCL_LINE */
|
||||
}
|
||||
buckets[idx] = prealloc_llist[prealloc_llist_len - 1];
|
||||
prealloc_llist_len--;
|
||||
|
@ -304,7 +302,7 @@ done:
|
|||
|
||||
/* On failure, we need to restore the htable size */
|
||||
if (rv != ARES_TRUE) {
|
||||
htable->size = old_size; /* LCOV_EXCL_LINE */
|
||||
htable->size = old_size; /* LCOV_EXCL_LINE */
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
@ -336,7 +334,7 @@ ares_bool_t ares__htable_insert(ares__htable_t *htable, void *bucket)
|
|||
if (htable->num_keys + 1 >
|
||||
(htable->size * ARES__HTABLE_EXPAND_PERCENT) / 100) {
|
||||
if (!ares__htable_expand(htable)) {
|
||||
return ARES_FALSE; /* LCOV_EXCL_LINE */
|
||||
return ARES_FALSE; /* LCOV_EXCL_LINE */
|
||||
}
|
||||
/* If we expanded, need to calculate a new index */
|
||||
idx = HASH_IDX(htable, key);
|
||||
|
|
4
deps/cares/src/lib/ares__htable_asvp.c
vendored
4
deps/cares/src/lib/ares__htable_asvp.c
vendored
|
@ -23,8 +23,6 @@
|
|||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
#include "ares_setup.h"
|
||||
#include "ares.h"
|
||||
#include "ares_private.h"
|
||||
#include "ares__htable.h"
|
||||
#include "ares__htable_asvp.h"
|
||||
|
@ -134,7 +132,7 @@ ares_socket_t *ares__htable_asvp_keys(const ares__htable_asvp_t *htable,
|
|||
out = ares_malloc_zero(sizeof(*out) * cnt);
|
||||
if (out == NULL) {
|
||||
ares_free(buckets); /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
return NULL; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
return NULL; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
for (i = 0; i < cnt; i++) {
|
||||
|
|
2
deps/cares/src/lib/ares__htable_strvp.c
vendored
2
deps/cares/src/lib/ares__htable_strvp.c
vendored
|
@ -23,8 +23,6 @@
|
|||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
#include "ares_setup.h"
|
||||
#include "ares.h"
|
||||
#include "ares_private.h"
|
||||
#include "ares__htable.h"
|
||||
#include "ares__htable_strvp.h"
|
||||
|
|
2
deps/cares/src/lib/ares__htable_szvp.c
vendored
2
deps/cares/src/lib/ares__htable_szvp.c
vendored
|
@ -23,8 +23,6 @@
|
|||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
#include "ares_setup.h"
|
||||
#include "ares.h"
|
||||
#include "ares_private.h"
|
||||
#include "ares__htable.h"
|
||||
#include "ares__htable_szvp.h"
|
||||
|
|
4
deps/cares/src/lib/ares__htable_vpvp.c
vendored
4
deps/cares/src/lib/ares__htable_vpvp.c
vendored
|
@ -23,8 +23,6 @@
|
|||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
#include "ares_setup.h"
|
||||
#include "ares.h"
|
||||
#include "ares_private.h"
|
||||
#include "ares__htable.h"
|
||||
#include "ares__htable_vpvp.h"
|
||||
|
@ -114,7 +112,7 @@ fail:
|
|||
ares_free(htable);
|
||||
}
|
||||
return NULL;
|
||||
/* LCOV_EXCL_STOP */
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
ares_bool_t ares__htable_vpvp_insert(ares__htable_vpvp_t *htable, void *key,
|
||||
|
|
20
deps/cares/src/lib/ares__iface_ips.c
vendored
20
deps/cares/src/lib/ares__iface_ips.c
vendored
|
@ -23,8 +23,7 @@
|
|||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
#include "ares_setup.h"
|
||||
|
||||
#include "ares_private.h"
|
||||
|
||||
#ifdef USE_WINSOCK
|
||||
# include <winsock2.h>
|
||||
|
@ -55,9 +54,10 @@
|
|||
#ifdef HAVE_NETINET_IN_H
|
||||
# include <netinet/in.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETDB_H
|
||||
# include <netdb.h>
|
||||
#endif
|
||||
|
||||
#include "ares.h"
|
||||
#include "ares_private.h"
|
||||
|
||||
static ares_status_t ares__iface_ips_enumerate(ares__iface_ips_t *ips,
|
||||
const char *name);
|
||||
|
@ -89,7 +89,7 @@ static ares__iface_ips_t *ares__iface_ips_alloc(ares__iface_ip_flags_t flags)
|
|||
ips->ips = ares_malloc_zero(ips->alloc_size * sizeof(*ips->ips));
|
||||
if (ips->ips == NULL) {
|
||||
ares_free(ips); /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
return NULL; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
return NULL; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
ips->enum_flags = flags;
|
||||
return ips;
|
||||
|
@ -215,8 +215,8 @@ static ares_status_t
|
|||
/* Add */
|
||||
idx = ips->cnt++;
|
||||
|
||||
ips->ips[idx].flags = flags;
|
||||
ips->ips[idx].netmask = netmask;
|
||||
ips->ips[idx].flags = flags;
|
||||
ips->ips[idx].netmask = netmask;
|
||||
if (flags & ARES_IFACE_IP_LINKLOCAL) {
|
||||
ips->ips[idx].ll_scope = ll_scope;
|
||||
}
|
||||
|
@ -526,8 +526,9 @@ static ares_status_t ares__iface_ips_enumerate(ares__iface_ips_t *ips,
|
|||
unsigned int ares__if_nametoindex(const char *name)
|
||||
{
|
||||
#ifdef HAVE_IF_NAMETOINDEX
|
||||
if (name == NULL)
|
||||
if (name == NULL) {
|
||||
return 0;
|
||||
}
|
||||
return if_nametoindex(name);
|
||||
#else
|
||||
ares_status_t status;
|
||||
|
@ -535,8 +536,9 @@ unsigned int ares__if_nametoindex(const char *name)
|
|||
size_t i;
|
||||
unsigned int index = 0;
|
||||
|
||||
if (name == NULL)
|
||||
if (name == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
status =
|
||||
ares__iface_ips(&ips, ARES_IFACE_IP_V6 | ARES_IFACE_IP_LINKLOCAL, name);
|
||||
|
|
32
deps/cares/src/lib/ares__llist.c
vendored
32
deps/cares/src/lib/ares__llist.c
vendored
|
@ -23,8 +23,6 @@
|
|||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
#include "ares_setup.h"
|
||||
#include "ares.h"
|
||||
#include "ares_private.h"
|
||||
#include "ares__llist.h"
|
||||
|
||||
|
@ -186,6 +184,26 @@ ares__llist_node_t *ares__llist_node_first(ares__llist_t *list)
|
|||
return list->head;
|
||||
}
|
||||
|
||||
ares__llist_node_t *ares__llist_node_idx(ares__llist_t *list, size_t idx)
|
||||
{
|
||||
ares__llist_node_t *node;
|
||||
size_t cnt;
|
||||
|
||||
if (list == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
if (idx >= list->cnt) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
node = list->head;
|
||||
for (cnt = 0; node != NULL && cnt < idx; cnt++) {
|
||||
node = node->next;
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
ares__llist_node_t *ares__llist_node_last(ares__llist_t *list)
|
||||
{
|
||||
if (list == NULL) {
|
||||
|
@ -323,7 +341,7 @@ void ares__llist_node_replace(ares__llist_node_t *node, void *val)
|
|||
node->data = val;
|
||||
}
|
||||
|
||||
void ares__llist_destroy(ares__llist_t *list)
|
||||
void ares__llist_clear(ares__llist_t *list)
|
||||
{
|
||||
ares__llist_node_t *node;
|
||||
|
||||
|
@ -334,6 +352,14 @@ void ares__llist_destroy(ares__llist_t *list)
|
|||
while ((node = ares__llist_node_first(list)) != NULL) {
|
||||
ares__llist_node_destroy(node);
|
||||
}
|
||||
}
|
||||
|
||||
void ares__llist_destroy(ares__llist_t *list)
|
||||
{
|
||||
if (list == NULL) {
|
||||
return;
|
||||
}
|
||||
ares__llist_clear(list);
|
||||
ares_free(list);
|
||||
}
|
||||
|
||||
|
|
15
deps/cares/src/lib/ares__llist.h
vendored
15
deps/cares/src/lib/ares__llist.h
vendored
|
@ -122,6 +122,14 @@ ares__llist_node_t *ares__llist_node_first(ares__llist_t *list);
|
|||
*/
|
||||
ares__llist_node_t *ares__llist_node_last(ares__llist_t *list);
|
||||
|
||||
/*! Obtain a node based on its index. This is an O(n) operation.
|
||||
*
|
||||
* \param[in] list Initialized list object
|
||||
* \param[in] idx Index of node to retrieve
|
||||
* \return node at index or NULL if invalid index
|
||||
*/
|
||||
ares__llist_node_t *ares__llist_node_idx(ares__llist_t *list, size_t idx);
|
||||
|
||||
/*! Obtain next node in respect to specified node
|
||||
*
|
||||
* \param[in] node Node referenced
|
||||
|
@ -136,6 +144,7 @@ ares__llist_node_t *ares__llist_node_next(ares__llist_node_t *node);
|
|||
*/
|
||||
ares__llist_node_t *ares__llist_node_prev(ares__llist_node_t *node);
|
||||
|
||||
|
||||
/*! Obtain value from node
|
||||
*
|
||||
* \param[in] node Node referenced
|
||||
|
@ -150,6 +159,12 @@ void *ares__llist_node_val(ares__llist_node_t *node);
|
|||
*/
|
||||
size_t ares__llist_len(const ares__llist_t *list);
|
||||
|
||||
/*! Clear all entries in the list, but don't destroy the list object.
|
||||
*
|
||||
* \param[in] list Initialized list object
|
||||
*/
|
||||
void ares__llist_clear(ares__llist_t *list);
|
||||
|
||||
/*! Obtain list object from referenced node
|
||||
*
|
||||
* \param[in] node Node referenced
|
||||
|
|
12
deps/cares/src/lib/ares__parse_into_addrinfo.c
vendored
12
deps/cares/src/lib/ares__parse_into_addrinfo.c
vendored
|
@ -24,7 +24,7 @@
|
|||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
#include "ares_setup.h"
|
||||
#include "ares_private.h"
|
||||
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
# include <netinet/in.h>
|
||||
|
@ -44,8 +44,6 @@
|
|||
# include <limits.h>
|
||||
#endif
|
||||
|
||||
#include "ares.h"
|
||||
#include "ares_private.h"
|
||||
|
||||
ares_status_t ares__parse_into_addrinfo(const ares_dns_record_t *dnsrec,
|
||||
ares_bool_t cname_only_is_enodata,
|
||||
|
@ -108,18 +106,18 @@ ares_status_t ares__parse_into_addrinfo(const ares_dns_record_t *dnsrec,
|
|||
cname = ares__append_addrinfo_cname(&cnames);
|
||||
if (cname == NULL) {
|
||||
status = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
cname->ttl = (int)ares_dns_rr_get_ttl(rr);
|
||||
cname->alias = ares_strdup(ares_dns_rr_get_name(rr));
|
||||
if (cname->alias == NULL) {
|
||||
status = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
cname->name = ares_strdup(hostname);
|
||||
if (cname->name == NULL) {
|
||||
status = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
} else if (rtype == ARES_REC_TYPE_A) {
|
||||
got_a = ARES_TRUE;
|
||||
|
@ -154,7 +152,7 @@ ares_status_t ares__parse_into_addrinfo(const ares_dns_record_t *dnsrec,
|
|||
ai->name = ares_strdup(hostname);
|
||||
if (ai->name == NULL) {
|
||||
status = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
}
|
||||
|
||||
|
|
4
deps/cares/src/lib/ares__slist.c
vendored
4
deps/cares/src/lib/ares__slist.c
vendored
|
@ -23,8 +23,6 @@
|
|||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
#include "ares_setup.h"
|
||||
#include "ares.h"
|
||||
#include "ares_private.h"
|
||||
#include "ares__slist.h"
|
||||
|
||||
|
@ -254,7 +252,7 @@ fail:
|
|||
ares_free(node);
|
||||
}
|
||||
return NULL;
|
||||
/* LCOV_EXCL_STOP */
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
static void ares__slist_node_pop(ares__slist_node_t *node)
|
||||
|
|
8
deps/cares/src/lib/ares__socket.c
vendored
8
deps/cares/src/lib/ares__socket.c
vendored
|
@ -24,7 +24,7 @@
|
|||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
#include "ares_setup.h"
|
||||
#include "ares_private.h"
|
||||
|
||||
#ifdef HAVE_SYS_UIO_H
|
||||
# include <sys/uio.h>
|
||||
|
@ -56,8 +56,6 @@
|
|||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include "ares.h"
|
||||
#include "ares_private.h"
|
||||
|
||||
ares_ssize_t ares__socket_recvfrom(ares_channel_t *channel, ares_socket_t s,
|
||||
void *data, size_t data_len, int flags,
|
||||
|
@ -305,7 +303,7 @@ ares_status_t ares__open_connection(ares_channel_t *channel,
|
|||
setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (void *)&opt, sizeof(opt)) ==
|
||||
-1) {
|
||||
ares__close_socket(channel, s); /* LCOV_EXCL_LINE: UntestablePath */
|
||||
return ARES_ECONNREFUSED; /* LCOV_EXCL_LINE: UntestablePath */
|
||||
return ARES_ECONNREFUSED; /* LCOV_EXCL_LINE: UntestablePath */
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -339,7 +337,7 @@ ares_status_t ares__open_connection(ares_channel_t *channel,
|
|||
conn = ares_malloc(sizeof(*conn));
|
||||
if (conn == NULL) {
|
||||
ares__close_socket(channel, s); /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
return ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
return ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
memset(conn, 0, sizeof(*conn));
|
||||
conn->fd = s;
|
||||
|
|
4
deps/cares/src/lib/ares__sortaddrinfo.c
vendored
4
deps/cares/src/lib/ares__sortaddrinfo.c
vendored
|
@ -36,7 +36,7 @@
|
|||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include "ares_setup.h"
|
||||
#include "ares_private.h"
|
||||
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
# include <netinet/in.h>
|
||||
|
@ -51,8 +51,6 @@
|
|||
#include <assert.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include "ares.h"
|
||||
#include "ares_private.h"
|
||||
|
||||
struct addrinfo_sort_elem {
|
||||
struct ares_addrinfo_node *ai;
|
||||
|
|
25
deps/cares/src/lib/ares__threads.c
vendored
25
deps/cares/src/lib/ares__threads.c
vendored
|
@ -23,8 +23,6 @@
|
|||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
#include "ares_setup.h"
|
||||
#include "ares.h"
|
||||
#include "ares_private.h"
|
||||
|
||||
#ifdef CARES_THREADS
|
||||
|
@ -219,34 +217,22 @@ struct ares__thread_mutex {
|
|||
|
||||
ares__thread_mutex_t *ares__thread_mutex_create(void)
|
||||
{
|
||||
pthread_mutexattr_t attr;
|
||||
ares__thread_mutex_t *mut = ares_malloc_zero(sizeof(*mut));
|
||||
if (mut == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (pthread_mutexattr_init(&attr) != 0) {
|
||||
ares_free(mut); /* LCOV_EXCL_LINE: UntestablePath */
|
||||
return NULL; /* LCOV_EXCL_LINE: UntestablePath */
|
||||
}
|
||||
|
||||
if (pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE) != 0) {
|
||||
if (pthread_mutex_init(&mut->mutex, NULL) != 0) {
|
||||
goto fail; /* LCOV_EXCL_LINE: UntestablePath */
|
||||
}
|
||||
|
||||
if (pthread_mutex_init(&mut->mutex, &attr) != 0) {
|
||||
goto fail; /* LCOV_EXCL_LINE: UntestablePath */
|
||||
}
|
||||
|
||||
pthread_mutexattr_destroy(&attr);
|
||||
return mut;
|
||||
|
||||
/* LCOV_EXCL_START: UntestablePath */
|
||||
fail:
|
||||
pthread_mutexattr_destroy(&attr);
|
||||
ares_free(mut);
|
||||
return NULL;
|
||||
/* LCOV_EXCL_STOP */
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
void ares__thread_mutex_destroy(ares__thread_mutex_t *mut)
|
||||
|
@ -384,7 +370,7 @@ ares_status_t ares__thread_create(ares__thread_t **thread,
|
|||
return ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
if (pthread_create(&thr->thread, NULL, func, arg) != 0) {
|
||||
ares_free(thr); /* LCOV_EXCL_LINE: UntestablePath */
|
||||
ares_free(thr); /* LCOV_EXCL_LINE: UntestablePath */
|
||||
return ARES_ESERVFAIL; /* LCOV_EXCL_LINE: UntestablePath */
|
||||
}
|
||||
|
||||
|
@ -564,7 +550,7 @@ ares_status_t ares_queue_wait_empty(ares_channel_t *channel, int timeout_ms)
|
|||
}
|
||||
|
||||
if (timeout_ms >= 0) {
|
||||
tout = ares__tvnow();
|
||||
ares__tvnow(&tout);
|
||||
tout.sec += (ares_int64_t)(timeout_ms / 1000);
|
||||
tout.usec += (unsigned int)(timeout_ms % 1000) * 1000;
|
||||
}
|
||||
|
@ -575,9 +561,10 @@ ares_status_t ares_queue_wait_empty(ares_channel_t *channel, int timeout_ms)
|
|||
ares__thread_cond_wait(channel->cond_empty, channel->lock);
|
||||
} else {
|
||||
ares_timeval_t tv_remaining;
|
||||
ares_timeval_t tv_now = ares__tvnow();
|
||||
ares_timeval_t tv_now;
|
||||
unsigned long tms;
|
||||
|
||||
ares__tvnow(&tv_now);
|
||||
ares__timeval_remaining(&tv_remaining, &tv_now, &tout);
|
||||
tms =
|
||||
(unsigned long)((tv_remaining.sec * 1000) + (tv_remaining.usec / 1000));
|
||||
|
|
31
deps/cares/src/lib/ares__timeval.c
vendored
31
deps/cares/src/lib/ares__timeval.c
vendored
|
@ -24,64 +24,55 @@
|
|||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include "ares_setup.h"
|
||||
#include "ares.h"
|
||||
#include "ares_private.h"
|
||||
|
||||
#if defined(_WIN32) && !defined(MSDOS)
|
||||
|
||||
ares_timeval_t ares__tvnow(void)
|
||||
void ares__tvnow(ares_timeval_t *now)
|
||||
{
|
||||
/* GetTickCount64() is available on Windows Vista and higher */
|
||||
ares_timeval_t now;
|
||||
ULONGLONG milliseconds = GetTickCount64();
|
||||
|
||||
now.sec = (ares_int64_t)milliseconds / 1000;
|
||||
now.usec = (unsigned int)(milliseconds % 1000) * 1000;
|
||||
return now;
|
||||
now->sec = (ares_int64_t)milliseconds / 1000;
|
||||
now->usec = (unsigned int)(milliseconds % 1000) * 1000;
|
||||
}
|
||||
|
||||
#elif defined(HAVE_CLOCK_GETTIME_MONOTONIC)
|
||||
|
||||
ares_timeval_t ares__tvnow(void)
|
||||
void ares__tvnow(ares_timeval_t *now)
|
||||
{
|
||||
/* clock_gettime() is guaranteed to be increased monotonically when the
|
||||
* monotonic clock is queried. Time starting point is unspecified, it
|
||||
* could be the system start-up time, the Epoch, or something else,
|
||||
* in any case the time starting point does not change once that the
|
||||
* system has started up. */
|
||||
ares_timeval_t now;
|
||||
struct timespec tsnow;
|
||||
|
||||
if (clock_gettime(CLOCK_MONOTONIC, &tsnow) == 0) {
|
||||
now.sec = (ares_int64_t)tsnow.tv_sec;
|
||||
now.usec = (unsigned int)(tsnow.tv_nsec / 1000);
|
||||
now->sec = (ares_int64_t)tsnow.tv_sec;
|
||||
now->usec = (unsigned int)(tsnow.tv_nsec / 1000);
|
||||
} else {
|
||||
/* LCOV_EXCL_START: FallbackCode */
|
||||
struct timeval tv;
|
||||
(void)gettimeofday(&tv, NULL);
|
||||
now.sec = (ares_int64_t)tv.tv_sec;
|
||||
now.usec = (unsigned int)tv.tv_usec;
|
||||
now->sec = (ares_int64_t)tv.tv_sec;
|
||||
now->usec = (unsigned int)tv.tv_usec;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
return now;
|
||||
}
|
||||
|
||||
#elif defined(HAVE_GETTIMEOFDAY)
|
||||
|
||||
ares_timeval_t ares__tvnow(void)
|
||||
void ares__tvnow(ares_timeval_t *now)
|
||||
{
|
||||
/* gettimeofday() is not granted to be increased monotonically, due to
|
||||
* clock drifting and external source time synchronization it can jump
|
||||
* forward or backward in time. */
|
||||
ares_timeval_t now;
|
||||
struct timeval tv;
|
||||
|
||||
(void)gettimeofday(&tv, NULL);
|
||||
now.sec = (ares_int64_t)tv.tv_sec;
|
||||
now.usec = (unsigned int)tv.tv_usec;
|
||||
|
||||
return now;
|
||||
now->sec = (ares_int64_t)tv.tv_sec;
|
||||
now->usec = (unsigned int)tv.tv_usec;
|
||||
}
|
||||
|
||||
#else
|
||||
|
|
7
deps/cares/src/lib/ares_android.c
vendored
7
deps/cares/src/lib/ares_android.c
vendored
|
@ -24,13 +24,8 @@
|
|||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
#if defined(ANDROID) || defined(__ANDROID__)
|
||||
|
||||
# include <jni.h>
|
||||
|
||||
# include "ares_setup.h"
|
||||
# include "ares.h"
|
||||
# include "ares_android.h"
|
||||
# include "ares_private.h"
|
||||
# include <jni.h>
|
||||
|
||||
static JavaVM *android_jvm = NULL;
|
||||
static jobject android_connectivity_manager = NULL;
|
||||
|
|
6
deps/cares/src/lib/ares_cancel.c
vendored
6
deps/cares/src/lib/ares_cancel.c
vendored
|
@ -24,10 +24,6 @@
|
|||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include "ares_setup.h"
|
||||
#include <assert.h>
|
||||
|
||||
#include "ares.h"
|
||||
#include "ares_private.h"
|
||||
|
||||
/*
|
||||
|
@ -58,7 +54,7 @@ void ares_cancel(ares_channel_t *channel)
|
|||
* can't report to caller */
|
||||
if (channel->all_queries == NULL) {
|
||||
channel->all_queries = list_copy; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
node = ares__llist_node_first(list_copy);
|
||||
|
|
9
deps/cares/src/lib/ares_config.h.cmake
vendored
9
deps/cares/src/lib/ares_config.h.cmake
vendored
|
@ -377,12 +377,6 @@
|
|||
/* Define to 1 if you have the __system_property_get function */
|
||||
#cmakedefine HAVE___SYSTEM_PROPERTY_GET 1
|
||||
|
||||
/* Define to 1 if you need the malloc.h header file even with stdlib.h */
|
||||
#cmakedefine NEED_MALLOC_H 1
|
||||
|
||||
/* Define to 1 if you need the memory.h header file even with stdlib.h */
|
||||
#cmakedefine NEED_MEMORY_H 1
|
||||
|
||||
/* Define if have arc4random_buf() */
|
||||
#cmakedefine HAVE_ARC4RANDOM_BUF 1
|
||||
|
||||
|
@ -443,9 +437,6 @@
|
|||
/* Define to the function return type for recv. */
|
||||
#define RECV_TYPE_RETV @RECV_TYPE_RETV@
|
||||
|
||||
/* Define to the type qualifier of arg 2 for send. */
|
||||
#define SEND_QUAL_ARG2 @SEND_QUAL_ARG2@
|
||||
|
||||
/* Define to the type of arg 1 for send. */
|
||||
#define SEND_TYPE_ARG1 @SEND_TYPE_ARG1@
|
||||
|
||||
|
|
3
deps/cares/src/lib/ares_config.h.in
vendored
3
deps/cares/src/lib/ares_config.h.in
vendored
|
@ -451,9 +451,6 @@
|
|||
/* recv() return value */
|
||||
#undef RECV_TYPE_RETV
|
||||
|
||||
/* send() arg2 qualifier */
|
||||
#undef SEND_QUAL_ARG2
|
||||
|
||||
/* send() arg1 type */
|
||||
#undef SEND_TYPE_ARG1
|
||||
|
||||
|
|
2
deps/cares/src/lib/ares_create_query.c
vendored
2
deps/cares/src/lib/ares_create_query.c
vendored
|
@ -24,8 +24,6 @@
|
|||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include "ares_setup.h"
|
||||
#include "ares.h"
|
||||
#include "ares_private.h"
|
||||
|
||||
static int ares_create_query_int(const char *name, int dnsclass, int type,
|
||||
|
|
10
deps/cares/src/lib/ares_data.c
vendored
10
deps/cares/src/lib/ares_data.c
vendored
|
@ -24,14 +24,10 @@
|
|||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
|
||||
#include "ares_setup.h"
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include "ares.h"
|
||||
#include "ares_data.h"
|
||||
#include "ares_private.h"
|
||||
#include <stddef.h>
|
||||
#include <assert.h>
|
||||
#include "ares_data.h"
|
||||
|
||||
/*
|
||||
** ares_free_data() - c-ares external API function.
|
||||
|
|
6
deps/cares/src/lib/ares_destroy.c
vendored
6
deps/cares/src/lib/ares_destroy.c
vendored
|
@ -25,13 +25,9 @@
|
|||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include "ares_setup.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "ares.h"
|
||||
#include "ares_private.h"
|
||||
#include "ares_event.h"
|
||||
#include <assert.h>
|
||||
|
||||
void ares_destroy(ares_channel_t *channel)
|
||||
{
|
||||
|
|
26
deps/cares/src/lib/ares_dns_mapping.c
vendored
26
deps/cares/src/lib/ares_dns_mapping.c
vendored
|
@ -23,8 +23,6 @@
|
|||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
#include "ares_setup.h"
|
||||
#include "ares.h"
|
||||
#include "ares_private.h"
|
||||
|
||||
ares_bool_t ares_dns_opcode_isvalid(ares_dns_opcode_t opcode)
|
||||
|
@ -518,9 +516,11 @@ ares_dns_datatype_t ares_dns_rr_key_datatype(ares_dns_rr_key_t key)
|
|||
return ARES_DATATYPE_U8;
|
||||
|
||||
case ARES_RR_CAA_VALUE:
|
||||
case ARES_RR_TXT_DATA:
|
||||
return ARES_DATATYPE_BINP;
|
||||
|
||||
case ARES_RR_TXT_DATA:
|
||||
return ARES_DATATYPE_ABINP;
|
||||
|
||||
case ARES_RR_SIG_SIGNATURE:
|
||||
case ARES_RR_TLSA_DATA:
|
||||
case ARES_RR_RAW_RR_DATA:
|
||||
|
@ -548,18 +548,14 @@ static const ares_dns_rr_key_t rr_hinfo_keys[] = { ARES_RR_HINFO_CPU,
|
|||
ARES_RR_HINFO_OS };
|
||||
static const ares_dns_rr_key_t rr_mx_keys[] = { ARES_RR_MX_PREFERENCE,
|
||||
ARES_RR_MX_EXCHANGE };
|
||||
static const ares_dns_rr_key_t rr_sig_keys[] = { ARES_RR_SIG_TYPE_COVERED,
|
||||
ARES_RR_SIG_ALGORITHM,
|
||||
ARES_RR_SIG_LABELS,
|
||||
ARES_RR_SIG_ORIGINAL_TTL,
|
||||
ARES_RR_SIG_EXPIRATION,
|
||||
ARES_RR_SIG_INCEPTION,
|
||||
ARES_RR_SIG_KEY_TAG,
|
||||
ARES_RR_SIG_SIGNERS_NAME,
|
||||
ARES_RR_SIG_SIGNATURE };
|
||||
static const ares_dns_rr_key_t rr_txt_keys[] = { ARES_RR_TXT_DATA };
|
||||
static const ares_dns_rr_key_t rr_aaaa_keys[] = { ARES_RR_AAAA_ADDR };
|
||||
static const ares_dns_rr_key_t rr_srv_keys[] = {
|
||||
static const ares_dns_rr_key_t rr_sig_keys[] = {
|
||||
ARES_RR_SIG_TYPE_COVERED, ARES_RR_SIG_ALGORITHM, ARES_RR_SIG_LABELS,
|
||||
ARES_RR_SIG_ORIGINAL_TTL, ARES_RR_SIG_EXPIRATION, ARES_RR_SIG_INCEPTION,
|
||||
ARES_RR_SIG_KEY_TAG, ARES_RR_SIG_SIGNERS_NAME, ARES_RR_SIG_SIGNATURE
|
||||
};
|
||||
static const ares_dns_rr_key_t rr_txt_keys[] = { ARES_RR_TXT_DATA };
|
||||
static const ares_dns_rr_key_t rr_aaaa_keys[] = { ARES_RR_AAAA_ADDR };
|
||||
static const ares_dns_rr_key_t rr_srv_keys[] = {
|
||||
ARES_RR_SRV_PRIORITY, ARES_RR_SRV_WEIGHT, ARES_RR_SRV_PORT, ARES_RR_SRV_TARGET
|
||||
};
|
||||
static const ares_dns_rr_key_t rr_naptr_keys[] = {
|
||||
|
|
207
deps/cares/src/lib/ares_dns_multistring.c
vendored
Normal file
207
deps/cares/src/lib/ares_dns_multistring.c
vendored
Normal file
|
@ -0,0 +1,207 @@
|
|||
/* MIT License
|
||||
*
|
||||
* Copyright (c) 2024 Brad House
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
#include "ares_private.h"
|
||||
#include "ares_dns_private.h"
|
||||
|
||||
typedef struct {
|
||||
unsigned char *data;
|
||||
size_t len;
|
||||
} multistring_data_t;
|
||||
|
||||
struct ares__dns_multistring {
|
||||
/*! whether or not cached concatenated string is valid */
|
||||
ares_bool_t cache_invalidated;
|
||||
/*! combined/concatenated string cache */
|
||||
unsigned char *cache_str;
|
||||
/*! length of combined/concatenated string */
|
||||
size_t cache_str_len;
|
||||
/*! Data making up strings */
|
||||
multistring_data_t *strs;
|
||||
size_t cnt;
|
||||
size_t alloc;
|
||||
};
|
||||
|
||||
ares__dns_multistring_t *ares__dns_multistring_create(void)
|
||||
{
|
||||
return ares_malloc_zero(sizeof(ares__dns_multistring_t));
|
||||
}
|
||||
|
||||
void ares__dns_multistring_clear(ares__dns_multistring_t *strs)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
if (strs == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < strs->cnt; i++) {
|
||||
ares_free(strs->strs[i].data);
|
||||
memset(&strs->strs[i], 0, sizeof(strs->strs[i]));
|
||||
}
|
||||
strs->cnt = 0;
|
||||
}
|
||||
|
||||
void ares__dns_multistring_destroy(ares__dns_multistring_t *strs)
|
||||
{
|
||||
if (strs == NULL) {
|
||||
return;
|
||||
}
|
||||
ares__dns_multistring_clear(strs);
|
||||
ares_free(strs->strs);
|
||||
ares_free(strs->cache_str);
|
||||
ares_free(strs);
|
||||
}
|
||||
|
||||
ares_status_t ares__dns_multistring_replace_own(ares__dns_multistring_t *strs,
|
||||
size_t idx, unsigned char *str,
|
||||
size_t len)
|
||||
{
|
||||
if (strs == NULL || str == NULL || len == 0 || idx >= strs->cnt) {
|
||||
return ARES_EFORMERR;
|
||||
}
|
||||
|
||||
strs->cache_invalidated = ARES_TRUE;
|
||||
ares_free(strs->strs[idx].data);
|
||||
strs->strs[idx].data = str;
|
||||
strs->strs[idx].len = len;
|
||||
return ARES_SUCCESS;
|
||||
}
|
||||
|
||||
ares_status_t ares__dns_multistring_del(ares__dns_multistring_t *strs,
|
||||
size_t idx)
|
||||
{
|
||||
size_t move_cnt;
|
||||
|
||||
if (strs == NULL || idx >= strs->cnt) {
|
||||
return ARES_EFORMERR;
|
||||
}
|
||||
|
||||
strs->cache_invalidated = ARES_TRUE;
|
||||
|
||||
ares_free(strs->strs[idx].data);
|
||||
|
||||
move_cnt = strs->cnt - idx - 1;
|
||||
if (move_cnt) {
|
||||
memmove(&strs->strs[idx], &strs->strs[idx + 1],
|
||||
sizeof(*strs->strs) * move_cnt);
|
||||
}
|
||||
|
||||
strs->cnt--;
|
||||
return ARES_SUCCESS;
|
||||
}
|
||||
|
||||
ares_status_t ares__dns_multistring_add_own(ares__dns_multistring_t *strs,
|
||||
unsigned char *str, size_t len)
|
||||
{
|
||||
if (strs == NULL) {
|
||||
return ARES_EFORMERR;
|
||||
}
|
||||
|
||||
strs->cache_invalidated = ARES_TRUE;
|
||||
|
||||
/* NOTE: its ok to have an empty string added */
|
||||
if (str == NULL && len != 0) {
|
||||
return ARES_EFORMERR;
|
||||
}
|
||||
|
||||
if (strs->alloc < strs->cnt + 1) {
|
||||
size_t newalloc = (strs->alloc == 0) ? 1 : (strs->alloc << 1);
|
||||
void *ptr = ares_realloc_zero(strs->strs, strs->alloc * sizeof(*strs->strs),
|
||||
(newalloc) * sizeof(*strs->strs));
|
||||
if (ptr == NULL) {
|
||||
return ARES_ENOMEM;
|
||||
}
|
||||
strs->strs = ptr;
|
||||
strs->alloc = newalloc;
|
||||
}
|
||||
|
||||
strs->strs[strs->cnt].data = str;
|
||||
strs->strs[strs->cnt].len = len;
|
||||
strs->cnt++;
|
||||
|
||||
return ARES_SUCCESS;
|
||||
}
|
||||
|
||||
size_t ares__dns_multistring_cnt(const ares__dns_multistring_t *strs)
|
||||
{
|
||||
if (strs == NULL) {
|
||||
return 0;
|
||||
}
|
||||
return strs->cnt;
|
||||
}
|
||||
|
||||
const unsigned char *ares__dns_multistring_get(
|
||||
const ares__dns_multistring_t *strs, size_t idx, size_t *len)
|
||||
{
|
||||
if (strs == NULL || idx >= strs->cnt || len == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
*len = strs->strs[idx].len;
|
||||
return strs->strs[idx].data;
|
||||
}
|
||||
|
||||
const unsigned char *
|
||||
ares__dns_multistring_get_combined(ares__dns_multistring_t *strs, size_t *len)
|
||||
{
|
||||
ares__buf_t *buf = NULL;
|
||||
size_t i;
|
||||
|
||||
if (strs == NULL || len == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
*len = 0;
|
||||
|
||||
/* Return cache if possible */
|
||||
if (!strs->cache_invalidated) {
|
||||
*len = strs->cache_str_len;
|
||||
return strs->cache_str;
|
||||
}
|
||||
|
||||
/* Clear cache */
|
||||
ares_free(strs->cache_str);
|
||||
strs->cache_str = NULL;
|
||||
strs->cache_str_len = 0;
|
||||
|
||||
buf = ares__buf_create();
|
||||
|
||||
for (i = 0; i < strs->cnt; i++) {
|
||||
if (ares__buf_append(buf, strs->strs[i].data, strs->strs[i].len) !=
|
||||
ARES_SUCCESS) {
|
||||
ares__buf_destroy(buf);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
strs->cache_str =
|
||||
(unsigned char *)ares__buf_finish_str(buf, &strs->cache_str_len);
|
||||
if (strs->cache_str != NULL) {
|
||||
strs->cache_invalidated = ARES_FALSE;
|
||||
}
|
||||
*len = strs->cache_str_len;
|
||||
return strs->cache_str;
|
||||
}
|
49
deps/cares/src/lib/ares_dns_multistring.h
vendored
Normal file
49
deps/cares/src/lib/ares_dns_multistring.h
vendored
Normal file
|
@ -0,0 +1,49 @@
|
|||
/* MIT License
|
||||
*
|
||||
* Copyright (c) 2024 Brad House
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
#ifndef __ARES_DNS_MULTISTRING_H
|
||||
#define __ARES_DNS_MULTISTRING_H
|
||||
|
||||
struct ares__dns_multistring;
|
||||
typedef struct ares__dns_multistring ares__dns_multistring_t;
|
||||
|
||||
ares__dns_multistring_t *ares__dns_multistring_create(void);
|
||||
void ares__dns_multistring_clear(ares__dns_multistring_t *strs);
|
||||
void ares__dns_multistring_destroy(ares__dns_multistring_t *strs);
|
||||
ares_status_t ares__dns_multistring_replace_own(ares__dns_multistring_t *strs,
|
||||
size_t idx, unsigned char *str,
|
||||
size_t len);
|
||||
ares_status_t ares__dns_multistring_del(ares__dns_multistring_t *strs,
|
||||
size_t idx);
|
||||
ares_status_t ares__dns_multistring_add_own(ares__dns_multistring_t *strs,
|
||||
unsigned char *str, size_t len);
|
||||
size_t ares__dns_multistring_cnt(const ares__dns_multistring_t *strs);
|
||||
const unsigned char *ares__dns_multistring_get(
|
||||
const ares__dns_multistring_t *strs, size_t idx, size_t *len);
|
||||
const unsigned char *
|
||||
ares__dns_multistring_get_combined(ares__dns_multistring_t *strs,
|
||||
size_t *len);
|
||||
|
||||
#endif
|
21
deps/cares/src/lib/ares_dns_name.c
vendored
21
deps/cares/src/lib/ares_dns_name.c
vendored
|
@ -23,8 +23,6 @@
|
|||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
#include "ares_setup.h"
|
||||
#include "ares.h"
|
||||
#include "ares_private.h"
|
||||
|
||||
typedef struct {
|
||||
|
@ -59,7 +57,7 @@ static ares_status_t ares__nameoffset_create(ares__llist_t **list,
|
|||
}
|
||||
if (*list == NULL) {
|
||||
status = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto fail; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto fail; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
off = ares_malloc_zero(sizeof(*off));
|
||||
|
@ -73,7 +71,7 @@ static ares_status_t ares__nameoffset_create(ares__llist_t **list,
|
|||
|
||||
if (ares__llist_insert_last(*list, off) == NULL) {
|
||||
status = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto fail; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto fail; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
return ARES_SUCCESS;
|
||||
|
@ -82,7 +80,7 @@ static ares_status_t ares__nameoffset_create(ares__llist_t **list,
|
|||
fail:
|
||||
ares__nameoffset_free(off);
|
||||
return status;
|
||||
/* LCOV_EXCL_STOP */
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
static const ares_nameoffset_t *ares__nameoffset_find(ares__llist_t *list,
|
||||
|
@ -113,7 +111,10 @@ static const ares_nameoffset_t *ares__nameoffset_find(ares__llist_t *list,
|
|||
|
||||
prefix_len = name_len - val->name_len;
|
||||
|
||||
if (strcasecmp(val->name, name + prefix_len) != 0) {
|
||||
/* Due to DNS 0x20, lets not inadvertently mangle things, use case-sensitive
|
||||
* matching instead of case-insensitive. This may result in slightly
|
||||
* larger DNS queries overall. */
|
||||
if (strcmp(val->name, name + prefix_len) != 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -269,7 +270,7 @@ static ares_status_t ares_split_dns_name(ares_dns_labels_t *labels,
|
|||
namebuf = ares__buf_create();
|
||||
if (namebuf == NULL) {
|
||||
status = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
if (*name != '\0') {
|
||||
|
@ -284,7 +285,7 @@ static ares_status_t ares_split_dns_name(ares_dns_labels_t *labels,
|
|||
label = ares_dns_labels_add(labels);
|
||||
if (label == NULL) {
|
||||
status = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
while (ares__buf_fetch_bytes(namebuf, &c, 1) == ARES_SUCCESS) {
|
||||
|
@ -293,7 +294,7 @@ static ares_status_t ares_split_dns_name(ares_dns_labels_t *labels,
|
|||
label = ares_dns_labels_add(labels);
|
||||
if (label == NULL) {
|
||||
status = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
@ -663,7 +664,7 @@ ares_status_t ares__dns_name_parse(ares__buf_t *buf, char **name,
|
|||
*name = ares__buf_finish_str(namebuf, NULL);
|
||||
if (*name == NULL) {
|
||||
status = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto fail; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto fail; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
}
|
||||
|
||||
|
|
46
deps/cares/src/lib/ares_dns_parse.c
vendored
46
deps/cares/src/lib/ares_dns_parse.c
vendored
|
@ -23,8 +23,6 @@
|
|||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
#include "ares_setup.h"
|
||||
#include "ares.h"
|
||||
#include "ares_private.h"
|
||||
#include <limits.h>
|
||||
#ifdef HAVE_STDINT_H
|
||||
|
@ -62,14 +60,16 @@ static ares_status_t ares_dns_parse_and_set_dns_name(ares__buf_t *buf,
|
|||
return ARES_SUCCESS;
|
||||
}
|
||||
|
||||
static ares_status_t ares_dns_parse_and_set_dns_str(
|
||||
ares__buf_t *buf, size_t max_len, ares_bool_t allow_multiple,
|
||||
ares_dns_rr_t *rr, ares_dns_rr_key_t key, ares_bool_t blank_allowed)
|
||||
static ares_status_t ares_dns_parse_and_set_dns_str(ares__buf_t *buf,
|
||||
size_t max_len,
|
||||
ares_dns_rr_t *rr,
|
||||
ares_dns_rr_key_t key,
|
||||
ares_bool_t blank_allowed)
|
||||
{
|
||||
ares_status_t status;
|
||||
char *str = NULL;
|
||||
|
||||
status = ares__buf_parse_dns_str(buf, max_len, &str, allow_multiple);
|
||||
status = ares__buf_parse_dns_str(buf, max_len, &str);
|
||||
if (status != ARES_SUCCESS) {
|
||||
return status;
|
||||
}
|
||||
|
@ -88,23 +88,21 @@ static ares_status_t ares_dns_parse_and_set_dns_str(
|
|||
}
|
||||
|
||||
static ares_status_t
|
||||
ares_dns_parse_and_set_dns_binstr(ares__buf_t *buf, size_t max_len,
|
||||
ares_bool_t allow_multiple,
|
||||
ares_dns_rr_t *rr, ares_dns_rr_key_t key)
|
||||
ares_dns_parse_and_set_dns_abin(ares__buf_t *buf, size_t max_len,
|
||||
ares_dns_rr_t *rr, ares_dns_rr_key_t key,
|
||||
ares_bool_t validate_printable)
|
||||
{
|
||||
ares_status_t status;
|
||||
unsigned char *bin = NULL;
|
||||
size_t bin_len = 0;
|
||||
ares_status_t status;
|
||||
ares__dns_multistring_t *strs = NULL;
|
||||
|
||||
status =
|
||||
ares__buf_parse_dns_binstr(buf, max_len, &bin, &bin_len, allow_multiple);
|
||||
status = ares__buf_parse_dns_abinstr(buf, max_len, &strs, validate_printable);
|
||||
if (status != ARES_SUCCESS) {
|
||||
return status;
|
||||
}
|
||||
|
||||
status = ares_dns_rr_set_bin_own(rr, key, bin, bin_len);
|
||||
status = ares_dns_rr_set_abin_own(rr, key, strs);
|
||||
if (status != ARES_SUCCESS) {
|
||||
ares_free(bin);
|
||||
ares__dns_multistring_destroy(strs);
|
||||
return status;
|
||||
}
|
||||
return ARES_SUCCESS;
|
||||
|
@ -257,7 +255,7 @@ static ares_status_t ares_dns_parse_rr_hinfo(ares__buf_t *buf,
|
|||
|
||||
/* CPU */
|
||||
status = ares_dns_parse_and_set_dns_str(
|
||||
buf, ares_dns_rr_remaining_len(buf, orig_len, rdlength), ARES_FALSE, rr,
|
||||
buf, ares_dns_rr_remaining_len(buf, orig_len, rdlength), rr,
|
||||
ARES_RR_HINFO_CPU, ARES_TRUE);
|
||||
if (status != ARES_SUCCESS) {
|
||||
return status;
|
||||
|
@ -265,7 +263,7 @@ static ares_status_t ares_dns_parse_rr_hinfo(ares__buf_t *buf,
|
|||
|
||||
/* OS */
|
||||
status = ares_dns_parse_and_set_dns_str(
|
||||
buf, ares_dns_rr_remaining_len(buf, orig_len, rdlength), ARES_FALSE, rr,
|
||||
buf, ares_dns_rr_remaining_len(buf, orig_len, rdlength), rr,
|
||||
ARES_RR_HINFO_OS, ARES_TRUE);
|
||||
|
||||
return status;
|
||||
|
@ -292,8 +290,8 @@ static ares_status_t ares_dns_parse_rr_mx(ares__buf_t *buf, ares_dns_rr_t *rr,
|
|||
static ares_status_t ares_dns_parse_rr_txt(ares__buf_t *buf, ares_dns_rr_t *rr,
|
||||
size_t rdlength)
|
||||
{
|
||||
return ares_dns_parse_and_set_dns_binstr(buf, rdlength, ARES_TRUE, rr,
|
||||
ARES_RR_TXT_DATA);
|
||||
return ares_dns_parse_and_set_dns_abin(buf, rdlength, rr, ARES_RR_TXT_DATA,
|
||||
ARES_FALSE);
|
||||
}
|
||||
|
||||
static ares_status_t ares_dns_parse_rr_sig(ares__buf_t *buf, ares_dns_rr_t *rr,
|
||||
|
@ -430,7 +428,7 @@ static ares_status_t ares_dns_parse_rr_naptr(ares__buf_t *buf,
|
|||
|
||||
/* FLAGS */
|
||||
status = ares_dns_parse_and_set_dns_str(
|
||||
buf, ares_dns_rr_remaining_len(buf, orig_len, rdlength), ARES_FALSE, rr,
|
||||
buf, ares_dns_rr_remaining_len(buf, orig_len, rdlength), rr,
|
||||
ARES_RR_NAPTR_FLAGS, ARES_TRUE);
|
||||
if (status != ARES_SUCCESS) {
|
||||
return status;
|
||||
|
@ -438,7 +436,7 @@ static ares_status_t ares_dns_parse_rr_naptr(ares__buf_t *buf,
|
|||
|
||||
/* SERVICES */
|
||||
status = ares_dns_parse_and_set_dns_str(
|
||||
buf, ares_dns_rr_remaining_len(buf, orig_len, rdlength), ARES_FALSE, rr,
|
||||
buf, ares_dns_rr_remaining_len(buf, orig_len, rdlength), rr,
|
||||
ARES_RR_NAPTR_SERVICES, ARES_TRUE);
|
||||
if (status != ARES_SUCCESS) {
|
||||
return status;
|
||||
|
@ -446,7 +444,7 @@ static ares_status_t ares_dns_parse_rr_naptr(ares__buf_t *buf,
|
|||
|
||||
/* REGEXP */
|
||||
status = ares_dns_parse_and_set_dns_str(
|
||||
buf, ares_dns_rr_remaining_len(buf, orig_len, rdlength), ARES_FALSE, rr,
|
||||
buf, ares_dns_rr_remaining_len(buf, orig_len, rdlength), rr,
|
||||
ARES_RR_NAPTR_REGEXP, ARES_TRUE);
|
||||
if (status != ARES_SUCCESS) {
|
||||
return status;
|
||||
|
@ -731,7 +729,7 @@ static ares_status_t ares_dns_parse_rr_caa(ares__buf_t *buf, ares_dns_rr_t *rr,
|
|||
|
||||
/* Tag */
|
||||
status = ares_dns_parse_and_set_dns_str(
|
||||
buf, ares_dns_rr_remaining_len(buf, orig_len, rdlength), ARES_FALSE, rr,
|
||||
buf, ares_dns_rr_remaining_len(buf, orig_len, rdlength), rr,
|
||||
ARES_RR_CAA_TAG, ARES_FALSE);
|
||||
if (status != ARES_SUCCESS) {
|
||||
return status;
|
||||
|
|
6
deps/cares/src/lib/ares_dns_private.h
vendored
6
deps/cares/src/lib/ares_dns_private.h
vendored
|
@ -41,6 +41,9 @@ ares_status_t ares_dns_rr_set_str_own(ares_dns_rr_t *dns_rr,
|
|||
ares_status_t ares_dns_rr_set_bin_own(ares_dns_rr_t *dns_rr,
|
||||
ares_dns_rr_key_t key, unsigned char *val,
|
||||
size_t len);
|
||||
ares_status_t ares_dns_rr_set_abin_own(ares_dns_rr_t *dns_rr,
|
||||
ares_dns_rr_key_t key,
|
||||
ares__dns_multistring_t *strs);
|
||||
ares_status_t ares_dns_rr_set_opt_own(ares_dns_rr_t *dns_rr,
|
||||
ares_dns_rr_key_t key, unsigned short opt,
|
||||
unsigned char *val, size_t val_len);
|
||||
|
@ -120,8 +123,7 @@ typedef struct {
|
|||
} ares__dns_mx_t;
|
||||
|
||||
typedef struct {
|
||||
char *data;
|
||||
size_t data_len;
|
||||
ares__dns_multistring_t *strs;
|
||||
} ares__dns_txt_t;
|
||||
|
||||
typedef struct {
|
||||
|
|
192
deps/cares/src/lib/ares_dns_record.c
vendored
192
deps/cares/src/lib/ares_dns_record.c
vendored
|
@ -23,8 +23,6 @@
|
|||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
#include "ares_setup.h"
|
||||
#include "ares.h"
|
||||
#include "ares_private.h"
|
||||
#include <limits.h>
|
||||
#ifdef HAVE_STDINT_H
|
||||
|
@ -68,6 +66,15 @@ unsigned short ares_dns_record_get_id(const ares_dns_record_t *dnsrec)
|
|||
return dnsrec->id;
|
||||
}
|
||||
|
||||
ares_bool_t ares_dns_record_set_id(ares_dns_record_t *dnsrec, unsigned short id)
|
||||
{
|
||||
if (dnsrec == NULL) {
|
||||
return ARES_FALSE;
|
||||
}
|
||||
dnsrec->id = id;
|
||||
return ARES_TRUE;
|
||||
}
|
||||
|
||||
unsigned short ares_dns_record_get_flags(const ares_dns_record_t *dnsrec)
|
||||
{
|
||||
if (dnsrec == NULL) {
|
||||
|
@ -145,7 +152,7 @@ static void ares__dns_rr_free(ares_dns_rr_t *rr)
|
|||
break;
|
||||
|
||||
case ARES_REC_TYPE_TXT:
|
||||
ares_free(rr->r.txt.data);
|
||||
ares__dns_multistring_destroy(rr->r.txt.strs);
|
||||
break;
|
||||
|
||||
case ARES_REC_TYPE_SIG:
|
||||
|
@ -293,7 +300,7 @@ ares_status_t ares_dns_record_query_set_name(ares_dns_record_t *dnsrec,
|
|||
dnsrec->qd[idx].name = ares_strdup(name);
|
||||
if (dnsrec->qd[idx].name == NULL) {
|
||||
dnsrec->qd[idx].name = orig_name; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
return ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
return ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
ares_free(orig_name);
|
||||
|
@ -664,11 +671,7 @@ static void *ares_dns_rr_data_ptr(ares_dns_rr_t *dns_rr, ares_dns_rr_key_t key,
|
|||
return &dns_rr->r.sig.signature;
|
||||
|
||||
case ARES_RR_TXT_DATA:
|
||||
if (lenptr == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
*lenptr = &dns_rr->r.txt.data_len;
|
||||
return &dns_rr->r.txt.data;
|
||||
return &dns_rr->r.txt.strs;
|
||||
|
||||
case ARES_RR_SRV_PRIORITY:
|
||||
return &dns_rr->r.srv.priority;
|
||||
|
@ -883,26 +886,138 @@ const unsigned char *ares_dns_rr_get_bin(const ares_dns_rr_t *dns_rr,
|
|||
size_t const *bin_len = NULL;
|
||||
|
||||
if ((ares_dns_rr_key_datatype(key) != ARES_DATATYPE_BIN &&
|
||||
ares_dns_rr_key_datatype(key) != ARES_DATATYPE_BINP) ||
|
||||
ares_dns_rr_key_datatype(key) != ARES_DATATYPE_BINP &&
|
||||
ares_dns_rr_key_datatype(key) != ARES_DATATYPE_ABINP) ||
|
||||
len == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Array of strings, return concatenated version */
|
||||
if (ares_dns_rr_key_datatype(key) == ARES_DATATYPE_ABINP) {
|
||||
ares__dns_multistring_t * const *strs =
|
||||
ares_dns_rr_data_ptr_const(dns_rr, key, NULL);
|
||||
|
||||
if (strs == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return ares__dns_multistring_get_combined(*strs, len);
|
||||
}
|
||||
|
||||
/* Not a multi-string, just straight binary data */
|
||||
bin = ares_dns_rr_data_ptr_const(dns_rr, key, &bin_len);
|
||||
if (bin == NULL) {
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Shouldn't be possible */
|
||||
if (bin_len == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
*len = *bin_len;
|
||||
|
||||
return *bin;
|
||||
}
|
||||
|
||||
size_t ares_dns_rr_get_abin_cnt(const ares_dns_rr_t *dns_rr,
|
||||
ares_dns_rr_key_t key)
|
||||
{
|
||||
ares__dns_multistring_t * const *strs;
|
||||
|
||||
if (ares_dns_rr_key_datatype(key) != ARES_DATATYPE_ABINP) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
strs = ares_dns_rr_data_ptr_const(dns_rr, key, NULL);
|
||||
if (strs == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ares__dns_multistring_cnt(*strs);
|
||||
}
|
||||
|
||||
const unsigned char *ares_dns_rr_get_abin(const ares_dns_rr_t *dns_rr,
|
||||
ares_dns_rr_key_t key, size_t idx,
|
||||
size_t *len)
|
||||
{
|
||||
ares__dns_multistring_t * const *strs;
|
||||
|
||||
if (ares_dns_rr_key_datatype(key) != ARES_DATATYPE_ABINP) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
strs = ares_dns_rr_data_ptr_const(dns_rr, key, NULL);
|
||||
if (strs == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return ares__dns_multistring_get(*strs, idx, len);
|
||||
}
|
||||
|
||||
ares_status_t ares_dns_rr_del_abin(ares_dns_rr_t *dns_rr, ares_dns_rr_key_t key,
|
||||
size_t idx)
|
||||
{
|
||||
ares__dns_multistring_t **strs;
|
||||
|
||||
if (ares_dns_rr_key_datatype(key) != ARES_DATATYPE_ABINP) {
|
||||
return ARES_EFORMERR;
|
||||
}
|
||||
|
||||
strs = ares_dns_rr_data_ptr(dns_rr, key, NULL);
|
||||
if (strs == NULL) {
|
||||
return ARES_EFORMERR;
|
||||
}
|
||||
|
||||
return ares__dns_multistring_del(*strs, idx);
|
||||
}
|
||||
|
||||
ares_status_t ares_dns_rr_add_abin(ares_dns_rr_t *dns_rr, ares_dns_rr_key_t key,
|
||||
const unsigned char *val, size_t len)
|
||||
{
|
||||
ares_status_t status;
|
||||
ares_dns_datatype_t datatype = ares_dns_rr_key_datatype(key);
|
||||
ares_bool_t is_nullterm =
|
||||
(datatype == ARES_DATATYPE_ABINP) ? ARES_TRUE : ARES_FALSE;
|
||||
size_t alloclen = is_nullterm ? len + 1 : len;
|
||||
unsigned char *temp;
|
||||
ares__dns_multistring_t **strs;
|
||||
|
||||
if (ares_dns_rr_key_datatype(key) != ARES_DATATYPE_ABINP) {
|
||||
return ARES_EFORMERR;
|
||||
}
|
||||
|
||||
strs = ares_dns_rr_data_ptr(dns_rr, key, NULL);
|
||||
if (strs == NULL) {
|
||||
return ARES_EFORMERR;
|
||||
}
|
||||
|
||||
if (*strs == NULL) {
|
||||
*strs = ares__dns_multistring_create();
|
||||
if (*strs == NULL) {
|
||||
return ARES_ENOMEM;
|
||||
}
|
||||
}
|
||||
|
||||
temp = ares_malloc(alloclen);
|
||||
if (temp == NULL) {
|
||||
return ARES_ENOMEM;
|
||||
}
|
||||
|
||||
memcpy(temp, val, len);
|
||||
|
||||
/* NULL-term ABINP */
|
||||
if (is_nullterm) {
|
||||
temp[len] = 0;
|
||||
}
|
||||
|
||||
status = ares__dns_multistring_add_own(*strs, temp, len);
|
||||
if (status != ARES_SUCCESS) {
|
||||
ares_free(temp);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
const char *ares_dns_rr_get_str(const ares_dns_rr_t *dns_rr,
|
||||
ares_dns_rr_key_t key)
|
||||
{
|
||||
|
@ -1115,10 +1230,30 @@ ares_status_t ares_dns_rr_set_bin_own(ares_dns_rr_t *dns_rr,
|
|||
size_t *bin_len = NULL;
|
||||
|
||||
if (ares_dns_rr_key_datatype(key) != ARES_DATATYPE_BIN &&
|
||||
ares_dns_rr_key_datatype(key) != ARES_DATATYPE_BINP) {
|
||||
ares_dns_rr_key_datatype(key) != ARES_DATATYPE_BINP &&
|
||||
ares_dns_rr_key_datatype(key) != ARES_DATATYPE_ABINP) {
|
||||
return ARES_EFORMERR;
|
||||
}
|
||||
|
||||
if (ares_dns_rr_key_datatype(key) == ARES_DATATYPE_ABINP) {
|
||||
ares__dns_multistring_t **strs = ares_dns_rr_data_ptr(dns_rr, key, NULL);
|
||||
if (strs == NULL) {
|
||||
return ARES_EFORMERR;
|
||||
}
|
||||
|
||||
if (*strs == NULL) {
|
||||
*strs = ares__dns_multistring_create();
|
||||
if (*strs == NULL) {
|
||||
return ARES_ENOMEM;
|
||||
}
|
||||
}
|
||||
|
||||
/* Clear all existing entries as this is an override */
|
||||
ares__dns_multistring_clear(*strs);
|
||||
|
||||
return ares__dns_multistring_add_own(*strs, val, len);
|
||||
}
|
||||
|
||||
bin = ares_dns_rr_data_ptr(dns_rr, key, &bin_len);
|
||||
if (bin == NULL || bin_len == NULL) {
|
||||
return ARES_EFORMERR;
|
||||
|
@ -1138,7 +1273,11 @@ ares_status_t ares_dns_rr_set_bin(ares_dns_rr_t *dns_rr, ares_dns_rr_key_t key,
|
|||
{
|
||||
ares_status_t status;
|
||||
ares_dns_datatype_t datatype = ares_dns_rr_key_datatype(key);
|
||||
size_t alloclen = (datatype == ARES_DATATYPE_BINP) ? len + 1 : len;
|
||||
ares_bool_t is_nullterm =
|
||||
(datatype == ARES_DATATYPE_BINP || datatype == ARES_DATATYPE_ABINP)
|
||||
? ARES_TRUE
|
||||
: ARES_FALSE;
|
||||
size_t alloclen = is_nullterm ? len + 1 : len;
|
||||
unsigned char *temp = ares_malloc(alloclen);
|
||||
|
||||
if (temp == NULL) {
|
||||
|
@ -1148,7 +1287,7 @@ ares_status_t ares_dns_rr_set_bin(ares_dns_rr_t *dns_rr, ares_dns_rr_key_t key,
|
|||
memcpy(temp, val, len);
|
||||
|
||||
/* NULL-term BINP */
|
||||
if (datatype == ARES_DATATYPE_BINP) {
|
||||
if (is_nullterm) {
|
||||
temp[len] = 0;
|
||||
}
|
||||
|
||||
|
@ -1204,6 +1343,29 @@ ares_status_t ares_dns_rr_set_str(ares_dns_rr_t *dns_rr, ares_dns_rr_key_t key,
|
|||
return status;
|
||||
}
|
||||
|
||||
ares_status_t ares_dns_rr_set_abin_own(ares_dns_rr_t *dns_rr,
|
||||
ares_dns_rr_key_t key,
|
||||
ares__dns_multistring_t *strs)
|
||||
{
|
||||
ares__dns_multistring_t **strs_ptr;
|
||||
|
||||
if (ares_dns_rr_key_datatype(key) != ARES_DATATYPE_ABINP) {
|
||||
return ARES_EFORMERR;
|
||||
}
|
||||
|
||||
strs_ptr = ares_dns_rr_data_ptr(dns_rr, key, NULL);
|
||||
if (strs_ptr == NULL) {
|
||||
return ARES_EFORMERR;
|
||||
}
|
||||
|
||||
if (*strs_ptr != NULL) {
|
||||
ares__dns_multistring_destroy(*strs_ptr);
|
||||
}
|
||||
*strs_ptr = strs;
|
||||
|
||||
return ARES_SUCCESS;
|
||||
}
|
||||
|
||||
ares_status_t ares_dns_rr_set_opt_own(ares_dns_rr_t *dns_rr,
|
||||
ares_dns_rr_key_t key, unsigned short opt,
|
||||
unsigned char *val, size_t val_len)
|
||||
|
|
55
deps/cares/src/lib/ares_dns_write.c
vendored
55
deps/cares/src/lib/ares_dns_write.c
vendored
|
@ -23,8 +23,6 @@
|
|||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
#include "ares_setup.h"
|
||||
#include "ares.h"
|
||||
#include "ares_private.h"
|
||||
#include <limits.h>
|
||||
#ifdef HAVE_STDINT_H
|
||||
|
@ -220,20 +218,14 @@ static ares_status_t ares_dns_write_rr_str(ares__buf_t *buf,
|
|||
return ares__buf_append(buf, (const unsigned char *)str, len);
|
||||
}
|
||||
|
||||
static ares_status_t ares_dns_write_rr_binstrs(ares__buf_t *buf,
|
||||
const ares_dns_rr_t *rr,
|
||||
ares_dns_rr_key_t key)
|
||||
static ares_status_t ares_dns_write_binstr(ares__buf_t *buf,
|
||||
const unsigned char *bin,
|
||||
size_t bin_len)
|
||||
{
|
||||
const unsigned char *bin;
|
||||
const unsigned char *ptr;
|
||||
size_t bin_len;
|
||||
size_t ptr_len;
|
||||
ares_status_t status;
|
||||
|
||||
bin = ares_dns_rr_get_bin(rr, key, &bin_len);
|
||||
if (bin == NULL) {
|
||||
return ARES_EFORMERR; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
}
|
||||
/* split into possible multiple 255-byte or less length strings */
|
||||
ptr = bin;
|
||||
ptr_len = bin_len;
|
||||
|
@ -264,6 +256,33 @@ static ares_status_t ares_dns_write_rr_binstrs(ares__buf_t *buf,
|
|||
return ARES_SUCCESS;
|
||||
}
|
||||
|
||||
static ares_status_t ares_dns_write_rr_abin(ares__buf_t *buf,
|
||||
const ares_dns_rr_t *rr,
|
||||
ares_dns_rr_key_t key)
|
||||
{
|
||||
ares_status_t status = ARES_EFORMERR;
|
||||
size_t i;
|
||||
size_t cnt = ares_dns_rr_get_abin_cnt(rr, key);
|
||||
|
||||
if (cnt == 0) {
|
||||
return ARES_EFORMERR;
|
||||
}
|
||||
|
||||
for (i = 0; i < cnt; i++) {
|
||||
const unsigned char *bin;
|
||||
size_t bin_len;
|
||||
|
||||
bin = ares_dns_rr_get_abin(rr, key, i, &bin_len);
|
||||
|
||||
status = ares_dns_write_binstr(buf, bin, bin_len);
|
||||
if (status != ARES_SUCCESS) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
static ares_status_t ares_dns_write_rr_be32(ares__buf_t *buf,
|
||||
const ares_dns_rr_t *rr,
|
||||
ares_dns_rr_key_t key)
|
||||
|
@ -421,7 +440,7 @@ static ares_status_t ares_dns_write_rr_txt(ares__buf_t *buf,
|
|||
ares__llist_t **namelist)
|
||||
{
|
||||
(void)namelist;
|
||||
return ares_dns_write_rr_binstrs(buf, rr, ARES_RR_TXT_DATA);
|
||||
return ares_dns_write_rr_abin(buf, rr, ARES_RR_TXT_DATA);
|
||||
}
|
||||
|
||||
static ares_status_t ares_dns_write_rr_sig(ares__buf_t *buf,
|
||||
|
@ -589,6 +608,12 @@ static ares_status_t ares_dns_write_rr_opt(ares__buf_t *buf,
|
|||
|
||||
(void)namelist;
|
||||
|
||||
/* Coverity reports on this even though its not possible when taken
|
||||
* into context */
|
||||
if (len == 0) {
|
||||
return ARES_EFORMERR; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
}
|
||||
|
||||
/* We need to go back and overwrite the class and ttl that were emitted as
|
||||
* the OPT record overloads them for its own use (yes, very strange!) */
|
||||
status = ares__buf_set_length(buf, len - 2 /* RDLENGTH */
|
||||
|
@ -865,6 +890,12 @@ static ares_status_t ares_dns_write_rr_raw_rr(ares__buf_t *buf,
|
|||
|
||||
(void)namelist;
|
||||
|
||||
/* Coverity reports on this even though its not possible when taken
|
||||
* into context */
|
||||
if (len == 0) {
|
||||
return ARES_EFORMERR; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
}
|
||||
|
||||
/* We need to go back and overwrite the type that was emitted by the parent
|
||||
* function */
|
||||
status = ares__buf_set_length(buf, len - 2 /* RDLENGTH */
|
||||
|
|
2
deps/cares/src/lib/ares_event.h
vendored
2
deps/cares/src/lib/ares_event.h
vendored
|
@ -26,8 +26,6 @@
|
|||
#ifndef __ARES__EVENT_H
|
||||
#define __ARES__EVENT_H
|
||||
|
||||
#include "ares_setup.h"
|
||||
|
||||
struct ares_event;
|
||||
typedef struct ares_event ares_event_t;
|
||||
|
||||
|
|
80
deps/cares/src/lib/ares_event_configchg.c
vendored
80
deps/cares/src/lib/ares_event_configchg.c
vendored
|
@ -23,8 +23,6 @@
|
|||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
#include "ares_setup.h"
|
||||
#include "ares.h"
|
||||
#include "ares_private.h"
|
||||
#include "ares_event.h"
|
||||
|
||||
|
@ -149,7 +147,7 @@ ares_status_t ares_event_configchg_init(ares_event_configchg_t **configchg,
|
|||
c->inotify_fd = inotify_init1(IN_NONBLOCK | IN_CLOEXEC);
|
||||
if (c->inotify_fd == -1) {
|
||||
status = ARES_ESERVFAIL; /* LCOV_EXCL_LINE: UntestablePath */
|
||||
goto done; /* LCOV_EXCL_LINE: UntestablePath */
|
||||
goto done; /* LCOV_EXCL_LINE: UntestablePath */
|
||||
}
|
||||
|
||||
/* We need to monitor /etc/resolv.conf, /etc/nsswitch.conf */
|
||||
|
@ -157,7 +155,7 @@ ares_status_t ares_event_configchg_init(ares_event_configchg_t **configchg,
|
|||
IN_CREATE | IN_MODIFY | IN_MOVED_TO | IN_ONLYDIR) ==
|
||||
-1) {
|
||||
status = ARES_ESERVFAIL; /* LCOV_EXCL_LINE: UntestablePath */
|
||||
goto done; /* LCOV_EXCL_LINE: UntestablePath */
|
||||
goto done; /* LCOV_EXCL_LINE: UntestablePath */
|
||||
}
|
||||
|
||||
status =
|
||||
|
@ -250,32 +248,29 @@ static void ares_event_configchg_ip_cb(PVOID CallerContext,
|
|||
}
|
||||
# endif
|
||||
|
||||
static ares_bool_t ares_event_configchg_regnotify(ares_event_configchg_t *configchg)
|
||||
static ares_bool_t
|
||||
ares_event_configchg_regnotify(ares_event_configchg_t *configchg)
|
||||
{
|
||||
# if defined(__WATCOMC__) && !defined(REG_NOTIFY_THREAD_AGNOSTIC)
|
||||
# define REG_NOTIFY_THREAD_AGNOSTIC 0x10000000L
|
||||
# endif
|
||||
DWORD flags =
|
||||
REG_NOTIFY_CHANGE_NAME|REG_NOTIFY_CHANGE_LAST_SET|REG_NOTIFY_THREAD_AGNOSTIC;
|
||||
DWORD flags = REG_NOTIFY_CHANGE_NAME | REG_NOTIFY_CHANGE_LAST_SET |
|
||||
REG_NOTIFY_THREAD_AGNOSTIC;
|
||||
|
||||
if (RegNotifyChangeKeyValue(configchg->regip4, TRUE,
|
||||
flags,
|
||||
configchg->regip4_event,
|
||||
TRUE) != ERROR_SUCCESS) {
|
||||
if (RegNotifyChangeKeyValue(configchg->regip4, TRUE, flags,
|
||||
configchg->regip4_event, TRUE) != ERROR_SUCCESS) {
|
||||
return ARES_FALSE;
|
||||
}
|
||||
|
||||
if (RegNotifyChangeKeyValue(configchg->regip6, TRUE,
|
||||
flags,
|
||||
configchg->regip6_event,
|
||||
TRUE) != ERROR_SUCCESS) {
|
||||
if (RegNotifyChangeKeyValue(configchg->regip6, TRUE, flags,
|
||||
configchg->regip6_event, TRUE) != ERROR_SUCCESS) {
|
||||
return ARES_FALSE;
|
||||
}
|
||||
|
||||
return ARES_TRUE;
|
||||
}
|
||||
|
||||
static VOID CALLBACK ares_event_configchg_reg_cb(PVOID lpParameter,
|
||||
static VOID CALLBACK ares_event_configchg_reg_cb(PVOID lpParameter,
|
||||
BOOLEAN TimerOrWaitFired)
|
||||
{
|
||||
ares_event_configchg_t *configchg = lpParameter;
|
||||
|
@ -301,7 +296,7 @@ ares_status_t ares_event_configchg_init(ares_event_configchg_t **configchg,
|
|||
|
||||
c->e = e;
|
||||
|
||||
#ifndef __WATCOMC__
|
||||
# ifndef __WATCOMC__
|
||||
/* NOTE: If a user goes into the control panel and changes the network
|
||||
* adapter DNS addresses manually, this will NOT trigger a notification.
|
||||
* We've also tried listening on NotifyUnicastIpAddressChange(), but
|
||||
|
@ -313,20 +308,22 @@ ares_status_t ares_event_configchg_init(ares_event_configchg_t **configchg,
|
|||
status = ARES_ESERVFAIL;
|
||||
goto done;
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
|
||||
/* Monitor HKLM\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters\Interfaces
|
||||
* and HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces
|
||||
* for changes via RegNotifyChangeKeyValue() */
|
||||
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
|
||||
"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces",
|
||||
0, KEY_NOTIFY, &c->regip4) != ERROR_SUCCESS) {
|
||||
if (RegOpenKeyExW(
|
||||
HKEY_LOCAL_MACHINE,
|
||||
L"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces", 0,
|
||||
KEY_NOTIFY, &c->regip4) != ERROR_SUCCESS) {
|
||||
status = ARES_ESERVFAIL;
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
|
||||
"SYSTEM\\CurrentControlSet\\Services\\Tcpip6\\Parameters\\Interfaces",
|
||||
if (RegOpenKeyExW(
|
||||
HKEY_LOCAL_MACHINE,
|
||||
L"SYSTEM\\CurrentControlSet\\Services\\Tcpip6\\Parameters\\Interfaces",
|
||||
0, KEY_NOTIFY, &c->regip6) != ERROR_SUCCESS) {
|
||||
status = ARES_ESERVFAIL;
|
||||
goto done;
|
||||
|
@ -345,13 +342,15 @@ ares_status_t ares_event_configchg_init(ares_event_configchg_t **configchg,
|
|||
}
|
||||
|
||||
if (!RegisterWaitForSingleObject(&c->regip4_wait, c->regip4_event,
|
||||
ares_event_configchg_reg_cb, c, INFINITE, WT_EXECUTEDEFAULT)) {
|
||||
ares_event_configchg_reg_cb, c, INFINITE,
|
||||
WT_EXECUTEDEFAULT)) {
|
||||
status = ARES_ESERVFAIL;
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (!RegisterWaitForSingleObject(&c->regip6_wait, c->regip6_event,
|
||||
ares_event_configchg_reg_cb, c, INFINITE, WT_EXECUTEDEFAULT)) {
|
||||
ares_event_configchg_reg_cb, c, INFINITE,
|
||||
WT_EXECUTEDEFAULT)) {
|
||||
status = ARES_ESERVFAIL;
|
||||
goto done;
|
||||
}
|
||||
|
@ -446,15 +445,16 @@ static void ares_event_configchg_cb(ares_event_thread_t *e, ares_socket_t fd,
|
|||
ares_status_t ares_event_configchg_init(ares_event_configchg_t **configchg,
|
||||
ares_event_thread_t *e)
|
||||
{
|
||||
ares_status_t status = ARES_SUCCESS;
|
||||
void *handle = NULL;
|
||||
const char *(*pdns_configuration_notify_key)(void) = NULL;
|
||||
const char *notify_key = NULL;
|
||||
int flags;
|
||||
size_t i;
|
||||
const char *searchlibs[] = {
|
||||
ares_status_t status = ARES_SUCCESS;
|
||||
void *handle = NULL;
|
||||
const char *(*pdns_configuration_notify_key)(void) = NULL;
|
||||
const char *notify_key = NULL;
|
||||
int flags;
|
||||
size_t i;
|
||||
const char *searchlibs[] = {
|
||||
"/usr/lib/libSystem.dylib",
|
||||
"/System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration",
|
||||
"/System/Library/Frameworks/SystemConfiguration.framework/"
|
||||
"SystemConfiguration",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
@ -464,14 +464,15 @@ ares_status_t ares_event_configchg_init(ares_event_configchg_t **configchg,
|
|||
}
|
||||
|
||||
/* Load symbol as it isn't normally public */
|
||||
for (i=0; searchlibs[i] != NULL; i++) {
|
||||
for (i = 0; searchlibs[i] != NULL; i++) {
|
||||
handle = dlopen(searchlibs[i], RTLD_LAZY);
|
||||
if (handle == NULL) {
|
||||
/* Fail, loop! */
|
||||
continue;
|
||||
}
|
||||
|
||||
pdns_configuration_notify_key = dlsym(handle, "dns_configuration_notify_key");
|
||||
pdns_configuration_notify_key = (const char *(*)(void))
|
||||
dlsym(handle, "dns_configuration_notify_key");
|
||||
if (pdns_configuration_notify_key != NULL) {
|
||||
break;
|
||||
}
|
||||
|
@ -548,10 +549,15 @@ static ares_status_t config_change_check(ares__htable_strvp_t *filestat,
|
|||
const char *resolvconf_path)
|
||||
{
|
||||
size_t i;
|
||||
const char *configfiles[] = { resolvconf_path, "/etc/nsswitch.conf",
|
||||
"/etc/netsvc.conf", "/etc/svc.conf", NULL };
|
||||
const char *configfiles[5];
|
||||
ares_bool_t changed = ARES_FALSE;
|
||||
|
||||
configfiles[0] = resolvconf_path;
|
||||
configfiles[1] = "/etc/nsswitch.conf";
|
||||
configfiles[2] = "/etc/netsvc.conf";
|
||||
configfiles[3] = "/etc/svc.conf";
|
||||
configfiles[4] = NULL;
|
||||
|
||||
for (i = 0; configfiles[i] != NULL; i++) {
|
||||
fileinfo_t *fi = ares__htable_strvp_get_direct(filestat, configfiles[i]);
|
||||
struct stat st;
|
||||
|
|
12
deps/cares/src/lib/ares_event_epoll.c
vendored
12
deps/cares/src/lib/ares_event_epoll.c
vendored
|
@ -23,8 +23,6 @@
|
|||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
#include "ares_setup.h"
|
||||
#include "ares.h"
|
||||
#include "ares_private.h"
|
||||
#include "ares_event.h"
|
||||
|
||||
|
@ -73,20 +71,16 @@ static ares_bool_t ares_evsys_epoll_init(ares_event_thread_t *e)
|
|||
|
||||
e->ev_sys_data = ep;
|
||||
|
||||
ep->epoll_fd = epoll_create1(0);
|
||||
ep->epoll_fd = epoll_create1(EPOLL_CLOEXEC);
|
||||
if (ep->epoll_fd == -1) {
|
||||
ares_evsys_epoll_destroy(e); /* LCOV_EXCL_LINE: UntestablePath */
|
||||
return ARES_FALSE; /* LCOV_EXCL_LINE: UntestablePath */
|
||||
return ARES_FALSE; /* LCOV_EXCL_LINE: UntestablePath */
|
||||
}
|
||||
|
||||
# ifdef FD_CLOEXEC
|
||||
fcntl(ep->epoll_fd, F_SETFD, FD_CLOEXEC);
|
||||
# endif
|
||||
|
||||
e->ev_signal = ares_pipeevent_create(e);
|
||||
if (e->ev_signal == NULL) {
|
||||
ares_evsys_epoll_destroy(e); /* LCOV_EXCL_LINE: UntestablePath */
|
||||
return ARES_FALSE; /* LCOV_EXCL_LINE: UntestablePath */
|
||||
return ARES_FALSE; /* LCOV_EXCL_LINE: UntestablePath */
|
||||
}
|
||||
|
||||
return ARES_TRUE;
|
||||
|
|
2
deps/cares/src/lib/ares_event_kqueue.c
vendored
2
deps/cares/src/lib/ares_event_kqueue.c
vendored
|
@ -23,8 +23,6 @@
|
|||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
#include "ares_setup.h"
|
||||
#include "ares.h"
|
||||
#include "ares_private.h"
|
||||
#include "ares_event.h"
|
||||
|
||||
|
|
2
deps/cares/src/lib/ares_event_poll.c
vendored
2
deps/cares/src/lib/ares_event_poll.c
vendored
|
@ -23,8 +23,6 @@
|
|||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
#include "ares_setup.h"
|
||||
#include "ares.h"
|
||||
#include "ares_private.h"
|
||||
#include "ares_event.h"
|
||||
#ifdef HAVE_POLL_H
|
||||
|
|
2
deps/cares/src/lib/ares_event_select.c
vendored
2
deps/cares/src/lib/ares_event_select.c
vendored
|
@ -29,8 +29,6 @@
|
|||
* anyhow */
|
||||
#define FD_SETSIZE 4096
|
||||
|
||||
#include "ares_setup.h"
|
||||
#include "ares.h"
|
||||
#include "ares_private.h"
|
||||
#include "ares_event.h"
|
||||
#ifdef HAVE_SYS_SELECT_H
|
||||
|
|
50
deps/cares/src/lib/ares_event_thread.c
vendored
50
deps/cares/src/lib/ares_event_thread.c
vendored
|
@ -23,8 +23,6 @@
|
|||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
#include "ares_setup.h"
|
||||
#include "ares.h"
|
||||
#include "ares_private.h"
|
||||
#include "ares_event.h"
|
||||
|
||||
|
@ -128,7 +126,7 @@ ares_status_t ares_event_update(ares_event_t **event, ares_event_thread_t *e,
|
|||
}
|
||||
|
||||
if (ares__llist_insert_last(e->ev_updates, ev) == NULL) {
|
||||
ares_free(ev); /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
ares_free(ev); /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
return ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
}
|
||||
|
@ -274,16 +272,19 @@ static void *ares_event_thread(void *arg)
|
|||
const struct timeval *tvout;
|
||||
unsigned long timeout_ms = 0; /* 0 = unlimited */
|
||||
|
||||
ares_event_process_updates(e);
|
||||
|
||||
/* Don't hold a mutex while waiting on events or calling into anything
|
||||
* that might require a c-ares channel lock since a callback could be
|
||||
* triggered cross-thread */
|
||||
ares__thread_mutex_unlock(e->mutex);
|
||||
|
||||
tvout = ares_timeout(e->channel, NULL, &tv);
|
||||
if (tvout != NULL) {
|
||||
timeout_ms =
|
||||
(unsigned long)((tvout->tv_sec * 1000) + (tvout->tv_usec / 1000) + 1);
|
||||
}
|
||||
|
||||
ares_event_process_updates(e);
|
||||
|
||||
/* Don't hold a mutex while waiting on events */
|
||||
ares__thread_mutex_unlock(e->mutex);
|
||||
e->ev_sys->wait(e, timeout_ms);
|
||||
|
||||
/* Each iteration should do timeout processing */
|
||||
|
@ -391,22 +392,23 @@ static const ares_event_sys_t *ares_event_fetch_sys(ares_evsys_t evsys)
|
|||
|
||||
/* case ARES_EVSYS_DEFAULT: */
|
||||
default:
|
||||
#if defined(USE_WINSOCK)
|
||||
return &ares_evsys_win32;
|
||||
#elif defined(HAVE_KQUEUE)
|
||||
return &ares_evsys_kqueue;
|
||||
#elif defined(HAVE_EPOLL)
|
||||
return &ares_evsys_epoll;
|
||||
#elif defined(HAVE_POLL)
|
||||
return &ares_evsys_poll;
|
||||
#elif defined(HAVE_PIPE)
|
||||
return &ares_evsys_select;
|
||||
#else
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* default */
|
||||
#if defined(USE_WINSOCK)
|
||||
return &ares_evsys_win32;
|
||||
#elif defined(HAVE_KQUEUE)
|
||||
return &ares_evsys_kqueue;
|
||||
#elif defined(HAVE_EPOLL)
|
||||
return &ares_evsys_epoll;
|
||||
#elif defined(HAVE_POLL)
|
||||
return &ares_evsys_poll;
|
||||
#elif defined(HAVE_PIPE)
|
||||
return &ares_evsys_select;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
ares_status_t ares_event_thread_init(ares_channel_t *channel)
|
||||
|
@ -421,25 +423,25 @@ ares_status_t ares_event_thread_init(ares_channel_t *channel)
|
|||
e->mutex = ares__thread_mutex_create();
|
||||
if (e->mutex == NULL) {
|
||||
ares_event_thread_destroy_int(e); /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
return ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
return ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
e->ev_updates = ares__llist_create(NULL);
|
||||
if (e->ev_updates == NULL) {
|
||||
ares_event_thread_destroy_int(e); /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
return ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
return ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
e->ev_sock_handles = ares__htable_asvp_create(ares_event_destroy_cb);
|
||||
if (e->ev_sock_handles == NULL) {
|
||||
ares_event_thread_destroy_int(e); /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
return ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
return ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
e->ev_cust_handles = ares__htable_vpvp_create(NULL, ares_event_destroy_cb);
|
||||
if (e->ev_cust_handles == NULL) {
|
||||
ares_event_thread_destroy_int(e); /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
return ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
return ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
e->channel = channel;
|
||||
|
@ -447,7 +449,7 @@ ares_status_t ares_event_thread_init(ares_channel_t *channel)
|
|||
e->ev_sys = ares_event_fetch_sys(channel->evsys);
|
||||
if (e->ev_sys == NULL) {
|
||||
ares_event_thread_destroy_int(e); /* LCOV_EXCL_LINE: UntestablePath */
|
||||
return ARES_ENOTIMP; /* LCOV_EXCL_LINE: UntestablePath */
|
||||
return ARES_ENOTIMP; /* LCOV_EXCL_LINE: UntestablePath */
|
||||
}
|
||||
|
||||
channel->sock_state_cb = ares_event_thread_sockstate_cb;
|
||||
|
|
6
deps/cares/src/lib/ares_event_wake_pipe.c
vendored
6
deps/cares/src/lib/ares_event_wake_pipe.c
vendored
|
@ -23,8 +23,6 @@
|
|||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
#include "ares_setup.h"
|
||||
#include "ares.h"
|
||||
#include "ares_private.h"
|
||||
#include "ares_event.h"
|
||||
#ifdef HAVE_UNISTD_H
|
||||
|
@ -69,7 +67,7 @@ static ares_pipeevent_t *ares_pipeevent_init(void)
|
|||
# ifdef HAVE_PIPE2
|
||||
if (pipe2(p->filedes, O_NONBLOCK | O_CLOEXEC) != 0) {
|
||||
ares_pipeevent_destroy(p); /* LCOV_EXCL_LINE: UntestablePath */
|
||||
return NULL; /* LCOV_EXCL_LINE: UntestablePath */
|
||||
return NULL; /* LCOV_EXCL_LINE: UntestablePath */
|
||||
}
|
||||
# else
|
||||
if (pipe(p->filedes) != 0) {
|
||||
|
@ -157,7 +155,7 @@ ares_event_t *ares_pipeevent_create(ares_event_thread_t *e)
|
|||
ares_pipeevent_signal);
|
||||
if (status != ARES_SUCCESS) {
|
||||
ares_pipeevent_destroy(p); /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
return NULL; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
return NULL; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
}
|
||||
|
||||
return event;
|
||||
|
|
37
deps/cares/src/lib/ares_event_win32.c
vendored
37
deps/cares/src/lib/ares_event_win32.c
vendored
|
@ -24,8 +24,12 @@
|
|||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include "ares_setup.h"
|
||||
#include "ares.h"
|
||||
/* Uses an anonymous union */
|
||||
#if defined(__clang__)
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wc11-extensions"
|
||||
#endif
|
||||
|
||||
#include "ares_private.h"
|
||||
#include "ares_event.h"
|
||||
#include "ares_event_win32.h"
|
||||
|
@ -254,12 +258,28 @@ static ares_bool_t ares_evsys_win32_init(ares_event_thread_t *e)
|
|||
goto fail;
|
||||
}
|
||||
|
||||
#ifdef __GNUC__
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wpedantic"
|
||||
/* Without the (void *) cast we get:
|
||||
* warning: cast between incompatible function types from 'FARPROC' {aka 'long long int (*)()'} to 'NTSTATUS (*)(...)'} [-Wcast-function-type]
|
||||
* but with it we get:
|
||||
* warning: ISO C forbids conversion of function pointer to object pointer type [-Wpedantic]
|
||||
* look unsolvable short of killing the warning.
|
||||
*/
|
||||
#endif
|
||||
|
||||
|
||||
/* Load Internal symbols not typically accessible */
|
||||
ew->NtDeviceIoControlFile = (NtDeviceIoControlFile_t)(void *)GetProcAddress(
|
||||
ntdll, "NtDeviceIoControlFile");
|
||||
ew->NtCancelIoFileEx =
|
||||
(NtCancelIoFileEx_t)(void *)GetProcAddress(ntdll, "NtCancelIoFileEx");
|
||||
|
||||
#ifdef __GNUC__
|
||||
# pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
if (ew->NtCancelIoFileEx == NULL || ew->NtDeviceIoControlFile == NULL) {
|
||||
goto fail;
|
||||
}
|
||||
|
@ -365,8 +385,6 @@ static ares_bool_t ares_evsys_win32_afd_enqueue(ares_event_t *event,
|
|||
IOCTL_AFD_POLL, &ed->afd_poll_info, sizeof(ed->afd_poll_info),
|
||||
&ed->afd_poll_info, sizeof(ed->afd_poll_info));
|
||||
if (status != STATUS_SUCCESS && status != STATUS_PENDING) {
|
||||
printf("%s(): failed to perform IOCTL_AFD_POLL operation\n", __FUNCTION__);
|
||||
fflush(stdout);
|
||||
return ARES_FALSE;
|
||||
}
|
||||
|
||||
|
@ -441,8 +459,6 @@ static ares_bool_t ares_evsys_win32_event_add(ares_event_t *event)
|
|||
|
||||
ed->base_socket = ares_evsys_win32_basesocket(ed->socket);
|
||||
if (ed->base_socket == ARES_SOCKET_BAD) {
|
||||
fprintf(stderr, "%s(): could not determine base socket for fd %d\n",
|
||||
__FUNCTION__, (int)event->fd);
|
||||
ares_evsys_win32_eventdata_destroy(ed);
|
||||
return ARES_FALSE;
|
||||
}
|
||||
|
@ -451,9 +467,6 @@ static ares_bool_t ares_evsys_win32_event_add(ares_event_t *event)
|
|||
* socket handle */
|
||||
if (WSADuplicateSocketW(ed->base_socket, GetCurrentProcessId(),
|
||||
&protocol_info) != 0) {
|
||||
fprintf(stderr,
|
||||
"%s(): could not retrieve protocol info for creating peer socket\n",
|
||||
__FUNCTION__);
|
||||
ares_evsys_win32_eventdata_destroy(ed);
|
||||
return ARES_FALSE;
|
||||
}
|
||||
|
@ -462,7 +475,6 @@ static ares_bool_t ares_evsys_win32_event_add(ares_event_t *event)
|
|||
WSASocketW(protocol_info.iAddressFamily, protocol_info.iSocketType,
|
||||
protocol_info.iProtocol, &protocol_info, 0, WSA_FLAG_OVERLAPPED);
|
||||
if (ed->peer_socket == ARES_SOCKET_BAD) {
|
||||
fprintf(stderr, "%s(): could not create peer socket\n", __FUNCTION__);
|
||||
ares_evsys_win32_eventdata_destroy(ed);
|
||||
return ARES_FALSE;
|
||||
}
|
||||
|
@ -471,7 +483,6 @@ static ares_bool_t ares_evsys_win32_event_add(ares_event_t *event)
|
|||
|
||||
if (CreateIoCompletionPort((HANDLE)ed->peer_socket, ew->iocp_handle,
|
||||
(ULONG_PTR)ed, 0) == NULL) {
|
||||
fprintf(stderr, "%s(): failed to bind peer socket to IOCP\n", __FUNCTION__);
|
||||
ares_evsys_win32_eventdata_destroy(ed);
|
||||
return ARES_FALSE;
|
||||
}
|
||||
|
@ -599,3 +610,7 @@ const ares_event_sys_t ares_evsys_win32 = { "win32",
|
|||
ares_evsys_win32_event_mod,
|
||||
ares_evsys_win32_wait };
|
||||
#endif
|
||||
|
||||
#if defined(__clang__)
|
||||
# pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
|
5
deps/cares/src/lib/ares_expand_name.c
vendored
5
deps/cares/src/lib/ares_expand_name.c
vendored
|
@ -25,7 +25,7 @@
|
|||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include "ares_setup.h"
|
||||
#include "ares_private.h"
|
||||
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
# include <netinet/in.h>
|
||||
|
@ -33,9 +33,6 @@
|
|||
|
||||
#include "ares_nameser.h"
|
||||
|
||||
#include "ares.h"
|
||||
#include "ares_private.h" /* for the memdebug */
|
||||
|
||||
ares_status_t ares__expand_name_validated(const unsigned char *encoded,
|
||||
const unsigned char *abuf,
|
||||
size_t alen, char **s, size_t *enclen,
|
||||
|
|
7
deps/cares/src/lib/ares_expand_string.c
vendored
7
deps/cares/src/lib/ares_expand_string.c
vendored
|
@ -25,7 +25,7 @@
|
|||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include "ares_setup.h"
|
||||
#include "ares_private.h"
|
||||
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
# include <netinet/in.h>
|
||||
|
@ -33,9 +33,6 @@
|
|||
|
||||
#include "ares_nameser.h"
|
||||
|
||||
#include "ares.h"
|
||||
#include "ares_private.h" /* for the memdebug */
|
||||
|
||||
/* Simply decodes a length-encoded character string. The first byte of the
|
||||
* input is the length of the string to be returned and the bytes thereafter
|
||||
* are the characters of the string. The returned result will be NULL
|
||||
|
@ -78,7 +75,7 @@ ares_status_t ares_expand_string_ex(const unsigned char *encoded,
|
|||
|
||||
start_len = ares__buf_len(buf);
|
||||
status =
|
||||
ares__buf_parse_dns_binstr(buf, ares__buf_len(buf), s, &len, ARES_FALSE);
|
||||
ares__buf_parse_dns_binstr(buf, ares__buf_len(buf), s, &len);
|
||||
/* hrm, no way to pass back 'len' with the prototype */
|
||||
if (status != ARES_SUCCESS) {
|
||||
goto done;
|
||||
|
|
3
deps/cares/src/lib/ares_fds.c
vendored
3
deps/cares/src/lib/ares_fds.c
vendored
|
@ -25,9 +25,6 @@
|
|||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include "ares_setup.h"
|
||||
|
||||
#include "ares.h"
|
||||
#include "ares_private.h"
|
||||
|
||||
int ares_fds(const ares_channel_t *channel, fd_set *read_fds, fd_set *write_fds)
|
||||
|
|
6
deps/cares/src/lib/ares_free_hostent.c
vendored
6
deps/cares/src/lib/ares_free_hostent.c
vendored
|
@ -24,16 +24,12 @@
|
|||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include "ares_setup.h"
|
||||
#include "ares_private.h"
|
||||
|
||||
#ifdef HAVE_NETDB_H
|
||||
# include <netdb.h>
|
||||
#endif
|
||||
|
||||
#include "ares.h"
|
||||
#include "ares_private.h" /* for memdebug */
|
||||
|
||||
void ares_free_hostent(struct hostent *host)
|
||||
{
|
||||
char **p;
|
||||
|
|
3
deps/cares/src/lib/ares_free_string.c
vendored
3
deps/cares/src/lib/ares_free_string.c
vendored
|
@ -25,9 +25,6 @@
|
|||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include "ares_setup.h"
|
||||
|
||||
#include "ares.h"
|
||||
#include "ares_private.h"
|
||||
|
||||
void ares_free_string(void *str)
|
||||
|
|
5
deps/cares/src/lib/ares_freeaddrinfo.c
vendored
5
deps/cares/src/lib/ares_freeaddrinfo.c
vendored
|
@ -25,15 +25,12 @@
|
|||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include "ares_setup.h"
|
||||
#include "ares_private.h"
|
||||
|
||||
#ifdef HAVE_NETDB_H
|
||||
# include <netdb.h>
|
||||
#endif
|
||||
|
||||
#include "ares.h"
|
||||
#include "ares_private.h"
|
||||
|
||||
void ares__freeaddrinfo_cnames(struct ares_addrinfo_cname *head)
|
||||
{
|
||||
struct ares_addrinfo_cname *current;
|
||||
|
|
18
deps/cares/src/lib/ares_getaddrinfo.c
vendored
18
deps/cares/src/lib/ares_getaddrinfo.c
vendored
|
@ -26,7 +26,7 @@
|
|||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include "ares_setup.h"
|
||||
#include "ares_private.h"
|
||||
|
||||
#ifdef HAVE_GETSERVBYNAME_R
|
||||
# if !defined(GETSERVBYNAME_R_ARGS) || (GETSERVBYNAME_R_ARGS < 4) || \
|
||||
|
@ -56,8 +56,6 @@
|
|||
# include <limits.h>
|
||||
#endif
|
||||
|
||||
#include "ares.h"
|
||||
#include "ares_private.h"
|
||||
#include "ares_dns.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
|
@ -254,7 +252,7 @@ static ares_bool_t fake_addrinfo(const char *name, unsigned short port,
|
|||
ares_bool_t valid = ARES_TRUE;
|
||||
const char *p;
|
||||
for (p = name; *p; p++) {
|
||||
if (!ISDIGIT(*p) && *p != '.') {
|
||||
if (!isdigit(*p) && *p != '.') {
|
||||
valid = ARES_FALSE;
|
||||
break;
|
||||
} else if (*p == '.') {
|
||||
|
@ -275,7 +273,7 @@ static ares_bool_t fake_addrinfo(const char *name, unsigned short port,
|
|||
status = ares_append_ai_node(AF_INET, port, 0, &addr4, &ai->nodes);
|
||||
if (status != ARES_SUCCESS) {
|
||||
callback(arg, (int)status, 0, NULL); /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
return ARES_TRUE; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
return ARES_TRUE; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -289,7 +287,7 @@ static ares_bool_t fake_addrinfo(const char *name, unsigned short port,
|
|||
status = ares_append_ai_node(AF_INET6, port, 0, &addr6, &ai->nodes);
|
||||
if (status != ARES_SUCCESS) {
|
||||
callback(arg, (int)status, 0, NULL); /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
return ARES_TRUE; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
return ARES_TRUE; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -674,20 +672,20 @@ static ares_bool_t next_dns_lookup(struct host_query *hquery)
|
|||
switch (hquery->hints.ai_family) {
|
||||
case AF_INET:
|
||||
hquery->remaining += 1;
|
||||
ares_query_dnsrec(hquery->channel, name, ARES_CLASS_IN, ARES_REC_TYPE_A,
|
||||
ares_query_nolock(hquery->channel, name, ARES_CLASS_IN, ARES_REC_TYPE_A,
|
||||
host_callback, hquery, &hquery->qid_a);
|
||||
break;
|
||||
case AF_INET6:
|
||||
hquery->remaining += 1;
|
||||
ares_query_dnsrec(hquery->channel, name, ARES_CLASS_IN,
|
||||
ares_query_nolock(hquery->channel, name, ARES_CLASS_IN,
|
||||
ARES_REC_TYPE_AAAA, host_callback, hquery,
|
||||
&hquery->qid_aaaa);
|
||||
break;
|
||||
case AF_UNSPEC:
|
||||
hquery->remaining += 2;
|
||||
ares_query_dnsrec(hquery->channel, name, ARES_CLASS_IN, ARES_REC_TYPE_A,
|
||||
ares_query_nolock(hquery->channel, name, ARES_CLASS_IN, ARES_REC_TYPE_A,
|
||||
host_callback, hquery, &hquery->qid_a);
|
||||
ares_query_dnsrec(hquery->channel, name, ARES_CLASS_IN,
|
||||
ares_query_nolock(hquery->channel, name, ARES_CLASS_IN,
|
||||
ARES_REC_TYPE_AAAA, host_callback, hquery,
|
||||
&hquery->qid_aaaa);
|
||||
break;
|
||||
|
|
2
deps/cares/src/lib/ares_getenv.c
vendored
2
deps/cares/src/lib/ares_getenv.c
vendored
|
@ -25,7 +25,7 @@
|
|||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include "ares_setup.h"
|
||||
#include "ares_private.h"
|
||||
#include "ares_getenv.h"
|
||||
|
||||
#ifndef HAVE_GETENV
|
||||
|
|
2
deps/cares/src/lib/ares_getenv.h
vendored
2
deps/cares/src/lib/ares_getenv.h
vendored
|
@ -27,8 +27,6 @@
|
|||
#ifndef HEADER_CARES_GETENV_H
|
||||
#define HEADER_CARES_GETENV_H
|
||||
|
||||
#include "ares_setup.h"
|
||||
|
||||
#ifndef HAVE_GETENV
|
||||
extern char *ares_getenv(const char *name);
|
||||
#endif
|
||||
|
|
20
deps/cares/src/lib/ares_gethostbyaddr.c
vendored
20
deps/cares/src/lib/ares_gethostbyaddr.c
vendored
|
@ -25,7 +25,7 @@
|
|||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include "ares_setup.h"
|
||||
#include "ares_private.h"
|
||||
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
# include <netinet/in.h>
|
||||
|
@ -38,11 +38,8 @@
|
|||
#endif
|
||||
|
||||
#include "ares_nameser.h"
|
||||
|
||||
#include "ares.h"
|
||||
#include "ares_inet_net_pton.h"
|
||||
#include "ares_platform.h"
|
||||
#include "ares_private.h"
|
||||
|
||||
struct addr_query {
|
||||
/* Arguments passed to ares_gethostbyaddr() */
|
||||
|
@ -64,9 +61,9 @@ static ares_status_t file_lookup(ares_channel_t *channel,
|
|||
const struct ares_addr *addr,
|
||||
struct hostent **host);
|
||||
|
||||
static void ares_gethostbyaddr_int(ares_channel_t *channel, const void *addr,
|
||||
int addrlen, int family,
|
||||
ares_host_callback callback, void *arg)
|
||||
void ares_gethostbyaddr_nolock(ares_channel_t *channel, const void *addr,
|
||||
int addrlen, int family,
|
||||
ares_host_callback callback, void *arg)
|
||||
{
|
||||
struct addr_query *aquery;
|
||||
|
||||
|
@ -116,7 +113,7 @@ void ares_gethostbyaddr(ares_channel_t *channel, const void *addr, int addrlen,
|
|||
return;
|
||||
}
|
||||
ares__channel_lock(channel);
|
||||
ares_gethostbyaddr_int(channel, addr, addrlen, family, callback, arg);
|
||||
ares_gethostbyaddr_nolock(channel, addr, addrlen, family, callback, arg);
|
||||
ares__channel_unlock(channel);
|
||||
}
|
||||
|
||||
|
@ -132,11 +129,12 @@ static void next_lookup(struct addr_query *aquery)
|
|||
case 'b':
|
||||
name = ares_dns_addr_to_ptr(&aquery->addr);
|
||||
if (name == NULL) {
|
||||
end_aquery(aquery, ARES_ENOMEM, NULL); /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
return; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
end_aquery(aquery, ARES_ENOMEM,
|
||||
NULL); /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
return; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
aquery->remaining_lookups = p + 1;
|
||||
ares_query_dnsrec(aquery->channel, name, ARES_CLASS_IN,
|
||||
ares_query_nolock(aquery->channel, name, ARES_CLASS_IN,
|
||||
ARES_REC_TYPE_PTR, addr_callback, aquery, NULL);
|
||||
ares_free(name);
|
||||
return;
|
||||
|
|
14
deps/cares/src/lib/ares_gethostbyname.c
vendored
14
deps/cares/src/lib/ares_gethostbyname.c
vendored
|
@ -25,7 +25,7 @@
|
|||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include "ares_setup.h"
|
||||
#include "ares_private.h"
|
||||
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
# include <netinet/in.h>
|
||||
|
@ -43,10 +43,8 @@
|
|||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#include "ares.h"
|
||||
#include "ares_inet_net_pton.h"
|
||||
#include "ares_platform.h"
|
||||
#include "ares_private.h"
|
||||
|
||||
static void sort_addresses(const struct hostent *host,
|
||||
const struct apattern *sortlist, size_t nsort);
|
||||
|
@ -102,13 +100,17 @@ static void ares_gethostbyname_callback(void *arg, int status, int timeouts,
|
|||
void ares_gethostbyname(ares_channel_t *channel, const char *name, int family,
|
||||
ares_host_callback callback, void *arg)
|
||||
{
|
||||
const struct ares_addrinfo_hints hints = { ARES_AI_CANONNAME, family, 0, 0 };
|
||||
struct host_query *ghbn_arg;
|
||||
struct ares_addrinfo_hints hints;
|
||||
struct host_query *ghbn_arg;
|
||||
|
||||
if (!callback) {
|
||||
return;
|
||||
}
|
||||
|
||||
memset(&hints, 0, sizeof(hints));
|
||||
hints.ai_flags = ARES_AI_CANONNAME;
|
||||
hints.ai_family = family;
|
||||
|
||||
ghbn_arg = ares_malloc(sizeof(*ghbn_arg));
|
||||
if (!ghbn_arg) {
|
||||
callback(arg, ARES_ENOMEM, 0, NULL);
|
||||
|
@ -249,7 +251,7 @@ static ares_status_t ares__hostent_localhost(const char *name, int family,
|
|||
ai = ares_malloc_zero(sizeof(*ai));
|
||||
if (ai == NULL) {
|
||||
status = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
status = ares__addrinfo_localhost(name, 0, &hints, ai);
|
||||
|
|
27
deps/cares/src/lib/ares_getnameinfo.c
vendored
27
deps/cares/src/lib/ares_getnameinfo.c
vendored
|
@ -23,7 +23,7 @@
|
|||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
#include "ares_setup.h"
|
||||
#include "ares_private.h"
|
||||
|
||||
#ifdef HAVE_GETSERVBYPORT_R
|
||||
# if !defined(GETSERVBYPORT_R_ARGS) || (GETSERVBYPORT_R_ARGS < 4) || \
|
||||
|
@ -51,9 +51,7 @@
|
|||
# include <iphlpapi.h>
|
||||
#endif
|
||||
|
||||
#include "ares.h"
|
||||
#include "ares_ipv6.h"
|
||||
#include "ares_private.h"
|
||||
|
||||
struct nameinfo_query {
|
||||
ares_nameinfo_callback callback;
|
||||
|
@ -81,8 +79,8 @@ static void nameinfo_callback(void *arg, int status, int timeouts,
|
|||
static char *lookup_service(unsigned short port, unsigned int flags, char *buf,
|
||||
size_t buflen);
|
||||
#ifdef HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID
|
||||
static void append_scopeid(const struct sockaddr_in6 *addr6,
|
||||
unsigned int flags, char *buf, size_t buflen);
|
||||
static void append_scopeid(const struct sockaddr_in6 *addr6, unsigned int flags,
|
||||
char *buf, size_t buflen);
|
||||
#endif
|
||||
static char *ares_striendstr(const char *s1, const char *s2);
|
||||
|
||||
|
@ -100,11 +98,11 @@ static void ares_getnameinfo_int(ares_channel_t *channel,
|
|||
/* Validate socket address family and length */
|
||||
if (sa && sa->sa_family == AF_INET &&
|
||||
salen >= (ares_socklen_t)sizeof(struct sockaddr_in)) {
|
||||
addr = CARES_INADDR_CAST(struct sockaddr_in *, sa);
|
||||
addr = CARES_INADDR_CAST(const struct sockaddr_in *, sa);
|
||||
port = addr->sin_port;
|
||||
} else if (sa && sa->sa_family == AF_INET6 &&
|
||||
salen >= (ares_socklen_t)sizeof(struct sockaddr_in6)) {
|
||||
addr6 = CARES_INADDR_CAST(struct sockaddr_in6 *, sa);
|
||||
addr6 = CARES_INADDR_CAST(const struct sockaddr_in6 *, sa);
|
||||
port = addr6->sin6_port;
|
||||
} else {
|
||||
callback(arg, ARES_ENOTIMP, 0, NULL, NULL);
|
||||
|
@ -173,14 +171,15 @@ static void ares_getnameinfo_int(ares_channel_t *channel,
|
|||
if (sa->sa_family == AF_INET) {
|
||||
niquery->family = AF_INET;
|
||||
memcpy(&niquery->addr.addr4, addr, sizeof(niquery->addr.addr4));
|
||||
ares_gethostbyaddr(channel, &addr->sin_addr, sizeof(struct in_addr),
|
||||
AF_INET, nameinfo_callback, niquery);
|
||||
ares_gethostbyaddr_nolock(channel, &addr->sin_addr,
|
||||
sizeof(struct in_addr), AF_INET,
|
||||
nameinfo_callback, niquery);
|
||||
} else {
|
||||
niquery->family = AF_INET6;
|
||||
memcpy(&niquery->addr.addr6, addr6, sizeof(niquery->addr.addr6));
|
||||
ares_gethostbyaddr(channel, &addr6->sin6_addr,
|
||||
sizeof(struct ares_in6_addr), AF_INET6,
|
||||
nameinfo_callback, niquery);
|
||||
ares_gethostbyaddr_nolock(channel, &addr6->sin6_addr,
|
||||
sizeof(struct ares_in6_addr), AF_INET6,
|
||||
nameinfo_callback, niquery);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -411,8 +410,8 @@ static char *ares_striendstr(const char *s1, const char *s2)
|
|||
c1 = c1_begin;
|
||||
c2 = s2;
|
||||
while (c2 < s2 + s2_len) {
|
||||
lo1 = TOLOWER(*c1);
|
||||
lo2 = TOLOWER(*c2);
|
||||
lo1 = ares__tolower((unsigned char)*c1);
|
||||
lo2 = ares__tolower((unsigned char)*c2);
|
||||
if (lo1 != lo2) {
|
||||
return NULL;
|
||||
} else {
|
||||
|
|
3
deps/cares/src/lib/ares_getsock.c
vendored
3
deps/cares/src/lib/ares_getsock.c
vendored
|
@ -24,9 +24,6 @@
|
|||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include "ares_setup.h"
|
||||
|
||||
#include "ares.h"
|
||||
#include "ares_private.h"
|
||||
|
||||
int ares_getsock(const ares_channel_t *channel, ares_socket_t *socks,
|
||||
|
|
17
deps/cares/src/lib/ares_init.c
vendored
17
deps/cares/src/lib/ares_init.c
vendored
|
@ -25,7 +25,7 @@
|
|||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include "ares_setup.h"
|
||||
#include "ares_private.h"
|
||||
|
||||
#ifdef HAVE_SYS_PARAM_H
|
||||
# include <sys/param.h>
|
||||
|
@ -61,10 +61,8 @@
|
|||
# include <iphlpapi.h>
|
||||
#endif
|
||||
|
||||
#include "ares.h"
|
||||
#include "ares_inet_net_pton.h"
|
||||
#include "ares_platform.h"
|
||||
#include "ares_private.h"
|
||||
#include "ares_event.h"
|
||||
|
||||
int ares_init(ares_channel_t **channelptr)
|
||||
|
@ -197,7 +195,7 @@ static ares_status_t init_by_defaults(ares_channel_t *channel)
|
|||
hostname = ares_malloc(len);
|
||||
if (!hostname) {
|
||||
rc = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto error; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto error; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
do {
|
||||
|
@ -210,7 +208,7 @@ static ares_status_t init_by_defaults(ares_channel_t *channel)
|
|||
p = ares_realloc(hostname, len);
|
||||
if (!p) {
|
||||
rc = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto error; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto error; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
hostname = p;
|
||||
continue;
|
||||
|
@ -229,12 +227,12 @@ static ares_status_t init_by_defaults(ares_channel_t *channel)
|
|||
channel->domains = ares_malloc(sizeof(char *));
|
||||
if (!channel->domains) {
|
||||
rc = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto error; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto error; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
channel->domains[0] = ares_strdup(dot + 1);
|
||||
if (!channel->domains[0]) {
|
||||
rc = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto error; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto error; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
channel->ndomains = 1;
|
||||
}
|
||||
|
@ -488,7 +486,6 @@ int ares_dup(ares_channel_t **dest, const ares_channel_t *src)
|
|||
|
||||
*dest = NULL; /* in case of failure return NULL explicitly */
|
||||
|
||||
ares__channel_lock(src);
|
||||
/* First get the options supported by the old ares_save_options() function,
|
||||
which is most of them */
|
||||
rc = (ares_status_t)ares_save_options(src, &opts, &optmask);
|
||||
|
@ -507,6 +504,7 @@ int ares_dup(ares_channel_t **dest, const ares_channel_t *src)
|
|||
goto done;
|
||||
}
|
||||
|
||||
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;
|
||||
|
@ -522,7 +520,7 @@ int ares_dup(ares_channel_t **dest, const ares_channel_t *src)
|
|||
sizeof((*dest)->local_dev_name));
|
||||
(*dest)->local_ip4 = src->local_ip4;
|
||||
memcpy((*dest)->local_ip6, src->local_ip6, sizeof(src->local_ip6));
|
||||
|
||||
ares__channel_unlock(src);
|
||||
|
||||
/* Servers are a bit unique as ares_init_options() only allows ipv4 servers
|
||||
* and not a port per server, but there are other user specified ways, that
|
||||
|
@ -558,7 +556,6 @@ int ares_dup(ares_channel_t **dest, const ares_channel_t *src)
|
|||
|
||||
rc = ARES_SUCCESS;
|
||||
done:
|
||||
ares__channel_unlock(src);
|
||||
return (int)rc; /* everything went fine */
|
||||
}
|
||||
|
||||
|
|
3
deps/cares/src/lib/ares_library_init.c
vendored
3
deps/cares/src/lib/ares_library_init.c
vendored
|
@ -25,9 +25,6 @@
|
|||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include "ares_setup.h"
|
||||
|
||||
#include "ares.h"
|
||||
#include "ares_private.h"
|
||||
|
||||
/* library-private global and unique instance vars */
|
||||
|
|
21
deps/cares/src/lib/ares_math.c
vendored
21
deps/cares/src/lib/ares_math.c
vendored
|
@ -23,8 +23,7 @@
|
|||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
#include "ares_setup.h"
|
||||
#include "ares.h"
|
||||
|
||||
#include "ares_private.h"
|
||||
|
||||
/* Uses public domain code snippets from
|
||||
|
@ -57,9 +56,23 @@ static ares_int64_t ares__round_up_pow2_u64(ares_int64_t n)
|
|||
return n;
|
||||
}
|
||||
|
||||
ares_bool_t ares__is_64bit(void)
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4127)
|
||||
#endif
|
||||
|
||||
return (sizeof(size_t) == 4) ? ARES_FALSE : ARES_TRUE;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
}
|
||||
|
||||
size_t ares__round_up_pow2(size_t n)
|
||||
{
|
||||
if (sizeof(size_t) > 4) {
|
||||
if (ares__is_64bit()) {
|
||||
return (size_t)ares__round_up_pow2_u64((ares_int64_t)n);
|
||||
}
|
||||
|
||||
|
@ -79,7 +92,7 @@ size_t ares__log2(size_t n)
|
|||
56, 45, 25, 31, 35, 16, 9, 12, 44, 24, 15, 8, 23, 7, 6, 5
|
||||
};
|
||||
|
||||
if (sizeof(size_t) == 4) {
|
||||
if (!ares__is_64bit()) {
|
||||
return tab32[(n * 0x077CB531) >> 27];
|
||||
}
|
||||
|
||||
|
|
262
deps/cares/src/lib/ares_metrics.c
vendored
Normal file
262
deps/cares/src/lib/ares_metrics.c
vendored
Normal file
|
@ -0,0 +1,262 @@
|
|||
/* MIT License
|
||||
*
|
||||
* Copyright (c) 2024 Brad House
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
|
||||
/* IMPLEMENTATION NOTES
|
||||
* ====================
|
||||
*
|
||||
* With very little effort we should be able to determine fairly proper timeouts
|
||||
* we can use based on prior query history. We track in order to be able to
|
||||
* auto-scale when network conditions change (e.g. maybe there is a provider
|
||||
* failover and timings change due to that). Apple appears to do this within
|
||||
* their system resolver in MacOS. Obviously we should have a minimum, maximum,
|
||||
* and initial value to make sure the algorithm doesn't somehow go off the
|
||||
* rails.
|
||||
*
|
||||
* Values:
|
||||
* - Minimum Timeout: 250ms (approximate RTT half-way around the globe)
|
||||
* - Maximum Timeout: 5000ms (Recommended timeout in RFC 1123), can be reduced
|
||||
* by ARES_OPT_MAXTIMEOUTMS, but otherwise the bound specified by the option
|
||||
* caps the retry timeout.
|
||||
* - Initial Timeout: User-specified via configuration or ARES_OPT_TIMEOUTMS
|
||||
* - Average latency multiplier: 5x (a local DNS server returning a cached value
|
||||
* will be quicker than if it needs to recurse so we need to account for this)
|
||||
* - Minimum Count for Average: 3. This is the minimum number of queries we
|
||||
* need to form an average for the bucket.
|
||||
*
|
||||
* Per-server buckets for tracking latency over time (these are ephemeral
|
||||
* meaning they don't persist once a channel is destroyed). We record both the
|
||||
* current timespan for the bucket and the immediate preceding timespan in case
|
||||
* of roll-overs we can still maintain recent metrics for calculations:
|
||||
* - 1 minute
|
||||
* - 15 minutes
|
||||
* - 1 hr
|
||||
* - 1 day
|
||||
* - since inception
|
||||
*
|
||||
* Each bucket would contain:
|
||||
* - timestamp (divided by interval)
|
||||
* - minimum latency
|
||||
* - maximum latency
|
||||
* - total time
|
||||
* - count
|
||||
* NOTE: average latency is (total time / count), we will calculate this
|
||||
* dynamically when needed
|
||||
*
|
||||
* Basic algorithm for calculating timeout to use would be:
|
||||
* - Scan from most recent bucket to least recent
|
||||
* - Check timestamp of bucket, if doesn't match current time, continue to next
|
||||
* bucket
|
||||
* - Check count of bucket, if its not at least the "Minimum Count for Average",
|
||||
* check the previous bucket, otherwise continue to next bucket
|
||||
* - If we reached the end with no bucket match, use "Initial Timeout"
|
||||
* - If bucket is selected, take ("total time" / count) as Average latency,
|
||||
* multiply by "Average Latency Multiplier", bound by "Minimum Timeout" and
|
||||
* "Maximum Timeout"
|
||||
* NOTE: The timeout calculated may not be the timeout used. If we are retrying
|
||||
* the query on the same server another time, then it will use a larger value
|
||||
*
|
||||
* On each query reply where the response is legitimate (proper response or
|
||||
* NXDOMAIN) and not something like a server error:
|
||||
* - Cycle through each bucket in order
|
||||
* - Check timestamp of bucket against current timestamp, if out of date
|
||||
* overwrite previous entry with values, clear current values
|
||||
* - Compare current minimum and maximum recorded latency against query time and
|
||||
* adjust if necessary
|
||||
* - Increment "count" by 1 and "total time" by the query time
|
||||
*
|
||||
* Other Notes:
|
||||
* - This is always-on, the only user-configurable value is the initial
|
||||
* timeout which will simply re-uses the current option.
|
||||
* - Minimum and Maximum latencies for a bucket are currently unused but are
|
||||
* there in case we find a need for them in the future.
|
||||
*/
|
||||
|
||||
#include "ares_private.h"
|
||||
|
||||
/*! Minimum timeout value. Chosen due to it being approximately RTT half-way
|
||||
* around the world */
|
||||
#define MIN_TIMEOUT_MS 250
|
||||
|
||||
/*! Multiplier to apply to average latency to come up with an initial timeout */
|
||||
#define AVG_TIMEOUT_MULTIPLIER 5
|
||||
|
||||
/*! Upper timeout bounds, only used if channel->maxtimeout not set */
|
||||
#define MAX_TIMEOUT_MS 5000
|
||||
|
||||
/*! Minimum queries required to form an average */
|
||||
#define MIN_COUNT_FOR_AVERAGE 3
|
||||
|
||||
static time_t ares_metric_timestamp(ares_server_bucket_t bucket,
|
||||
const ares_timeval_t *now,
|
||||
ares_bool_t is_previous)
|
||||
{
|
||||
time_t divisor = 1; /* Silence bogus MSVC warning by setting default value */
|
||||
|
||||
switch (bucket) {
|
||||
case ARES_METRIC_1MINUTE:
|
||||
divisor = 60;
|
||||
break;
|
||||
case ARES_METRIC_15MINUTES:
|
||||
divisor = 15 * 60;
|
||||
break;
|
||||
case ARES_METRIC_1HOUR:
|
||||
divisor = 60 * 60;
|
||||
break;
|
||||
case ARES_METRIC_1DAY:
|
||||
divisor = 24 * 60 * 60;
|
||||
break;
|
||||
case ARES_METRIC_INCEPTION:
|
||||
return is_previous ? 0 : 1;
|
||||
case ARES_METRIC_COUNT:
|
||||
return 0; /* Invalid! */
|
||||
}
|
||||
|
||||
if (is_previous) {
|
||||
if (divisor >= now->sec) {
|
||||
return 0;
|
||||
}
|
||||
return (time_t)((now->sec - divisor) / divisor);
|
||||
}
|
||||
|
||||
return (time_t)(now->sec / divisor);
|
||||
}
|
||||
|
||||
void ares_metrics_record(const struct query *query, struct server_state *server,
|
||||
ares_status_t status, const ares_dns_record_t *dnsrec)
|
||||
{
|
||||
ares_timeval_t now;
|
||||
ares_timeval_t tvdiff;
|
||||
unsigned int query_ms;
|
||||
ares_dns_rcode_t rcode;
|
||||
ares_server_bucket_t i;
|
||||
|
||||
if (status != ARES_SUCCESS) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (server == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
ares__tvnow(&now);
|
||||
|
||||
rcode = ares_dns_record_get_rcode(dnsrec);
|
||||
if (rcode != ARES_RCODE_NOERROR && rcode != ARES_RCODE_NXDOMAIN) {
|
||||
return;
|
||||
}
|
||||
|
||||
ares__timeval_diff(&tvdiff, &query->ts, &now);
|
||||
query_ms = (unsigned int)(tvdiff.sec + (tvdiff.usec / 1000));
|
||||
if (query_ms == 0) {
|
||||
query_ms = 1;
|
||||
}
|
||||
|
||||
/* Place in each bucket */
|
||||
for (i = 0; i < ARES_METRIC_COUNT; i++) {
|
||||
time_t ts = ares_metric_timestamp(i, &now, ARES_FALSE);
|
||||
|
||||
/* Copy metrics to prev and clear */
|
||||
if (ts != server->metrics[i].ts) {
|
||||
server->metrics[i].prev_ts = server->metrics[i].ts;
|
||||
server->metrics[i].prev_total_ms = server->metrics[i].total_ms;
|
||||
server->metrics[i].prev_total_count = server->metrics[i].total_count;
|
||||
server->metrics[i].ts = ts;
|
||||
server->metrics[i].latency_min_ms = 0;
|
||||
server->metrics[i].latency_max_ms = 0;
|
||||
server->metrics[i].total_ms = 0;
|
||||
server->metrics[i].total_count = 0;
|
||||
}
|
||||
|
||||
if (server->metrics[i].latency_min_ms == 0 ||
|
||||
server->metrics[i].latency_min_ms > query_ms) {
|
||||
server->metrics[i].latency_min_ms = query_ms;
|
||||
}
|
||||
|
||||
if (query_ms > server->metrics[i].latency_max_ms) {
|
||||
server->metrics[i].latency_min_ms = query_ms;
|
||||
}
|
||||
|
||||
server->metrics[i].total_count++;
|
||||
server->metrics[i].total_ms += (ares_uint64_t)query_ms;
|
||||
}
|
||||
}
|
||||
|
||||
size_t ares_metrics_server_timeout(const struct server_state *server,
|
||||
const ares_timeval_t *now)
|
||||
{
|
||||
const ares_channel_t *channel = server->channel;
|
||||
ares_server_bucket_t i;
|
||||
size_t timeout_ms = 0;
|
||||
|
||||
|
||||
for (i = 0; i < ARES_METRIC_COUNT; i++) {
|
||||
time_t ts = ares_metric_timestamp(i, now, ARES_FALSE);
|
||||
|
||||
/* This ts has been invalidated, see if we should use the previous
|
||||
* time period */
|
||||
if (ts != server->metrics[i].ts ||
|
||||
server->metrics[i].total_count < MIN_COUNT_FOR_AVERAGE) {
|
||||
time_t prev_ts = ares_metric_timestamp(i, now, ARES_TRUE);
|
||||
if (prev_ts != server->metrics[i].prev_ts ||
|
||||
server->metrics[i].prev_total_count < MIN_COUNT_FOR_AVERAGE) {
|
||||
/* Move onto next bucket */
|
||||
continue;
|
||||
}
|
||||
/* Calculate average time for previous bucket */
|
||||
timeout_ms = (size_t)(server->metrics[i].prev_total_ms /
|
||||
server->metrics[i].prev_total_count);
|
||||
} else {
|
||||
/* Calculate average time for current bucket*/
|
||||
timeout_ms =
|
||||
(size_t)(server->metrics[i].total_ms / server->metrics[i].total_count);
|
||||
}
|
||||
|
||||
/* Multiply average by constant to get timeout value */
|
||||
timeout_ms *= AVG_TIMEOUT_MULTIPLIER;
|
||||
break;
|
||||
}
|
||||
|
||||
/* If we're here, that means its the first query for the server, so we just
|
||||
* use the initial default timeout */
|
||||
if (timeout_ms == 0) {
|
||||
timeout_ms = channel->timeout;
|
||||
}
|
||||
|
||||
/* don't go below lower bounds */
|
||||
if (timeout_ms < MIN_TIMEOUT_MS) {
|
||||
timeout_ms = MIN_TIMEOUT_MS;
|
||||
}
|
||||
|
||||
/* don't go above upper bounds */
|
||||
if (channel->maxtimeout && timeout_ms > channel->maxtimeout) {
|
||||
timeout_ms = channel->maxtimeout;
|
||||
} else if (timeout_ms > MAX_TIMEOUT_MS) {
|
||||
timeout_ms = MAX_TIMEOUT_MS;
|
||||
}
|
||||
|
||||
return timeout_ms;
|
||||
}
|
8
deps/cares/src/lib/ares_options.c
vendored
8
deps/cares/src/lib/ares_options.c
vendored
|
@ -25,16 +25,14 @@
|
|||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include "ares_setup.h"
|
||||
#include "ares_private.h"
|
||||
|
||||
#ifdef HAVE_ARPA_INET_H
|
||||
# include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
#include "ares.h"
|
||||
#include "ares_data.h"
|
||||
#include "ares_inet_net_pton.h"
|
||||
#include "ares_private.h"
|
||||
|
||||
void ares_destroy_options(struct ares_options *options)
|
||||
{
|
||||
|
@ -464,8 +462,8 @@ ares_status_t ares__init_by_options(ares_channel_t *channel,
|
|||
/* qcache_max_ttl is unsigned unlike the others */
|
||||
channel->qcache_max_ttl = options->qcache_max_ttl;
|
||||
} else {
|
||||
optmask |= ARES_OPT_QUERY_CACHE;
|
||||
channel->qcache_max_ttl = 3600;
|
||||
optmask |= ARES_OPT_QUERY_CACHE;
|
||||
channel->qcache_max_ttl = 3600;
|
||||
}
|
||||
|
||||
/* Initialize the ipv4 servers if provided */
|
||||
|
|
8
deps/cares/src/lib/ares_parse_a_reply.c
vendored
8
deps/cares/src/lib/ares_parse_a_reply.c
vendored
|
@ -25,7 +25,7 @@
|
|||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include "ares_setup.h"
|
||||
#include "ares_private.h"
|
||||
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
# include <netinet/in.h>
|
||||
|
@ -37,8 +37,6 @@
|
|||
# include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
#include "ares_nameser.h"
|
||||
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
@ -47,10 +45,6 @@
|
|||
# include <limits.h>
|
||||
#endif
|
||||
|
||||
#include "ares.h"
|
||||
#include "ares_dns.h"
|
||||
#include "ares_private.h"
|
||||
|
||||
int ares_parse_a_reply(const unsigned char *abuf, int alen,
|
||||
struct hostent **host, struct ares_addrttl *addrttls,
|
||||
int *naddrttls)
|
||||
|
|
7
deps/cares/src/lib/ares_parse_aaaa_reply.c
vendored
7
deps/cares/src/lib/ares_parse_aaaa_reply.c
vendored
|
@ -26,7 +26,7 @@
|
|||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include "ares_setup.h"
|
||||
#include "ares_private.h"
|
||||
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
# include <netinet/in.h>
|
||||
|
@ -38,8 +38,6 @@
|
|||
# include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
#include "ares_nameser.h"
|
||||
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
@ -48,10 +46,7 @@
|
|||
# include <limits.h>
|
||||
#endif
|
||||
|
||||
#include "ares.h"
|
||||
#include "ares_dns.h"
|
||||
#include "ares_inet_net_pton.h"
|
||||
#include "ares_private.h"
|
||||
|
||||
int ares_parse_aaaa_reply(const unsigned char *abuf, int alen,
|
||||
struct hostent **host, struct ares_addr6ttl *addrttls,
|
||||
|
|
14
deps/cares/src/lib/ares_parse_caa_reply.c
vendored
14
deps/cares/src/lib/ares_parse_caa_reply.c
vendored
|
@ -24,10 +24,8 @@
|
|||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include "ares_setup.h"
|
||||
#include "ares.h"
|
||||
#include "ares_data.h"
|
||||
#include "ares_private.h"
|
||||
#include "ares_data.h"
|
||||
|
||||
int ares_parse_caa_reply(const unsigned char *abuf, int alen_int,
|
||||
struct ares_caa_reply **caa_out)
|
||||
|
@ -67,7 +65,7 @@ int ares_parse_caa_reply(const unsigned char *abuf, int alen_int,
|
|||
if (rr == NULL) {
|
||||
/* Shouldn't be possible */
|
||||
status = ARES_EBADRESP; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
goto done; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
goto done; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
}
|
||||
|
||||
/* XXX: Why do we allow Chaos class? */
|
||||
|
@ -85,7 +83,7 @@ int ares_parse_caa_reply(const unsigned char *abuf, int alen_int,
|
|||
caa_curr = ares_malloc_data(ARES_DATATYPE_CAA_REPLY);
|
||||
if (caa_curr == NULL) {
|
||||
status = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
/* Link in the record */
|
||||
|
@ -101,7 +99,7 @@ int ares_parse_caa_reply(const unsigned char *abuf, int alen_int,
|
|||
(unsigned char *)ares_strdup(ares_dns_rr_get_str(rr, ARES_RR_CAA_TAG));
|
||||
if (caa_curr->property == NULL) {
|
||||
status = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
break; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
break; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
/* RFC6844 says this can only be ascii, so not sure why we're recording a
|
||||
* length */
|
||||
|
@ -110,14 +108,14 @@ int ares_parse_caa_reply(const unsigned char *abuf, int alen_int,
|
|||
ptr = ares_dns_rr_get_bin(rr, ARES_RR_CAA_VALUE, &ptr_len);
|
||||
if (ptr == NULL) {
|
||||
status = ARES_EBADRESP; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
goto done; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
goto done; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
}
|
||||
|
||||
/* Wants NULL termination for some reason */
|
||||
caa_curr->value = ares_malloc(ptr_len + 1);
|
||||
if (caa_curr->value == NULL) {
|
||||
status = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
memcpy(caa_curr->value, ptr, ptr_len);
|
||||
caa_curr->value[ptr_len] = 0;
|
||||
|
|
10
deps/cares/src/lib/ares_parse_mx_reply.c
vendored
10
deps/cares/src/lib/ares_parse_mx_reply.c
vendored
|
@ -24,10 +24,8 @@
|
|||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include "ares_setup.h"
|
||||
#include "ares.h"
|
||||
#include "ares_data.h"
|
||||
#include "ares_private.h"
|
||||
#include "ares_data.h"
|
||||
|
||||
int ares_parse_mx_reply(const unsigned char *abuf, int alen_int,
|
||||
struct ares_mx_reply **mx_out)
|
||||
|
@ -65,7 +63,7 @@ int ares_parse_mx_reply(const unsigned char *abuf, int alen_int,
|
|||
if (rr == NULL) {
|
||||
/* Shouldn't be possible */
|
||||
status = ARES_EBADRESP; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
goto done; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
goto done; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
}
|
||||
|
||||
if (ares_dns_rr_get_class(rr) != ARES_CLASS_IN ||
|
||||
|
@ -77,7 +75,7 @@ int ares_parse_mx_reply(const unsigned char *abuf, int alen_int,
|
|||
mx_curr = ares_malloc_data(ARES_DATATYPE_MX_REPLY);
|
||||
if (mx_curr == NULL) {
|
||||
status = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
/* Link in the record */
|
||||
|
@ -93,7 +91,7 @@ int ares_parse_mx_reply(const unsigned char *abuf, int alen_int,
|
|||
|
||||
if (mx_curr->host == NULL) {
|
||||
status = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
}
|
||||
|
||||
|
|
16
deps/cares/src/lib/ares_parse_naptr_reply.c
vendored
16
deps/cares/src/lib/ares_parse_naptr_reply.c
vendored
|
@ -23,10 +23,8 @@
|
|||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
#include "ares_setup.h"
|
||||
#include "ares.h"
|
||||
#include "ares_data.h"
|
||||
#include "ares_private.h"
|
||||
#include "ares_data.h"
|
||||
|
||||
int ares_parse_naptr_reply(const unsigned char *abuf, int alen_int,
|
||||
struct ares_naptr_reply **naptr_out)
|
||||
|
@ -64,7 +62,7 @@ int ares_parse_naptr_reply(const unsigned char *abuf, int alen_int,
|
|||
if (rr == NULL) {
|
||||
/* Shouldn't be possible */
|
||||
status = ARES_EBADRESP; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
goto done; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
goto done; /* LCOV_EXCL_LINE: DefensiveCoding */
|
||||
}
|
||||
|
||||
if (ares_dns_rr_get_class(rr) != ARES_CLASS_IN ||
|
||||
|
@ -76,7 +74,7 @@ int ares_parse_naptr_reply(const unsigned char *abuf, int alen_int,
|
|||
naptr_curr = ares_malloc_data(ARES_DATATYPE_NAPTR_REPLY);
|
||||
if (naptr_curr == NULL) {
|
||||
status = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
|
||||
/* Link in the record */
|
||||
|
@ -95,27 +93,27 @@ int ares_parse_naptr_reply(const unsigned char *abuf, int alen_int,
|
|||
ares_dns_rr_get_str(rr, ARES_RR_NAPTR_FLAGS));
|
||||
if (naptr_curr->flags == NULL) {
|
||||
status = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
/* XXX: Why is this unsigned char * ? */
|
||||
naptr_curr->service = (unsigned char *)ares_strdup(
|
||||
ares_dns_rr_get_str(rr, ARES_RR_NAPTR_SERVICES));
|
||||
if (naptr_curr->service == NULL) {
|
||||
status = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
/* XXX: Why is this unsigned char * ? */
|
||||
naptr_curr->regexp = (unsigned char *)ares_strdup(
|
||||
ares_dns_rr_get_str(rr, ARES_RR_NAPTR_REGEXP));
|
||||
if (naptr_curr->regexp == NULL) {
|
||||
status = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
naptr_curr->replacement =
|
||||
ares_strdup(ares_dns_rr_get_str(rr, ARES_RR_NAPTR_REPLACEMENT));
|
||||
if (naptr_curr->replacement == NULL) {
|
||||
status = ARES_ENOMEM; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
goto done; /* LCOV_EXCL_LINE: OutOfMemory */
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue