diff --git a/.eslintrc.js b/.eslintrc.js
index b427c9986f679f..49a810249146d7 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -44,10 +44,7 @@ module.exports = {
parserOptions: {
babelOptions: {
plugins: [
- [
- Module._findPath('@babel/plugin-syntax-import-attributes'),
- { deprecatedAssertSyntax: true },
- ],
+ Module._findPath('@babel/plugin-syntax-import-attributes'),
],
},
requireConfigFile: false,
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 13aaf0606290d5..3c0f7e8a0221d6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -32,7 +32,10 @@ release.
-18.19.1
+18.20.2
+18.20.1
+18.20.0
+18.19.1
18.19.0
18.18.2
18.18.1
diff --git a/benchmark/_http-benchmarkers.js b/benchmark/_http-benchmarkers.js
index ae5429fa721750..4eba83eccb58f0 100644
--- a/benchmark/_http-benchmarkers.js
+++ b/benchmark/_http-benchmarkers.js
@@ -12,11 +12,16 @@ exports.PORT = Number(process.env.PORT) || 12346;
class AutocannonBenchmarker {
constructor() {
+ const shell = (process.platform === 'win32');
this.name = 'autocannon';
- this.executable =
- process.platform === 'win32' ? 'autocannon.cmd' : 'autocannon';
- const result = child_process.spawnSync(this.executable, ['-h']);
- this.present = !(result.error && result.error.code === 'ENOENT');
+ this.opts = { shell };
+ this.executable = shell ? 'autocannon.cmd' : 'autocannon';
+ const result = child_process.spawnSync(this.executable, ['-h'], this.opts);
+ if (shell) {
+ this.present = (result.status === 0);
+ } else {
+ this.present = !(result.error && result.error.code === 'ENOENT');
+ }
}
create(options) {
@@ -27,11 +32,15 @@ class AutocannonBenchmarker {
'-n',
];
for (const field in options.headers) {
- args.push('-H', `${field}=${options.headers[field]}`);
+ if (this.opts.shell) {
+ args.push('-H', `'${field}=${options.headers[field]}'`);
+ } else {
+ args.push('-H', `${field}=${options.headers[field]}`);
+ }
}
const scheme = options.scheme || 'http';
args.push(`${scheme}://127.0.0.1:${options.port}${options.path}`);
- const child = child_process.spawn(this.executable, args);
+ const child = child_process.spawn(this.executable, args, this.opts);
return child;
}
diff --git a/benchmark/vm/compile-script-in-isolate-cache.js b/benchmark/vm/compile-script-in-isolate-cache.js
new file mode 100644
index 00000000000000..7eceb0eba0d215
--- /dev/null
+++ b/benchmark/vm/compile-script-in-isolate-cache.js
@@ -0,0 +1,35 @@
+'use strict';
+
+// This benchmarks compiling scripts that hit the in-isolate compilation
+// cache (by having the same source).
+const common = require('../common.js');
+const fs = require('fs');
+const vm = require('vm');
+const fixtures = require('../../test/common/fixtures.js');
+const scriptPath = fixtures.path('snapshot', 'typescript.js');
+
+const bench = common.createBenchmark(main, {
+ type: ['with-dynamic-import-callback', 'without-dynamic-import-callback'],
+ n: [100],
+});
+
+const scriptSource = fs.readFileSync(scriptPath, 'utf8');
+
+function main({ n, type }) {
+ let script;
+ bench.start();
+ const options = {};
+ switch (type) {
+ case 'with-dynamic-import-callback':
+ // Use a dummy callback for now until we really need to benchmark it.
+ options.importModuleDynamically = async () => {};
+ break;
+ case 'without-dynamic-import-callback':
+ break;
+ }
+ for (let i = 0; i < n; i++) {
+ script = new vm.Script(scriptSource, options);
+ }
+ bench.end(n);
+ script.runInThisContext();
+}
diff --git a/common.gypi b/common.gypi
index dba2631f218581..38471d4639eb5e 100644
--- a/common.gypi
+++ b/common.gypi
@@ -36,7 +36,7 @@
# Reset this number to 0 on major V8 upgrades.
# Increment by one for each non-official patch applied to deps/v8.
- 'v8_embedder_string': '-node.28',
+ 'v8_embedder_string': '-node.36',
##### V8 defaults for Node.js #####
diff --git a/configure b/configure
index fefb313c9cd13c..711a3014b9a67f 100755
--- a/configure
+++ b/configure
@@ -4,6 +4,7 @@
# Note that the mix of single and double quotes is intentional,
# as is the fact that the ] goes on a new line.
_=[ 'exec' '/bin/sh' '-c' '''
+command -v python3.12 >/dev/null && exec python3.12 "$0" "$@"
command -v python3.11 >/dev/null && exec python3.11 "$0" "$@"
command -v python3.10 >/dev/null && exec python3.10 "$0" "$@"
command -v python3.9 >/dev/null && exec python3.9 "$0" "$@"
@@ -23,7 +24,7 @@ except ImportError:
from distutils.spawn import find_executable as which
print('Node.js configure: Found Python {}.{}.{}...'.format(*sys.version_info))
-acceptable_pythons = ((3, 11), (3, 10), (3, 9), (3, 8), (3, 7), (3, 6))
+acceptable_pythons = ((3, 12), (3, 11), (3, 10), (3, 9), (3, 8), (3, 7), (3, 6))
if sys.version_info[:2] in acceptable_pythons:
import configure
else:
diff --git a/configure.py b/configure.py
index 4638f04b6ae622..82916748fd23c1 100755
--- a/configure.py
+++ b/configure.py
@@ -1057,7 +1057,7 @@ def check_compiler(o):
if not ok:
warn(f'failed to autodetect C++ compiler version (CXX={CXX})')
elif clang_version < (8, 0, 0) if is_clang else gcc_version < (8, 3, 0):
- warn(f'C++ compiler (CXX={CXX}, {version_str}) too old, need g++ 10.1.0 or clang++ 8.0.0')
+ warn(f'C++ compiler (CXX={CXX}, {version_str}) too old, need g++ 8.3.0 or clang++ 8.0.0')
ok, is_clang, clang_version, gcc_version = try_check_compiler(CC, 'c')
version_str = ".".join(map(str, clang_version if is_clang else gcc_version))
diff --git a/deps/ada/ada.cpp b/deps/ada/ada.cpp
index 909fd50034d4fe..9641cce39cda12 100644
--- a/deps/ada/ada.cpp
+++ b/deps/ada/ada.cpp
@@ -1,4 +1,4 @@
-/* auto-generated on 2023-10-22 19:50:50 -0400. Do not edit! */
+/* auto-generated on 2024-01-29 13:13:24 -0500. Do not edit! */
/* begin file src/ada.cpp */
#include "ada.h"
/* begin file src/checkers.cpp */
@@ -7,62 +7,79 @@
namespace ada::checkers {
ada_really_inline ada_constexpr bool is_ipv4(std::string_view view) noexcept {
- size_t last_dot = view.rfind('.');
- if (last_dot == view.size() - 1) {
+ // The string is not empty and does not contain upper case ASCII characters.
+ //
+ // Optimization. To be considered as a possible ipv4, the string must end
+ // with 'x' or a lowercase hex character.
+ // Most of the time, this will be false so this simple check will save a lot
+ // of effort.
+ char last_char = view.back();
+ // If the address ends with a dot, we need to prune it (special case).
+ if (last_char == '.') {
view.remove_suffix(1);
- last_dot = view.rfind('.');
+ if (view.empty()) {
+ return false;
+ }
+ last_char = view.back();
}
- std::string_view number =
- (last_dot == std::string_view::npos) ? view : view.substr(last_dot + 1);
- if (number.empty()) {
+ bool possible_ipv4 = (last_char >= '0' && last_char <= '9') ||
+ (last_char >= 'a' && last_char <= 'f') ||
+ last_char == 'x';
+ if (!possible_ipv4) {
return false;
}
+ // From the last character, find the last dot.
+ size_t last_dot = view.rfind('.');
+ if (last_dot != std::string_view::npos) {
+ // We have at least one dot.
+ view = view.substr(last_dot + 1);
+ }
/** Optimization opportunity: we have basically identified the last number of
the ipv4 if we return true here. We might as well parse it and have at
least one number parsed when we get to parse_ipv4. */
- if (std::all_of(number.begin(), number.end(), ada::checkers::is_digit)) {
+ if (std::all_of(view.begin(), view.end(), ada::checkers::is_digit)) {
return true;
}
- return (checkers::has_hex_prefix(number) &&
- std::all_of(number.begin() + 2, number.end(),
- ada::unicode::is_lowercase_hex));
+ // It could be hex (0x), but not if there is a single character.
+ if (view.size() == 1) {
+ return false;
+ }
+ // It must start with 0x.
+ if (!std::equal(view.begin(), view.begin() + 2, "0x")) {
+ return false;
+ }
+ // We must allow "0x".
+ if (view.size() == 2) {
+ return true;
+ }
+ // We have 0x followed by some characters, we need to check that they are
+ // hexadecimals.
+ return std::all_of(view.begin() + 2, view.end(),
+ ada::unicode::is_lowercase_hex);
}
// for use with path_signature, we include all characters that need percent
// encoding.
-static constexpr uint8_t path_signature_table[256] = {
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
-static_assert(path_signature_table[uint8_t('?')] == 1);
-static_assert(path_signature_table[uint8_t('`')] == 1);
-static_assert(path_signature_table[uint8_t('{')] == 1);
-static_assert(path_signature_table[uint8_t('}')] == 1);
-//
-static_assert(path_signature_table[uint8_t(' ')] == 1);
-static_assert(path_signature_table[uint8_t('?')] == 1);
-static_assert(path_signature_table[uint8_t('"')] == 1);
-static_assert(path_signature_table[uint8_t('#')] == 1);
-static_assert(path_signature_table[uint8_t('<')] == 1);
-static_assert(path_signature_table[uint8_t('>')] == 1);
-static_assert(path_signature_table[uint8_t('\\')] == 2);
-static_assert(path_signature_table[uint8_t('.')] == 4);
-static_assert(path_signature_table[uint8_t('%')] == 8);
-
-//
-static_assert(path_signature_table[0] == 1);
-static_assert(path_signature_table[31] == 1);
-static_assert(path_signature_table[127] == 1);
-static_assert(path_signature_table[128] == 1);
-static_assert(path_signature_table[255] == 1);
+static constexpr std::array path_signature_table =
+ []() constexpr {
+ std::array result{};
+ for (size_t i = 0; i < 256; i++) {
+ if (i <= 0x20 || i == 0x22 || i == 0x23 || i == 0x3c || i == 0x3e ||
+ i == 0x3f || i == 0x60 || i == 0x7b || i == 0x7b || i == 0x7d ||
+ i > 0x7e) {
+ result[i] = 1;
+ } else if (i == 0x25) {
+ result[i] = 8;
+ } else if (i == 0x2e) {
+ result[i] = 4;
+ } else if (i == 0x5c) {
+ result[i] = 2;
+ } else {
+ result[i] = 0;
+ }
+ }
+ return result;
+ }();
ada_really_inline constexpr uint8_t path_signature(
std::string_view input) noexcept {
@@ -9912,56 +9929,36 @@ ada_really_inline bool has_tabs_or_newline(
// U+0020 SPACE, U+0023 (#), U+002F (/), U+003A (:), U+003C (<), U+003E (>),
// U+003F (?), U+0040 (@), U+005B ([), U+005C (\), U+005D (]), U+005E (^), or
// U+007C (|).
-constexpr static bool is_forbidden_host_code_point_table[] = {
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
-static_assert(sizeof(is_forbidden_host_code_point_table) == 256);
+constexpr static std::array is_forbidden_host_code_point_table =
+ []() constexpr {
+ std::array result{};
+ for (uint8_t c : {'\0', '\x09', '\x0a', '\x0d', ' ', '#', '/', ':', '<',
+ '>', '?', '@', '[', '\\', ']', '^', '|'}) {
+ result[c] = true;
+ }
+ return result;
+ }();
ada_really_inline constexpr bool is_forbidden_host_code_point(
const char c) noexcept {
return is_forbidden_host_code_point_table[uint8_t(c)];
}
-static_assert(unicode::is_forbidden_host_code_point('\0'));
-static_assert(unicode::is_forbidden_host_code_point('\t'));
-static_assert(unicode::is_forbidden_host_code_point('\n'));
-static_assert(unicode::is_forbidden_host_code_point('\r'));
-static_assert(unicode::is_forbidden_host_code_point(' '));
-static_assert(unicode::is_forbidden_host_code_point('#'));
-static_assert(unicode::is_forbidden_host_code_point('/'));
-static_assert(unicode::is_forbidden_host_code_point(':'));
-static_assert(unicode::is_forbidden_host_code_point('?'));
-static_assert(unicode::is_forbidden_host_code_point('@'));
-static_assert(unicode::is_forbidden_host_code_point('['));
-static_assert(unicode::is_forbidden_host_code_point('?'));
-static_assert(unicode::is_forbidden_host_code_point('<'));
-static_assert(unicode::is_forbidden_host_code_point('>'));
-static_assert(unicode::is_forbidden_host_code_point('\\'));
-static_assert(unicode::is_forbidden_host_code_point(']'));
-static_assert(unicode::is_forbidden_host_code_point('^'));
-static_assert(unicode::is_forbidden_host_code_point('|'));
-
-constexpr static uint8_t is_forbidden_domain_code_point_table[] = {
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
+constexpr static std::array is_forbidden_domain_code_point_table =
+ []() constexpr {
+ std::array result{};
+ for (uint8_t c : {'\0', '\x09', '\x0a', '\x0d', ' ', '#', '/', ':', '<',
+ '>', '?', '@', '[', '\\', ']', '^', '|', '%'}) {
+ result[c] = true;
+ }
+ for (uint8_t c = 0; c <= 32; c++) {
+ result[c] = true;
+ }
+ for (size_t c = 127; c < 255; c++) {
+ result[c] = true;
+ }
+ return result;
+ }();
static_assert(sizeof(is_forbidden_domain_code_point_table) == 256);
@@ -9986,22 +9983,24 @@ ada_really_inline constexpr bool contains_forbidden_domain_code_point(
return accumulator;
}
-constexpr static uint8_t is_forbidden_domain_code_point_table_or_upper[] = {
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
-
-static_assert(sizeof(is_forbidden_domain_code_point_table_or_upper) == 256);
-static_assert(is_forbidden_domain_code_point_table_or_upper[uint8_t('A')] == 2);
-static_assert(is_forbidden_domain_code_point_table_or_upper[uint8_t('Z')] == 2);
+constexpr static std::array
+ is_forbidden_domain_code_point_table_or_upper = []() constexpr {
+ std::array result{};
+ for (uint8_t c : {'\0', '\x09', '\x0a', '\x0d', ' ', '#', '/', ':', '<',
+ '>', '?', '@', '[', '\\', ']', '^', '|', '%'}) {
+ result[c] = 1;
+ }
+ for (uint8_t c = 'A'; c <= 'Z'; c++) {
+ result[c] = 2;
+ }
+ for (uint8_t c = 0; c <= 32; c++) {
+ result[c] = 1;
+ }
+ for (size_t c = 127; c < 255; c++) {
+ result[c] = 1;
+ }
+ return result;
+ }();
ada_really_inline constexpr uint8_t
contains_forbidden_domain_code_point_or_upper(const char* input,
@@ -10025,41 +10024,22 @@ contains_forbidden_domain_code_point_or_upper(const char* input,
return accumulator;
}
-static_assert(unicode::is_forbidden_domain_code_point('%'));
-static_assert(unicode::is_forbidden_domain_code_point('\x7f'));
-static_assert(unicode::is_forbidden_domain_code_point('\0'));
-static_assert(unicode::is_forbidden_domain_code_point('\t'));
-static_assert(unicode::is_forbidden_domain_code_point('\n'));
-static_assert(unicode::is_forbidden_domain_code_point('\r'));
-static_assert(unicode::is_forbidden_domain_code_point(' '));
-static_assert(unicode::is_forbidden_domain_code_point('#'));
-static_assert(unicode::is_forbidden_domain_code_point('/'));
-static_assert(unicode::is_forbidden_domain_code_point(':'));
-static_assert(unicode::is_forbidden_domain_code_point('?'));
-static_assert(unicode::is_forbidden_domain_code_point('@'));
-static_assert(unicode::is_forbidden_domain_code_point('['));
-static_assert(unicode::is_forbidden_domain_code_point('?'));
-static_assert(unicode::is_forbidden_domain_code_point('<'));
-static_assert(unicode::is_forbidden_domain_code_point('>'));
-static_assert(unicode::is_forbidden_domain_code_point('\\'));
-static_assert(unicode::is_forbidden_domain_code_point(']'));
-static_assert(unicode::is_forbidden_domain_code_point('^'));
-static_assert(unicode::is_forbidden_domain_code_point('|'));
-
-constexpr static bool is_alnum_plus_table[] = {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
-
-static_assert(sizeof(is_alnum_plus_table) == 256);
+// std::isalnum(c) || c == '+' || c == '-' || c == '.') is true for
+constexpr static std::array is_alnum_plus_table = []() constexpr {
+ std::array result{};
+ for (size_t c = 0; c < 256; c++) {
+ if (c >= '0' && c <= '9') {
+ result[c] = true;
+ } else if (c >= 'a' && c <= 'z') {
+ result[c] = true;
+ } else if (c >= 'A' && c <= 'Z') {
+ result[c] = true;
+ } else if (c == '+' || c == '-' || c == '.') {
+ result[c] = true;
+ }
+ }
+ return result;
+}();
ada_really_inline constexpr bool is_alnum_plus(const char c) noexcept {
return is_alnum_plus_table[uint8_t(c)];
@@ -10067,13 +10047,6 @@ ada_really_inline constexpr bool is_alnum_plus(const char c) noexcept {
// following under most compilers: return
// return (std::isalnum(c) || c == '+' || c == '-' || c == '.');
}
-static_assert(unicode::is_alnum_plus('+'));
-static_assert(unicode::is_alnum_plus('-'));
-static_assert(unicode::is_alnum_plus('.'));
-static_assert(unicode::is_alnum_plus('0'));
-static_assert(unicode::is_alnum_plus('1'));
-static_assert(unicode::is_alnum_plus('a'));
-static_assert(unicode::is_alnum_plus('b'));
ada_really_inline constexpr bool is_ascii_hex_digit(const char c) noexcept {
return (c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') ||
@@ -10617,155 +10590,302 @@ ada_really_inline void resize(std::string_view& input, size_t pos) noexcept {
input.remove_suffix(input.size() - pos);
}
-// Reverse the byte order.
-ada_really_inline uint64_t swap_bytes(uint64_t val) noexcept {
- // performance: this often compiles to a single instruction (e.g., bswap)
- return ((((val)&0xff00000000000000ull) >> 56) |
- (((val)&0x00ff000000000000ull) >> 40) |
- (((val)&0x0000ff0000000000ull) >> 24) |
- (((val)&0x000000ff00000000ull) >> 8) |
- (((val)&0x00000000ff000000ull) << 8) |
- (((val)&0x0000000000ff0000ull) << 24) |
- (((val)&0x000000000000ff00ull) << 40) |
- (((val)&0x00000000000000ffull) << 56));
-}
-
-ada_really_inline uint64_t swap_bytes_if_big_endian(uint64_t val) noexcept {
- // performance: under little-endian systems (most systems), this function
- // is free (just returns the input).
-#if ADA_IS_BIG_ENDIAN
- return swap_bytes(val);
-#else
- return val; // unchanged (trivial)
-#endif
+// computes the number of trailing zeroes
+// this is a private inline function only defined in this source file.
+ada_really_inline int trailing_zeroes(uint32_t input_num) noexcept {
+#ifdef ADA_REGULAR_VISUAL_STUDIO
+ unsigned long ret;
+ // Search the mask data from least significant bit (LSB)
+ // to the most significant bit (MSB) for a set bit (1).
+ _BitScanForward(&ret, input_num);
+ return (int)ret;
+#else // ADA_REGULAR_VISUAL_STUDIO
+ return __builtin_ctzl(input_num);
+#endif // ADA_REGULAR_VISUAL_STUDIO
}
// starting at index location, this finds the next location of a character
// :, /, \\, ? or [. If none is found, view.size() is returned.
// For use within get_host_delimiter_location.
+#if ADA_NEON
+// The ada_make_uint8x16_t macro is necessary because Visual Studio does not
+// support direct initialization of uint8x16_t. See
+// https://developercommunity.visualstudio.com/t/error-C2078:-too-many-initializers-whe/402911?q=backend+neon
+#ifndef ada_make_uint8x16_t
+#define ada_make_uint8x16_t(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, \
+ x13, x14, x15, x16) \
+ ([=]() { \
+ static uint8_t array[16] = {x1, x2, x3, x4, x5, x6, x7, x8, \
+ x9, x10, x11, x12, x13, x14, x15, x16}; \
+ return vld1q_u8(array); \
+ }())
+#endif
+
ada_really_inline size_t find_next_host_delimiter_special(
std::string_view view, size_t location) noexcept {
- // performance: if you plan to call find_next_host_delimiter more than once,
- // you *really* want find_next_host_delimiter to be inlined, because
- // otherwise, the constants may get reloaded each time (bad).
- auto has_zero_byte = [](uint64_t v) {
- return ((v - 0x0101010101010101) & ~(v)&0x8080808080808080);
- };
- auto index_of_first_set_byte = [](uint64_t v) {
- return ((((v - 1) & 0x101010101010101) * 0x101010101010101) >> 56) - 1;
- };
- auto broadcast = [](uint8_t v) -> uint64_t {
- return 0x101010101010101ull * v;
+ // first check for short strings in which case we do it naively.
+ if (view.size() - location < 16) { // slow path
+ for (size_t i = location; i < view.size(); i++) {
+ if (view[i] == ':' || view[i] == '/' || view[i] == '\\' ||
+ view[i] == '?' || view[i] == '[') {
+ return i;
+ }
+ }
+ return size_t(view.size());
+ }
+ auto to_bitmask = [](uint8x16_t input) -> uint16_t {
+ uint8x16_t bit_mask =
+ ada_make_uint8x16_t(0x01, 0x02, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80, 0x01,
+ 0x02, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80);
+ uint8x16_t minput = vandq_u8(input, bit_mask);
+ uint8x16_t tmp = vpaddq_u8(minput, minput);
+ tmp = vpaddq_u8(tmp, tmp);
+ tmp = vpaddq_u8(tmp, tmp);
+ return vgetq_lane_u16(vreinterpretq_u16_u8(tmp), 0);
};
+
+ // fast path for long strings (expected to be common)
size_t i = location;
- uint64_t mask1 = broadcast(':');
- uint64_t mask2 = broadcast('/');
- uint64_t mask3 = broadcast('\\');
- uint64_t mask4 = broadcast('?');
- uint64_t mask5 = broadcast('[');
- // This loop will get autovectorized under many optimizing compilers,
- // so you get actually SIMD!
- for (; i + 7 < view.size(); i += 8) {
- uint64_t word{};
- // performance: the next memcpy translates into a single CPU instruction.
- memcpy(&word, view.data() + i, sizeof(word));
- // performance: on little-endian systems (most systems), this next line is
- // free.
- word = swap_bytes_if_big_endian(word);
- uint64_t xor1 = word ^ mask1;
- uint64_t xor2 = word ^ mask2;
- uint64_t xor3 = word ^ mask3;
- uint64_t xor4 = word ^ mask4;
- uint64_t xor5 = word ^ mask5;
- uint64_t is_match = has_zero_byte(xor1) | has_zero_byte(xor2) |
- has_zero_byte(xor3) | has_zero_byte(xor4) |
- has_zero_byte(xor5);
- if (is_match) {
- return size_t(i + index_of_first_set_byte(is_match));
+ uint8x16_t low_mask =
+ ada_make_uint8x16_t(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x01, 0x04, 0x04, 0x00, 0x00, 0x03);
+ uint8x16_t high_mask =
+ ada_make_uint8x16_t(0x00, 0x00, 0x02, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
+ uint8x16_t fmask = vmovq_n_u8(0xf);
+ uint8x16_t zero{0};
+ for (; i + 15 < view.size(); i += 16) {
+ uint8x16_t word = vld1q_u8((const uint8_t*)view.data() + i);
+ uint8x16_t lowpart = vqtbl1q_u8(low_mask, vandq_u8(word, fmask));
+ uint8x16_t highpart = vqtbl1q_u8(high_mask, vshrq_n_u8(word, 4));
+ uint8x16_t classify = vandq_u8(lowpart, highpart);
+ if (vmaxvq_u8(classify) != 0) {
+ uint8x16_t is_zero = vceqq_u8(classify, zero);
+ uint16_t is_non_zero = ~to_bitmask(is_zero);
+ return i + trailing_zeroes(is_non_zero);
}
}
+
if (i < view.size()) {
- uint64_t word{};
- // performance: the next memcpy translates into a function call, but
- // that is difficult to avoid. Might be a bit expensive.
- memcpy(&word, view.data() + i, view.size() - i);
- word = swap_bytes_if_big_endian(word);
- uint64_t xor1 = word ^ mask1;
- uint64_t xor2 = word ^ mask2;
- uint64_t xor3 = word ^ mask3;
- uint64_t xor4 = word ^ mask4;
- uint64_t xor5 = word ^ mask5;
- uint64_t is_match = has_zero_byte(xor1) | has_zero_byte(xor2) |
- has_zero_byte(xor3) | has_zero_byte(xor4) |
- has_zero_byte(xor5);
- if (is_match) {
- return size_t(i + index_of_first_set_byte(is_match));
+ uint8x16_t word =
+ vld1q_u8((const uint8_t*)view.data() + view.length() - 16);
+ uint8x16_t lowpart = vqtbl1q_u8(low_mask, vandq_u8(word, fmask));
+ uint8x16_t highpart = vqtbl1q_u8(high_mask, vshrq_n_u8(word, 4));
+ uint8x16_t classify = vandq_u8(lowpart, highpart);
+ if (vmaxvq_u8(classify) != 0) {
+ uint8x16_t is_zero = vceqq_u8(classify, zero);
+ uint16_t is_non_zero = ~to_bitmask(is_zero);
+ return view.length() - 16 + trailing_zeroes(is_non_zero);
+ }
+ }
+ return size_t(view.size());
+}
+#elif ADA_SSE2
+ada_really_inline size_t find_next_host_delimiter_special(
+ std::string_view view, size_t location) noexcept {
+ // first check for short strings in which case we do it naively.
+ if (view.size() - location < 16) { // slow path
+ for (size_t i = location; i < view.size(); i++) {
+ if (view[i] == ':' || view[i] == '/' || view[i] == '\\' ||
+ view[i] == '?' || view[i] == '[') {
+ return i;
+ }
+ }
+ return size_t(view.size());
+ }
+ // fast path for long strings (expected to be common)
+ size_t i = location;
+ const __m128i mask1 = _mm_set1_epi8(':');
+ const __m128i mask2 = _mm_set1_epi8('/');
+ const __m128i mask3 = _mm_set1_epi8('\\');
+ const __m128i mask4 = _mm_set1_epi8('?');
+ const __m128i mask5 = _mm_set1_epi8('[');
+
+ for (; i + 15 < view.size(); i += 16) {
+ __m128i word = _mm_loadu_si128((const __m128i*)(view.data() + i));
+ __m128i m1 = _mm_cmpeq_epi8(word, mask1);
+ __m128i m2 = _mm_cmpeq_epi8(word, mask2);
+ __m128i m3 = _mm_cmpeq_epi8(word, mask3);
+ __m128i m4 = _mm_cmpeq_epi8(word, mask4);
+ __m128i m5 = _mm_cmpeq_epi8(word, mask5);
+ __m128i m = _mm_or_si128(
+ _mm_or_si128(_mm_or_si128(m1, m2), _mm_or_si128(m3, m4)), m5);
+ int mask = _mm_movemask_epi8(m);
+ if (mask != 0) {
+ return i + trailing_zeroes(mask);
}
}
- return view.size();
+ if (i < view.size()) {
+ __m128i word =
+ _mm_loadu_si128((const __m128i*)(view.data() + view.length() - 16));
+ __m128i m1 = _mm_cmpeq_epi8(word, mask1);
+ __m128i m2 = _mm_cmpeq_epi8(word, mask2);
+ __m128i m3 = _mm_cmpeq_epi8(word, mask3);
+ __m128i m4 = _mm_cmpeq_epi8(word, mask4);
+ __m128i m5 = _mm_cmpeq_epi8(word, mask5);
+ __m128i m = _mm_or_si128(
+ _mm_or_si128(_mm_or_si128(m1, m2), _mm_or_si128(m3, m4)), m5);
+ int mask = _mm_movemask_epi8(m);
+ if (mask != 0) {
+ return view.length() - 16 + trailing_zeroes(mask);
+ }
+ }
+ return size_t(view.length());
}
+#else
+// : / [ \\ ?
+static constexpr std::array special_host_delimiters =
+ []() constexpr {
+ std::array result{};
+ for (int i : {':', '/', '[', '\\', '?'}) {
+ result[i] = 1;
+ }
+ return result;
+ }();
+// credit: @the-moisrex recommended a table-based approach
+ada_really_inline size_t find_next_host_delimiter_special(
+ std::string_view view, size_t location) noexcept {
+ auto const str = view.substr(location);
+ for (auto pos = str.begin(); pos != str.end(); ++pos) {
+ if (special_host_delimiters[(uint8_t)*pos]) {
+ return pos - str.begin() + location;
+ }
+ }
+ return size_t(view.size());
+}
+#endif
// starting at index location, this finds the next location of a character
// :, /, ? or [. If none is found, view.size() is returned.
// For use within get_host_delimiter_location.
+#if ADA_NEON
ada_really_inline size_t find_next_host_delimiter(std::string_view view,
size_t location) noexcept {
- // performance: if you plan to call find_next_host_delimiter more than once,
- // you *really* want find_next_host_delimiter to be inlined, because
- // otherwise, the constants may get reloaded each time (bad).
- auto has_zero_byte = [](uint64_t v) {
- return ((v - 0x0101010101010101) & ~(v)&0x8080808080808080);
- };
- auto index_of_first_set_byte = [](uint64_t v) {
- return ((((v - 1) & 0x101010101010101) * 0x101010101010101) >> 56) - 1;
- };
- auto broadcast = [](uint8_t v) -> uint64_t {
- return 0x101010101010101ull * v;
+ // first check for short strings in which case we do it naively.
+ if (view.size() - location < 16) { // slow path
+ for (size_t i = location; i < view.size(); i++) {
+ if (view[i] == ':' || view[i] == '/' || view[i] == '?' ||
+ view[i] == '[') {
+ return i;
+ }
+ }
+ return size_t(view.size());
+ }
+ auto to_bitmask = [](uint8x16_t input) -> uint16_t {
+ uint8x16_t bit_mask =
+ ada_make_uint8x16_t(0x01, 0x02, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80, 0x01,
+ 0x02, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80);
+ uint8x16_t minput = vandq_u8(input, bit_mask);
+ uint8x16_t tmp = vpaddq_u8(minput, minput);
+ tmp = vpaddq_u8(tmp, tmp);
+ tmp = vpaddq_u8(tmp, tmp);
+ return vgetq_lane_u16(vreinterpretq_u16_u8(tmp), 0);
};
+
+ // fast path for long strings (expected to be common)
size_t i = location;
- uint64_t mask1 = broadcast(':');
- uint64_t mask2 = broadcast('/');
- uint64_t mask4 = broadcast('?');
- uint64_t mask5 = broadcast('[');
- // This loop will get autovectorized under many optimizing compilers,
- // so you get actually SIMD!
- for (; i + 7 < view.size(); i += 8) {
- uint64_t word{};
- // performance: the next memcpy translates into a single CPU instruction.
- memcpy(&word, view.data() + i, sizeof(word));
- // performance: on little-endian systems (most systems), this next line is
- // free.
- word = swap_bytes_if_big_endian(word);
- uint64_t xor1 = word ^ mask1;
- uint64_t xor2 = word ^ mask2;
- uint64_t xor4 = word ^ mask4;
- uint64_t xor5 = word ^ mask5;
- uint64_t is_match = has_zero_byte(xor1) | has_zero_byte(xor2) |
- has_zero_byte(xor4) | has_zero_byte(xor5);
- if (is_match) {
- return size_t(i + index_of_first_set_byte(is_match));
+ uint8x16_t low_mask =
+ ada_make_uint8x16_t(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x01, 0x04, 0x00, 0x00, 0x00, 0x03);
+ uint8x16_t high_mask =
+ ada_make_uint8x16_t(0x00, 0x00, 0x02, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
+ uint8x16_t fmask = vmovq_n_u8(0xf);
+ uint8x16_t zero{0};
+ for (; i + 15 < view.size(); i += 16) {
+ uint8x16_t word = vld1q_u8((const uint8_t*)view.data() + i);
+ uint8x16_t lowpart = vqtbl1q_u8(low_mask, vandq_u8(word, fmask));
+ uint8x16_t highpart = vqtbl1q_u8(high_mask, vshrq_n_u8(word, 4));
+ uint8x16_t classify = vandq_u8(lowpart, highpart);
+ if (vmaxvq_u8(classify) != 0) {
+ uint8x16_t is_zero = vceqq_u8(classify, zero);
+ uint16_t is_non_zero = ~to_bitmask(is_zero);
+ return i + trailing_zeroes(is_non_zero);
}
}
+
if (i < view.size()) {
- uint64_t word{};
- // performance: the next memcpy translates into a function call, but
- // that is difficult to avoid. Might be a bit expensive.
- memcpy(&word, view.data() + i, view.size() - i);
- // performance: on little-endian systems (most systems), this next line is
- // free.
- word = swap_bytes_if_big_endian(word);
- uint64_t xor1 = word ^ mask1;
- uint64_t xor2 = word ^ mask2;
- uint64_t xor4 = word ^ mask4;
- uint64_t xor5 = word ^ mask5;
- uint64_t is_match = has_zero_byte(xor1) | has_zero_byte(xor2) |
- has_zero_byte(xor4) | has_zero_byte(xor5);
- if (is_match) {
- return size_t(i + index_of_first_set_byte(is_match));
+ uint8x16_t word =
+ vld1q_u8((const uint8_t*)view.data() + view.length() - 16);
+ uint8x16_t lowpart = vqtbl1q_u8(low_mask, vandq_u8(word, fmask));
+ uint8x16_t highpart = vqtbl1q_u8(high_mask, vshrq_n_u8(word, 4));
+ uint8x16_t classify = vandq_u8(lowpart, highpart);
+ if (vmaxvq_u8(classify) != 0) {
+ uint8x16_t is_zero = vceqq_u8(classify, zero);
+ uint16_t is_non_zero = ~to_bitmask(is_zero);
+ return view.length() - 16 + trailing_zeroes(is_non_zero);
+ }
+ }
+ return size_t(view.size());
+}
+#elif ADA_SSE2
+ada_really_inline size_t find_next_host_delimiter(std::string_view view,
+ size_t location) noexcept {
+ // first check for short strings in which case we do it naively.
+ if (view.size() - location < 16) { // slow path
+ for (size_t i = location; i < view.size(); i++) {
+ if (view[i] == ':' || view[i] == '/' || view[i] == '?' ||
+ view[i] == '[') {
+ return i;
+ }
+ }
+ return size_t(view.size());
+ }
+ // fast path for long strings (expected to be common)
+ size_t i = location;
+ const __m128i mask1 = _mm_set1_epi8(':');
+ const __m128i mask2 = _mm_set1_epi8('/');
+ const __m128i mask4 = _mm_set1_epi8('?');
+ const __m128i mask5 = _mm_set1_epi8('[');
+
+ for (; i + 15 < view.size(); i += 16) {
+ __m128i word = _mm_loadu_si128((const __m128i*)(view.data() + i));
+ __m128i m1 = _mm_cmpeq_epi8(word, mask1);
+ __m128i m2 = _mm_cmpeq_epi8(word, mask2);
+ __m128i m4 = _mm_cmpeq_epi8(word, mask4);
+ __m128i m5 = _mm_cmpeq_epi8(word, mask5);
+ __m128i m = _mm_or_si128(_mm_or_si128(m1, m2), _mm_or_si128(m4, m5));
+ int mask = _mm_movemask_epi8(m);
+ if (mask != 0) {
+ return i + trailing_zeroes(mask);
}
}
- return view.size();
+ if (i < view.size()) {
+ __m128i word =
+ _mm_loadu_si128((const __m128i*)(view.data() + view.length() - 16));
+ __m128i m1 = _mm_cmpeq_epi8(word, mask1);
+ __m128i m2 = _mm_cmpeq_epi8(word, mask2);
+ __m128i m4 = _mm_cmpeq_epi8(word, mask4);
+ __m128i m5 = _mm_cmpeq_epi8(word, mask5);
+ __m128i m = _mm_or_si128(_mm_or_si128(m1, m2), _mm_or_si128(m4, m5));
+ int mask = _mm_movemask_epi8(m);
+ if (mask != 0) {
+ return view.length() - 16 + trailing_zeroes(mask);
+ }
+ }
+ return size_t(view.length());
}
+#else
+// : / [ ?
+static constexpr std::array host_delimiters = []() constexpr {
+ std::array result{};
+ for (int i : {':', '/', '?', '['}) {
+ result[i] = 1;
+ }
+ return result;
+}();
+// credit: @the-moisrex recommended a table-based approach
+ada_really_inline size_t find_next_host_delimiter(std::string_view view,
+ size_t location) noexcept {
+ auto const str = view.substr(location);
+ for (auto pos = str.begin(); pos != str.end(); ++pos) {
+ if (host_delimiters[(uint8_t)*pos]) {
+ return pos - str.begin() + location;
+ }
+ }
+ return size_t(view.size());
+}
+#endif
ada_really_inline std::pair get_host_delimiter_location(
const bool is_special, std::string_view& view) noexcept {
@@ -11040,101 +11160,47 @@ ada_really_inline void strip_trailing_spaces_from_opaque_path(
url.update_base_pathname(path);
}
+// @ / \\ ?
+static constexpr std::array authority_delimiter_special =
+ []() constexpr {
+ std::array result{};
+ for (int i : {'@', '/', '\\', '?'}) {
+ result[i] = 1;
+ }
+ return result;
+ }();
+// credit: @the-moisrex recommended a table-based approach
ada_really_inline size_t
find_authority_delimiter_special(std::string_view view) noexcept {
- auto has_zero_byte = [](uint64_t v) {
- return ((v - 0x0101010101010101) & ~(v)&0x8080808080808080);
- };
- auto index_of_first_set_byte = [](uint64_t v) {
- return ((((v - 1) & 0x101010101010101) * 0x101010101010101) >> 56) - 1;
- };
- auto broadcast = [](uint8_t v) -> uint64_t {
- return 0x101010101010101ull * v;
- };
- size_t i = 0;
- uint64_t mask1 = broadcast('@');
- uint64_t mask2 = broadcast('/');
- uint64_t mask3 = broadcast('?');
- uint64_t mask4 = broadcast('\\');
-
- for (; i + 7 < view.size(); i += 8) {
- uint64_t word{};
- memcpy(&word, view.data() + i, sizeof(word));
- word = swap_bytes_if_big_endian(word);
- uint64_t xor1 = word ^ mask1;
- uint64_t xor2 = word ^ mask2;
- uint64_t xor3 = word ^ mask3;
- uint64_t xor4 = word ^ mask4;
- uint64_t is_match = has_zero_byte(xor1) | has_zero_byte(xor2) |
- has_zero_byte(xor3) | has_zero_byte(xor4);
- if (is_match) {
- return size_t(i + index_of_first_set_byte(is_match));
+ // performance note: we might be able to gain further performance
+ // with SIMD instrinsics.
+ for (auto pos = view.begin(); pos != view.end(); ++pos) {
+ if (authority_delimiter_special[(uint8_t)*pos]) {
+ return pos - view.begin();
}
}
-
- if (i < view.size()) {
- uint64_t word{};
- memcpy(&word, view.data() + i, view.size() - i);
- word = swap_bytes_if_big_endian(word);
- uint64_t xor1 = word ^ mask1;
- uint64_t xor2 = word ^ mask2;
- uint64_t xor3 = word ^ mask3;
- uint64_t xor4 = word ^ mask4;
- uint64_t is_match = has_zero_byte(xor1) | has_zero_byte(xor2) |
- has_zero_byte(xor3) | has_zero_byte(xor4);
- if (is_match) {
- return size_t(i + index_of_first_set_byte(is_match));
- }
- }
-
- return view.size();
+ return size_t(view.size());
}
+// @ / ?
+static constexpr std::array authority_delimiter = []() constexpr {
+ std::array result{};
+ for (int i : {'@', '/', '?'}) {
+ result[i] = 1;
+ }
+ return result;
+}();
+// credit: @the-moisrex recommended a table-based approach
ada_really_inline size_t
find_authority_delimiter(std::string_view view) noexcept {
- auto has_zero_byte = [](uint64_t v) {
- return ((v - 0x0101010101010101) & ~(v)&0x8080808080808080);
- };
- auto index_of_first_set_byte = [](uint64_t v) {
- return ((((v - 1) & 0x101010101010101) * 0x101010101010101) >> 56) - 1;
- };
- auto broadcast = [](uint8_t v) -> uint64_t {
- return 0x101010101010101ull * v;
- };
- size_t i = 0;
- uint64_t mask1 = broadcast('@');
- uint64_t mask2 = broadcast('/');
- uint64_t mask3 = broadcast('?');
-
- for (; i + 7 < view.size(); i += 8) {
- uint64_t word{};
- memcpy(&word, view.data() + i, sizeof(word));
- word = swap_bytes_if_big_endian(word);
- uint64_t xor1 = word ^ mask1;
- uint64_t xor2 = word ^ mask2;
- uint64_t xor3 = word ^ mask3;
- uint64_t is_match =
- has_zero_byte(xor1) | has_zero_byte(xor2) | has_zero_byte(xor3);
- if (is_match) {
- return size_t(i + index_of_first_set_byte(is_match));
+ // performance note: we might be able to gain further performance
+ // with SIMD instrinsics.
+ for (auto pos = view.begin(); pos != view.end(); ++pos) {
+ if (authority_delimiter[(uint8_t)*pos]) {
+ return pos - view.begin();
}
}
-
- if (i < view.size()) {
- uint64_t word{};
- memcpy(&word, view.data() + i, view.size() - i);
- word = swap_bytes_if_big_endian(word);
- uint64_t xor1 = word ^ mask1;
- uint64_t xor2 = word ^ mask2;
- uint64_t xor3 = word ^ mask3;
- uint64_t is_match =
- has_zero_byte(xor1) | has_zero_byte(xor2) | has_zero_byte(xor3);
- if (is_match) {
- return size_t(i + index_of_first_set_byte(is_match));
- }
- }
-
- return view.size();
+ return size_t(view.size());
}
} // namespace ada::helpers
@@ -11143,6 +11209,7 @@ namespace ada {
ada_warn_unused std::string to_string(ada::state state) {
return ada::helpers::get_state(state);
}
+#undef ada_make_uint8x16_t
} // namespace ada
/* end file src/helpers.cpp */
/* begin file src/url.cpp */
@@ -11154,7 +11221,7 @@ ada_warn_unused std::string to_string(ada::state state) {
namespace ada {
bool url::parse_opaque_host(std::string_view input) {
- ada_log("parse_opaque_host ", input, "[", input.size(), " bytes]");
+ ada_log("parse_opaque_host ", input, " [", input.size(), " bytes]");
if (std::any_of(input.begin(), input.end(),
ada::unicode::is_forbidden_host_code_point)) {
return is_valid = false;
@@ -11168,7 +11235,7 @@ bool url::parse_opaque_host(std::string_view input) {
}
bool url::parse_ipv4(std::string_view input) {
- ada_log("parse_ipv4 ", input, "[", input.size(), " bytes]");
+ ada_log("parse_ipv4 ", input, " [", input.size(), " bytes]");
if (input.back() == '.') {
input.remove_suffix(1);
}
@@ -11210,7 +11277,7 @@ bool url::parse_ipv4(std::string_view input) {
// We have the last value.
// At this stage, ipv4 contains digit_count*8 bits.
// So we have 32-digit_count*8 bits left.
- if (segment_result > (uint64_t(1) << (32 - digit_count * 8))) {
+ if (segment_result >= (uint64_t(1) << (32 - digit_count * 8))) {
return is_valid = false;
}
ipv4 <<= (32 - digit_count * 8);
@@ -11243,7 +11310,7 @@ bool url::parse_ipv4(std::string_view input) {
}
bool url::parse_ipv6(std::string_view input) {
- ada_log("parse_ipv6 ", input, "[", input.size(), " bytes]");
+ ada_log("parse_ipv6 ", input, " [", input.size(), " bytes]");
if (input.empty()) {
return is_valid = false;
@@ -11567,7 +11634,7 @@ ada_really_inline bool url::parse_scheme(const std::string_view input) {
}
ada_really_inline bool url::parse_host(std::string_view input) {
- ada_log("parse_host ", input, "[", input.size(), " bytes]");
+ ada_log("parse_host ", input, " [", input.size(), " bytes]");
if (input.empty()) {
return is_valid = false;
} // technically unnecessary.
@@ -11619,6 +11686,8 @@ ada_really_inline bool url::parse_host(std::string_view input) {
ada_log("parse_host to_ascii returns false");
return is_valid = false;
}
+ ada_log("parse_host to_ascii succeeded ", *host, " [", host->size(),
+ " bytes]");
if (std::any_of(host.value().begin(), host.value().end(),
ada::unicode::is_forbidden_domain_code_point)) {
@@ -11629,7 +11698,7 @@ ada_really_inline bool url::parse_host(std::string_view input) {
// If asciiDomain ends in a number, then return the result of IPv4 parsing
// asciiDomain.
if (checkers::is_ipv4(host.value())) {
- ada_log("parse_host got ipv4", *host);
+ ada_log("parse_host got ipv4 ", *host);
return parse_ipv4(host.value());
}
@@ -13504,7 +13573,7 @@ void url_aggregator::set_hash(const std::string_view input) {
bool url_aggregator::set_href(const std::string_view input) {
ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
- ada_log("url_aggregator::set_href ", input, "[", input.size(), " bytes]");
+ ada_log("url_aggregator::set_href ", input, " [", input.size(), " bytes]");
ada::result out = ada::parse(input);
ada_log("url_aggregator::set_href, success :", out.has_value());
@@ -13518,7 +13587,8 @@ bool url_aggregator::set_href(const std::string_view input) {
}
ada_really_inline bool url_aggregator::parse_host(std::string_view input) {
- ada_log("url_aggregator:parse_host ", input, "[", input.size(), " bytes]");
+ ada_log("url_aggregator:parse_host \"", input, "\" [", input.size(),
+ " bytes]");
ADA_ASSERT_TRUE(validate());
ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
if (input.empty()) {
@@ -13568,7 +13638,7 @@ ada_really_inline bool url_aggregator::parse_host(std::string_view input) {
update_base_hostname(input);
if (checkers::is_ipv4(get_hostname())) {
ada_log("parse_host fast path ipv4");
- return parse_ipv4(get_hostname());
+ return parse_ipv4(get_hostname(), true);
}
ada_log("parse_host fast path ", get_hostname());
return true;
@@ -13584,6 +13654,8 @@ ada_really_inline bool url_aggregator::parse_host(std::string_view input) {
ada_log("parse_host to_ascii returns false");
return is_valid = false;
}
+ ada_log("parse_host to_ascii succeeded ", *host, " [", host->size(),
+ " bytes]");
if (std::any_of(host.value().begin(), host.value().end(),
ada::unicode::is_forbidden_domain_code_point)) {
@@ -13593,8 +13665,8 @@ ada_really_inline bool url_aggregator::parse_host(std::string_view input) {
// If asciiDomain ends in a number, then return the result of IPv4 parsing
// asciiDomain.
if (checkers::is_ipv4(host.value())) {
- ada_log("parse_host got ipv4", *host);
- return parse_ipv4(host.value());
+ ada_log("parse_host got ipv4 ", *host);
+ return parse_ipv4(host.value(), false);
}
update_base_hostname(host.value());
@@ -13847,7 +13919,7 @@ bool url_aggregator::set_hostname(const std::string_view input) {
}
[[nodiscard]] std::string ada::url_aggregator::to_string() const {
- ada_log("url_aggregator::to_string buffer:", buffer, "[", buffer.size(),
+ ada_log("url_aggregator::to_string buffer:", buffer, " [", buffer.size(),
" bytes]");
if (!is_valid) {
return "null";
@@ -13946,8 +14018,8 @@ bool url_aggregator::set_hostname(const std::string_view input) {
return checkers::verify_dns_length(get_hostname());
}
-bool url_aggregator::parse_ipv4(std::string_view input) {
- ada_log("parse_ipv4 ", input, "[", input.size(),
+bool url_aggregator::parse_ipv4(std::string_view input, bool in_place) {
+ ada_log("parse_ipv4 ", input, " [", input.size(),
" bytes], overlaps with buffer: ",
helpers::overlaps(input, buffer) ? "yes" : "no");
ADA_ASSERT_TRUE(validate());
@@ -13971,27 +14043,32 @@ bool url_aggregator::parse_ipv4(std::string_view input) {
} else {
std::from_chars_result r;
if (is_hex) {
+ ada_log("parse_ipv4 trying to parse hex number");
r = std::from_chars(input.data() + 2, input.data() + input.size(),
segment_result, 16);
} else if ((input.length() >= 2) && input[0] == '0' &&
checkers::is_digit(input[1])) {
+ ada_log("parse_ipv4 trying to parse octal number");
r = std::from_chars(input.data() + 1, input.data() + input.size(),
segment_result, 8);
} else {
+ ada_log("parse_ipv4 trying to parse decimal number");
pure_decimal_count++;
r = std::from_chars(input.data(), input.data() + input.size(),
segment_result, 10);
}
if (r.ec != std::errc()) {
+ ada_log("parse_ipv4 parsing failed");
return is_valid = false;
}
+ ada_log("parse_ipv4 parsed ", segment_result);
input.remove_prefix(r.ptr - input.data());
}
if (input.empty()) {
// We have the last value.
// At this stage, ipv4 contains digit_count*8 bits.
// So we have 32-digit_count*8 bits left.
- if (segment_result > (uint64_t(1) << (32 - digit_count * 8))) {
+ if (segment_result >= (uint64_t(1) << (32 - digit_count * 8))) {
return is_valid = false;
}
ipv4 <<= (32 - digit_count * 8);
@@ -14009,6 +14086,7 @@ bool url_aggregator::parse_ipv4(std::string_view input) {
}
}
if ((digit_count != 4) || (!input.empty())) {
+ ada_log("parse_ipv4 found invalid (more than 4 numbers or empty) ");
return is_valid = false;
}
final:
@@ -14016,10 +14094,14 @@ bool url_aggregator::parse_ipv4(std::string_view input) {
" host: ", get_host());
// We could also check r.ptr to see where the parsing ended.
- if (pure_decimal_count == 4 && !trailing_dot) {
+ if (in_place && pure_decimal_count == 4 && !trailing_dot) {
+ ada_log(
+ "url_aggregator::parse_ipv4 completed and was already correct in the "
+ "buffer");
// The original input was already all decimal and we validated it. So we
// don't need to do anything.
} else {
+ ada_log("url_aggregator::parse_ipv4 completed and we need to update it");
// Optimization opportunity: Get rid of unnecessary string return in ipv4
// serializer.
// TODO: This is likely a bug because it goes back update_base_hostname, not
@@ -14033,8 +14115,11 @@ bool url_aggregator::parse_ipv4(std::string_view input) {
}
bool url_aggregator::parse_ipv6(std::string_view input) {
+ // TODO: Implement in_place optimization: we know that input points
+ // in the buffer, so we can just check whether the buffer is already
+ // well formatted.
// TODO: Find a way to merge parse_ipv6 with url.cpp implementation.
- ada_log("parse_ipv6 ", input, "[", input.size(), " bytes]");
+ ada_log("parse_ipv6 ", input, " [", input.size(), " bytes]");
ADA_ASSERT_TRUE(validate());
ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
if (input.empty()) {
@@ -14268,7 +14353,7 @@ bool url_aggregator::parse_ipv6(std::string_view input) {
}
bool url_aggregator::parse_opaque_host(std::string_view input) {
- ada_log("parse_opaque_host ", input, "[", input.size(), " bytes]");
+ ada_log("parse_opaque_host ", input, " [", input.size(), " bytes]");
ADA_ASSERT_TRUE(validate());
ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
if (std::any_of(input.begin(), input.end(),
diff --git a/deps/ada/ada.h b/deps/ada/ada.h
index 6d98b37075f892..03a22534d3f87c 100644
--- a/deps/ada/ada.h
+++ b/deps/ada/ada.h
@@ -1,4 +1,4 @@
-/* auto-generated on 2023-10-22 19:50:50 -0400. Do not edit! */
+/* auto-generated on 2024-01-29 13:13:24 -0500. Do not edit! */
/* begin file include/ada.h */
/**
* @file ada.h
@@ -1670,18 +1670,6 @@ template
ada_really_inline void strip_trailing_spaces_from_opaque_path(
url_type& url) noexcept;
-/**
- * @private
- * Reverse the order of the bytes.
- */
-ada_really_inline uint64_t swap_bytes(uint64_t val) noexcept;
-
-/**
- * @private
- * Reverse the order of the bytes but only if the system is big endian
- */
-ada_really_inline uint64_t swap_bytes_if_big_endian(uint64_t val) noexcept;
-
/**
* @private
* Finds the delimiter of a view in authority state.
@@ -4880,10 +4868,12 @@ struct url_aggregator : url_base {
}
/**
- * Return true on success.
+ * Return true on success. The 'in_place' parameter indicates whether the
+ * the string_view input is pointing in the buffer. When in_place is false,
+ * we must nearly always update the buffer.
* @see https://url.spec.whatwg.org/#concept-ipv4-parser
*/
- [[nodiscard]] bool parse_ipv4(std::string_view input);
+ [[nodiscard]] bool parse_ipv4(std::string_view input, bool in_place);
/**
* Return true on success.
@@ -5032,7 +5022,9 @@ ada_really_inline bool begins_with(std::string_view view,
std::string_view prefix);
/**
- * Returns true if an input is an ipv4 address.
+ * Returns true if an input is an ipv4 address. It is assumed that the string
+ * does not contain uppercase ASCII characters (the input should have been
+ * lowered cased before calling this function) and is not empty.
*/
ada_really_inline ada_constexpr bool is_ipv4(std::string_view view) noexcept;
@@ -7088,14 +7080,14 @@ url_search_params_entries_iter::next() {
#ifndef ADA_ADA_VERSION_H
#define ADA_ADA_VERSION_H
-#define ADA_VERSION "2.7.2"
+#define ADA_VERSION "2.7.6"
namespace ada {
enum {
ADA_VERSION_MAJOR = 2,
ADA_VERSION_MINOR = 7,
- ADA_VERSION_REVISION = 2,
+ ADA_VERSION_REVISION = 6,
};
} // namespace ada
diff --git a/deps/base64/base64.gyp b/deps/base64/base64.gyp
index be68561708fef0..7bba55dbd9b498 100644
--- a/deps/base64/base64.gyp
+++ b/deps/base64/base64.gyp
@@ -46,6 +46,7 @@
'HAVE_SSE42=1',
'HAVE_AVX=1',
'HAVE_AVX2=1',
+ 'HAVE_AVX512=1',
],
'dependencies': [
'base64_ssse3',
@@ -53,6 +54,7 @@
'base64_sse42',
'base64_avx',
'base64_avx2',
+ 'base64_avx512',
],
}, {
'sources': [
@@ -61,6 +63,7 @@
'base64/lib/arch/sse42/codec.c',
'base64/lib/arch/avx/codec.c',
'base64/lib/arch/avx2/codec.c',
+ 'base64/lib/arch/avx512/codec.c',
],
}],
],
@@ -162,6 +165,30 @@
],
},
+ {
+ 'target_name': 'base64_avx512',
+ 'type': 'static_library',
+ 'include_dirs': [ 'base64/include', 'base64/lib' ],
+ 'sources': [ 'base64/lib/arch/avx512/codec.c' ],
+ 'defines': [ 'BASE64_STATIC_DEFINE', 'HAVE_AVX512=1' ],
+ 'conditions': [
+ [ 'OS!="win"', {
+ 'cflags': [ '-mavx512vl', '-mavx512vbmi' ],
+ 'xcode_settings': {
+ 'OTHER_CFLAGS': [ '-mavx512vl', '-mavx512vbmi' ]
+ },
+ }, {
+ 'msvs_settings': {
+ 'VCCLCompilerTool': {
+ 'AdditionalOptions': [
+ '/arch:AVX512'
+ ],
+ },
+ },
+ }],
+ ],
+ },
+
{
'target_name': 'base64_neon32',
'type': 'static_library',
diff --git a/deps/base64/base64/.gitignore b/deps/base64/base64/.gitignore
index 837a2306a6294b..bb7b160deb3702 100644
--- a/deps/base64/base64/.gitignore
+++ b/deps/base64/base64/.gitignore
@@ -1,12 +1 @@
-*.o
-bin/base64
-lib/config.h
-test/benchmark
-test/test_base64
-
-# visual studio symbol db, etc.
-.vs/
-# build directory used by CMakePresets
-out/
-# private cmake presets
-CMakeUserPresets.json
+# Intentionally empty
diff --git a/deps/base64/base64/CMakeLists.txt b/deps/base64/base64/CMakeLists.txt
index 56076e47a6aa3a..ff9f6f21e1ee28 100644
--- a/deps/base64/base64/CMakeLists.txt
+++ b/deps/base64/base64/CMakeLists.txt
@@ -17,7 +17,7 @@ if (POLICY CMP0127)
cmake_policy(SET CMP0127 NEW)
endif()
-project(base64 LANGUAGES C VERSION 0.5.0)
+project(base64 LANGUAGES C VERSION 0.5.2)
include(GNUInstallDirs)
include(CMakeDependentOption)
@@ -62,6 +62,8 @@ cmake_dependent_option(BASE64_WITH_AVX "add AVX codepath" ON ${_IS_X86} OFF)
add_feature_info(AVX BASE64_WITH_AVX "add AVX codepath")
cmake_dependent_option(BASE64_WITH_AVX2 "add AVX 2 codepath" ON ${_IS_X86} OFF)
add_feature_info(AVX2 BASE64_WITH_AVX2 "add AVX2 codepath")
+cmake_dependent_option(BASE64_WITH_AVX512 "add AVX 512 codepath" ON ${_IS_X86} OFF)
+add_feature_info(AVX512 BASE64_WITH_AVX512 "add AVX512 codepath")
cmake_dependent_option(BASE64_WITH_NEON32 "add NEON32 codepath" OFF _TARGET_ARCH_arm OFF)
add_feature_info(NEON32 BASE64_WITH_NEON32 "add NEON32 codepath")
@@ -118,6 +120,7 @@ add_library(base64
lib/arch/sse42/codec.c
lib/arch/avx/codec.c
lib/arch/avx2/codec.c
+ lib/arch/avx512/codec.c
lib/arch/neon32/codec.c
lib/arch/neon64/codec.c
@@ -206,6 +209,7 @@ if (_TARGET_ARCH STREQUAL "x86" OR _TARGET_ARCH STREQUAL "x64")
configure_codec(SSE42 __SSSE4_2__)
configure_codec(AVX)
configure_codec(AVX2)
+ configure_codec(AVX512)
elseif (_TARGET_ARCH STREQUAL "arm")
set(BASE64_NEON32_CFLAGS "${COMPILE_FLAGS_NEON32}" CACHE STRING "the NEON32 compile flags (for 'lib/arch/neon32/codec.c')")
diff --git a/deps/base64/base64/LICENSE b/deps/base64/base64/LICENSE
index 9446393a82a847..109d6521b122c0 100644
--- a/deps/base64/base64/LICENSE
+++ b/deps/base64/base64/LICENSE
@@ -1,7 +1,7 @@
Copyright (c) 2005-2007, Nick Galbreath
-Copyright (c) 2013-2019, Alfred Klomp
-Copyright (c) 2015-2017, Wojciech Mula
+Copyright (c) 2015-2018, Wojciech Muła
Copyright (c) 2016-2017, Matthieu Darbois
+Copyright (c) 2013-2022, Alfred Klomp
All rights reserved.
Redistribution and use in source and binary forms, with or without
diff --git a/deps/base64/base64/Makefile b/deps/base64/base64/Makefile
index 2bb01e204fcfac..bba3fde4dd05bf 100644
--- a/deps/base64/base64/Makefile
+++ b/deps/base64/base64/Makefile
@@ -1,9 +1,10 @@
-CFLAGS += -std=c99 -O3 -Wall -Wextra -pedantic
+CFLAGS += -std=c99 -O3 -Wall -Wextra -pedantic -DBASE64_STATIC_DEFINE
# Set OBJCOPY if not defined by environment:
OBJCOPY ?= objcopy
OBJS = \
+ lib/arch/avx512/codec.o \
lib/arch/avx2/codec.o \
lib/arch/generic/codec.o \
lib/arch/neon32/codec.o \
@@ -16,6 +17,7 @@ OBJS = \
lib/codec_choose.o \
lib/tables/tables.o
+HAVE_AVX512 = 0
HAVE_AVX2 = 0
HAVE_NEON32 = 0
HAVE_NEON64 = 0
@@ -26,6 +28,9 @@ HAVE_AVX = 0
# The user should supply compiler flags for the codecs they want to build.
# Check which codecs we're going to include:
+ifdef AVX512_CFLAGS
+ HAVE_AVX512 = 1
+endif
ifdef AVX2_CFLAGS
HAVE_AVX2 = 1
endif
@@ -51,6 +56,7 @@ ifdef OPENMP
CFLAGS += -fopenmp
endif
+TARGET := $(shell $(CC) -dumpmachine)
.PHONY: all analyze clean
@@ -59,12 +65,21 @@ all: bin/base64 lib/libbase64.o
bin/base64: bin/base64.o lib/libbase64.o
$(CC) $(CFLAGS) -o $@ $^
-lib/libbase64.o: $(OBJS)
- $(LD) -r -o $@ $^
- $(OBJCOPY) --keep-global-symbols=lib/exports.txt $@
+# Workaround: mangle exported function names on MinGW32.
+lib/exports.build.txt: lib/exports.txt
+ifeq (i686-w64-mingw32, $(TARGET))
+ sed -e 's/^/_/' $< > $@
+else
+ cp -f $< $@
+endif
+
+lib/libbase64.o: lib/exports.build.txt $(OBJS)
+ $(LD) -r -o $@ $(OBJS)
+ $(OBJCOPY) --keep-global-symbols=$< $@
lib/config.h:
- @echo "#define HAVE_AVX2 $(HAVE_AVX2)" > $@
+ @echo "#define HAVE_AVX512 $(HAVE_AVX512)" > $@
+ @echo "#define HAVE_AVX2 $(HAVE_AVX2)" >> $@
@echo "#define HAVE_NEON32 $(HAVE_NEON32)" >> $@
@echo "#define HAVE_NEON64 $(HAVE_NEON64)" >> $@
@echo "#define HAVE_SSSE3 $(HAVE_SSSE3)" >> $@
@@ -75,6 +90,7 @@ lib/config.h:
$(OBJS): lib/config.h
$(OBJS): CFLAGS += -Ilib
+lib/arch/avx512/codec.o: CFLAGS += $(AVX512_CFLAGS)
lib/arch/avx2/codec.o: CFLAGS += $(AVX2_CFLAGS)
lib/arch/neon32/codec.o: CFLAGS += $(NEON32_CFLAGS)
lib/arch/neon64/codec.o: CFLAGS += $(NEON64_CFLAGS)
@@ -90,4 +106,4 @@ analyze: clean
scan-build --use-analyzer=`which clang` --status-bugs make
clean:
- rm -f bin/base64 bin/base64.o lib/libbase64.o lib/config.h $(OBJS)
+ rm -f bin/base64 bin/base64.o lib/libbase64.o lib/config.h lib/exports.build.txt $(OBJS)
diff --git a/deps/base64/base64/README.md b/deps/base64/base64/README.md
index b953c324c9dc1e..ae0a914965e101 100644
--- a/deps/base64/base64/README.md
+++ b/deps/base64/base64/README.md
@@ -3,7 +3,7 @@
[![Build Status](https://github.com/aklomp/base64/actions/workflows/test.yml/badge.svg)](https://github.com/aklomp/base64/actions/workflows/test.yml)
This is an implementation of a base64 stream encoding/decoding library in C99
-with SIMD (AVX2, NEON, AArch64/NEON, SSSE3, SSE4.1, SSE4.2, AVX) and
+with SIMD (AVX2, AVX512, NEON, AArch64/NEON, SSSE3, SSE4.1, SSE4.2, AVX) and
[OpenMP](http://www.openmp.org) acceleration. It also contains wrapper functions
to encode/decode simple length-delimited strings. This library aims to be:
@@ -19,6 +19,10 @@ will pick an optimized codec that lets it encode/decode 12 or 24 bytes at a
time, which gives a speedup of four or more times compared to the "plain"
bytewise codec.
+AVX512 support is only for encoding at present, utilizing the AVX512 VL and VBMI
+instructions. Decoding part reused AVX2 implementations. For CPUs later than
+Cannonlake (manufactured in 2018) supports these instructions.
+
NEON support is hardcoded to on or off at compile time, because portable
runtime feature detection is unavailable on ARM.
@@ -59,6 +63,9 @@ optimizations described by Wojciech Muła in a
[articles](http://0x80.pl/notesen/2016-01-17-sse-base64-decoding.html).
His own code is [here](https://github.com/WojciechMula/toys/tree/master/base64).
+The AVX512 encoder is based on code from Wojciech Muła's
+[base64simd](https://github.com/WojciechMula/base64simd) library.
+
The OpenMP implementation was added by Ferry Toth (@htot) from [Exalon Delft](http://www.exalondelft.nl).
## Building
@@ -76,8 +83,8 @@ To compile just the "plain" library without SIMD codecs, type:
make lib/libbase64.o
```
-Optional SIMD codecs can be included by specifying the `AVX2_CFLAGS`, `NEON32_CFLAGS`, `NEON64_CFLAGS`,
-`SSSE3_CFLAGS`, `SSE41_CFLAGS`, `SSE42_CFLAGS` and/or `AVX_CFLAGS` environment variables.
+Optional SIMD codecs can be included by specifying the `AVX2_CFLAGS`, `AVX512_CFLAGS`,
+`NEON32_CFLAGS`, `NEON64_CFLAGS`, `SSSE3_CFLAGS`, `SSE41_CFLAGS`, `SSE42_CFLAGS` and/or `AVX_CFLAGS` environment variables.
A typical build invocation on x86 looks like this:
```sh
@@ -93,6 +100,15 @@ Example:
AVX2_CFLAGS=-mavx2 make
```
+### AVX512
+
+To build and include the AVX512 codec, set the `AVX512_CFLAGS` environment variable to a value that will turn on AVX512 support in your compiler, typically `-mavx512vl -mavx512vbmi`.
+Example:
+
+```sh
+AVX512_CFLAGS="-mavx512vl -mavx512vbmi" make
+```
+
The codec will only be used if runtime feature detection shows that the target machine supports AVX2.
### SSSE3
@@ -208,6 +224,7 @@ Mainly there for testing purposes, this is also useful on ARM where the only way
The following constants can be used:
- `BASE64_FORCE_AVX2`
+- `BASE64_FORCE_AVX512`
- `BASE64_FORCE_NEON32`
- `BASE64_FORCE_NEON64`
- `BASE64_FORCE_PLAIN`
@@ -434,7 +451,7 @@ x86 processors
| i7-4770 @ 3.4 GHz DDR1600 OPENMP 4 thread | 4884\* | 7099\* | 4917\* | 7057\* | 4799\* | 7143\* | 4902\* | 7219\* |
| i7-4770 @ 3.4 GHz DDR1600 OPENMP 8 thread | 5212\* | 8849\* | 5284\* | 9099\* | 5289\* | 9220\* | 4849\* | 9200\* |
| i7-4870HQ @ 2.5 GHz | 1471\* | 3066\* | 6721\* | 6962\* | 7015\* | 8267\* | 8328\* | 11576\* |
-| i5-4590S @ 3.0 GHz | 3356 | 3197 | 4363 | 6104 | 4243 | 6233 | 4160 | 6344 |
+| i5-4590S @ 3.0 GHz | 3356 | 3197 | 4363 | 6104 | 4243\* | 6233 | 4160\* | 6344 |
| Xeon X5570 @ 2.93 GHz | 2161 | 1508 | 3160 | 3915 | - | - | - | - |
| Pentium4 @ 3.4 GHz | 896 | 740 | - | - | - | - | - | - |
| Atom N270 | 243 | 266 | 508 | 387 | - | - | - | - |
diff --git a/deps/base64/base64/bin/base64.c b/deps/base64/base64/bin/base64.c
index e4384fe885d3eb..0e32ed03762df7 100644
--- a/deps/base64/base64/bin/base64.c
+++ b/deps/base64/base64/bin/base64.c
@@ -1,128 +1,591 @@
-#include // size_t
-#include // fopen()
-#include // strlen()
+// Test for MinGW.
+#if defined(__MINGW32__) || defined(__MINGW64__)
+# define MINGW
+#endif
+
+// Decide if the writev(2) system call needs to be emulated as a series of
+// write(2) calls. At least MinGW does not support writev(2).
+#ifdef MINGW
+# define EMULATE_WRITEV
+#endif
+
+// Include the necessary system header when using the system's writev(2).
+#ifndef EMULATE_WRITEV
+# define _XOPEN_SOURCE // Unlock IOV_MAX
+# include
+#endif
+
+#include
+#include
+#include
+#include
+#include
#include
+#include
+#include
+
#include "../include/libbase64.h"
-#define BUFSIZE 1024 * 1024
+// Size of the buffer for the "raw" (not base64-encoded) data in bytes.
+#define BUFFER_RAW_SIZE (1024 * 1024)
+
+// Size of the buffer for the base64-encoded data in bytes. The base64-encoded
+// data is 4/3 the size of the input, with some margin to be sure.
+#define BUFFER_ENC_SIZE (BUFFER_RAW_SIZE * 4 / 3 + 16)
+
+// Global config structure.
+struct config {
+
+ // Name by which the program was called on the command line.
+ const char *name;
+
+ // Name of the input file for logging purposes.
+ const char *file;
+
+ // Input file handle.
+ FILE *fp;
+
+ // Wrap width in characters, for encoding only.
+ size_t wrap;
+
+ // Whether to run in decode mode.
+ bool decode;
-static char buf[BUFSIZE];
-static char out[(BUFSIZE * 5) / 3]; // Technically 4/3 of input, but take some margin
-size_t nread;
-size_t nout;
+ // Whether to just print the help text and exit.
+ bool print_help;
+};
-static int
-enc (FILE *fp)
+// Input/output buffer structure.
+struct buffer {
+
+ // Runtime-allocated buffer for raw (unencoded) data.
+ char *raw;
+
+ // Runtime-allocated buffer for base64-encoded data.
+ char *enc;
+};
+
+// Optionally emulate writev(2) as a series of write calls.
+#ifdef EMULATE_WRITEV
+
+// Quick and dirty definition of IOV_MAX as it is probably not defined.
+#ifndef IOV_MAX
+# define IOV_MAX 1024
+#endif
+
+// Quick and dirty definition of this system struct, for local use only.
+struct iovec {
+
+ // Opaque data pointer.
+ void *iov_base;
+
+ // Length of the data in bytes.
+ size_t iov_len;
+};
+
+static ssize_t
+writev (const int fd, const struct iovec *iov, int iovcnt)
{
- int ret = 1;
- struct base64_state state;
+ ssize_t r, nwrite = 0;
- base64_stream_encode_init(&state, 0);
+ // Reset the error marker.
+ errno = 0;
+
+ while (iovcnt-- > 0) {
- while ((nread = fread(buf, 1, BUFSIZE, fp)) > 0) {
- base64_stream_encode(&state, buf, nread, out, &nout);
- if (nout) {
- fwrite(out, nout, 1, stdout);
+ // Write the vector; propagate errors back to the caller. Note
+ // that this loses information about how much vectors have been
+ // successfully written, but that also seems to be the case
+ // with the real function. The API is somewhat flawed.
+ if ((r = write(fd, iov->iov_base, iov->iov_len)) < 0) {
+ return r;
}
- if (feof(fp)) {
+
+ // Update the total write count.
+ nwrite += r;
+
+ // Return early after a partial write; the caller should retry.
+ if ((size_t) r != iov->iov_len) {
break;
}
+
+ // Move to the next vector.
+ iov++;
}
- if (ferror(fp)) {
- fprintf(stderr, "read error\n");
- ret = 0;
- goto out;
+
+ return nwrite;
+}
+
+#endif // EMULATE_WRITEV
+
+static bool
+buffer_alloc (const struct config *config, struct buffer *buf)
+{
+ if ((buf->raw = malloc(BUFFER_RAW_SIZE)) == NULL ||
+ (buf->enc = malloc(BUFFER_ENC_SIZE)) == NULL) {
+ free(buf->raw);
+ fprintf(stderr, "%s: malloc: %s\n",
+ config->name, strerror(errno));
+ return false;
}
- base64_stream_encode_final(&state, out, &nout);
- if (nout) {
- fwrite(out, nout, 1, stdout);
+ return true;
+}
+
+static void
+buffer_free (struct buffer *buf)
+{
+ free(buf->raw);
+ free(buf->enc);
+}
+
+static bool
+writev_retry (const struct config *config, struct iovec *iov, size_t nvec)
+{
+ // Writing nothing always succeeds.
+ if (nvec == 0) {
+ return true;
+ }
+
+ while (true) {
+ ssize_t nwrite;
+
+ // Try to write the vectors to stdout.
+ if ((nwrite = writev(1, iov, nvec)) < 0) {
+
+ // Retry on EINTR.
+ if (errno == EINTR) {
+ continue;
+ }
+
+ // Quit on other errors.
+ fprintf(stderr, "%s: writev: %s\n",
+ config->name, strerror(errno));
+ return false;
+ }
+
+ // The return value of `writev' is the number of bytes written.
+ // To check for success, we traverse the list and remove all
+ // written vectors. The call succeeded if the list is empty.
+ while (true) {
+
+ // Retry if this vector is not or partially written.
+ if (iov->iov_len > (size_t) nwrite) {
+ char *base = iov->iov_base;
+
+ iov->iov_base = (size_t) nwrite + base;
+ iov->iov_len -= (size_t) nwrite;
+ break;
+ }
+
+ // Move to the next vector.
+ nwrite -= iov->iov_len;
+ iov++;
+
+ // Return successfully if all vectors were written.
+ if (--nvec == 0) {
+ return true;
+ }
+ }
}
-out: fclose(fp);
- fclose(stdout);
- return ret;
}
-static int
-dec (FILE *fp)
+static inline bool
+iov_append (const struct config *config, struct iovec *iov,
+ size_t *nvec, char *base, const size_t len)
{
- int ret = 1;
- struct base64_state state;
+ // Add the buffer to the IO vector array.
+ iov[*nvec].iov_base = base;
+ iov[*nvec].iov_len = len;
- base64_stream_decode_init(&state, 0);
+ // Increment the array index. Flush the array if it is full.
+ if (++(*nvec) == IOV_MAX) {
+ if (writev_retry(config, iov, IOV_MAX) == false) {
+ return false;
+ }
+ *nvec = 0;
+ }
+
+ return true;
+}
- while ((nread = fread(buf, 1, BUFSIZE, fp)) > 0) {
- if (!base64_stream_decode(&state, buf, nread, out, &nout)) {
- fprintf(stderr, "decoding error\n");
- ret = 0;
- goto out;
+static bool
+write_stdout (const struct config *config, const char *buf, size_t len)
+{
+ while (len > 0) {
+ ssize_t nwrite;
+
+ // Try to write the buffer to stdout.
+ if ((nwrite = write(1, buf, len)) < 0) {
+
+ // Retry on EINTR.
+ if (errno == EINTR) {
+ continue;
+ }
+
+ // Quit on other errors.
+ fprintf(stderr, "%s: write: %s\n",
+ config->name, strerror(errno));
+ return false;
}
- if (nout) {
- fwrite(out, nout, 1, stdout);
+
+ // Update the buffer position.
+ buf += (size_t) nwrite;
+ len -= (size_t) nwrite;
+ }
+
+ return true;
+}
+
+static bool
+write_wrapped (const struct config *config, char *buf, size_t len)
+{
+ static size_t col = 0;
+
+ // Special case: if buf is NULL, print final trailing newline.
+ if (buf == NULL) {
+ if (config->wrap > 0 && col > 0) {
+ return write_stdout(config, "\n", 1);
}
- if (feof(fp)) {
- break;
+ return true;
+ }
+
+ // If no wrap width is given, write the entire buffer.
+ if (config->wrap == 0) {
+ return write_stdout(config, buf, len);
+ }
+
+ // Statically allocated IO vector buffer.
+ static struct iovec iov[IOV_MAX];
+ size_t nvec = 0;
+
+ while (len > 0) {
+
+ // Number of characters to fill the current line.
+ size_t nwrite = config->wrap - col;
+
+ // Do not write more data than is available.
+ if (nwrite > len) {
+ nwrite = len;
+ }
+
+ // Append the data to the IO vector array.
+ if (iov_append(config, iov, &nvec, buf, nwrite) == false) {
+ return false;
+ }
+
+ // Advance the buffer.
+ len -= nwrite;
+ buf += nwrite;
+ col += nwrite;
+
+ // If the line is full, append a newline.
+ if (col == config->wrap) {
+ if (iov_append(config, iov, &nvec, "\n", 1) == false) {
+ return false;
+ }
+ col = 0;
}
}
- if (ferror(fp)) {
- fprintf(stderr, "read error\n");
- ret = 0;
+
+ // Write the remaining vectors.
+ if (writev_retry(config, iov, nvec) == false) {
+ return false;
}
-out: fclose(fp);
- fclose(stdout);
- return ret;
+
+ return true;
}
-int
-main (int argc, char **argv)
+static bool
+encode (const struct config *config, struct buffer *buf)
{
- char *file;
- FILE *fp;
- int decode = 0;
-
- // Parse options:
- for (;;)
- {
- int c;
- int opt_index = 0;
- static struct option opt_long[] = {
- { "decode", 0, 0, 'd' },
- { 0, 0, 0, 0 }
- };
- if ((c = getopt_long(argc, argv, "d", opt_long, &opt_index)) == -1) {
- break;
+ size_t nread, nout;
+ struct base64_state state;
+
+ // Initialize the encoder's state structure.
+ base64_stream_encode_init(&state, 0);
+
+ // Read raw data into the buffer.
+ while ((nread = fread(buf->raw, 1, BUFFER_RAW_SIZE, config->fp)) > 0) {
+
+ // Encode the raw input into the encoded buffer.
+ base64_stream_encode(&state, buf->raw, nread, buf->enc, &nout);
+
+ // Append the encoded data to the output stream.
+ if (write_wrapped(config, buf->enc, nout) == false) {
+ return false;
}
- switch (c)
- {
- case 'd':
- decode = 1;
+ }
+
+ // Check for stream errors.
+ if (ferror(config->fp)) {
+ fprintf(stderr, "%s: %s: read error\n",
+ config->name, config->file);
+ return false;
+ }
+
+ // Finalize the encoding by adding proper stream terminators.
+ base64_stream_encode_final(&state, buf->enc, &nout);
+
+ // Append this tail to the output stream.
+ if (write_wrapped(config, buf->enc, nout) == false) {
+ return false;
+ }
+
+ // Print optional trailing newline.
+ if (write_wrapped(config, NULL, 0) == false) {
+ return false;
+ }
+
+ return true;
+}
+
+static inline size_t
+find_newline (const char *p, const size_t avail)
+{
+ // This is very naive and can probably be improved by vectorization.
+ for (size_t len = 0; len < avail; len++) {
+ if (p[len] == '\n') {
+ return len;
+ }
+ }
+
+ return avail;
+}
+
+static bool
+decode (const struct config *config, struct buffer *buf)
+{
+ size_t avail;
+ struct base64_state state;
+
+ // Initialize the decoder's state structure.
+ base64_stream_decode_init(&state, 0);
+
+ // Read encoded data into the buffer. Use the smallest buffer size to
+ // be on the safe side: the decoded output will fit the raw buffer.
+ while ((avail = fread(buf->enc, 1, BUFFER_RAW_SIZE, config->fp)) > 0) {
+ char *start = buf->enc;
+ char *outbuf = buf->raw;
+ size_t ototal = 0;
+
+ // By popular demand, this utility tries to be bug-compatible
+ // with GNU `base64'. That includes silently ignoring newlines
+ // in the input. Tokenize the input on newline characters.
+ while (avail > 0) {
+
+ // Find the offset of the next newline character, which
+ // is also the length of the next chunk.
+ size_t outlen, len = find_newline(start, avail);
+
+ // Ignore empty chunks.
+ if (len == 0) {
+ start++;
+ avail--;
+ continue;
+ }
+
+ // Decode the chunk into the raw buffer.
+ if (base64_stream_decode(&state, start, len,
+ outbuf, &outlen) == 0) {
+ fprintf(stderr, "%s: %s: decoding error\n",
+ config->name, config->file);
+ return false;
+ }
+
+ // Update the output buffer pointer and total size.
+ outbuf += outlen;
+ ototal += outlen;
+
+ // Bail out if the whole string has been consumed.
+ if (len == avail) {
break;
+ }
+
+ // Move the start pointer past the newline.
+ start += len + 1;
+ avail -= len + 1;
+ }
+
+ // Append the raw data to the output stream.
+ if (write_stdout(config, buf->raw, ototal) == false) {
+ return false;
}
}
- // No options left on command line? Read from stdin:
- if (optind >= argc) {
- fp = stdin;
+ // Check for stream errors.
+ if (ferror(config->fp)) {
+ fprintf(stderr, "%s: %s: read error\n",
+ config->name, config->file);
+ return false;
}
- // One option left on command line? Treat it as a file:
- else if (optind + 1 == argc) {
- file = argv[optind];
- if (strcmp(file, "-") == 0) {
- fp = stdin;
- }
- else if ((fp = fopen(file, "rb")) == NULL) {
- printf("cannot open %s\n", file);
- return 1;
+ return true;
+}
+
+static void
+usage (FILE *fp, const struct config *config)
+{
+ const char *usage =
+ "Usage: %s [OPTION]... [FILE]\n"
+ "If no FILE is given or is specified as '-', "
+ "read from standard input.\n"
+ "Options:\n"
+ " -d, --decode Decode a base64 stream.\n"
+ " -h, --help Print this help text.\n"
+ " -w, --wrap=COLS Wrap encoded lines at this column. "
+ "Default 76, 0 to disable.\n";
+
+ fprintf(fp, usage, config->name);
+}
+
+static bool
+get_wrap (struct config *config, const char *str)
+{
+ char *eptr;
+
+ // Reject empty strings.
+ if (*str == '\0') {
+ return false;
+ }
+
+ // Convert the input string to a signed long.
+ const long wrap = strtol(str, &eptr, 10);
+
+ // Reject negative numbers.
+ if (wrap < 0) {
+ return false;
+ }
+
+ // Reject strings containing non-digits.
+ if (*eptr != '\0') {
+ return false;
+ }
+
+ config->wrap = (size_t) wrap;
+ return true;
+}
+
+static bool
+parse_opts (int argc, char **argv, struct config *config)
+{
+ int c;
+ static const struct option opts[] = {
+ { "decode", no_argument, NULL, 'd' },
+ { "help", no_argument, NULL, 'h' },
+ { "wrap", required_argument, NULL, 'w' },
+ { NULL }
+ };
+
+ // Remember the program's name.
+ config->name = *argv;
+
+ // Parse command line options.
+ while ((c = getopt_long(argc, argv, ":dhw:", opts, NULL)) != -1) {
+ switch (c) {
+ case 'd':
+ config->decode = true;
+ break;
+
+ case 'h':
+ config->print_help = true;
+ return true;
+
+ case 'w':
+ if (get_wrap(config, optarg) == false) {
+ fprintf(stderr,
+ "%s: invalid wrap value '%s'\n",
+ config->name, optarg);
+ return false;
+ }
+ break;
+
+ case ':':
+ fprintf(stderr, "%s: missing argument for '%c'\n",
+ config->name, optopt);
+ return false;
+
+ default:
+ fprintf(stderr, "%s: unknown option '%c'\n",
+ config->name, optopt);
+ return false;
}
}
- // More than one option left on command line? Syntax error:
- else {
- printf("Usage: %s \n", argv[0]);
+ // Return successfully if no filename was given.
+ if (optind >= argc) {
+ return true;
+ }
+
+ // Return unsuccessfully if more than one filename was given.
+ if (optind + 1 < argc) {
+ fprintf(stderr, "%s: too many files\n", config->name);
+ return false;
+ }
+
+ // For compatibility with GNU Coreutils base64, treat a filename of '-'
+ // as standard input.
+ if (strcmp(argv[optind], "-") == 0) {
+ return true;
+ }
+
+ // Save the name of the file.
+ config->file = argv[optind];
+
+ // Open the file.
+ if ((config->fp = fopen(config->file, "rb")) == NULL) {
+ fprintf(stderr, "%s: %s: %s\n",
+ config->name, config->file, strerror(errno));
+ return false;
+ }
+
+ return true;
+}
+
+int
+main (int argc, char **argv)
+{
+ // Default program config.
+ struct config config = {
+ .file = "stdin",
+ .fp = stdin,
+ .wrap = 76,
+ .decode = false,
+ .print_help = false,
+ };
+ struct buffer buf;
+
+ // Parse options from the command line.
+ if (parse_opts(argc, argv, &config) == false) {
+ usage(stderr, &config);
+ return 1;
+ }
+
+ // Return early if the user just wanted the help text.
+ if (config.print_help) {
+ usage(stdout, &config);
+ return 0;
+ }
+
+ // Allocate buffers.
+ if (buffer_alloc(&config, &buf) == false) {
return 1;
}
- // Invert return codes to create shell return code:
- return (decode) ? !dec(fp) : !enc(fp);
+ // Encode or decode the input based on the user's choice.
+ const bool ret = config.decode
+ ? decode(&config, &buf)
+ : encode(&config, &buf);
+
+ // Free the buffers.
+ buffer_free(&buf);
+
+ // Close the input file.
+ fclose(config.fp);
+
+ // Close the output stream.
+ fclose(stdout);
+
+ // That's all, folks.
+ return ret ? 0 : 1;
}
diff --git a/deps/base64/base64/cmake/Modules/TargetSIMDInstructionSet.cmake b/deps/base64/base64/cmake/Modules/TargetSIMDInstructionSet.cmake
index ba1f6e51815eec..485080905319a6 100644
--- a/deps/base64/base64/cmake/Modules/TargetSIMDInstructionSet.cmake
+++ b/deps/base64/base64/cmake/Modules/TargetSIMDInstructionSet.cmake
@@ -21,6 +21,7 @@ macro(define_SIMD_compile_flags)
set(COMPILE_FLAGS_SSE42 "-msse4.2")
set(COMPILE_FLAGS_AVX "-mavx")
set(COMPILE_FLAGS_AVX2 "-mavx2")
+ set(COMPILE_FLAGS_AVX512 "-mavx512vl -mavx512vbmi")
#arm
set(COMPILE_FLAGS_NEON32 "-mfpu=neon")
@@ -30,5 +31,6 @@ macro(define_SIMD_compile_flags)
set(COMPILE_FLAGS_SSE42 " ")
set(COMPILE_FLAGS_AVX "/arch:AVX")
set(COMPILE_FLAGS_AVX2 "/arch:AVX2")
+ set(COMPILE_FLAGS_AVX512 "/arch:AVX512")
endif()
endmacro(define_SIMD_compile_flags)
diff --git a/deps/base64/base64/cmake/config.h.in b/deps/base64/base64/cmake/config.h.in
index 8530d1e13d4801..c7faa94bc0903d 100644
--- a/deps/base64/base64/cmake/config.h.in
+++ b/deps/base64/base64/cmake/config.h.in
@@ -16,6 +16,9 @@
#cmakedefine01 BASE64_WITH_AVX2
#define HAVE_AVX2 BASE64_WITH_AVX2
+#cmakedefine01 BASE64_WITH_AVX512
+#define HAVE_AVX512 BASE64_WITH_AVX512
+
#cmakedefine01 BASE64_WITH_NEON32
#define HAVE_NEON32 BASE64_WITH_NEON32
diff --git a/deps/base64/base64/include/libbase64.h b/deps/base64/base64/include/libbase64.h
index d470a82f1028dc..c5908973c5e73c 100644
--- a/deps/base64/base64/include/libbase64.h
+++ b/deps/base64/base64/include/libbase64.h
@@ -53,6 +53,7 @@ extern "C" {
#define BASE64_FORCE_SSE41 (1 << 5)
#define BASE64_FORCE_SSE42 (1 << 6)
#define BASE64_FORCE_AVX (1 << 7)
+#define BASE64_FORCE_AVX512 (1 << 8)
struct base64_state {
int eof;
diff --git a/deps/base64/base64/lib/arch/avx/codec.c b/deps/base64/base64/lib/arch/avx/codec.c
index a7a963d8358918..b069618e29463e 100644
--- a/deps/base64/base64/lib/arch/avx/codec.c
+++ b/deps/base64/base64/lib/arch/avx/codec.c
@@ -11,11 +11,25 @@
#if HAVE_AVX
#include
+// Only enable inline assembly on supported compilers and on 64-bit CPUs.
+#ifndef BASE64_AVX_USE_ASM
+# if (defined(__GNUC__) || defined(__clang__)) && BASE64_WORDSIZE == 64
+# define BASE64_AVX_USE_ASM 1
+# else
+# define BASE64_AVX_USE_ASM 0
+# endif
+#endif
+
#include "../ssse3/dec_reshuffle.c"
#include "../ssse3/dec_loop.c"
-#include "../ssse3/enc_translate.c"
-#include "../ssse3/enc_reshuffle.c"
-#include "../ssse3/enc_loop.c"
+
+#if BASE64_AVX_USE_ASM
+# include "enc_loop_asm.c"
+#else
+# include "../ssse3/enc_translate.c"
+# include "../ssse3/enc_reshuffle.c"
+# include "../ssse3/enc_loop.c"
+#endif
#endif // HAVE_AVX
@@ -23,7 +37,17 @@ BASE64_ENC_FUNCTION(avx)
{
#if HAVE_AVX
#include "../generic/enc_head.c"
+
+ // For supported compilers, use a hand-optimized inline assembly
+ // encoder. Otherwise fall back on the SSSE3 encoder, but compiled with
+ // AVX flags to generate better optimized AVX code.
+
+#if BASE64_AVX_USE_ASM
+ enc_loop_avx(&s, &slen, &o, &olen);
+#else
enc_loop_ssse3(&s, &slen, &o, &olen);
+#endif
+
#include "../generic/enc_tail.c"
#else
BASE64_ENC_STUB
diff --git a/deps/base64/base64/lib/arch/avx/enc_loop_asm.c b/deps/base64/base64/lib/arch/avx/enc_loop_asm.c
new file mode 100644
index 00000000000000..979269af57740e
--- /dev/null
+++ b/deps/base64/base64/lib/arch/avx/enc_loop_asm.c
@@ -0,0 +1,264 @@
+// Apologies in advance for combining the preprocessor with inline assembly,
+// two notoriously gnarly parts of C, but it was necessary to avoid a lot of
+// code repetition. The preprocessor is used to template large sections of
+// inline assembly that differ only in the registers used. If the code was
+// written out by hand, it would become very large and hard to audit.
+
+// Generate a block of inline assembly that loads register R0 from memory. The
+// offset at which the register is loaded is set by the given round.
+#define LOAD(R0, ROUND) \
+ "vlddqu ("#ROUND" * 12)(%[src]), %["R0"] \n\t"
+
+// Generate a block of inline assembly that deinterleaves and shuffles register
+// R0 using preloaded constants. Outputs in R0 and R1.
+#define SHUF(R0, R1, R2) \
+ "vpshufb %[lut0], %["R0"], %["R1"] \n\t" \
+ "vpand %["R1"], %[msk0], %["R2"] \n\t" \
+ "vpand %["R1"], %[msk2], %["R1"] \n\t" \
+ "vpmulhuw %["R2"], %[msk1], %["R2"] \n\t" \
+ "vpmullw %["R1"], %[msk3], %["R1"] \n\t" \
+ "vpor %["R1"], %["R2"], %["R1"] \n\t"
+
+// Generate a block of inline assembly that takes R0 and R1 and translates
+// their contents to the base64 alphabet, using preloaded constants.
+#define TRAN(R0, R1, R2) \
+ "vpsubusb %[n51], %["R1"], %["R0"] \n\t" \
+ "vpcmpgtb %[n25], %["R1"], %["R2"] \n\t" \
+ "vpsubb %["R2"], %["R0"], %["R0"] \n\t" \
+ "vpshufb %["R0"], %[lut1], %["R2"] \n\t" \
+ "vpaddb %["R1"], %["R2"], %["R0"] \n\t"
+
+// Generate a block of inline assembly that stores the given register R0 at an
+// offset set by the given round.
+#define STOR(R0, ROUND) \
+ "vmovdqu %["R0"], ("#ROUND" * 16)(%[dst]) \n\t"
+
+// Generate a block of inline assembly that generates a single self-contained
+// encoder round: fetch the data, process it, and store the result. Then update
+// the source and destination pointers.
+#define ROUND() \
+ LOAD("a", 0) \
+ SHUF("a", "b", "c") \
+ TRAN("a", "b", "c") \
+ STOR("a", 0) \
+ "add $12, %[src] \n\t" \
+ "add $16, %[dst] \n\t"
+
+// Define a macro that initiates a three-way interleaved encoding round by
+// preloading registers a, b and c from memory.
+// The register graph shows which registers are in use during each step, and
+// is a visual aid for choosing registers for that step. Symbol index:
+//
+// + indicates that a register is loaded by that step.
+// | indicates that a register is in use and must not be touched.
+// - indicates that a register is decommissioned by that step.
+// x indicates that a register is used as a temporary by that step.
+// V indicates that a register is an input or output to the macro.
+//
+#define ROUND_3_INIT() /* a b c d e f */ \
+ LOAD("a", 0) /* + */ \
+ SHUF("a", "d", "e") /* | + x */ \
+ LOAD("b", 1) /* | + | */ \
+ TRAN("a", "d", "e") /* | | - x */ \
+ LOAD("c", 2) /* V V V */
+
+// Define a macro that translates, shuffles and stores the input registers A, B
+// and C, and preloads registers D, E and F for the next round.
+// This macro can be arbitrarily daisy-chained by feeding output registers D, E
+// and F back into the next round as input registers A, B and C. The macro
+// carefully interleaves memory operations with data operations for optimal
+// pipelined performance.
+
+#define ROUND_3(ROUND, A,B,C,D,E,F) /* A B C D E F */ \
+ LOAD(D, (ROUND + 3)) /* V V V + */ \
+ SHUF(B, E, F) /* | | | | + x */ \
+ STOR(A, (ROUND + 0)) /* - | | | | */ \
+ TRAN(B, E, F) /* | | | - x */ \
+ LOAD(E, (ROUND + 4)) /* | | | + */ \
+ SHUF(C, A, F) /* + | | | | x */ \
+ STOR(B, (ROUND + 1)) /* | - | | | */ \
+ TRAN(C, A, F) /* - | | | x */ \
+ LOAD(F, (ROUND + 5)) /* | | | + */ \
+ SHUF(D, A, B) /* + x | | | | */ \
+ STOR(C, (ROUND + 2)) /* | - | | | */ \
+ TRAN(D, A, B) /* - x V V V */
+
+// Define a macro that terminates a ROUND_3 macro by taking pre-loaded
+// registers D, E and F, and translating, shuffling and storing them.
+#define ROUND_3_END(ROUND, A,B,C,D,E,F) /* A B C D E F */ \
+ SHUF(E, A, B) /* + x V V V */ \
+ STOR(D, (ROUND + 3)) /* | - | | */ \
+ TRAN(E, A, B) /* - x | | */ \
+ SHUF(F, C, D) /* + x | | */ \
+ STOR(E, (ROUND + 4)) /* | - | */ \
+ TRAN(F, C, D) /* - x | */ \
+ STOR(F, (ROUND + 5)) /* - */
+
+// Define a type A round. Inputs are a, b, and c, outputs are d, e, and f.
+#define ROUND_3_A(ROUND) \
+ ROUND_3(ROUND, "a", "b", "c", "d", "e", "f")
+
+// Define a type B round. Inputs and outputs are swapped with regard to type A.
+#define ROUND_3_B(ROUND) \
+ ROUND_3(ROUND, "d", "e", "f", "a", "b", "c")
+
+// Terminating macro for a type A round.
+#define ROUND_3_A_LAST(ROUND) \
+ ROUND_3_A(ROUND) \
+ ROUND_3_END(ROUND, "a", "b", "c", "d", "e", "f")
+
+// Terminating macro for a type B round.
+#define ROUND_3_B_LAST(ROUND) \
+ ROUND_3_B(ROUND) \
+ ROUND_3_END(ROUND, "d", "e", "f", "a", "b", "c")
+
+// Suppress clang's warning that the literal string in the asm statement is
+// overlong (longer than the ISO-mandated minimum size of 4095 bytes for C99
+// compilers). It may be true, but the goal here is not C99 portability.
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Woverlength-strings"
+
+static inline void
+enc_loop_avx (const uint8_t **s, size_t *slen, uint8_t **o, size_t *olen)
+{
+ // For a clearer explanation of the algorithm used by this function,
+ // please refer to the plain (not inline assembly) implementation. This
+ // function follows the same basic logic.
+
+ if (*slen < 16) {
+ return;
+ }
+
+ // Process blocks of 12 bytes at a time. Input is read in blocks of 16
+ // bytes, so "reserve" four bytes from the input buffer to ensure that
+ // we never read beyond the end of the input buffer.
+ size_t rounds = (*slen - 4) / 12;
+
+ *slen -= rounds * 12; // 12 bytes consumed per round
+ *olen += rounds * 16; // 16 bytes produced per round
+
+ // Number of times to go through the 36x loop.
+ size_t loops = rounds / 36;
+
+ // Number of rounds remaining after the 36x loop.
+ rounds %= 36;
+
+ // Lookup tables.
+ const __m128i lut0 = _mm_set_epi8(
+ 10, 11, 9, 10, 7, 8, 6, 7, 4, 5, 3, 4, 1, 2, 0, 1);
+
+ const __m128i lut1 = _mm_setr_epi8(
+ 65, 71, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -19, -16, 0, 0);
+
+ // Temporary registers.
+ __m128i a, b, c, d, e, f;
+
+ __asm__ volatile (
+
+ // If there are 36 rounds or more, enter a 36x unrolled loop of
+ // interleaved encoding rounds. The rounds interleave memory
+ // operations (load/store) with data operations (table lookups,
+ // etc) to maximize pipeline throughput.
+ " test %[loops], %[loops] \n\t"
+ " jz 18f \n\t"
+ " jmp 36f \n\t"
+ " \n\t"
+ ".balign 64 \n\t"
+ "36: " ROUND_3_INIT()
+ " " ROUND_3_A( 0)
+ " " ROUND_3_B( 3)
+ " " ROUND_3_A( 6)
+ " " ROUND_3_B( 9)
+ " " ROUND_3_A(12)
+ " " ROUND_3_B(15)
+ " " ROUND_3_A(18)
+ " " ROUND_3_B(21)
+ " " ROUND_3_A(24)
+ " " ROUND_3_B(27)
+ " " ROUND_3_A_LAST(30)
+ " add $(12 * 36), %[src] \n\t"
+ " add $(16 * 36), %[dst] \n\t"
+ " dec %[loops] \n\t"
+ " jnz 36b \n\t"
+
+ // Enter an 18x unrolled loop for rounds of 18 or more.
+ "18: cmp $18, %[rounds] \n\t"
+ " jl 9f \n\t"
+ " " ROUND_3_INIT()
+ " " ROUND_3_A(0)
+ " " ROUND_3_B(3)
+ " " ROUND_3_A(6)
+ " " ROUND_3_B(9)
+ " " ROUND_3_A_LAST(12)
+ " sub $18, %[rounds] \n\t"
+ " add $(12 * 18), %[src] \n\t"
+ " add $(16 * 18), %[dst] \n\t"
+
+ // Enter a 9x unrolled loop for rounds of 9 or more.
+ "9: cmp $9, %[rounds] \n\t"
+ " jl 6f \n\t"
+ " " ROUND_3_INIT()
+ " " ROUND_3_A(0)
+ " " ROUND_3_B_LAST(3)
+ " sub $9, %[rounds] \n\t"
+ " add $(12 * 9), %[src] \n\t"
+ " add $(16 * 9), %[dst] \n\t"
+
+ // Enter a 6x unrolled loop for rounds of 6 or more.
+ "6: cmp $6, %[rounds] \n\t"
+ " jl 55f \n\t"
+ " " ROUND_3_INIT()
+ " " ROUND_3_A_LAST(0)
+ " sub $6, %[rounds] \n\t"
+ " add $(12 * 6), %[src] \n\t"
+ " add $(16 * 6), %[dst] \n\t"
+
+ // Dispatch the remaining rounds 0..5.
+ "55: cmp $3, %[rounds] \n\t"
+ " jg 45f \n\t"
+ " je 3f \n\t"
+ " cmp $1, %[rounds] \n\t"
+ " jg 2f \n\t"
+ " je 1f \n\t"
+ " jmp 0f \n\t"
+
+ "45: cmp $4, %[rounds] \n\t"
+ " je 4f \n\t"
+
+ // Block of non-interlaced encoding rounds, which can each
+ // individually be jumped to. Rounds fall through to the next.
+ "5: " ROUND()
+ "4: " ROUND()
+ "3: " ROUND()
+ "2: " ROUND()
+ "1: " ROUND()
+ "0: \n\t"
+
+ // Outputs (modified).
+ : [rounds] "+r" (rounds),
+ [loops] "+r" (loops),
+ [src] "+r" (*s),
+ [dst] "+r" (*o),
+ [a] "=&x" (a),
+ [b] "=&x" (b),
+ [c] "=&x" (c),
+ [d] "=&x" (d),
+ [e] "=&x" (e),
+ [f] "=&x" (f)
+
+ // Inputs (not modified).
+ : [lut0] "x" (lut0),
+ [lut1] "x" (lut1),
+ [msk0] "x" (_mm_set1_epi32(0x0FC0FC00)),
+ [msk1] "x" (_mm_set1_epi32(0x04000040)),
+ [msk2] "x" (_mm_set1_epi32(0x003F03F0)),
+ [msk3] "x" (_mm_set1_epi32(0x01000010)),
+ [n51] "x" (_mm_set1_epi8(51)),
+ [n25] "x" (_mm_set1_epi8(25))
+
+ // Clobbers.
+ : "cc", "memory"
+ );
+}
+
+#pragma GCC diagnostic pop
diff --git a/deps/base64/base64/lib/arch/avx2/codec.c b/deps/base64/base64/lib/arch/avx2/codec.c
index 0498548b80d286..8a2aa4a6071500 100644
--- a/deps/base64/base64/lib/arch/avx2/codec.c
+++ b/deps/base64/base64/lib/arch/avx2/codec.c
@@ -11,11 +11,25 @@
#if HAVE_AVX2
#include
+// Only enable inline assembly on supported compilers and on 64-bit CPUs.
+#ifndef BASE64_AVX2_USE_ASM
+# if (defined(__GNUC__) || defined(__clang__)) && BASE64_WORDSIZE == 64
+# define BASE64_AVX2_USE_ASM 1
+# else
+# define BASE64_AVX2_USE_ASM 0
+# endif
+#endif
+
#include "dec_reshuffle.c"
#include "dec_loop.c"
-#include "enc_translate.c"
-#include "enc_reshuffle.c"
-#include "enc_loop.c"
+
+#if BASE64_AVX2_USE_ASM
+# include "enc_loop_asm.c"
+#else
+# include "enc_translate.c"
+# include "enc_reshuffle.c"
+# include "enc_loop.c"
+#endif
#endif // HAVE_AVX2
diff --git a/deps/base64/base64/lib/arch/avx2/enc_loop_asm.c b/deps/base64/base64/lib/arch/avx2/enc_loop_asm.c
new file mode 100644
index 00000000000000..eb775a1d1f03d0
--- /dev/null
+++ b/deps/base64/base64/lib/arch/avx2/enc_loop_asm.c
@@ -0,0 +1,291 @@
+// Apologies in advance for combining the preprocessor with inline assembly,
+// two notoriously gnarly parts of C, but it was necessary to avoid a lot of
+// code repetition. The preprocessor is used to template large sections of
+// inline assembly that differ only in the registers used. If the code was
+// written out by hand, it would become very large and hard to audit.
+
+// Generate a block of inline assembly that loads register R0 from memory. The
+// offset at which the register is loaded is set by the given round and a
+// constant offset.
+#define LOAD(R0, ROUND, OFFSET) \
+ "vlddqu ("#ROUND" * 24 + "#OFFSET")(%[src]), %["R0"] \n\t"
+
+// Generate a block of inline assembly that deinterleaves and shuffles register
+// R0 using preloaded constants. Outputs in R0 and R1.
+#define SHUF(R0, R1, R2) \
+ "vpshufb %[lut0], %["R0"], %["R1"] \n\t" \
+ "vpand %["R1"], %[msk0], %["R2"] \n\t" \
+ "vpand %["R1"], %[msk2], %["R1"] \n\t" \
+ "vpmulhuw %["R2"], %[msk1], %["R2"] \n\t" \
+ "vpmullw %["R1"], %[msk3], %["R1"] \n\t" \
+ "vpor %["R1"], %["R2"], %["R1"] \n\t"
+
+// Generate a block of inline assembly that takes R0 and R1 and translates
+// their contents to the base64 alphabet, using preloaded constants.
+#define TRAN(R0, R1, R2) \
+ "vpsubusb %[n51], %["R1"], %["R0"] \n\t" \
+ "vpcmpgtb %[n25], %["R1"], %["R2"] \n\t" \
+ "vpsubb %["R2"], %["R0"], %["R0"] \n\t" \
+ "vpshufb %["R0"], %[lut1], %["R2"] \n\t" \
+ "vpaddb %["R1"], %["R2"], %["R0"] \n\t"
+
+// Generate a block of inline assembly that stores the given register R0 at an
+// offset set by the given round.
+#define STOR(R0, ROUND) \
+ "vmovdqu %["R0"], ("#ROUND" * 32)(%[dst]) \n\t"
+
+// Generate a block of inline assembly that generates a single self-contained
+// encoder round: fetch the data, process it, and store the result. Then update
+// the source and destination pointers.
+#define ROUND() \
+ LOAD("a", 0, -4) \
+ SHUF("a", "b", "c") \
+ TRAN("a", "b", "c") \
+ STOR("a", 0) \
+ "add $24, %[src] \n\t" \
+ "add $32, %[dst] \n\t"
+
+// Define a macro that initiates a three-way interleaved encoding round by
+// preloading registers a, b and c from memory.
+// The register graph shows which registers are in use during each step, and
+// is a visual aid for choosing registers for that step. Symbol index:
+//
+// + indicates that a register is loaded by that step.
+// | indicates that a register is in use and must not be touched.
+// - indicates that a register is decommissioned by that step.
+// x indicates that a register is used as a temporary by that step.
+// V indicates that a register is an input or output to the macro.
+//
+#define ROUND_3_INIT() /* a b c d e f */ \
+ LOAD("a", 0, -4) /* + */ \
+ SHUF("a", "d", "e") /* | + x */ \
+ LOAD("b", 1, -4) /* | + | */ \
+ TRAN("a", "d", "e") /* | | - x */ \
+ LOAD("c", 2, -4) /* V V V */
+
+// Define a macro that translates, shuffles and stores the input registers A, B
+// and C, and preloads registers D, E and F for the next round.
+// This macro can be arbitrarily daisy-chained by feeding output registers D, E
+// and F back into the next round as input registers A, B and C. The macro
+// carefully interleaves memory operations with data operations for optimal
+// pipelined performance.
+
+#define ROUND_3(ROUND, A,B,C,D,E,F) /* A B C D E F */ \
+ LOAD(D, (ROUND + 3), -4) /* V V V + */ \
+ SHUF(B, E, F) /* | | | | + x */ \
+ STOR(A, (ROUND + 0)) /* - | | | | */ \
+ TRAN(B, E, F) /* | | | - x */ \
+ LOAD(E, (ROUND + 4), -4) /* | | | + */ \
+ SHUF(C, A, F) /* + | | | | x */ \
+ STOR(B, (ROUND + 1)) /* | - | | | */ \
+ TRAN(C, A, F) /* - | | | x */ \
+ LOAD(F, (ROUND + 5), -4) /* | | | + */ \
+ SHUF(D, A, B) /* + x | | | | */ \
+ STOR(C, (ROUND + 2)) /* | - | | | */ \
+ TRAN(D, A, B) /* - x V V V */
+
+// Define a macro that terminates a ROUND_3 macro by taking pre-loaded
+// registers D, E and F, and translating, shuffling and storing them.
+#define ROUND_3_END(ROUND, A,B,C,D,E,F) /* A B C D E F */ \
+ SHUF(E, A, B) /* + x V V V */ \
+ STOR(D, (ROUND + 3)) /* | - | | */ \
+ TRAN(E, A, B) /* - x | | */ \
+ SHUF(F, C, D) /* + x | | */ \
+ STOR(E, (ROUND + 4)) /* | - | */ \
+ TRAN(F, C, D) /* - x | */ \
+ STOR(F, (ROUND + 5)) /* - */
+
+// Define a type A round. Inputs are a, b, and c, outputs are d, e, and f.
+#define ROUND_3_A(ROUND) \
+ ROUND_3(ROUND, "a", "b", "c", "d", "e", "f")
+
+// Define a type B round. Inputs and outputs are swapped with regard to type A.
+#define ROUND_3_B(ROUND) \
+ ROUND_3(ROUND, "d", "e", "f", "a", "b", "c")
+
+// Terminating macro for a type A round.
+#define ROUND_3_A_LAST(ROUND) \
+ ROUND_3_A(ROUND) \
+ ROUND_3_END(ROUND, "a", "b", "c", "d", "e", "f")
+
+// Terminating macro for a type B round.
+#define ROUND_3_B_LAST(ROUND) \
+ ROUND_3_B(ROUND) \
+ ROUND_3_END(ROUND, "d", "e", "f", "a", "b", "c")
+
+// Suppress clang's warning that the literal string in the asm statement is
+// overlong (longer than the ISO-mandated minimum size of 4095 bytes for C99
+// compilers). It may be true, but the goal here is not C99 portability.
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Woverlength-strings"
+
+static inline void
+enc_loop_avx2 (const uint8_t **s, size_t *slen, uint8_t **o, size_t *olen)
+{
+ // For a clearer explanation of the algorithm used by this function,
+ // please refer to the plain (not inline assembly) implementation. This
+ // function follows the same basic logic.
+
+ if (*slen < 32) {
+ return;
+ }
+
+ // Process blocks of 24 bytes at a time. Because blocks are loaded 32
+ // bytes at a time an offset of -4, ensure that there will be at least
+ // 4 remaining bytes after the last round, so that the final read will
+ // not pass beyond the bounds of the input buffer.
+ size_t rounds = (*slen - 4) / 24;
+
+ *slen -= rounds * 24; // 24 bytes consumed per round
+ *olen += rounds * 32; // 32 bytes produced per round
+
+ // Pre-decrement the number of rounds to get the number of rounds
+ // *after* the first round, which is handled as a special case.
+ rounds--;
+
+ // Number of times to go through the 36x loop.
+ size_t loops = rounds / 36;
+
+ // Number of rounds remaining after the 36x loop.
+ rounds %= 36;
+
+ // Lookup tables.
+ const __m256i lut0 = _mm256_set_epi8(
+ 10, 11, 9, 10, 7, 8, 6, 7, 4, 5, 3, 4, 1, 2, 0, 1,
+ 14, 15, 13, 14, 11, 12, 10, 11, 8, 9, 7, 8, 5, 6, 4, 5);
+
+ const __m256i lut1 = _mm256_setr_epi8(
+ 65, 71, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -19, -16, 0, 0,
+ 65, 71, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -19, -16, 0, 0);
+
+ // Temporary registers.
+ __m256i a, b, c, d, e;
+
+ // Temporary register f doubles as the shift mask for the first round.
+ __m256i f = _mm256_setr_epi32(0, 0, 1, 2, 3, 4, 5, 6);
+
+ __asm__ volatile (
+
+ // The first loop iteration requires special handling to ensure
+ // that the read, which is normally done at an offset of -4,
+ // does not underflow the buffer. Load the buffer at an offset
+ // of 0 and permute the input to achieve the same effect.
+ LOAD("a", 0, 0)
+ "vpermd %[a], %[f], %[a] \n\t"
+
+ // Perform the standard shuffling and translation steps.
+ SHUF("a", "b", "c")
+ TRAN("a", "b", "c")
+
+ // Store the result and increment the source and dest pointers.
+ "vmovdqu %[a], (%[dst]) \n\t"
+ "add $24, %[src] \n\t"
+ "add $32, %[dst] \n\t"
+
+ // If there are 36 rounds or more, enter a 36x unrolled loop of
+ // interleaved encoding rounds. The rounds interleave memory
+ // operations (load/store) with data operations (table lookups,
+ // etc) to maximize pipeline throughput.
+ " test %[loops], %[loops] \n\t"
+ " jz 18f \n\t"
+ " jmp 36f \n\t"
+ " \n\t"
+ ".balign 64 \n\t"
+ "36: " ROUND_3_INIT()
+ " " ROUND_3_A( 0)
+ " " ROUND_3_B( 3)
+ " " ROUND_3_A( 6)
+ " " ROUND_3_B( 9)
+ " " ROUND_3_A(12)
+ " " ROUND_3_B(15)
+ " " ROUND_3_A(18)
+ " " ROUND_3_B(21)
+ " " ROUND_3_A(24)
+ " " ROUND_3_B(27)
+ " " ROUND_3_A_LAST(30)
+ " add $(24 * 36), %[src] \n\t"
+ " add $(32 * 36), %[dst] \n\t"
+ " dec %[loops] \n\t"
+ " jnz 36b \n\t"
+
+ // Enter an 18x unrolled loop for rounds of 18 or more.
+ "18: cmp $18, %[rounds] \n\t"
+ " jl 9f \n\t"
+ " " ROUND_3_INIT()
+ " " ROUND_3_A(0)
+ " " ROUND_3_B(3)
+ " " ROUND_3_A(6)
+ " " ROUND_3_B(9)
+ " " ROUND_3_A_LAST(12)
+ " sub $18, %[rounds] \n\t"
+ " add $(24 * 18), %[src] \n\t"
+ " add $(32 * 18), %[dst] \n\t"
+
+ // Enter a 9x unrolled loop for rounds of 9 or more.
+ "9: cmp $9, %[rounds] \n\t"
+ " jl 6f \n\t"
+ " " ROUND_3_INIT()
+ " " ROUND_3_A(0)
+ " " ROUND_3_B_LAST(3)
+ " sub $9, %[rounds] \n\t"
+ " add $(24 * 9), %[src] \n\t"
+ " add $(32 * 9), %[dst] \n\t"
+
+ // Enter a 6x unrolled loop for rounds of 6 or more.
+ "6: cmp $6, %[rounds] \n\t"
+ " jl 55f \n\t"
+ " " ROUND_3_INIT()
+ " " ROUND_3_A_LAST(0)
+ " sub $6, %[rounds] \n\t"
+ " add $(24 * 6), %[src] \n\t"
+ " add $(32 * 6), %[dst] \n\t"
+
+ // Dispatch the remaining rounds 0..5.
+ "55: cmp $3, %[rounds] \n\t"
+ " jg 45f \n\t"
+ " je 3f \n\t"
+ " cmp $1, %[rounds] \n\t"
+ " jg 2f \n\t"
+ " je 1f \n\t"
+ " jmp 0f \n\t"
+
+ "45: cmp $4, %[rounds] \n\t"
+ " je 4f \n\t"
+
+ // Block of non-interlaced encoding rounds, which can each
+ // individually be jumped to. Rounds fall through to the next.
+ "5: " ROUND()
+ "4: " ROUND()
+ "3: " ROUND()
+ "2: " ROUND()
+ "1: " ROUND()
+ "0: \n\t"
+
+ // Outputs (modified).
+ : [rounds] "+r" (rounds),
+ [loops] "+r" (loops),
+ [src] "+r" (*s),
+ [dst] "+r" (*o),
+ [a] "=&x" (a),
+ [b] "=&x" (b),
+ [c] "=&x" (c),
+ [d] "=&x" (d),
+ [e] "=&x" (e),
+ [f] "+x" (f)
+
+ // Inputs (not modified).
+ : [lut0] "x" (lut0),
+ [lut1] "x" (lut1),
+ [msk0] "x" (_mm256_set1_epi32(0x0FC0FC00)),
+ [msk1] "x" (_mm256_set1_epi32(0x04000040)),
+ [msk2] "x" (_mm256_set1_epi32(0x003F03F0)),
+ [msk3] "x" (_mm256_set1_epi32(0x01000010)),
+ [n51] "x" (_mm256_set1_epi8(51)),
+ [n25] "x" (_mm256_set1_epi8(25))
+
+ // Clobbers.
+ : "cc", "memory"
+ );
+}
+
+#pragma GCC diagnostic pop
diff --git a/deps/base64/base64/lib/arch/avx512/codec.c b/deps/base64/base64/lib/arch/avx512/codec.c
new file mode 100644
index 00000000000000..664120853d4316
--- /dev/null
+++ b/deps/base64/base64/lib/arch/avx512/codec.c
@@ -0,0 +1,42 @@
+#include
+#include
+#include
+
+#include "../../../include/libbase64.h"
+#include "../../tables/tables.h"
+#include "../../codecs.h"
+#include "config.h"
+#include "../../env.h"
+
+#if HAVE_AVX512
+#include
+
+#include "../avx2/dec_reshuffle.c"
+#include "../avx2/dec_loop.c"
+#include "enc_reshuffle_translate.c"
+#include "enc_loop.c"
+
+#endif // HAVE_AVX512
+
+BASE64_ENC_FUNCTION(avx512)
+{
+#if HAVE_AVX512
+ #include "../generic/enc_head.c"
+ enc_loop_avx512(&s, &slen, &o, &olen);
+ #include "../generic/enc_tail.c"
+#else
+ BASE64_ENC_STUB
+#endif
+}
+
+// Reuse AVX2 decoding. Not supporting AVX512 at present
+BASE64_DEC_FUNCTION(avx512)
+{
+#if HAVE_AVX512
+ #include "../generic/dec_head.c"
+ dec_loop_avx2(&s, &slen, &o, &olen);
+ #include "../generic/dec_tail.c"
+#else
+ BASE64_DEC_STUB
+#endif
+}
diff --git a/deps/base64/base64/lib/arch/avx512/enc_loop.c b/deps/base64/base64/lib/arch/avx512/enc_loop.c
new file mode 100644
index 00000000000000..4c71e160ae820a
--- /dev/null
+++ b/deps/base64/base64/lib/arch/avx512/enc_loop.c
@@ -0,0 +1,61 @@
+static inline void
+enc_loop_avx512_inner (const uint8_t **s, uint8_t **o)
+{
+ // Load input.
+ __m512i src = _mm512_loadu_si512((__m512i *) *s);
+
+ // Reshuffle, translate, store.
+ src = enc_reshuffle_translate(src);
+ _mm512_storeu_si512((__m512i *) *o, src);
+
+ *s += 48;
+ *o += 64;
+}
+
+static inline void
+enc_loop_avx512 (const uint8_t **s, size_t *slen, uint8_t **o, size_t *olen)
+{
+ if (*slen < 64) {
+ return;
+ }
+
+ // Process blocks of 48 bytes at a time. Because blocks are loaded 64
+ // bytes at a time, ensure that there will be at least 24 remaining
+ // bytes after the last round, so that the final read will not pass
+ // beyond the bounds of the input buffer.
+ size_t rounds = (*slen - 24) / 48;
+
+ *slen -= rounds * 48; // 48 bytes consumed per round
+ *olen += rounds * 64; // 64 bytes produced per round
+
+ while (rounds > 0) {
+ if (rounds >= 8) {
+ enc_loop_avx512_inner(s, o);
+ enc_loop_avx512_inner(s, o);
+ enc_loop_avx512_inner(s, o);
+ enc_loop_avx512_inner(s, o);
+ enc_loop_avx512_inner(s, o);
+ enc_loop_avx512_inner(s, o);
+ enc_loop_avx512_inner(s, o);
+ enc_loop_avx512_inner(s, o);
+ rounds -= 8;
+ continue;
+ }
+ if (rounds >= 4) {
+ enc_loop_avx512_inner(s, o);
+ enc_loop_avx512_inner(s, o);
+ enc_loop_avx512_inner(s, o);
+ enc_loop_avx512_inner(s, o);
+ rounds -= 4;
+ continue;
+ }
+ if (rounds >= 2) {
+ enc_loop_avx512_inner(s, o);
+ enc_loop_avx512_inner(s, o);
+ rounds -= 2;
+ continue;
+ }
+ enc_loop_avx512_inner(s, o);
+ break;
+ }
+}
diff --git a/deps/base64/base64/lib/arch/avx512/enc_reshuffle_translate.c b/deps/base64/base64/lib/arch/avx512/enc_reshuffle_translate.c
new file mode 100644
index 00000000000000..5c332bb24ca4e3
--- /dev/null
+++ b/deps/base64/base64/lib/arch/avx512/enc_reshuffle_translate.c
@@ -0,0 +1,50 @@
+// AVX512 algorithm is based on permutevar and multishift. The code is based on
+// https://github.com/WojciechMula/base64simd which is under BSD-2 license.
+
+static inline __m512i
+enc_reshuffle_translate (const __m512i input)
+{
+ // 32-bit input
+ // [ 0 0 0 0 0 0 0 0|c1 c0 d5 d4 d3 d2 d1 d0|
+ // b3 b2 b1 b0 c5 c4 c3 c2|a5 a4 a3 a2 a1 a0 b5 b4]
+ // output order [1, 2, 0, 1]
+ // [b3 b2 b1 b0 c5 c4 c3 c2|c1 c0 d5 d4 d3 d2 d1 d0|
+ // a5 a4 a3 a2 a1 a0 b5 b4|b3 b2 b1 b0 c3 c2 c1 c0]
+
+ const __m512i shuffle_input = _mm512_setr_epi32(0x01020001,
+ 0x04050304,
+ 0x07080607,
+ 0x0a0b090a,
+ 0x0d0e0c0d,
+ 0x10110f10,
+ 0x13141213,
+ 0x16171516,
+ 0x191a1819,
+ 0x1c1d1b1c,
+ 0x1f201e1f,
+ 0x22232122,
+ 0x25262425,
+ 0x28292728,
+ 0x2b2c2a2b,
+ 0x2e2f2d2e);
+
+ // Reorder bytes
+ // [b3 b2 b1 b0 c5 c4 c3 c2|c1 c0 d5 d4 d3 d2 d1 d0|
+ // a5 a4 a3 a2 a1 a0 b5 b4|b3 b2 b1 b0 c3 c2 c1 c0]
+ const __m512i in = _mm512_permutexvar_epi8(shuffle_input, input);
+
+ // After multishift a single 32-bit lane has following layout
+ // [c1 c0 d5 d4 d3 d2 d1 d0|b1 b0 c5 c4 c3 c2 c1 c0|
+ // a1 a0 b5 b4 b3 b2 b1 b0|d1 d0 a5 a4 a3 a2 a1 a0]
+ // (a = [10:17], b = [4:11], c = [22:27], d = [16:21])
+
+ // 48, 54, 36, 42, 16, 22, 4, 10
+ const __m512i shifts = _mm512_set1_epi64(0x3036242a1016040alu);
+ __m512i shuffled_in = _mm512_multishift_epi64_epi8(shifts, in);
+
+ // Translate immediatedly after reshuffled.
+ const __m512i lookup = _mm512_loadu_si512(base64_table_enc_6bit);
+
+ // Translation 6-bit values to ASCII.
+ return _mm512_permutexvar_epi8(shuffled_in, lookup);
+}
diff --git a/deps/base64/base64/lib/arch/neon32/enc_loop.c b/deps/base64/base64/lib/arch/neon32/enc_loop.c
index e9e8e28525691b..d694b33733cd61 100644
--- a/deps/base64/base64/lib/arch/neon32/enc_loop.c
+++ b/deps/base64/base64/lib/arch/neon32/enc_loop.c
@@ -100,7 +100,8 @@ enc_loop_neon32_inner_asm (const uint8_t **s, uint8_t **o)
[n63] "w" (n63)
// Clobbers.
- : "d24", "d25", "d26", "d27", "d28", "d29", "d30", "d31"
+ : "d24", "d25", "d26", "d27", "d28", "d29", "d30", "d31",
+ "cc", "memory"
);
}
#endif
diff --git a/deps/base64/base64/lib/arch/neon64/enc_loop_asm.c b/deps/base64/base64/lib/arch/neon64/enc_loop_asm.c
index cf2fd27e80d2ca..182e9cdf4a17db 100644
--- a/deps/base64/base64/lib/arch/neon64/enc_loop_asm.c
+++ b/deps/base64/base64/lib/arch/neon64/enc_loop_asm.c
@@ -160,7 +160,8 @@ enc_loop_neon64 (const uint8_t **s, size_t *slen, uint8_t **o, size_t *olen)
// Clobbers.
: "v2", "v3", "v4", "v5",
"v8", "v9", "v10", "v11",
- "v12", "v13", "v14", "v15"
+ "v12", "v13", "v14", "v15",
+ "cc", "memory"
);
}
diff --git a/deps/base64/base64/lib/arch/sse41/codec.c b/deps/base64/base64/lib/arch/sse41/codec.c
index 00645feda836d0..6e5afe30011b7b 100644
--- a/deps/base64/base64/lib/arch/sse41/codec.c
+++ b/deps/base64/base64/lib/arch/sse41/codec.c
@@ -11,11 +11,25 @@
#if HAVE_SSE41
#include
+// Only enable inline assembly on supported compilers and on 64-bit CPUs.
+#ifndef BASE64_SSE41_USE_ASM
+# if (defined(__GNUC__) || defined(__clang__)) && BASE64_WORDSIZE == 64
+# define BASE64_SSE41_USE_ASM 1
+# else
+# define BASE64_SSE41_USE_ASM 0
+# endif
+#endif
+
#include "../ssse3/dec_reshuffle.c"
#include "../ssse3/dec_loop.c"
-#include "../ssse3/enc_translate.c"
-#include "../ssse3/enc_reshuffle.c"
-#include "../ssse3/enc_loop.c"
+
+#if BASE64_SSE41_USE_ASM
+# include "../ssse3/enc_loop_asm.c"
+#else
+# include "../ssse3/enc_translate.c"
+# include "../ssse3/enc_reshuffle.c"
+# include "../ssse3/enc_loop.c"
+#endif
#endif // HAVE_SSE41
diff --git a/deps/base64/base64/lib/arch/sse42/codec.c b/deps/base64/base64/lib/arch/sse42/codec.c
index cf5d97cfb293ca..dde823b7aa0aa6 100644
--- a/deps/base64/base64/lib/arch/sse42/codec.c
+++ b/deps/base64/base64/lib/arch/sse42/codec.c
@@ -11,11 +11,25 @@
#if HAVE_SSE42
#include
+// Only enable inline assembly on supported compilers and on 64-bit CPUs.
+#ifndef BASE64_SSE42_USE_ASM
+# if (defined(__GNUC__) || defined(__clang__)) && BASE64_WORDSIZE == 64
+# define BASE64_SSE42_USE_ASM 1
+# else
+# define BASE64_SSE42_USE_ASM 0
+# endif
+#endif
+
#include "../ssse3/dec_reshuffle.c"
#include "../ssse3/dec_loop.c"
-#include "../ssse3/enc_translate.c"
-#include "../ssse3/enc_reshuffle.c"
-#include "../ssse3/enc_loop.c"
+
+#if BASE64_SSE42_USE_ASM
+# include "../ssse3/enc_loop_asm.c"
+#else
+# include "../ssse3/enc_translate.c"
+# include "../ssse3/enc_reshuffle.c"
+# include "../ssse3/enc_loop.c"
+#endif
#endif // HAVE_SSE42
diff --git a/deps/base64/base64/lib/arch/ssse3/codec.c b/deps/base64/base64/lib/arch/ssse3/codec.c
index ad14a4589deb70..a812a2901f4efb 100644
--- a/deps/base64/base64/lib/arch/ssse3/codec.c
+++ b/deps/base64/base64/lib/arch/ssse3/codec.c
@@ -11,11 +11,27 @@
#if HAVE_SSSE3
#include
+// Only enable inline assembly on supported compilers and on 64-bit CPUs.
+// 32-bit CPUs with SSSE3 support, such as low-end Atoms, only have eight XMM
+// registers, which is not enough to run the inline assembly.
+#ifndef BASE64_SSSE3_USE_ASM
+# if (defined(__GNUC__) || defined(__clang__)) && BASE64_WORDSIZE == 64
+# define BASE64_SSSE3_USE_ASM 1
+# else
+# define BASE64_SSSE3_USE_ASM 0
+# endif
+#endif
+
#include "dec_reshuffle.c"
#include "dec_loop.c"
-#include "enc_reshuffle.c"
-#include "enc_translate.c"
-#include "enc_loop.c"
+
+#if BASE64_SSSE3_USE_ASM
+# include "enc_loop_asm.c"
+#else
+# include "enc_reshuffle.c"
+# include "enc_translate.c"
+# include "enc_loop.c"
+#endif
#endif // HAVE_SSSE3
diff --git a/deps/base64/base64/lib/arch/ssse3/enc_loop_asm.c b/deps/base64/base64/lib/arch/ssse3/enc_loop_asm.c
new file mode 100644
index 00000000000000..0cdb340a63b7fc
--- /dev/null
+++ b/deps/base64/base64/lib/arch/ssse3/enc_loop_asm.c
@@ -0,0 +1,268 @@
+// Apologies in advance for combining the preprocessor with inline assembly,
+// two notoriously gnarly parts of C, but it was necessary to avoid a lot of
+// code repetition. The preprocessor is used to template large sections of
+// inline assembly that differ only in the registers used. If the code was
+// written out by hand, it would become very large and hard to audit.
+
+// Generate a block of inline assembly that loads register R0 from memory. The
+// offset at which the register is loaded is set by the given round.
+#define LOAD(R0, ROUND) \
+ "lddqu ("#ROUND" * 12)(%[src]), %["R0"] \n\t"
+
+// Generate a block of inline assembly that deinterleaves and shuffles register
+// R0 using preloaded constants. Outputs in R0 and R1.
+#define SHUF(R0, R1) \
+ "pshufb %[lut0], %["R0"] \n\t" \
+ "movdqa %["R0"], %["R1"] \n\t" \
+ "pand %[msk0], %["R0"] \n\t" \
+ "pand %[msk2], %["R1"] \n\t" \
+ "pmulhuw %[msk1], %["R0"] \n\t" \
+ "pmullw %[msk3], %["R1"] \n\t" \
+ "por %["R1"], %["R0"] \n\t"
+
+// Generate a block of inline assembly that takes R0 and R1 and translates
+// their contents to the base64 alphabet, using preloaded constants.
+#define TRAN(R0, R1, R2) \
+ "movdqa %["R0"], %["R1"] \n\t" \
+ "movdqa %["R0"], %["R2"] \n\t" \
+ "psubusb %[n51], %["R1"] \n\t" \
+ "pcmpgtb %[n25], %["R2"] \n\t" \
+ "psubb %["R2"], %["R1"] \n\t" \
+ "movdqa %[lut1], %["R2"] \n\t" \
+ "pshufb %["R1"], %["R2"] \n\t" \
+ "paddb %["R2"], %["R0"] \n\t"
+
+// Generate a block of inline assembly that stores the given register R0 at an
+// offset set by the given round.
+#define STOR(R0, ROUND) \
+ "movdqu %["R0"], ("#ROUND" * 16)(%[dst]) \n\t"
+
+// Generate a block of inline assembly that generates a single self-contained
+// encoder round: fetch the data, process it, and store the result. Then update
+// the source and destination pointers.
+#define ROUND() \
+ LOAD("a", 0) \
+ SHUF("a", "b") \
+ TRAN("a", "b", "c") \
+ STOR("a", 0) \
+ "add $12, %[src] \n\t" \
+ "add $16, %[dst] \n\t"
+
+// Define a macro that initiates a three-way interleaved encoding round by
+// preloading registers a, b and c from memory.
+// The register graph shows which registers are in use during each step, and
+// is a visual aid for choosing registers for that step. Symbol index:
+//
+// + indicates that a register is loaded by that step.
+// | indicates that a register is in use and must not be touched.
+// - indicates that a register is decommissioned by that step.
+// x indicates that a register is used as a temporary by that step.
+// V indicates that a register is an input or output to the macro.
+//
+#define ROUND_3_INIT() /* a b c d e f */ \
+ LOAD("a", 0) /* + */ \
+ SHUF("a", "d") /* | + */ \
+ LOAD("b", 1) /* | + | */ \
+ TRAN("a", "d", "e") /* | | - x */ \
+ LOAD("c", 2) /* V V V */
+
+// Define a macro that translates, shuffles and stores the input registers A, B
+// and C, and preloads registers D, E and F for the next round.
+// This macro can be arbitrarily daisy-chained by feeding output registers D, E
+// and F back into the next round as input registers A, B and C. The macro
+// carefully interleaves memory operations with data operations for optimal
+// pipelined performance.
+
+#define ROUND_3(ROUND, A,B,C,D,E,F) /* A B C D E F */ \
+ LOAD(D, (ROUND + 3)) /* V V V + */ \
+ SHUF(B, E) /* | | | | + */ \
+ STOR(A, (ROUND + 0)) /* - | | | | */ \
+ TRAN(B, E, F) /* | | | - x */ \
+ LOAD(E, (ROUND + 4)) /* | | | + */ \
+ SHUF(C, A) /* + | | | | */ \
+ STOR(B, (ROUND + 1)) /* | - | | | */ \
+ TRAN(C, A, F) /* - | | | x */ \
+ LOAD(F, (ROUND + 5)) /* | | | + */ \
+ SHUF(D, A) /* + | | | | */ \
+ STOR(C, (ROUND + 2)) /* | - | | | */ \
+ TRAN(D, A, B) /* - x V V V */
+
+// Define a macro that terminates a ROUND_3 macro by taking pre-loaded
+// registers D, E and F, and translating, shuffling and storing them.
+#define ROUND_3_END(ROUND, A,B,C,D,E,F) /* A B C D E F */ \
+ SHUF(E, A) /* + V V V */ \
+ STOR(D, (ROUND + 3)) /* | - | | */ \
+ TRAN(E, A, B) /* - x | | */ \
+ SHUF(F, C) /* + | | */ \
+ STOR(E, (ROUND + 4)) /* | - | */ \
+ TRAN(F, C, D) /* - x | */ \
+ STOR(F, (ROUND + 5)) /* - */
+
+// Define a type A round. Inputs are a, b, and c, outputs are d, e, and f.
+#define ROUND_3_A(ROUND) \
+ ROUND_3(ROUND, "a", "b", "c", "d", "e", "f")
+
+// Define a type B round. Inputs and outputs are swapped with regard to type A.
+#define ROUND_3_B(ROUND) \
+ ROUND_3(ROUND, "d", "e", "f", "a", "b", "c")
+
+// Terminating macro for a type A round.
+#define ROUND_3_A_LAST(ROUND) \
+ ROUND_3_A(ROUND) \
+ ROUND_3_END(ROUND, "a", "b", "c", "d", "e", "f")
+
+// Terminating macro for a type B round.
+#define ROUND_3_B_LAST(ROUND) \
+ ROUND_3_B(ROUND) \
+ ROUND_3_END(ROUND, "d", "e", "f", "a", "b", "c")
+
+// Suppress clang's warning that the literal string in the asm statement is
+// overlong (longer than the ISO-mandated minimum size of 4095 bytes for C99
+// compilers). It may be true, but the goal here is not C99 portability.
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Woverlength-strings"
+
+static inline void
+enc_loop_ssse3 (const uint8_t **s, size_t *slen, uint8_t **o, size_t *olen)
+{
+ // For a clearer explanation of the algorithm used by this function,
+ // please refer to the plain (not inline assembly) implementation. This
+ // function follows the same basic logic.
+
+ if (*slen < 16) {
+ return;
+ }
+
+ // Process blocks of 12 bytes at a time. Input is read in blocks of 16
+ // bytes, so "reserve" four bytes from the input buffer to ensure that
+ // we never read beyond the end of the input buffer.
+ size_t rounds = (*slen - 4) / 12;
+
+ *slen -= rounds * 12; // 12 bytes consumed per round
+ *olen += rounds * 16; // 16 bytes produced per round
+
+ // Number of times to go through the 36x loop.
+ size_t loops = rounds / 36;
+
+ // Number of rounds remaining after the 36x loop.
+ rounds %= 36;
+
+ // Lookup tables.
+ const __m128i lut0 = _mm_set_epi8(
+ 10, 11, 9, 10, 7, 8, 6, 7, 4, 5, 3, 4, 1, 2, 0, 1);
+
+ const __m128i lut1 = _mm_setr_epi8(
+ 65, 71, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -19, -16, 0, 0);
+
+ // Temporary registers.
+ __m128i a, b, c, d, e, f;
+
+ __asm__ volatile (
+
+ // If there are 36 rounds or more, enter a 36x unrolled loop of
+ // interleaved encoding rounds. The rounds interleave memory
+ // operations (load/store) with data operations (table lookups,
+ // etc) to maximize pipeline throughput.
+ " test %[loops], %[loops] \n\t"
+ " jz 18f \n\t"
+ " jmp 36f \n\t"
+ " \n\t"
+ ".balign 64 \n\t"
+ "36: " ROUND_3_INIT()
+ " " ROUND_3_A( 0)
+ " " ROUND_3_B( 3)
+ " " ROUND_3_A( 6)
+ " " ROUND_3_B( 9)
+ " " ROUND_3_A(12)
+ " " ROUND_3_B(15)
+ " " ROUND_3_A(18)
+ " " ROUND_3_B(21)
+ " " ROUND_3_A(24)
+ " " ROUND_3_B(27)
+ " " ROUND_3_A_LAST(30)
+ " add $(12 * 36), %[src] \n\t"
+ " add $(16 * 36), %[dst] \n\t"
+ " dec %[loops] \n\t"
+ " jnz 36b \n\t"
+
+ // Enter an 18x unrolled loop for rounds of 18 or more.
+ "18: cmp $18, %[rounds] \n\t"
+ " jl 9f \n\t"
+ " " ROUND_3_INIT()
+ " " ROUND_3_A(0)
+ " " ROUND_3_B(3)
+ " " ROUND_3_A(6)
+ " " ROUND_3_B(9)
+ " " ROUND_3_A_LAST(12)
+ " sub $18, %[rounds] \n\t"
+ " add $(12 * 18), %[src] \n\t"
+ " add $(16 * 18), %[dst] \n\t"
+
+ // Enter a 9x unrolled loop for rounds of 9 or more.
+ "9: cmp $9, %[rounds] \n\t"
+ " jl 6f \n\t"
+ " " ROUND_3_INIT()
+ " " ROUND_3_A(0)
+ " " ROUND_3_B_LAST(3)
+ " sub $9, %[rounds] \n\t"
+ " add $(12 * 9), %[src] \n\t"
+ " add $(16 * 9), %[dst] \n\t"
+
+ // Enter a 6x unrolled loop for rounds of 6 or more.
+ "6: cmp $6, %[rounds] \n\t"
+ " jl 55f \n\t"
+ " " ROUND_3_INIT()
+ " " ROUND_3_A_LAST(0)
+ " sub $6, %[rounds] \n\t"
+ " add $(12 * 6), %[src] \n\t"
+ " add $(16 * 6), %[dst] \n\t"
+
+ // Dispatch the remaining rounds 0..5.
+ "55: cmp $3, %[rounds] \n\t"
+ " jg 45f \n\t"
+ " je 3f \n\t"
+ " cmp $1, %[rounds] \n\t"
+ " jg 2f \n\t"
+ " je 1f \n\t"
+ " jmp 0f \n\t"
+
+ "45: cmp $4, %[rounds] \n\t"
+ " je 4f \n\t"
+
+ // Block of non-interlaced encoding rounds, which can each
+ // individually be jumped to. Rounds fall through to the next.
+ "5: " ROUND()
+ "4: " ROUND()
+ "3: " ROUND()
+ "2: " ROUND()
+ "1: " ROUND()
+ "0: \n\t"
+
+ // Outputs (modified).
+ : [rounds] "+r" (rounds),
+ [loops] "+r" (loops),
+ [src] "+r" (*s),
+ [dst] "+r" (*o),
+ [a] "=&x" (a),
+ [b] "=&x" (b),
+ [c] "=&x" (c),
+ [d] "=&x" (d),
+ [e] "=&x" (e),
+ [f] "=&x" (f)
+
+ // Inputs (not modified).
+ : [lut0] "x" (lut0),
+ [lut1] "x" (lut1),
+ [msk0] "x" (_mm_set1_epi32(0x0FC0FC00)),
+ [msk1] "x" (_mm_set1_epi32(0x04000040)),
+ [msk2] "x" (_mm_set1_epi32(0x003F03F0)),
+ [msk3] "x" (_mm_set1_epi32(0x01000010)),
+ [n51] "x" (_mm_set1_epi8(51)),
+ [n25] "x" (_mm_set1_epi8(25))
+
+ // Clobbers.
+ : "cc", "memory"
+ );
+}
+
+#pragma GCC diagnostic pop
diff --git a/deps/base64/base64/lib/codec_choose.c b/deps/base64/base64/lib/codec_choose.c
index 6a07d6a74cc24f..abef3f2ae9f403 100644
--- a/deps/base64/base64/lib/codec_choose.c
+++ b/deps/base64/base64/lib/codec_choose.c
@@ -2,6 +2,7 @@
#include
#include
#include
+#include
#include "../include/libbase64.h"
#include "codecs.h"
@@ -10,7 +11,7 @@
#if (__x86_64__ || __i386__ || _M_X86 || _M_X64)
#define BASE64_X86
- #if (HAVE_SSSE3 || HAVE_SSE41 || HAVE_SSE42 || HAVE_AVX || HAVE_AVX2)
+ #if (HAVE_SSSE3 || HAVE_SSE41 || HAVE_SSE42 || HAVE_AVX || HAVE_AVX2 || HAVE_AVX512)
#define BASE64_X86_SIMD
#endif
#endif
@@ -31,7 +32,7 @@
__cpuid_count(__level, 0, __eax, __ebx, __ecx, __edx)
#else
#include
- #if HAVE_AVX2 || HAVE_AVX
+ #if HAVE_AVX512 || HAVE_AVX2 || HAVE_AVX
#if ((__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 2) || (__clang_major__ >= 3))
static inline uint64_t _xgetbv (uint32_t index)
{
@@ -45,6 +46,12 @@
#endif
#endif
+#ifndef bit_AVX512vl
+#define bit_AVX512vl (1 << 31)
+#endif
+#ifndef bit_AVX512vbmi
+#define bit_AVX512vbmi (1 << 1)
+#endif
#ifndef bit_AVX2
#define bit_AVX2 (1 << 5)
#endif
@@ -75,6 +82,7 @@
BASE64_ENC_FUNCTION(arch); \
BASE64_DEC_FUNCTION(arch); \
+BASE64_CODEC_FUNCS(avx512)
BASE64_CODEC_FUNCS(avx2)
BASE64_CODEC_FUNCS(neon32)
BASE64_CODEC_FUNCS(neon64)
@@ -91,9 +99,10 @@ codec_choose_forced (struct codec *codec, int flags)
// always allow it, even if the codec is a no-op.
// For testing purposes.
- if (!(flags & 0xFF)) {
+ if (!(flags & 0xFFFF)) {
return false;
}
+
if (flags & BASE64_FORCE_AVX2) {
codec->enc = base64_stream_encode_avx2;
codec->dec = base64_stream_decode_avx2;
@@ -134,6 +143,11 @@ codec_choose_forced (struct codec *codec, int flags)
codec->dec = base64_stream_decode_avx;
return true;
}
+ if (flags & BASE64_FORCE_AVX512) {
+ codec->enc = base64_stream_encode_avx512;
+ codec->dec = base64_stream_decode_avx512;
+ return true;
+ }
return false;
}
@@ -178,8 +192,8 @@ codec_choose_x86 (struct codec *codec)
max_level = __get_cpuid_max(0, NULL);
#endif
- #if HAVE_AVX2 || HAVE_AVX
- // Check for AVX/AVX2 support:
+ #if HAVE_AVX512 || HAVE_AVX2 || HAVE_AVX
+ // Check for AVX/AVX2/AVX512 support:
// Checking for AVX requires 3 things:
// 1) CPUID indicates that the OS uses XSAVE and XRSTORE instructions
// (allowing saving YMM registers on context switch)
@@ -194,7 +208,17 @@ codec_choose_x86 (struct codec *codec)
if (ecx & bit_XSAVE_XRSTORE) {
uint64_t xcr_mask;
xcr_mask = _xgetbv(_XCR_XFEATURE_ENABLED_MASK);
- if (xcr_mask & _XCR_XMM_AND_YMM_STATE_ENABLED_BY_OS) {
+ if ((xcr_mask & _XCR_XMM_AND_YMM_STATE_ENABLED_BY_OS) == _XCR_XMM_AND_YMM_STATE_ENABLED_BY_OS) { // check multiple bits at once
+ #if HAVE_AVX512
+ if (max_level >= 7) {
+ __cpuid_count(7, 0, eax, ebx, ecx, edx);
+ if ((ebx & bit_AVX512vl) && (ecx & bit_AVX512vbmi)) {
+ codec->enc = base64_stream_encode_avx512;
+ codec->dec = base64_stream_decode_avx512;
+ return true;
+ }
+ }
+ #endif
#if HAVE_AVX2
if (max_level >= 7) {
__cpuid_count(7, 0, eax, ebx, ecx, edx);
diff --git a/deps/base64/base64/lib/env.h b/deps/base64/base64/lib/env.h
index d5c2fdb7952735..d489ba54215bbf 100644
--- a/deps/base64/base64/lib/env.h
+++ b/deps/base64/base64/lib/env.h
@@ -1,6 +1,8 @@
#ifndef BASE64_ENV_H
#define BASE64_ENV_H
+#include
+
// This header file contains macro definitions that describe certain aspects of
// the compile-time environment. Compatibility and portability macros go here.
@@ -46,12 +48,10 @@
#if defined (__x86_64__)
// This also works for the x32 ABI, which has a 64-bit word size.
# define BASE64_WORDSIZE 64
-#elif defined (_INTEGRAL_MAX_BITS)
-# define BASE64_WORDSIZE _INTEGRAL_MAX_BITS
-#elif defined (__WORDSIZE)
-# define BASE64_WORDSIZE __WORDSIZE
-#elif defined (__SIZE_WIDTH__)
-# define BASE64_WORDSIZE __SIZE_WIDTH__
+#elif SIZE_MAX == UINT32_MAX
+# define BASE64_WORDSIZE 32
+#elif SIZE_MAX == UINT64_MAX
+# define BASE64_WORDSIZE 64
#else
# error BASE64_WORDSIZE_NOT_DEFINED
#endif
diff --git a/deps/base64/base64/lib/lib.c b/deps/base64/base64/lib/lib.c
index 4703512b87ab46..053931a9918b2b 100644
--- a/deps/base64/base64/lib/lib.c
+++ b/deps/base64/base64/lib/lib.c
@@ -68,7 +68,7 @@ void
base64_stream_decode_init (struct base64_state *state, int flags)
{
// If any of the codec flags are set, redo choice:
- if (codec.dec == NULL || flags & 0xFF) {
+ if (codec.dec == NULL || flags & 0xFFFF) {
codec_choose(&codec, flags);
}
state->eof = 0;
diff --git a/deps/base64/base64/test/CMakeLists.txt b/deps/base64/base64/test/CMakeLists.txt
index ef8787047b2944..f07b65a00c2cb4 100644
--- a/deps/base64/base64/test/CMakeLists.txt
+++ b/deps/base64/base64/test/CMakeLists.txt
@@ -32,12 +32,10 @@ add_base64_test(test_base64
test_base64.c
)
-if (NOT WIN32)
- add_base64_test(benchmark
- codec_supported.c
- benchmark.c
- )
-endif()
+add_base64_test(benchmark
+ codec_supported.c
+ benchmark.c
+)
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
target_link_libraries(benchmark PRIVATE rt)
diff --git a/deps/base64/base64/test/Makefile b/deps/base64/base64/test/Makefile
index d1045824195edb..7ecb893a6363b9 100644
--- a/deps/base64/base64/test/Makefile
+++ b/deps/base64/base64/test/Makefile
@@ -1,4 +1,4 @@
-CFLAGS += -std=c99 -O3 -Wall -Wextra -pedantic
+CFLAGS += -std=c99 -O3 -Wall -Wextra -pedantic -DBASE64_STATIC_DEFINE
ifdef OPENMP
CFLAGS += -fopenmp
endif
@@ -6,17 +6,22 @@ endif
TARGET := $(shell $(CC) -dumpmachine)
ifneq (, $(findstring darwin, $(TARGET)))
BENCH_LDFLAGS=
+else ifneq (, $(findstring mingw, $(TARGET)))
+ BENCH_LDFLAGS=
else
# default to linux, -lrt needed
BENCH_LDFLAGS=-lrt
endif
-.PHONY: clean test
+.PHONY: clean test valgrind
test: clean test_base64 benchmark
./test_base64
./benchmark
+valgrind: clean test_base64
+ valgrind --error-exitcode=2 ./test_base64
+
test_base64: test_base64.c codec_supported.o ../lib/libbase64.o
$(CC) $(CFLAGS) -o $@ $^
diff --git a/deps/base64/base64/test/benchmark.c b/deps/base64/base64/test/benchmark.c
index 80d21a389cb98c..e78b696bedb6b3 100644
--- a/deps/base64/base64/test/benchmark.c
+++ b/deps/base64/base64/test/benchmark.c
@@ -8,17 +8,25 @@
#define _XOPEN_SOURCE 600
#endif
+// Standard cross-platform includes.
#include
-#include
-#include
-#include
-#include
#include
#include
-#include
-#ifdef __MACH__
-#include
+// Platform-specific includes.
+#if defined(_WIN32) || defined(_WIN64)
+# include
+# include
+#else
+# include
+# include
+# include
+# include
+# include
+#endif
+
+#if defined(__MACH__)
+# include
#endif
#include "../include/libbase64.h"
@@ -60,6 +68,27 @@ bytes_to_mb (size_t bytes)
static bool
get_random_data (struct buffers *b, char **errmsg)
{
+#if defined(_WIN32) || defined(_WIN64)
+ HCRYPTPROV hProvider = 0;
+
+ if (!CryptAcquireContext(&hProvider, 0, 0, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) {
+ *errmsg = "Error: CryptAcquireContext";
+ return false;
+ }
+
+ if (!CryptGenRandom(hProvider, b->regsz, b->reg)) {
+ CryptReleaseContext(hProvider, 0);
+ *errmsg = "Error: CryptGenRandom";
+ return false;
+ }
+
+ if (!CryptReleaseContext(hProvider, 0)) {
+ *errmsg = "Error: CryptReleaseContext";
+ return false;
+ }
+
+ return true;
+#else
int fd;
ssize_t nread;
size_t total_read = 0;
@@ -80,16 +109,19 @@ get_random_data (struct buffers *b, char **errmsg)
}
total_read += nread;
}
+
close(fd);
return true;
+#endif
}
-#ifdef __MACH__
+#if defined(__MACH__)
typedef uint64_t base64_timespec;
+
static void
-base64_gettime (base64_timespec * o_time)
+base64_gettime (base64_timespec *t)
{
- *o_time = mach_absolute_time();
+ *t = mach_absolute_time();
}
static float
@@ -101,18 +133,39 @@ timediff_sec (base64_timespec *start, base64_timespec *end)
return (float)((diff * tb.numer) / tb.denom) / 1e9f;
}
+#elif defined(_WIN32) || defined(_WIN64)
+typedef ULARGE_INTEGER base64_timespec;
+
+static void
+base64_gettime (base64_timespec *t)
+{
+ FILETIME current_time_ft;
+
+ GetSystemTimePreciseAsFileTime(¤t_time_ft);
+
+ t->LowPart = current_time_ft.dwLowDateTime;
+ t->HighPart = current_time_ft.dwHighDateTime;
+}
+
+static float
+timediff_sec (base64_timespec *start, base64_timespec *end)
+{
+ // Timer resolution is 100 nanoseconds (10^-7 sec).
+ return (end->QuadPart - start->QuadPart) / 1e7f;
+}
#else
typedef struct timespec base64_timespec;
+
static void
-base64_gettime (base64_timespec * o_time)
+base64_gettime (base64_timespec *t)
{
- clock_gettime(CLOCK_REALTIME, o_time);
+ clock_gettime(CLOCK_REALTIME, t);
}
static float
timediff_sec (base64_timespec *start, base64_timespec *end)
{
- return (end->tv_sec - start->tv_sec) + ((float)(end->tv_nsec - start->tv_nsec)) / 1e9f;
+ return (end->tv_sec - start->tv_sec) + (end->tv_nsec - start->tv_nsec) / 1e9f;
}
#endif
diff --git a/deps/base64/base64/test/ci/analysis.sh b/deps/base64/base64/test/ci/analysis.sh
new file mode 100755
index 00000000000000..f7da1857fe05e3
--- /dev/null
+++ b/deps/base64/base64/test/ci/analysis.sh
@@ -0,0 +1,37 @@
+#!/bin/bash
+set -ve
+
+MACHINE=$(uname -m)
+export CC=gcc
+
+uname -a
+clang --version # make analyse
+${CC} --version # make -C test valgrind
+
+for USE_ASSEMBLY in 0 1; do
+ if [ "${MACHINE}" == "x86_64" ]; then
+ export SSSE3_CFLAGS="-mssse3 -DBASE64_SSSE3_USE_ASM=${USE_ASSEMBLY}"
+ export SSE41_CFLAGS="-msse4.1 -DBASE64_SSE41_USE_ASM=${USE_ASSEMBLY}"
+ export SSE42_CFLAGS="-msse4.2 -DBASE64_SSE42_USE_ASM=${USE_ASSEMBLY}"
+ export AVX_CFLAGS="-mavx -DBASE64_AVX_USE_ASM=${USE_ASSEMBLY}"
+ export AVX2_CFLAGS="-mavx2 -DBASE64_AVX2_USE_ASM=${USE_ASSEMBLY}"
+ # Temporarily disable AVX512; it is not available in CI yet.
+ # export AVX512_CFLAGS="-mavx512vl -mavx512vbmi"
+ elif [ "${MACHINE}" == "aarch64" ]; then
+ export NEON64_CFLAGS="-march=armv8-a"
+ elif [ "${MACHINE}" == "armv7l" ]; then
+ export NEON32_CFLAGS="-march=armv7-a -mfloat-abi=hard -mfpu=neon"
+ fi
+
+ if [ ${USE_ASSEMBLY} -eq 0 ]; then
+ echo "::group::analyze"
+ make analyze
+ echo "::endgroup::"
+ fi
+
+ echo "::group::valgrind (USE_ASSEMBLY=${USE_ASSEMBLY})"
+ make clean
+ make
+ make -C test valgrind
+ echo "::endgroup::"
+done
diff --git a/deps/base64/base64/test/ci/test.sh b/deps/base64/base64/test/ci/test.sh
index 066a49f400b95c..fb188418cca0a9 100755
--- a/deps/base64/base64/test/ci/test.sh
+++ b/deps/base64/base64/test/ci/test.sh
@@ -7,9 +7,11 @@ if [ "${MACHINE}" == "x86_64" ]; then
export SSE41_CFLAGS=-msse4.1
export SSE42_CFLAGS=-msse4.2
export AVX_CFLAGS=-mavx
- # no AVX2 on GHA macOS
+ # no AVX2 or AVX512 on GHA macOS
if [ "$(uname -s)" != "Darwin" ]; then
export AVX2_CFLAGS=-mavx2
+ # Temporarily disable AVX512; it is not available in CI yet.
+ # export AVX512_CFLAGS="-mavx512vl -mavx512vbmi"
fi
elif [ "${MACHINE}" == "aarch64" ]; then
export NEON64_CFLAGS="-march=armv8-a"
diff --git a/deps/base64/base64/test/codec_supported.c b/deps/base64/base64/test/codec_supported.c
index a027b9943bf8ed..f68c766875abcd 100644
--- a/deps/base64/base64/test/codec_supported.c
+++ b/deps/base64/base64/test/codec_supported.c
@@ -11,6 +11,7 @@ static char *_codecs[] =
, "SSE41"
, "SSE42"
, "AVX"
+, "AVX512"
, NULL
} ;
diff --git a/deps/base64/base64/test/test_base64.c b/deps/base64/base64/test/test_base64.c
index bec52d146c824a..94aad2d489b9f7 100644
--- a/deps/base64/base64/test/test_base64.c
+++ b/deps/base64/base64/test/test_base64.c
@@ -1,6 +1,7 @@
#include
#include
#include
+#include
#include "../include/libbase64.h"
#include "codec_supported.h"
#include "moby_dick.h"
@@ -92,7 +93,7 @@ assert_roundtrip (int flags, const char *src)
}
static int
-test_char_table (int flags)
+test_char_table (int flags, bool use_malloc)
{
bool fail = false;
char chr[256];
@@ -107,8 +108,24 @@ test_char_table (int flags)
for (int i = 0; i < 256; i++) {
size_t chrlen = 256 - i;
+ char* src = &chr[i];
+ if (use_malloc) {
+ src = malloc(chrlen); /* malloc/copy this so valgrind can find out-of-bound access */
+ if (src == NULL) {
+ printf(
+ "FAIL: encoding @ %d: allocation of %lu bytes failed\n",
+ i, (unsigned long)chrlen
+ );
+ fail = true;
+ continue;
+ }
+ memcpy(src, &chr[i], chrlen);
+ }
- base64_encode(&chr[i], chrlen, enc, &enclen, BASE64_FORCE_PLAIN);
+ base64_encode(src, chrlen, enc, &enclen, flags);
+ if (use_malloc) {
+ free(src);
+ }
if (!base64_decode(enc, enclen, dec, &declen, flags)) {
printf("FAIL: decoding @ %d: decoding error\n", i);
@@ -198,6 +215,11 @@ test_streaming (int flags)
while (base64_stream_decode(&state, &ref[inpos], (inpos + bs > reflen) ? reflen - inpos : bs, &enc[enclen], &partlen)) {
enclen += partlen;
inpos += bs;
+
+ // Has the entire buffer been consumed?
+ if (inpos >= 400) {
+ break;
+ }
}
if (enclen != 256) {
printf("FAIL: stream decoding gave incorrect size: "
@@ -336,7 +358,8 @@ test_one_codec (const char *codec, int flags)
fail |= assert_roundtrip(flags, vec[i].out);
}
- fail |= test_char_table(flags);
+ fail |= test_char_table(flags, false); /* test with unaligned input buffer */
+ fail |= test_char_table(flags, true); /* test for out-of-bound input read */
fail |= test_streaming(flags);
fail |= test_invalid_dec_input(flags);
diff --git a/deps/cares/CHANGES b/deps/cares/CHANGES
index 6523436d3af31d..24a68a89849b67 100644
--- a/deps/cares/CHANGES
+++ b/deps/cares/CHANGES
@@ -1,5707 +1,6226 @@
Changelog for the c-ares project. Generated with git2changes.pl
-Version 1.20.1 (8 Oct 2023)
+Version 1.27.0 (22 Feb 2024)
-GitHub (8 Oct 2023)
-- [Daniel Stenberg brought this change]
+GitHub (22 Feb 2024)
+- [Brad House brought this change]
- ares-test: silence warning (#564)
+ Release 1.27.0 (#715)
- warning: comparison of integer expressions of different signedness
+ release prep for 1.27.0 release
+
+- [Brad House brought this change]
+
+ Merge pull request from GHSA-mg26-v6qh-x48q
+
+- [Oliver Welsh brought this change]
+
+ Add flag to not use a default local named server on channel initialization (#713)
- Fix By: Daniel Stenberg (@bagder)
+ Hello, I work on an application for Microsoft which uses c-ares to
+ perform DNS lookups. We have made some minor changes to the library over
+ time, and would like to contribute these back to the project in case
+ they are useful more widely. This PR adds a new channel init flag,
+ described below.
+
+ Please let me know if I can include any more information to make this PR
+ better/easier for you to review. Thanks!
+
+ **Summary**
+ When initializing a channel with `ares_init_options()`, if there are no
+ nameservers available (because `ARES_OPT_SERVERS` is not used and
+ `/etc/resolv.conf` is either empty or not available) then a default
+ local named server will be added to the channel.
+
+ However in some applications a local named server will never be
+ available. In this case, all subsequent queries on the channel will
+ fail.
+
+ If we know this ahead of time, then it may be preferred to fail channel
+ initialization directly rather than wait for the queries to fail. This
+ gives better visibility, since we know that the failure is due to
+ missing servers rather than something going wrong with the queries.
+
+ This PR adds a new flag `ARES_FLAG_NO_DFLT_SVR`, to indicate that a
+ default local named server should not be added to a channel in this
+ scenario. Instead, a new error `ARES_EINITNOSERVER` is returned and
+ initialization fails.
+
+ **Testing**
+ I have added 2 new FV tests:
+ - `ContainerNoDfltSvrEmptyInit` to test that initialization fails when
+ no nameservers are available and the flag is set.
+ - `ContainerNoDfltSvrFullInit` to test that initialization still
+ succeeds when the flag is set but other nameservers are available.
+
+ Existing FVs are all passing.
+
+ **Documentation**
+ I have had a go at manually updating the docs to describe the new
+ flag/error, but couldn't see any contributing guidance about testing
+ this. Please let me know if you'd like anything more here.
+
+ ---------
+
+ Fix By: Oliver Welsh (@oliverwelsh)
-Brad House (8 Oct 2023)
-- fix README.md
+Brad House (18 Feb 2024)
+- badge should be only main branch
-GitHub (8 Oct 2023)
+- put logo in readme
+
+- clang-format
+
+GitHub (17 Feb 2024)
- [Brad House brought this change]
- 1.20.1 release (#563)
+ Add ares_queue_active_queries() (#712)
+
+ Add a function to request the number of active queries from an ares
+ channel. This will return the number of inflight requests to dns
+ servers. Some functions like `ares_getaddrinfo()` when using `AF_UNSPEC`
+ may enqueue multiple queries which will be reflected in this count.
+
+ In the future, if we implement support for queuing (e.g. for throttling
+ purposes), and/or implement support for tracking user-requested queries
+ (e.g. for cancelation), we can provide additional functions for
+ inspecting those queues.
+
+ Fix By: Brad House (@bradh352)
+
+- [Vojtěch Vobr brought this change]
+
+ fix leaking DNS suffix search list on Windows (#711)
+
+ ares__strsplit provides a newly allocated buffer, so suffix list in
+ line variable isn't referenced anymore. Related ares_free seems to
+ have gone missing during refactoring made in #594
+
+ Fix By: Vojtěch Vobr (@vojtechvobr)
- [Brad House brought this change]
- fix reference to freed memory (#562)
+ Add ares_queue_wait_empty() for use with EventThreads (#710)
- Issue #561 shows free'd memory could be accessed in some error conditions.
+ It may be useful to wait for the queue to be empty under certain conditions (mainly test cases), expose a function to efficiently do this and rework test cases to use it.
- Fixes Issue #561
Fix By: Brad House (@bradh352)
-Brad House (8 Oct 2023)
-- reported build/test systems may timeout on intensive tests. reduce test case to still be relevant but to reduce false positive errors
+- [Cheng Zhao brought this change]
-GitHub (8 Oct 2023)
-- [Gregor Jasny brought this change]
+ Fix warning about ignoring result of write (#709)
+
+ Fix the compiler warning from clang:
+
+ ```
+ ares_event_wake_pipe.c:120:3: error: ignoring return value of function declared with 'warn_unused_result' attribute [-Werror,-Wunused-result]
+ 120 | write(p->filedes[1], "1", 1);
+ | ^~~~~ ~~~~~~~~~~~~~~~~~~~~~
+ 1 error generated.
+ ```
+
+ Fix By: Cheng Zhao (@zcbenz)
- Regression: Fix typo in fuzzcheck target name (#559)
+Brad House (5 Feb 2024)
+- CMake: don't override target output locations if not top-level
- This seems to be a vim'esque typo introduced with c1b00c41.
+ CMake was unconditionally setting output locations globally, but
+ it should not do that if it is not the top-level project (e.g.
+ during chain building). Detect this fact and only set the output
+ location when top level.
- Fix By: Gregor Jasny (@gjasny)
+ Fixes Issue: #708
+ Fix By: Anthony Alayo (@anthonyalayo)
-Version 1.20.0 (6 Oct 2023)
+- make docs match PR #705
-Brad House (6 Oct 2023)
-- fix slist search off by 1
+GitHub (31 Jan 2024)
+- [Cristian Rodríguez brought this change]
-GitHub (6 Oct 2023)
-- [Brad House brought this change]
+ lower EDNSPACKETSZ to 1232 (#705)
+
+ In 2020, it was agreed this is optimal maximum size and all
+ major server software was updated to reflect this.
+
+ see https://www.dnsflagday.net/2020/#faq
+
+ Fix By: Cristian Rodríguez (@crrodriguez)
- 1.20.0 release prep (#557)
+Brad House (30 Jan 2024)
+- fix version
+
+- fix typo
+
+- bad symlink
+
+- attempt to fix pkgconfig on windows for static builds
+
+GitHub (28 Jan 2024)
+- [Andriy Utkin brought this change]
+
+ docs/ares_init_options.3: fix args in analogy (#701)
+
+ Fix By: Andriy Utkin
- [Brad House brought this change]
- ares__buf should return standard error codes. more helpers implemented. (#558)
+ sonarcloud: fix minor codesmells (#702)
- The purpose of this PR is to hopefully make the private API of this set of routines less likely to need to be changed in a future release. While this is not a public API, it could become harder in the future to change usage as it becomes more widely used within c-ares.
+ Fix minor codesmells, mostly related to missing 'const' in the new event system.
Fix By: Brad House (@bradh352)
+Brad House (26 Jan 2024)
+- remove outdated copyright text
+
+- spelling
+
+- sanity check GTest includes GMock component
+
+GitHub (26 Jan 2024)
- [Brad House brought this change]
- Update from 1989 MIT license text to modern MIT license text (#556)
-
- ares (and thus c-ares) was originally licensed under the 1989 MIT license text:
- https://fedoraproject.org/wiki/Licensing:MIT#Old_Style_(no_advertising_without_permission)
+ build-time disabled threads breaks c-ares (#700)
- This change updates the license to the modern MIT license as recognized here:
- https://opensource.org/license/mit/
-
- care has been taken to ensure correct attributions remain for the authors contained within the copyright headers, and all authors with attributions in the headers have been contacted for approval regarding the change. Any authors which were not able to be contacted, the original copyright maintains, luckily that exists in only a single file `ares_parse_caa_reply.c` at this time.
+ Regression introduced in 1.26.0, building c-ares with threading disabled results in ares_init{_options}() failing.
- Please see PR #556 for the documented approvals by each contributor.
+ Also adds a new CI test case to prevent this regression in the future.
+ Fixes Bug: #699
Fix By: Brad House (@bradh352)
+Version 1.26.0 (25 Jan 2024)
+
+Brad House (25 Jan 2024)
+- clusterfuzz: enforce maximum DNS packet size due to long parser time
+
+GitHub (24 Jan 2024)
- [Brad House brought this change]
- Test Harness: use ares_timeout() to calculate the value to pass to select() these days. (#555)
+ Release prep for c-ares 1.26.0 (#698)
- The test framework was using 100ms timeout passed to select(), and not using ares_timeout() to calculate the actual recommended value based on the queries in queue. Using ares_timeout() tests the functionality of ares_timeout() itself and will provide more responsive results.
+ release prep
+
+Brad House (24 Jan 2024)
+- adig: Differentiate between internal and server error
- Fix By: Brad House (@bradh352)
+ Should not output "Got answer" if there was no answer from the
+ server, instead should just output the internal error.
+
+ Fix By: Gisle Vanem (@gvanem)
+GitHub (24 Jan 2024)
- [Brad House brought this change]
- Fix for TCP back to back queries (#552)
+ Event Subsystem: No longer require integrators to have their own (#696)
- As per #266, TCP queries are basically broken. If we get a partial reply, things just don't work, but unlike UDP, TCP may get fragmented and we need to properly handle that.
+ This PR implements an event thread to process all events on file descriptors registered by c-ares. Prior to this feature, integrators were required to understand the internals of c-ares and how to monitor file descriptors and timeouts and process events.
- I've started creating a basic parser/buffer framework for c-ares for memory safety reasons, but it also helps for things like this where we shouldn't be manually tracking positions and fetching only a couple of bytes at a time from a socket. This parser/buffer will be expanded and used more in the future.
+ Implements OS-specific efficient polling such as epoll(), kqueue(), or IOCP, and falls back to poll() or select() if otherwise unsupported. At this point, it depends on basic threading primitives such as pthreads or windows threads.
- This also resolves #206 by allowing NULL to be specified for some socket callbacks so they will auto-route to the built-in c-ares functions.
+ If enabled via the ARES_OPT_EVENT_THREAD option passed to ares_init_options(), then socket callbacks cannot be used.
- Fixes: #206, #266
+ Fixes Bug: #611
Fix By: Brad House (@bradh352)
-- [Brad House brought this change]
+- [Erik Lax brought this change]
- remove acountry from built tools as nerd.dk is gone (#554)
+ Added flags to are_dns_parse to force RAW packet parsing (#693)
- The acountry utility required a third party DNSBL service from nerd.dk in order to operate. That service has been offline for about a year and there is no other comparable service offering. We are keeping the code in the repository as an example, but no longer building it.
+ This pull request adds six flags to instruct the parser under various circumstances to skip parsing of the returned RR records so the raw data can be retrieved.
- Fixes: #537
- Fix By: Brad House (@bradh352)
+ Fixes Bug: #686
+ Fix By: Erik Lax (@eriklax)
- [Brad House brought this change]
- Don't requeue any queries for getaddrinfo() during destruction. (#553)
+ Autotools allow make to override CFLAGS/CPPFLAGS/CXXFLAGS (#695)
- During ares_destroy(), any outstanding queries are terminated, however ares_getaddrinfo() had an ordering issue with status codes which in some circumstances could lead to a new query being enqueued rather than honoring the termination.
+ The previous build system allowed overwriting of CFLAGS/CPPFLAGS/CXXFLAGS on the make command line. Switch to using AM_CFLAGS/AM_CPPFLAGS/AM_CXXFLAGS when we set our own flags for building which ensures they are kept even when a user tries to override.
- Fixes #532
- Fix By: @Chilledheart and Brad House (@bradh352)
+ Fixes Bug: #694
+ Fix By: Brad House (@bradh352)
+Brad House (16 Jan 2024)
+- fix doxygen typo
+
+GitHub (16 Jan 2024)
- [Brad House brought this change]
- ares_getaddrinfo(): Fail faster on AF_UNSPEC if we've already received one address class (#551)
+ man ares_fds(3): mark as deprecated and add explanation (#691)
- As per #541, when using AF_UNSPEC with ares_getaddrinfo() (and in turn with ares_gethostbynam()) if we receive a successful response for one address class, we should not allow the other address class to continue on with retries, just return the address class we have.
-
- This will limit the overall query time to whatever timeout remains for the pending query for the other address class, it will not, however, terminate the other query as it may still prove to be successful (possibly coming in less than a millisecond later) and we'd want that result still. It just turns off additional error processing to get the result back quicker.
+ ares_fds(3) is not safe to use, mark as deprecated.
- Fixes Bug: #541
+ Fixes Issue: #687
Fix By: Brad House (@bradh352)
-- [Sam Morris brought this change]
+- [Brad House brought this change]
- Avoid producing an ill-formed result when qualifying a name with the root domain (#546)
+ autotools: fix building for 32bit windows due to stdcall symbol mangling (#689)
- This prevents the result of qualifying "name" with "." being "name.." which is ill-formed.
+ Use AC_CHECK_DECL not AC_CHECK_FUNCS, while this doesn't do a linkage test, it just makes sure the headers define it, this is the only thing without a complex workaround on Windows that will do what we need.
- Fixes Bug: #545
- Fix By: Sam Morris (@yrro)
+ See:
+
+ https://github.com/msys2/msys2/wiki/Porting/f87a222118b1008ebc166ad237f04edb759c8f4c#calling-conventions-stdcall-and-autotools
+
+ and
+
+ https://lists.gnu.org/archive/html/autoconf/2013-05/msg00085.html
+
+ and for a more complex workaround, we'd need to use AC_LINK_IFELSE like:
+
+ https://mailman.videolan.org/pipermail/vlc-devel/2015-March/101802.html
+
+ which would require we check each individually and provide function arguments for the test. I don't think that is worthwhile.
+
+ Fixes Issue: #688
+ Fix By: Brad House (@bradh352)
- [Brad House brought this change]
- Configuration option to limit number of UDP queries per ephemeral port (#549)
-
- Add a new ARES_OPT_UDP_MAX_QUERIES option with udp_max_queries parameter that can be passed to ares_init_options(). This value defaults to 0 (unlimited) to maintain existing compatibility, any positive number will cause new UDP ephemeral ports to be created once the threshold is reached, we'll call these 'connections' even though its technically wrong for UDP.
+ Do not sanity check RR Name vs Question (#685)
- Implementation Details:
- * Each server entry in a channel now has a linked-list of connections/ports for udp and tcp. The first connection in the list is the one most likely to be eligible to accept new queries.
- * Queries are now tracked by connection rather than by server.
- * Every time a query is detached from a connection, the connection that it was attached to will be checked to see if it needs to be cleaned up.
- * Insertion, lookup, and searching for connections has been implemented as O(1) complexity so the number of connections will not impact performance.
- * Remove is_broken from the server, it appears it would be set and immediately unset, so must have been invalidated via a prior patch. A future patch should probably track consecutive server errors and de-prioritize such servers. The code right now will always try servers in the order of configuration, so a bad server in the list will always be tried and may rely on timeout logic to try the next.
- * Various other cleanups to remove code duplication and for clarification.
+ It appears as though we should never sanity check the RR name vs the question name as some DNS servers may return results for alias records.
- Fixes Bug: #444
+ Fixes Bug: #683
Fix By: Brad House (@bradh352)
- [Brad House brought this change]
- its not 1991 anymore, lower default timeout and retry count (#542)
+ no reason to include sys/random.h all the time (#684)
- A lot of time has passed since the original timeouts and retry counts were chosen. We have on and off issues reported due to this. Even on geostationary satellite links, latency is worst case around 1.5s. This PR changes the per-server timeout to 2s and the retry count lowered from 4 to 3.
+ External integrations don't need sys/random.h in order to compile, remove the dependency. Try to fix building on legacy MacOS versions.
+ Fixes Issue: #682
Fix By: Brad House (@bradh352)
-- [Brad House brought this change]
+- [Gregor Jasny brought this change]
- Modernization: Implement base data-structures and replace usage (#540)
+ cmake: improve some include related code (#680)
- c-ares currently lacks modern data structures that can make coding easier and more efficient. This PR implements a new linked list, skip list (sorted linked list), and hashtable implementation that are easy to use and hard to misuse. Though these implementations use more memory allocations than the prior implementation, the ability to more rapidly iterate on the codebase is a bigger win than any marginal performance difference (which is unlikely to be visible, modern systems are much more powerful than when c-ares was initially created).
+ * cmake: avoid warning about non-existing include dir
- The data structure implementation favors readability and audit-ability over performance, however using the algorithmically correct data type for the purpose should offset any perceived losses.
+ In the Debian build logs I noticed the following warning:
+ cc1: warning: /build/c-ares-1.25.0/test/include: No such file or directory [-Wmissing-include-dirs]
- The primary motivation for this PR is to facilitate future implementation for Issues #444, #135, #458, and possibly #301
+ This happened because ${CMAKE_INSTALL_INCLUDEDIR} had been added to
+ caresinternal. I believe it has been copied from the "real" lib
+ where it's used in the INSTALL_INTERFACE context. But because
+ caresinternal is never installed we don't need that include here.
- A couple additional notes:
+ * cmake: drop CARES_TOPLEVEL_DIR variable
- The ares_timeout() function is now O(1) complexity instead of O(n) due to the use of a skiplist.
- Some obscure bugs were uncovered which were actually being incorrectly validated in the test cases. These have been addressed in this PR but are not explicitly discussed.
- Fixed some dead code warnings in ares_rand for systems that don't need rc4
+ The CARES_TOPLEVEL_DIR variable is the same as the automatically
+ created PROJECT_SOURCE_DIR variable. Let's stick to the official
+ one. Also because it is already used at places where CARES_TOPLEVEL_DIR
+ is used as well.
- Fix By: Brad House (@bradh352)
+ Fix By: Gregor Jasny (@gjasny)
-- [Jérôme Duval brought this change]
+Brad House (5 Jan 2024)
+- test: fix outdated license headers
- fix missing prefix for CMake generated libcares.pc (#530)
-
- 'pkg-config grpc --cflags' complains with:
- Variable 'prefix' not defined in libcares.pc
-
- Fix By: Jérôme Duval (@korli)
+- RELEASE-NOTES -> RELEASE-NOTES.md
-bradh352 (11 Jul 2023)
-- windows get_DNS_Windows port fix for ipv6
+- update format slightly
-- windows get_DNS_Windows port is in network byte order
+- update release notes format
-- backoff to debian 11 due to coverage check failure
+Version 1.25.0 (2 Jan 2024)
-- extend on PR #534, windows should also honor a port
+GitHub (2 Jan 2024)
+- [Brad House brought this change]
-GitHub (11 Jul 2023)
+ 1.25.0 release prep (#676)
+
+Brad House (31 Dec 2023)
+- tests: replace google DNS with CloudFlare for reverse lookups as google's servers stopped responding properly
+
+- OSSFuzz: it assumes autotools builds a static library by default, which means the old autotools must have done that even though there were comments saying it wasn't. Disable static by default on Windows however since it can't build both simultaneously.
+
+- autotools: update logic for building tests to provide more feedback
+
+- set winver consistently across build systems
+
+GitHub (28 Dec 2023)
- [Brad House brought this change]
- Support configuration of DNS server ports (#534)
+ Autotools: rework to simplify and fix recent issues (#674)
- As per https://man.openbsd.org/OpenBSD-5.1/resolv.conf.5 we should
- support bracketed syntax for resolv.conf entries to contain an optional
- port number.
+ Completely rework the autotools build system, issues have cropped up due to the complexity and could cause issues on even semi-modern Linux systems (Ubuntu 20.04 for example).
- We also need to utilize this format for configuration of MacOS
- DNS servers as seen when using the Viscosity OpenVPN client, where
- it starts a private DNS server listening on localhost on a non-standard
- port.
+ Changes include:
+
+ Remove all curl/xc/cares m4 helper files, they go overboard on detections of functions and datatypes. Go back to more plain autoconf macros as they've come a long way over the years.
+ Use known systems and heuristics to determine datatypes for functions like send() and recv(), rather than the error prone detection which required thousands of permutations and might still get it wrong.
+ Remove unneeded configure arguments like --enable-debug or --enable-optimize, its more common for people to simply pass their own CFLAGS on the command line.
+ Only require CARES_STATICLIB definition on Windows static builds, its not necessary ever for other systems, even when hiding non-public symbols.
+ Remove some function and definition detections that were never used in c-ares
+ The test framework is now embedded into the toplevel configure system, there was no need to chain build the test system as it is never built externally to c-ares.
+ As a side-effect of the changes, a configure run completes in about 25% of the original time.
+
+ This has been tested on various Linux distributions (of varying age), FreeBSD, MacOS, Windows (via MSYS2 with Mingw), and Solaris10/11 (by @dfandrich), AIX 7.3 (by @dfandrich). It is not unlikely that this may have broken more esoteric or legacy systems, and we'll likely need to be ready to accept bug reports and patches, but it has removed over 10k lines of build system code. It is very likely any issues that crop up will add far fewer lines of code to fix such systems.
+ Fixes Bug: #670
Fix By: Brad House (@bradh352)
-Daniel Stenberg (9 Jun 2023)
-- provide SPDX identifiers and a REUSE CI job to verify
+Brad House (22 Dec 2023)
+- docs: host -> ip
- All files have their licence and copyright information clearly
- identifiable. If not in the file header, they are set separately in
- .reuse/dep5.
+ fix mismatched documentation stating host instead of ip
- All used license texts are provided in LICENSES/
+ Fix By: Brad House (@bradh352)
-GitHub (30 May 2023)
-- [Alexey A Tikhonov brought this change]
+GitHub (21 Dec 2023)
+- [Brad House brought this change]
- Remove unreachable code as reported by Coverity (#527)
+ Old MacOS SDKs require you include sys/socket.h before net/if.h (#673)
- Coverity reported some code as unreachable. A manual inspection confirmed the reports.
+ Old MacOS SDKs (like 10.8) require you include `sys/socket.h` before you include `net/if.h` as reported by MacPorts. Using a new SDK but with setting the macos target version does not have the same issue.
- Fix By: Alexey A Tikhonov (@alexey-tikhonov)
+ Fixes Issue: #672
+ Fix By: Brad House (@bradh352)
-- [Ben Noordhuis brought this change]
+- [Brad House brought this change]
- rand: add support for getrandom() (#526)
+ Autotools warning fixes (#671)
- glibc provides arc4random_buf() but musl does not and /dev/urandom is
- not always available.
+ * get rid of clashes with curl namespace
+ * remove warnings due to deprecated functionality
+ * reorder some macro calls to get rid of warnings due to being called in the wrong order
+
+ Fix By: Brad House (@bradh352)
-- [Tim Wojtulewicz brought this change]
+Brad House (19 Dec 2023)
+- clang-format
- Replace uses of sprintf with snprintf (#525)
+- ares_strsplit() rewrite as wrapper around ares__buf_split()
- sprintf isn't safe even if you think you are using it right. Switch to snprintf().
+ We want to limit as much as possible any hand written parsers.
+ ares__buf_split() uses the new memory-safe parsing routines. This
+ adds a couple of additional flags to remove duplicates which the
+ existing split code did.
- Fix By: Tim Wojtulewicz (@timwoj)
+ Fix By: Brad House (@bradh352)
-bradh352 (23 May 2023)
-- update version and release procedure
+- clang-format
-GitHub (22 May 2023)
-- [Douglas R. Reno brought this change]
+- sonarcloud: const
- INSTALL.md: Add Watcom instructions and update Windows documentation URLs (#524)
-
- This commit adds instructions on how to use the WATCOM compiler to build c-ares. This was just tested on c-ares-1.19.1 and works well.
+- Connection failure should increment server failure count first
- While going through the links for the C Runtime documentation for Windows systems, I discovered that all three of the KB articles that were linked are now nonexistent. This commit replaces KB94248 with the current replacement available on Microsoft's website, which also makes the other two KB articles obsolete.
+ In order to be sure a different server is chosen on the next query,
+ a read error should result in the failure count being updated
+ first before requeing the request to a different server.
- Fix By: Douglas R. Reno (@renodr)
+ Fix By: Brad House (@bradh352)
-Version 1.19.1 (22 May 2023)
+GitHub (18 Dec 2023)
+- [Brad House brought this change]
-bradh352 (22 May 2023)
-- Makefile.inc Windows requires tabs not spaces for nmake
+ ahost should use ares_getaddrinfo() these days (#669)
+
+ ahost wasn't printing both ipv4 and ipv6 addresses. This day and age, it really should.
+
+ This PR also adds the ability to specify the servers to use.
+
+ Fix By: Brad House (@bradh352)
-GitHub (22 May 2023)
-- [Daniel Stenberg brought this change]
+Brad House (17 Dec 2023)
+- Fix bad stub for ares__iface_ips_enumerate()
+
+ If the ability to enumerate interface ip addresses does not exist
+ on a system, the stub function contained the wrong prototype.
+
+ Fixes Bug: #668
+ Fix By: Brad House (@bradh352)
- ares_expand_name: fix compiler warnings (#522)
+GitHub (17 Dec 2023)
+- [Gregor Jasny brought this change]
+
+ Fix minor warnings and documentation typos (#666)
- Fix some compiler warnings (not introduced in this release)
+ Build warnings could be seen [here](https://buildd.debian.org/status/fetch.php?pkg=c-ares&arch=arm64&ver=1.24.0-1&stamp=1702826366&raw=0) [origin](https://buildd.debian.org/status/package.php?p=c-ares)
- Fix By: Daniel Stenberg (@bagder)
+ Fix By: Gregor Jasny (@gjasny)
-bradh352 (22 May 2023)
-- windows MSVC compiler fix on 32bit
+- [Brad House brought this change]
-- update security advisory links
+ CI: Add Alpine Linux and old Ubuntu (#667)
+
+ Alpine linux doesn't use glibc but instead musl c, so provides a good alternative test bed. We are also adding the oldest non-EOL ubuntu version so we can test against older linux variants to prevent surprises.
+
+ This patch also migrates more tests to use cmake and ninja in order to reduce overall build times as we seem to run out of credits on Cirrus-CI pretty quickly.
+
+ Fix By: Brad House (@bradh352)
-- minor CI issues fixes for imported inet_net_pton
+Brad House (17 Dec 2023)
+- fix support with older google test versions
-- ares_rand static analysis fixes from CI
+- getrandom() may require sys/random.h on some systems
+
+ There is a reported build issue where getrandom() is detected
+ but compile fails due to a missing prototype. This commit attempts
+ to resolve that issue.
+
+ Fixes Bug: #665
+ Fix By: Brad House (@bradh352)
-- windows build fix
+GitHub (17 Dec 2023)
+- [Martin Chang brought this change]
-- security release notes
+ Use SOCK_DNS extension on socket on OpenBSD (#659)
+
+ This patch added the `SOCK_DNS` flag when running on OpenBSD. Allowing a reduced set of `pledge(2)` promises. Before this patch. The "stdio rpath inet" promises must be used in order to resolve any records. After the patch inet can be replaced with dns which only allows communication on destination port 53, instead of on all ports.
+
+ Side note: I checked the OpenBSD kernel source code. Even though the socket document says the DNS port (typically 53)., The OpenBSD 7.4 kernel only allows 53.
+
+ Fix By: Martin Chang (@marty1885)
-GitHub (22 May 2023)
-- [Brad House brought this change]
+Brad House (17 Dec 2023)
+- ci: disable static for symbol hiding tests
- Merge pull request from GHSA-9g78-jv2r-p7vc
+- ci: add test case for building with hidden symbol visibility
-- [Brad House brought this change]
-
- Merge pull request from GHSA-x6mf-cxr9-8q6v
+- fix test building with symbol hiding
- * Merged latest OpenBSD changes for inet_net_pton_ipv6() into c-ares.
- * Always use our own IP conversion functions now, do not delegate to OS
- so we can have consistency in testing and fuzzing.
- * Removed bogus test cases that never should have passed.
- * Add new test case for crash bug found.
+ New test cases depend on internal symbols for calculating timeouts.
+ Disable those test features if symbol hiding is enabled.
+ Fixes Bug: #664
Fix By: Brad House (@bradh352)
+Version 1.24.0 (16 Dec 2023)
+
+GitHub (16 Dec 2023)
- [Brad House brought this change]
- Merge pull request from GHSA-8r8p-23f3-64c2
-
- * segment random number generation into own file
+ ares_cancel() could trigger callback with wrong response code (#663)
- * abstract random code to make it more modular so we can have multiple backends
-
- * rand: add support for arc4random_buf() and also direct CARES_RANDOM_FILE reading
+ When doing ares_gethostbyname() or ares_getaddrinfo() with AF_UNSPEC, if ares_cancel() was called after one address class was returned but before the other address class, it would return ARES_SUCCESS rather than ARES_ECANCELLED.
- * autotools: fix detection of arc4random_buf
+ Test case has been added for this specific condition.
- * rework initial rc4 seed for PRNG as last fallback
+ Fixes Bug: #662
+ Fix By: Brad House (@bradh352)
+
+- [Brad House brought this change]
+
+ rand: allow fallback from OS (#661)
- * rc4: more proper implementation, simplified for clarity
+ getrandom() can fail with ENOSYS if the libc supports the function but the kernel does not.
- * clarifications
+ Fixes Bug: #660
+ Fix By: Brad House (@bradh352)
-bradh352 (20 May 2023)
-- add public release note information
+- [Brad House brought this change]
-- bump version to 1.19.1
+ 1.24.0 release prep (#657)
-GitHub (6 May 2023)
-- [Gregor Jasny brought this change]
+Brad House (11 Dec 2023)
+- reference alternative to ares_getsock() in docs
- test: fix warning about uninitialized memory (#515)
-
- fix warning in tests
-
- Fix By: Gregor Jasny (@gjasny)
+- tag some functions as deprecated in docs
-- [lifenjoiner brought this change]
+- Coverity: fix allocation size as reported in new code
- Turn off IPV6_V6ONLY on Windows if it is supported (#520)
-
- Turn off IPV6_V6ONLY on Windows if it is supported, support for IPv4-mapped IPv6 addresses.
-
- IPV6_V6ONLY refs:
- https://en.wikipedia.org/wiki/IPv6#IPv4-mapped_IPv6_addresses
- https://github.com/golang/go/blob/master/src/net/ipsock_posix.go
- https://en.wikipedia.org/wiki/Unix-like
- off:
- https://www.kernel.org/doc/html/latest/networking/ip-sysctl.html#proc-sys-net-ipv6-variables
- https://man.netbsd.org/inet6.4
- https://man.freebsd.org/cgi/man.cgi?query=inet6
- https://github.com/apple-oss-distributions/xnu/blob/main/bsd/man/man4/inet6.4
- on:
- https://learn.microsoft.com/en-us/windows/win32/winsock/ipproto-ipv6-socket-options
- acts like off, but returns 1 and dummy setting:
- https://man.dragonflybsd.org/?command=inet6
- https://man.dragonflybsd.org/?command=ip6
- unsupported and read-only returns 1:
- https://man.openbsd.org/inet6.4
-
- default value refs:
- https://datatracker.ietf.org/doc/html/rfc3493#section-5.3
- https://www.kernel.org/doc/html/latest/networking/ip-sysctl.html#proc-sys-net-ipv6-variables
+- remove dead code: ares_iphlpapi.h
+- remove dead code: bitncmp
+
+GitHub (9 Dec 2023)
- [Brad House brought this change]
- Merge pull request from GHSA-54xr-f67r-4pc4
+ Use external GoogleTest instead of bundling it (#655)
- * CARES_RANDOM_FILE should always default to /dev/urandom
+ GoogleTest should be unbundled. Google changed their guidance a few years back and modern versions of google test cannot build the bundling code file.
- During cross-compilation, CARES_RANDOM_FILE may not be able to be appropriately
- detected, therefore we should always set it to /dev/urandom and allow the
- entity requesting compilation override the value. The code does appropriately
- fall back if CARES_RANDOM_FILE cannot be opened.
+ This PR also updates to use C++14 as is required by modern GoogleTest versions.
- * use set not option
+ Fixes Bug: #506
+ Fix By: Brad House (@bradh352)
-bradh352 (18 Mar 2023)
-- ares_getaddrinfo using service of "0" should be allowed
+Brad House (8 Dec 2023)
+- use IF_NAMESIZE instead of IFNAMSIZ to avoid warning
+
+- remove redundant cast
+
+- clang-format and fix one warning
+
+GitHub (8 Dec 2023)
+- [Brad House brought this change]
+
+ Clean up some Windows-only warnings (#654)
- As per #517 glibc allows a service/servname of "0" to be treated the
- same as if NULL was provided. Also, add a sanity check to ensure
- the port number is in range instead of a blind cast.
+ Windows was emitting some warnings due to datatype differences.
- Fixes: #517
Fix By: Brad House (@bradh352)
-GitHub (10 Feb 2023)
-- [Nikolaos Chatzikonstantinou brought this change]
+- [Brad House brought this change]
- fix memory leak in ares_send (#511)
+ Rewrite sortlist hand parser for memory safety and bugs (#653)
- When the condition channel->nservers < 1 holds, the function returns
- prematurely, without deallocating query->tcpbuf. We rearrange the
- check to be done prior to the allocations, avoiding the memory
- leak. In this way, we also avoid unnecessary allocations if
- channel->nservers < 1 holds.
+ The parser for the sortlist has been rewritten to use the ares__buf_*() functions. This also resolves some known bugs in accepting invalid sortlist entries which should have caused parse failures.
- Fix By: Nikolaos Chatzikonstantinou (@createyourpersonalaccount)
+ Fixes Bug: #501
+ Fix By: Brad House (@bradh352)
-- [Nikolaos Chatzikonstantinou brought this change]
+Brad House (8 Dec 2023)
+- enhance timeout test case to make sure it will re-use a previously downed server
- change comment style to old-style (#513)
-
- Following the README.md guidelines,
+- enhance timeout test case
+
+- SonarCloud: make const
+
+GitHub (7 Dec 2023)
+- [Brad House brought this change]
+
+ increment failures on timeout (#651)
- "Comments must be written in the old-style"
+ As of c-ares 1.22.0, server timeouts were erroneously not incrementing server failures meaning the server in use wouldn't rotate. There was apparently never a test case for this condition.
- the comment is changed to the old style.
+ This PR fixes the bug and adds a test case to ensure it behaves properly.
- Fix By: Nikolaos Chatzikonstantinou (@createyourpersonalaccount)
+ Fixes Bug: #650
+ Fix By: Brad House (@bradh352)
-- [Nikolaos Chatzikonstantinou brought this change]
+- [Brad House brought this change]
- use strncasecmp in ares__strsplit (#512)
+ Windows UBSAN tests (#649)
- strncasecmp on platforms that don't already have it is already #define'd to a private implementation. There is no need to have OS-specific logic. Also removes ares__strsplit.h as a header as ares_private.h already includes it.
+ Fix UBSAN error, and enable UBSAN testing in AppVeyor.
- Fix By: Nikolaos Chatzikonstantinou (@createyourpersonalaccount)
+ Fixes Bug #648
+ Fix By: Gisle Vanem (@gvanem)
-- [Yijie Ma brought this change]
+- [Brad House brought this change]
- Fix a typo in ares_init_options.3 (#510)
+ Support ipv6 link-local servers and %iface syntax (#646)
- that -> than
+ Some environments may send router advertisements on a link setting their link-local (fe80::/10) address as a valid DNS server to the remote system. This will cause a DNS entry to be created like `fe80::1%iface`, since all link-local network interfaces are technically part of the same /10 subnet, it must be told what interface to send packets through explicitly if there are multiple physical interfaces.
- Fix By: Yijie Ma (@yijiem)
-
-- [Douglas R. Reno brought this change]
-
- Watcom Portability Improvements (#509)
+ This PR adds support for the %iface modifier when setting DNS servers via `/etc/resolv.conf` as well as via `ares_set_servers_csv()`.
- - Modify the Watcom Makefile for the source code reorganization (#352)
- - Add *.map files into .gitignore
- - Fix build errors with Watcom's builtin Windows SDK (which is rather
- outdated). It's smart enough to understand Windows Vista, but doesn't
- have PMIB_UNICASTIPADDRESS_TABLE or MIB_IPFORWARD_ROW2.
+ For MacOS and iOS it is assumed that libresolve will set the `sin6_scope_id` and should be supported, but my test systems don't seem to read the Router Advertisement for RDNSS link-local. Specifying the link-local dns server on MacOS via adig has been tested and confirmed working.
- It may be possible to use a different Windows SDK with the Watcom
- compiler, such as the most recent Windows 10 SDK. Alternatively the SDK
- in OpenWatcom 2.0 (which is in development) should fix this.
+ For Windows, this is similar to MacOS in that the system doesn't seem to honor the RDNSS RA, but specifying manually has been tested to work.
- I have no problems testing this Makefile prior to releases, just give me
- a ping.
+ At this point, Android support does not exist.
- Tested with Windows Vista, Windows 7, and Windows 10 using 'adig',
- 'acountry', and 'ahost'. This also seems to work on Windows XP, though
- this is likely due to the compiler in use.
+ Fixes Bug #462
+ Supersedes PR #463
- Fix By: Douglas R. Reno (@renodr)
- Fixes Bug: #352
+ Fix By: Brad House (@bradh352) and Serhii Purik (@sergvpurik)
-- [Jay Freeman (saurik) brought this change]
+Brad House (4 Dec 2023)
+- silence openwatcom warning due to qcache_max_ttl being unsigned
- ignore aminclude_static.am, as generated by AX_AM_MACROS_STATIC (#508)
+- ares__round_up_pow2() work around bogus warning
- Fix By: Jay Freeman (@saurik)
+ On 32bit systems, a codeblock that would intentionally never
+ be executed was emitting a warning. Rework the code to
+ prevent the warning. More code, no behavior difference, but
+ keeps people from complaining about the warning...
+
+ Fixes Bug: #645
+ Fix By: Brad House (@bradh352)
-- [Jay Freeman (saurik) brought this change]
+- try to move AC_USE_SYSTEM_EXTENSIONS
- sync ax_pthread.m4 with upstream (#507)
+- Enable system extensions
- The version in the repository is many years old so this PR simply pulls in the latest
- available revision from:
- http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=tree;f=m4
+ Certain defines are needed on some systems to enable functionality like
+ pthread recursive mutexes.
- Fix By: Jay Freeman (@saurik)
-
-- [Chilledheart brought this change]
+ Fixes #644
+ Fix By: Brad House (@bradh352)
- Windows: Invalid stack variable out of scope for HOSTS file path (#502)
+- ares_init_options() with invalid options values should unset the option
- In some conditions Windows might try to use a stack address that has gone out of scope when determining where to read the hosts data from for file lookups.
+ Apparently nodejs is relying on the above behavior for legacy reasons. Add
+ sanity checks to the various optmask parameters where it makes sense.
- Fix By: @Chilledheart
+ See https://github.com/nodejs/node/pull/50800
+
+ Fix By: Brad House (@bradh352)
+- SonarCloud: silence bogus reported error
+
+- clang-format
+
+GitHub (2 Dec 2023)
- [Brad House brought this change]
- sync ax_cxx_compile_stdcxx_11.m4 with upstream (#505)
+ Nameserver parsing: replace another hand-written parser (#643)
- It was reported that ax_cxx_compile_stdcxx_11.m4 was not compatible with uclibc.
- The version in the repository is many years old so this PR simply pulls in the latest
- available revision from:
- http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=tree;f=m4
+ This replaces the nameserver parsing code with code that use ares__buf_*() in the name of memory safety.
- Fixes Bug: #504
Fix By: Brad House (@bradh352)
-Version 1.19.0 (18 Jan 2023)
+Version 1.23.0 (28 Nov 2023)
-bradh352 (18 Jan 2023)
-- Prep for 1.19.0 release
+GitHub (28 Nov 2023)
+- [Brad House brought this change]
-- Fix inverted logic in 25523e2
+ 1.23.0 release prep (#641)
+
+Brad House (28 Nov 2023)
+- add missing manpage to distribution list
+
+- clang-format
+
+- remove a simply
+
+- fix doc typo
+
+- ares_init_options with ARES_OPT_UDP_PORT wrong byte order
- Fix .localhost. handling in prior commit
+ Regression from c-ares 1.19.1, ARES_OPT_UDP_PORT and ARES_OPT_TCP_PORT are
+ specified from the user in host-byte order, but there was a regression that
+ caused it to be read as if it was network byte order.
+ Fixes Bug: #640
+ Reported By: @Flow86
Fix By: Brad House (@bradh352)
-- RFC6761 localhost definition includes subdomains
-
- RFC6761 6.3 states:
- The domain "localhost." and any names falling within ".localhost."
+- fix ares_threadsafety() prototype
+
+GitHub (28 Nov 2023)
+- [Brad House brought this change]
+
+ Basic Thread Safety (#636)
- We were only honoring "localhost".
+ c-ares does not have any concept of thread-safety. It has always been 100% up to the implementor to ensure they never call c-ares from more than one thread at a time. This patch adds basic thread-safety support, which can be disabled at compile time if not desired. It uses a single recursive mutex per channel, which should be extremely quick when uncontested so overhead should be minimal.
- Fixes: #477
- Fix By: Brad House (@bradh352)
-
-- docs: ARES_OPT_UDP_PORT and ARES_OPT_TCP_PORT docs wrong byte order
+ Fixes Bug: #610
- As per #487, documentation states the port should be in network byte
- order, but we can see from the test cases using MockServers on
- different ports that this is not the case, it is definitely in host
- byte order.
+ Also sets the stage to implement #611
Fix By: Brad House (@bradh352)
-GitHub (18 Jan 2023)
-- [hopper-vul brought this change]
+- [petrvh brought this change]
- Add str len check in config_sortlist to avoid stack overflow (#497)
-
- In ares_set_sortlist, it calls config_sortlist(..., sortstr) to parse
- the input str and initialize a sortlist configuration.
+ ares_getaddrinfo(): do not use search domains if ARES_FLAG_NOSEARCH is set (#638)
- However, ares_set_sortlist has not any checks about the validity of the input str.
- It is very easy to create an arbitrary length stack overflow with the unchecked
- `memcpy(ipbuf, str, q-str);` and `memcpy(ipbufpfx, str, q-str);`
- statements in the config_sortlist call, which could potentially cause severe
- security impact in practical programs.
+ c-ares init options defines a flag ARES_FLAG_NOSEARCH that is supposed to prevent search using configured domain suffixes, however when using ares_getaddrinfo() the flag was ignored and domain suffixes were used anyway.
- This commit add necessary check for `ipbuf` and `ipbufpfx` which avoid the
- potential stack overflows.
+ Configuring zero domains to search also does not work (if ndomains == 0 default domain search list is loaded regardless of the flag ARES_OPT_DOMAINS being set).
- fixes #496
+ This change adds a check for the ARES_FLAG_NOSEARCH in as_is_only() function that is used by ares_getaddrinfo() to decide if to try to query next possible name ( next_dns_lookup() )
- Fix By: @hopper-vul
+ Fix By: @petrvh
-bradh352 (18 Jan 2023)
-- Fix build due to str-split sed gone wrong
+Brad House (25 Nov 2023)
+- Fix MacOS version test
+
+ It appears that the Issue #454 wasn't really fixed for some reason. This commit should fix the detection.
Fix By: Brad House (@bradh352)
-- cirrus-ci: switch to scan-build-py for MacOS
-
- MacOS seems to work better with scan-build-py
+Daniel Stenberg (24 Nov 2023)
+- CI: codespell
- Fix By: Brad House (@bradh352)
+ Closes #635
-- ares_strsplit* -> ares__strsplit* to comply with internal function naming
+GitHub (24 Nov 2023)
+- [Christian Clauss brought this change]
+
+ Fix typos discovered by codespell (#634)
- Inspired by #495, but was missing test cases and would failed to build.
+ % `codespell --ignore-words-list="aas,aci,acter,atleast,contentss,firey,fo,sais,seh,statics"`
+ * https://pypi.org/project/codespell
- Fix By: Brad House (@bradh352), Daniel Stenberg (@bagder)
+ Fix By: Christian Clauss (@cclauss)
-- Cirrus-CI: MacOS Homebrew has changed from /usr/local/opt to /opt/homebrew
+Brad House (22 Nov 2023)
+- environment is meant as an override for sysconfig
+
+GitHub (22 Nov 2023)
+- [Ignat brought this change]
+
+ Support attempts and timeout options from resolv.conf (#632)
- Fix paths for homebrew.
+ c-ares parses only antique version of options for timeout and number of retries from resolv.conf (`retrans` and `retry` are missing in modern documentation https://man7.org/linux/man-pages/man5/resolv.conf.5.html).
- Fix By: Brad House (@bradh352)
+ I add support of `attempts` and `timeout` options
+
+ Fix By: Ignat (@Kontakter)
-- cirrus-ci: iOS build needs to use ARM MacOS image
+- [Brad House brought this change]
+
+ more precise timeout calculation (#633)
- CirrusCI removed Intel-based MacOS images. Need to switch
- iOS builds to use new ARM images as well.
+ The timeout calculation was occurring with millisecond precision, but on some systems, there is microsecond precision which could mean we'd tell a user a timeout time prior to the actual timeout.
+ Fixes Bug: #631
Fix By: Brad House (@bradh352)
-- cirrus-ci: new MacOS image
+- [Christian Clauss brought this change]
+
+ INSTALL.md: Fix typo (#630)
- Cirrus-CI has recently EOL'd Intel MacOS VMs, switch to the latest
- ARM-based image.
+ Fix By: Christian Clauss (@cclauss)
+
+Brad House (19 Nov 2023)
+- SonarCloud: fix minor codesmells
+
+- fix test case regression due to missing parens
+
+- now that warnings are enabled on test cases, clear a bunch of warnings
+
+- CMake: CXXFLAGS environment wasn't being read because C++ compiler was enabled after settings warnings.
+
+- fix additional windows test warnings
+
+- cleanup some Windows warnings in test
+
+- clang-format
+
+GitHub (19 Nov 2023)
+- [Brad House brought this change]
+
+ Fix Windows UWP (Store) building and add to CI/CD (#627)
- Fix By: Brad House (@bradh352)
+ When building for UWP (WindowsStore), additional headers are needed and some functions are not available. This also adds AppVeyor CI/CD support to catch these issues in the future.
+
+ Fix By: Deal (@halx99) and Brad House (@bradh352)
-- acountry was passing stack variable to callback
+Brad House (19 Nov 2023)
+- ares_set_servers_*() should allow an empty server list
- Recent ASAN versions picked up that acountry was passing stack
- variables to ares_gethostbyname() then leaving the stack context.
- We will now allocate a buffer for this.
+ For historic reasons, we have users depending on ares_set_servers_*()
+ to return ARES_SUCCESS when passing no servers and actually *clear*
+ the server list. It appears they do this for test cases to simulate
+ DNS unavailable or similar. Presumably they could achieve the same
+ effect in other ways (point to localhost on a port that isn't in use).
+ But it seems like this might be wide-spread enough to cause headaches
+ so we just will document and test for this behavior, clearly it hasn't
+ caused "issues" for anyone with the old behavior.
+
+ See: https://github.com/nodejs/node/pull/50800
Fix By: Brad House (@bradh352)
-GitHub (13 Dec 2022)
-- [Daniel Stenberg brought this change]
+GitHub (19 Nov 2023)
+- [Brad House brought this change]
- docs: reformat/cleanup man pages SYNOPSIS sections (#494)
+ Query Cache support (#625)
- To make them render "nicer" in both terminals and on the website.
+ This PR implements a query cache at the lowest possible level, the actual dns request and response messages. Only successful and `NXDOMAIN` responses are cached. The lowest TTL in the response message determines the cache validity period for the response, and is capped at the configuration value for `qcache_max_ttl`. For `NXDOMAIN` responses, the SOA record is evaluated.
- - Removes the bold
- - Removes .PP lines
- - Indents them more like proper code style
+ For a query to match the cache, the opcode, flags, and each question's class, type, and name are all evaluated. This is to prevent matching a cached entry for a subtly different query (such as if the RD flag is set on one request and not another).
- Fix By: Daniel Stenberg (@bagder)
-
-- [Nikolaos Chatzikonstantinou brought this change]
-
- bug fix: new ares_strsplit (#492)
-
- * add ares_strsplit unit test
-
- The test reveals a bug in the implementation of ares_strsplit when the
- make_set parameter is set to 1, as distinct domains are confused for
- equal:
+ For things like ares_getaddrinfo() or ares_search() that may spawn multiple queries, each individual message received is cached rather than the overarching response. This makes it possible for one query in the sequence to be purged from the cache while others still return cached results which means there is no chance of ever returning stale data.
- out = ares_strsplit("example.com, example.co", ", ", 1, &n);
-
- evaluates to n = 1 with out = { "example.com" }.
+ We have had a lot of user requests to return TTLs on all the various parsers like `ares_parse_caa_reply()`, and likely this is because they want to implement caching mechanisms of their own, thus this PR should solve those issues as well.
- * bugfix and cleanup of ares_strsplit
+ Due to the internal data structures we have these days, this PR is less than 500 lines of new code.
- The purpose of ares_strsplit in c-ares is to split a comma-delimited
- string of unique (up to letter case) domains. However, because the
- terminating NUL byte was not checked in the substrings when comparing
- for uniqueness, the function would sometimes drop domains it should
- not. For example,
+ Fixes #608
- ares_strsplit("example.com, example.co", ",")
+ Fix By: Brad House (@bradh352)
+
+Version 1.22.1 (17 Nov 2023)
+
+GitHub (17 Nov 2023)
+- [Brad House brought this change]
+
+ 1.22.1 release prep (#624)
+
+Brad House (17 Nov 2023)
+- ares__htable_strvp should be case-insensitive
+
+- optimize: large /etc/hosts files reading
- would only result in a single domain "example.com".
+ profiling found some hot paths that could be optimized to reduce
+ insert times into the cache.
- Aside from this bugfix, the following cleanup is performed:
+ Fix By: Brad House (@bradh352)
+
+- Fix /etc/hosts processing performance with all entries using same IP address
- 1. The tokenization now happens with the help of strcspn instead of the
- custom function is_delim.
- 2. The function list_contains has been inlined.
- 3. The interface of ares_strsplit has been simplified by removing the
- parameter make_set since in practice it was always 1.
- 4. There are fewer passes over the input string.
- 5. We resize the table using realloc() down to its minimum size.
- 6. The docstring of ares_strsplit is updated and also a couple typos
- are fixed.
+ Some users use blacklist files like https://github.com/StevenBlack/hosts which
+ can contain 200k+ host entries all pointing to 0.0.0.0. Due to the merge
+ logic in the new hosts processor, all those entries will be associated as
+ aliases for the same ip address.
- There occurs a single use of ares_strsplit and since the make_set
- parameter has been removed, the call in ares_init.c is modified
- accordingly. The unit test for ares_strsplit is also updated.
+ The first issue is that it attempts to check the status of all the hosts for
+ the merged entry, when it should only be checking the new hosts added to the
+ merged entry, so this caused exponential time as the entries got longer.
- Fix By: Nikolaos Chatzikonstantinou (@createyourpersonalaccount)
-
-bradh352 (23 Oct 2022)
-- CirrusCI: update freebsd image
+ The next issue is if searching for one of those hosts, it would append all
+ the matches as cnames/aliases, but there is zero use for 200k aliases
+ being appended to a lookup, so we are artificially capping this to 100.
- Old FreeBSD image for CirrusCI has issues with newer symbols, update to later one.
+ Bug report reference: https://bugs.gentoo.org/917400
Fix By: Brad House (@bradh352)
-GitHub (23 Oct 2022)
-- [Stephen Sachs brought this change]
+- new badges
- Fix Intel compiler deprecated options (#485)
-
- Options `-we ###` and `-wd ###` should not include a whitespace. They are also deprecated and `-diag-error` and `-diag-disable` are their replacements.
-
- Intel compiler 2021.6 is not able to be used in configure without the proposed patch.
-
- Fix By: Stephen Sachs (@stephenmsachs)
+- OpenWatcom: time_t is unsigned, change math using time_t to promote to a 64bit signed integer
-- [Jonathan Ringer brought this change]
+- fix more docs
- Allow for CMake to use absolute install paths (#486)
+GitHub (15 Nov 2023)
+- [Gregor Jasny brought this change]
+
+ Fix typos and man page whatis entry (#619)
- Generated libcares.pc could have bad paths when using absolute paths.
+ Those issues were detected by lintian.
- Fix By: Jonathan Ringer (@jonringer)
+ Fix By: Gregor Jasny (@gjasny)
-- [Thomas Dreibholz brought this change]
+- [Douglas R. Reno brought this change]
- Fix for issue #488: ensure that the number of iovec entries does not exceed system limits. (#489)
+ Fix building c-ares-1.22.0 and higher under Watcom. (#623)
- c-ares could try to exceed maximum number of iovec entries supported by system.
+ Update config-win32.h to define HAVE_STDINT_H when OpenWatcom is in use.
- Fix By: Thomas Dreibholz (@dreibh)
+ Fix By: Douglas R. Reno (@renodr)
-- [bsergean brought this change]
+Brad House (15 Nov 2023)
+- OpenWatcom: fix PR building
- Add include guards to ares_data.h (#491)
-
- All the other header files in the src/lib folder do have an include guard so it look like an overthought.
-
- Fix By: @bsergean
+- CI/CD: Add OpenWatcom
-- [Brad Spencer brought this change]
+- CI/CD: Add OpenWatcom
- Fix typo in docs for ares_process_fd (#490)
-
- A single letter was missing
-
- Fix By: Brad Spencer (@b-spencer)
+- CI/CD: Add OpenWatcom
-- [lifenjoiner brought this change]
+- CI/CD: Add OpenWatcom
- tools: refine help (#481)
-
- fix invalid help options and documentation typos
-
- Fix By: @lifenjoiner
+- CI/CD: Add OpenWatcom
-- [lifenjoiner brought this change]
+- CI/CD: Add OpenWatcom
- Git: ignore CMake temporary files (#480)
-
- exclude more files from git
-
- Fix By: @lifenjoiner
+- CI/CD: Add OpenWatcom
-- [lifenjoiner brought this change]
+- warnings: try to prevent warnings due to automatic integer promotion
- adig: fix `-T` option (#479)
-
- Helper was missing flag to enable TCP mode of operation.
-
- Fix By: @lifenjoiner
+- only push to coverity weekly or on explicit coverity_scan branch commits
-- [Frank brought this change]
+- try to cleanup bogus compiler warnings
- Add vcpkg installation instructions (#478)
-
- Update to include vcpkg installation instructions
-
- Fix By: @FrankXie05
+- try to cleanup bogus compiler warnings
-- [marc-groundctl brought this change]
+- additional test coverage
- Convert total timeout to per-query (#467)
-
- On Apple platforms, libresolv reports the total timeout in retrans, not the per-query time. This patch undoes that math to get the per-query time, which is what c-ares expects. This is not perfect because libresolv is inconsistent on whether the timeout is multiplied by retry or retry+1, but I don't see any way to distinguish these cases.
+- Coverity: omit tests
+
+- Coverity: more
+
+- Coverity: silence false positives
+
+Version 1.22.0 (14 Nov 2023)
+
+Brad House (14 Nov 2023)
+- fix workflow
+
+- try a different coverity workflow
+
+GitHub (14 Nov 2023)
+- [Brad House brought this change]
+
+ coverity workflow (#618)
+
+Brad House (14 Nov 2023)
+- typos
+
+- getaddrinfo ESERVICE
+
+GitHub (14 Nov 2023)
+- [Brad House brought this change]
+
+ Release 1.22.0 (#616)
+
+Brad House (13 Nov 2023)
+- SonarCloud: minor codesmells
+
+- clang-format
+
+- Extended RCODE in OPT RR PsuedoRecord should not be exposed directly, it should be presented as part of the normal rcode
+
+- Slight fixes for PR #615
- Fix By: Marc Aldorasi (@marc-groundctl)
+ 1. the maxtimeout must come at the end of the structure
+ 2. fix comment form to be C style
+ 3. fix timeplus randomness if statement
-- [marc-groundctl brought this change]
+GitHub (13 Nov 2023)
+- [Brad House brought this change]
- Don't include version info in the static library (#468)
+ Add DNS record manpages (#615)
- The static library should not contain version info, since it would be linked into an executable or dll with its own version info.
+ The new DNS record parser and writer needs manpages. This PR implements those.
- Fix By: @marc-groundctl
+ Fix By: Brad House (@bradh352)
-- [Ridge Kennedy brought this change]
+- [Ignat brought this change]
- Fix ares_getaddrinfo() numerical address fast path with AF_UNSPEC (#469)
+ Randomize retry penalties to prevent thundering herd type issues (#606)
- The conversion of numeric IPv4 addresses in fake_addrinfo() is broken when
- the family is AF_UNSPEC. The initial call to ares_inet_pton with AF_INET
- will succeed, but the subsequent call using AF_INET6 will fail. This results
- in the fake_addrinfo() fast path failing, and ares_getaddrinfo() making a
- query when none should be required.
+ The retry timeout values were using a fixed calculation which could cause multiple simultaneous queries to timeout and retry at the exact same time. If a DNS server is throttling requests, this could cause the issue to never self-resolve due to all requests recurring at the same instance again.
- Resolve this by only attempting the call to ares_inet_pton with AF_INET6
- if the initial call with AF_INET was unsuccessful.
+ This PR also creates a maximum timeout option to make sure the random value selected does not exceed this value.
- Fix By: Ridge Kennedy (@ridgek)
+ Fix By: Ignat (@Kontakter)
-- [Manish Mehra brought this change]
+Brad House (13 Nov 2023)
+- fix typos
- Configurable hosts path for file_lookup (#465)
-
- This changeset adds support for configurable hosts file
- ARES_OPT_HOSTS_FILE (similar to ARES_OPT_RESOLVCONF).
-
- Co-authored-by: Manish Mehra (@mmehra)
+- some simplification and better error handling
-bradh352 (27 Apr 2022)
-- CMake: Windows DLLs lack version information
+- SonarCloud: fix some minor codesmells
+
+GitHub (12 Nov 2023)
+- [Brad House brought this change]
+
+ Implement ares_reinit() to reload system configuration into existing channel (#614)
- The cares.rc was not included in the build for CMake. Conditionally
- add it when building for Windows.
+ This PR implements ares_reinit() to safely reload a channel's configuration even if there are existing queries. This function can be called when system configuration is detected to be changed, however since c-ares isn't thread aware, care must be taken to ensure no other c-ares calls are in progress at the time this function is called. Also, this function may update the open file descriptor list so care must also be taken to wake any event loops and reprocess the list of file descriptors.
+
+ Fixes Bug #301
Fix By: Brad House (@bradh352)
- Fixes Bug: #460
-GitHub (27 Apr 2022)
-- [Kai Pastor brought this change]
+Brad House (11 Nov 2023)
+- test case ensures tag for caa is not blank
- CMake: Guard target creation in exported config (#464)
+- 0-length strings are ok
+
+- SonarCloud: fix up codesmells
+
+GitHub (11 Nov 2023)
+- [Brad House brought this change]
+
+ rewrite adig using new helpers (#607)
- User projects may call 'find_package(c-ares)' multiple times (e.g.
- via dependencies), but targets must be created only once.
- Shared and static target must be treated independently.
+ adig previously performed manual parsing of the DNS records. Now it can focus strictly on formatting of output data for printing. It simply iterates across the parsed DNS packet and queries for the RRs, parameters for each RR, and the datatypes for each parameter. adig will now automatically pick up new RRs from the c-ares library due to the dynamic nature.
- Fix By: Kai Pastor (@dg0yt)
-
-bradh352 (27 Apr 2022)
-- Honor valid DNS result even if other class returned an error
+ The adig format also now more closely resembles that of BIND's `dig` output.
- When using ares_getaddrinfo() with PF_UNSPEC, if a DNS server returned
- good data on an A record, followed by bad data on an AAAA record, the
- good record would be thrown away and an error returned.
+ A few more helpers needed to be added to the c-ares library that were missing. There ware a couple of minor bugs and enhancements also needed.
- If we got a good response from one of the two queries, regardless of
- the order returned, we should honor that.
+ Example:
+ ```
+ ./adig -t ANY www.google.com
+
+ ; <<>> c-ares DiG 1.21.0 <<>> www.google.com
+ ;; Got answer:
+ ;; ->>HEADER<<- opcode: QUERY, status: RCODE, id: 23913
+ ;; flags: qr rd ra; QUERY: 1, ANSWER: 11, AUTHORITY: 0, ADDITIONAL: 1
+
+ ;; OPT PSEUDOSECTION:
+ ; EDNS: version: 0, flags: 0; udp: 512
+ ;; QUESTION SECTION:
+ ;www.google.com. IN ANY
+
+ ;; ANSWER SECTION:
+ www.google.com. 162 IN A 142.251.107.99
+ www.google.com. 162 IN A 142.251.107.105
+ www.google.com. 162 IN A 142.251.107.103
+ www.google.com. 162 IN A 142.251.107.147
+ www.google.com. 162 IN A 142.251.107.104
+ www.google.com. 162 IN A 142.251.107.106
+ www.google.com. 162 IN AAAA 2607:f8b0:400c:c32::93
+ www.google.com. 162 IN AAAA 2607:f8b0:400c:c32::69
+ www.google.com. 162 IN AAAA 2607:f8b0:400c:c32::68
+ www.google.com. 162 IN AAAA 2607:f8b0:400c:c32::6a
+ www.google.com. 21462 IN HTTPS 1 . alpn="h2,h3"
+
+ ;; MSG SIZE rcvd: 276
+ ```
- Fix By: Dmitry Karpov (dkarpov@roku.com)
- Signed Off By: Brad House (@bradh352)
+ Fix By: Brad House (@bradh352)
-GitHub (2 Apr 2022)
-- [Sam James brought this change]
+- [Brad House brought this change]
- configure.ac: fix STDC_HEADERS typo (#459)
+ make dns parser/writer public (#604)
- There is no autoconf macro called STDC_HEADERS. AC_HEADER_STDC however does
- exist and it defines the STDC_HEADERS macro for use.
+ This PR makes the c-ares parser introduced in 1.21, and the new writer, along with associated helpers public. These helpers are contained in a new public header of `ares_dns_record.h` which should _**not**_ be included directly, instead simply including `ares.h` is sufficient. This will address #587, as well as #470.
- Not clear that STDC_HEADERS from its use in the repo is needed but
- would rather not meddle with it for now.
+ A follow-up PR will be made which will transform `adig` to use the new parsers and helpers.
- Fixes an annoying warning on `./configure`:
- ```
- /var/tmp/portage/net-dns/c-ares-1.18.1/work/c-ares-1.18.1/configure: 24546: STDC_HEADERS: not found
- ```
+ This PR does not currently add man pages for these public functions, that will be in a follow-up PR once the `adig` migration is done which may expose additional needed helpers.
- Signed-off-by: Sam James
+ The two aforementioned PRs will be done before the 1.22 release.
+
+ Fix By: Brad House (@bradh352)
-bradh352 (2 Mar 2022)
-- Asterisks should be allowed in host validation as CNAMEs may reference wildcard domains
+Brad House (9 Nov 2023)
+- options helpers: fix dereference to properly return params
+
+- clang-format
+
+GitHub (9 Nov 2023)
+- [Brad House brought this change]
+
+ Add SVCB and HTTPS RR (RFC 9460) (#603)
- CloudFlare appears to use this logic in CNAMEs as per
- https://github.com/nodejs/node/issues/42171
+ This PR adds parsing and writing support for SVCB and HTTPS RRs as defined in RFC 9460.
+
+ This should fix #566
- Fixes: #457
Fix By: Brad House (@bradh352)
-- Don't return on file lookup failure, set status
+- [Brad House brought this change]
+
+ OPT RR should support parsing key/value options (#602)
- When resolving a host via /etc/hosts, don't return with a predefined
- error as there may be other tries.
+ The OPT RR record has some seldom used options with a 16bit key and a binary value. The current parser and writer was not supporting this. This PR adds support. The same format is also used for SVCB/HTTPS records, so getting this in there is necessary to support that RR type.
+
+ Also, we split the Binary record format into BIN and BINP, where BINP is an indicator that the binary data is _likely_ printable and will guarantee a NULL terminator. This is helpful for those attempting to print RRs.
Fix By: Brad House (@bradh352)
-- 'localhost' special treatment enhancement
+Brad House (8 Nov 2023)
+- SonarCloud: fix some easy codesmells
+
+- clang-format
+
+- Mark a couple of parameters as const in the public API
+
+GitHub (7 Nov 2023)
+- [Brad House brought this change]
+
+ Add TLSA record support (#600)
- Since localhost is special-cased, any errors should be ignored when
- reading /etc/hosts as otherwise we could return an error if there
- were for instance an invalidly formatted /etc/hosts or if /etc/hosts
- had a permissions error while reading.
+ As per #470, c-ares is missing a parser for the TLSA record format (RFC 6698). This PR introduces that parser.
- This exact behavior appears to have been seen on OS/400 PASE
- environments which allows AIX binares to run.
+ Once the new parser interface becomes public and this PR is merged, then #470 can be closed.
Fix By: Brad House (@bradh352)
-- If chain building c-ares as part of another project, detect of res_servicename could fail (#451)
+Brad House (7 Nov 2023)
+- memory leak in test case
+
+- fix bad variable reference
+
+- DNS Write: fix name compression
+
+- SonarCloud: fix codesmells
+
+- Coverage: add tests for writing and parsing various record formats
+
+GitHub (7 Nov 2023)
+- [Brad House brought this change]
+
+ DNS Record Write (#598)
- If libresolv is already included with the build, c-ares wouldn't properly detect its use.
+ The `ares_dns_record_t` data structure created in the prior release is capable of holding a complete parsed DNS message and also provides all helpers in order to fill in the data structure. This PR adds write capabilities for this data structure to form a complete message and supports features such as DNS name compression as defined in RFC1035. Though this message writing capability goes further than c-ares internally needs, external users may find it useful ... and we may find it useful for test validation as well.
- May fix: #451
- Fix by: Brad House (@bradh352)
-
-- no analyze capability on ios
+ This also replaces the existing message writing code in `ares_create_query()`, as well rewriting the request message without EDNS in ares_process.c's `process_answer()`.
+
+ Fix By: Brad House (@bradh352)
-- attempt to use scan-build on ios
+Brad House (6 Nov 2023)
+- PATH_RESOLV_CONF: use empty string instead of NULL to prevent warnings
-- disable tests on ios
+- build fix
-- fix switch statement
+- const: fix some usecases
-- code coverage had gotten disabled
+- remove tests that depend on randomness
-- looks like shell expansion doesn't work with cirrus-ci, lets do it another way
+GitHub (5 Nov 2023)
+- [Brad House brought this change]
-- attempt to autobuild for iOS
+ Use EDNS by default (#596)
+
+ All DNS servers support EDNS, by using this by default, it will allow larger responses without the need to switch to TCP. If by chance a DNS server is hit that doesn't support EDNS, this is detected due to the lack of the OPT RR in the response and will be automatically retried without EDNS.
+
+ Fix By: Brad House (@bradh352)
-GitHub (8 Dec 2021)
- [Brad House brought this change]
- Windows: rework/simplify initialization code, drop long EOL systems (#445)
+ `ares_channel` -> `ares_channel_t *`: don't bury the pointer (#595)
- There was a lot of windows initialization code specific to the era that predates Windows Vista such as reading DNS configuration from the registry, and dynamically loading libraries to get access to functions that didn't exist in XP or earlier releases.
+ `ares_channel` is defined as `typedef struct ares_channeldata *ares_channel;`. The problem with this, is it embeds the pointer into the typedef, which means an `ares_channel` can never be declared as `const` as if you write `const ares_channel channel`, that expands to `struct ares_channeldata * const ares_channel` and not `const struct ares_channeldata *channel`.
- Vista was released in January 2007, and was EOL'd in 2017, and support for Vista is still maintained with this patch set.
+ We will now typedef `ares_channel_t` as `typedef struct ares_channeldata ares_channel_t;`, so if you write `const ares_channel_t *channel`, it properly expands to `const struct ares_channeldata *channel`.
- XP was EOL'd in Apr 8 2014.
+ We are maintaining the old typedef for API compatibility with existing integrations, and due to typedef expansion this should not even cause any compiler warnings for existing code. There are no ABI implications with this change. I could be convinced to keep existing public functions as `ares_channel` if a sufficient argument exists, but internally we really need make this change for modern best practices.
- I believe the last OS based on something earlier than Vista was POSReady 2009, as it was XP based for some reason, and that was EOL'd in January 2019. Considering any POS system falls under the PCI-DSS rules, they aren't allow to run POSReady 2009 any more so there is no reason to try to continue supporting such systems.
+ This change will allow us to internally use `const ares_channel_t *` where appropriate. Whether or not we decide to change any public interfaces to use `const` may require further discussion on if there might be ABI implications (I don't think so, but I'm also not 100% sure what a compiler internally does with `const` when emitting machine code ... I think more likely ABI implications would occur going the opposite direction).
- We have also targeted with our build system Vista support for the last few years, and while developers could change the target, we haven't had any reports that they have.
-
-bradh352 (9 Nov 2021)
-- Fix memory leak in reading /etc/hosts
-
- When an /etc/hosts lookup is performed, but fails with ENOTFOUND, and
- a valid RFC6761 Section 6.3 fallback is performed, it could overwrite
- variables that were already set and therefore leave the pointers
- dangling, never to be cleaned up.
-
- Clean up explicitly on ENOTFOUND when returning from the file parser.
+ FYI, This PR was done via a combination of sed and clang-format, the only manual code change was the addition of the new typedef, and a couple doc fixes :)
- Fixes: #439
Fix By: Brad House (@bradh352)
-GitHub (2 Nov 2021)
-- [Bobby Reynolds brought this change]
-
- Fix cross-compilation from Windows to Linux due to CPACK logic (#436)
-
- When determining value for CPACK_PACKAGE_ARCHITECTURE, prefer to use
- value from CMAKE_SYSTEM_PROCESSOR before falling back to uname output.
-
- Additionally, if building from a Windows host, emit a fatal error
- instead of attempting to call uname.
-
- Fix By: Bobby Reynolds (@reynoldsbd)
-
-bradh352 (1 Nov 2021)
-- fix coveralls link
-
-- coveralls needs token
-
-- coveralls appears to require git
-
-- fix a couple of coveralls vars
-
-- more coveralls fixes
-
-- add code coverage libs to LDADD instead of _LIBS
-
-- make verbose
-
-- try to fix code coverage building
-
-- need -y for install
+Brad House (4 Nov 2023)
+- win32 warnings look good, remove commented out block
-- try to fix asan/ubsan/lsan when built with clang. try to support code coverage properly.
+- more msvc warnings
-- try another path
+- fix
-- fix pip
+- docs: document setting servers can be done live
-- attempt to enable some other build types that travis supported
+- SonarCloud: more easy codesmells
-Version 1.18.1 (26 Oct 2021)
+- clang-format
-bradh352 (26 Oct 2021)
-- missed version
+- SonarCloud: fix up codesmells
-- 1.18.1 release prep
+GitHub (3 Nov 2023)
+- [Brad House brought this change]
-- ares_getaddrinfo() was returning the wrong size for ai_addrlen
+ Dynamic Server List (#594)
- ai_addrlen was erroneously returning 16 bytes instead of the
- sizeof(struct sockaddr_in6). This is a regression introduced
- in 1.18.0.
+ This PR makes the server list a dynamic sorted list of servers. The sort order is [ consecutive failures, system config index ]. The server list can be updated via ares_set_servers_*(). Any queries currently directed to servers that are no longer in the list will be automatically re-queued to a different server.
+
+ Also, any time a failure occurs on the server, the sort order of the servers will be updated so that the one with the fewest consecutive failures is chosen for the next query that goes on the wire, this way bad or non-responsive servers are automatically isolated.
+
+ Since the server list is now dynamic, the tracking of query failures per server has been removed and instead is relying on the server sort order as previously described. This simplifies the logic while also reducing the amount of memory required per query. However, because of this dynamic nature, it may not be easy to determine the server attempt order for enqueued queries if there have been any failures.
+
+ If using the ARES_OPT_ROTATE, this is now implemented to be a random selection of the configured servers. Since the server list is dynamic, its not possible to go to the next server as configuration could have changed between queries or attempts for the same query.
+
+ Finally, this PR moved some existing functions into new files to logically separate them.
+
+ This should address issues #550 and #440, while also setting the framework to implement #301. #301 needs a little more effort since it configures things other than the servers themselves (domains, search, sortlist, lookups), which need to make sure they can be safely updated.
- Reported by: James Brown
Fix By: Brad House (@bradh352)
-- Windows: autotools force linking to iphlpapi
+Brad House (1 Nov 2023)
+- no reason to run LSAN, ASAN already does it
-GitHub (26 Oct 2021)
-- [Gregor Jasny brought this change]
+GitHub (31 Oct 2023)
+- [Brad House brought this change]
- Fix typo detected by lintian (#434)
+ AppVeyor: update compiler versions, use Msys2, and Windows fixes (#593)
- typo in docs for ares_parse_uri_reply
+ AppVeyor was using Visual Studio 2015 along with old versions of MinGW. Update to the latest AppVeyor provides and also add an MSYS2 build test using MinGW which will use the bleeding edge version.
- Fix By: Gregor Jasny (@gjasny)
+ When researching #590 this also uncovered a bug in cmake not properly detecting if_indextoname() on windows. This has been corrected as well as the underlying issue reported in #590.
+
+ Fix By: Brad House (@bradh352) and Jonas Kvinge (@jonaski)
-Version 1.18.0 (25 Oct 2021)
+Brad House (31 Oct 2023)
+- Coverage: add some code misuse test cases
-bradh352 (25 Oct 2021)
-- replace Travis badge with Cirrus-CI badge
+- hosts file parsing should set success at end of loop
-- c-ares 1.18.0 release prep
+- fix windows localhost for ares_gethostbyname_file() when /etc/hosts doesn't have an entry
-GitHub (21 Oct 2021)
-- [Jérôme Duval brought this change]
+- SonarCloud: fix up codesmells (const, unneeded casts, reduce complexity)
- Haiku: port (#431)
+GitHub (30 Oct 2023)
+- [Brad House brought this change]
+
+ Replace hosts parser, add caching capabilities (#591)
+
+ HOSTS FILE PROCESSING OVERVIEW
+ ==============================
+ The hosts file on the system contains static entries to be processed locally
+ rather than querying the nameserver. Each row is an IP address followed by
+ a list of space delimited hostnames that match the ip address. This is used
+ for both forward and reverse lookups.
+
+ We are caching the entire parsed hosts file for performance reasons. Some
+ files may be quite sizable and as per Issue #458 can approach 1/2MB in size,
+ and the parse overhead on a rapid succession of queries can be quite large.
+ The entries are stored in forwards and backwards hashtables so we can get
+ O(1) performance on lookup. The file is cached until the file modification
+ timestamp changes (or 60s if there is no implemented stat() capability).
+
+ The hosts file processing is quite unique. It has to merge all related hosts
+ and ips into a single entry due to file formatting requirements. For
+ instance take the below:
+ ```
+ 127.0.0.1 localhost.localdomain localhost
+ ::1 localhost.localdomain localhost
+ 192.168.1.1 host.example.com host
+ 192.168.1.5 host.example.com host
+ 2620:1234::1 host.example.com host6.example.com host6 host
+ ```
+ This will yield 2 entries.
+ 1) ips: `127.0.0.1,::1`
+ hosts: `localhost.localdomain,localhost`
+ 2) ips: `192.168.1.1,192.168.1.5,2620:1234::1`
+ hosts: `host.example.com,host,host6.example.com,host6`
- Port for Haiku. Slight CMake changes, header changes, and resolv.conf/hosts paths specific to Haiku.
+ It could be argued that if searching for `192.168.1.1` that the `host6`
+ hostnames should not be returned, but this implementation will return them
+ since they are related (both ips have the fqdn of host.example.com). It is
+ unlikely this will matter in the real world.
- Port By: Jérôme Duval (@korli)
+
+ Fix By: Brad House (@bradh352)
-bradh352 (19 Oct 2021)
-- valgrind: fix reported invalid read
+- [Brad House brought this change]
-- make sure distcheck runs
+ cleanups: split functions out into different files, rename some to be more logical (#589)
-- detect oddities and skip test if necessary
+Brad House (27 Oct 2023)
+- fix comment
-- fix null ptr deref in strlen
+- recursive git attributes
-- bend over backwards for testing file access, something is weird on debian
+Version 1.21.0 (26 Oct 2023)
-- chmod(fn, 0) is failing on debian
+Brad House (26 Oct 2023)
+- SonarCloud: reduce reported complexity that exists for no reason.
-- maybe process needs to be called
+- SonarCloud: fix some #undef codesmells
-- split test output
+- formatting
-- clean up a couple of compiler warnings
+- document ARES_RR_* records
-- use helper function for addrinfo to simplify code
+- no reason to limit on truncation
-- INSTANTIATE_TEST_CASE_P -> INSTANTIATE_TEST_SUITE_P as new convention in googletest
+- linguist fixes
-- gmock: update from 1.8.0 to 1.11.0
+- don't use test cases to determine language of c-ares
-- Cirrus-CI: fix debian arm build
+- fix grammar
-- Cirrus-CI: more updates for proper testing
+- fix count
-- install proper packages for asan and analyze
+GitHub (25 Oct 2023)
+- [Brad House brought this change]
-- fix crash in tests
+ 1.21.0 release prep (#585)
-- try to disable container tests
+Brad House (25 Oct 2023)
+- fix build warning
-- need g++ for tests on debian
+GitHub (25 Oct 2023)
+- [Brad House brought this change]
-- try cirrus-ci again
+ SonarCloud: clean up more codesmells (#584)
-- whitespace
+Brad House (25 Oct 2023)
+- resolve reported memory leaks
-- start bringing up cirrus-ci
+- add test vector said to cause a memory leak
-- prep for adding new ci
+GitHub (25 Oct 2023)
+- [Brad House brought this change]
-- fix cut and paste error
+ sonarcloud: fix more codesmells (#583)
-GitHub (18 Oct 2021)
- [Brad House brought this change]
- RFC6761: special case "localhost" (#430)
-
- As per RFC6761 Section 6.3, "localhost" lookups need to be special cased to return loopback addresses, and not forward queries to recursive dns servers.
-
- We first look up via files (/etc/hosts or equivalent), and if that fails, we then attempt a system-specific address enumeration for loopback addresses (currently Windows-only), and finally fallback to ::1 and 127.0.0.1.
+ sonarcloud easy codesmells (#582)
Fix By: Brad House (@bradh352)
- Fixes Bug: #399
- [Brad House brought this change]
- Reimplement ares_gethostbyname() by wrapping ares_getaddrinfo() (#428)
+ Modernization: replace multiple hand-parsers with new memory-safe parser (#581)
- ares_gethostbyname() and ares_getaddrinfo() do a lot of similar things, however ares_getaddrinfo() has some desirable behaviors that should be imported into ares_gethostbyname(). For one, it sorts the address lists for the most likely to succeed based on the current system routes. Next, when AF_UNSPEC is specified, it properly handles search lists instead of first searching all of AF_INET6 then AF_INET, since ares_gethostbyname() searches in parallel. Therefore, this PR should also resolve the issues attempted in #94.
+ New DNS record parsing code. The old code was basically just some helper macros and functions for parsing an entire DNS message. The caller had to know the RFCs to use the parsers, except for some pre-made exceptions. The new parsing code parses the entire DNS message into an opaque data structure in a memory safe manner with various accessors for reading and manipulating the data.
- A few things this PR does:
+ The existing parser helpers for the various record types were reimplemented as wrappers around the new parser.
- 1. ares_parse_a_reply() and ares_parse_aaaa_reply() had very similar code to translate struct ares_addrinfo into a struct hostent as well as into struct ares_addrttl/ares_addr6ttl this has been split out into helper functions of ares__addrinfo2hostent() and ares__addrinfo2addrttl() to prevent this duplicative code.
+ The accessors allow easy iteration across the DNS record datastructure, and can be used to easily create dig-like output without needing to know anything about the various record types and formats as dynamic helpers are provided for enumeration of values and data types of those values.
- 2. ares_getaddrinfo() was apparently never honoring HOSTALIASES, and this was discovered once ares_gethostbyname() was turned into a wrapper, the affected test cases started failing.
+ At some point in the future, this new DNS record structure, accessors, and parser will be exposed publicly. This is not done at this point as we don't want to do that until the API is completely stable. Likely a write() function to output the DNS record back into an actual message buffer will be introduced with the stable API as well.
- 3. A slight API modification to save the query hostname into struct ares_addrinfo as the last element of name. Since this is the last element, and all user-level instances of struct ares_addrinfo are allocated internally by c-ares, this is not an ABI-breaking change nor would it impact any API compatibility. This was needed since struct hostent has an h_name element.
+ Some subtle bugs in the existing code were uncovered, some which had test cases which turned out to be bogus. Validation with third-party implementations (e.g. BIND9) were performed to validate such cases were indeed bugs.
- 4. Test Framework: MockServer tests via TCP would fail if more than 1 request was received at a time which is common when ares_getaddrinfo() queries for both A and AAAA records simultaneously. Infact, this was a long standing issue in which the ares_getaddrinfo() test were bypassing TCP alltogether. This has been corrected, the message is now processed in a loop.
+ Adding additional RR parsers such as for TLSA (#470) or SVCB/HTTPS (#566) are trivial now since focus can be put on only parsing the data within the RR, not the entire message. That said, as the new parser is not yet public, it isn't clear the best way to expose any new RRs (probably best to wait for the new parser to be public rather than hacking in another legacy function).
- 5. Some tests had to be updated for overall correctness as they were invalid but somehow passing prior to this change.
+ Some additional RRs that are part of DNS RFC1035 or EDNS RFC6891 that didn't have previously implemented parsers are now also implemented (e.g. HINFO, OPT). Any unrecognized RRs are encapsulated into a "RAW_RR" as binary data which can be inserted or extracted, but are otherwise not interpreted in any way.
- Change By: Brad House (@bradh352)
+ Fix By: Brad House (@bradh352)
-bradh352 (9 Oct 2021)
-- ares_getaddrinfo() missing sanity check to fix #426
+- [Gregor Jasny brought this change]
-- ares_getaddrinfo(): continue to next domain in search if query returns ARES_ENODATA
+ feat: use CMake to control symbol visibility (#574)
- Some DNS servers may behave badly and return a valid response with no data, in this
- case, continue on to the next search domain, but cache the result.
+ In contrast to #572 this solution does not need any extra headers. But it is also limited to GCC-like compilers.
+
+ Fix By: Gregor Jasny (@gjasny)
+
+- [Brad House brought this change]
+
+ remove ares_nowarn helpers #580
+
+ Now that the code internally is using proper datatypes, there is no longer a need for ares_nowarn helpers. Remove them.
- Fixes Bug: #426
Fix By: Brad House (@bradh352)
-- Allow '/' as a valid character for a returned name
+Brad House (16 Oct 2023)
+- clang-format: fix structure alignment
- As of c-ares 1.17.2, a CNAME an in-addr.arpa delegation broke due
- to not allowing '/'. This needs to be allowed to not break valid
- functionality.
+ It appears the structure alignment chosen just doesn't work right.
+ Switch to 'left', it appears to be mostly correct.
- Fixes Bug: #427
- Reported By: Adrian (@leftshift)
Fix By: Brad House (@bradh352)
-Daniel Stenberg (5 Oct 2021)
-- libcares.pc.in: update the URL
+GitHub (15 Oct 2023)
+- [Brad House brought this change]
-bradh352 (8 Sep 2021)
-- ares_expand_name should allow underscores (_) as SRV records legitimately use them
+ Reformat code using clang-format (#579)
- c-ares 1.17.2 introduced response validation to prevent a security issue, however
- it did not have (_) listed as a valid character for domain name responses which
- caused issues when a CNAME referenced a SRV record which contained underscores.
+ c-ares uses multiple code styles, standardize on one. Talking with @bagder he feels strongly about maintaining an 80 column limit, but feels less strongly about things I feel strongly about (like alignment).
- While RFC2181 section 11 does explicitly state not to do validation, that applies
- to servers not clients.
+ Can re-run the formatter on the codebase via:
+ ```
+ clang-format -i */*.c */*.h */*/*.c */*/*.h
+ ```
- Fixes: #424
Fix By: Brad House (@bradh352)
-Daniel Stenberg (7 Sep 2021)
-- domain: update to use c-ares.org
+Brad House (15 Oct 2023)
+- inet_ntop requires ares_private.h
+
+- SonarCloud: Fix additional code smells
- Closes #423
+ Fix By: Brad House (@bradh352)
-- mailing list: moved to lists.haxx.se
+- SonarCloud: Ignore codesmells c89 doesn't support
+
+ C89 doesn't support iterator declaration in for loop, kill warning.
+
+ Fix By: Brad House (@bradh352)
-GitHub (3 Sep 2021)
-- [Biswapriyo Nath brought this change]
+GitHub (15 Oct 2023)
+- [Brad House brought this change]
- CMake: Fix build in cygwin (#422)
+ set compiler standard to ISO C90/ANSI C89 (#577)
- As cygwin environment has both socket.h and winsock2.h headers check WIN32 not to include the later one here
+ SonarCloud is outputting some code smells for things that aren't possible for C89. Hopefully setting the code standard to C89/C90 properly will fix those bogus warnings.
- Fix By: Biswapriyo Nath (@Biswa96)
+ Fix By: Brad House (@bradh352)
-bradh352 (23 Aug 2021)
-- make building more verbose
+Brad House (15 Oct 2023)
+- fix new ares_strcpy to ensure null termination
-- add appveyor cmake/mingw static-only build
+- build fix
-GitHub (17 Aug 2021)
-- [Sinan Kaya brought this change]
+GitHub (15 Oct 2023)
+- [Brad House brought this change]
- CMake: lower case advapi32 for cross-building with mingw (#420)
+ SonarCloud: Fix up codesmells due to strlen(), strcpy(), and strncpy() (#576)
- When cross compiling with yocto's meta-mingw layer, getting a dependency
- error.
+ Create ares_strlen() and ares_strcpy() in order to resolve SonarCloud codesmells related to their use.
- This is caused by the fact that advapi32 is lower case in mingw builds.
+ ares_strlen() just becomes null-safe.
- Fix By: Sinan Kaya
+ ares_strcpy() is equivalent to strlcpy(), so unlike strncpy() it guarantees NULL termination.
+
+ Fix By: Brad House (@bradh352)
-bradh352 (17 Aug 2021)
-- autotools: add ax_check_gnu_make.m4
+Brad House (15 Oct 2023)
+- SonarCloud: try to appease it better
-- autotools: add ax_require_defined.m4
+- SonarCloud: Fix reported bugs
+
+ SonarCloud reported a few bugs, this commit should fix those reports.
+
+ Fix By: Brad House (@bradh352)
-- autotools: dont use newer AC_CHECK_INCLUDES_DEFAULT, don't quote AC_ERROR_MSG
+GitHub (15 Oct 2023)
+- [Brad House brought this change]
-- import more files needed by newer ax_code_coverage.m4
+ Fix internal datatype usage and warnings (#573)
+
+ PR #568 increased the warning levels and c-ares code emitted a bunch of warnings. This PR fixes those warnings and starts transitioning internal data types into more proper forms (e.g. data lengths should be size_t not int). It does, however, have to manually cast back to what the public API needs due to API and ABI compliance (we aren't looking to break integrations, just clean up internals).
+
+ Fix By: Brad House (@bradh352)
-- import more files needed by newer ax_code_coverage.m4
+Brad House (15 Oct 2023)
+- SonarCloud: exclude tests
-- work around autoreconf -fiv first call returning 'error: too many loops'
+- fix source directories
-- restore zz40-xc-ovr.m4
+GitHub (15 Oct 2023)
+- [Brad House brought this change]
-- autotools: processed configure.ac through autoupdate
+ Sonarcloud (#575)
-- autotools. update ax_code_coverage.m4 to latest. don't use deprecated AC_HELP_STRING
+- [Brad House brought this change]
-- pull out some old autotools cruft
+ Increase compiler warnings by default (#568)
+
+ c-ares was missing a couple of common compiler warnings during building that are widely recognized as a best practice. This PR makes no code changes, only build system changes to increase warning levels.
+
+ This PR does cause some new warnings to be emitted, a follow-up PR will address those.
+
+ Fix By: Brad House (@bradh352)
-GitHub (17 Aug 2021)
-- [Felix Yan brought this change]
+- [Brad House brought this change]
- Provide ares_nameser.h as a public interface (#417)
+ introduce ares_bool_t datatype (#570)
- NodeJS needs ares_nameser.h as a pubic header.
+ c-ares currently uses int for boolean, which can be confusing as there are some functions which return int but use '0' as the success condition. Some internal variable usage is similar. Lets try to identify the boolean use cases and split them out into their own data type of ares_bool_t. Since we're trying to keep C89 compatibility, we can't rely on stdbool.h or the _Bool C99 data type, so we'll define our own.
- Fixes: #415
- Fix By: Felix Yan (@felixonmars)
-
-- [Felix Yan brought this change]
+ Also, chose using an enum rather than say unsigned char or int because of the type safety benefits it provides. Compilers should warn if you try to pass, ARES_TRUE on to a ares_status_t enum (or similar) since they are different enums.
+
+ Fix By: Brad House (@bradh352)
- Fix building when latest ax_code_coverage.m4 is imported (#418)
+Brad House (12 Oct 2023)
+- Socket callbacks were passed SOCK_STREAM instead of SOCK_DGRAM on udp
- ax_code_coverage.m4 dropped the @CODE_COVERAGE_RULES@ macro, so we need to switch to the latest recommendation from the m4 file. This requires updates to Makefile.am.
+ A regression was introduced in 1.20.0 that would pass SOCK_STREAM on udp
+ connections due to code refactoring. If a client application validated this
+ data, it could cause issues as seen in gRPC.
- Fix By: Felix Yan (@felixonmars)
+ Fixes Issue: #571
+ Fix By: Brad House (@bradh352)
-bradh352 (12 Aug 2021)
-- bump version to match current release
+- Enhance test of ares_getsock()
+
+ In an attempt to see if ares_getsock() was broken as per #571, do
+ further sanity checks of the results of ares_getsock(). It seems
+ as though ares_getsock() is fine.
+
+ Fix By: Brad House (@bradh352)
-GitHub (12 Aug 2021)
-- [dhrumilrana brought this change]
+GitHub (10 Oct 2023)
+- [Brad House brought this change]
- z/OS minor update, add missing semicolon in ares_init.c (#414)
+ Tool: STAYOPEN flag could make tools not terminate (#569)
- Build fix for z/OS
+ If a flag is set to keep the connections to the DNS servers open even if there are no queries, the tools would not exit until the remote server closed the connection due to the user of ares_fds() to determine if there are any active queries. Instead, rely on ares_timeout() returning NULL if there are no active queries (technically this returns the value passed to max_tv in ares_timeout(), but in our use case, that is always NULL).
- Fix by: Dhrumil Rana (@dhrumilrana)
+ Fixes Issue: #452
+ Fix By: Brad House (@bradh352)
-- [Daniel Bevenius brought this change]
+- [Brad House brought this change]
- add build to .gitignore (#410)
+ ares_status_t enum for status codes (#567)
- This commit adds the build directory to be ignored by git.
+ The list of possible error codes in c-ares was a #define list. This not only doesn't provide for any sort of type safety but it also lacks clarification on what a function may return or what it takes, as an int could be an ares status, a boolean, or possibly even a length in the current code.
- The motivation for adding this to .gitignore as opposed to
- .git/info/exclude is that the CMake example in INSTALL.md uses build
- as the name of the directory to be used by CMake. This will cause
- git to report build as an untracked file.
+ We are not changing any public APIs as though the C standard states the underlying size and type of an enum is int, there are compiler attributes to override this as well as compiler flags like -fshort-enums. GCC in particular is known to expand an enum's width based on the data values (e.g., it can emit a 64bit integer enum).
- Fix By: Daniel Bevenius (@danbev)
-
-- [Martin Holeš brought this change]
+ All internal usages should be changed by this PR, but of course, there may be some I missed.
+
+ Fix By: Brad House (@bradh352)
- Add support for URI(Uniform Resource Identifier) records. (#411)
+Daniel Stenberg (9 Oct 2023)
+- docs: provide better man page references
- Add ares_parse_uri_reply() for parsing URI DNS replies.
+ When referring to another c-ares function use \fI function(3) \fP to let
+ the webpage rendering find and cross-link them appropriately.
- Fix By: Martin Holeš (@martin-256)
-
-Daniel Stenberg (10 Aug 2021)
-- ares_getaddrinfo.3: available since 1.16.0
+ SEE ALSO references should be ".BR name (3),", with a space before the
+ open parenthesis. This helps the manpage to HTML renderer.
+
+ Closes #565
-- README.md: use https:// links
+Version 1.20.1 (8 Oct 2023)
-Version 1.17.2 (24 Jul 2021)
+GitHub (8 Oct 2023)
+- [Daniel Stenberg brought this change]
-bradh352 (24 Jul 2021)
-- fix typo
+ ares-test: silence warning (#564)
+
+ warning: comparison of integer expressions of different signedness
+
+ Fix By: Daniel Stenberg (@bagder)
-- prep for 1.17.2 release
+Brad House (8 Oct 2023)
+- fix README.md
-GitHub (30 Jun 2021)
-- [jeanpierrecartal brought this change]
+GitHub (8 Oct 2023)
+- [Brad House brought this change]
- Replace strdup() with ares_strdup() (#408)
-
- strdup() is used in src/lib/ares_parse_a_reply.c and src/lib/ares_parse_aaaa_reply.c whereas allocated memory is freed using ares_free().
-
- Bug: 407
- Fix By: Jean-pierre Cartal (@jeanpierrecartal)
+ 1.20.1 release (#563)
- [Brad House brought this change]
- Validate hostnames in DNS responses and discard from malicious servers (#406)
-
- To prevent possible users having XSS issues due to intentionally malformed DNS replies, validate hostnames returned in responses and return EBADRESP if they are not valid.
+ fix reference to freed memory (#562)
- It is not clear what legitimate issues this may cause at this point.
+ Issue #561 shows free'd memory could be accessed in some error conditions.
- Bug Reported By: philipp.jeitner@sit.fraunhofer.de
+ Fixes Issue #561
Fix By: Brad House (@bradh352)
-bradh352 (11 Jun 2021)
-- ares_expand_name(): fix formatting and handling of root name response
-
- Fixes issue introduced in prior commit with formatting and handling
- of parsing a root name response which should not be escaped.
-
- Fix By: Brad House
+Brad House (8 Oct 2023)
+- reported build/test systems may timeout on intensive tests. reduce test case to still be relevant but to reduce false positive errors
-- ares_expand_name() should escape more characters
+GitHub (8 Oct 2023)
+- [Gregor Jasny brought this change]
+
+ Regression: Fix typo in fuzzcheck target name (#559)
- RFC1035 5.1 specifies some reserved characters and escaping sequences
- that are allowed to be specified. Expand the list of reserved characters
- and also escape non-printable characters using the \DDD format as
- specified in the RFC.
+ This seems to be a vim'esque typo introduced with c1b00c41.
- Bug Reported By: philipp.jeitner@sit.fraunhofer.de
- Fix By: Brad House (@bradh352)
+ Fix By: Gregor Jasny (@gjasny)
-GitHub (15 Apr 2021)
-- [HALX99 brought this change]
+Version 1.20.0 (6 Oct 2023)
- Fix can't get dns server on macos and ios (#401)
-
- If DNS configuration didn't include search domains on MacOS (or iOS) it would throw an error instead of ignoring.
-
- Fix By: @halx99
+Brad House (6 Oct 2023)
+- fix slist search off by 1
-- [catalinh-bd brought this change]
+GitHub (6 Oct 2023)
+- [Brad House brought this change]
- Bugfix/crash in ares sortaddrinfo (#400)
-
- The bug was generated because there was no check for the number
- of items in the list and invalid memory was accesed when the list
- was empty. There is a check for null after calling malloc but on
- some systems it always returns a valid address for size equals 0.
- Relates To: #392, 0903dcecabca283d0fa771632892dc7592b7a66d
-
- Fix By: @catalinh-bd
+ 1.20.0 release prep (#557)
-bradh352 (2 Mar 2021)
-- Null deref if ares_getaddrinfo() is terminated with ares_destroy()
-
- ares_freeaddrinfo() was not checking for a Null ptr during cleanup of
- an aborted query.
+- [Brad House brought this change]
+
+ ares__buf should return standard error codes. more helpers implemented. (#558)
- Once that was resolved it uncovered another possible issue with
- multiple simultaneous underlying queries being outstanding and
- possibly prematurely cleaning up the handle.
+ The purpose of this PR is to hopefully make the private API of this set of routines less likely to need to be changed in a future release. While this is not a public API, it could become harder in the future to change usage as it becomes more widely used within c-ares.
- Reported By: Michael Kourlas
Fix By: Brad House (@bradh352)
-GitHub (18 Feb 2021)
- [Brad House brought this change]
- CMake: RANDOM_FILE not defined #397
+ Update from 1989 MIT license text to modern MIT license text (#556)
- RANDOM_FILE was never defined by cmake, causing RC4 key generation to use the less secure rand() method.
+ ares (and thus c-ares) was originally licensed under the 1989 MIT license text:
+ https://fedoraproject.org/wiki/Licensing:MIT#Old_Style_(no_advertising_without_permission)
- Also, due to clashes with chain-building from other projects (e.g. curl) that may define RANDOM_FILE, this was renamed to CARES_RANDOM_FILE.
+ This change updates the license to the modern MIT license as recognized here:
+ https://opensource.org/license/mit/
- This is the proposed change for #396
+ care has been taken to ensure correct attributions remain for the authors contained within the copyright headers, and all authors with attributions in the headers have been contacted for approval regarding the change. Any authors which were not able to be contacted, the original copyright maintains, luckily that exists in only a single file `ares_parse_caa_reply.c` at this time.
+
+ Please see PR #556 for the documented approvals by each contributor.
Fix By: Brad House (@bradh352)
-- [Anton Danielsson brought this change]
+- [Brad House brought this change]
- CMake: fix Make install for iOS/MacOS (#395)
+ Test Harness: use ares_timeout() to calculate the value to pass to select() these days. (#555)
- INSTALL TARGETS were missing the BUNDLE DESTINATION
+ The test framework was using 100ms timeout passed to select(), and not using ares_timeout() to calculate the actual recommended value based on the queries in queue. Using ares_timeout() tests the functionality of ares_timeout() itself and will provide more responsive results.
- Fix By: Anton Danielsson (@anton-danielsson)
+ Fix By: Brad House (@bradh352)
-- [František Dvořák brought this change]
+- [Brad House brought this change]
- Fix build with autotools out of source tree (#394)
+ Fix for TCP back to back queries (#552)
- Add missing include directory, which fixes the build with autotools in separated build directory.
+ As per #266, TCP queries are basically broken. If we get a partial reply, things just don't work, but unlike UDP, TCP may get fragmented and we need to properly handle that.
- Fix By: František Dvořák (@valtri)
-
-bradh352 (15 Jan 2021)
-- fuzzing: HAVE_CONFIG_H may not be defined so cannot include ares_setup.h. Its not needed even though we include ares_nameser.h
-
-- remove redundant header checks
-
-- properly detect netinet/tcp.h on openbsd
-
-- more portability updates
-
-- renamed nameser.h to ares_nameser.h requires Makefile.inc update for distributed files
-
-- more portability updates
-
-- remove bad files
-
-- portability updates for test cases
-
-- Portability Updates for arpa/nameser.h (#388)
+ I've started creating a basic parser/buffer framework for c-ares for memory safety reasons, but it also helps for things like this where we shouldn't be manually tracking positions and fetching only a couple of bytes at a time from a socket. This parser/buffer will be expanded and used more in the future.
- There is too much inconsistency between platforms for arpa/nameser.h and arpa/nameser_compat.h for the way the current files are structured. Still load the respective system files but make our private nameser.h more forgiving.
+ This also resolves #206 by allowing NULL to be specified for some socket callbacks so they will auto-route to the built-in c-ares functions.
- Fixes: #388
+ Fixes: #206, #266
Fix By: Brad House (@bradh352)
-- ares_parse_ptr_reply() handle NULL for addr/addr_len. Fixes #392
-
- NodeJS passes NULL for addr and 0 for addrlen parameters to ares_parse_ptr_reply(). On systems where malloc(0) returned NULL, this would cause the function to return ARES_ENOMEM, but the cleanup wasn't handled properly and would crash.
+- [Brad House brought this change]
+
+ remove acountry from built tools as nerd.dk is gone (#554)
- This patche fixes that bug, and also hardens ares_free_hostent() to not leak memory during cleanup.
+ The acountry utility required a third party DNSBL service from nerd.dk in order to operate. That service has been offline for about a year and there is no other comparable service offering. We are keeping the code in the repository as an example, but no longer building it.
- Fixes: #392
+ Fixes: #537
Fix By: Brad House (@bradh352)
-- Define behavior of malloc(0)
-
- Some systems may return either NULL or a valid pointer on malloc(0). c-ares should never call malloc(0) so lets return NULL so we're more likely to find an issue if it were to occur.
-
-GitHub (24 Dec 2020)
-- [dhrumilrana brought this change]
+- [Brad House brought this change]
- z/OS: port (#390)
+ Don't requeue any queries for getaddrinfo() during destruction. (#553)
- Port c-ares to z/OS.
+ During ares_destroy(), any outstanding queries are terminated, however ares_getaddrinfo() had an ordering issue with status codes which in some circumstances could lead to a new query being enqueued rather than honoring the termination.
- Fix By: Dhrumil Rana (@dhrumilrana)
+ Fixes #532
+ Fix By: @Chilledheart and Brad House (@bradh352)
-- [vburdo brought this change]
+- [Brad House brought this change]
- Use unbuffered stdio for /dev/urandom to read only requested data (#391)
+ ares_getaddrinfo(): Fail faster on AF_UNSPEC if we've already received one address class (#551)
- Buffered fread() reads 4096 bytes which is completely unnecessary and potentially may cause problems.
- I discovered this on private linux configuration where custom /dev/urandom implementation has poor performance.
+ As per #541, when using AF_UNSPEC with ares_getaddrinfo() (and in turn with ares_gethostbynam()) if we receive a successful response for one address class, we should not allow the other address class to continue on with retries, just return the address class we have.
- Fix By: @vburdo
+ This will limit the overall query time to whatever timeout remains for the pending query for the other address class, it will not, however, terminate the other query as it may still prove to be successful (possibly coming in less than a millisecond later) and we'd want that result still. It just turns off additional error processing to get the result back quicker.
+
+ Fixes Bug: #541
+ Fix By: Brad House (@bradh352)
-- [Jay Freeman (saurik) brought this change]
+- [Sam Morris brought this change]
- This relative header #include needs to use quotes. (#386)
+ Avoid producing an ill-formed result when qualifying a name with the root domain (#546)
- Fix By: Jay Freeman (@saurik)
-
-bradh352 (23 Nov 2020)
-- Win32: Fix tools build with autotools static library
- When c-ares is being built as static on Win32, CARES_STATICLIB must
- be defined, but it wasn't being pulled in for the tools.
+ This prevents the result of qualifying "name" with "." being "name.." which is ill-formed.
- Fixes: #384
- Fix By: Brad House (@bradh352)
+ Fixes Bug: #545
+ Fix By: Sam Morris (@yrro)
-- Loosen requirements for static c-ares library when building tests
+- [Brad House brought this change]
+
+ Configuration option to limit number of UDP queries per ephemeral port (#549)
- It appears that when building tests, it would hardcode enabling building
- of the c-ares static library. This was probably due to Windows limitations
- in symbol visibility.
+ Add a new ARES_OPT_UDP_MAX_QUERIES option with udp_max_queries parameter that can be passed to ares_init_options(). This value defaults to 0 (unlimited) to maintain existing compatibility, any positive number will cause new UDP ephemeral ports to be created once the threshold is reached, we'll call these 'connections' even though its technically wrong for UDP.
- This change will use the static library if it exists for tests, always.
- Otherwise, it will only forcibly enable static libraries for tests on
- Windows.
+ Implementation Details:
+ * Each server entry in a channel now has a linked-list of connections/ports for udp and tcp. The first connection in the list is the one most likely to be eligible to accept new queries.
+ * Queries are now tracked by connection rather than by server.
+ * Every time a query is detached from a connection, the connection that it was attached to will be checked to see if it needs to be cleaned up.
+ * Insertion, lookup, and searching for connections has been implemented as O(1) complexity so the number of connections will not impact performance.
+ * Remove is_broken from the server, it appears it would be set and immediately unset, so must have been invalidated via a prior patch. A future patch should probably track consecutive server errors and de-prioritize such servers. The code right now will always try servers in the order of configuration, so a bad server in the list will always be tried and may rely on timeout logic to try the next.
+ * Various other cleanups to remove code duplication and for clarification.
- Fixes: #380
+ Fixes Bug: #444
Fix By: Brad House (@bradh352)
-- Remove legacy comment about ahost/acountry/adig targets
+- [Brad House brought this change]
-- Distribute fuzzinput/fuzznames for fuzz tests
+ its not 1991 anymore, lower default timeout and retry count (#542)
- The fuzz test files were not being distributed. This doesn't appear to be
- a regression, it looks like they have never been distributed.
+ A lot of time has passed since the original timeouts and retry counts were chosen. We have on and off issues reported due to this. Even on geostationary satellite links, latency is worst case around 1.5s. This PR changes the per-server timeout to 2s and the retry count lowered from 4 to 3.
- Fixes: #379
Fix By: Brad House (@bradh352)
-Version 1.17.1 (19 Nov 2020)
-
-GitHub (19 Nov 2020)
- [Brad House brought this change]
- Travis: add iOS target built with CMake (#378)
+ Modernization: Implement base data-structures and replace usage (#540)
- Issue #377 suggested that CMake builds for iOS with c-ares were broken. This PR adds an automatic Travis build for iOS CMake.
+ c-ares currently lacks modern data structures that can make coding easier and more efficient. This PR implements a new linked list, skip list (sorted linked list), and hashtable implementation that are easy to use and hard to misuse. Though these implementations use more memory allocations than the prior implementation, the ability to more rapidly iterate on the codebase is a bigger win than any marginal performance difference (which is unlikely to be visible, modern systems are much more powerful than when c-ares was initially created).
+
+ The data structure implementation favors readability and audit-ability over performance, however using the algorithmically correct data type for the purpose should offset any perceived losses.
+
+ The primary motivation for this PR is to facilitate future implementation for Issues #444, #135, #458, and possibly #301
+
+ A couple additional notes:
+
+ The ares_timeout() function is now O(1) complexity instead of O(n) due to the use of a skiplist.
+ Some obscure bugs were uncovered which were actually being incorrectly validated in the test cases. These have been addressed in this PR but are not explicitly discussed.
+ Fixed some dead code warnings in ares_rand for systems that don't need rc4
Fix By: Brad House (@bradh352)
-bradh352 (18 Nov 2020)
-- fix build
-
-GitHub (18 Nov 2020)
-- [Fabrice Fontaine brought this change]
+- [Jérôme Duval brought this change]
- External projects were using non-public header ares_dns.h, make public again (#376)
-
- It appears some outside projects were relying on macros in ares_dns.h, even though it doesn't appear that header was ever meant to be public. That said, we don't want to break external integrators so we should distribute this header again.
+ fix missing prefix for CMake generated libcares.pc (#530)
- Fix By: Fabrice Fontaine (@ffontaine)
-
-bradh352 (17 Nov 2020)
-- note that so versioning has moved to configure.ac
-
-- note about 1.17.1
-
-- fix sed gone wrong
-
-GitHub (17 Nov 2020)
-- [Daniel Stenberg brought this change]
-
- autotools cleanup (#372)
-
- * remove: install-sh mkinstalldirs
-
- They're generated when needed, no need to store in it.
-
- * buildconf: remove custom logic with autoreconf
+ 'pkg-config grpc --cflags' complains with:
+ Variable 'prefix' not defined in libcares.pc
- Fix By: Daniel Stenberg (@bagder)
+ Fix By: Jérôme Duval (@korli)
-bradh352 (17 Nov 2020)
-- attempt to fix 1.17.0 release distribution issues
+bradh352 (11 Jul 2023)
+- windows get_DNS_Windows port fix for ipv6
-Version 1.17.0 (16 Nov 2020)
+- windows get_DNS_Windows port is in network byte order
-bradh352 (16 Nov 2020)
-- 1.17.0 release prep
+- backoff to debian 11 due to coverage check failure
-- ares_getaddrinfo(): duplicate hints ai_socktype and ai_protocol into output
-
- ai_socktype and ai_protocol were ignored from the hints input. They are now
- duplicated into the output as expected. Currently no sanity checks on
- proper values are taking place.
-
- Fixes: #317
- Fix By: Brad House (@bradh352)
+- extend on PR #534, windows should also honor a port
-- ares_parse_{a,aaaa}_reply could return larger *naddrttls than passed in
-
- If there are more ttls returned than the maximum provided by the requestor, then
- the *naddrttls response would be larger than the actual number of elements in
- the addrttls array.
+GitHub (11 Jul 2023)
+- [Brad House brought this change]
+
+ Support configuration of DNS server ports (#534)
- This bug could lead to invalid memory accesses in applications using c-ares.
+ As per https://man.openbsd.org/OpenBSD-5.1/resolv.conf.5 we should
+ support bracketed syntax for resolv.conf entries to contain an optional
+ port number.
- This behavior appeared to break with PR #257
+ We also need to utilize this format for configuration of MacOS
+ DNS servers as seen when using the Viscosity OpenVPN client, where
+ it starts a private DNS server listening on localhost on a non-standard
+ port.
- Fixes: #371
- Reported By: Momtchil Momtchev (@mmomtchev)
Fix By: Brad House (@bradh352)
-GitHub (5 Nov 2020)
-- [Dustin Lundquist brought this change]
-
- docs: ares_set_local_ip4() uses host byte order (#368)
+Daniel Stenberg (9 Jun 2023)
+- provide SPDX identifiers and a REUSE CI job to verify
- Properly document brain-dead behavior of ares_set_local_ip4() using host byte order instead of expected network byte order.
+ All files have their licence and copyright information clearly
+ identifiable. If not in the file header, they are set separately in
+ .reuse/dep5.
- Fix By: Dustin Lundquist
-
-- [Łukasz Marszał brought this change]
+ All used license texts are provided in LICENSES/
- empty hquery->name could lead to invalid memory access (#367)
-
- If hquery->name is empty (=="\0"), &hquery->name[strlen(hquery->name)-1] would point to "random" place in memory. This is causing some of my address sanitizer tests to fail.
-
- Fix By: Łukasz Marszał (@lmarszal)
+GitHub (30 May 2023)
+- [Alexey A Tikhonov brought this change]
-bradh352 (28 Sep 2020)
-- Fix OSSFuzz reported issue in CAA reply parsing
+ Remove unreachable code as reported by Coverity (#527)
- OSS-Fuzz is reporting a use-of-uninitialized-value:
- https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=26012
+ Coverity reported some code as unreachable. A manual inspection confirmed the reports.
- Reported By: David Drysdale (@daviddrysdale)
+ Fix By: Alexey A Tikhonov (@alexey-tikhonov)
-GitHub (26 Sep 2020)
-- [David Hotham brought this change]
+- [Ben Noordhuis brought this change]
- fuzz CAA parsing (#363)
-
- Add fuzz support for CAA parsing
+ rand: add support for getrandom() (#526)
- Fix By: David Hotham (@dimbleby)
-
-- [Daniela Sonnenschein brought this change]
+ glibc provides arc4random_buf() but musl does not and /dev/urandom is
+ not always available.
- Allow parsing of CAA Resource Record (#360)
-
- CAA (Certification Authority Authorization) was introduced in RFC 6844.
- This has been obsoleted by RFC 8659. This commit added the possibility
- to query CAA resource records with adig and adds a parser for CAA
- records, that can be used in conjunction with ares_query(3).
-
- Closes Bug: #292
- Fix By: Daniela Sonnenschein (@lxdicted)
+- [Tim Wojtulewicz brought this change]
-Daniel Stenberg (17 Sep 2020)
-- docs: remove the html and pdf make targets
+ Replace uses of sprintf with snprintf (#525)
- They're rarely used in our daily work flow and mostly just add friction,
+ sprintf isn't safe even if you think you are using it right. Switch to snprintf().
- Closes #362
-
-bradh352 (14 Sep 2020)
-- ares_process needs to always include nameser.h as it has compat
-
-- Define T_OPT if system doesn't provide it
-
-GitHub (12 Sep 2020)
-- [Gisle Vanem brought this change]
+ Fix By: Tim Wojtulewicz (@timwoj)
- Change the mailman links (#358)
-
- Links when wrapping become misleading. Insert newline to prevent wrapping.
-
- Fix By: Gisle Vanem (@gvanem)
+bradh352 (23 May 2023)
+- update version and release procedure
-- [Gisle Vanem brought this change]
+GitHub (22 May 2023)
+- [Douglas R. Reno brought this change]
- [adig] Update man-page for the '-x' option (#357)
+ INSTALL.md: Add Watcom instructions and update Windows documentation URLs (#524)
- Fix By: Gisle Vanem (@gvanem)
-
-- [Gisle Vanem brought this change]
-
- [adig] add '-x' option. (#356)
+ This commit adds instructions on how to use the WATCOM compiler to build c-ares. This was just tested on c-ares-1.19.1 and works well.
- Added a 'dig-style' '-x' option. Also support '-xx' for a
- IPv6 bit-string PTR query.
+ While going through the links for the C Runtime documentation for Windows systems, I discovered that all three of the KB articles that were linked are now nonexistent. This commit replaces KB94248 with the current replacement available on Microsoft's website, which also makes the other two KB articles obsolete.
- Fix By: Gisle Vanem (@gvanem)
+ Fix By: Douglas R. Reno (@renodr)
-bradh352 (12 Sep 2020)
-- fix indentation
+Version 1.19.1 (22 May 2023)
-- ns_t_opt -> T_OPT
+bradh352 (22 May 2023)
+- Makefile.inc Windows requires tabs not spaces for nmake
-GitHub (12 Sep 2020)
-- [Gisle Vanem brought this change]
+GitHub (22 May 2023)
+- [Daniel Stenberg brought this change]
- Fixes for Watt-32 on djgpp + Windows (#355)
+ ares_expand_name: fix compiler warnings (#522)
- No longer any relation to libcurl since '/packages/DOS/common.dj' is dropped.
- This Makefile.dj has been tested on Win-10 only (using the Windows hosted djgpp cross compiler).
+ Fix some compiler warnings (not introduced in this release)
- Fix By: Gisle Vanem (@gvanem)
+ Fix By: Daniel Stenberg (@bagder)
-- [Gisle Vanem brought this change]
+bradh352 (22 May 2023)
+- windows MSVC compiler fix on 32bit
- Fixes for Watt-32 on Windows and MSDOS (#354)
-
- Move the prototype to 'ares_private.h'.
-
- Fix By: Gisle Vanem (@gvanem)
+- update security advisory links
-bradh352 (11 Sep 2020)
-- update path for include
+- minor CI issues fixes for imported inet_net_pton
-- remove stale information
+- ares_rand static analysis fixes from CI
-- remove stale information
+- windows build fix
-Brad House (9 Sep 2020)
-- silence compiler warnings
+- security release notes
-- Remove stale msvc files from makefile
+GitHub (22 May 2023)
+- [Brad House brought this change]
+
+ Merge pull request from GHSA-9g78-jv2r-p7vc
-GitHub (9 Sep 2020)
- [Brad House brought this change]
- Reorganize source tree (#349)
+ Merge pull request from GHSA-x6mf-cxr9-8q6v
- Originally started by Daniel Stenberg (@bagder) with #123, this patch reorganizes the c-ares source tree to have a more modern layout. It also fixes out of tree builds for autotools, and automatically builds the tests if tests are enabled. All tests are passing which tests each of the supported build systems (autotools, cmake, nmake, mingw gmake). There may be some edge cases that will have to be caught later on for things I'm not aware of.
+ * Merged latest OpenBSD changes for inet_net_pton_ipv6() into c-ares.
+ * Always use our own IP conversion functions now, do not delegate to OS
+ so we can have consistency in testing and fuzzing.
+ * Removed bogus test cases that never should have passed.
+ * Add new test case for crash bug found.
Fix By: Brad House (@bradh352)
-Brad House (1 Sep 2020)
-- remove CURLDEBUG as per #82
-
-GitHub (1 Sep 2020)
-- [Erik Lax brought this change]
+- [Brad House brought this change]
- Detect remote DNS server does not support EDNS as per RFC 6891 (#244)
-
- EDNS retry should be based on FORMERR returned without an OPT RR record as per https://tools.ietf.org/html/rfc6891#section-7 rather than just treating any unexpected error condition as a reason to disable EDNS on the channel.
+ Merge pull request from GHSA-8r8p-23f3-64c2
- Fix By: Erik Lax (@eriklax)
-
-Brad House (27 Aug 2020)
-- Fix for #345, don't use 'true' use 1
-
-GitHub (27 Aug 2020)
-- [Seraphime Kirkovski brought this change]
-
- ares_gethostbyname: Fix AF_UNSPEC support when using an ip address (#204)
+ * segment random number generation into own file
- fake_hostent() was not supporting AF_UNSPEC, so when an ip address was specified when using AF_UNSPEC it would attempt to do a DNS lookup rather than returning a fake hostent using the ip address.
+ * abstract random code to make it more modular so we can have multiple backends
- Fix By: Seraphime Kirkovski (@Seraphime)
-
-- [apenn-msft brought this change]
-
- Tests should use dynamic system-assigned ports rather than static port (#346)
+ * rand: add support for arc4random_buf() and also direct CARES_RANDOM_FILE reading
- The c-ares test suite was hardcoded to use port 5300 (and possibly 5301, 5302) for the test suite. Especially in containers, there may be no guarantee these ports are available and cause tests to fail when they could otherwise succeed. Instead, request the system to assign a port to use dynamically. This is now the default. To override, the test suite still takes the "-p " option as it always has and will honor that.
+ * autotools: fix detection of arc4random_buf
- Fix By: Anthony Penniston (@apenn-msft)
-
-Brad House (25 Aug 2020)
-- Unset members of the addr struct contain garbage values (#343)
+ * rework initial rc4 seed for PRNG as last fallback
- When generating the ares_sockaddr data by getaddrinfo() it was only filling
- in certain members while leaving others uninitialized. This left garbage
- data if a user tried to use the unset values. memset() the ares_sockaddr
- to 0 prior to filling in the values to prevent this.
+ * rc4: more proper implementation, simplified for clarity
- Reported By: @SmorkalovG
- Fix By: Brad House (@bradh352)
+ * clarifications
-GitHub (24 Aug 2020)
-- [Jonathan Maye-Hobbs brought this change]
+bradh352 (20 May 2023)
+- add public release note information
- FQDN with trailing period should be queried first with larger ndot value (#345)
+- bump version to 1.19.1
+
+GitHub (6 May 2023)
+- [Gregor Jasny brought this change]
+
+ test: fix warning about uninitialized memory (#515)
- If a query is performed for dynamodb.us-east-1.amazonaws.com. with ndots=5, it was attempting to search the search domains rather than just attempting the FQDN that was passed it. This patch now at least attempts the FQDN first.
+ fix warning in tests
- We may need to determine if we should abort any further searching, however as is probably intended.
-
- Fix by: Jonathan Maye-Hobbs (@wheelpharoah)
+ Fix By: Gregor Jasny (@gjasny)
-- [Gisle Vanem brought this change]
+- [lifenjoiner brought this change]
- Update acountry.c country code list (#341)
+ Turn off IPV6_V6ONLY on Windows if it is supported (#520)
- Updated country_list[]:
- * 2-letter ISO-3166 country-codes.
- * Add, rename some names + codes in accordance with latest table at https://en.wikipedia.org/wiki/ISO_3166-1.
+ Turn off IPV6_V6ONLY on Windows if it is supported, support for IPv4-mapped IPv6 addresses.
- Fix By: Gisle Vanem (@gvanem)
+ IPV6_V6ONLY refs:
+ https://en.wikipedia.org/wiki/IPv6#IPv4-mapped_IPv6_addresses
+ https://github.com/golang/go/blob/master/src/net/ipsock_posix.go
+ https://en.wikipedia.org/wiki/Unix-like
+ off:
+ https://www.kernel.org/doc/html/latest/networking/ip-sysctl.html#proc-sys-net-ipv6-variables
+ https://man.netbsd.org/inet6.4
+ https://man.freebsd.org/cgi/man.cgi?query=inet6
+ https://github.com/apple-oss-distributions/xnu/blob/main/bsd/man/man4/inet6.4
+ on:
+ https://learn.microsoft.com/en-us/windows/win32/winsock/ipproto-ipv6-socket-options
+ acts like off, but returns 1 and dummy setting:
+ https://man.dragonflybsd.org/?command=inet6
+ https://man.dragonflybsd.org/?command=ip6
+ unsupported and read-only returns 1:
+ https://man.openbsd.org/inet6.4
+
+ default value refs:
+ https://datatracker.ietf.org/doc/html/rfc3493#section-5.3
+ https://www.kernel.org/doc/html/latest/networking/ip-sysctl.html#proc-sys-net-ipv6-variables
-- [Bulat Gaifullin brought this change]
+- [Brad House brought this change]
- Test case should honor flag HAVE_WRITEV rather than WIN32 (#344)
+ Merge pull request from GHSA-54xr-f67r-4pc4
- Test cases where not honoring the HAVE_WRITEV flag but instead using WIN32 to determine if WRITEV was available or not. This patch fixes that.
+ * CARES_RANDOM_FILE should always default to /dev/urandom
- Fix By: Bulat Gaifullin (@bgaifullin)
+ During cross-compilation, CARES_RANDOM_FILE may not be able to be appropriately
+ detected, therefore we should always set it to /dev/urandom and allow the
+ entity requesting compilation override the value. The code does appropriately
+ fall back if CARES_RANDOM_FILE cannot be opened.
+
+ * use set not option
-Brad House (18 Jul 2020)
-- Ensure c89 support
+bradh352 (18 Mar 2023)
+- ares_getaddrinfo using service of "0" should be allowed
- A couple of for loops in Mac-specific code were using integer declarations
- inside a for loop. Move the declaration to the top of the preceding
- code block to retain c89 compliance.
+ As per #517 glibc allows a service/servname of "0" to be treated the
+ same as if NULL was provided. Also, add a sanity check to ensure
+ the port number is in range instead of a blind cast.
- Reported By: Jeffrey Walton
+ Fixes: #517
+ Fix By: Brad House (@bradh352)
-GitHub (2 Jul 2020)
-- [Fionn Fitzmaurice brought this change]
+GitHub (10 Feb 2023)
+- [Nikolaos Chatzikonstantinou brought this change]
- Avoid buffer overflow in RC4 loop comparison (#336)
+ fix memory leak in ares_send (#511)
- The rc4 function iterates over a buffer of size buffer_len who's maximum
- value is INT_MAX with a counter of type short that is not guaranteed to
- have maximum size INT_MAX.
+ When the condition channel->nservers < 1 holds, the function returns
+ prematurely, without deallocating query->tcpbuf. We rearrange the
+ check to be done prior to the allocations, avoiding the memory
+ leak. In this way, we also avoid unnecessary allocations if
+ channel->nservers < 1 holds.
- In circumstances where short is narrower than int and where buffer_len
- is larger than the maximum value of a short, it may be possible to loop
- infinitely as counter will overflow and never be greater than or equal
- to buffer_len.
+ Fix By: Nikolaos Chatzikonstantinou (@createyourpersonalaccount)
+
+- [Nikolaos Chatzikonstantinou brought this change]
+
+ change comment style to old-style (#513)
- The solution is to make the comparison be between types of equal width.
- This commit defines counter as an int.
+ Following the README.md guidelines,
- Fix By: Fionn Fitzmaurice (@fionn)
+ "Comments must be written in the old-style"
+
+ the comment is changed to the old style.
+
+ Fix By: Nikolaos Chatzikonstantinou (@createyourpersonalaccount)
-- [anonymoushelpishere brought this change]
+- [Nikolaos Chatzikonstantinou brought this change]
- Updated help information for adig, acountry, and ahost. (#334)
+ use strncasecmp in ares__strsplit (#512)
- Provide more descriptive help information for various utilities.
+ strncasecmp on platforms that don't already have it is already #define'd to a private implementation. There is no need to have OS-specific logic. Also removes ares__strsplit.h as a header as ares_private.h already includes it.
- Fix By: @anonymoushelpishere
+ Fix By: Nikolaos Chatzikonstantinou (@createyourpersonalaccount)
-- [lutianxiong brought this change]
+- [Yijie Ma brought this change]
- avoid read-heap-buffer-overflow (#332)
+ Fix a typo in ares_init_options.3 (#510)
- Fix invalid read in ares_parse_soa_reply.c found during fuzzing
+ that -> than
- Fixes Bug: #333
- Fix By: lutianxiong (@ltx2018)
+ Fix By: Yijie Ma (@yijiem)
-- [Ivan Baidakou brought this change]
+- [Douglas R. Reno brought this change]
- Fix: sizeof(sizeof(addr.saX)) -> sizeof(addr.saX) in readaddrinfo (#331)
+ Watcom Portability Improvements (#509)
- Looks like a sed-gone-wrong, a sizeof inside of a sizeof.
+ - Modify the Watcom Makefile for the source code reorganization (#352)
+ - Add *.map files into .gitignore
+ - Fix build errors with Watcom's builtin Windows SDK (which is rather
+ outdated). It's smart enough to understand Windows Vista, but doesn't
+ have PMIB_UNICASTIPADDRESS_TABLE or MIB_IPFORWARD_ROW2.
- Fix By: Ivan Baidakou (@basiliscos)
+ It may be possible to use a different Windows SDK with the Watcom
+ compiler, such as the most recent Windows 10 SDK. Alternatively the SDK
+ in OpenWatcom 2.0 (which is in development) should fix this.
+
+ I have no problems testing this Makefile prior to releases, just give me
+ a ping.
+
+ Tested with Windows Vista, Windows 7, and Windows 10 using 'adig',
+ 'acountry', and 'ahost'. This also seems to work on Windows XP, though
+ this is likely due to the compiler in use.
+
+ Fix By: Douglas R. Reno (@renodr)
+ Fixes Bug: #352
-Version 1.16.1 (11 May 2020)
+- [Jay Freeman (saurik) brought this change]
-Brad House (11 May 2020)
-- c-ares 1.16.1 release prep
+ ignore aminclude_static.am, as generated by AX_AM_MACROS_STATIC (#508)
+
+ Fix By: Jay Freeman (@saurik)
-- update travis to use xcode11.4
+- [Jay Freeman (saurik) brought this change]
-- Prevent possible double-free in ares_getaddrinfo() if ares_destroy() is called
+ sync ax_pthread.m4 with upstream (#507)
- In the event that ares_destroy() is called prior to ares_getaddrinfo() completing,
- it would result in an invalid read and double-free due to calling end_hquery() twice.
+ The version in the repository is many years old so this PR simply pulls in the latest
+ available revision from:
+ http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=tree;f=m4
- Reported By: Jann Horn @ Google Project Zero
+ Fix By: Jay Freeman (@saurik)
-GitHub (30 Apr 2020)
-- [shelley vohr brought this change]
+- [Chilledheart brought this change]
- fix: windows UNICODE incompatibilities with ares_getaddrinfo (#328)
+ Windows: Invalid stack variable out of scope for HOSTS file path (#502)
- Fixes the following compatibility issues:
- * Use RegQueryValueExA instead of RegQueryValueEx
- * Use ExpandEnvironmentStringsA instead of ExpandEnvironmentStrings
- * Use RegOpenKeyExA instead of RegOpenKeyExA
- * Use GetWindowsDirectoryA instead of GetWindowsDirectoryA
+ In some conditions Windows might try to use a stack address that has gone out of scope when determining where to read the hosts data from for file lookups.
- Fix By: Shelley Vohr (@codebytere)
- Closes: #327
-
-Brad House (13 Apr 2020)
-- travis: CloudFlare does not allow T_ANY requests, so live tests that use it fail. Disable.
+ Fix By: @Chilledheart
-- travis: bump macos image to the latest
+- [Brad House brought this change]
-- cast-align warnings are false for struct sockaddr, silence
+ sync ax_cxx_compile_stdcxx_11.m4 with upstream (#505)
- Create a macro to silence false cast-align warnings when casting
- struct sockaddr * to struct sockaddr_in * and struct sockaddr_in6 *.
+ It was reported that ax_cxx_compile_stdcxx_11.m4 was not compatible with uclibc.
+ The version in the repository is many years old so this PR simply pulls in the latest
+ available revision from:
+ http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=tree;f=m4
+ Fixes Bug: #504
Fix By: Brad House (@bradh352)
-- MacOS: Enable libresolv support for retrieving DNS servers like iOS does.
+Version 1.19.0 (18 Jan 2023)
-GitHub (10 Apr 2020)
-- [Dmitry Igrishin brought this change]
+bradh352 (18 Jan 2023)
+- Prep for 1.19.0 release
- CMake: Populate the INCLUDE_DIRECTORIES property of installed targets (#323)
+- Fix inverted logic in 25523e2
- Populate the INCLUDE_DIRECTORIES property of installed targets
+ Fix .localhost. handling in prior commit
- Fix By: Dmitry Igrishin (@dmitigr)
-
-Brad House (10 Apr 2020)
-- travis: make valgrind use cmake for tests
-
-- dont try to use libtool to run valgrind
-
-- valgrind requires libtool installed to wrap tests
-
-- scan build 7
-
-- fix travis live test
-
-- add debug for travis
-
-- try without sudo
-
-- attempt to modernize travis build environment
-
-GitHub (6 Apr 2020)
-- [Teemu R brought this change]
+ Fix By: Brad House (@bradh352)
- Allow TXT records on CHAOS qclass (#321)
+- RFC6761 localhost definition includes subdomains
- Some DNS servers intentionally "misuse" the obsoleted CHAOS (CH) qclass to provide things like `version.bind`, `version.server`, `authors.bind`, `hostname.bind` and `id.server`.
+ RFC6761 6.3 states:
+ The domain "localhost." and any names falling within ".localhost."
- C-ares was not allowing such use cases.
+ We were only honoring "localhost".
- Fix By: Teemu R. (@rytilahti)
+ Fixes: #477
+ Fix By: Brad House (@bradh352)
-Brad House (5 Apr 2020)
-- Remove warnings from ares_getaddrinfo.3 man page
+- docs: ARES_OPT_UDP_PORT and ARES_OPT_TCP_PORT docs wrong byte order
- As reported in #319, non-standard macros of .IN were used.
- Replace with .RS/.RE.
+ As per #487, documentation states the port should be in network byte
+ order, but we can see from the test cases using MockServers on
+ different ports that this is not the case, it is definitely in host
+ byte order.
- Fixes: #319
Fix By: Brad House (@bradh352)
-- ares_getaddrinfo man page render better for man2html
-
-- update man pages to render better for man2html
-
-Version 1.16.0 (12 Mar 2020)
-
-Brad House (12 Mar 2020)
-- 1.16.0 release notes draft
-
-- attempt to fix double-free introduced in e0517f9
-
-GitHub (12 Mar 2020)
-- [David Drysdale brought this change]
+GitHub (18 Jan 2023)
+- [hopper-vul brought this change]
- test: fuzzer input triggering double free (#315)
+ Add str len check in config_sortlist to avoid stack overflow (#497)
- OSS-Fuzz has reported a double-free with the fuzzer input file
- included here; run with:
- ./test/aresfuzz test/fuzzinput/clusterfuzz-5637790584012800
+ In ares_set_sortlist, it calls config_sortlist(..., sortstr) to parse
+ the input str and initialize a sortlist configuration.
- Bisecting the failure points to commit e0517f97d988 ("Parse SOA records
- from ns_t_any response (#103)")
-
-- [Brad House brought this change]
-
- CMake: Install Manpages (#314)
+ However, ares_set_sortlist has not any checks about the validity of the input str.
+ It is very easy to create an arbitrary length stack overflow with the unchecked
+ `memcpy(ipbuf, str, q-str);` and `memcpy(ipbufpfx, str, q-str);`
+ statements in the config_sortlist call, which could potentially cause severe
+ security impact in practical programs.
- CMake wasn't installing manpages.
+ This commit add necessary check for `ipbuf` and `ipbufpfx` which avoid the
+ potential stack overflows.
- Fixes #297
- Fix By: Brad House (@bradh352)
+ fixes #496
+
+ Fix By: @hopper-vul
-- [Brad House brought this change]
+bradh352 (18 Jan 2023)
+- Fix build due to str-split sed gone wrong
+
+ Fix By: Brad House (@bradh352)
- Enable cmake tests for AppVeyor (#313)
+- cirrus-ci: switch to scan-build-py for MacOS
- Tests require linking against the static library on Windows otherwise the symbols are not exported for internals being tested.
+ MacOS seems to work better with scan-build-py
Fix By: Brad House (@bradh352)
-Brad House (11 Mar 2020)
-- Add AppVeyor badge
-
-- bump c-ares version to 1.16.0. test AppVeyor integration.
-
-GitHub (11 Mar 2020)
-- [Brad House brought this change]
+- ares_strsplit* -> ares__strsplit* to comply with internal function naming
+
+ Inspired by #495, but was missing test cases and would failed to build.
+
+ Fix By: Brad House (@bradh352), Daniel Stenberg (@bagder)
- replace all usages of inet_addr() with ares_inet_pton() which is more proper (#312)
+- Cirrus-CI: MacOS Homebrew has changed from /usr/local/opt to /opt/homebrew
- Replace usage of inet_addr() with ares_inet_pton() which is more appropriate and fixes issues with legitimate addresses like 255.255.255.0. IPv6 already used this.
+ Fix paths for homebrew.
- Fixes #309
Fix By: Brad House (@bradh352)
-- [Brad House brought this change]
-
- CMake: Generate WinPDB files during build (#311)
-
- Build and Install PDB (Windows Debug Symbol) files if supported by underlying system.
+- cirrus-ci: iOS build needs to use ARM MacOS image
- Also update AppVeyor to test cmake builds.
+ CirrusCI removed Intel-based MacOS images. Need to switch
+ iOS builds to use new ARM images as well.
- Fixes #245
- Fix By: Piotr Pietraszkiewicz (@ppietrasa) and Brad House (@bradh352)
-
-- [Brad House brought this change]
+ Fix By: Brad House (@bradh352)
- CMake: Rework library function checking (#310)
+- cirrus-ci: new MacOS image
- CHECK_LIBRARY_EXISTS(), while it takes a function name, does not actually verify the function exists in the library being evaluated. Instead, if the function is found in any dependent library, and the referenced library also exists, it returns true. This is not desirable.
+ Cirrus-CI has recently EOL'd Intel MacOS VMs, switch to the latest
+ ARM-based image.
- Wrap with a Macro to change the behavior.
+ Fix By: Brad House (@bradh352)
+
+- acountry was passing stack variable to callback
+
+ Recent ASAN versions picked up that acountry was passing stack
+ variables to ares_gethostbyname() then leaving the stack context.
+ We will now allocate a buffer for this.
- Fixes: #307
Fix By: Brad House (@bradh352)
-- [Dron Rathore brought this change]
+GitHub (13 Dec 2022)
+- [Daniel Stenberg brought this change]
- Parse SOA records from ns_t_any response (#103)
-
- Added the capability of parsing SOA record from a response buffer of ns_t_any type query, this implementation doesn't interfere with existing T_SOA query's response as that too is treated as a list of records. The function returns ARES_EBADRESP if no SOA record is found(as per RFC).
+ docs: reformat/cleanup man pages SYNOPSIS sections (#494)
- The basic idea of sticking to RFC that a ns_t_any too should return an SOA record is something open for discussion but I have kept the functionality intact as it was previously i.e the function returns ARES_EBADRESP if it doesn't find a SOA record regardless of which response it is parsing i.e. T_SOA or T_ANY.
+ To make them render "nicer" in both terminals and on the website.
- Note that asking for T_ANY is generally a bad idea:
- - https://blog.cloudflare.com/what-happened-next-the-deprecation-of-any/
- - https://tools.ietf.org/html/draft-ietf-dnsop-refuse-any
+ - Removes the bold
+ - Removes .PP lines
+ - Indents them more like proper code style
- Bug: #102
- Fix By: Dron Rathore (@DronRathore)
+ Fix By: Daniel Stenberg (@bagder)
-- [Stephen Bryant brought this change]
+- [Nikolaos Chatzikonstantinou brought this change]
- Added CPack functionality for generating RPM or DEB packages (#283)
+ bug fix: new ares_strsplit (#492)
- Added CPack functionality for generating RPM or DEB packages
+ * add ares_strsplit unit test
- ie: run `cpack -G RPM` (or "DEB") after building with CMake.
+ The test reveals a bug in the implementation of ares_strsplit when the
+ make_set parameter is set to 1, as distinct domains are confused for
+ equal:
- The current configuration creates 3 separate packages for the shared library,
- the development files and the tools.
+ out = ares_strsplit("example.com, example.co", ", ", 1, &n);
- Fix By: Stephen Bryant (@bf-bryants)
-
-- [tjwalton brought this change]
-
- ares_gethostbyname: Return ENODATA if no valid A or AAAA record found (#304)
+ evaluates to n = 1 with out = { "example.com" }.
- ares_gethostbyname() was returning ESUCCESS when no A or AAAA record was found but a CNAME pointing nowhere was present. ENODATA should be returned instead, however the hosts pointer will still be present to provide the alias list.
+ * bugfix and cleanup of ares_strsplit
- * Return ENODATA if no valid A or AAAA record found
- * Fix and update test ParseAReplyNoData.
- * Add test for new ENODATA behaviour in ares_gethostbyname.
+ The purpose of ares_strsplit in c-ares is to split a comma-delimited
+ string of unique (up to letter case) domains. However, because the
+ terminating NUL byte was not checked in the substrings when comparing
+ for uniqueness, the function would sometimes drop domains it should
+ not. For example,
- Fixes Bug #303
- Fix By: @tjwalton
-
-- [Michal Rostecki brought this change]
-
- test: Separate live tests from SetServers* tests (#299)
+ ares_strsplit("example.com, example.co", ",")
- Before this change, SetServers, SetServersPorts and SetServersCSV
- contained test cases trying to make DNS queries with the google.com
- hostname, which requires Internet connectivity. Tests with that
- requirement should be defined in the ares-test-live.cc file and contain
- "Live" prefix to filter them out with `--gtest_filter=-*.Live*` on
- machines without Internet connectivity.
+ would only result in a single domain "example.com".
- Fix By: Michal Rostecki (@mrostecki)
-
-- [Adam Majer brought this change]
-
- Only count valid addresses when response parsing (#302)
+ Aside from this bugfix, the following cleanup is performed:
- When ares_parse_a_reply or ares_parse_aaaa_reply is called in case
- where another AAAA and A responses exist, the resulting ares_addrttl
- count is invalid and the structure points to gibberish.
+ 1. The tokenization now happens with the help of strcspn instead of the
+ custom function is_delim.
+ 2. The function list_contains has been inlined.
+ 3. The interface of ares_strsplit has been simplified by removing the
+ parameter make_set since in practice it was always 1.
+ 4. There are fewer passes over the input string.
+ 5. We resize the table using realloc() down to its minimum size.
+ 6. The docstring of ares_strsplit is updated and also a couple typos
+ are fixed.
- This is a regression since 1.15.
+ There occurs a single use of ares_strsplit and since the make_set
+ parameter has been removed, the call in ares_init.c is modified
+ accordingly. The unit test for ares_strsplit is also updated.
- Issue: https://github.com/c-ares/c-ares/issues/300
- Fix By: Adam Majer (@AdamMajer)
-
-Brad House (24 Dec 2019)
-- [Kyle Edwards brought this change]
+ Fix By: Nikolaos Chatzikonstantinou (@createyourpersonalaccount)
- CMake: Provide c-ares version in package export file (#296)
+bradh352 (23 Oct 2022)
+- CirrusCI: update freebsd image
- The CMake package export file should provide version information.
+ Old FreeBSD image for CirrusCI has issues with newer symbols, update to later one.
- Fix By: Kyle Edwards (@KyleFromKitware)
+ Fix By: Brad House (@bradh352)
-- [Ben Noordhuis brought this change]
+GitHub (23 Oct 2022)
+- [Stephen Sachs brought this change]
- Accept invalid /etc/resolv.conf lookup values, ability to build container tests (#274)
+ Fix Intel compiler deprecated options (#485)
- * Add CARES_BUILD_CONTAINER_TESTS CMake option to add ability to build the Linux-only containerized tests.
- * Accept invalid /etc/resolv.conf lookup values
+ Options `-we ###` and `-wd ###` should not include a whitespace. They are also deprecated and `-diag-error` and `-diag-disable` are their replacements.
- Before this commit invalid `lookup` values resulted in c-ares not using
- any lookups without any clear indication why. After this commit it uses
- the default "fb".
+ Intel compiler 2021.6 is not able to be used in configure without the proposed patch.
- Fix By: Ben Noordhuis (@bnoordhuis)
+ Fix By: Stephen Sachs (@stephenmsachs)
-- [Christian Ammer brought this change]
+- [Jonathan Ringer brought this change]
- Parallel A and AAAA lookups in `ares_getaddrinfo` (#290)
-
- A and AAAA lookups for ares_getaddrinfo() are now performed in parallel.
-
- For this change `ares_search` was removed from `ares_getaddrinfo`.
- Instead `ares_query` in combination with `next_dns_lookup` are
- doing the suffix search.
+ Allow for CMake to use absolute install paths (#486)
- Adding support for `.onion` addresses which are tested by
- `TEST_F(DefaultChannelTest, GetAddrinfoOnionDomain)`
+ Generated libcares.pc could have bad paths when using absolute paths.
- Fix By: Christian Ammer (@ChristianAmmer)
+ Fix By: Jonathan Ringer (@jonringer)
-- [Vy Nguyen brought this change]
+- [Thomas Dreibholz brought this change]
- Move variables into the block where it is used to avoid unused-vars (#281)
+ Fix for issue #488: ensure that the number of iovec entries does not exceed system limits. (#489)
- Warning uncovered with [-Werror, -Wunused-variables]
+ c-ares could try to exceed maximum number of iovec entries supported by system.
- Fix By: Vy Nguyen (@oontvoo)
+ Fix By: Thomas Dreibholz (@dreibh)
-- [Vy Nguyen brought this change]
+- [bsergean brought this change]
- Rename local macros to avoid conflicting with system ones and remove unsed variables. (Otherwise code will break once compiled with [-Werror,-Wmacro-redefined,-Wunused-variable] ) (#280)
+ Add include guards to ares_data.h (#491)
- Fix new getaddrinfo code to not redefine macros on some systems.
+ All the other header files in the src/lib folder do have an include guard so it look like an overthought.
- Fix By: Vy Nguyen (@oontvoo)
+ Fix By: @bsergean
-- [Egor Pugin brought this change]
+- [Brad Spencer brought this change]
- [ares_getenv] Return NULL in all cases. (#279)
+ Fix typo in docs for ares_process_fd (#490)
- if ares_getenv is defined, it must return a value on all platforms.
+ A single letter was missing
- Fix By: Egor Pugin (@egorpugin)
+ Fix By: Brad Spencer (@b-spencer)
-- [Abhishek Arya brought this change]
+- [lifenjoiner brought this change]
- Add OSS-Fuzz fuzzing badge (#278)
+ tools: refine help (#481)
- Adds based on instructions at
- https://google.github.io/oss-fuzz/getting-started/new-project-guide/#status-badge
+ fix invalid help options and documentation typos
- Patch By: Abhishek Arya (@inferno-chromium)
+ Fix By: @lifenjoiner
-- [Peter Eisentraut brought this change]
+- [lifenjoiner brought this change]
- ares_init_options.3: Fix layout (#275)
+ Git: ignore CMake temporary files (#480)
- 7e6af8e inserted the documentation of resolvconf_path in the middle of
- the item for ednspsz, leading to broken layout. Fix that.
+ exclude more files from git
- Fix By: Peter Eisentraut (@petere)
+ Fix By: @lifenjoiner
-- [Gregor Jasny brought this change]
+- [lifenjoiner brought this change]
- manpages: Fix typos detected by lintian (#269)
+ adig: fix `-T` option (#479)
+ Helper was missing flag to enable TCP mode of operation.
- Fix By: Gregor Jasny (@gjasny)
+ Fix By: @lifenjoiner
-- [lifenjoiner brought this change]
+- [Frank brought this change]
- keep command line usage up to date (#256)
+ Add vcpkg installation instructions (#478)
- adig and ahost built-in help did not match args taken.
+ Update to include vcpkg installation instructions
- Fix-By: @lifenjoiner
+ Fix By: @FrankXie05
-- [Dan Noé brought this change]
+- [marc-groundctl brought this change]
- ares-test.cc: Handle nullptr in AddrInfo ostream. (#268)
+ Convert total timeout to per-query (#467)
- The const AddrInfo& argument to operator<< overload for AddrInfo can be
- a nullptr unique_ptr. Handle this explicitly by printing {nullptr} if
- the rest of the function cannot be safely executed.
+ On Apple platforms, libresolv reports the total timeout in retrans, not the per-query time. This patch undoes that math to get the per-query time, which is what c-ares expects. This is not perfect because libresolv is inconsistent on whether the timeout is multiplied by retry or retry+1, but I don't see any way to distinguish these cases.
- Fix-by: Dan Noé
+ Fix By: Marc Aldorasi (@marc-groundctl)
-- [Dan Noé brought this change]
+- [marc-groundctl brought this change]
- Add missing limits.h include from ares_getaddrinfo.c (#267)
+ Don't include version info in the static library (#468)
- This files references INT_MAX, but does not include limits.h. This can
- cause a build failure on some platforms. Include limits.h if we have it.
+ The static library should not contain version info, since it would be linked into an executable or dll with its own version info.
- Fix-by: Dan Noé
+ Fix By: @marc-groundctl
-- [Andrew Selivanov brought this change]
+- [Ridge Kennedy brought this change]
- fix fuzzer docs and add missing getaddrinfo docs (#265)
-
- There is a fix for a bit outdated clang fuzzer docs and ares_getaddrinfo docs.
+ Fix ares_getaddrinfo() numerical address fast path with AF_UNSPEC (#469)
- Fix By: Andrew Selivanov (@ki11roy)
-
-- [Andrew Selivanov brought this change]
-
- Fix leak and crash in ares_parse_a/aaaa_reply (#264)
+ The conversion of numeric IPv4 addresses in fake_addrinfo() is broken when
+ the family is AF_UNSPEC. The initial call to ares_inet_pton with AF_INET
+ will succeed, but the subsequent call using AF_INET6 will fail. This results
+ in the fake_addrinfo() fast path failing, and ares_getaddrinfo() making a
+ query when none should be required.
- * fix leak if naddress of particular type found
- * fix segfault when wanted ttls count lesser than count of result records
- * add fuzzer input files that trigger problems (from #263)
+ Resolve this by only attempting the call to ares_inet_pton with AF_INET6
+ if the initial call with AF_INET was unsuccessful.
- Reported-By: David Drysdale (@daviddrysdale)
- Fix-By: Andrew Selivanov (@ki11roy)
+ Fix By: Ridge Kennedy (@ridgek)
-- [Andrew Selivanov brought this change]
+- [Manish Mehra brought this change]
- fix segfault when parsing wrong type of record (#262)
+ Configurable hosts path for file_lookup (#465)
- Fixes segfault when trying to ares_parse_aaaa with AF_INET and vise versa.
+ This changeset adds support for configurable hosts file
+ ARES_OPT_HOSTS_FILE (similar to ARES_OPT_RESOLVCONF).
- Fix By: Andrew Selivanov (@ki11roy)
-
-- work around mingw compile failure
-
-- c++ requires explicit casts
-
-- support EnvValue on Windows by implementing setenv/unsetenv
-
-- [Andrew Selivanov brought this change]
+ Co-authored-by: Manish Mehra (@mmehra)
- getaddrinfo enhancements (#257)
+bradh352 (27 Apr 2022)
+- CMake: Windows DLLs lack version information
- * Service support has been added to getaddrinfo.
- * ares_parse_a/aaaa_record now share code with the addrinfo parser.
- * Private ares_addrinfo structure with useful extensions such as ttls (including cname ttls),
- as well as the ability to list multiple cnames in chain of lookups
+ The cares.rc was not included in the build for CMake. Conditionally
+ add it when building for Windows.
- Work By: Andrew Selivanov @ki11roy
+ Fix By: Brad House (@bradh352)
+ Fixes Bug: #460
-- [Andrew Selivanov brought this change]
+GitHub (27 Apr 2022)
+- [Kai Pastor brought this change]
- fix ares__sortaddrinfo, use wrappers for sock_funcs (#258)
+ CMake: Guard target creation in exported config (#464)
- Some socket functions weren't exposed for use by other areas of the library. Expose
- those and make use of them in ares__sortaddrinfo().
+ User projects may call 'find_package(c-ares)' multiple times (e.g.
+ via dependencies), but targets must be created only once.
+ Shared and static target must be treated independently.
- Fix By: Andrew Selivanov (@ki11roy)
+ Fix By: Kai Pastor (@dg0yt)
-- Fix c89 compilation support broken by .onion rejection changes
-
- Move .onion check lower after all variables have been declared.
+bradh352 (27 Apr 2022)
+- Honor valid DNS result even if other class returned an error
- Bug: #246
-
-- [kedixa brought this change]
-
- getaddrinfo: callback must be called on bad domain (#249)
+ When using ares_getaddrinfo() with PF_UNSPEC, if a DNS server returned
+ good data on an A record, followed by bad data on an AAAA record, the
+ good record would be thrown away and an error returned.
- Due to an order of incrementing the remaining queries and calling ares_query, on a bad domain
- the registered callback wouldn't be called.
+ If we got a good response from one of the two queries, regardless of
+ the order returned, we should honor that.
- Bug: #248
- Fixed-By: @kedixa
+ Fix By: Dmitry Karpov (dkarpov@roku.com)
+ Signed Off By: Brad House (@bradh352)
-- [Darrin W. Cullop brought this change]
+GitHub (2 Apr 2022)
+- [Sam James brought this change]
- Windows ARM/ARM64 requires AdvApi32 (#252)
+ configure.ac: fix STDC_HEADERS typo (#459)
- Fix link issues caused by missing library that appears to only be required on ARM (though
- docs don't list this restriction). Doesn't hurt to require it everywhere.
+ There is no autoconf macro called STDC_HEADERS. AC_HEADER_STDC however does
+ exist and it defines the STDC_HEADERS macro for use.
- Bug: #251
- Fixed-By: Darrin Cullop (@dwcullop)
-
-- [kedixa brought this change]
-
- getaddrinfo: avoid infinite loop in case of NXDOMAIN(#240) (#242)
+ Not clear that STDC_HEADERS from its use in the repo is needed but
+ would rather not meddle with it for now.
- There are two possible causes for infinite loops fo NXDOMAIN, based on how many dots are in the domain name (one for < ARES_OPT_NDOTS and one for >= ARES_OPT_NDOTS), where it will repeat the same query over and over as the hquery->next_domain doesn't increment.
+ Fixes an annoying warning on `./configure`:
+ ```
+ /var/tmp/portage/net-dns/c-ares-1.18.1/work/c-ares-1.18.1/configure: 24546: STDC_HEADERS: not found
+ ```
- Fix By: @kedixa
+ Signed-off-by: Sam James
-- Portability fix for ares__sortaddrinfo()
+bradh352 (2 Mar 2022)
+- Asterisks should be allowed in host validation as CNAMEs may reference wildcard domains
- replace uint32_t with unsigned int and socklen_t with ares_socklen_t
+ CloudFlare appears to use this logic in CNAMEs as per
+ https://github.com/nodejs/node/issues/42171
- By: Brad House
-
-- [Khaidi Chu brought this change]
+ Fixes: #457
+ Fix By: Brad House (@bradh352)
- fix: init bufp before reject .onion to make it can be free correctly (#241)
+- Don't return on file lookup failure, set status
- When querying a .onion domain, it returns directly without setting bufp to NULL. A subsequent free() that occurs can cause a segmentation fault.
+ When resolving a host via /etc/hosts, don't return with a predefined
+ error as there may be other tries.
- Fix By: Khaidi Chu (@XadillaX)
-
-- [Andrew Selivanov brought this change]
+ Fix By: Brad House (@bradh352)
- Add ares__sortaddrinfo() to support getaddrinfo() sorted results (#239)
+- 'localhost' special treatment enhancement
- This is a port of RFC 6724 compliant sorting function from Android Bionic project:
- https://android.googlesource.com/platform/bionic/+/e919b116d35aa7deb24ddece69c491e24c3b0d6f/libc/netbsd/net/getaddrinfo.c
+ Since localhost is special-cased, any errors should be ignored when
+ reading /etc/hosts as otherwise we could return an error if there
+ were for instance an invalidly formatted /etc/hosts or if /etc/hosts
+ had a permissions error while reading.
- The latest version is essentially the same, except two additional parameters to test connection with (mark/uid):
- https://android.googlesource.com/platform/bionic/+/master/libc/dns/net/getaddrinfo.c
+ This exact behavior appears to have been seen on OS/400 PASE
+ environments which allows AIX binares to run.
- Please note that even that version has some restrictions. It doesn't support some rules from RFC 6724:
+ Fix By: Brad House (@bradh352)
+
+- If chain building c-ares as part of another project, detect of res_servicename could fail (#451)
- Rule 3 (Avoid deprecated addresses)
- Rule 4 (Prefer home addresses)
- Rule 7 (Prefer native transport)
+ If libresolv is already included with the build, c-ares wouldn't properly detect its use.
- Submitted By: Andrew Selivanov (@ki11roy)
+ May fix: #451
+ Fix by: Brad House (@bradh352)
-- [Christian Ammer brought this change]
+- no analyze capability on ios
- Increase portability of `ares-test-mock-ai.cc` (#235)
-
- * using portable ares_inet_pton and updated includes in ares-test-mock-ai
- * forgot to remove deleted ares-test-ai.cc in Makefile.inc
-
- Fix By: Christian Ammer (@ChristianAmmer)
+- attempt to use scan-build on ios
-- [Fabrice Fontaine brought this change]
+- disable tests on ios
- m4/xc-cc-check.m4: use XC_CHECK_BUILD_FLAGS (#236)
-
- Use XC_CHECK_BUILD_FLAGS instead of XC_CHECK_USER_FLAGS.
- Otherwise it complains of CPPFLAGS in CFLAGS.
- [Retrieved from:
- https://git.buildroot.net/buildroot/tree/package/c-ares/0001-use_check_build_instead_of_check_user.patch]
-
- Signed-off-by: Gustavo Zacarias
- Signed-off-by: Fabrice Fontaine
- Submitted by: Fabrice Fontaine
+- fix switch statement
-- [Christian Ammer brought this change]
+- code coverage had gotten disabled
- Bugfix for `ares_getaddrinfo` and additional unit tests (#234)
+- looks like shell expansion doesn't work with cirrus-ci, lets do it another way
+
+- attempt to autobuild for iOS
+
+GitHub (8 Dec 2021)
+- [Brad House brought this change]
+
+ Windows: rework/simplify initialization code, drop long EOL systems (#445)
- This PullRequest fixes a bug in the function add_to_addrinfo which task is to add new addrinfo items to the ai_next linked list. Also additional unit tests for testing ares_getaddrinfo will be added:
+ There was a lot of windows initialization code specific to the era that predates Windows Vista such as reading DNS configuration from the registry, and dynamically loading libraries to get access to functions that didn't exist in XP or earlier releases.
- Additional mock server test classes (ares-test-mock-ai.cc):
- MockTCPChannelTestAI
- MockExtraOptsTestAI
- MockNoCheckRespChannelTestAI
- MockEDNSChannelTestAI
- RotateMultiMockTestAI
- NoRotateMultiMockTestAI
+ Vista was released in January 2007, and was EOL'd in 2017, and support for Vista is still maintained with this patch set.
- Additional live tests (ares-test-live-ai.cc):
- LiveGetHostByNameV4
- LiveGetHostByNameV6
- LiveGetHostByNameV4AndV6
+ XP was EOL'd in Apr 8 2014.
- Fix By: Christian Ammer (@ChristianAmmer)
-
-- [Christian Ammer brought this change]
+ I believe the last OS based on something earlier than Vista was POSReady 2009, as it was XP based for some reason, and that was EOL'd in January 2019. Considering any POS system falls under the PCI-DSS rules, they aren't allow to run POSReady 2009 any more so there is no reason to try to continue supporting such systems.
+
+ We have also targeted with our build system Vista support for the last few years, and while developers could change the target, we haven't had any reports that they have.
- Remaining queries counter fix, additional unit tests for `ares_getaddrinfo` (#233)
+bradh352 (9 Nov 2021)
+- Fix memory leak in reading /etc/hosts
- Remaining queries counter fix, added tests (ParallelLookups,
- SearchDomains, SearchDomainsServFailOnAAAA). Removed unnecessary
- if and commented code in test.
+ When an /etc/hosts lookup is performed, but fails with ENOTFOUND, and
+ a valid RFC6761 Section 6.3 fallback is performed, it could overwrite
+ variables that were already set and therefore leave the pointers
+ dangling, never to be cleaned up.
- Fix By: Christian Ammer (@ChristianAmmer)
+ Clean up explicitly on ENOTFOUND when returning from the file parser.
+
+ Fixes: #439
+ Fix By: Brad House (@bradh352)
-- [Christian Ammer brought this change]
+GitHub (2 Nov 2021)
+- [Bobby Reynolds brought this change]
- Add initial implementation for ares_getaddrinfo (#112)
+ Fix cross-compilation from Windows to Linux due to CPACK logic (#436)
- Initial implementation for ares_getaddrinfo(). It is NOT compliant with RFC6724, though
- it is expected to come closer to conformance prior to the next release.
+ When determining value for CPACK_PACKAGE_ARCHITECTURE, prefer to use
+ value from CMAKE_SYSTEM_PROCESSOR before falling back to uname output.
- Features not supported include sorted addresses and honoring of service and hints
- parameters.
+ Additionally, if building from a Windows host, emit a fatal error
+ instead of attempting to call uname.
- Implementation by: Christian Ammer (@ChristianAmmer)
+ Fix By: Bobby Reynolds (@reynoldsbd)
-- [Ben Noordhuis brought this change]
+bradh352 (1 Nov 2021)
+- fix coveralls link
- test: fix bad expectation in ipv6 localhost test (#227)
-
- The LiveGetLocalhostByAddrV6 test expected to see "localhost" in the
- result when doing an address-to-name lookup for ::1 but on my system
- that resolves to "ip6-loopback" because of this stanza in /etc/hosts:
-
- $ grep ^::1 /etc/hosts
- ::1 ip6-localhost ip6-loopback
-
- Fix By: Ben Noordhuis (@bnoordhuis)
- Bug: #85
+- coveralls needs token
-- [Ben Noordhuis brought this change]
+- coveralls appears to require git
- ares_version.h: bump version (#230)
-
- Version change not committed from maketgz.sh
-
- Bug: #229
+- fix a couple of coveralls vars
-Daniel Stenberg (24 Oct 2018)
-- ares_library_init_android.3: minor syntax edits, fixed AVAILABILITY
+- more coveralls fixes
-Version 1.15.0 (23 Oct 2018)
+- add code coverage libs to LDADD instead of _LIBS
-Brad House (23 Oct 2018)
-- last minute 1.15.0 addition
+- make verbose
-- [Ben Noordhuis brought this change]
+- try to fix code coverage building
- Report ARES_ENOTFOUND for .onion domain names as per RFC7686. (#228)
-
- Quoting RFC 7686:
-
- Name Resolution APIs and Libraries (...) MUST either respond
- to requests for .onion names by resolving them according to
- [tor-rendezvous] or by responding with NXDOMAIN.
-
- A legacy client may inadvertently attempt to resolve a .onion
- name through the DNS. This causes a disclosure that the client
- is attempting to use Tor to reach a specific service. Malicious
- resolvers could be engineered to capture and record such leaks,
- which might have very adverse consequences for the well-being
- of the user.
-
- Bug: #196
- Fix By: Ben Noordhuis @bnoordhuis
+- need -y for install
-- prepare for c-ares 1.15.0 release
+- try to fix asan/ubsan/lsan when built with clang. try to support code coverage properly.
-- AIX Build Fix
-
- AIX attempts to include both nameser_compat.h and onameser_compat.h. It appears
- the proper fix is to define _USE_IRS so that only nameser_compat.h is used.
-
- Bug: #224
- Fix By: Brad House (@bradh352)
+- try another path
-- Fix crash in ares_dup() due to new ARES_OPT_RESOLVCONF
-
- ares_dup() calls ares_init_options() by making its own fake option
- mask since the original mask isn't stored but ARES_OPT_RESOLVCONF
- was always set, instead of conditionally set. This caused a crash
- because ares_strdup() isn't NULL-safe if no custom path was set.
+- fix pip
+
+- attempt to enable some other build types that travis supported
+
+Version 1.18.1 (26 Oct 2021)
+
+bradh352 (26 Oct 2021)
+- missed version
+
+- 1.18.1 release prep
+
+- ares_getaddrinfo() was returning the wrong size for ai_addrlen
- Made ares_dup() set ARES_OPT_RESOLVCONF conditionally.
+ ai_addrlen was erroneously returning 16 bytes instead of the
+ sizeof(struct sockaddr_in6). This is a regression introduced
+ in 1.18.0.
+ Reported by: James Brown
Fix By: Brad House (@bradh352)
-- [Sarat Addepalli brought this change]
+- Windows: autotools force linking to iphlpapi
- Add ares_init_options() configurability for path to resolv.conf file
+GitHub (26 Oct 2021)
+- [Gregor Jasny brought this change]
+
+ Fix typo detected by lintian (#434)
- Add resolvconf_path to end of struct ares_options with ARES_OPT_RESOLVCONF option
- so on Unix-like systems a custom path can be specified. If no path is specified,
- /etc/resolv.conf is used like normal.
+ typo in docs for ares_parse_uri_reply
- Fix By: Sarat Addepalli @SirR4T
- Fixes Bug: #220
- Review By: Brad House @bradh352
-
-- remove stale variables
-
-- fix prototype name for ares_strsplit_free()
+ Fix By: Gregor Jasny (@gjasny)
-- add missing prototype
+Version 1.18.0 (25 Oct 2021)
-- simplify ares_strsplit() and create ares_strsplit_free() helper function
+bradh352 (25 Oct 2021)
+- replace Travis badge with Cirrus-CI badge
-- missing ares_strsplit.h from HHEADERS for inclusion in distribution
+- c-ares 1.18.0 release prep
-- [Ruslan Baratov brought this change]
+GitHub (21 Oct 2021)
+- [Jérôme Duval brought this change]
- Add CARES_BUILD_TOOLS CMake option (#214)
+ Haiku: port (#431)
- Add ability to exclude building of tools (adig, ahost, acountry) in CMake. This should also close #200.
+ Port for Haiku. Slight CMake changes, header changes, and resolv.conf/hosts paths specific to Haiku.
- Fix By: Ruslan Baratov (@ruslo)
- Bug: #200
+ Port By: Jérôme Duval (@korli)
-- [flyingdutchman23 brought this change]
+bradh352 (19 Oct 2021)
+- valgrind: fix reported invalid read
- Style. Whitespace cleanup. (#213)
-
- Small whitespace cleanups.
-
- Fix By: @flyingdutchman23
+- make sure distcheck runs
-- [John Schember brought this change]
+- detect oddities and skip test if necessary
- Android: Support for domain search suffix (#211)
-
- Fixes issue #207. Uses LinkProperties.getDomains() to get a list of search domains and adds them to the suffix list. This also adds a new helper function to split strings into an array based on multiple delimiters replacing multiple other functions for dealing with string splitting.
-
- Submitter: John Schember (@user-none)
- Fixes: #207
- Approved-by: Brad House (@bradh352)
+- fix null ptr deref in strlen
-- [afalin brought this change]
+- bend over backwards for testing file access, something is weird on debian
- Improve DNS suffixes extracting from WinNT registry (#202)
-
- Join all global and connection specific suffix lists. Use 'HKLM\Software\Policies\Microsoft\Windows NT\DNSClient\SearchList', 'HKLM\System\CurrentControlSet\Services\Tcpip\Parameters\Domain' as global suffix lists.
-
- Fix By: @afalin
+- chmod(fn, 0) is failing on debian
-- Be consistent with indention in CMakeLists.txt
-
- The imported TRANSFORM_MAKEFILE_INC function from curl used space indention
- but the rest of the file used tabs. Go ahead and make it tabs for
- consistency as well.
-
- Committed By: Brad House
+- maybe process needs to be called
-- [flyingdutchman23 brought this change]
+- split test output
- Fix modern gcc warning: argument to 'sizeof' in 'strncpy' call is the same expression as the source
-
- Silence warning about using src to determine number of bytes to copy.
- In this case it doesn't matter whether it is `src` or `dest`. So there
- is no functionality change.
-
- Bug: #210
- Fix By: @flyingdutchman23
+- clean up a couple of compiler warnings
-- [Andi Schnebinger brought this change]
+- use helper function for addrinfo to simplify code
- fix stringop-overflow warning of GCC (#201)
-
- When using a modern GCC to compile c-ares, there is a stringop-overflow warning.
- This patch simply silences the false-positive warning, there is no actual code flaw.
-
- Bug: https://github.com/c-ares/c-ares/pull/201
- Fixed By: Andi Schnebinger @Iniesta8
+- INSTANTIATE_TEST_CASE_P -> INSTANTIATE_TEST_SUITE_P as new convention in googletest
-GitHub (18 May 2018)
-- [David Drysdale brought this change]
+- gmock: update from 1.8.0 to 1.11.0
- travis: do coverage in "coverage" build (#195)
-
- Fixes #194, a mistake from commit a255081f2c3c ("travis: Only do
- coverage/distcheck on normal build")
+- Cirrus-CI: fix debian arm build
-Brad House (17 May 2018)
-- [Brad Spencer brought this change]
+- Cirrus-CI: more updates for proper testing
- Apply the IPv6 server blacklist to all nameserver sources, not just Windows (#193)
-
- For #164, I mentioned that it seemed like the IPv6 nameserver blacklist should apply to all OSes. In a mailing list post, @bradh352 agreed and suggested that I file a PR to make it so.
-
- This moves the blacklist check from being Windows-specific to being a general feature of config_nameservers(), no matter the nameserver source. It also simplifies the ares_ipv6_server_blacklisted() implementation to not parse and re-parse the blacklisted IPv6 addresses from strings on every check. I think they're almost as easy to read as a sequence of hex bytes in an array initializer, and it's definitely less work on each trip through the code.
-
- Fix By: Brad Spencer @b-spencer
- PR: https://github.com/c-ares/c-ares/pull/193
+- install proper packages for asan and analyze
-- [Brad Spencer brought this change]
+- fix crash in tests
- Fix warnings emitted by MSVC when using -W4 (#192)
-
- These changes fix a few warnings emitted by recent versions of MSVC when compiling with -W4. Half of the changes are in Windows-specific code, and the other half should be safe no matter the compiler or OS.
-
- The allocation function change is probably the only one that needs explanation. MSVC gives warnings about the function pointers not being stable across DLL boundaries or something to that effect, so for Windows, I've made them be called indirectly, which at least made the compiler happy. I can't say I've tested every linking combination on Windows with them before or after the change, but it seems harmless.
-
- Fix By: Brad Spencer @b-spencer
- PR: https://github.com/c-ares/c-ares/pull/192
+- try to disable container tests
-- [David Hotham brought this change]
+- need g++ for tests on debian
- Prevent changing name servers while queries are outstanding (#191)
-
- Changing name servers doesn't work, per #41. Better to return an error code than to crash.
-
- Fix-by: David Hotham @dimbleby
+- try cirrus-ci again
-David Drysdale (15 May 2018)
-- [Tobias Nießen brought this change]
+- whitespace
- Fix comment in ares_rules.h (#189)
+- start bringing up cirrus-ci
-Brad House (6 May 2018)
-- [Brad Spencer brought this change]
+- prep for adding new ci
- Harden and rationalize c-ares timeout computation (#187)
+- fix cut and paste error
+
+GitHub (18 Oct 2021)
+- [Brad House brought this change]
+
+ RFC6761: special case "localhost" (#430)
- * Harden and rationalize c-ares timeout computation
- * Remove the rand() part of the timeout calculation completely.
+ As per RFC6761 Section 6.3, "localhost" lookups need to be special cased to return loopback addresses, and not forward queries to recursive dns servers.
- When c-ares sends a DNS query, it computes the timeout for that request as follows:
+ We first look up via files (/etc/hosts or equivalent), and if that fails, we then attempt a system-specific address enumeration for loopback addresses (currently Windows-only), and finally fallback to ::1 and 127.0.0.1.
- timeplus = channel->timeout << (query->try_count / channel->nservers);
- timeplus = (timeplus * (9 + (rand () & 7))) / 16;
- I see two issues with this code. Firstly, when either try_count or channel->timeout are large enough, this can end up as an illegal shift.
+ Fix By: Brad House (@bradh352)
+ Fixes Bug: #399
+
+- [Brad House brought this change]
+
+ Reimplement ares_gethostbyname() by wrapping ares_getaddrinfo() (#428)
- Secondly, the algorithm for adding the random timeout (added in 2009) is surprising. The original commit that introduced this algorithm says it was done to avoid a "packet storm". But, the algorithm appears to only reduce the timeout by an amount proportional to the scaled timeout's magnitude. It isn't clear to me that, for example, cutting a 30 second timeout almost in half to roughly 17 seconds is appropriate. Even with the default timeout of 5000 ms, this algorithm computes values between 2812 ms and 5000 ms, which is enough to cause a slightly latent DNS response to get spuriously dropped.
+ ares_gethostbyname() and ares_getaddrinfo() do a lot of similar things, however ares_getaddrinfo() has some desirable behaviors that should be imported into ares_gethostbyname(). For one, it sorts the address lists for the most likely to succeed based on the current system routes. Next, when AF_UNSPEC is specified, it properly handles search lists instead of first searching all of AF_INET6 then AF_INET, since ares_gethostbyname() searches in parallel. Therefore, this PR should also resolve the issues attempted in #94.
- If preventing the timers from all expiring at the same time really is desirable, then it seems better to extend the timeout by a small factor so that the application gets at least the timeout it asked for, and maybe a little more. In my experience, this is common practice for timeouts: applications expect that a timeout will happen at or after the designated time (but not before), allowing for delay in detecting and reporting the timeout. Furthermore, it seems like the timeout shouldn't be extended by very much (we don't want a 30 second timeout changing into a 45 second timeout, either).
+ A few things this PR does:
- Consider also the documentation of channel->timeout in ares_init_options():
+ 1. ares_parse_a_reply() and ares_parse_aaaa_reply() had very similar code to translate struct ares_addrinfo into a struct hostent as well as into struct ares_addrttl/ares_addr6ttl this has been split out into helper functions of ares__addrinfo2hostent() and ares__addrinfo2addrttl() to prevent this duplicative code.
- 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 timeout.) The default is five seconds.
+ 2. ares_getaddrinfo() was apparently never honoring HOSTALIASES, and this was discovered once ares_gethostbyname() was turned into a wrapper, the affected test cases started failing.
- In the current implementation, even the first try does not use the value that the user supplies; it will use anywhere between 56% and 100% of that value.
+ 3. A slight API modification to save the query hostname into struct ares_addrinfo as the last element of name. Since this is the last element, and all user-level instances of struct ares_addrinfo are allocated internally by c-ares, this is not an ABI-breaking change nor would it impact any API compatibility. This was needed since struct hostent has an h_name element.
- The attached patch attempts to address all of these concerns without trying to make the algorithm much more sophisticated. After performing a safe shift, this patch simply adds a small random timeout to the computed value of between 0 ms and 511 ms. I could see limiting the random amount to be no greater than a proportion of the configured magnitude, but I can't see scaling the random with the overall computed timeout. As far as I understand, the goal is just to schedule retries "not at the same exact time", so a small difference seems sufficient.
+ 4. Test Framework: MockServer tests via TCP would fail if more than 1 request was received at a time which is common when ares_getaddrinfo() queries for both A and AAAA records simultaneously. Infact, this was a long standing issue in which the ares_getaddrinfo() test were bypassing TCP alltogether. This has been corrected, the message is now processed in a loop.
- UPDATE: randomization removed.
+ 5. Some tests had to be updated for overall correctness as they were invalid but somehow passing prior to this change.
- Closes PR #187
- Fix by: Brad Spencer
+ Change By: Brad House (@bradh352)
-- distribute ares_android.h
-
- Distribute ares_android.h when a release distribution package is
- created.
-
- Reported By: Andrey Khranovsky
- Bug: https://c-ares.haxx.se/mail/c-ares-archive-2018-04/0000.shtml
+bradh352 (9 Oct 2021)
+- ares_getaddrinfo() missing sanity check to fix #426
-- ares_set_servers_csv() on failure should not leave channel in a bad state
-
- If bad data is passed to ares_set_servers_csv() or
- ares_set_servers_ports_csv() it will clear the existing channel
- configured DNS servers, then a call to ares_send() will fail due
- to a bad malloc which may have undefined behavior.
+- ares_getaddrinfo(): continue to next domain in search if query returns ARES_ENODATA
- The fix now only clears existing servers on success. An additional
- sanity check was added in ares_send() to ensure nservers >= 1 or
- will result in ARES_ESERVFAIL.
+ Some DNS servers may behave badly and return a valid response with no data, in this
+ case, continue on to the next search domain, but cache the result.
- Bug: https://c-ares.haxx.se/mail/c-ares-archive-2018-03/0000.shtml
- Reported-by: Francisco Sedano Crippa
+ Fixes Bug: #426
+ Fix By: Brad House (@bradh352)
-- docs: Not all manpages are listed
+- Allow '/' as a valid character for a returned name
- Some docs aren't installed or not showing up on
- https://c-ares.haxx.se/docs.html
- due to not being listed in Makefile.inc. Add missing docs and
- ensure docs are alphabetized.
-
-Version 1.14.0 (16 Feb 2018)
-
-Daniel Stenberg (16 Feb 2018)
-- ares_android.c: fix warning: ISO C forbids an empty translation unit
+ As of c-ares 1.17.2, a CNAME an in-addr.arpa delegation broke due
+ to not allowing '/'. This needs to be allowed to not break valid
+ functionality.
+
+ Fixes Bug: #427
+ Reported By: Adrian (@leftshift)
+ Fix By: Brad House (@bradh352)
-- RELEASE-NOTES: some more work we did and people who helped
+Daniel Stenberg (5 Oct 2021)
+- libcares.pc.in: update the URL
-Brad House (16 Feb 2018)
-- travis: skip Autotools style testing for cmake
+bradh352 (8 Sep 2021)
+- ares_expand_name should allow underscores (_) as SRV records legitimately use them
- Fix cmake test build by skipping autotools portion of test script.
-
-- travis: standardize CMake test off of Autotools tests
+ c-ares 1.17.2 introduced response validation to prevent a security issue, however
+ it did not have (_) listed as a valid character for domain name responses which
+ caused issues when a CNAME referenced a SRV record which contained underscores.
- Instead of running 'make test', run the tests directly like autotools
- does. It provides more verbose output.
+ While RFC2181 section 11 does explicitly state not to do validation, that applies
+ to servers not clients.
+
+ Fixes: #424
+ Fix By: Brad House (@bradh352)
-- travis: Enable building tests for CMake
+Daniel Stenberg (7 Sep 2021)
+- domain: update to use c-ares.org
- Travis should auto-build and run tests for cmake builds now that
- PR #168 is merged.
+ Closes #423
-- fix version in pkgconfig
+- mailing list: moved to lists.haxx.se
-- Add version update to CMakeLists in maketgz
+GitHub (3 Sep 2021)
+- [Biswapriyo Nath brought this change]
-- Release prep. Add support for pkgconfig in cmake, set versions appropriately
+ CMake: Fix build in cygwin (#422)
+
+ As cygwin environment has both socket.h and winsock2.h headers check WIN32 not to include the later one here
+
+ Fix By: Biswapriyo Nath (@Biswa96)
-Gregor Jasny (15 Feb 2018)
-- CMake: Add tests
+bradh352 (23 Aug 2021)
+- make building more verbose
-Brad House (14 Feb 2018)
-- [Gregor Jasny brought this change]
+- add appveyor cmake/mingw static-only build
- Use cmake3 package provided by Ubuntu (#182)
+GitHub (17 Aug 2021)
+- [Sinan Kaya brought this change]
-- Cmake 3.1 instead of 3.2.1 should be the minimum
+ CMake: lower case advapi32 for cross-building with mingw (#420)
+
+ When cross compiling with yocto's meta-mingw layer, getting a dependency
+ error.
+
+ This is caused by the fact that advapi32 is lower case in mingw builds.
+
+ Fix By: Sinan Kaya
-- Update RELEASE-NOTES and RELEASE-PROCEDURE.md to prepare for next release
+bradh352 (17 Aug 2021)
+- autotools: add ax_check_gnu_make.m4
-- get rid of c++ style comments
+- autotools: add ax_require_defined.m4
-- Use trusty for all builds, precise is EOL. Update clang and cmake versions.
+- autotools: dont use newer AC_CHECK_INCLUDES_DEFAULT, don't quote AC_ERROR_MSG
-- Current CMakeLists.txt doesn't support 2.8.12 anymore, we need to bump the version to 3.2.1 minimum
+- import more files needed by newer ax_code_coverage.m4
-- Re-organize sections in INSTALL.md and add CMake section
+- import more files needed by newer ax_code_coverage.m4
-- [Sergey Kolomenkin brought this change]
+- work around autoreconf -fiv first call returning 'error: too many loops'
- remove compilation warnings in MSVC (#47)
+- restore zz40-xc-ovr.m4
-- document handling of timeouts for ares_process and ares_process_fd to close PR #57
+- autotools: processed configure.ac through autoupdate
-- As per Issue #155, since we do not require gethostname() during init, if it fails, there's no reason for init to fail as it is only used to populate the domain
+- autotools. update ax_code_coverage.m4 to latest. don't use deprecated AC_HELP_STRING
-GitHub (7 Feb 2018)
-- [David Drysdale brought this change]
+- pull out some old autotools cruft
- Document WSAStartup requirement (#180)
+GitHub (17 Aug 2021)
+- [Felix Yan brought this change]
-David Drysdale (6 Feb 2018)
-- [Antonio Tajuelo brought this change]
+ Provide ares_nameser.h as a public interface (#417)
+
+ NodeJS needs ares_nameser.h as a pubic header.
+
+ Fixes: #415
+ Fix By: Felix Yan (@felixonmars)
- Added coderelease.io badge to readme.md for letting people subscribe to new versions (#174)
+- [Felix Yan brought this change]
-- [Sheel Bedi brought this change]
+ Fix building when latest ax_code_coverage.m4 is imported (#418)
+
+ ax_code_coverage.m4 dropped the @CODE_COVERAGE_RULES@ macro, so we need to switch to the latest recommendation from the m4 file. This requires updates to Makefile.am.
+
+ Fix By: Felix Yan (@felixonmars)
- Update year in LICENSE.md to 2018 (#170)
+bradh352 (12 Aug 2021)
+- bump version to match current release
-GitHub (4 Feb 2018)
-- [David Drysdale brought this change]
+GitHub (12 Aug 2021)
+- [dhrumilrana brought this change]
- travis: use VM not container for {L,A}SAN builds (#177)
+ z/OS minor update, add missing semicolon in ares_init.c (#414)
- As per https://github.com/travis-ci/travis-ci/issues/9033, container
- based builds do not currently allow ptrace, which is used by LSAN and
- ASAN.
+ Build fix for z/OS
+
+ Fix by: Dhrumil Rana (@dhrumilrana)
-Brad House (3 Feb 2018)
-- [acthompson-google-com brought this change]
+- [Daniel Bevenius brought this change]
- Android JNI code leaks local references in some cases (#175)
+ add build to .gitignore (#410)
- * Add Google LLC to AUTHORS.
+ This commit adds the build directory to be ignored by git.
- * android: Explicitly delete all JNI local references, and cache JNI method IDs at initialization.
+ The motivation for adding this to .gitignore as opposed to
+ .git/info/exclude is that the CMake example in INSTALL.md uses build
+ as the name of the directory to be used by CMake. This will cause
+ git to report build as an untracked file.
- * android: Only return ARES_ENOTINITIALIZED on failures in initialization code.
+ Fix By: Daniel Bevenius (@danbev)
-Gregor Jasny (2 Jan 2018)
-- Embed fused Google Test 1.8.0
+- [Martin Holeš brought this change]
-Brad House (21 Dec 2017)
-- [John Schember brought this change]
+ Add support for URI(Uniform Resource Identifier) records. (#411)
+
+ Add ares_parse_uri_reply() for parsing URI DNS replies.
+
+ Fix By: Martin Holeš (@martin-256)
- android: Check returns for obj and classes are not NULL. Document API levels for various Android functions and objects used. (#166)
+Daniel Stenberg (10 Aug 2021)
+- ares_getaddrinfo.3: available since 1.16.0
-- CARES_CHECK_TYPE should reference variable so a warning is not produced for -Werror compatibility
+- README.md: use https:// links
-- [Brad Spencer brought this change]
+Version 1.17.2 (24 Jul 2021)
- Fix computation of IPv6 blacklist mask for values of netmask > 8. (#164)
+bradh352 (24 Jul 2021)
+- fix typo
-David Drysdale (14 Dec 2017)
-- travis: Only do coverage/distcheck on normal build
+- prep for 1.17.2 release
-- travis: only do pip install on Linux
+GitHub (30 Jun 2021)
+- [jeanpierrecartal brought this change]
-- travis: only test in IPv4 mode
+ Replace strdup() with ares_strdup() (#408)
- Travis' Trusty environment does not support IPv6.
+ strdup() is used in src/lib/ares_parse_a_reply.c and src/lib/ares_parse_aaaa_reply.c whereas allocated memory is freed using ares_free().
+
+ Bug: 407
+ Fix By: Jean-pierre Cartal (@jeanpierrecartal)
-- test: allow restriction to one IP address family
+- [Brad House brought this change]
-- [Roman Teterin brought this change]
+ Validate hostnames in DNS responses and discard from malicious servers (#406)
+
+ To prevent possible users having XSS issues due to intentionally malformed DNS replies, validate hostnames returned in responses and return EBADRESP if they are not valid.
+
+ It is not clear what legitimate issues this may cause at this point.
+
+ Bug Reported By: philipp.jeitner@sit.fraunhofer.de
+ Fix By: Brad House (@bradh352)
- Fix a typo in init_by_resolv_conf (#160)
+bradh352 (11 Jun 2021)
+- ares_expand_name(): fix formatting and handling of root name response
+
+ Fixes issue introduced in prior commit with formatting and handling
+ of parsing a root name response which should not be escaped.
+
+ Fix By: Brad House
-Brad House (11 Dec 2017)
-- @gvanem says MSVC -RTCc option fails, looks erroneous to me, but the additional mask is harmless
+- ares_expand_name() should escape more characters
+
+ RFC1035 5.1 specifies some reserved characters and escaping sequences
+ that are allowed to be specified. Expand the list of reserved characters
+ and also escape non-printable characters using the \DDD format as
+ specified in the RFC.
+
+ Bug Reported By: philipp.jeitner@sit.fraunhofer.de
+ Fix By: Brad House (@bradh352)
-- Fix some other mingw warnings
+GitHub (15 Apr 2021)
+- [HALX99 brought this change]
-- Issue #143, get rid of windows build warning due to passing 'char **' to argument expecting 'const char **'
+ Fix can't get dns server on macos and ios (#401)
+
+ If DNS configuration didn't include search domains on MacOS (or iOS) it would throw an error instead of ignoring.
+
+ Fix By: @halx99
-- [Gregor Jasny brought this change]
+- [catalinh-bd brought this change]
- Distribute CMake files (#130)
+ Bugfix/crash in ares sortaddrinfo (#400)
+
+ The bug was generated because there was no check for the number
+ of items in the list and invalid memory was accesed when the list
+ was empty. There is a check for null after calling malloc but on
+ some systems it always returns a valid address for size equals 0.
+ Relates To: #392, 0903dcecabca283d0fa771632892dc7592b7a66d
+
+ Fix By: @catalinh-bd
-- Android variants may not have __system_property_get
+bradh352 (2 Mar 2021)
+- Null deref if ares_getaddrinfo() is terminated with ares_destroy()
- Some android systems like ARM64 may not have the __system_property_get
- symbol in libc (but still have it in the public headers). Detect this
- condition at build time. The __system_property_get method of retrieving
- name servers is deprecated as of Oreo so should strictly be a fallback
- mechanism anyhow.
-
-David Drysdale (9 Nov 2017)
-- [David Hotham brought this change]
-
- Wrong function name throughout man page (#154)
-
-- ares_data.c: iterate through substructs when freeing
-
- Previous code recursed into substructures, which makes it more likely
- that large/heavily-nested responses could use up lots of stack.
-
-- test: test ares_free_data on long chain of structs
-
-- [Felix Yan brought this change]
-
- Fix a typo in inet_ntop.c (#151)
-
-Daniel Stenberg (29 Sep 2017)
-- ares_gethostbyname.3: fix callback status values
-
- - ARES_ENOTFOUND means the _name_ wasn't found
+ ares_freeaddrinfo() was not checking for a Null ptr during cleanup of
+ an aborted query.
- - ARES_ENODATA can be returned when a resolve fails
+ Once that was resolved it uncovered another possible issue with
+ multiple simultaneous underlying queries being outstanding and
+ possibly prematurely cleaning up the handle.
- Reported-by: Jakub Hrozek
- Bug: https://c-ares.haxx.se/mail/c-ares-archive-2011-06/0012.shtml
+ Reported By: Michael Kourlas
+ Fix By: Brad House (@bradh352)
-Brad House (28 Sep 2017)
-- [John Schember brought this change]
+GitHub (18 Feb 2021)
+- [Brad House brought this change]
- Fix DNS server lookup breaking with Android O due to Android removing access to net.dns# system properties. (#148)
+ CMake: RANDOM_FILE not defined #397
- As of Android 8 (Oreo) access to net.dns# has been removed (https://developer.android.com/about/versions/oreo/android-8.0-changes.html). The reasoning given is that it, "improves privacy on the platform". Currently c-ares uses this to get the list of DNS servers.
+ RANDOM_FILE was never defined by cmake, causing RC4 key generation to use the less secure rand() method.
- Now the only way to access the DNS server list is by using the Connectivity Manager though Java. This adds the necessary JNI code to use the Connectivity Manager and pull the DNS server list. The old way using __system_property_get with net.dns# remains for compatibilty.
+ Also, due to clashes with chain-building from other projects (e.g. curl) that may define RANDOM_FILE, this was renamed to CARES_RANDOM_FILE.
- Using the Connectivity Manager requires the ACCESS_NETWORK_STATE permission to be set on the app. Existing applications most likely are not setting this and keeping the previous method as a fallback will at the very least ensure those apps don't break on older versions of Android. They will need to add this permission for Android 8 compatibility.
+ This is the proposed change for #396
- Included in the patch are two initalization functions which are required. The JVM must be registered as well as the Connectivity Manager itself. There is no way to get the Connectivity Manager except though Java. Either being passed down to C directly or by passing in an Android Context which can be used to get the Connectivity Manager. Examples are provided in the documentation.
+ Fix By: Brad House (@bradh352)
-- [Konstantinos Sofokleous brought this change]
+- [Anton Danielsson brought this change]
- allow linking against the static msvc runtime library (#133)
+ CMake: fix Make install for iOS/MacOS (#395)
- allow linking against the static msvc runtime library
+ INSTALL TARGETS were missing the BUNDLE DESTINATION
+
+ Fix By: Anton Danielsson (@anton-danielsson)
-- [Gergely Nagy brought this change]
+- [František Dvořák brought this change]
- Force using the ANSI versions of WinAPI functions (#142)
+ Fix build with autotools out of source tree (#394)
- When compiling c-ares with a build system that defines UNICODE,
- bad versions of WinAPI functions are used causing failures or even
- crashes. When windows.h is included in MBCS mode (like in the default
- build system), the ..A versions are the same as using the one without
- any suffix.
+ Add missing include directory, which fixes the build with autotools in separated build directory.
+
+ Fix By: František Dvořák (@valtri)
-- [cmake] build fix on Solaris
+bradh352 (15 Jan 2021)
+- fuzzing: HAVE_CONFIG_H may not be defined so cannot include ares_setup.h. Its not needed even though we include ares_nameser.h
-GitHub (11 Sep 2017)
-- [Brad House brought this change]
+- remove redundant header checks
- Win32 exclude legacy ipv6 subnets (#144)
-
- win32 ipv6: add infrastructure to exclude ipv6 subnets that are known to cause issues
+- properly detect netinet/tcp.h on openbsd
-- [David Drysdale brought this change]
+- more portability updates
- windows: only look for ancient compilers (#146)
-
- Also drop the use of a versioned output directory; just use
- .\msvc
+- renamed nameser.h to ares_nameser.h requires Makefile.inc update for distributed files
-- [David Drysdale brought this change]
+- more portability updates
- ares_init_options.3: match up sock_state_cb args (#141)
-
- Fixes #140
+- remove bad files
-Daniel Stenberg (25 Aug 2017)
-- [Anna Henningsen brought this change]
+- portability updates for test cases
- gethostbyaddr: fail with `ECANCELLED` for `ares_cancel()`
+- Portability Updates for arpa/nameser.h (#388)
- When `ares_cancel()` was invoked, `ares_gethostbyaddr()`
- queries would fail with `ENOTFOUND` instead of `ECANCELLED`.
+ There is too much inconsistency between platforms for arpa/nameser.h and arpa/nameser_compat.h for the way the current files are structured. Still load the respective system files but make our private nameser.h more forgiving.
- It seems appropriate to treat `ares_cancel()` like `ares_destroy()`,
- but I would appreciate review of the correctness of this change.
+ Fixes: #388
+ Fix By: Brad House (@bradh352)
+
+- ares_parse_ptr_reply() handle NULL for addr/addr_len. Fixes #392
- Ref: https://github.com/nodejs/node/issues/14814
+ NodeJS passes NULL for addr and 0 for addrlen parameters to ares_parse_ptr_reply(). On systems where malloc(0) returned NULL, this would cause the function to return ARES_ENOMEM, but the cleanup wasn't handled properly and would crash.
- Closes #138
+ This patche fixes that bug, and also hardens ares_free_hostent() to not leak memory during cleanup.
+
+ Fixes: #392
+ Fix By: Brad House (@bradh352)
-David Drysdale (18 Aug 2017)
-- [David Hotham brought this change]
+- Define behavior of malloc(0)
+
+ Some systems may return either NULL or a valid pointer on malloc(0). c-ares should never call malloc(0) so lets return NULL so we're more likely to find an issue if it were to occur.
- support most recent Visual Studio 2017
+GitHub (24 Dec 2020)
+- [dhrumilrana brought this change]
-Brad House (26 Jul 2017)
-- Preserve original DNS server order on Windows for equal metrics.
+ z/OS: port (#390)
- qsort is not stable, in order to make it stable we need to record
- the original index and add it as a secondary sort value when the
- metrics are equal to prevent using DNS servers that may not work
- at all as reported by some users.
+ Port c-ares to z/OS.
+
+ Fix By: Dhrumil Rana (@dhrumilrana)
-David Drysdale (15 Jul 2017)
-- [Anna Henningsen brought this change]
+- [vburdo brought this change]
- ares_parse_naptr_reply: make buffer length check more accurate
+ Use unbuffered stdio for /dev/urandom to read only requested data (#391)
- 9478908a490a6bf009ba58d81de8c1d06d50a117 introduced a length check
- for records parsed by `ares_parse_naptr_reply()`. However, that
- function is designed to parse replies which also contain non-NAPTR
- records; for A records, the `rr_len > 7` check will fail as there
- are only 4 bytes of payload.
- In particular, parsing ANY replies for NAPTR records was broken
- by that patch.
+ Buffered fread() reads 4096 bytes which is completely unnecessary and potentially may cause problems.
+ I discovered this on private linux configuration where custom /dev/urandom implementation has poor performance.
- Fix that by moving the check into the case in which it is already
- known that the record is a NAPTR record.
+ Fix By: @vburdo
-- appveyor: run dnsdump as a sanity check
+- [Jay Freeman (saurik) brought this change]
-- travis: run dnsdump as a sanity check
+ This relative header #include needs to use quotes. (#386)
+
+ Fix By: Jay Freeman (@saurik)
-- test: use ares_free_string() throughout
+bradh352 (23 Nov 2020)
+- Win32: Fix tools build with autotools static library
+ When c-ares is being built as static on Win32, CARES_STATICLIB must
+ be defined, but it wasn't being pulled in for the tools.
- As pointed out by Gisle Vanem in #125.
+ Fixes: #384
+ Fix By: Brad House (@bradh352)
-Daniel Stenberg (3 Jul 2017)
-- RELEASE-PROCEDURE.md: how to release
+- Loosen requirements for static c-ares library when building tests
- Fixes #115
- Closes #116
+ It appears that when building tests, it would hardcode enabling building
+ of the c-ares static library. This was probably due to Windows limitations
+ in symbol visibility.
+
+ This change will use the static library if it exists for tests, always.
+ Otherwise, it will only forcibly enable static libraries for tests on
+ Windows.
+
+ Fixes: #380
+ Fix By: Brad House (@bradh352)
-David Drysdale (2 Jul 2017)
-- test: Build dnsdump on Windows too
+- Remove legacy comment about ahost/acountry/adig targets
+
+- Distribute fuzzinput/fuzznames for fuzz tests
- Thanks to Gisle Vanem for showing the way:
- https://github.com/c-ares/c-ares/commit/b701af8a24cf9d173b1dbe5faedcea34642e92da#commitcomment-22830845
+ The fuzz test files were not being distributed. This doesn't appear to be
+ a regression, it looks like they have never been distributed.
+
+ Fixes: #379
+ Fix By: Brad House (@bradh352)
-Brad House (26 Jun 2017)
-- [Christian Ammer brought this change]
+Version 1.17.1 (19 Nov 2020)
- fix statement like #define - ares ssize_t define had a trailing semicolon (#120)
+GitHub (19 Nov 2020)
+- [Brad House brought this change]
-David Drysdale (21 Jun 2017)
-- test: distribute the fuzzcheck.sh script
+ Travis: add iOS target built with CMake (#378)
- The TESTS target runs fuzzcheck.sh so make sure it is included
- in the distributed tarball.
+ Issue #377 suggested that CMake builds for iOS with c-ares were broken. This PR adds an automatic Travis build for iOS CMake.
- (The test itself will be pointless when run on a distribution, because
- the fuzzing corpus directories are not shipped, but at least this
- means that `make -C test test` should work.)
+ Fix By: Brad House (@bradh352)
-- test: run the name-parsing corpus check too
+bradh352 (18 Nov 2020)
+- fix build
-Daniel Stenberg (21 Jun 2017)
-- dist: don't build/ship PDF versions in release archives
+GitHub (18 Nov 2020)
+- [Fabrice Fontaine brought this change]
+
+ External projects were using non-public header ares_dns.h, make public again (#376)
- ... experience says very few read them and they can still get build by
- those who want them.a
+ It appears some outside projects were relying on macros in ares_dns.h, even though it doesn't appear that header was ever meant to be public. That said, we don't want to break external integrators so we should distribute this header again.
+
+ Fix By: Fabrice Fontaine (@ffontaine)
-- ares_version.h: bump version
+bradh352 (17 Nov 2020)
+- note that so versioning has moved to configure.ac
-Version 1.13.0 (20 Jun 2017)
+- note about 1.17.1
-Daniel Stenberg (20 Jun 2017)
-- RELEASE-NOTES: 1.13.0
+- fix sed gone wrong
-- ares_set_socket_functions.3: added in 1.13.0
+GitHub (17 Nov 2020)
+- [Daniel Stenberg brought this change]
-David Drysdale (18 Jun 2017)
-- ares_parse_naptr_reply: check sufficient data
+ autotools cleanup (#372)
- Check that there is enough data for the required elements
- of an NAPTR record (2 int16, 3 bytes for string lengths)
- before processing a record.
-
-- test: Feed in short NAPTR
-
-- test: Add fuzz input with short NAPTR
+ * remove: install-sh mkinstalldirs
+
+ They're generated when needed, no need to store in it.
+
+ * buildconf: remove custom logic with autoreconf
+
+ Fix By: Daniel Stenberg (@bagder)
-- test: add ares_parse_naptr_reply to fuzzer
+bradh352 (17 Nov 2020)
+- attempt to fix 1.17.0 release distribution issues
-- [noiz brought this change]
+Version 1.17.0 (16 Nov 2020)
- Update ares.h to support compiling with QNX
+bradh352 (16 Nov 2020)
+- 1.17.0 release prep
-- [Dionna Glaze brought this change]
-
- Simple changes to appease stricter compilers.
+- ares_getaddrinfo(): duplicate hints ai_socktype and ai_protocol into output
- ares_process.c uses htonl, which needs included.
- ares_getnameinfo.c uses a dynamically selected format string for
- sprintf, which -Wformat-literal doesn't like. Usually one would use
- inttypes.h and a format string "%" PRIu32, but C99 is too new for some
- supported platforms.
-
-GitHub (16 Jun 2017)
-- [Gregor Jasny brought this change]
-
- CMake: Emulate interface library on import (#108)
+ ai_socktype and ai_protocol were ignored from the hints input. They are now
+ duplicated into the output as expected. Currently no sanity checks on
+ proper values are taking place.
- Closes: #104
- Signed-off-by: Gregor Jasny
-
-Brad House (6 Jun 2017)
-- [ChristianAmmer brought this change]
+ Fixes: #317
+ Fix By: Brad House (@bradh352)
- Added support for Windows DNS Suffix Search List (#93)
+- ares_parse_{a,aaaa}_reply could return larger *naddrttls than passed in
- This change solves issue #53.
+ If there are more ttls returned than the maximum provided by the requestor, then
+ the *naddrttls response would be larger than the actual number of elements in
+ the addrttls array.
- Support for suffix search lists was already built in for Linux. The search list could be set via set_search. With this change the suffix search list from Windows is read from the registry and then set into the ares configuration via set_search. There are two sources for the search list:
+ This bug could lead to invalid memory accesses in applications using c-ares.
- The global DNS suffix search list.
- The primary and connection specific DNS suffixes if the global is not available.
+ This behavior appeared to break with PR #257
- Contributed by @ChristianAmmer
+ Fixes: #371
+ Reported By: Momtchil Momtchev (@mmomtchev)
+ Fix By: Brad House (@bradh352)
-Daniel Stenberg (25 May 2017)
-- [Thomas Köckerbauer brought this change]
+GitHub (5 Nov 2020)
+- [Dustin Lundquist brought this change]
- configure: do not heck for ar if specified manually
+ docs: ares_set_local_ip4() uses host byte order (#368)
- Closes #62
-
-David Drysdale (23 May 2017)
-- ares_expand_name: limit number of indirections
-
-- test: fuzz input file that takes a while to process
-
-- test: copy data in fuzz regression driver
+ Properly document brain-dead behavior of ares_set_local_ip4() using host byte order instead of expected network byte order.
- Oops.
+ Fix By: Dustin Lundquist
-GitHub (23 May 2017)
-- [David Drysdale brought this change]
+- [Łukasz Marszał brought this change]
- Convert char from ISO-8859-1 to UTF-8 (#99)
+ empty hquery->name could lead to invalid memory access (#367)
- Fixes #97
-
-- [Gregor Jasny brought this change]
+ If hquery->name is empty (=="\0"), &hquery->name[strlen(hquery->name)-1] would point to "random" place in memory. This is causing some of my address sanitizer tests to fail.
+
+ Fix By: Łukasz Marszał (@lmarszal)
- travis: Use trusty for cmake builds (#109)
+bradh352 (28 Sep 2020)
+- Fix OSSFuzz reported issue in CAA reply parsing
- kubuntu-backports dropped the CMake package for Precise
+ OSS-Fuzz is reporting a use-of-uninitialized-value:
+ https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=26012
+
+ Reported By: David Drysdale (@daviddrysdale)
-David Drysdale (2 May 2017)
+GitHub (26 Sep 2020)
- [David Hotham brought this change]
- msvc_ver.inc support most recent Visual Studio 2017 (#101)
-
-- test: use io.h not unistd.h for Windows
-
-- test: try building fuzz binaries on Windows
-
-- test: stick to int in ares-fuzz.c
+ fuzz CAA parsing (#363)
- Using int rather than ares_ssize_t means this file
- needs no c-ares dependency - it's a general driver for
- any libFuzzer-style entrypoint.
+ Add fuzz support for CAA parsing
+
+ Fix By: David Hotham (@dimbleby)
-- test: force ARES_OPT_NOROTATE for no-rotate tests
+- [Daniela Sonnenschein brought this change]
-- test: check expected NOROTATE value
+ Allow parsing of CAA Resource Record (#360)
+
+ CAA (Certification Authority Authorization) was introduced in RFC 6844.
+ This has been obsoleted by RFC 8659. This commit added the possibility
+ to query CAA resource records with adig and adds a parser for CAA
+ records, that can be used in conjunction with ares_query(3).
+
+ Closes Bug: #292
+ Fix By: Daniela Sonnenschein (@lxdicted)
-- ares_create_query: use ares_free not naked free
+Daniel Stenberg (17 Sep 2020)
+- docs: remove the html and pdf make targets
- Accidentally added in commit 65c71be1cbe5
- ("ares_create_query: avoid single-byte buffer overwrite")
+ They're rarely used in our daily work flow and mostly just add friction,
+
+ Closes #362
-Brad House (17 Mar 2017)
-- Need ares.h for ares_ssize_t
+bradh352 (14 Sep 2020)
+- ares_process needs to always include nameser.h as it has compat
-- tests should not use ssize_t, use ares_ssize_t
+- Define T_OPT if system doesn't provide it
-GitHub (16 Mar 2017)
-- [Brad House brought this change]
+GitHub (12 Sep 2020)
+- [Gisle Vanem brought this change]
- Portability updates for legacy systems. (#92)
+ Change the mailman links (#358)
- Socklen_t should not be used in code, instead ares_socklen_t should be used.
- Convert ssize_t to ares_ssize_t for portability since the public API now exposes this.
+ Links when wrapping become misleading. Insert newline to prevent wrapping.
+
+ Fix By: Gisle Vanem (@gvanem)
-David Drysdale (14 Mar 2017)
-- [Michael Osei brought this change]
+- [Gisle Vanem brought this change]
- Update msvc_ver.inc (#91)
+ [adig] Update man-page for the '-x' option (#357)
- For Visual Studio 2017 builds
+ Fix By: Gisle Vanem (@gvanem)
-Daniel Stenberg (13 Mar 2017)
-- [Brad House brought this change]
+- [Gisle Vanem brought this change]
- Windows DNS server sorting (#81)
-
- Original Patch From Brad Spencer:
- https://c-ares.haxx.se/mail/c-ares-archive-2016-04/0000.shtml
-
- My modifications include:
- * Dynamically find GetBestRoute2 since it is a Windows Vista+ symbol, and will fall back to prior behavior when not available.
- * Prefer get_DNS_AdaptersAddresses as the modifications should alleviate the concerns which caused us to prefer get_DNS_NetworkParams
- * Update AppVeyor to use MinGW-w64 instead of the legacy MinGW
- * Fix compile error in test suite for Windows.
-
- Original message from patch below:
+ [adig] add '-x' option. (#356)
- From: Brad Spencer
- Date: Fri, 29 Apr 2016 14:26:23 -0300
+ Added a 'dig-style' '-x' option. Also support '-xx' for a
+ IPv6 bit-string PTR query.
- On Windows, the c-ares DNS resolver tries first to get a full list of
- DNS server addresses by enumerating the system's IPv4/v6 interfaces and
- then getting the per-interface DNS server lists from those interfaces
- and joining them together. The OS, at least in the way the c-ares
- prefers to query them (which also may be the only or best way in some
- environments), does not provide a unified list of DNS servers ordered
- according to "current network conditions". Currently, c-ares will then
- try to use them in whatever order the nested enumeration produces, which
- may result in DNS requests being sent to servers on one interface
- (hosting the current default route, for example) that are only intended
- to be used via another interface (intended to be used when the first
- interface is not available, for example). This, in turn, can lead to
- spurious failures and timeouts simply because of the server address
- order that resulted because of the enumeration process.
+ Fix By: Gisle Vanem (@gvanem)
+
+bradh352 (12 Sep 2020)
+- fix indentation
+
+- ns_t_opt -> T_OPT
+
+GitHub (12 Sep 2020)
+- [Gisle Vanem brought this change]
+
+ Fixes for Watt-32 on djgpp + Windows (#355)
- This patch makes the (safe?) assumption that there is no other better
- rule to chose which interface's DNS server list should be prioritized.
- After all, a DNS lookup isn't something "per network"; applications
- don't look up "these DNS names on this interface and those DNS names on
- that interface". There is a single resource pool of DNS servers and the
- application should presume that any server will give it the "right"
- answer. However, even if all DNS servers are assumed to give equally
- useful responses, it is reasonable to expect that some DNS servers will
- not accept requests on all interfaces. This patch avoids the problem by
- sorting the DNS server addresses using the Windows IPv4/v6 routing tables.
+ No longer any relation to libcurl since '/packages/DOS/common.dj' is dropped.
+ This Makefile.dj has been tested on Win-10 only (using the Windows hosted djgpp cross compiler).
- For example, a request to DNS server C on interface 2 that is actually
- sent over interface 1 (which may happen to have the default route) may
- be rejected by or not delivered to DNS server C. So, better to use DNS
- servers A and B associated with interface 1, at least as a first try.
+ Fix By: Gisle Vanem (@gvanem)
+
+- [Gisle Vanem brought this change]
+
+ Fixes for Watt-32 on Windows and MSDOS (#354)
- By using the metric of the route to the DNS server itself as a proxy for
- priority of the DNS server in the list, this patch is able to adapt
- dynamically to changes in the interface list, the DNS server lists per
- interface, which interfaces are active, the routing table, and so on,
- while always picking a good "best" DNS server first.
+ Move the prototype to 'ares_private.h'.
- In cases where any DNS server on any interface will do, this patch still
- seems useful because it will prioritize a lower-metric route's (and thus
- interface's) servers.
-
-David Drysdale (22 Feb 2017)
-- [Sergii Pylypenko brought this change]
+ Fix By: Gisle Vanem (@gvanem)
- docs: fixed references to ares_set_local_ip4 and ares_set_local_ip6
+bradh352 (11 Sep 2020)
+- update path for include
-- [Calle Wilund brought this change]
+- remove stale information
- ares test: fix win32 build errors with virtual socket function tests
-
- The added api requires both some typedefs not previously imported
- into the test build + the test code did not fully deal with
- socket differences on windows.
+- remove stale information
-- [Calle Wilund brought this change]
+Brad House (9 Sep 2020)
+- silence compiler warnings
- ares_process: fix return type of socket_create function (win32 warning)
+- Remove stale msvc files from makefile
-Daniel Stenberg (31 Jan 2017)
-- [Calle Wilund brought this change]
+GitHub (9 Sep 2020)
+- [Brad House brought this change]
- ares_set_socket_functions: Add man page
+ Reorganize source tree (#349)
- Providing some rudimentary documentation for the added functionality
+ Originally started by Daniel Stenberg (@bagder) with #123, this patch reorganizes the c-ares source tree to have a more modern layout. It also fixes out of tree builds for autotools, and automatically builds the tests if tests are enabled. All tests are passing which tests each of the supported build systems (autotools, cmake, nmake, mingw gmake). There may be some edge cases that will have to be caught later on for things I'm not aware of.
- Closes #72
-
-- [Calle Wilund brought this change]
+ Fix By: Brad House (@bradh352)
- ares-test: Add test helpers and cases for virtual socket IO
-
- * Added test case macro to automatically run tests twice, once "normal",
- once with virtual IO.
- * Changed most "live" query tests to run in dual mode to verify
- at least simple socket IO via virtual functions
- * Added test case for settings/duping socket functions & callback data
+Brad House (1 Sep 2020)
+- remove CURLDEBUG as per #82
-- [elcallio brought this change]
+GitHub (1 Sep 2020)
+- [Erik Lax brought this change]
- Implement using virtual socket IO functions when set
+ Detect remote DNS server does not support EDNS as per RFC 6891 (#244)
- Uses virtual socket IO functions when set on a channel.
- Note that no socket options are set, nor is any binding
- done by the library in this case, since the client defining
- these is probably more suited to deal with this.
-
-- [elcallio brought this change]
-
- Add virtual function set for socket IO
+ EDNS retry should be based on FORMERR returned without an OPT RR record as per https://tools.ietf.org/html/rfc6891#section-7 rather than just treating any unexpected error condition as a reason to disable EDNS on the channel.
- Defines a structure of basic create, close, read/write
- functions as virtual function calls, settable for individual
- c-ares channels.
-
-David Drysdale (30 Jan 2017)
-- test: ignore aresfuzzname binary
+ Fix By: Erik Lax (@eriklax)
-Gregor Jasny (14 Jan 2017)
-- [Stephen Sorley brought this change]
+Brad House (27 Aug 2020)
+- Fix for #345, don't use 'true' use 1
- Always use check_symbol_exists instead of check_function_exists.
+GitHub (27 Aug 2020)
+- [Seraphime Kirkovski brought this change]
-- Also add includes to TARGETS_INST_DEST
+ ares_gethostbyname: Fix AF_UNSPEC support when using an ip address (#204)
+
+ fake_hostent() was not supporting AF_UNSPEC, so when an ip address was specified when using AF_UNSPEC it would attempt to do a DNS lookup rather than returning a fake hostent using the ip address.
+
+ Fix By: Seraphime Kirkovski (@Seraphime)
-- [Stephen Sorley brought this change]
+- [apenn-msft brought this change]
- Windows build fixes
+ Tests should use dynamic system-assigned ports rather than static port (#346)
+
+ The c-ares test suite was hardcoded to use port 5300 (and possibly 5301, 5302) for the test suite. Especially in containers, there may be no guarantee these ports are available and cause tests to fail when they could otherwise succeed. Instead, request the system to assign a port to use dynamically. This is now the default. To override, the test suite still takes the "-p " option as it always has and will honor that.
+
+ Fix By: Anthony Penniston (@apenn-msft)
-- CMake: Export targets
+Brad House (25 Aug 2020)
+- Unset members of the addr struct contain garbage values (#343)
+
+ When generating the ares_sockaddr data by getaddrinfo() it was only filling
+ in certain members while leaving others uninitialized. This left garbage
+ data if a user tried to use the unset values. memset() the ares_sockaddr
+ to 0 prior to filling in the values to prevent this.
+
+ Reported By: @SmorkalovG
+ Fix By: Brad House (@bradh352)
-- CMake: Use GNUInstallDirs for install location defaults
+GitHub (24 Aug 2020)
+- [Jonathan Maye-Hobbs brought this change]
-David Drysdale (11 Jan 2017)
-- Update Makefile.am for renamed INSTALL.md
+ FQDN with trailing period should be queried first with larger ndot value (#345)
+
+ If a query is performed for dynamodb.us-east-1.amazonaws.com. with ndots=5, it was attempting to search the search domains rather than just attempting the FQDN that was passed it. This patch now at least attempts the FQDN first.
+
+ We may need to determine if we should abort any further searching, however as is probably intended.
+
+ Fix by: Jonathan Maye-Hobbs (@wheelpharoah)
-GitHub (11 Jan 2017)
-- [David Drysdale brought this change]
+- [Gisle Vanem brought this change]
- docs: convert INSTALL to MarkDown & tweak (#83)
+ Update acountry.c country code list (#341)
+
+ Updated country_list[]:
+ * 2-letter ISO-3166 country-codes.
+ * Add, rename some names + codes in accordance with latest table at https://en.wikipedia.org/wiki/ISO_3166-1.
+
+ Fix By: Gisle Vanem (@gvanem)
-- [Gregor Jasny brought this change]
+- [Bulat Gaifullin brought this change]
- Merge pull request #77 from stephen-sorley/cmake_modernize
+ Test case should honor flag HAVE_WRITEV rather than WIN32 (#344)
- Updated CMake minimum version to 2.8.12.
+ Test cases where not honoring the HAVE_WRITEV flag but instead using WIN32 to determine if WRITEV was available or not. This patch fixes that.
+
+ Fix By: Bulat Gaifullin (@bgaifullin)
-Stephen Sorley (4 Jan 2017)
-- Changed executables to depend directly on internal libcares target, instead of against
- the external-facing alias targets.
+Brad House (18 Jul 2020)
+- Ensure c89 support
+
+ A couple of for loops in Mac-specific code were using integer declarations
+ inside a for loop. Move the declaration to the top of the preceding
+ code block to retain c89 compliance.
+
+ Reported By: Jeffrey Walton
-- Updated Travis to pull CMake 2.8.12 from kubuntu-backports ppa.
+GitHub (2 Jul 2020)
+- [Fionn Fitzmaurice brought this change]
-- Updated CMake minimum version to 2.8.12.
+ Avoid buffer overflow in RC4 loop comparison (#336)
- Changed the way usage requirements (include dirs, compile defs, dependent libraries) are specified, to match the recommended standard practice for modern CMake. This involves using target-specific functions (target_include_directories, target_compile_definitions, etc.), along with the PUBLIC, PRIVATE or INTERFACE modifiers.
+ The rc4 function iterates over a buffer of size buffer_len who's maximum
+ value is INT_MAX with a counter of type short that is not guaranteed to
+ have maximum size INT_MAX.
- Updated chain-building support to imitate new-style Find modules (import libs), instead of old-style Find modules (cache variables).
+ In circumstances where short is narrower than int and where buffer_len
+ is larger than the maximum value of a short, it may be possible to loop
+ infinitely as counter will overflow and never be greater than or equal
+ to buffer_len.
+
+ The solution is to make the comparison be between types of equal width.
+ This commit defines counter as an int.
+
+ Fix By: Fionn Fitzmaurice (@fionn)
-David Drysdale (26 Dec 2016)
-- [Chris Araman brought this change]
+- [anonymoushelpishere brought this change]
- configure: clock_gettime workaround (#75)
+ Updated help information for adig, acountry, and ahost. (#334)
- Commits 7518c26, c41726b, and bc14ee7 brought this workaround to the CMake build system. This expands it to the autoconf build system.
+ Provide more descriptive help information for various utilities.
- Fixes #71
+ Fix By: @anonymoushelpishere
-- test: add fuzz entrypoint for ares_create_query()
+- [lutianxiong brought this change]
-- test: Add gTest/gMock files to SOURCES
+ avoid read-heap-buffer-overflow (#332)
- Built tarballs are not including all of the files needed
- to build the test suite because they are missing from the
- _SOURCES variable in Makefile.am.
-
-- travis: Move build scripts under travis/
+ Fix invalid read in ares_parse_soa_reply.c found during fuzzing
- Travis doesn't always propagate errors in inline multi-line
- scripts, so move them all to be explicit shell scripts, each
- with set -e.
+ Fixes Bug: #333
+ Fix By: lutianxiong (@ltx2018)
-- travis: check distributed tarball builds
+- [Ivan Baidakou brought this change]
-Daniel Stenberg (25 Oct 2016)
-- dist: ship msvc_ver.inc too
+ Fix: sizeof(sizeof(addr.saX)) -> sizeof(addr.saX) in readaddrinfo (#331)
- Reported-by: Bruce Stephens
+ Looks like a sed-gone-wrong, a sizeof inside of a sizeof.
- Fixes #69
-
-- [Aaron Bieber brought this change]
+ Fix By: Ivan Baidakou (@basiliscos)
- fix build on OpenBSD
+Version 1.16.1 (11 May 2020)
-- ares_version.h: bump, working on 1.12.1 now
+Brad House (11 May 2020)
+- c-ares 1.16.1 release prep
-GitHub (18 Oct 2016)
-- [Gregor Jasny brought this change]
+- update travis to use xcode11.4
- Merge pull request #64 from bradh352/master
+- Prevent possible double-free in ares_getaddrinfo() if ares_destroy() is called
- Add CMake build system support to C-Ares.
+ In the event that ares_destroy() is called prior to ares_getaddrinfo() completing,
+ it would result in an invalid read and double-free due to calling end_hquery() twice.
+
+ Reported By: Jann Horn @ Google Project Zero
-Brad House (5 Oct 2016)
-- suggested PROJECT_NAME change broke chain building as it needs the magic PROJECT_NAME set in the ADD_LIBRARY for matching. Fix to make both goals work
+GitHub (30 Apr 2020)
+- [shelley vohr brought this change]
-- update MacOSX 10.12 detection
+ fix: windows UNICODE incompatibilities with ares_getaddrinfo (#328)
+
+ Fixes the following compatibility issues:
+ * Use RegQueryValueExA instead of RegQueryValueEx
+ * Use ExpandEnvironmentStringsA instead of ExpandEnvironmentStrings
+ * Use RegOpenKeyExA instead of RegOpenKeyExA
+ * Use GetWindowsDirectoryA instead of GetWindowsDirectoryA
+
+ Fix By: Shelley Vohr (@codebytere)
+ Closes: #327
-- Expand XCode clock_gettime fix to include MacOS 10.12, not just iOS10
+Brad House (13 Apr 2020)
+- travis: CloudFlare does not allow T_ANY requests, so live tests that use it fail. Disable.
-David Drysdale (4 Oct 2016)
-- Revert "travis: work around bug in PyCParser"
-
- This reverts commit a24a10a348fc00b8cfd684d91894a1df14880ea9.
+- travis: bump macos image to the latest
-- travis: work around bug in PyCParser
+- cast-align warnings are false for struct sockaddr, silence
- See https://github.com/pyca/cryptography/issues/3187
+ Create a macro to silence false cast-align warnings when casting
+ struct sockaddr * to struct sockaddr_in * and struct sockaddr_in6 *.
+
+ Fix By: Brad House (@bradh352)
-Brad House (3 Oct 2016)
-- PROJECT_SOURCE_DIR instead of CMAKE_CURRENT_SOURCE_DIR as per @gjasny
+- MacOS: Enable libresolv support for retrieving DNS servers like iOS does.
-- use a project name of c-ares as per @gjasny
+GitHub (10 Apr 2020)
+- [Dmitry Igrishin brought this change]
-- Import curl conversion of Makefile.inc to cmake form dynamically as per bdoetsch@ameritech.net to make maintaining multiple build systems easier
+ CMake: Populate the INCLUDE_DIRECTORIES property of installed targets (#323)
+
+ Populate the INCLUDE_DIRECTORIES property of installed targets
+
+ Fix By: Dmitry Igrishin (@dmitigr)
-Daniel Stenberg (30 Sep 2016)
-- dist: add ares_library_initialized.* to the tarball
+Brad House (10 Apr 2020)
+- travis: make valgrind use cmake for tests
-David Drysdale (30 Sep 2016)
-- test: check ares_create_query with too-long name
+- dont try to use libtool to run valgrind
-Daniel Stenberg (30 Sep 2016)
-- man pages: minor formatting edits
+- valgrind requires libtool installed to wrap tests
-Brad House (29 Sep 2016)
-- merge fc7917e from @daviddrysdale ... travis build updates for cmake
+- scan build 7
-- cleanups as per @gjasny ... Use naked IF statements and use NOT DEFINED
+- fix travis live test
-Version 1.12.0 (29 Sep 2016)
+- add debug for travis
-Daniel Stenberg (29 Sep 2016)
-- RELEASE-NOTES: 1.12.0
+- try without sudo
-- [David Drysdale brought this change]
+- attempt to modernize travis build environment
- ares-test-misc: test ares_create_query with escaped trailing dot
+GitHub (6 Apr 2020)
+- [Teemu R brought this change]
-- ares_create_query: avoid single-byte buffer overwrite
+ Allow TXT records on CHAOS qclass (#321)
- ... when the name ends with an escaped dot.
+ Some DNS servers intentionally "misuse" the obsoleted CHAOS (CH) qclass to provide things like `version.bind`, `version.server`, `authors.bind`, `hostname.bind` and `id.server`.
- CVE-2016-5180
+ C-ares was not allowing such use cases.
- Bug: https://c-ares.haxx.se/adv_20160929.html
+ Fix By: Teemu R. (@rytilahti)
-Brad House (29 Sep 2016)
-- CMake: Unify library versioning with the libtool methodology to make keeping library versions in sync easier with the autotools build system
+Brad House (5 Apr 2020)
+- Remove warnings from ares_getaddrinfo.3 man page
+
+ As reported in #319, non-standard macros of .IN were used.
+ Replace with .RS/.RE.
+
+ Fixes: #319
+ Fix By: Brad House (@bradh352)
-Daniel Stenberg (29 Sep 2016)
-- ares_library_initialized.3: added
+- ares_getaddrinfo man page render better for man2html
-- make: bump CARES_VERSION_INFO for release
+- update man pages to render better for man2html
-David Drysdale (29 Sep 2016)
-- man: update ares_init_options.3
+Version 1.16.0 (12 Mar 2020)
-Daniel Stenberg (29 Sep 2016)
-- ares_library_init.3: corrected the ares_library_init_mem proto
+Brad House (12 Mar 2020)
+- 1.16.0 release notes draft
-Brad House (28 Sep 2016)
-- XCode v8 introduced clock_gettime() for iOS v10. However, it is a weak symbol, which means when earlier iOS versions try to use clock_gettime() it results in a crash due to the missing symbol. Detect this condition and do not set HAVE_CLOCK_GETTIME_MONOTONIC.
+- attempt to fix double-free introduced in e0517f9
-- Adds cmake build system support to C-Ares.
+GitHub (12 Mar 2020)
+- [David Drysdale brought this change]
+
+ test: fuzzer input triggering double free (#315)
- The patch does not modify any source files, it only adds 3 new files
- (CMakelists.txt, ares_build.h.cmake, ares_config.h.cmake) which form the
- build system. I've tried to go through as much of the autotools tests and
- extracted what I thought was appropriate, though many of the tests aren't
- as in-depth in CMake as they are for autotools ... it is unclear why some
- of them exist at all, I'm guessing for legacy systems that CMake probably
- doesn't support anyhow.
+ OSS-Fuzz has reported a double-free with the fuzzer input file
+ included here; run with:
+ ./test/aresfuzz test/fuzzinput/clusterfuzz-5637790584012800
- Building the library, and examples (adig, ahost, acountry) plus installation
- should work across a large number of tested platforms. The tests have not
- yet been integrated.
+ Bisecting the failure points to commit e0517f97d988 ("Parse SOA records
+ from ns_t_any response (#103)")
-Daniel Stenberg (27 Sep 2016)
-- README.md: remove space from link
+- [Brad House brought this change]
-- README: link to the correct c-ares badge!
+ CMake: Install Manpages (#314)
- Reported-by: David Hotham
+ CMake wasn't installing manpages.
- Fixes #63
+ Fixes #297
+ Fix By: Brad House (@bradh352)
-- docs: minor formatting edits
+- [Brad House brought this change]
-- ares_destroy.3: formatting polish
+ Enable cmake tests for AppVeyor (#313)
+
+ Tests require linking against the static library on Windows otherwise the symbols are not exported for internals being tested.
+
+ Fix By: Brad House (@bradh352)
-- ares_init.3: split the init docs into two separate man pages
+Brad House (11 Mar 2020)
+- Add AppVeyor badge
-- SECURITY: point to the vulnerabilities page now
+- bump c-ares version to 1.16.0. test AppVeyor integration.
-- RELEASE-NOTES: synced with daa7235b1a5
+GitHub (11 Mar 2020)
+- [Brad House brought this change]
-- ares_create_query.3: edit language
+ replace all usages of inet_addr() with ares_inet_pton() which is more proper (#312)
- Tried to make the man page more readable.
-
-David Drysdale (26 Sep 2016)
-- test: fix gMock to work with gcc >= 6.x
+ Replace usage of inet_addr() with ares_inet_pton() which is more appropriate and fixes issues with legitimate addresses like 255.255.255.0. IPv6 already used this.
- Taken from:
- https://github.com/google/googletest/issues/705#issuecomment-235067917
+ Fixes #309
+ Fix By: Brad House (@bradh352)
-Daniel Stenberg (26 Sep 2016)
- [Brad House brought this change]
- headers: remove checks for and defines of variable sizes
+ CMake: Generate WinPDB files during build (#311)
- ... they're not really used and by avoiding them in the ares_build.h
- output we make the public header less dependent on data sizes.
-
-David Drysdale (24 Sep 2016)
-- api: add ARES_OPT_NOROTATE optmask value
+ Build and Install PDB (Windows Debug Symbol) files if supported by underlying system.
- Fix up a couple of problems with configuring whether c-ares rotates
- between different name servers between requests.
+ Also update AppVeyor to test cmake builds.
- Firstly, ares_save_options() returns (in *optmask) the value of
- (channel->optmask & ARES_OPT_ROTATE), which doesn't necessarily
- indicate whether the channel is or is not actually doing rotation.
- This can be confusing/incorrect if:
- - the channel was originally configured without ARES_OPT_ROTATE
- (so it appears that the channel is not rotating)
- - the /etc/resolv.conf file includes the 'rotate' option
- (so the channel is actually performing rotation).
+ Fixes #245
+ Fix By: Piotr Pietraszkiewicz (@ppietrasa) and Brad House (@bradh352)
+
+- [Brad House brought this change]
+
+ CMake: Rework library function checking (#310)
- Secondly, it is not possible to reliably configure a channel
- to not-rotate; leaving off ARES_OPT_ROTATE is not enough, since
- a 'rotate' option in /etc/resolv.conf will turn it on again.
+ CHECK_LIBRARY_EXISTS(), while it takes a function name, does not actually verify the function exists in the library being evaluated. Instead, if the function is found in any dependent library, and the referenced library also exists, it returns true. This is not desirable.
- Therefore:
- - add an ARES_OPT_NOROTATE optmask value to allow explicit
- configuration of no-rotate behaviour
- - in ares_save_options(), report the value of channel->rotate
- as exactly one of (optmask & ARES_OPT_ROTATE) or
- (optmask & ARES_OPT_NOROTATE).
+ Wrap with a Macro to change the behavior.
- In terms of back-compatibility:
- - existing apps that set ARES_OPT_ROTATE will continue to rotate,
- and to have ARES_OPT_ROTATE reported back from ares_save_options()
- - existing apps that don't set ARES_OPT_ROTATE will continue to
- use local config/defaults to decide whether to rotate, and will
- now get ARES_OPT_ROTATE or ARES_OPT_NOROTATE reported back from
- ares_save_options() rather than 0.
+ Fixes: #307
+ Fix By: Brad House (@bradh352)
-- ares_init_options: only propagate init failures from options
-
- Commit 46bb820be3a8 ("ares_init_options: don't lose init failure")
- changed init behaviour so that earlier errors in initialization
- weren't lost. In particular, if the user passes in specific
- options but they are not applied (e.g. because of an allocation
- failure), that failure needs to be reported back to the user; this
- also applies when duplicating a channel with ares_dup().
+- [Dron Rathore brought this change]
+
+ Parse SOA records from ns_t_any response (#103)
- However, other initialization failures can be ignored and
- overridden -- in particular, if init_by_resolv_conf() or
- init_by_environment() fail, then falling back to default values
- is OK.
+ Added the capability of parsing SOA record from a response buffer of ns_t_any type query, this implementation doesn't interfere with existing T_SOA query's response as that too is treated as a list of records. The function returns ARES_EBADRESP if no SOA record is found(as per RFC).
- So only preserve failures from the init_by_options() stage, not
- from all initialization stages.
+ The basic idea of sticking to RFC that a ns_t_any too should return an SOA record is something open for discussion but I have kept the functionality intact as it was previously i.e the function returns ARES_EBADRESP if it doesn't find a SOA record regardless of which response it is parsing i.e. T_SOA or T_ANY.
- Fixes issue 60.
-
-- test: Force reinstall of libtool on OSX
+ Note that asking for T_ANY is generally a bad idea:
+ - https://blog.cloudflare.com/what-happened-next-the-deprecation-of-any/
+ - https://tools.ietf.org/html/draft-ietf-dnsop-refuse-any
- Travis build environment appears to have changed.
+ Bug: #102
+ Fix By: Dron Rathore (@DronRathore)
-- test: Add valgrind build variant
+- [Stephen Bryant brought this change]
-- test: Add null pointer to gtest args
+ Added CPack functionality for generating RPM or DEB packages (#283)
- GoogleTest assumes that there is a null pointer in argv[argc],
- so make it look like that. Without this change, tests run with
- command-line arguments get memory errors under valgrind/ASAN.
-
-Daniel Stenberg (21 Aug 2016)
-- AUTHOR: maybe gitgub isn't really an author =)
+ Added CPack functionality for generating RPM or DEB packages
+
+ ie: run `cpack -G RPM` (or "DEB") after building with CMake.
+
+ The current configuration creates 3 separate packages for the shared library,
+ the development files and the tools.
+
+ Fix By: Stephen Bryant (@bf-bryants)
-- AUTHORS: added contributors from the git log
+- [tjwalton brought this change]
-- LICENSE.md: add a stand-alone license file
+ ares_gethostbyname: Return ENODATA if no valid A or AAAA record found (#304)
- Just the MIT license used in the top the source files moved out to a
- stand-alone file for easier reference and discovery.
-
-- README: added "CII best practices" badge
+ ares_gethostbyname() was returning ESUCCESS when no A or AAAA record was found but a CNAME pointing nowhere was present. ENODATA should be returned instead, however the hosts pointer will still be present to provide the alias list.
+
+ * Return ENODATA if no valid A or AAAA record found
+ * Fix and update test ParseAReplyNoData.
+ * Add test for new ENODATA behaviour in ares_gethostbyname.
+
+ Fixes Bug #303
+ Fix By: @tjwalton
-- SECURITY.md: suggested "security process" for the project
+- [Michal Rostecki brought this change]
-David Drysdale (17 Aug 2016)
-- test: Add Clang static analysis build to Travis
+ test: Separate live tests from SetServers* tests (#299)
- Run scan-build over the library source code, but skip the
- tests. Needs a later Clang install in Travis
-
-- test: more info on how to run fuzz testing
+ Before this change, SetServers, SetServersPorts and SetServersCSV
+ contained test cases trying to make DNS queries with the google.com
+ hostname, which requires Internet connectivity. Tests with that
+ requirement should be defined in the ares-test-live.cc file and contain
+ "Live" prefix to filter them out with `--gtest_filter=-*.Live*` on
+ machines without Internet connectivity.
+
+ Fix By: Michal Rostecki (@mrostecki)
-- test: make fuzzer driver code C not C++
+- [Adam Majer brought this change]
-- test: fuzzer mode for AFL's persistent mode
+ Only count valid addresses when response parsing (#302)
- When fuzzing with AFL, if the LLVM-based instrumentation is
- used (via the afl-clang-fast wrapper), then it is possible to
- have a single execution of the fuzzer program iterate multiple
- times over the fuzzing entrypoint (similar to libFuzzer's normal
- mode of execution) with different data. This is much (e.g. 10x)
- faster.
+ When ares_parse_a_reply or ares_parse_aaaa_reply is called in case
+ where another AAAA and A responses exist, the resulting ares_addrttl
+ count is invalid and the structure points to gibberish.
- Add code to support this, by checking whether __AFL_LOOP is
- defined at compile-time.
+ This is a regression since 1.15.
- Also, shift the code to effectively be C rather than C++.
+ Issue: https://github.com/c-ares/c-ares/issues/300
+ Fix By: Adam Majer (@AdamMajer)
-- test: simplify deps for fuzzer entrypoint
+Brad House (24 Dec 2019)
+- [Kyle Edwards brought this change]
+
+ CMake: Provide c-ares version in package export file (#296)
- No need to depend on the rest of the test code (ares-test.h) for
- the fuzzer entrypoint; this makes the entrypoint slightly simpler
- to build with LLVM's libFuzzer.
+ The CMake package export file should provide version information.
- Also shift the code to effectively be C rather than C++
+ Fix By: Kyle Edwards (@KyleFromKitware)
-- test: disable MinGW tests
+- [Ben Noordhuis brought this change]
+
+ Accept invalid /etc/resolv.conf lookup values, ability to build container tests (#274)
- The test binary built in the MinGW build is failing for some
- reason. It works for me when I build locally, so I'm guessing
- it's down to some sort of AppVeyor environment issue.
+ * Add CARES_BUILD_CONTAINER_TESTS CMake option to add ability to build the Linux-only containerized tests.
+ * Accept invalid /etc/resolv.conf lookup values
- Disable for now.
-
-Daniel Stenberg (16 Aug 2016)
-- read_tcp_data: remove superfluous NULL check
+ Before this commit invalid `lookup` values resulted in c-ares not using
+ any lookups without any clear indication why. After this commit it uses
+ the default "fb".
- CID 56884 by Coverity. The pointer is already derefenced before this
- point so it can't be NULL here anyway.
-
-- web: http => https
+ Fix By: Ben Noordhuis (@bnoordhuis)
-GitHub (20 Jul 2016)
-- [David Drysdale brought this change]
+- [Christian Ammer brought this change]
- Merge pull request #59 from fuze/master
+ Parallel A and AAAA lookups in `ares_getaddrinfo` (#290)
- Update msvc_ver.inc for VS2015 Update 3
+ A and AAAA lookups for ares_getaddrinfo() are now performed in parallel.
+
+ For this change `ares_search` was removed from `ares_getaddrinfo`.
+ Instead `ares_query` in combination with `next_dns_lookup` are
+ doing the suffix search.
+
+ Adding support for `.onion` addresses which are tested by
+ `TEST_F(DefaultChannelTest, GetAddrinfoOnionDomain)`
+
+ Fix By: Christian Ammer (@ChristianAmmer)
-- [Chris Araman brought this change]
+- [Vy Nguyen brought this change]
- Update msvc_ver.inc
+ Move variables into the block where it is used to avoid unused-vars (#281)
- support Visual Studio 2015 Update 3
-
-David Drysdale (2 May 2016)
-- Fix trailing comment for #endif
+ Warning uncovered with [-Werror, -Wunused-variables]
+
+ Fix By: Vy Nguyen (@oontvoo)
-Daniel Stenberg (30 Apr 2016)
-- email: use Gisle's "new" address
+- [Vy Nguyen brought this change]
-David Drysdale (18 Apr 2016)
-- test: drop superfluous fuzz inputs
+ Rename local macros to avoid conflicting with system ones and remove unsed variables. (Otherwise code will break once compiled with [-Werror,-Wmacro-redefined,-Wunused-variable] ) (#280)
- Where there are multiple fuzz input files that only differ in
- the first two bytes (the query ID), just keep the first such
- file.
-
-svante karlsson (15 Apr 2016)
-- Update msvc_ver.inc
+ Fix new getaddrinfo code to not redefine macros on some systems.
- support Visual Studio 2015 Update 2
+ Fix By: Vy Nguyen (@oontvoo)
-David Drysdale (31 Mar 2016)
-- test: Run fuzzcheck.sh in Travis build
+- [Egor Pugin brought this change]
-- test: add fuzzing check script to tests
+ [ares_getenv] Return NULL in all cases. (#279)
- Add a test script that runs the fuzzing command over the
- corpus of DNS packets. This doesn't actually do any fuzzing
- (it just runs them as inputs without generating any variations)
- but it does ensure that the fuzzing entrypoint is still working.
-
-- test: allow multiple files in aresfuzz command line
+ if ares_getenv is defined, it must return a value on all platforms.
- If no arguments are specified, use stdin as input.
- Otherwise treat each argument as a filename and feed
- its contents to the fuzz entrypoint.
+ Fix By: Egor Pugin (@egorpugin)
-- test: Add corpus of DNS packets
+- [Abhishek Arya brought this change]
+
+ Add OSS-Fuzz fuzzing badge (#278)
- For fuzz testing it is useful to start from a corpus of valid
- packets, so fill out the test/fuzzinput/ directory with a bunch
- of inputs.
+ Adds based on instructions at
+ https://google.github.io/oss-fuzz/getting-started/new-project-guide/#status-badge
- These packets were generated by temporarily modifying the c-ares
- process_answer() function to save off any incoming response messages.
-
-- test: Add utility to show DNS packet from file
+ Patch By: Abhishek Arya (@inferno-chromium)
-- [nordsturm brought this change]
+- [Peter Eisentraut brought this change]
- Fix nsort initialization
+ ares_init_options.3: Fix layout (#275)
- Author: Alexander Drachevskiy
- http://c-ares.haxx.se/mail/c-ares-archive-2014-07/0004.shtml
- http://c-ares.haxx.se/mail/c-ares-archive-2014-07/0014.shtml
-
-- test: Check setting nsort=0 option is respected
-
-- test: Update fuzzing function prototype
+ 7e6af8e inserted the documentation of resolvconf_path in the middle of
+ the item for ednspsz, leading to broken layout. Fix that.
- libFuzzer changed expected return type from void to int
- in LLVM 3.8.
+ Fix By: Peter Eisentraut (@petere)
-- Explicitly clear struct servent before use
-
- On a build where MSAN has been manually set up (which involves
- using an MSAN-instrumented version of the standard C++ library, see
- https://github.com/google/sanitizers/wiki/MemorySanitizerLibcxxHowTo)
- there's a warning about use of uninitialized memory here. It
- might be a false positive, but the fix is trivial so include it.
+- [Gregor Jasny brought this change]
-- test: for AF_UNSPEC, return CNAME only for AAAA, but valid A record
+ manpages: Fix typos detected by lintian (#269)
- Also shuffle expected responses rsp6/rsp4 into the order they will occur.
-
-- [Chris Araman brought this change]
-
- msvc_ver.inc: support Visual Studio 2015 Update 1
-
-- build: commonize MSVC version detection
- Remove the need to copy/paste version number mapping between
- Makefile.msvc and test/Makefile.msvc.
-
-- test: Use different name in live test
+ Fix By: Gregor Jasny (@gjasny)
-- test: Only pass unused args to GoogleTest
+- [lifenjoiner brought this change]
-- ahost.c: add cast to fix C++ compile
+ keep command line usage up to date (#256)
- If ahost.c is force-compiled as C++ the missing cast from
- (void *) to (char **) is problematic.
-
-- ares_library_cleanup: reset ares_realloc too
+ adig and ahost built-in help did not match args taken.
- Otherwise a subsequent use of the library might use a previous
- incarnation's realloc() implementation.
+ Fix-By: @lifenjoiner
-Daniel Stenberg (9 Mar 2016)
-- [Brad House brought this change]
+- [Dan Noé brought this change]
- configure: check if tests can get built before enabled
+ ares-test.cc: Handle nullptr in AddrInfo ostream. (#268)
- The current approach for disabling tests is not a good solution because
- it forces you to pass --disable-tests, rather than auto-detect if your
- system can support the tests in the first place. Many (most?) systems
- do not have C++11. This also causes issues when chain-building c-ares,
- the hosting system needs to be updated to support passing this
- additional flag if necessary, it doesn't seem reasonable to add this
- requirement which breaks compatibility.
+ The const AddrInfo& argument to operator<< overload for AddrInfo can be
+ a nullptr unique_ptr. Handle this explicitly by printing {nullptr} if
+ the rest of the function cannot be safely executed.
- This change auto-detects if the system can build the tests and
- automatically disable them if it cannot. If you pass --enable-tests to
- configure and the system cannot build them either due to lack of system
- support, or because cross-compilation is being used, it will throw an
- appropriate error since the user indicated they really did want the
- tests.
-
-David Drysdale (3 Mar 2016)
-- [Viktor Szakats brought this change]
-
- Makefile.m32: add support for CROSSPREFIX
+ Fix-by: Dan Noé
-- [Viktor Szakats brought this change]
+- [Dan Noé brought this change]
- Makefile.m32: add support for extra flags
+ Add missing limits.h include from ares_getaddrinfo.c (#267)
- Allow specification of CARES_{LD,C}FLAG_EXTRAS envvars
- for mingw
+ This files references INT_MAX, but does not include limits.h. This can
+ cause a build failure on some platforms. Include limits.h if we have it.
+
+ Fix-by: Dan Noé
-- test: Build with MinGW on AppVeyor
+- [Andrew Selivanov brought this change]
-- test: avoid in6addr_* constants
+ fix fuzzer docs and add missing getaddrinfo docs (#265)
- These aren't available on MinGW, so use explicit addresses instead.
+ There is a fix for a bit outdated clang fuzzer docs and ares_getaddrinfo docs.
+
+ Fix By: Andrew Selivanov (@ki11roy)
-- test: add missing #includes for dns-proto.cc
+- [Andrew Selivanov brought this change]
-- [Gregor Jasny brought this change]
+ Fix leak and crash in ares_parse_a/aaaa_reply (#264)
+
+ * fix leak if naddress of particular type found
+ * fix segfault when wanted ttls count lesser than count of result records
+ * add fuzzer input files that trigger problems (from #263)
+
+ Reported-By: David Drysdale (@daviddrysdale)
+ Fix-By: Andrew Selivanov (@ki11roy)
- Fix man page typos detected by Lintian
+- [Andrew Selivanov brought this change]
-Daniel Stenberg (19 Feb 2016)
-- configure: acknowledge --disable-tests
+ fix segfault when parsing wrong type of record (#262)
- Fixes #44
+ Fixes segfault when trying to ares_parse_aaaa with AF_INET and vise versa.
+
+ Fix By: Andrew Selivanov (@ki11roy)
-- AUTHORS: added contributors from the 1.11.0 release
+- work around mingw compile failure
-- bump: start working on the next version
+- c++ requires explicit casts
-Version 1.11.0 (19 Feb 2016)
+- support EnvValue on Windows by implementing setenv/unsetenv
-Daniel Stenberg (19 Feb 2016)
-- RELEASE-NOTES: final edits for 1.11.0
+- [Andrew Selivanov brought this change]
-David Drysdale (15 Feb 2016)
-- ares_dup.3: remove mention of nonexistent function
+ getaddrinfo enhancements (#257)
- ares_dup_options() doesn't exist, so don't document it.
-
-- test: skip repeated build steps
+ * Service support has been added to getaddrinfo.
+ * ares_parse_a/aaaa_record now share code with the addrinfo parser.
+ * Private ares_addrinfo structure with useful extensions such as ttls (including cname ttls),
+ as well as the ability to list multiple cnames in chain of lookups
- Top-level buildconf/configure now triggers for the
- test/ subdir too, so don't need to do explicitly.
+ Work By: Andrew Selivanov @ki11roy
-- test: namespaces unavailable when cross-compiling
+- [Andrew Selivanov brought this change]
-Daniel Stenberg (13 Feb 2016)
-- configure: only run configure in test when NOT cross-compiling
+ fix ares__sortaddrinfo, use wrappers for sock_funcs (#258)
- ... as the tests won't run cross-compiled anyway
+ Some socket functions weren't exposed for use by other areas of the library. Expose
+ those and make use of them in ares__sortaddrinfo().
+
+ Fix By: Andrew Selivanov (@ki11roy)
-David Drysdale (13 Feb 2016)
-- test: prefer ON_CALL to EXPECT_CALL to reduce flakes
+- Fix c89 compilation support broken by .onion rejection changes
- For UDP tests, there's a chance of a retry. EXPECT_CALL only
- expects a single request to arrive at the server; ON_CALL allows
- for a UDP retry and repeats the same answer.
+ Move .onion check lower after all variables have been declared.
- Note that ON_CALL and EXPECT_CALL can't be mixed in the same
- test, and that tests that have a varied sequence of responses
- for the same repeated request still have to use EXPECT_CALL.
+ Bug: #246
-Daniel Stenberg (13 Feb 2016)
-- configure: run configure in 'test' too
+- [kedixa brought this change]
+
+ getaddrinfo: callback must be called on bad domain (#249)
- Having the test dir completely stand-alone causes too many issues for
- users and devs. It still needs to be built specifically.
+ Due to an order of incrementing the remaining queries and calling ares_query, on a bad domain
+ the registered callback wouldn't be called.
+
+ Bug: #248
+ Fixed-By: @kedixa
-- configure: build silently by default
+- [Darrin W. Cullop brought this change]
-- buildconf: run test/buildconf too if present
+ Windows ARM/ARM64 requires AdvApi32 (#252)
+
+ Fix link issues caused by missing library that appears to only be required on ARM (though
+ docs don't list this restriction). Doesn't hurt to require it everywhere.
+
+ Bug: #251
+ Fixed-By: Darrin Cullop (@dwcullop)
-- test/configure: build silently by default
+- [kedixa brought this change]
-- [Gregor Jasny brought this change]
+ getaddrinfo: avoid infinite loop in case of NXDOMAIN(#240) (#242)
+
+ There are two possible causes for infinite loops fo NXDOMAIN, based on how many dots are in the domain name (one for < ARES_OPT_NDOTS and one for >= ARES_OPT_NDOTS), where it will repeat the same query over and over as the hquery->next_domain doesn't increment.
+
+ Fix By: @kedixa
- dist: Distribute README.md
+- Portability fix for ares__sortaddrinfo()
- Closes #42
+ replace uint32_t with unsigned int and socklen_t with ares_socklen_t
+
+ By: Brad House
-Version 1.11.0 (11 Feb 2016)
+- [Khaidi Chu brought this change]
-Daniel Stenberg (11 Feb 2016)
-- Makefile.am: distribute the test dir too
+ fix: init bufp before reject .onion to make it can be free correctly (#241)
+
+ When querying a .onion domain, it returns directly without setting bufp to NULL. A subsequent free() that occurs can cause a segmentation fault.
+
+ Fix By: Khaidi Chu (@XadillaX)
-- RELEASE-NOTES: synced with 385582bd14b68a
-
-- [Nicolas \"Pixel\" Noble brought this change]
+- [Andrew Selivanov brought this change]
- ares_win32_init: make LoadLibrary work when using UNICODE too
+ Add ares__sortaddrinfo() to support getaddrinfo() sorted results (#239)
- Closes #17
+ This is a port of RFC 6724 compliant sorting function from Android Bionic project:
+ https://android.googlesource.com/platform/bionic/+/e919b116d35aa7deb24ddece69c491e24c3b0d6f/libc/netbsd/net/getaddrinfo.c
+
+ The latest version is essentially the same, except two additional parameters to test connection with (mark/uid):
+ https://android.googlesource.com/platform/bionic/+/master/libc/dns/net/getaddrinfo.c
+
+ Please note that even that version has some restrictions. It doesn't support some rules from RFC 6724:
+
+ Rule 3 (Avoid deprecated addresses)
+ Rule 4 (Prefer home addresses)
+ Rule 7 (Prefer native transport)
+
+ Submitted By: Andrew Selivanov (@ki11roy)
-David Drysdale (11 Feb 2016)
-- Use "resolve" as synonym of "dns" in nsswitch.conf
+- [Christian Ammer brought this change]
+
+ Increase portability of `ares-test-mock-ai.cc` (#235)
- Modern Linux systems may have libnss_resolve from systemd as the
- resolver, which is then configured in /etc/nsswitch.conf with
- the "resolve" keyword rather than "dns".
+ * using portable ares_inet_pton and updated includes in ares-test-mock-ai
+ * forgot to remove deleted ares-test-ai.cc in Makefile.inc
- Fixes #33
+ Fix By: Christian Ammer (@ChristianAmmer)
-- ares_set_socket_callback: make manpage match code
+- [Fabrice Fontaine brought this change]
+
+ m4/xc-cc-check.m4: use XC_CHECK_BUILD_FLAGS (#236)
- The code in ares_process.c that invokes the socket creation/connection
- callback only checks for rc < 0, not for standard ares error codes.
+ Use XC_CHECK_BUILD_FLAGS instead of XC_CHECK_USER_FLAGS.
+ Otherwise it complains of CPPFLAGS in CFLAGS.
+ [Retrieved from:
+ https://git.buildroot.net/buildroot/tree/package/c-ares/0001-use_check_build_instead_of_check_user.patch]
+
+ Signed-off-by: Gustavo Zacarias
+ Signed-off-by: Fabrice Fontaine
+ Submitted by: Fabrice Fontaine
-- Merge pull request #36 from AGWA-forks/master
+- [Christian Ammer brought this change]
+
+ Bugfix for `ares_getaddrinfo` and additional unit tests (#234)
- Add ares_set_socket_configure_callback()
+ This PullRequest fixes a bug in the function add_to_addrinfo which task is to add new addrinfo items to the ai_next linked list. Also additional unit tests for testing ares_getaddrinfo will be added:
+
+ Additional mock server test classes (ares-test-mock-ai.cc):
+ MockTCPChannelTestAI
+ MockExtraOptsTestAI
+ MockNoCheckRespChannelTestAI
+ MockEDNSChannelTestAI
+ RotateMultiMockTestAI
+ NoRotateMultiMockTestAI
+
+ Additional live tests (ares-test-live-ai.cc):
+ LiveGetHostByNameV4
+ LiveGetHostByNameV6
+ LiveGetHostByNameV4AndV6
+
+ Fix By: Christian Ammer (@ChristianAmmer)
-- test: Update init tests to match behaviour
+- [Christian Ammer brought this change]
+
+ Remaining queries counter fix, additional unit tests for `ares_getaddrinfo` (#233)
- Unreadable config files are now treated the same way
- as absent config files.
+ Remaining queries counter fix, added tests (ParallelLookups,
+ SearchDomains, SearchDomainsServFailOnAAAA). Removed unnecessary
+ if and commented code in test.
+
+ Fix By: Christian Ammer (@ChristianAmmer)
-- [Fedor Indutny brought this change]
+- [Christian Ammer brought this change]
- Ignore `fopen` errors to use default values
+ Add initial implementation for ares_getaddrinfo (#112)
- After 46bb820be3a83520e70e6c5f0c5133253fcd69cd `init_by_resolv_conf`
- errors are no longer swallowed in `ares_init_options`. This has exposed
- a previously unknown bug in `lookups` initialization code.
+ Initial implementation for ares_getaddrinfo(). It is NOT compliant with RFC6724, though
+ it is expected to come closer to conformance prior to the next release.
- If there is no lookup configuration in `resolv.conf`,
- `init_by_resolv_conf` will attempt to read it from other files available
- on the system. However, some of these files may have restricted
- permissions (like `600`), which will lead to `EACCESS` errno, which in
- turn is handled like a fatal error by `init_by_resolv_conf`.
+ Features not supported include sorted addresses and honoring of service and hints
+ parameters.
- However, it sounds illogical that this error should be handled as a
- fatal. There is a `init_by_defaults` call that overrides `lookups` with
- default value, and certainly possible absence of lookup information is
- the reason why this function exists in a first place!
+ Implementation by: Christian Ammer (@ChristianAmmer)
+
+- [Ben Noordhuis brought this change]
+
+ test: fix bad expectation in ipv6 localhost test (#227)
- I suggest handling any `fopen` errors as non-fatal ones, allowing to
- pick up the `lookups` value from different config files, or to pick up
- default value.
+ The LiveGetLocalhostByAddrV6 test expected to see "localhost" in the
+ result when doing an address-to-name lookup for ::1 but on my system
+ that resolves to "ip6-loopback" because of this stanza in /etc/hosts:
+
+ $ grep ^::1 /etc/hosts
+ ::1 ip6-localhost ip6-loopback
+
+ Fix By: Ben Noordhuis (@bnoordhuis)
+ Bug: #85
-Andrew Ayer (9 Feb 2016)
-- Document callback type in man page for ares_set_socket_callback
+- [Ben Noordhuis brought this change]
-- Add ares_set_socket_configure_callback()
+ ares_version.h: bump version (#230)
- This function sets a callback that is invoked after the socket is
- created, but before the connection is established. This is an ideal
- time to customize various socket options.
+ Version change not committed from maketgz.sh
+
+ Bug: #229
-David Drysdale (9 Feb 2016)
-- test: ares_set_socket_callback failure behaviour
+Daniel Stenberg (24 Oct 2018)
+- ares_library_init_android.3: minor syntax edits, fixed AVAILABILITY
-- test: Check ares_parse_txt_reply_ext() entrypoint
+Version 1.15.0 (23 Oct 2018)
-- [Fedor Indutny brought this change]
+Brad House (23 Oct 2018)
+- last minute 1.15.0 addition
- txt: introduce `ares_parse_txt_reply_ext`
+- [Ben Noordhuis brought this change]
+
+ Report ARES_ENOTFOUND for .onion domain names as per RFC7686. (#228)
- Introduce `ares_txt_ext` structure with an extra `record_start`
- field, which indicates a start of a new TXT record, thus allowing to
- differentiate the chunks in the same record, from a chunks in a
- different record.
+ Quoting RFC 7686:
- Introduce a new API method: `ares_parse_txt_reply_ext` that works with
- this kind of struct.
+ Name Resolution APIs and Libraries (...) MUST either respond
+ to requests for .onion names by resolving them according to
+ [tor-rendezvous] or by responding with NXDOMAIN.
+
+ A legacy client may inadvertently attempt to resolve a .onion
+ name through the DNS. This causes a disclosure that the client
+ is attempting to use Tor to reach a specific service. Malicious
+ resolvers could be engineered to capture and record such leaks,
+ which might have very adverse consequences for the well-being
+ of the user.
+
+ Bug: #196
+ Fix By: Ben Noordhuis @bnoordhuis
-- doc: Update missed repo references
+- prepare for c-ares 1.15.0 release
-- doc: Update docs on contributing
+- AIX Build Fix
+
+ AIX attempts to include both nameser_compat.h and onameser_compat.h. It appears
+ the proper fix is to define _USE_IRS so that only nameser_compat.h is used.
+
+ Bug: #224
+ Fix By: Brad House (@bradh352)
-- test: Run command line tools in Travis
+- Fix crash in ares_dup() due to new ARES_OPT_RESOLVCONF
- Do a quick execution of each of the command line tools
- in the continuous integration build, so that any (say)
- sanitizer failures show up.
+ ares_dup() calls ares_init_options() by making its own fake option
+ mask since the original mask isn't stored but ARES_OPT_RESOLVCONF
+ was always set, instead of conditionally set. This caused a crash
+ because ares_strdup() isn't NULL-safe if no custom path was set.
+
+ Made ares_dup() set ARES_OPT_RESOLVCONF conditionally.
+
+ Fix By: Brad House (@bradh352)
-- acountry: drop inert test
+- [Sarat Addepalli brought this change]
+
+ Add ares_init_options() configurability for path to resolv.conf file
- If ver_1 is true, then z0 and z1 must both be 'z', and so
- (z0 != 'z' && z1 != 'z') can never be true.
+ Add resolvconf_path to end of struct ares_options with ARES_OPT_RESOLVCONF option
+ so on Unix-like systems a custom path can be specified. If no path is specified,
+ /etc/resolv.conf is used like normal.
- CID 56879, pointed out by Coverity.
+ Fix By: Sarat Addepalli @SirR4T
+ Fixes Bug: #220
+ Review By: Brad House @bradh352
-- doc: update badge locations to master repo
+- remove stale variables
-- test: Enable maintainer mode + debug in Travis
+- fix prototype name for ares_strsplit_free()
-- test: Add an iOS build target
+- add missing prototype
-- test: Ignore SIGPIPE in tests
+- simplify ares_strsplit() and create ares_strsplit_free() helper function
-- test: More initialization tests
+- missing ares_strsplit.h from HHEADERS for inclusion in distribution
-- test: Improve containerized test mechanism
+- [Ruslan Baratov brought this change]
+
+ Add CARES_BUILD_TOOLS CMake option (#214)
- Aim is to ensure that code coverage information can escape the
- container. To do this:
- - Enter a new mount namespace too, so that we can...
- - Bind mount the expected source directory into the container
- - Share memory with the sub-process so coverage information is
- shared too.
+ Add ability to exclude building of tools (adig, ahost, acountry) in CMake. This should also close #200.
+
+ Fix By: Ruslan Baratov (@ruslo)
+ Bug: #200
-- test: Make contained tests easier to write
+- [flyingdutchman23 brought this change]
-- test: Add framework for containerized testing
+ Style. Whitespace cleanup. (#213)
- On Linux we can potentially use user and UTS namespaces to run a test
- in a pseudo-container with:
- - arbitrary filesystem (e.g. /etc/resolv.conf, /etc/nsswitch.conf, /etc/hosts)
- - arbitrary hostname/domainname.
+ Small whitespace cleanups.
- Include a first pass at the framework code to allow this, along with a
- first test case that uses the container.
+ Fix By: @flyingdutchman23
-- test: Use a longer timeout for less flakiness
+- [John Schember brought this change]
+
+ Android: Support for domain search suffix (#211)
- Having occasional test failures from timeout before multiple
- queries can complete, so up the default timeout for the test
- from 100ms to 1500ms.
+ Fixes issue #207. Uses LinkProperties.getDomains() to get a list of search domains and adds them to the suffix list. This also adds a new helper function to split strings into an array based on multiple delimiters replacing multiple other functions for dealing with string splitting.
+
+ Submitter: John Schember (@user-none)
+ Fixes: #207
+ Approved-by: Brad House (@bradh352)
-- test: Make failure tests more robust
+- [afalin brought this change]
+
+ Improve DNS suffixes extracting from WinNT registry (#202)
- Different platforms will do different numbers of allocations
- in the processing of a given API call; just check that the
- return code is either success or ENOMEM, and free off any
- returned state in the former case.
+ Join all global and connection specific suffix lists. Use 'HKLM\Software\Policies\Microsoft\Windows NT\DNSClient\SearchList', 'HKLM\System\CurrentControlSet\Services\Tcpip\Parameters\Domain' as global suffix lists.
- Also cope with ECONNREFUSED as well as ENOTFOUND.
+ Fix By: @afalin
-- test: Get test code building under Windows
+- Be consistent with indention in CMakeLists.txt
- - Initial nmake file based off library nmake file
- - Cast socket call arguments to (char *)
- - Use wrapper sclose() that maps to closesocket() or close()
- - Build a config.h indicating presence of headers
- - Conditionally include netdb.h
- - Remove unnecessary include of sys/socket.h
- - Force longer bitmask for allocation failure tracking
- - Call WSAStartup() / WSACleanup() in main()
- - Set TCP_NODELAY for mock server
- - Turn on tests in AppVeyor build
-
-- test: Disable tests that manipulate env on Windows
-
-- test: Move file lists into Makefile.inc
-
- In preparation for a Win32 build of the test suite.
-
-- test: Add a simple multi-server test
+ The imported TRANSFORM_MAKEFILE_INC function from curl used space indention
+ but the rest of the file used tabs. Go ahead and make it tabs for
+ consistency as well.
- Check rotate option does something
+ Committed By: Brad House
-- test: Allow for multiple mock servers
-
- - Update the MockServer to allow separate specification of
- UDP and TCP ports
- - Have an array of mock servers listening on consecutive
- sets of ports.
- - Rename Process(fd) to ProcessFD(fd) to avoid confusion.
- - Initialize channel by using the new ares_set_servers_ports()
- entrypoint, so multiple ports on the same loopback address
- can be used.
+- [flyingdutchman23 brought this change]
-- test: Update test for set/get_servers variants
+ Fix modern gcc warning: argument to 'sizeof' in 'strncpy' call is the same expression as the source
- Ports are significant in the _ports_ variant functions, so update test to cope.
-
-- test: Make GetNameServers() utility function port-aware
+ Silence warning about using src to determine number of bytes to copy.
+ In this case it doesn't matter whether it is `src` or `dest`. So there
+ is no functionality change.
- Also make it generally available.
+ Bug: #210
+ Fix By: @flyingdutchman23
-- test: more testing, including of internal static functions
+- [Andi Schnebinger brought this change]
-- test: more tests, especially fallback processing
+ fix stringop-overflow warning of GCC (#201)
- - Make mock server listen on UDP + TCP in parallel.
- - Test UDP->TCP fallback on truncation
- - Test EDNS->no-EDNS fallback
- - Test some environment init options
- - Test nonsense reply
+ When using a modern GCC to compile c-ares, there is a stringop-overflow warning.
+ This patch simply silences the false-positive warning, there is no actual code flaw.
- test: short response
+ Bug: https://github.com/c-ares/c-ares/pull/201
+ Fixed By: Andi Schnebinger @Iniesta8
-- test: more tests, particularly of initialization
+GitHub (18 May 2018)
+- [David Drysdale brought this change]
-- test: Run mock tests over both TCP and UDP
+ travis: do coverage in "coverage" build (#195)
- With the exception of a few tests that make use of the timed
- retry aspect of UDP.
-
-- test: Run mock tests over both IPv4 and IPv6
-
-- test: Add more tests for edge cases
-
-- test: more nooks and crannies of pton functions
-
-- test: More tests for PTR parsing
+ Fixes #194, a mistake from commit a255081f2c3c ("travis: Only do
+ coverage/distcheck on normal build")
-- test: Use of HOSTALIAS environment variable
+Brad House (17 May 2018)
+- [Brad Spencer brought this change]
-- test: Add RAII utility classes for testing
+ Apply the IPv6 server blacklist to all nameserver sources, not just Windows (#193)
- - TempFile holds specific contents
- - EnvValue sets an environment variable
-
-- test: More search domain scenarios
-
-- test: Remove duplicate flags from Makefile.am
-
-- test: Make test code leak-free
-
-- test: More tests
+ For #164, I mentioned that it seemed like the IPv6 nameserver blacklist should apply to all OSes. In a mailing list post, @bradh352 agreed and suggested that I file a PR to make it so.
- - test use of sortlist
- - test gethostbyname(AF_UNSPEC)
-
-- test: Test ares_gethostbyname_file()
-
-- test: Add more tests of ares_getnameinfo()
-
-- test: Tweak tests, add alloc failure test
-
-- test: Test init with options
-
-- test: More tests
+ This moves the blacklist check from being Windows-specific to being a general feature of config_nameservers(), no matter the nameserver source. It also simplifies the ares_ipv6_server_blacklisted() implementation to not parse and re-parse the blacklisted IPv6 addresses from strings on every check. I think they're almost as easy to read as a sequence of hex bytes in an array initializer, and it's definitely less work on each trip through the code.
- - ares_inet_net_pton() variants
- - ares_getsock() variants
+ Fix By: Brad Spencer @b-spencer
+ PR: https://github.com/c-ares/c-ares/pull/193
-- test: Expose ProcessWork() function
+- [Brad Spencer brought this change]
-- test: More parsing tests
+ Fix warnings emitted by MSVC when using -W4 (#192)
- Including:
- - Split each parse function test set out into separate files.
- - Add an allocation failure test for each parsing function.
- - Add error check test for each parsing function.
-
-- test: Add various additional tests
-
-- test: More tests
+ These changes fix a few warnings emitted by recent versions of MSVC when compiling with -W4. Half of the changes are in Windows-specific code, and the other half should be safe no matter the compiler or OS.
- Include tests of internal functions, based on the value of the
- CARES_SYMBOL_HIDING macro; need to configure the library with
- --disable-symbol-hiding to enable these tests.
-
-- test: Allow command line override of mock server port
+ The allocation function change is probably the only one that needs explanation. MSVC gives warnings about the function pointers not being stable across DLL boundaries or something to that effect, so for Windows, I've made them be called indirectly, which at least made the compiler happy. I can't say I've tested every linking combination on Windows with them before or after the change, but it seems harmless.
+
+ Fix By: Brad Spencer @b-spencer
+ PR: https://github.com/c-ares/c-ares/pull/192
-- test: Add README.md documentation
+- [David Hotham brought this change]
-- test: Temporarily avoid latest Python requests package
+ Prevent changing name servers while queries are outstanding (#191)
- Currently get error from Travis on this install step, and downgrading one
- version appears to fix the problem.
+ Changing name servers doesn't work, per #41. Better to return an error code than to crash.
- "Could not find any downloads that satisfy the requirement pyOpenSSL>=0.13
- (from requests[security])"
+ Fix-by: David Hotham @dimbleby
-- test: Add AppVeyor config file for Windows build
+David Drysdale (15 May 2018)
+- [Tobias Nießen brought this change]
-- test: Add configuration for a Travis build
-
- Cover Linux & OSX on the container infrastructure, but install
- a later G++ to satisfy the tests' need for C++11.
-
- Use a build matrix to include a variety of build variants:
- - ASAN
- - UBSAN
- - LSAN
- - Coverage via coveralls.io
+ Fix comment in ares_rules.h (#189)
+
+Brad House (6 May 2018)
+- [Brad Spencer brought this change]
+
+ Harden and rationalize c-ares timeout computation (#187)
- test: invoke ASAN and coverage in Travis build
+ * Harden and rationalize c-ares timeout computation
+ * Remove the rand() part of the timeout calculation completely.
- Also shift to use explicit build matrix
+ When c-ares sends a DNS query, it computes the timeout for that request as follows:
- test: Use coveralls.io for coverage tracking
+ timeplus = channel->timeout << (query->try_count / channel->nservers);
+ timeplus = (timeplus * (9 + (rand () & 7))) / 16;
+ I see two issues with this code. Firstly, when either try_count or channel->timeout are large enough, this can end up as an illegal shift.
- test: Add a build with UBSAN
+ Secondly, the algorithm for adding the random timeout (added in 2009) is surprising. The original commit that introduced this algorithm says it was done to avoid a "packet storm". But, the algorithm appears to only reduce the timeout by an amount proportional to the scaled timeout's magnitude. It isn't clear to me that, for example, cutting a 30 second timeout almost in half to roughly 17 seconds is appropriate. Even with the default timeout of 5000 ms, this algorithm computes values between 2812 ms and 5000 ms, which is enough to cause a slightly latent DNS response to get spuriously dropped.
- Also expand and re-order the setting of environment variables
- for easier modification.
+ If preventing the timers from all expiring at the same time really is desirable, then it seems better to extend the timeout by a small factor so that the application gets at least the timeout it asked for, and maybe a little more. In my experience, this is common practice for timeouts: applications expect that a timeout will happen at or after the designated time (but not before), allowing for delay in detecting and reporting the timeout. Furthermore, it seems like the timeout shouldn't be extended by very much (we don't want a 30 second timeout changing into a 45 second timeout, either).
- test: Add LSAN build to Travis config
-
-- test: Add initial unit tests for c-ares library
+ Consider also the documentation of channel->timeout in ares_init_options():
- The tests are written in C++11, using the GoogleTest and GoogleMock
- frameworks. They have their own independent autoconf setup, so that
- users of the library need not have a C++ compiler just to get c-ares
- working (however, the test/configure.ac file does assume the use of
- a shared top-level m4/ directory). However, this autoconf setup has
- only been tested on Linux and OSX so far.
+ 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 timeout.) The default is five seconds.
- Run with "./arestest", or "./arestest -v" to see extra debug info.
- The GoogleTest options for running specific tests are also
- available (e.g. "./arestest --gtest_filter=*Live*").
+ In the current implementation, even the first try does not use the value that the user supplies; it will use anywhere between 56% and 100% of that value.
- The tests are nowhere near complete yet (currently hitting around
- 60% coverage as reported by gcov), but they do include examples
- of a few different styles of testing:
+ The attached patch attempts to address all of these concerns without trying to make the algorithm much more sophisticated. After performing a safe shift, this patch simply adds a small random timeout to the computed value of between 0 ms and 511 ms. I could see limiting the random amount to be no greater than a proportion of the configured magnitude, but I can't see scaling the random with the overall computed timeout. As far as I understand, the goal is just to schedule retries "not at the same exact time", so a small difference seems sufficient.
- - There are live tests (ares-test-live.cc), which assume that the
- current machine has a valid DNS setup and connection to the
- internet; these tests issue queries for real domains but don't
- particularly check what gets returned. The tests will fail on
- an offline machine.
+ UPDATE: randomization removed.
- - There a few mock tests (ares-test-mock.cc) that set up a fake DNS
- server and inject its port into the c-ares library configuration.
- These tests allow specific response messages to be crafted and
- injected, and so are likely to be used for many more tests in
- future.
+ Closes PR #187
+ Fix by: Brad Spencer
+
+- distribute ares_android.h
- - To make this generation/injection easier, the dns-proto.h file
- includes C++ helper classes for building DNS packets.
+ Distribute ares_android.h when a release distribution package is
+ created.
- - Other library entrypoints that don't require network activity
- (e.g. ares_parse_*_reply) are tested directly.
+ Reported By: Andrey Khranovsky
+ Bug: https://c-ares.haxx.se/mail/c-ares-archive-2018-04/0000.shtml
+
+- ares_set_servers_csv() on failure should not leave channel in a bad state
- - There are few tests of library-internal functions that are not
- normally visible to API users (in ares-test-internal.cc).
+ If bad data is passed to ares_set_servers_csv() or
+ ares_set_servers_ports_csv() it will clear the existing channel
+ configured DNS servers, then a call to ares_send() will fail due
+ to a bad malloc which may have undefined behavior.
- - A couple of the tests use a helper method of the test fixture to
- inject memory allocation failures, using the earlier change to the
- library to allow override of malloc/realloc/free.
+ The fix now only clears existing servers on success. An additional
+ sanity check was added in ares_send() to ensure nservers >= 1 or
+ will result in ARES_ESERVFAIL.
- - There is also an entrypoint to allow Clang's libfuzzer to drive
- the packet parsing code in ares_parse_*_reply, together with a
- standalone wrapper for it (./aresfuzz) to allow use of afl-fuzz
- for further fuzz testing.
+ Bug: https://c-ares.haxx.se/mail/c-ares-archive-2018-03/0000.shtml
+ Reported-by: Francisco Sedano Crippa
-- test: Add local copy of GoogleMock/GoogleTest 1.7.0
+- docs: Not all manpages are listed
- Don't check in gtest/m4 files, as they are unused and interfere
- with the top-level configure process.
+ Some docs aren't installed or not showing up on
+ https://c-ares.haxx.se/docs.html
+ due to not being listed in Makefile.inc. Add missing docs and
+ ensure docs are alphabetized.
-- doc: Show build badges in README.md
-
- Note that these URLs will need to be updated if/when the test branch
- gets pulled into the master repo/branch.
+Version 1.14.0 (16 Feb 2018)
-- doc: Convert README to README.md
-
- Gives better display on GitHub
+Daniel Stenberg (16 Feb 2018)
+- ares_android.c: fix warning: ISO C forbids an empty translation unit
-- doc: Update in preparation for next release
-
- Assume 1.11.0 is next (as there are various API additions).
- Also add myself to AUTHORS.
+- RELEASE-NOTES: some more work we did and people who helped
+
+Brad House (16 Feb 2018)
+- travis: skip Autotools style testing for cmake
+
+ Fix cmake test build by skipping autotools portion of test script.
+
+- travis: standardize CMake test off of Autotools tests
+
+ Instead of running 'make test', run the tests directly like autotools
+ does. It provides more verbose output.
+
+- travis: Enable building tests for CMake
+
+ Travis should auto-build and run tests for cmake builds now that
+ PR #168 is merged.
+
+- fix version in pkgconfig
+
+- Add version update to CMakeLists in maketgz
+
+- Release prep. Add support for pkgconfig in cmake, set versions appropriately
+
+Gregor Jasny (15 Feb 2018)
+- CMake: Add tests
+
+Brad House (14 Feb 2018)
+- [Gregor Jasny brought this change]
+
+ Use cmake3 package provided by Ubuntu (#182)
+
+- Cmake 3.1 instead of 3.2.1 should be the minimum
+
+- Update RELEASE-NOTES and RELEASE-PROCEDURE.md to prepare for next release
+
+- get rid of c++ style comments
+
+- Use trusty for all builds, precise is EOL. Update clang and cmake versions.
+
+- Current CMakeLists.txt doesn't support 2.8.12 anymore, we need to bump the version to 3.2.1 minimum
+
+- Re-organize sections in INSTALL.md and add CMake section
+
+- [Sergey Kolomenkin brought this change]
+
+ remove compilation warnings in MSVC (#47)
+
+- document handling of timeouts for ares_process and ares_process_fd to close PR #57
+
+- As per Issue #155, since we do not require gethostname() during init, if it fails, there's no reason for init to fail as it is only used to populate the domain
+
+GitHub (7 Feb 2018)
+- [David Drysdale brought this change]
+
+ Document WSAStartup requirement (#180)
+
+David Drysdale (6 Feb 2018)
+- [Antonio Tajuelo brought this change]
+
+ Added coderelease.io badge to readme.md for letting people subscribe to new versions (#174)
+
+- [Sheel Bedi brought this change]
+
+ Update year in LICENSE.md to 2018 (#170)
+
+GitHub (4 Feb 2018)
+- [David Drysdale brought this change]
+
+ travis: use VM not container for {L,A}SAN builds (#177)
+
+ As per https://github.com/travis-ci/travis-ci/issues/9033, container
+ based builds do not currently allow ptrace, which is used by LSAN and
+ ASAN.
+
+Brad House (3 Feb 2018)
+- [acthompson-google-com brought this change]
+
+ Android JNI code leaks local references in some cases (#175)
+
+ * Add Google LLC to AUTHORS.
+
+ * android: Explicitly delete all JNI local references, and cache JNI method IDs at initialization.
+
+ * android: Only return ARES_ENOTINITIALIZED on failures in initialization code.
+
+Gregor Jasny (2 Jan 2018)
+- Embed fused Google Test 1.8.0
+
+Brad House (21 Dec 2017)
+- [John Schember brought this change]
+
+ android: Check returns for obj and classes are not NULL. Document API levels for various Android functions and objects used. (#166)
+
+- CARES_CHECK_TYPE should reference variable so a warning is not produced for -Werror compatibility
+
+- [Brad Spencer brought this change]
+
+ Fix computation of IPv6 blacklist mask for values of netmask > 8. (#164)
+
+David Drysdale (14 Dec 2017)
+- travis: Only do coverage/distcheck on normal build
+
+- travis: only do pip install on Linux
+
+- travis: only test in IPv4 mode
+
+ Travis' Trusty environment does not support IPv6.
+
+- test: allow restriction to one IP address family
+
+- [Roman Teterin brought this change]
+
+ Fix a typo in init_by_resolv_conf (#160)
+
+Brad House (11 Dec 2017)
+- @gvanem says MSVC -RTCc option fails, looks erroneous to me, but the additional mask is harmless
+
+- Fix some other mingw warnings
+
+- Issue #143, get rid of windows build warning due to passing 'char **' to argument expecting 'const char **'
+
+- [Gregor Jasny brought this change]
+
+ Distribute CMake files (#130)
+
+- Android variants may not have __system_property_get
+
+ Some android systems like ARM64 may not have the __system_property_get
+ symbol in libc (but still have it in the public headers). Detect this
+ condition at build time. The __system_property_get method of retrieving
+ name servers is deprecated as of Oreo so should strictly be a fallback
+ mechanism anyhow.
+
+David Drysdale (9 Nov 2017)
+- [David Hotham brought this change]
+
+ Wrong function name throughout man page (#154)
+
+- ares_data.c: iterate through substructs when freeing
+
+ Previous code recursed into substructures, which makes it more likely
+ that large/heavily-nested responses could use up lots of stack.
+
+- test: test ares_free_data on long chain of structs
+
+- [Felix Yan brought this change]
+
+ Fix a typo in inet_ntop.c (#151)
+
+Daniel Stenberg (29 Sep 2017)
+- ares_gethostbyname.3: fix callback status values
+
+ - ARES_ENOTFOUND means the _name_ wasn't found
+
+ - ARES_ENODATA can be returned when a resolve fails
+
+ Reported-by: Jakub Hrozek
+ Bug: https://c-ares.haxx.se/mail/c-ares-archive-2011-06/0012.shtml
+
+Brad House (28 Sep 2017)
+- [John Schember brought this change]
+
+ Fix DNS server lookup breaking with Android O due to Android removing access to net.dns# system properties. (#148)
+
+ As of Android 8 (Oreo) access to net.dns# has been removed (https://developer.android.com/about/versions/oreo/android-8.0-changes.html). The reasoning given is that it, "improves privacy on the platform". Currently c-ares uses this to get the list of DNS servers.
+
+ Now the only way to access the DNS server list is by using the Connectivity Manager though Java. This adds the necessary JNI code to use the Connectivity Manager and pull the DNS server list. The old way using __system_property_get with net.dns# remains for compatibilty.
+
+ Using the Connectivity Manager requires the ACCESS_NETWORK_STATE permission to be set on the app. Existing applications most likely are not setting this and keeping the previous method as a fallback will at the very least ensure those apps don't break on older versions of Android. They will need to add this permission for Android 8 compatibility.
+
+ Included in the patch are two initalization functions which are required. The JVM must be registered as well as the Connectivity Manager itself. There is no way to get the Connectivity Manager except though Java. Either being passed down to C directly or by passing in an Android Context which can be used to get the Connectivity Manager. Examples are provided in the documentation.
+
+- [Konstantinos Sofokleous brought this change]
+
+ allow linking against the static msvc runtime library (#133)
+
+ allow linking against the static msvc runtime library
+
+- [Gergely Nagy brought this change]
+
+ Force using the ANSI versions of WinAPI functions (#142)
+
+ When compiling c-ares with a build system that defines UNICODE,
+ bad versions of WinAPI functions are used causing failures or even
+ crashes. When windows.h is included in MBCS mode (like in the default
+ build system), the ..A versions are the same as using the one without
+ any suffix.
+
+- [cmake] build fix on Solaris
+
+GitHub (11 Sep 2017)
+- [Brad House brought this change]
+
+ Win32 exclude legacy ipv6 subnets (#144)
+
+ win32 ipv6: add infrastructure to exclude ipv6 subnets that are known to cause issues
+
+- [David Drysdale brought this change]
+
+ windows: only look for ancient compilers (#146)
+
+ Also drop the use of a versioned output directory; just use
+ .\msvc
+
+- [David Drysdale brought this change]
+
+ ares_init_options.3: match up sock_state_cb args (#141)
+
+ Fixes #140
+
+Daniel Stenberg (25 Aug 2017)
+- [Anna Henningsen brought this change]
+
+ gethostbyaddr: fail with `ECANCELLED` for `ares_cancel()`
+
+ When `ares_cancel()` was invoked, `ares_gethostbyaddr()`
+ queries would fail with `ENOTFOUND` instead of `ECANCELLED`.
+
+ It seems appropriate to treat `ares_cancel()` like `ares_destroy()`,
+ but I would appreciate review of the correctness of this change.
+
+ Ref: https://github.com/nodejs/node/issues/14814
+
+ Closes #138
+
+David Drysdale (18 Aug 2017)
+- [David Hotham brought this change]
+
+ support most recent Visual Studio 2017
+
+Brad House (26 Jul 2017)
+- Preserve original DNS server order on Windows for equal metrics.
+
+ qsort is not stable, in order to make it stable we need to record
+ the original index and add it as a secondary sort value when the
+ metrics are equal to prevent using DNS servers that may not work
+ at all as reported by some users.
+
+David Drysdale (15 Jul 2017)
+- [Anna Henningsen brought this change]
+
+ ares_parse_naptr_reply: make buffer length check more accurate
+
+ 9478908a490a6bf009ba58d81de8c1d06d50a117 introduced a length check
+ for records parsed by `ares_parse_naptr_reply()`. However, that
+ function is designed to parse replies which also contain non-NAPTR
+ records; for A records, the `rr_len > 7` check will fail as there
+ are only 4 bytes of payload.
+ In particular, parsing ANY replies for NAPTR records was broken
+ by that patch.
+
+ Fix that by moving the check into the case in which it is already
+ known that the record is a NAPTR record.
+
+- appveyor: run dnsdump as a sanity check
+
+- travis: run dnsdump as a sanity check
+
+- test: use ares_free_string() throughout
+
+ As pointed out by Gisle Vanem in #125.
+
+Daniel Stenberg (3 Jul 2017)
+- RELEASE-PROCEDURE.md: how to release
+
+ Fixes #115
+ Closes #116
+
+David Drysdale (2 Jul 2017)
+- test: Build dnsdump on Windows too
+
+ Thanks to Gisle Vanem for showing the way:
+ https://github.com/c-ares/c-ares/commit/b701af8a24cf9d173b1dbe5faedcea34642e92da#commitcomment-22830845
+
+Brad House (26 Jun 2017)
+- [Christian Ammer brought this change]
+
+ fix statement like #define - ares ssize_t define had a trailing semicolon (#120)
+
+David Drysdale (21 Jun 2017)
+- test: distribute the fuzzcheck.sh script
+
+ The TESTS target runs fuzzcheck.sh so make sure it is included
+ in the distributed tarball.
+
+ (The test itself will be pointless when run on a distribution, because
+ the fuzzing corpus directories are not shipped, but at least this
+ means that `make -C test test` should work.)
+
+- test: run the name-parsing corpus check too
+
+Daniel Stenberg (21 Jun 2017)
+- dist: don't build/ship PDF versions in release archives
+
+ ... experience says very few read them and they can still get build by
+ those who want them.a
+
+- ares_version.h: bump version
+
+Version 1.13.0 (20 Jun 2017)
+
+Daniel Stenberg (20 Jun 2017)
+- RELEASE-NOTES: 1.13.0
+
+- ares_set_socket_functions.3: added in 1.13.0
+
+David Drysdale (18 Jun 2017)
+- ares_parse_naptr_reply: check sufficient data
+
+ Check that there is enough data for the required elements
+ of an NAPTR record (2 int16, 3 bytes for string lengths)
+ before processing a record.
+
+- test: Feed in short NAPTR
+
+- test: Add fuzz input with short NAPTR
+
+- test: add ares_parse_naptr_reply to fuzzer
+
+- [noiz brought this change]
+
+ Update ares.h to support compiling with QNX
+
+- [Dionna Glaze brought this change]
+
+ Simple changes to appease stricter compilers.
+
+ ares_process.c uses htonl, which needs included.
+ ares_getnameinfo.c uses a dynamically selected format string for
+ sprintf, which -Wformat-literal doesn't like. Usually one would use
+ inttypes.h and a format string "%" PRIu32, but C99 is too new for some
+ supported platforms.
+
+GitHub (16 Jun 2017)
+- [Gregor Jasny brought this change]
+
+ CMake: Emulate interface library on import (#108)
+
+ Closes: #104
+ Signed-off-by: Gregor Jasny
+
+Brad House (6 Jun 2017)
+- [ChristianAmmer brought this change]
+
+ Added support for Windows DNS Suffix Search List (#93)
+
+ This change solves issue #53.
+
+ Support for suffix search lists was already built in for Linux. The search list could be set via set_search. With this change the suffix search list from Windows is read from the registry and then set into the ares configuration via set_search. There are two sources for the search list:
+
+ The global DNS suffix search list.
+ The primary and connection specific DNS suffixes if the global is not available.
+
+ Contributed by @ChristianAmmer
+
+Daniel Stenberg (25 May 2017)
+- [Thomas Köckerbauer brought this change]
+
+ configure: do not heck for ar if specified manually
+
+ Closes #62
+
+David Drysdale (23 May 2017)
+- ares_expand_name: limit number of indirections
+
+- test: fuzz input file that takes a while to process
+
+- test: copy data in fuzz regression driver
+
+ Oops.
+
+GitHub (23 May 2017)
+- [David Drysdale brought this change]
+
+ Convert char from ISO-8859-1 to UTF-8 (#99)
+
+ Fixes #97
+
+- [Gregor Jasny brought this change]
+
+ travis: Use trusty for cmake builds (#109)
+
+ kubuntu-backports dropped the CMake package for Precise
+
+David Drysdale (2 May 2017)
+- [David Hotham brought this change]
+
+ msvc_ver.inc support most recent Visual Studio 2017 (#101)
+
+- test: use io.h not unistd.h for Windows
+
+- test: try building fuzz binaries on Windows
+
+- test: stick to int in ares-fuzz.c
+
+ Using int rather than ares_ssize_t means this file
+ needs no c-ares dependency - it's a general driver for
+ any libFuzzer-style entrypoint.
+
+- test: force ARES_OPT_NOROTATE for no-rotate tests
+
+- test: check expected NOROTATE value
+
+- ares_create_query: use ares_free not naked free
+
+ Accidentally added in commit 65c71be1cbe5
+ ("ares_create_query: avoid single-byte buffer overwrite")
+
+Brad House (17 Mar 2017)
+- Need ares.h for ares_ssize_t
+
+- tests should not use ssize_t, use ares_ssize_t
+
+GitHub (16 Mar 2017)
+- [Brad House brought this change]
+
+ Portability updates for legacy systems. (#92)
+
+ Socklen_t should not be used in code, instead ares_socklen_t should be used.
+ Convert ssize_t to ares_ssize_t for portability since the public API now exposes this.
+
+David Drysdale (14 Mar 2017)
+- [Michael Osei brought this change]
+
+ Update msvc_ver.inc (#91)
+
+ For Visual Studio 2017 builds
+
+Daniel Stenberg (13 Mar 2017)
+- [Brad House brought this change]
+
+ Windows DNS server sorting (#81)
+
+ Original Patch From Brad Spencer:
+ https://c-ares.haxx.se/mail/c-ares-archive-2016-04/0000.shtml
+
+ My modifications include:
+ * Dynamically find GetBestRoute2 since it is a Windows Vista+ symbol, and will fall back to prior behavior when not available.
+ * Prefer get_DNS_AdaptersAddresses as the modifications should alleviate the concerns which caused us to prefer get_DNS_NetworkParams
+ * Update AppVeyor to use MinGW-w64 instead of the legacy MinGW
+ * Fix compile error in test suite for Windows.
+
+ Original message from patch below:
+
+ From: Brad Spencer
+ Date: Fri, 29 Apr 2016 14:26:23 -0300
+
+ On Windows, the c-ares DNS resolver tries first to get a full list of
+ DNS server addresses by enumerating the system's IPv4/v6 interfaces and
+ then getting the per-interface DNS server lists from those interfaces
+ and joining them together. The OS, at least in the way the c-ares
+ prefers to query them (which also may be the only or best way in some
+ environments), does not provide a unified list of DNS servers ordered
+ according to "current network conditions". Currently, c-ares will then
+ try to use them in whatever order the nested enumeration produces, which
+ may result in DNS requests being sent to servers on one interface
+ (hosting the current default route, for example) that are only intended
+ to be used via another interface (intended to be used when the first
+ interface is not available, for example). This, in turn, can lead to
+ spurious failures and timeouts simply because of the server address
+ order that resulted because of the enumeration process.
+
+ This patch makes the (safe?) assumption that there is no other better
+ rule to chose which interface's DNS server list should be prioritized.
+ After all, a DNS lookup isn't something "per network"; applications
+ don't look up "these DNS names on this interface and those DNS names on
+ that interface". There is a single resource pool of DNS servers and the
+ application should presume that any server will give it the "right"
+ answer. However, even if all DNS servers are assumed to give equally
+ useful responses, it is reasonable to expect that some DNS servers will
+ not accept requests on all interfaces. This patch avoids the problem by
+ sorting the DNS server addresses using the Windows IPv4/v6 routing tables.
+
+ For example, a request to DNS server C on interface 2 that is actually
+ sent over interface 1 (which may happen to have the default route) may
+ be rejected by or not delivered to DNS server C. So, better to use DNS
+ servers A and B associated with interface 1, at least as a first try.
+
+ By using the metric of the route to the DNS server itself as a proxy for
+ priority of the DNS server in the list, this patch is able to adapt
+ dynamically to changes in the interface list, the DNS server lists per
+ interface, which interfaces are active, the routing table, and so on,
+ while always picking a good "best" DNS server first.
+
+ In cases where any DNS server on any interface will do, this patch still
+ seems useful because it will prioritize a lower-metric route's (and thus
+ interface's) servers.
+
+David Drysdale (22 Feb 2017)
+- [Sergii Pylypenko brought this change]
+
+ docs: fixed references to ares_set_local_ip4 and ares_set_local_ip6
+
+- [Calle Wilund brought this change]
+
+ ares test: fix win32 build errors with virtual socket function tests
+
+ The added api requires both some typedefs not previously imported
+ into the test build + the test code did not fully deal with
+ socket differences on windows.
+
+- [Calle Wilund brought this change]
+
+ ares_process: fix return type of socket_create function (win32 warning)
+
+Daniel Stenberg (31 Jan 2017)
+- [Calle Wilund brought this change]
+
+ ares_set_socket_functions: Add man page
+
+ Providing some rudimentary documentation for the added functionality
+
+ Closes #72
+
+- [Calle Wilund brought this change]
+
+ ares-test: Add test helpers and cases for virtual socket IO
+
+ * Added test case macro to automatically run tests twice, once "normal",
+ once with virtual IO.
+ * Changed most "live" query tests to run in dual mode to verify
+ at least simple socket IO via virtual functions
+ * Added test case for settings/duping socket functions & callback data
+
+- [elcallio brought this change]
+
+ Implement using virtual socket IO functions when set
+
+ Uses virtual socket IO functions when set on a channel.
+ Note that no socket options are set, nor is any binding
+ done by the library in this case, since the client defining
+ these is probably more suited to deal with this.
+
+- [elcallio brought this change]
+
+ Add virtual function set for socket IO
+
+ Defines a structure of basic create, close, read/write
+ functions as virtual function calls, settable for individual
+ c-ares channels.
+
+David Drysdale (30 Jan 2017)
+- test: ignore aresfuzzname binary
+
+Gregor Jasny (14 Jan 2017)
+- [Stephen Sorley brought this change]
+
+ Always use check_symbol_exists instead of check_function_exists.
+
+- Also add includes to TARGETS_INST_DEST
+
+- [Stephen Sorley brought this change]
+
+ Windows build fixes
+
+- CMake: Export targets
+
+- CMake: Use GNUInstallDirs for install location defaults
+
+David Drysdale (11 Jan 2017)
+- Update Makefile.am for renamed INSTALL.md
+
+GitHub (11 Jan 2017)
+- [David Drysdale brought this change]
+
+ docs: convert INSTALL to MarkDown & tweak (#83)
+
+- [Gregor Jasny brought this change]
+
+ Merge pull request #77 from stephen-sorley/cmake_modernize
+
+ Updated CMake minimum version to 2.8.12.
+
+Stephen Sorley (4 Jan 2017)
+- Changed executables to depend directly on internal libcares target, instead of against
+ the external-facing alias targets.
+
+- Updated Travis to pull CMake 2.8.12 from kubuntu-backports ppa.
+
+- Updated CMake minimum version to 2.8.12.
+
+ Changed the way usage requirements (include dirs, compile defs, dependent libraries) are specified, to match the recommended standard practice for modern CMake. This involves using target-specific functions (target_include_directories, target_compile_definitions, etc.), along with the PUBLIC, PRIVATE or INTERFACE modifiers.
+
+ Updated chain-building support to imitate new-style Find modules (import libs), instead of old-style Find modules (cache variables).
+
+David Drysdale (26 Dec 2016)
+- [Chris Araman brought this change]
+
+ configure: clock_gettime workaround (#75)
+
+ Commits 7518c26, c41726b, and bc14ee7 brought this workaround to the CMake build system. This expands it to the autoconf build system.
+
+ Fixes #71
+
+- test: add fuzz entrypoint for ares_create_query()
+
+- test: Add gTest/gMock files to SOURCES
+
+ Built tarballs are not including all of the files needed
+ to build the test suite because they are missing from the
+ _SOURCES variable in Makefile.am.
-- build: Allow header compilation by Windows C++ compiler
+- travis: Move build scripts under travis/
+
+ Travis doesn't always propagate errors in inline multi-line
+ scripts, so move them all to be explicit shell scripts, each
+ with set -e.
-- build: Expose whether symbol hiding is on
+- travis: check distributed tarball builds
+
+Daniel Stenberg (25 Oct 2016)
+- dist: ship msvc_ver.inc too
- Adding the CARES_SYMBOL_HIDING definition allows the test suite to
- detect whether internal symbols are available or not.
+ Reported-by: Bruce Stephens
+
+ Fixes #69
-- build: Add autoconf macros for C++11 code using pthreads
+- [Aaron Bieber brought this change]
+
+ fix build on OpenBSD
+
+- ares_version.h: bump, working on 1.12.1 now
+
+GitHub (18 Oct 2016)
+- [Gregor Jasny brought this change]
+
+ Merge pull request #64 from bradh352/master
- Pull in testing macros from the GNU autoconf archive to allow
- configure scripts to test for and setup use of a C++11 compiler
- (AX_CXX_COMPILE_STDCXX_11) and the pthreads library (AX_PTHREAD).
+ Add CMake build system support to C-Ares.
+
+Brad House (5 Oct 2016)
+- suggested PROJECT_NAME change broke chain building as it needs the magic PROJECT_NAME set in the ADD_LIBRARY for matching. Fix to make both goals work
+
+- update MacOSX 10.12 detection
+
+- Expand XCode clock_gettime fix to include MacOS 10.12, not just iOS10
+
+David Drysdale (4 Oct 2016)
+- Revert "travis: work around bug in PyCParser"
- Note that these macros are not used by the main library autoconf,
- just by the tests (which share the same m4/ directory).
+ This reverts commit a24a10a348fc00b8cfd684d91894a1df14880ea9.
-- build: Add a code coverage option
+- travis: work around bug in PyCParser
- Configure with:
- ./configure --enable-code-coverage
- Show coverage output with:
- make code-coverage-capture
+ See https://github.com/pyca/cryptography/issues/3187
+
+Brad House (3 Oct 2016)
+- PROJECT_SOURCE_DIR instead of CMAKE_CURRENT_SOURCE_DIR as per @gjasny
+
+- use a project name of c-ares as per @gjasny
+
+- Import curl conversion of Makefile.inc to cmake form dynamically as per bdoetsch@ameritech.net to make maintaining multiple build systems easier
+
+Daniel Stenberg (30 Sep 2016)
+- dist: add ares_library_initialized.* to the tarball
+
+David Drysdale (30 Sep 2016)
+- test: check ares_create_query with too-long name
+
+Daniel Stenberg (30 Sep 2016)
+- man pages: minor formatting edits
+
+Brad House (29 Sep 2016)
+- merge fc7917e from @daviddrysdale ... travis build updates for cmake
+
+- cleanups as per @gjasny ... Use naked IF statements and use NOT DEFINED
+
+Version 1.12.0 (29 Sep 2016)
+
+Daniel Stenberg (29 Sep 2016)
+- RELEASE-NOTES: 1.12.0
+
+- [David Drysdale brought this change]
+
+ ares-test-misc: test ares_create_query with escaped trailing dot
+
+- ares_create_query: avoid single-byte buffer overwrite
- Built on m4/ax_code_coverage.m4 from the GNU autoconf archive
- to provide the macros to check for presence of gcov + lcov;
- upstream macro modified to:
- - Remove use of $(AM_DEFAULT_VERBOSITY) , as earlier versions of
- autoconf (such as the one used by default on Travis) do not have this.
- - Rather than automatically defining CODE_COVERAGE_RULES to be a set
- of makefile rules that use ifeq/endif (which is GNU make-specific),
- instead only define CODE_COVERAGE_RULES if coverages is turned on,
- and in that case don't use conditionals in the makefile.
+ ... when the name ends with an escaped dot.
+
+ CVE-2016-5180
+
+ Bug: https://c-ares.haxx.se/adv_20160929.html
-- api: Add entrypoints to allow use of per-server ports
+Brad House (29 Sep 2016)
+- CMake: Unify library versioning with the libtool methodology to make keeping library versions in sync easier with the autotools build system
+
+Daniel Stenberg (29 Sep 2016)
+- ares_library_initialized.3: added
+
+- make: bump CARES_VERSION_INFO for release
+
+David Drysdale (29 Sep 2016)
+- man: update ares_init_options.3
+
+Daniel Stenberg (29 Sep 2016)
+- ares_library_init.3: corrected the ares_library_init_mem proto
+
+Brad House (28 Sep 2016)
+- XCode v8 introduced clock_gettime() for iOS v10. However, it is a weak symbol, which means when earlier iOS versions try to use clock_gettime() it results in a crash due to the missing symbol. Detect this condition and do not set HAVE_CLOCK_GETTIME_MONOTONIC.
+
+- Adds cmake build system support to C-Ares.
- Add user-visible entrypoints ares_{get,set}_servers_ports(3), which
- take struct ares_addr_port_node rather than struct ares_addr_node.
- This structure includes a UDP and TCP port number; if this is set
- to zero, the channel-wide port values are used as before.
+ The patch does not modify any source files, it only adds 3 new files
+ (CMakelists.txt, ares_build.h.cmake, ares_config.h.cmake) which form the
+ build system. I've tried to go through as much of the autotools tests and
+ extracted what I thought was appropriate, though many of the tests aren't
+ as in-depth in CMake as they are for autotools ... it is unclear why some
+ of them exist at all, I'm guessing for legacy systems that CMake probably
+ doesn't support anyhow.
- Similarly, add a new ares_set_servers_ports_csv(3) entrypoint, which
- is analogous to ares_set_servers(3) except it doesn't ignore any
- specified port information; instead, any per-server specified port
- is used as both the UDP and TCP port for that server.
+ Building the library, and examples (adig, ahost, acountry) plus installation
+ should work across a large number of tested platforms. The tests have not
+ yet been integrated.
+
+Daniel Stenberg (27 Sep 2016)
+- README.md: remove space from link
+
+- README: link to the correct c-ares badge!
- The internal struct ares_addr is extended to hold the UDP/TCP ports,
- stored in network order, with the convention that a value of zero
- indicates that the channel-wide UDP/TCP port should be used.
+ Reported-by: David Hotham
- For the internal implementation of ares_dup(3), shift to use the
- _ports() version of the get/set functions, so port information is
- transferred correctly to the new channel.
+ Fixes #63
+
+- docs: minor formatting edits
+
+- ares_destroy.3: formatting polish
+
+- ares_init.3: split the init docs into two separate man pages
+
+- SECURITY: point to the vulnerabilities page now
+
+- RELEASE-NOTES: synced with daa7235b1a5
+
+- ares_create_query.3: edit language
- Update manpages, and add missing ares_set_servers_csv to the lists
- while we're at it
+ Tried to make the man page more readable.
-- api: Add ares_set_sortlist(3) entrypoint
+David Drysdale (26 Sep 2016)
+- test: fix gMock to work with gcc >= 6.x
- Allow explicit configuration of the channel's sortlist, by
- specifying a string in the same format as the equivalent
- /etc/resolv.conf option.
+ Taken from:
+ https://github.com/google/googletest/issues/705#issuecomment-235067917
+
+Daniel Stenberg (26 Sep 2016)
+- [Brad House brought this change]
+
+ headers: remove checks for and defines of variable sizes
- This allows library users to perform the same configuration
- that is available via /etc/resolv.conf, but without needing
- to change that file.
+ ... they're not really used and by avoiding them in the ares_build.h
+ output we make the public header less dependent on data sizes.
-- api: Allow injection of user-specified malloc/free functions
+David Drysdale (24 Sep 2016)
+- api: add ARES_OPT_NOROTATE optmask value
- Add a new ares_library_init_mem() initialization function for the
- library which allows the library user to specify their own malloc,
- realloc & free equivalents for use library-wide.
+ Fix up a couple of problems with configuring whether c-ares rotates
+ between different name servers between requests.
- Store these function pointers in library-wide global variables,
- defaulting to libc's malloc(), realloc() and free().
+ Firstly, ares_save_options() returns (in *optmask) the value of
+ (channel->optmask & ARES_OPT_ROTATE), which doesn't necessarily
+ indicate whether the channel is or is not actually doing rotation.
+ This can be confusing/incorrect if:
+ - the channel was originally configured without ARES_OPT_ROTATE
+ (so it appears that the channel is not rotating)
+ - the /etc/resolv.conf file includes the 'rotate' option
+ (so the channel is actually performing rotation).
- Change all calls to malloc, realloc and free to use the function pointer
- instead. Also ensure that ares_strdup() is always available
- (even if the local environment includes strdup(3)), and change the
- library code to always use it.
+ Secondly, it is not possible to reliably configure a channel
+ to not-rotate; leaving off ARES_OPT_ROTATE is not enough, since
+ a 'rotate' option in /etc/resolv.conf will turn it on again.
- Convert calls to calloc() to use ares_malloc() + memset
+ Therefore:
+ - add an ARES_OPT_NOROTATE optmask value to allow explicit
+ configuration of no-rotate behaviour
+ - in ares_save_options(), report the value of channel->rotate
+ as exactly one of (optmask & ARES_OPT_ROTATE) or
+ (optmask & ARES_OPT_NOROTATE).
+
+ In terms of back-compatibility:
+ - existing apps that set ARES_OPT_ROTATE will continue to rotate,
+ and to have ARES_OPT_ROTATE reported back from ares_save_options()
+ - existing apps that don't set ARES_OPT_ROTATE will continue to
+ use local config/defaults to decide whether to rotate, and will
+ now get ARES_OPT_ROTATE or ARES_OPT_NOROTATE reported back from
+ ares_save_options() rather than 0.
-- api: Add option to expose some internal functions
+- ares_init_options: only propagate init failures from options
- Purely for testing, add --enable-expose-statics option to configure
- which converts some static internal functions to be externally visible.
+ Commit 46bb820be3a8 ("ares_init_options: don't lose init failure")
+ changed init behaviour so that earlier errors in initialization
+ weren't lost. In particular, if the user passes in specific
+ options but they are not applied (e.g. because of an allocation
+ failure), that failure needs to be reported back to the user; this
+ also applies when duplicating a channel with ares_dup().
+
+ However, other initialization failures can be ignored and
+ overridden -- in particular, if init_by_resolv_conf() or
+ init_by_environment() fail, then falling back to default values
+ is OK.
+
+ So only preserve failures from the init_by_options() stage, not
+ from all initialization stages.
+
+ Fixes issue 60.
-- api: Expose the ares_library_initialized() function
+- test: Force reinstall of libtool on OSX
+
+ Travis build environment appears to have changed.
+
+- test: Add valgrind build variant
+
+- test: Add null pointer to gtest args
+
+ GoogleTest assumes that there is a null pointer in argv[argc],
+ so make it look like that. Without this change, tests run with
+ command-line arguments get memory errors under valgrind/ASAN.
+
+Daniel Stenberg (21 Aug 2016)
+- AUTHOR: maybe gitgub isn't really an author =)
-- ahost: Allow repeated -s options
-
- This also removes a potential leak where later -s options would
- replace earlier ones without freeing the relevant string.
+- AUTHORS: added contributors from the git log
-- Mark unhittable lines
+- LICENSE.md: add a stand-alone license file
- Add comments for the benefit of the lcov tool, marking
- lines that cannot be hit. Typically these are fall-back
- protection arms that are already covered by earlier checks,
- and so it's not worth taking out the unhittable code (in case
- someone changes the code between the two places in future).
+ Just the MIT license used in the top the source files moved out to a
+ stand-alone file for easier reference and discovery.
-- ares_set_servers_csv.3: make return type match code
+- README: added "CII best practices" badge
-- bitncmp: update comment to match code behaviour
+- SECURITY.md: suggested "security process" for the project
-- ares_striendstr: fix so non-NULL return can happen
+David Drysdale (17 Aug 2016)
+- test: Add Clang static analysis build to Travis
- This looks to have been broken since it was first introduced in 2005 in
- commit aba0b775ea30 ("Added ares_getnameinfo which mimics the
- getnameinfo API")
+ Run scan-build over the library source code, but skip the
+ tests. Needs a later Clang install in Travis
-- config_sortlist: free any existing sortlist on (re)alloc failure
-
- If we get an allocation failure on 2nd or later entry in the sortlist, the
- code would return ENOMEM but still leave the initial entries allocated.
- Ensure that *sortlist is set to NULL whenever ENOMEM is returned.
+- test: more info on how to run fuzz testing
-- ares_dup: clear new channel on failure
-
- If the attempt to transfer IPv6 servers from the old to the new channel
- fails, the previous code would still return a channel to the user even though
- an error return code was generated. This makes it likely that users would
- leak the channel, so explicitly clear the channel in this case.
+- test: make fuzzer driver code C not C++
-- ares_init_options: don't lose init failure
+- test: fuzzer mode for AFL's persistent mode
- If (say) init_by_options() fails, the subsequent call to
- init_by_defaults() was overwriting the return code with
- success. Still call init_by_defaults() regardless, but track
- its return value separately
-
-- ares_gethostbyname: don't leak valid-but-empty hostent
+ When fuzzing with AFL, if the LLVM-based instrumentation is
+ used (via the afl-clang-fast wrapper), then it is possible to
+ have a single execution of the fuzzer program iterate multiple
+ times over the fuzzing entrypoint (similar to libFuzzer's normal
+ mode of execution) with different data. This is much (e.g. 10x)
+ faster.
- If an AF_UNSPEC query gets a valid response to its AAAA query,
- but which has no IPv6 addresses in it, then the code chains on to
- a A record query. However, the hostent from the AAAA response
- was being leaked along the way (because it gets replaced before
- the follow-on end_hquery() invocation).
+ Add code to support this, by checking whether __AFL_LOOP is
+ defined at compile-time.
+
+ Also, shift the code to effectively be C rather than C++.
-- ares_parse_txt_reply: propagate errors from per-substring loop
+- test: simplify deps for fuzzer entrypoint
- If we get an allocation failure when processing a particular substring in a
- TXT record, that failure is silently lost; fix that by propagating errors from
- the inner loop to the outer loop.
+ No need to depend on the rest of the test code (ares-test.h) for
+ the fuzzer entrypoint; this makes the entrypoint slightly simpler
+ to build with LLVM's libFuzzer.
+
+ Also shift the code to effectively be C rather than C++
-- process_answer: fix things up correctly when removing EDNS option
+- test: disable MinGW tests
- When a server rejects an EDNS-equipped request, we retry without
- the EDNS option. However, in TCP mode, the 2-byte length prefix was
- being calculated wrong -- it was built from the answer length rather than
- the length of the original request.
+ The test binary built in the MinGW build is failing for some
+ reason. It works for me when I build locally, so I'm guessing
+ it's down to some sort of AppVeyor environment issue.
- Also, it is theoretically possible that the call to realloc() might change
- the data pointed to; to allow for this, qbuf also needs updating.
+ Disable for now.
+
+Daniel Stenberg (16 Aug 2016)
+- read_tcp_data: remove superfluous NULL check
- (Both these fixes were actually included in a patchset sent on the mailing
- list in Oct 2012, but were included with other functional changes that
- didn't get merged:
- http://c-ares.haxx.se/mail/c-ares-archive-2012-10/0004.shtml)
+ CID 56884 by Coverity. The pointer is already derefenced before this
+ point so it can't be NULL here anyway.
-- ares__read_line: clear buf pointer on realloc failure
+- web: http => https
-- ares_expand_name: check for valid bits in label length
+GitHub (20 Jul 2016)
+- [David Drysdale brought this change]
+
+ Merge pull request #59 from fuze/master
- The top two bits of the label length indicate whether this is a
- label length (00) or an index to a name elsewhere in the message
- (11). RFC1035 4.1.4 says that the other possible values for the
- top two bits (01, 10) are reserved for future use.
+ Update msvc_ver.inc for VS2015 Update 3
-Daniel Stenberg (23 Jan 2016)
-- [Gregor Jasny brought this change]
+- [Chris Araman brought this change]
- Fix typos detected by lintian
+ Update msvc_ver.inc
- Closes #32
+ support Visual Studio 2015 Update 3
-- [Gregor Jasny brought this change]
+David Drysdale (2 May 2016)
+- Fix trailing comment for #endif
- Distribute all man pages
+Daniel Stenberg (30 Apr 2016)
+- email: use Gisle's "new" address
-- README.cares: s/I/Daniel
+David Drysdale (18 Apr 2016)
+- test: drop superfluous fuzz inputs
- ... and add a pointer to an existing version of the original area 1.1.1
- package.a
+ Where there are multiple fuzz input files that only differ in
+ the first two bytes (the query ID), just keep the first such
+ file.
-- read_tcp_data: don't try to use NULL pointer after malloc failure
+svante karlsson (15 Apr 2016)
+- Update msvc_ver.inc
- CID 56884, pointed out by Coverity. We really should make this function
- return an error code so that a malloc() failure can return back a major
- failure.
+ support Visual Studio 2015 Update 2
-- configure_socket: explicitly ignore return code
-
- CID 56889 in Coverity pointed out the return code from setsocknonblock()
- is ignored, and this added typecast to (void) makes it explicit.
+David Drysdale (31 Mar 2016)
+- test: Run fuzzcheck.sh in Travis build
-- ahost: check the select() return code
+- test: add fuzzing check script to tests
- Fixes CID 137189, pointed out by Coverity
+ Add a test script that runs the fuzzing command over the
+ corpus of DNS packets. This doesn't actually do any fuzzing
+ (it just runs them as inputs without generating any variations)
+ but it does ensure that the fuzzing entrypoint is still working.
-David Drysdale (18 Jan 2016)
-- Fix buildconf on platforms using glibtoolize
+- test: allow multiple files in aresfuzz command line
- Commit c49a87eea538 changed buildconf to only check for
- libtoolize, but missed a line
+ If no arguments are specified, use stdin as input.
+ Otherwise treat each argument as a filename and feed
+ its contents to the fuzz entrypoint.
-- Don't exit loop early leaving uninitialized entries
-
- Update for commit affc63cba875d.
+- test: Add corpus of DNS packets
- The original patch from Gregor Jasny did not have the break
- statement; I incorrectly added it to prevent continuing the loop.
- However, the later entries in the array would then be left
- uninitialized, causing problems for later cleanup.
+ For fuzz testing it is useful to start from a corpus of valid
+ packets, so fill out the test/fuzzinput/ directory with a bunch
+ of inputs.
- So fix to match Gregor's original patch, with apologies.
+ These packets were generated by temporarily modifying the c-ares
+ process_answer() function to save off any incoming response messages.
-Daniel Stenberg (18 Jan 2016)
-- buildconf: remove check for libtool, it only requires libtoolize
+- test: Add utility to show DNS packet from file
-David Drysdale (17 Jan 2016)
-- [Gregor Jasny brought this change]
+- [nordsturm brought this change]
- Use libresolv to initialize cares on iPhone targets
+ Fix nsort initialization
- On iPhone targets like iOS, watchOS or tvOS the file
- /etc/resolv.conf cannot be used to configure cares.
+ Author: Alexander Drachevskiy
+ http://c-ares.haxx.se/mail/c-ares-archive-2014-07/0004.shtml
+ http://c-ares.haxx.se/mail/c-ares-archive-2014-07/0014.shtml
+
+- test: Check setting nsort=0 option is respected
+
+- test: Update fuzzing function prototype
- Instead the resolver library is queried for configuration
- values.
+ libFuzzer changed expected return type from void to int
+ in LLVM 3.8.
+
+- Explicitly clear struct servent before use
- CC: Yury Kirpichev
+ On a build where MSAN has been manually set up (which involves
+ using an MSAN-instrumented version of the standard C++ library, see
+ https://github.com/google/sanitizers/wiki/MemorySanitizerLibcxxHowTo)
+ there's a warning about use of uninitialized memory here. It
+ might be a false positive, but the fix is trivial so include it.
-Daniel Stenberg (17 Jan 2016)
-- README: updated to new repo URL
+- test: for AF_UNSPEC, return CNAME only for AAAA, but valid A record
+
+ Also shuffle expected responses rsp6/rsp4 into the order they will occur.
-David Drysdale (14 Jan 2016)
-- [Lei Shi brought this change]
+- [Chris Araman brought this change]
- Fixing slow DNS lookup issue
-
- This patch is fixing the dns lookup issue due to dummy dns information
- of a disconnected adapter(in my case is a bluetooth adapter). I changed
- the dns lookup policy to try GetNetworkParams first because the
- GetNetworkParams provides the most reliable dns information (lots of
- checks were done by system). I also filter out inoperable adapter in
- DNS_AdaptersAddresses in case GetNetworkParams fail.
+ msvc_ver.inc: support Visual Studio 2015 Update 1
-- Merge pull request #30 from p-push/vs-2015
+- build: commonize MSVC version detection
- Support Visual Studio 2015
+ Remove the need to copy/paste version number mapping between
+ Makefile.msvc and test/Makefile.msvc.
-Oleg Pudeyev (3 Jan 2016)
-- [Gisle Vanem brought this change]
+- test: Use different name in live test
- Support Visual Studio 2015
+- test: Only pass unused args to GoogleTest
-David Drysdale (11 Nov 2015)
-- [Andrew Andkjar brought this change]
+- ahost.c: add cast to fix C++ compile
+
+ If ahost.c is force-compiled as C++ the missing cast from
+ (void *) to (char **) is problematic.
- added another version case to Makefile.msvc
+- ares_library_cleanup: reset ares_realloc too
- nmake version 11.00.61030.0 resolves to CC_VERS_NUM = 110
+ Otherwise a subsequent use of the library might use a previous
+ incarnation's realloc() implementation.
+
+Daniel Stenberg (9 Mar 2016)
+- [Brad House brought this change]
+
+ configure: check if tests can get built before enabled
+
+ The current approach for disabling tests is not a good solution because
+ it forces you to pass --disable-tests, rather than auto-detect if your
+ system can support the tests in the first place. Many (most?) systems
+ do not have C++11. This also causes issues when chain-building c-ares,
+ the hosting system needs to be updated to support passing this
+ additional flag if necessary, it doesn't seem reasonable to add this
+ requirement which breaks compatibility.
+
+ This change auto-detects if the system can build the tests and
+ automatically disable them if it cannot. If you pass --enable-tests to
+ configure and the system cannot build them either due to lack of system
+ support, or because cross-compilation is being used, it will throw an
+ appropriate error since the user indicated they really did want the
+ tests.
-- Merge pull request #26 from bitbouncer/vs-2013
-
- added define for visual studio 2013
+David Drysdale (3 Mar 2016)
+- [Viktor Szakats brought this change]
-svante karlsson (25 Jun 2015)
-- added define for visual studio 2013
+ Makefile.m32: add support for CROSSPREFIX
-Jakub Hrozek (6 Nov 2014)
-- ares__read_line: free buf on realloc failure
+- [Viktor Szakats brought this change]
-- Destroy options if ares_save_options fails
+ Makefile.m32: add support for extra flags
- It's possible that, if ares_save_options failed, the opts structure
- would contain some allocated memory. Calling ares_destroy_options in
- this case is safe, because ares_save_options zeroes out the memory
- initially.
+ Allow specification of CARES_{LD,C}FLAG_EXTRAS envvars
+ for mingw
-- [David Drysdale brought this change]
+- test: Build with MinGW on AppVeyor
- Continue loop if space for hostname not large enough
-
- When attempting to build a search domain from the local hostname
- (used as a fallback when no other methods have given a search
- domain), the code doubles the buffer size on each loop iteration.
+- test: avoid in6addr_* constants
- However, the loop previously had a WHILE_FALSE terminator so the continue
- statement exited the loop rather than going round again.
+ These aren't available on MinGW, so use explicit addresses instead.
-Daniel Stenberg (30 Oct 2014)
-- ares_getnameinfo.3: there is no ares_getaddrinfo
+- test: add missing #includes for dns-proto.cc
-David Drysdale (30 Sep 2014)
- [Gregor Jasny brought this change]
- Prevent tmpbuf from overrunning
-
- Fix Coverity error CID 56886.
+ Fix man page typos detected by Lintian
+
+Daniel Stenberg (19 Feb 2016)
+- configure: acknowledge --disable-tests
- Signed-off-by: Gregor Jasny
+ Fixes #44
-- [Gregor Jasny brought this change]
+- AUTHORS: added contributors from the 1.11.0 release
- Re-start loop if select fails
-
- Fix Coverity error CID 56882
-
- Signed-off-by: Gregor Jasny
+- bump: start working on the next version
-- [Gregor Jasny brought this change]
+Version 1.11.0 (19 Feb 2016)
- Free temporary variable in error path
+Daniel Stenberg (19 Feb 2016)
+- RELEASE-NOTES: final edits for 1.11.0
+
+David Drysdale (15 Feb 2016)
+- ares_dup.3: remove mention of nonexistent function
- Fix Coverity CID 56890
+ ares_dup_options() doesn't exist, so don't document it.
+
+- test: skip repeated build steps
- Signed-off-by: Gregor Jasny
+ Top-level buildconf/configure now triggers for the
+ test/ subdir too, so don't need to do explicitly.
-- [Gregor Jasny brought this change]
+- test: namespaces unavailable when cross-compiling
- Fix integer shift overflow if both tcp_socket and udp_socket are set
+Daniel Stenberg (13 Feb 2016)
+- configure: only run configure in test when NOT cross-compiling
- The problem occurs if at the start of the loop the sockindex is at the
- last valid ARES_GETSOCK_MAXNUM position. If then both udp_socket and
- tcp_socket are valid, sockindex gets incremented for UDP first and
- points one entry behind the array for the tcp block.
- So the fix is to check after every increment of sockindex if it is still
- valid.
+ ... as the tests won't run cross-compiled anyway
+
+David Drysdale (13 Feb 2016)
+- test: prefer ON_CALL to EXPECT_CALL to reduce flakes
- Fix Coverity error CID 56878
+ For UDP tests, there's a chance of a retry. EXPECT_CALL only
+ expects a single request to arrive at the server; ON_CALL allows
+ for a UDP retry and repeats the same answer.
- Signed-off-by: Gregor Jasny
+ Note that ON_CALL and EXPECT_CALL can't be mixed in the same
+ test, and that tests that have a varied sequence of responses
+ for the same repeated request still have to use EXPECT_CALL.
+
+Daniel Stenberg (13 Feb 2016)
+- configure: run configure in 'test' too
+
+ Having the test dir completely stand-alone causes too many issues for
+ users and devs. It still needs to be built specifically.
+
+- configure: build silently by default
+
+- buildconf: run test/buildconf too if present
+
+- test/configure: build silently by default
- [Gregor Jasny brought this change]
- Null check before dereference
-
- Fix Coverity error CID 56880
+ dist: Distribute README.md
- Signed-off-by: Gregor Jasny
+ Closes #42
-Jakub Hrozek (28 Jul 2014)
-- [Gisle Vanem brought this change]
+Version 1.11.0 (11 Feb 2016)
- Comment in ares_ipv6.h
+Daniel Stenberg (11 Feb 2016)
+- Makefile.am: distribute the test dir too
-David Drysdale (25 Jul 2014)
-- CONTRIBUTING: add file to indicate mailing list is preferred
+- RELEASE-NOTES: synced with 385582bd14b68a
-- Add -t u option to ahost
+- [Nicolas \"Pixel\" Noble brought this change]
+
+ ares_win32_init: make LoadLibrary work when using UNICODE too
- Add an option to allow specification of the AF_UNSPEC
- address family.
+ Closes #17
-Jakub Hrozek (24 Jul 2014)
-- host_callback: Fall back to AF_INET on searching with AF_UNSPEC
+David Drysdale (11 Feb 2016)
+- Use "resolve" as synonym of "dns" in nsswitch.conf
- Previously, when an ares_gethostbyname() searched with AF_UNSPEC and the
- first AF_INET6 call only returned CNAMEs, the host_callback never
- retried AF_INET.
+ Modern Linux systems may have libnss_resolve from systemd as the
+ resolver, which is then configured in /etc/nsswitch.conf with
+ the "resolve" keyword rather than "dns".
- This patch makes sure than on ARES_SUCCESS, the result of AF_INET6 is
- taken as authoritative only if the result contains some addresses.
+ Fixes #33
-- [David Drysdale brought this change]
+- ares_set_socket_callback: make manpage match code
+
+ The code in ares_process.c that invokes the socket creation/connection
+ callback only checks for rc < 0, not for standard ares error codes.
- Move memset call below platform-specific declarations
+- Merge pull request #36 from AGWA-forks/master
- A GitHub commenter [1] says that my recent change to ahost.c has
- problems compiling on Windows + C89 platforms.
+ Add ares_set_socket_configure_callback()
+
+- test: Update init tests to match behaviour
- [1] https://github.com/bagder/c-ares/commit/ee22246507c9#commitcomment-6587616
+ Unreadable config files are now treated the same way
+ as absent config files.
-- [David Drysdale brought this change]
+- [Fedor Indutny brought this change]
- Update ahost man page to describe -s option.
+ Ignore `fopen` errors to use default values
- Commit ee22246507c9 added the -s option to the
- ahost command, but neglected to update the man page to
- describe it.
+ After 46bb820be3a83520e70e6c5f0c5133253fcd69cd `init_by_resolv_conf`
+ errors are no longer swallowed in `ares_init_options`. This has exposed
+ a previously unknown bug in `lookups` initialization code.
- Also fix typo in description of -t option.
+ If there is no lookup configuration in `resolv.conf`,
+ `init_by_resolv_conf` will attempt to read it from other files available
+ on the system. However, some of these files may have restricted
+ permissions (like `600`), which will lead to `EACCESS` errno, which in
+ turn is handled like a fatal error by `init_by_resolv_conf`.
+
+ However, it sounds illogical that this error should be handled as a
+ fatal. There is a `init_by_defaults` call that overrides `lookups` with
+ default value, and certainly possible absence of lookup information is
+ the reason why this function exists in a first place!
+
+ I suggest handling any `fopen` errors as non-fatal ones, allowing to
+ pick up the `lookups` value from different config files, or to pick up
+ default value.
-- ares_parse_soa_reply: Do not leak rr_name on allocation failure
+Andrew Ayer (9 Feb 2016)
+- Document callback type in man page for ares_set_socket_callback
+
+- Add ares_set_socket_configure_callback()
- If ares_malloc_data failed, already allocated rr_name would go out of
- scope.
+ This function sets a callback that is invoked after the socket is
+ created, but before the connection is established. This is an ideal
+ time to customize various socket options.
-- [David Drysdale brought this change]
+David Drysdale (9 Feb 2016)
+- test: ares_set_socket_callback failure behaviour
- Don't override explicitly specified search domains
+- test: Check ares_parse_txt_reply_ext() entrypoint
+
+- [Fedor Indutny brought this change]
+
+ txt: introduce `ares_parse_txt_reply_ext`
- Only set search domains from /etc/resolv.conf if there isn't a value
- already present in the channel.
+ Introduce `ares_txt_ext` structure with an extra `record_start`
+ field, which indicates a start of a new TXT record, thus allowing to
+ differentiate the chunks in the same record, from a chunks in a
+ different record.
+
+ Introduce a new API method: `ares_parse_txt_reply_ext` that works with
+ this kind of struct.
-- [David Drysdale brought this change]
+- doc: Update missed repo references
- Allow specification of search domain in ahost
+- doc: Update docs on contributing
+
+- test: Run command line tools in Travis
- Add the "-s domain" command line option to override the search
- domains.
+ Do a quick execution of each of the command line tools
+ in the continuous integration build, so that any (say)
+ sanitizer failures show up.
-Daniel Stenberg (12 May 2014)
-- Revert "ares_parse_aaaa_reply: fix leak when reply contains 1 alias and no address"
+- acountry: drop inert test
- This reverts commit 440110b303fdbfadb3ad53d30eeb98cc45d70451.
+ If ver_1 is true, then z0 and z1 must both be 'z', and so
+ (z0 != 'z' && z1 != 'z') can never be true.
+
+ CID 56879, pointed out by Coverity.
-- [Frederic Germain brought this change]
+- doc: update badge locations to master repo
- ares_parse_aaaa_reply: fix leak when reply contains 1 alias and no address
+- test: Enable maintainer mode + debug in Travis
-- [Doug Kwan brought this change]
+- test: Add an iOS build target
- ares_build.h: fix building on 64-bit powerpc
-
- There are two issues.
+- test: Ignore SIGPIPE in tests
+
+- test: More initialization tests
+
+- test: Improve containerized test mechanism
- 1. gcc actually does not use __ppc__ and __ppc64__ but __PPC__ and
- __PPC64__. The tests of __ILP32__ and __LP64__ are sufficient for gcc.
+ Aim is to ensure that code coverage information can escape the
+ container. To do this:
+ - Enter a new mount namespace too, so that we can...
+ - Bind mount the expected source directory into the container
+ - Share memory with the sub-process so coverage information is
+ shared too.
+
+- test: Make contained tests easier to write
+
+- test: Add framework for containerized testing
- 2. clang defines __GNU__ and defines both __ppc64__ and __ppc__ when
- targeting ppc64. This makes CARES_SIZEOF_LONG to be 4 on a ppc64 system
- when building with clang.
+ On Linux we can potentially use user and UTS namespaces to run a test
+ in a pseudo-container with:
+ - arbitrary filesystem (e.g. /etc/resolv.conf, /etc/nsswitch.conf, /etc/hosts)
+ - arbitrary hostname/domainname.
- My patch is two change the order of the checks so that we check the
- 64-bit case first.
+ Include a first pass at the framework code to allow this, along with a
+ first test case that uses the container.
-- refresh: updated now with automake 1.14
+- test: Use a longer timeout for less flakiness
+
+ Having occasional test failures from timeout before multiple
+ queries can complete, so up the default timeout for the test
+ from 100ms to 1500ms.
-- [David Drysdale brought this change]
+- test: Make failure tests more robust
+
+ Different platforms will do different numbers of allocations
+ in the processing of a given API call; just check that the
+ return code is either success or ENOMEM, and free off any
+ returned state in the former case.
+
+ Also cope with ECONNREFUSED as well as ENOTFOUND.
- single_domain: Invalid memory access for empty string input
+- test: Get test code building under Windows
- We noticed a small buglet in ares_search() when it gets an empty string
- as input -- the single_domain() utility function in ares_search.c
- accesses invalid memory (before the start of the string).
+ - Initial nmake file based off library nmake file
+ - Cast socket call arguments to (char *)
+ - Use wrapper sclose() that maps to closesocket() or close()
+ - Build a config.h indicating presence of headers
+ - Conditionally include netdb.h
+ - Remove unnecessary include of sys/socket.h
+ - Force longer bitmask for allocation failure tracking
+ - Call WSAStartup() / WSACleanup() in main()
+ - Set TCP_NODELAY for mock server
+ - Turn on tests in AppVeyor build
-Guenter Knauf (31 Aug 2013)
-- Fixed warning 'type specifier missing'.
+- test: Disable tests that manipulate env on Windows
-Daniel Stenberg (30 Aug 2013)
-- [Tor Arntsen brought this change]
+- test: Move file lists into Makefile.inc
+
+ In preparation for a Win32 build of the test suite.
- ares_rules.h: CARES_SIZEOF_LONG doesn't exist anymore, don't test for it
+- test: Add a simple multi-server test
- It was removed in f19387dd72432
+ Check rotate option does something
-- nowarn: use instead of configure for size of long
+- test: Allow for multiple mock servers
- This makes the header file much more multi-arch friendly and can be used
- as-is with both 32 bit and 64 bit builds.
+ - Update the MockServer to allow separate specification of
+ UDP and TCP ports
+ - Have an array of mock servers listening on consecutive
+ sets of ports.
+ - Rename Process(fd) to ProcessFD(fd) to avoid confusion.
+ - Initialize channel by using the new ares_set_servers_ports()
+ entrypoint, so multiple ports on the same loopback address
+ can be used.
-- timeoffset: made static and private
+- test: Update test for set/get_servers variants
- ares__timeoffset() was only used once within this single source file
+ Ports are significant in the _ports_ variant functions, so update test to cope.
-- timeadd: make static
+- test: Make GetNameServers() utility function port-aware
- ares__timeadd() was only ever used from within the same source
+ Also make it generally available.
-Yang Tse (18 Jul 2013)
-- xc-am-iface.m4: comments refinement
+- test: more testing, including of internal static functions
-- configure: fix 'subdir-objects' distclean related issue
+- test: more tests, especially fallback processing
- See XC_AMEND_DISTCLEAN comments for details.
+ - Make mock server listen on UDP + TCP in parallel.
+ - Test UDP->TCP fallback on truncation
+ - Test EDNS->no-EDNS fallback
+ - Test some environment init options
+ - Test nonsense reply
+
+ test: short response
-- configure: automake 1.14 compatibility tweak (use XC_AUTOMAKE)
+- test: more tests, particularly of initialization
-- xc-am-iface.m4: provide XC_AUTOMAKE macro
+- test: Run mock tests over both TCP and UDP
+
+ With the exception of a few tests that make use of the timed
+ retry aspect of UDP.
-Daniel Stenberg (12 May 2013)
-- gitignore: ignore all ares_*pdf but also CHANGES.dist
+- test: Run mock tests over both IPv4 and IPv6
-- bump: start working towards 1.10.1
+- test: Add more tests for edge cases
-Version 1.10.0 (12 May 2013)
+- test: more nooks and crannies of pton functions
-Daniel Stenberg (12 May 2013)
-- RELEASE-NOTES: two more bug fixes
+- test: More tests for PTR parsing
-- [Keith Shaw brought this change]
+- test: Use of HOSTALIAS environment variable
- ares_set_servers_csv: fixed IPv6 address parsing
+- test: Add RAII utility classes for testing
- Fixed bug that caused the last part of an IPv6 address to be parsed as
- the port number when the last part is all numeric.
+ - TempFile holds specific contents
+ - EnvValue sets an environment variable
-- nroff: fix two syntax mistakes
-
- ares_parse_a_reply and ares_parse_aaaa_reply both had two \fB instead of
- \fP
-
- Reported-by: Alexander Klauer
- Bug: http://c-ares.haxx.se/mail/c-ares-archive-2013-03/0010.shtml
+- test: More search domain scenarios
-- [Alex Loukissas brought this change]
+- test: Remove duplicate flags from Makefile.am
- build: fix build on msvc11
+- test: Make test code leak-free
-- Makefile.am: increment -version-info for 1.10.0 release
+- test: More tests
+
+ - test use of sortlist
+ - test gethostbyname(AF_UNSPEC)
-- README: remove unnecessary comment
+- test: Test ares_gethostbyname_file()
-- ares_version.h: copyright end range year is now 2013
+- test: Add more tests of ares_getnameinfo()
-- RELEASE-NOTES: synced with fb0737f3a0a1c37
+- test: Tweak tests, add alloc failure test
-- [Paul Saab brought this change]
+- test: Test init with options
- ares_parse_aaaa_reply: Plug memory leak
+- test: More tests
- This change is similar to ares_parse_a_reply.c in commit
- bffd67f16a8f42fe6dbf79ab2e39d92eea05c8a6
+ - ares_inet_net_pton() variants
+ - ares_getsock() variants
-- [Patrick Valsecchi brought this change]
+- test: Expose ProcessWork() function
- ares_parse_txt_reply: return a ares_txt_reply node for each sub-string
+- test: More parsing tests
- Previously, the function would wrongly return all substrings merged into
- one.
+ Including:
+ - Split each parse function test set out into separate files.
+ - Add an allocation failure test for each parsing function.
+ - Add error check test for each parsing function.
-- [Alexander Klauer brought this change]
+- test: Add various additional tests
- library init: documentation update
+- test: More tests
- This commit updates the documentation of ares_library_init() and
- ares_library_cleanup() with regard to the newly introduced reference
- counting of initializations and deinitializations.
-
-- [Alexander Klauer brought this change]
+ Include tests of internal functions, based on the value of the
+ CARES_SYMBOL_HIDING macro; need to configure the library with
+ --disable-symbol-hiding to enable these tests.
- library init: be recursive
-
- Previously, a single call to ares_library_cleanup() would deinitialise
- the c-ares library, regardless of how many times ares_library_init() was
- called. This behaviour may cause problems in programs linking two or
- more libraries which, in turn, use c-ares. The present commit fixes this
- problem, deinitializing the library only after a number of calls to
- ares_library_cleanup() matching the number of calls to
- ares_library_init().
+- test: Allow command line override of mock server port
-- [Patrick Valsecchi brought this change]
+- test: Add README.md documentation
- protocol parsing: check input data stricter
+- test: Temporarily avoid latest Python requests package
- ... so that bad length fields aren't blindly accepted
+ Currently get error from Travis on this install step, and downgrading one
+ version appears to fix the problem.
- Bug: http://c-ares.haxx.se/mail/c-ares-archive-2013-04/0016.shtml
+ "Could not find any downloads that satisfy the requirement pyOpenSSL>=0.13
+ (from requests[security])"
-Guenter Knauf (11 Apr 2013)
-- Create ares_build.h when buidling from Git.
+- test: Add AppVeyor config file for Windows build
-- Added -DCARES_STATICLIB to CFLAGS.
+- test: Add configuration for a Travis build
- Currently this static makefile does only support building the
- static library libcares.a.
-
-Daniel Stenberg (8 Apr 2013)
-- [Alexander Klauer brought this change]
-
- .gitignore: ignore patch files
+ Cover Linux & OSX on the container infrastructure, but install
+ a later G++ to satisfy the tests' need for C++11.
- This commit adds a line to .gitignore to the effect that patch files
- generated by 'git format-patch' are excluded from the repository.
-
-- [Alexander Klauer brought this change]
-
- ares_destroy() documentation: no new requests
+ Use a build matrix to include a variety of build variants:
+ - ASAN
+ - UBSAN
+ - LSAN
+ - Coverage via coveralls.io
- Clarify that no new requests may be added to a resolver channel that is
- currently being destroyed.
-
-- [Alexander Klauer brought this change]
-
- Documentation: properly document ARES_ECANCELLED
+ test: invoke ASAN and coverage in Travis build
- This commit clarifies the behaviour of ares_cancel() with respect to
- callbacks and adds missing documentation of ARES_ECANCELLED to the man
- pages of the affected functions.
-
-- [Alexander Klauer brought this change]
-
- ares_cancel(): cancel requests safely
+ Also shift to use explicit build matrix
- An invocation of ares_cancel() walks through the request list, calling
- the callbacks of all pending requests on a channel. Previously, if such
- a callback added a new request to the channel, the request list might
- not end up empty, causing an abort by assertion failure. The present
- commit ensures that precisely all requests present upon entry of
- ares_cancel() are cancelled, and that adding new requests through
- callbacks is safe.
-
-Yang Tse (10 Mar 2013)
-- ares.h: stricter CARES_EXTERN linkage decorations logic
+ test: Use coveralls.io for coverage tracking
- No API change involved.
+ test: Add a build with UBSAN
+
+ Also expand and re-order the setting of environment variables
+ for easier modification.
+
+ test: Add LSAN build to Travis config
-- ares_build.h.dist: enhance non-configure GCC ABI detection logic
+- test: Add initial unit tests for c-ares library
- GCC specific adjustments:
+ The tests are written in C++11, using the GoogleTest and GoogleMock
+ frameworks. They have their own independent autoconf setup, so that
+ users of the library need not have a C++ compiler just to get c-ares
+ working (however, the test/configure.ac file does assume the use of
+ a shared top-level m4/ directory). However, this autoconf setup has
+ only been tested on Linux and OSX so far.
+
+ Run with "./arestest", or "./arestest -v" to see extra debug info.
+ The GoogleTest options for running specific tests are also
+ available (e.g. "./arestest --gtest_filter=*Live*").
+
+ The tests are nowhere near complete yet (currently hitting around
+ 60% coverage as reported by gcov), but they do include examples
+ of a few different styles of testing:
+
+ - There are live tests (ares-test-live.cc), which assume that the
+ current machine has a valid DNS setup and connection to the
+ internet; these tests issue queries for real domains but don't
+ particularly check what gets returned. The tests will fail on
+ an offline machine.
- - check __ILP32__ before 32 and 64bit processor architectures in
- order to detect ILP32 programming model on 64 bit processors
- which, of course, also support LP64 programming model, when using
- gcc 4.7 or newer.
+ - There a few mock tests (ares-test-mock.cc) that set up a fake DNS
+ server and inject its port into the c-ares library configuration.
+ These tests allow specific response messages to be crafted and
+ injected, and so are likely to be used for many more tests in
+ future.
- - keep 32bit processor architecture checks in order to support gcc
- versions older than 4.7 which don't define __ILP32__
+ - To make this generation/injection easier, the dns-proto.h file
+ includes C++ helper classes for building DNS packets.
- - check __LP64__ for gcc 3.3 and newer, while keeping 64bit processor
- architecture checks for older versions which don't define __LP64__
-
-Daniel Stenberg (9 Mar 2013)
-- ares.h: there is no ares_free_soa function
-
-Yang Tse (9 Mar 2013)
-- Makefile.am: empty AM_LDFLAGS definition for automake 1.7 compatibility
-
-- ares_inet_ntop.3: s/socklen_t/ares_socklen_t
-
-- configure: use XC_LIBTOOL for portability across libtool versions
-
-- xc-lt-iface.m4: provide XC_LIBTOOL macro
-
-- Makefile.am: use AM_CPPFLAGS instead of INCLUDES
-
-- inet_ntop.c: s/socklen_t/ares_socklen_t
-
-- inet_ntop.c: s/socklen_t/ares_socklen_t for portability
-
-Daniel Stenberg (19 Feb 2013)
-- ares.h: s/socklen_t/ares_socklen_t for portability
-
-- ares_inet_ntop.3: 4th argument is socklen_t!
-
-- spell inet correctly!
-
-- ares_inet_pton/ntop: cleanup
+ - Other library entrypoints that don't require network activity
+ (e.g. ares_parse_*_reply) are tested directly.
- Make sure that the symbols are always exported and present in c-ares.
+ - There are few tests of library-internal functions that are not
+ normally visible to API users (in ares-test-internal.cc).
- Make the headers prefixed with 'ares'.
+ - A couple of the tests use a helper method of the test fixture to
+ inject memory allocation failures, using the earlier change to the
+ library to allow override of malloc/realloc/free.
- Removed the inet_ntop.h version as it no longer features any content.
-
-- ares_inet_ntop/ares_inet_pton: added man pages
-
-Yang Tse (15 Feb 2013)
-- [Gisle Vanem brought this change]
-
- curl_setup_once.h: definition of HAVE_CLOSE_S defines sclose() to close_s()
-
-- [Gisle Vanem brought this change]
-
- config-dos.h: define HAVE_CLOSE_S for MSDOS/Watt-32
-
-- [Gisle Vanem brought this change]
-
- config-dos.h: define strerror() to strerror_s_() for High-C
+ - There is also an entrypoint to allow Clang's libfuzzer to drive
+ the packet parsing code in ares_parse_*_reply, together with a
+ standalone wrapper for it (./aresfuzz) to allow use of afl-fuzz
+ for further fuzz testing.
-Daniel Stenberg (13 Feb 2013)
-- ares_get_datatype: removed unused function
+- test: Add local copy of GoogleMock/GoogleTest 1.7.0
- it was also wrongly named as internal functions require two underscores
+ Don't check in gtest/m4 files, as they are unused and interfere
+ with the top-level configure process.
-- ares__bitncmp: use two underscores for private functions
+- doc: Show build badges in README.md
- It used a single one previously making it look like a public one
+ Note that these URLs will need to be updated if/when the test branch
+ gets pulled into the master repo/branch.
-- ares__generate_new_id: moved to ares_query.c
+- doc: Convert README to README.md
- ... and ares__rc4 is turned into a local static function.
+ Gives better display on GitHub
-- ares__swap_lists: make private and static
+- doc: Update in preparation for next release
- ... since there's only one user, make it static within ares_process.c
+ Assume 1.11.0 is next (as there are various API additions).
+ Also add myself to AUTHORS.
-Yang Tse (13 Feb 2013)
-- Makefile.msvc: add four VS version strings
+- build: Allow header compilation by Windows C++ compiler
-Daniel Stenberg (13 Feb 2013)
-- ares_expand_name.3: clarify how to free the data
+- build: Expose whether symbol hiding is on
+
+ Adding the CARES_SYMBOL_HIDING definition allows the test suite to
+ detect whether internal symbols are available or not.
-Yang Tse (30 Jan 2013)
-- zz40-xc-ovr.m4: fix 'wc' detection - follow-up 2
+- build: Add autoconf macros for C++11 code using pthreads
- - Fix a pair of single quotes to double quotes.
+ Pull in testing macros from the GNU autoconf archive to allow
+ configure scripts to test for and setup use of a C++11 compiler
+ (AX_CXX_COMPILE_STDCXX_11) and the pthreads library (AX_PTHREAD).
- URL: http://curl.haxx.se/mail/lib-2013-01/0355.html
- Reported by: Tor Arntsen
+ Note that these macros are not used by the main library autoconf,
+ just by the tests (which share the same m4/ directory).
-- zz40-xc-ovr.m4: fix 'wc' detection - follow-up
+- build: Add a code coverage option
- - Take into account that 'wc' may return leading spaces and/or tabs.
+ Configure with:
+ ./configure --enable-code-coverage
+ Show coverage output with:
+ make code-coverage-capture
- - Set initial IFS to space, tab and newline.
+ Built on m4/ax_code_coverage.m4 from the GNU autoconf archive
+ to provide the macros to check for presence of gcov + lcov;
+ upstream macro modified to:
+ - Remove use of $(AM_DEFAULT_VERBOSITY) , as earlier versions of
+ autoconf (such as the one used by default on Travis) do not have this.
+ - Rather than automatically defining CODE_COVERAGE_RULES to be a set
+ of makefile rules that use ifeq/endif (which is GNU make-specific),
+ instead only define CODE_COVERAGE_RULES if coverages is turned on,
+ and in that case don't use conditionals in the makefile.
-- zz40-xc-ovr.m4: fix 'wc' detection
+- api: Add entrypoints to allow use of per-server ports
- - Take into account that 'wc' may return leading spaces.
+ Add user-visible entrypoints ares_{get,set}_servers_ports(3), which
+ take struct ares_addr_port_node rather than struct ares_addr_node.
+ This structure includes a UDP and TCP port number; if this is set
+ to zero, the channel-wide port values are used as before.
- - Set internationalization behavior variables.
+ Similarly, add a new ares_set_servers_ports_csv(3) entrypoint, which
+ is analogous to ares_set_servers(3) except it doesn't ignore any
+ specified port information; instead, any per-server specified port
+ is used as both the UDP and TCP port for that server.
- Tor Arntsen analyzed and reported the issue.
+ The internal struct ares_addr is extended to hold the UDP/TCP ports,
+ stored in network order, with the convention that a value of zero
+ indicates that the channel-wide UDP/TCP port should be used.
- URL: http://curl.haxx.se/mail/lib-2013-01/0351.html
-
-- zz40-xc-ovr.m4: check another three basic utilities
-
-- zz40-xc-ovr.m4: 1.0 interface stabilization
+ For the internal implementation of ares_dup(3), shift to use the
+ _ports() version of the get/set functions, so port information is
+ transferred correctly to the new channel.
- - Stabilization results in 4 public interface m4 macros:
- XC_CONFIGURE_PREAMBLE
- XC_CONFIGURE_PREAMBLE_VER_MAJOR
- XC_CONFIGURE_PREAMBLE_VER_MINOR
- XC_CHECK_PATH_SEPARATOR
- - Avoid one level of internal indirection
- - Update comments
- - Drop XC_OVR_ZZ40 macro
+ Update manpages, and add missing ares_set_servers_csv to the lists
+ while we're at it
-- zz40-xc-ovr.m4: emit witness message in configure BODY
+- api: Add ares_set_sortlist(3) entrypoint
- This avoids witness message in output when running configure --help,
- while sending the message to config.log for other configure runs.
-
-- zz40-xc-ovr.m4: truly do version conditional overriding
+ Allow explicit configuration of the channel's sortlist, by
+ specifying a string in the same format as the equivalent
+ /etc/resolv.conf option.
- - version conditional overriding
- - catch unexpanded XC macros
- - fix double words in comments
+ This allows library users to perform the same configuration
+ that is available via /etc/resolv.conf, but without needing
+ to change that file.
-- zz40-xc-ovr.m4: fix variable assignment of subshell output bashism
+- api: Allow injection of user-specified malloc/free functions
- Tor Arntsen analyzed and reported the issue.
+ Add a new ares_library_init_mem() initialization function for the
+ library which allows the library user to specify their own malloc,
+ realloc & free equivalents for use library-wide.
- URL: http://curl.haxx.se/mail/lib-2013-01/0306.html
-
-- zz40-xc-ovr.m4: reinstate strict AC_REQUIRE macro dependencies
-
-- zz40-xc-ovr.m4: avoid double single-quote usage
-
-- zz40-xc-ovr.m4: parentheses balancing of 'case' statements
+ Store these function pointers in library-wide global variables,
+ defaulting to libc's malloc(), realloc() and free().
- m4 quadrigraph shell comment technique allows proper autoconf
- parentheses balancing in shell 'case' statements. The presence
- of unbalanced parentheses may otherwise trigger expansion bugs.
-
-- zz40-xc-ovr.m4: internals overhauling
+ Change all calls to malloc, realloc and free to use the function pointer
+ instead. Also ensure that ares_strdup() is always available
+ (even if the local environment includes strdup(3)), and change the
+ library code to always use it.
- - Update comments
- - Execute commands in subshells
- - Faster path separator check
- - Fix missing 'test' command
- - Rename private macros
- - Minimize AC_REQUIRE usage
-
-- zz40-xc-ovr.m4: redirect errors and warnings to stderr
+ Convert calls to calloc() to use ares_malloc() + memset
-- configure: use XC_CONFIGURE_PREAMBLE early checks
+- api: Add option to expose some internal functions
- Some basic checks we make were placed early enough in generated
- configure script when using autoconf 2.5X versions. Newer autoconf
- versions expand these checks much further into the configure script,
- rendering them useless. Using XC_CONFIGURE_PREAMBLE fixes placement
- of early intended checks across all our autoconf supported versions.
+ Purely for testing, add --enable-expose-statics option to configure
+ which converts some static internal functions to be externally visible.
-- zz40-xc-ovr.m4: provide XC_CONFIGURE_PREAMBLE macro
+- api: Expose the ares_library_initialized() function
-- configure: autotools compatibility fixes - step I
+- ahost: Allow repeated -s options
- Fix proper macro expansion order across autotools versions for
- C compiler and preprocessor program checks.
+ This also removes a potential leak where later -s options would
+ replace earlier ones without freeing the relevant string.
-- configure: fix automake 1.13 compatibility
-
- Tested with:
+- Mark unhittable lines
- buildconf: autoconf version 2.69
- buildconf: autom4te version 2.69
- buildconf: autoheader version 2.69
- buildconf: automake version 1.13.1
- buildconf: aclocal version 1.13.1
- buildconf: libtool version 2.4
- buildconf: GNU m4 version 1.4.16
+ Add comments for the benefit of the lcov tool, marking
+ lines that cannot be hit. Typically these are fall-back
+ protection arms that are already covered by earlier checks,
+ and so it's not worth taking out the unhittable code (in case
+ someone changes the code between the two places in future).
-- ares_private.h: use again memdebug.h instead of curl_memdebug.h
+- ares_set_servers_csv.3: make return type match code
-- configure.ac: replace AM_CONFIG_HEADER with AC_CONFIG_HEADERS
-
- automake 1.13 errors if AM_CONFIG_HEADER is used in configure script.
+- bitncmp: update comment to match code behaviour
-- cares-override.m4: provide AC_CONFIG_MACRO_DIR definition conditionally
+- ares_striendstr: fix so non-NULL return can happen
- Provide a 'traceable' AC_CONFIG_MACRO_DIR definition only when using
- an autoconf version that does not provide it, instead of what we were
- doing up to now of providing and overriding AC_CONFIG_MACRO_DIR for
- all autoconf versions.
-
-- ares_private.h: use curl_memdebug.h instead of memdebug.h
+ This looks to have been broken since it was first introduced in 2005 in
+ commit aba0b775ea30 ("Added ares_getnameinfo which mimics the
+ getnameinfo API")
-- vc6cares.dsp: add ares_create_query.c and ares_parse_soa_reply.c
+- config_sortlist: free any existing sortlist on (re)alloc failure
+
+ If we get an allocation failure on 2nd or later entry in the sortlist, the
+ code would return ENOMEM but still leave the initial entries allocated.
+ Ensure that *sortlist is set to NULL whenever ENOMEM is returned.
-- cares-functions.m4: improve gethostname arg 2 data type check
+- ares_dup: clear new channel on failure
+
+ If the attempt to transfer IPv6 servers from the old to the new channel
+ fails, the previous code would still return a channel to the user even though
+ an error return code was generated. This makes it likely that users would
+ leak the channel, so explicitly clear the channel in this case.
-- setup_once.h: HP-UX specific 'bool', 'false' and 'true' definitions.
+- ares_init_options: don't lose init failure
- Also reverts commit bceb40095a
+ If (say) init_by_options() fails, the subsequent call to
+ init_by_defaults() was overwriting the return code with
+ success. Still call init_by_defaults() regardless, but track
+ its return value separately
-- configure: check if compiler halts on function prototype mismatch
+- ares_gethostbyname: don't leak valid-but-empty hostent
+
+ If an AF_UNSPEC query gets a valid response to its AAAA query,
+ but which has no IPv6 addresses in it, then the code chains on to
+ a A record query. However, the hostent from the AAAA response
+ was being leaked along the way (because it gets replaced before
+ the follow-on end_hquery() invocation).
-- cares-functions.m4: add gethostname arg 2 data type check and definition
+- ares_parse_txt_reply: propagate errors from per-substring loop
+
+ If we get an allocation failure when processing a particular substring in a
+ TXT record, that failure is silently lost; fix that by propagating errors from
+ the inner loop to the outer loop.
-- cares-functions.m4: update thread-safeness detection of getaddrinfo()
+- process_answer: fix things up correctly when removing EDNS option
+
+ When a server rejects an EDNS-equipped request, we retry without
+ the EDNS option. However, in TCP mode, the 2-byte length prefix was
+ being calculated wrong -- it was built from the answer length rather than
+ the length of the original request.
- Take in account that POSIX standard Issue 7 drops h_errno support. Now, we also
- consider getaddrinfo() to be thread-safe when (_POSIX_C_SOURCE >= 200809L) or
- (_XOPEN_SOURCE >= 700) independently of whether h_errno exists or not.
+ Also, it is theoretically possible that the call to realloc() might change
+ the data pointed to; to allow for this, qbuf also needs updating.
- Take in account that h_errno might be a modifiable lvalue not defined as
- a C preprocessor macro.
+ (Both these fixes were actually included in a patchset sent on the mailing
+ list in Oct 2012, but were included with other functional changes that
+ didn't get merged:
+ http://c-ares.haxx.se/mail/c-ares-archive-2012-10/0004.shtml)
-- setup_once.h: HP-UX issue workaround
-
- Issue: When building a 32bit target with large file support HP-UX
- header file may simultaneously provide two different
- sets of declarations for sendfile and sendpath functions, one with
- static and another with external linkage. Given that we do not use
- mentioned functions we really don't care which linkage is the
- appropriate one, but on the other hand, the double declaration emmits
- warnings when using the HP-UX compiler and errors when using modern
- gcc versions resulting in fatal compilation errors.
-
- Mentioned issue is now fixed as long as we don't use sendfile nor
- sendpath functions.
+- ares__read_line: clear buf pointer on realloc failure
-- setup_once.h: refactor inclusion of and
+- ares_expand_name: check for valid bits in label length
- Inclusion of these two header files now done in setup_once.h
+ The top two bits of the label length indicate whether this is a
+ label length (00) or an index to a name elsewhere in the message
+ (11). RFC1035 4.1.4 says that the other possible values for the
+ top two bits (01, 10) are reserved for future use.
-- Header inclusion clean-up
-
- Remove header inclusions already done in setup_once.h
+Daniel Stenberg (23 Jan 2016)
+- [Gregor Jasny brought this change]
-- setup_once.h: HP-UX specific TRUE and FALSE definitions
+ Fix typos detected by lintian
- Some HP-UX system headers require TRUE defined to 1 and FALSE to 0.
-
-- ares_timeout.c: fix compiler warning
+ Closes #32
-- ares_create_query.c: IRIX compilation fix
+- [Gregor Jasny brought this change]
-- c-ares/nameser.h: add some T_* defines for ns_t_* values
+ Distribute all man pages
-Daniel Stenberg (7 Nov 2012)
-- Revert "ares_parse_aaaa_reply: fix memory leak"
+- README.cares: s/I/Daniel
- This reverts commit 50f25d8a4b2d16f4c5e0ef620238688b7a315c7a.
+ ... and add a pointer to an existing version of the original area 1.1.1
+ package.a
-- ares_parse_aaaa_reply: fix memory leak
+- read_tcp_data: don't try to use NULL pointer after malloc failure
- an allocated buffer was not freed in the successful case.
-
-- [Gisle Vanem brought this change]
+ CID 56884, pointed out by Coverity. We really should make this function
+ return an error code so that a malloc() failure can return back a major
+ failure.
- adig: perror() doesn't work for socket errors on windows
+- configure_socket: explicitly ignore return code
- ... so print the SOCKERRNO instead
+ CID 56889 in Coverity pointed out the return code from setsocknonblock()
+ is ignored, and this added typecast to (void) makes it explicit.
-- get_DNS_AdaptersAddresses: fix IPv6 parsing
-
- Use of the wrong define made the function not parse IPv6 addresses
- properly.
+- ahost: check the select() return code
- Bug: http://c-ares.haxx.se/mail/c-ares-archive-2012-06/0028.shtml
- Reported by: Saúl Ibarra Corretgé
+ Fixes CID 137189, pointed out by Coverity
-- version: bumped to 1.10.0
+David Drysdale (18 Jan 2016)
+- Fix buildconf on platforms using glibtoolize
- Due to the newly added function: ares_create_query()
+ Commit c49a87eea538 changed buildconf to only check for
+ libtoolize, but missed a line
-- AUTHORS: synced with 83093ac450
+- Don't exit loop early leaving uninitialized entries
- Added 21 authors since this document was last updated
-
-- ares_create_query.3: mention when this is added
-
-- [hpopescu@ixiacom.com brought this change]
-
- Added new feature (rfc2671)
-
-- code police: fix indents, < 80 columns, reflowed comments
-
-Guenter Knauf (11 Jul 2012)
-- Cleaned up version awk script.
-
-Daniel Stenberg (30 Jun 2012)
-- [Gisle Vanem brought this change]
-
- read_udp_packets: bail out loop on bad sockets
+ Update for commit affc63cba875d.
- I can see that recvfrom() in ares_process.c many times is called with
- 'udp_socket' == ARES_SOCKET_BAD. The code takes care not to call
- recv/recvfrom with ARES_SOCKET_BAD in the outer-loop. So should the
- inner-loop.
-
-Yang Tse (29 Jun 2012)
-- cares-compilers.m4: remove -Wstrict-aliasing=3 from clang
+ The original patch from Gregor Jasny did not have the break
+ statement; I incorrectly added it to prevent continuing the loop.
+ However, the later entries in the array would then be left
+ uninitialized, causing problems for later cleanup.
- Currently it is unknown if there is any version of clang that
- actually supports -Wstrict-aliasing. What is known is that there
- are several that don't support it.
-
-- cares-compilers.m4: -Wstrict-aliasing=3 for warning enabled gcc and clang builds
-
-Daniel Stenberg (18 Jun 2012)
-- version: work towards 1.9.2 (at least)
-
-Version 1.9.1 (18 Jun 2012)
-
-Daniel Stenberg (18 Jun 2012)
-- RELEASE-NOTES: 1.9.1 coming up
-
-Version 1.9.0 (16 Jun 2012)
-
-Daniel Stenberg (16 Jun 2012)
-- ares_version.h: next version is 1.9.0
+ So fix to match Gregor's original patch, with apologies.
-- [Marko Kreen brought this change]
+Daniel Stenberg (18 Jan 2016)
+- buildconf: remove check for libtool, it only requires libtoolize
- ares_data.h: ARES_DATATYPE_SOA_REPLY is added in 1.9.0
+David Drysdale (17 Jan 2016)
+- [Gregor Jasny brought this change]
-- RELEASE-NOTES: synced with 979bf951d
+ Use libresolv to initialize cares on iPhone targets
- Next release deemed to become 1.9.0 due to the new function
-
-- [Marko Kreen brought this change]
-
- SOA parser added
+ On iPhone targets like iOS, watchOS or tvOS the file
+ /etc/resolv.conf cannot be used to configure cares.
- I need to do SOA queries, so here is a parser for them.
+ Instead the resolver library is queried for configuration
+ values.
- - ares_soa_reply: new struct
- - ares_malloc_data/ares_free_soa: ARES_DATATYPE_SOA_REPLY
- - ares_parse_soa_reply: actual function
-
-Yang Tse (14 Jun 2012)
-- Kill compiler warning
+ CC: Yury Kirpichev
-- Fix libcares.pc generation for static MingW* cross builds
+Daniel Stenberg (17 Jan 2016)
+- README: updated to new repo URL
-Daniel Stenberg (21 May 2012)
-- [Nick Alcock brought this change]
+David Drysdale (14 Jan 2016)
+- [Lei Shi brought this change]
- Fix UDP and TCP port byte order in saved options.
+ Fixing slow DNS lookup issue
- The UDP and TCP port are stored in network byte order in the
- ares_channeldata, but are passed in to ares_init_options() in host byte
- order. Thus we must return them from ares_save_options() in host byte
- order too, or a duplicated channel will convert them again, leading to a
- nonfunctional channel and a mysterious connection refused error from
- ares_gethostbyname(). This breaks ares_dup(), thus the curl easy API
- when c-ares is used by curl, and thus all the curl easy API's users.
-
-Yang Tse (28 Apr 2012)
-- version: start working on 1.8.1-DEV
-
-Version 1.8.0 (27 Apr 2012)
+ This patch is fixing the dns lookup issue due to dummy dns information
+ of a disconnected adapter(in my case is a bluetooth adapter). I changed
+ the dns lookup policy to try GetNetworkParams first because the
+ GetNetworkParams provides the most reliable dns information (lots of
+ checks were done by system). I also filter out inoperable adapter in
+ DNS_AdaptersAddresses in case GetNetworkParams fail.
-Daniel Stenberg (27 Apr 2012)
-- RELEASE-NOTES: call next 1.8 instead
+- Merge pull request #30 from p-push/vs-2015
- Since we added a function, let's use a stricter bumping scheme
-
-Yang Tse (25 Apr 2012)
-- INSTALL: some adjustments
-
-Daniel Stenberg (25 Apr 2012)
-- GIT-INFO: mention buildconf
+ Support Visual Studio 2015
-Yang Tse (25 Apr 2012)
-- INSTALL: remove more sections that don't apply to c-ares
+Oleg Pudeyev (3 Jan 2016)
+- [Gisle Vanem brought this change]
-- ares_timeout.c: fix compiler warning
+ Support Visual Studio 2015
-Daniel Stenberg (25 Apr 2012)
-- [Ben Noordhuis brought this change]
+David Drysdale (11 Nov 2015)
+- [Andrew Andkjar brought this change]
- Makefile.m32: fix mingw32 build
+ added another version case to Makefile.msvc
- * add . to include path so ares_build.h is picked up
- * make ar configurable to ease cross-compiling
+ nmake version 11.00.61030.0 resolves to CC_VERS_NUM = 110
-- RELEASE-NOTES: added what's happened since 1.7.5
+- Merge pull request #26 from bitbouncer/vs-2013
+
+ added define for visual studio 2013
-Guenter Knauf (22 Apr 2012)
-- Updated copyright year.
+svante karlsson (25 Jun 2015)
+- added define for visual studio 2013
-Yang Tse (21 Apr 2012)
-- ares_init.c: Further refactoring of Windows system's DNS fetching code
+Jakub Hrozek (6 Nov 2014)
+- ares__read_line: free buf on realloc failure
-Guenter Knauf (20 Apr 2012)
-- Android: small changes to dns property part.
+- Destroy options if ares_save_options fails
- Prefix prop vars; kill var; use DNS_PROP_NAME_PREFIX macro.
+ It's possible that, if ares_save_options failed, the opts structure
+ would contain some allocated memory. Calling ares_destroy_options in
+ this case is safe, because ares_save_options zeroes out the memory
+ initially.
-- Handle CNAME-only in ares_parse_aaaa_reply().
-
- posted to the c-ares list by Peter Griess .
+- [David Drysdale brought this change]
-- Add support for multiple DNS servers on Android.
+ Continue loop if space for hostname not large enough
- Before, c-ares always used the first DNS server on Android, causing
- network problems if this DNS server was not available.
+ When attempting to build a search domain from the local hostname
+ (used as a fallback when no other methods have given a search
+ domain), the code doubles the buffer size on each loop iteration.
- Signed-off-by: Geert Uytterhoeven
-
-- Added INSTALL so it gets into tarballs.
+ However, the loop previously had a WHILE_FALSE terminator so the continue
+ statement exited the loop rather than going round again.
-- Added some more ifdefs to silent compiler warnings.
+Daniel Stenberg (30 Oct 2014)
+- ares_getnameinfo.3: there is no ares_getaddrinfo
-Yang Tse (17 Apr 2012)
-- INSTALL: remove a non c-ares section
+David Drysdale (30 Sep 2014)
+- [Gregor Jasny brought this change]
-- cares-compilers.m4: -Wno-pedantic-ms-format for Windows gcc 4.5 builds
+ Prevent tmpbuf from overrunning
- When building a Windows target with gcc 4.5 or newer and strict compiler
- warnings enabled use -Wno-pedantic-ms-format in addition to other flags.
-
-- setup_once.h: tighten requirements for stdbool.h header inclusion
+ Fix Coverity error CID 56886.
- Include stdbool.h only when it is available and configure is capable of
- detecting a proper 'bool' data type when the header is included.
-
-- configure: NATIVE_WINDOWS no longer defined in config file
-
-- cares-compilers.m4: double underscore decoration for visibility attribute
+ Signed-off-by: Gregor Jasny
-- build adjustments: CARES_SYMBOL_HIDING no longer defined in config files
-
- configure script now provides conditional definitions for Makefile.am
- that result in CARES_SYMBOL_HIDING being defined by resulting makefiles
- when appropriate.
+- [Gregor Jasny brought this change]
-- configure: Windows cross-compilation fixes
+ Re-start loop if select fails
- CARES_BUILDING_LIBRARY and CARES_STATICLIB no longer defined in ares_config.h,
- configure will generate appropriate conditionals so that mentioned symbols
- get defined and used in Makefile derived from Makefile.am at compilation time.
-
-Guenter Knauf (17 Apr 2012)
-- Added INSTALL file adapted from libcurl.
+ Fix Coverity error CID 56882
- Not yet ready, and needs further edits.
-
-Yang Tse (16 Apr 2012)
-- ares_init.c: get_iphlpapi_dns_info() refactoring
-
-Guenter Knauf (16 Apr 2012)
-- Kill some more compiler warnings.
-
-- Kill compiler warning about unused var.
-
-- Fixed my last commit: wrong preprocessor directive.
+ Signed-off-by: Gregor Jasny
-- Check for __ANDROID__ in addition to ANDROID macro.
+- [Gregor Jasny brought this change]
-- Check for __ANDROID__ in addition to ANDROID macro.
+ Free temporary variable in error path
- Posted to c-ares list by Wayne.
-
-- Fix for Android to disable useless arpa/nameser.h.
-
-- Fix for Android to include sys/select.h for fd_set.
+ Fix Coverity CID 56890
+
+ Signed-off-by: Gregor Jasny
-Yang Tse (17 Mar 2012)
-- ares_data.c: some NAPTR related fixes
+- [Gregor Jasny brought this change]
-Daniel Stenberg (16 Mar 2012)
-- port numbers: convert them to network order!
-
- When the config options ARES_OPT_UDP_PORT or ARES_OPT_TCP_PORT are used,
- make sure to convert them to network byte order!
+ Fix integer shift overflow if both tcp_socket and udp_socket are set
- Bug: http://c-ares.haxx.se/mail/c-ares-archive-2012-02/0004.shtml
-
-- white space cleanup
+ The problem occurs if at the start of the loop the sockindex is at the
+ last valid ARES_GETSOCK_MAXNUM position. If then both udp_socket and
+ tcp_socket are valid, sockindex gets incremented for UDP first and
+ points one entry behind the array for the tcp block.
+ So the fix is to check after every increment of sockindex if it is still
+ valid.
- - Keep code within 80 columns
+ Fix Coverity error CID 56878
- - Removed funny spaces after open paren and before closing paren
+ Signed-off-by: Gregor Jasny
-- [Poul Thomas Lomholt brought this change]
+- [Gregor Jasny brought this change]
- get_iphlpapi_dns_info: fix buffer overrun
-
- I experienced a buffer overrun exception in c-ares on Windows and
- tracked it down to be an error in the calculation of the 'left' variable
- in get_iphlpapi_dns_info().
+ Null check before dereference
- I changed the variable type of 'left' to a _signed_ type because of the
- subtraction arithmetic; not sure if a long is the best choice
-
-- Merge pull request #7 from saghul/naptr
+ Fix Coverity error CID 56880
- Added support for parsing NAPTR records
+ Signed-off-by: Gregor Jasny
-saghul (23 Feb 2012)
-- Added support for parsing NAPTR records
+Jakub Hrozek (28 Jul 2014)
+- [Gisle Vanem brought this change]
-Yang Tse (19 Jan 2012)
-- ares_init.c: fix compiler warning on winsock builds
+ Comment in ares_ipv6.h
-- configure: libtool 1.5 tweaks
+David Drysdale (25 Jul 2014)
+- CONTRIBUTING: add file to indicate mailing list is preferred
-Daniel Stenberg (19 Dec 2011)
-- ares_timeout.3: fix the NAME section
+- Add -t u option to ahost
- It was clearly a copy n' paste error
-
-Yang Tse (27 Sep 2011)
-- [Albert Chin brought this change]
+ Add an option to allow specification of the AF_UNSPEC
+ address family.
- configure - m4: make CURL_CHECK_DEF ignore leading whitespace on symbol def
+Jakub Hrozek (24 Jul 2014)
+- host_callback: Fall back to AF_INET on searching with AF_UNSPEC
- When using Sun C compiler the preprocessor somehow inserts an extra space
- in front of replaced symbol, breaking CURL_CHECK_DEF macro. To workaround
- this, macro CURL_CHECK_DEF now ignores all leading whitespace in front of
- symbol substitution result.
-
-- ares_init.c: fix segfault triggered in ares_init_options() upon previous
- failure of init_by_defaults() and incomplete cleanup there.
-
-- ares_process.c: fix compiler warning
-
-- fix MSVC compiler warning 'conditional expression is constant'
-
-- setup_once.h cleanup and sync
-
-- [Denis Bilenko brought this change]
-
- ares_getnameinfo: fix random results with c-ares 1.7.5
+ Previously, when an ares_gethostbyname() searched with AF_UNSPEC and the
+ first AF_INET6 call only returned CNAMEs, the host_callback never
+ retried AF_INET.
- In ares_getnameinfo memcpy did not copy enough bytes, causing
- it to return arbitrary memory contents as a result.
+ This patch makes sure than on ARES_SUCCESS, the result of AF_INET6 is
+ taken as authoritative only if the result contains some addresses.
-- warnings: fix another 'conversion may lose significant bits' compiler warning
+- [David Drysdale brought this change]
-- ares_dns.h: adjust DNS__16BIT and DNS__32BIT macro definitions
+ Move memset call below platform-specific declarations
- Fixing compiler warnings existing definitions triggered on these.
-
-- ares_destroy.c: fix segfault in ares_destroy_options()
-
-Daniel Stenberg (21 Aug 2011)
-- ares_parse_srv_reply: silence compiler warnings
+ A GitHub commenter [1] says that my recent change to ahost.c has
+ problems compiling on Windows + C89 platforms.
- ... by adding ugly typecasts.
+ [1] https://github.com/bagder/c-ares/commit/ee22246507c9#commitcomment-6587616
-- CHANGES: generate from script
+- [David Drysdale brought this change]
+
+ Update ahost man page to describe -s option.
- The CHANGES file is now generated automatically with 'git2changes.pl',
- invoked by the maketgz script which is used to build release archives.
+ Commit ee22246507c9 added the -s option to the
+ ahost command, but neglected to update the man page to
+ describe it.
- The former human edited CHANGES file was renamed to CHANGES.0 in git.
-
-Yang Tse (21 Aug 2011)
-- Makefile.netware: SIZEOF_SHORT definition
-
-- warnings: fix some 'conversion may lose significant bits' compiler warnings
+ Also fix typo in description of -t option.
-- configure: fix symbol hiding usability check
+- ares_parse_soa_reply: Do not leak rr_name on allocation failure
- A more thorough test is done now in order to determine visibility attribute
- usability, given that some compilers don't support visibility attribute on
- all configurations.
-
-Daniel Stenberg (16 Aug 2011)
-- 1.7.6: start working...
-
-Version 1.7.5 (16 Aug 2011)
-
-Daniel Stenberg (16 Aug 2011)
-- CHANGES: synced for 1.7.5 release
-
-- RELEASE-NOTES: synced with bb4096effef7f000
-
-Jakub Hrozek (15 Aug 2011)
-- Only fall back to AF_INET searches when looking for AF_UNSPEC addresses
+ If ares_malloc_data failed, already allocated rr_name would go out of
+ scope.
-Yang Tse (10 Aug 2011)
-- [Gisle Vanem brought this change]
+- [David Drysdale brought this change]
- ares_iphlpapi.h: Watcom C fix
+ Don't override explicitly specified search domains
- Added "!defined(_WS2DEF_)" since Watcom doesn't have
- a per type guard for the typedefs 'CSADDR_INFO' (that MingW has) or
- 'SOCKET_ADDRESS' (that MSVC has). But we can use the header-guard for
- instead.
-
-- [Gisle Vanem brought this change]
+ Only set search domains from /etc/resolv.conf if there isn't a value
+ already present in the channel.
- Makefile.Watcom:
- * The 'NTDDI_VERSION' needs to be raised to 0x05010000
- in order for SOCKADDR_STORAGE etc. to be typedefed.
- * Replaced '-dUSE_WATT32' with '-dWATT32'.
- * Added $(DEMOS) to the 'all' target and removed the 'demos'
- target to be consistent with e.g. Makefile.msvc etc.
- * 'ENABLE_IPV6' is no longer used. Hence removed the '%use_ipv6' construct.
- * object-file order seems to be important (Watcom v.19). Hence
- 'ares_getopt.obj' must be put after the .obj that references getopt().
+- [David Drysdale brought this change]
-- cares-compilers.m4: CARES_CONVERT_INCLUDE_TO_ISYSTEM adjustments
-
- Add CARES_CHECK_COMPILER as a requirement.
-
- Ensure macro does nothing unless GNU_C or CLANG compiler is used.
+ Allow specification of search domain in ahost
- This should allow usage of this macro in unforeseen placements.
-
-- config-win32.h: comments adjustments - followup
-
-- config-win32.h: comments adjustments
-
-Daniel Stenberg (5 Aug 2011)
-- [Tom Hughes brought this change]
-
- ares_parse_a_reply: fix memleak
-
-Yang Tse (29 Jul 2011)
-- cares-functions.m4 serial # bump
+ Add the "-s domain" command line option to override the search
+ domains.
-- Revert "configure: additional flag checks for fcntl() and socket()"
+Daniel Stenberg (12 May 2014)
+- Revert "ares_parse_aaaa_reply: fix leak when reply contains 1 alias and no address"
- This reverts commit 5f2a3b0e48f26d24cb1fefea0dccb92d417dcbf7.
-
-- configure: additional flag checks for fcntl() and socket()
+ This reverts commit 440110b303fdbfadb3ad53d30eeb98cc45d70451.
-- xc-translit.m4 fix quoting
+- [Frederic Germain brought this change]
-- configure: avoid direct usage of AS_TR_* macros
+ ares_parse_aaaa_reply: fix leak when reply contains 1 alias and no address
-- xc-translit.m4 provides transliteration macros with well defined behavior.
+- [Doug Kwan brought this change]
-Jakub Hrozek (15 Jun 2011)
-- Revert "Only fall back to AF_INET searches when looking for AF_UNSPEC addresses"
+ ares_build.h: fix building on 64-bit powerpc
- This reverts commit b5823d65706af687c0e5110af8f0cfdcd068997d.
+ There are two issues.
- This patch was not reviewed properly before pushing
-
-- Revert "Do not use sized constants in public headers"
+ 1. gcc actually does not use __ppc__ and __ppc64__ but __PPC__ and
+ __PPC64__. The tests of __ILP32__ and __LP64__ are sufficient for gcc.
- This reverts commit 22c01e96f7b2ae9923e1baa50bfe3c0d22297a7d.
+ 2. clang defines __GNU__ and defines both __ppc64__ and __ppc__ when
+ targeting ppc64. This makes CARES_SIZEOF_LONG to be 4 on a ppc64 system
+ when building with clang.
- This is a Red Hat specific patch that does not belong into upstream
-
-- Use correct sizeof in ares_getnameinfo()
-
-- Do not leak rr_name on failures inside ares_parse_ptr_reply
-
-- Do not leak rr_name on failures inside ares_parse_a_reply
-
-- Do not leak rr_name on failures inside ares_parse_aaaa_reply
-
-- Do not leak rr_name on failures inside ares_parse_ns_reply
-
-- Fix incorrect sizeof() in ares_save_options
-
-- Fix incorrect allocation in ares_parse_ptr_reply()
-
-- Only fall back to AF_INET searches when looking for AF_UNSPEC addresses
-
-- Do not use sized constants in public headers
-
-Daniel Stenberg (13 Jun 2011)
-- [Jakub Hrozek brought this change]
+ My patch is two change the order of the checks so that we check the
+ 64-bit case first.
- ares_free_hostent(NULL) should be a noop
+- refresh: updated now with automake 1.14
-Yang Tse (8 Jun 2011)
-- configure: fix recvfrom 5th arg type qualifier detection (followup)
+- [David Drysdale brought this change]
-- configure: fix recvfrom 5th arg type qualifier detection
+ single_domain: Invalid memory access for empty string input
- Additionally remove whitespace from EOL
-
-Daniel Stenberg (4 Jun 2011)
-- strlen: use size_t to receive the return
-
-Yang Tse (4 Jun 2011)
-- xlc: avoid preprocessor definition usage when linking
+ We noticed a small buglet in ares_search() when it gets an empty string
+ as input -- the single_domain() utility function in ares_search.c
+ accesses invalid memory (before the start of the string).
-- ares_nowarn: icc 9.1 workaround
+Guenter Knauf (31 Aug 2013)
+- Fixed warning 'type specifier missing'.
-- ares_nowarn: header inclusion fix
+Daniel Stenberg (30 Aug 2013)
+- [Tor Arntsen brought this change]
-- ares_init: make ares_private.h last included header again
+ ares_rules.h: CARES_SIZEOF_LONG doesn't exist anymore, don't test for it
+
+ It was removed in f19387dd72432
-- compiler warning: fix
+- nowarn: use instead of configure for size of long
- Fix compiler warning: conversion may lose significant bits
+ This makes the header file much more multi-arch friendly and can be used
+ as-is with both 32 bit and 64 bit builds.
-- compiler warning: fix
+- timeoffset: made static and private
- Fix compiler warning: variable was set but never used
+ ares__timeoffset() was only used once within this single source file
+
+- timeadd: make static
- Fix compiler warning: clobber ignored
+ ares__timeadd() was only ever used from within the same source
-- ares_iphlpapi: fix compiler warnings
+Yang Tse (18 Jul 2013)
+- xc-am-iface.m4: comments refinement
-- winsock: compilation fixes
+- configure: fix 'subdir-objects' distclean related issue
- Provide winsock iphlpapi alternative definitions to prevent compilation
- failures when using a variety of winsock header implementations.
+ See XC_AMEND_DISTCLEAN comments for details.
-Daniel Stenberg (17 May 2011)
-- [David Stuart brought this change]
+- configure: automake 1.14 compatibility tweak (use XC_AUTOMAKE)
- IPv6-on-windows: find DNS servers correctly
+- xc-am-iface.m4: provide XC_AUTOMAKE macro
-- man pages: docs for the c-ares utility programs
+Daniel Stenberg (12 May 2013)
+- gitignore: ignore all ares_*pdf but also CHANGES.dist
-- ares_parse_ns_reply.c: remove CVSism
+- bump: start working towards 1.10.1
-Yang Tse (27 Mar 2011)
-- build: fix header inclusion
+Version 1.10.0 (12 May 2013)
-- getservbyport replacement for Win CE
+Daniel Stenberg (12 May 2013)
+- RELEASE-NOTES: two more bug fixes
-- renamed getplatform() to ares__getplatform() to avoid namespace pollution
+- [Keith Shaw brought this change]
-- configure: fix libtool warning
+ ares_set_servers_csv: fixed IPv6 address parsing
- Recent versions of libtool are now tracing usage of AC_CONFIG_MACRO_DIR
- macro and warn heavily when not used in configure script along with
- ACLOCAL_AMFLAGS in Makefile.am. So in order to make libtool happy
- while keeping backwards compatibility this is added.
+ Fixed bug that caused the last part of an IPv6 address to be parsed as
+ the port number when the last part is all numeric.
-- adig: RFC4034 resource record type detection
+- nroff: fix two syntax mistakes
- Can be tested with: adig -s 8.8.8.8 -t ANY example.com
-
-- nameser.h: RFC4034 resource record type definitions
-
-- build: move platform stuff to ares_platform.c and ares_platform.h
-
-- build: find out windows platform using GetVersionEx()
+ ares_parse_a_reply and ares_parse_aaaa_reply both had two \fB instead of
+ \fP
+
+ Reported-by: Alexander Klauer
+ Bug: http://c-ares.haxx.se/mail/c-ares-archive-2013-03/0010.shtml
-- build: use getenv() replacement function for systems which lack it
+- [Alex Loukissas brought this change]
-- setup_once: system error codes for Windows CE
+ build: fix build on msvc11
-- ares_search: use ERRNO macro for portability sake
+- Makefile.am: increment -version-info for 1.10.0 release
-- System's errno.h inclusion cleanup follow-up.
-
- System's errno.h is conditionally included from setup_once.h
+- README: remove unnecessary comment
-- Windows CE specific adjustment
-
- All versions of Windows CE support Winsock 1.1
+- ares_version.h: copyright end range year is now 2013
-- System's errno.h inclusion cleanup.
-
- System's errno.h is conditionally included from setup_once.h
+- RELEASE-NOTES: synced with fb0737f3a0a1c37
-- ares_init: fix gethostname error detection on winsock platforms
+- [Paul Saab brought this change]
-- configure: r-enable temporarily disabled detection of system's inet_ntop()
+ ares_parse_aaaa_reply: Plug memory leak
- Detection was temporarily disabled in commit 674e044ccb21f2f63537da53565fce868f
-
-Daniel Stenberg (15 Mar 2011)
-- configure: stop using the deprecated AM_INIT_AUTOMAKE syntax
+ This change is similar to ares_parse_a_reply.c in commit
+ bffd67f16a8f42fe6dbf79ab2e39d92eea05c8a6
-- [Gisle Vanem brought this change]
+- [Patrick Valsecchi brought this change]
- Watt-32: use errno
+ ares_parse_txt_reply: return a ares_txt_reply node for each sub-string
- Make sure Watt-32 programs use 'errno' even on Win32 targets
+ Previously, the function would wrongly return all substrings merged into
+ one.
-Guenter Knauf (18 Feb 2011)
-- Removed commented CLFAGS no longer needed.
+- [Alexander Klauer brought this change]
-- Fixed CFLAGS for NetWare.
+ library init: documentation update
- Added -m32 to enable compilation with x86_64 compilers;
- added conditional to set -fpcc-struct-return only for gcc compiler.
+ This commit updates the documentation of ares_library_init() and
+ ares_library_cleanup() with regard to the newly introduced reference
+ counting of initializations and deinitializations.
-Daniel Stenberg (18 Feb 2011)
-- [Gisle Vanem brought this change]
+- [Alexander Klauer brought this change]
- Watt32: fix server init
+ library init: be recursive
- Somewhere in the process, programs using the Watt-32 tcp/ip stack
- stopped working.
+ Previously, a single call to ares_library_cleanup() would deinitialise
+ the c-ares library, regardless of how many times ares_library_init() was
+ called. This behaviour may cause problems in programs linking two or
+ more libraries which, in turn, use c-ares. The present commit fixes this
+ problem, deinitializing the library only after a number of calls to
+ ares_library_cleanup() matching the number of calls to
+ ares_library_init().
-- [Dima Tisnek brought this change]
+- [Patrick Valsecchi brought this change]
- config_sortlist: (win32) missing else
+ protocol parsing: check input data stricter
- Without an else there, contents of "pat" that could have been
- successfully set just above, may be clobbered by successive unsuccessful
- calls to "xxx_pton" or "ip_addr".
-
-Yang Tse (17 Jan 2011)
-- Makefile.msvc: add a couple of VS version strings
-
-- Makefile.msvc: add a couple of VS version strings
-
-- build: add install target to Makefile.msvc
-
-Daniel Stenberg (27 Dec 2010)
-- ares_set_servers_csv: remove unused variables
-
-- init_by_resolv_conf: fix compiler warnings
+ ... so that bad length fields aren't blindly accepted
- The code received the return codes in the 'status' variable without
- using it. Instead we just ignore those particular errors.
+ Bug: http://c-ares.haxx.se/mail/c-ares-archive-2013-04/0016.shtml
-- getv4: Value stored to 'dst' is never read
+Guenter Knauf (11 Apr 2013)
+- Create ares_build.h when buidling from Git.
-- advance_tcp_send_queue: avoid NULL ptr dereference
+- Added -DCARES_STATICLIB to CFLAGS.
- If given a too large 'num_bytes' value, it would cause a NULL ptr
- dereference. Instead the code will now break out of the loop at the end
- of the list.
-
-- [Peter Pentchev brought this change]
+ Currently this static makefile does only support building the
+ static library libcares.a.
- configure: fix a bashism
+Daniel Stenberg (8 Apr 2013)
+- [Alexander Klauer brought this change]
-- cleanup: avoid unsafe typecasts
+ .gitignore: ignore patch files
- Avoid the risk of reading 16bit data from an unaligned address by using
- a macro that is adapted for this.
-
-- [Stefan Bühler brought this change]
-
- ares_expand_name: Fix encoded length for indirect root
-
-Yang Tse (18 Dec 2010)
-- build: add some explicit file references to VS project files
-
-- config-win32: provide HAVE_ASSERT_H definition
-
-- build: include ares_nowarn in sample program VS project files
+ This commit adds a line to .gitignore to the effect that patch files
+ generated by 'git format-patch' are excluded from the repository.
-- build: include ares_nowarn among SAMPLESOURCES and SAMPLEHEADERS
+- [Alexander Klauer brought this change]
-- configure: temporarily disable detection of system's inet_ntop()
+ ares_destroy() documentation: no new requests
- This is done to allow compilation of ares_inet_ntop() by some daily
- builds picky compilers that otherwise do not need this function.
-
-- changes: mention last fix
+ Clarify that no new requests may be added to a resolver channel that is
+ currently being destroyed.
-- ares_inet_ntop: remove definition and usage of macro SPRINTF
-
- Existing definition of SPRINTF always resulted in sprintf() being used,
- and sprintf() returning 'int' is already used throughout the library.
+- [Alexander Klauer brought this change]
-- ares_inet_ntop: reapply changes from previous c-ares version (III)
+ Documentation: properly document ARES_ECANCELLED
- - Replace 'u_char' with 'unsigned char'.
- - Replace 'u_int' with 'unsigned int'.
- - use macros ERRNO and SET_ERRNO() for errno handling.
+ This commit clarifies the behaviour of ares_cancel() with respect to
+ callbacks and adds missing documentation of ARES_ECANCELLED to the man
+ pages of the affected functions.
-- ares_inet_ntop: reapply changes from previous c-ares version (II)
-
- - Remove rcsid.
- - Adjust header file inclusions.
- - ares_inet_ntop used only on systems without a proper inet_ntop function.
+- [Alexander Klauer brought this change]
-- ares_inet_ntop: reapply changes from previous c-ares version (I)
+ ares_cancel(): cancel requests safely
- - Replace tabs with spaces.
- - Use ANSI C style for function declarations and definitions.
- - Use sizeof with parentheses.
+ An invocation of ares_cancel() walks through the request list, calling
+ the callbacks of all pending requests on a channel. Previously, if such
+ a callback added a new request to the channel, the request list might
+ not end up empty, causing an abort by assertion failure. The present
+ commit ensures that precisely all requests present upon entry of
+ ares_cancel() are cancelled, and that adding new requests through
+ callbacks is safe.
-- ares_inet_ntop: fix off by one error triggering out of bounds write
-
- ares_inet_ntop would trigger an out of bounds write when the representation
- of the address required 15 characters, due to not taking in account null
- termination character.
+Yang Tse (10 Mar 2013)
+- ares.h: stricter CARES_EXTERN linkage decorations logic
- Full import of inet_ntop.c from bind-9.5.3rc1 to pull additional fixes.
-
-- ares_nowarn: add conditional inclusion of assert.h header
-
-- fix compiler warning: conversion may lose significant bits
+ No API change involved.
-- ares_inet_net_pton: fix non-rejection of some malformed literals
+- ares_build.h.dist: enhance non-configure GCC ABI detection logic
- ares_inet_net_pton would return wrong values when excessively large,
- and invalid, netmasks are used. Fixes are from bind-9.5.3rc1,
- issue also described in the WLB-2008080064 advisory.
-
-- setup_once: provide ISASCII macro
-
-- configure: inet_net_pton function check adjustments
+ GCC specific adjustments:
- Define HAVE_INET_NET_PTON only when system's inet_net_pton function is IPv6
- capable and is not affected by the WLB-2008080064 advisory.
+ - check __ILP32__ before 32 and 64bit processor architectures in
+ order to detect ILP32 programming model on 64 bit processors
+ which, of course, also support LP64 programming model, when using
+ gcc 4.7 or newer.
- HAVE_INET_NET_PTON_IPV6 is no longer defined nor used.
-
-- ares_init: fix detection of semicolon comments in resolv.conf
+ - keep 32bit processor architecture checks in order to support gcc
+ versions older than 4.7 which don't define __ILP32__
- File resolv.conf may either use a hash '#' or a semicolon ';' character as an
- indication that the rest of the line is a comment. This fixes not recognizing
- the semicolon as a valid comment indicator in resolv.conf.
-
-- version: start working on 1.7.5
-
-Version 1.7.4 (8 Dec 2010)
-
-Daniel Stenberg (8 Dec 2010)
-- release-preps: CHANGES and RELEASE-NOTES synced
-
-- ares_set_local_*: added in 1.7.4, not before
-
-Yang Tse (3 Dec 2010)
-- build: provide SIZEOF_SIZE_T definition for non-configure builds
-
-- build: config.dos renamed to config-dos.h
+ - check __LP64__ for gcc 3.3 and newer, while keeping 64bit processor
+ architecture checks for older versions which don't define __LP64__
-- build: provide SIZEOF_SIZE_T netware definition
+Daniel Stenberg (9 Mar 2013)
+- ares.h: there is no ares_free_soa function
-- ares_gethostbyaddr: fix compiler warning: conversion may lose significant bits
+Yang Tse (9 Mar 2013)
+- Makefile.am: empty AM_LDFLAGS definition for automake 1.7 compatibility
-- configure: undo using autobuilds to temporarily verify strict aliasing warnings.
+- ares_inet_ntop.3: s/socklen_t/ares_socklen_t
-- fix compiler warning: rounding, sign extension, or loss of accuracy may result
+- configure: use XC_LIBTOOL for portability across libtool versions
-Daniel Stenberg (2 Dec 2010)
-- [Ben Noordhuis brought this change]
+- xc-lt-iface.m4: provide XC_LIBTOOL macro
- ares_parse_a_reply: fix CNAME response parsing
-
- Reply to a CNAME query doesn't contain addresses, causing
- ares_parse_a_reply() to bail out with ARES_ENODATA
-
- Bug: http://groups.google.com/group/nodejs/browse_thread/thread/a1268c9ea5e9ad9b
+- Makefile.am: use AM_CPPFLAGS instead of INCLUDES
-Yang Tse (1 Dec 2010)
-- fix compiler warning: conversion may lose significant bits
+- inet_ntop.c: s/socklen_t/ares_socklen_t
-- atoi: remove atoi usage
+- inet_ntop.c: s/socklen_t/ares_socklen_t for portability
-- ares_init: fix compiler warning: conversion may lose significant bits
+Daniel Stenberg (19 Feb 2013)
+- ares.h: s/socklen_t/ares_socklen_t for portability
-- configure: fix autoconf warning
+- ares_inet_ntop.3: 4th argument is socklen_t!
-- inet_pton: fix compiler warning
+- spell inet correctly!
-- configure: use autobuilds to temporarily verify strict aliasing warnings.
+- ares_inet_pton/ntop: cleanup
- Temporarily, When cross-compiling with gcc 3.0 or later, enable strict aliasing
- rules and warnings. Given that cross-compiled targets autobuilds do not run the
- test-suite, there is no risk of running code that violates strict aliasing rules
-
-- ares_getnameinfo: Partially revert commit 85520d66e0ac7ac73411bc25e98769a88b2f
+ Make sure that the symbols are always exported and present in c-ares.
- Upon socket address family and length validation failure return ARES_ENOTIMP
- in callback again, this is the error code documented in man page and used
- mostly all over the library.
-
-- ares_getnameinfo: Validate socket address family and length.
+ Make the headers prefixed with 'ares'.
- Validate socket address family and that the socket address length is appropriate
- for the specified family. Failure is reported with ARES_EBADFAMILY in callback.
-
-- ares_getnameinfo: fix two compiler warnings
-
-- Added another VS10 version string
-
-- Fix GCC 4 compiler warning 'dereferencing type-punned pointer might break strict-aliasing rules'.
+ Removed the inet_ntop.h version as it no longer features any content.
-- Revert commit 494274e653936335c255a47599970de3df21e7c4
+- ares_inet_ntop/ares_inet_pton: added man pages
-- configure: fix autoconf 2.68 warning: no AC_LANG_SOURCE call detected in body
+Yang Tse (15 Feb 2013)
+- [Gisle Vanem brought this change]
-- Fix compiler warning: array subscript has type 'char'
+ curl_setup_once.h: definition of HAVE_CLOSE_S defines sclose() to close_s()
-- Fix GCC 4 compiler warning 'dereferencing type-punned pointer might break strict-aliasing rules'.
+- [Gisle Vanem brought this change]
-- Revert following commits:
- 07bc7ea79509bcc9ef6e09151e81766ed00d3392
- 3392a50ea3f8573ea4b7a9d82b9833dab60cb0e9
- 9912637d32c9987719a1ea12db591aee2941891c
-
- The purpose of the whole patch was to silence a compiler warning triggered
- with GCC 4 on file ares_process.c The specific compiler warning was
- 'dereferencing type-punned pointer might break strict-aliasing rules'.
-
- A simpler patch will follow to equally silence the warning.
+ config-dos.h: define HAVE_CLOSE_S for MSDOS/Watt-32
-- ares_options: reorder header inclusions to make inclusion of
- ares_private.h the last included one again.
+- [Gisle Vanem brought this change]
-Daniel Stenberg (12 Nov 2010)
-- [Patrik Thunstrom brought this change]
+ config-dos.h: define strerror() to strerror_s_() for High-C
- adig: fix NAPTR parsing
-
- I ran across a small "issue" in your adig example.
+Daniel Stenberg (13 Feb 2013)
+- ares_get_datatype: removed unused function
- It is simply the last part of the NAPTR record, the replacement element,
- which is not a string, as currently handled in adig, but a domain name.
-
-- ares_save_options: assignments instead of memcpy
+ it was also wrongly named as internal functions require two underscores
-- init_by_options: don't copy an empty sortlist
+- ares__bitncmp: use two underscores for private functions
- If there aren't any sort items to copy, don't bother. Without this
- little precaution it would do a malloc(0) which causes undefined
- behaviors and is frowned upon by curl's memdebug-system.
-
-Guenter Knauf (3 Oct 2010)
-- Minor Watcom makefile tweaks.
-
-Daniel Stenberg (30 Sep 2010)
-- [Mike Crowe brought this change]
+ It used a single one previously making it look like a public one
- Fix lookup with HOSTALIASES set.
-
- ares__read_line returns ARES_EOF when it reaches the end of the
- file. This will happen every time when reading to the end of the
- HOSTALIASES file. Unfortunately single_domain treats this error as
- being fatal.
+- ares__generate_new_id: moved to ares_query.c
- Signed-off-by: Mike Crowe
+ ... and ares__rc4 is turned into a local static function.
-Ben Greear (24 Aug 2010)
-- Add missing break that caused get_ares_servers to fail.
+- ares__swap_lists: make private and static
- Reported-by: Ning Dong
- Signed-off-by: Ben Greear
-
-Yang Tse (11 Aug 2010)
-- configure: werror related adjustments
-
-Guenter Knauf (8 Aug 2010)
-- Added copyright string to ares_version.h and make use of it in other files.
-
-- Block created ares_build.h for NetWare to avoid usage from other platforms.
-
-- Fix to overwrite default libname.
+ ... since there's only one user, make it static within ares_process.c
-- Some more Watcom makefile massage ...
+Yang Tse (13 Feb 2013)
+- Makefile.msvc: add four VS version strings
-- Some more Watcom makefile massage ...
+Daniel Stenberg (13 Feb 2013)
+- ares_expand_name.3: clarify how to free the data
-Ben Greear (4 Aug 2010)
-- sock-addr-storage: Detect and deal with lack of .ss_family member.
+Yang Tse (30 Jan 2013)
+- zz40-xc-ovr.m4: fix 'wc' detection - follow-up 2
- AIX, at least, does not have sockaddr_storage.ss_family member.
- Detect this in the configure logic and use proper #ifdefs in the
- ares_process logic.
+ - Fix a pair of single quotes to double quotes.
- Signed-off-by: Ben Greear
- Tested-by: Tor Arntsen
-
-Guenter Knauf (3 Aug 2010)
-- Added Watcom makefile based on libcurl's Makefile.Watcom.
+ URL: http://curl.haxx.se/mail/lib-2013-01/0355.html
+ Reported by: Tor Arntsen
-Ben Greear (31 Jul 2010)
-- typo: Fix compile bug for platforms that don't have sockaddr_storage.
+- zz40-xc-ovr.m4: fix 'wc' detection - follow-up
- Bug was introduced by me in previous commit.
+ - Take into account that 'wc' may return leading spaces and/or tabs.
- Signed-off-by: Ben Greear
+ - Set initial IFS to space, tab and newline.
-- Fix aliasing warning in gcc 4.4.4 (at least).
-
- Should be no functional change, though the code gets a bit
- ugglier.
+- zz40-xc-ovr.m4: fix 'wc' detection
- Signed-off-by: Ben Greear
-
-Daniel Stenberg (31 Jul 2010)
-- ares_set_servers_csv: use ISDIGIT
+ - Take into account that 'wc' may return leading spaces.
- The IS*() set of macros are preferred to the regular is*() functions as
- they help us avoid the most common pitfalls.
-
-Ben Greear (30 Jul 2010)
-- cast arg to isdigit to int
+ - Set internationalization behavior variables.
- Looks like it might silence a warning on Netware build.
+ Tor Arntsen analyzed and reported the issue.
- Signed-off-by: Ben Greear
+ URL: http://curl.haxx.se/mail/lib-2013-01/0351.html
-- remove all uses of uint32_t
-
- Previous fix forgot a few.
-
- Signed-off-by: Ben Greear
+- zz40-xc-ovr.m4: check another three basic utilities
-- fix signed v/s unsigned casts warning in ares_gethostbyaddr.c
+- zz40-xc-ovr.m4: 1.0 interface stabilization
- Signed-off-by: Ben Greear
+ - Stabilization results in 4 public interface m4 macros:
+ XC_CONFIGURE_PREAMBLE
+ XC_CONFIGURE_PREAMBLE_VER_MAJOR
+ XC_CONFIGURE_PREAMBLE_VER_MINOR
+ XC_CHECK_PATH_SEPARATOR
+ - Avoid one level of internal indirection
+ - Update comments
+ - Drop XC_OVR_ZZ40 macro
-- local-bind-fixup: Fix inet_pton warning.
-
- Conditionally include for inet_pton
- headers.
+- zz40-xc-ovr.m4: emit witness message in configure BODY
- Signed-off-by: Ben Greear
+ This avoids witness message in output when running configure --help,
+ while sending the message to config.log for other configure runs.
-- build: Enable compiling with -Werror.
+- zz40-xc-ovr.m4: truly do version conditional overriding
- This helps find compile warnings because they simply break
- the build.
+ - version conditional overriding
+ - catch unexpanded XC macros
+ - fix double words in comments
+
+- zz40-xc-ovr.m4: fix variable assignment of subshell output bashism
- To use:
- ./configure --enable-warnings --enable-werror
+ Tor Arntsen analyzed and reported the issue.
- Signed-off-by: Ben Greear
+ URL: http://curl.haxx.se/mail/lib-2013-01/0306.html
-- ipv6: Fix some build issues related to the local-bind feature.
-
- Signed-off-by: Ben Greear
+- zz40-xc-ovr.m4: reinstate strict AC_REQUIRE macro dependencies
diff --git a/deps/cares/CMakeLists.txt b/deps/cares/CMakeLists.txt
index bd901733626678..e951cafd7b4068 100644
--- a/deps/cares/CMakeLists.txt
+++ b/deps/cares/CMakeLists.txt
@@ -1,6 +1,8 @@
# Copyright (C) The c-ares project and its contributors
# SPDX-License-Identifier: MIT
-CMAKE_MINIMUM_REQUIRED (VERSION 3.1.0)
+CMAKE_MINIMUM_REQUIRED (VERSION 3.5.0)
+
+list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
INCLUDE (CheckIncludeFiles)
INCLUDE (CheckTypeSize)
@@ -10,10 +12,10 @@ INCLUDE (CheckCSourceCompiles)
INCLUDE (CheckStructHasMember)
INCLUDE (CheckLibraryExists)
-PROJECT (c-ares LANGUAGES C VERSION "1.20.1" )
+PROJECT (c-ares LANGUAGES C VERSION "1.27.0" )
# Set this version before release
-SET (CARES_VERSION "1.20.1")
+SET (CARES_VERSION "1.27.0")
INCLUDE (GNUInstallDirs) # include this *AFTER* PROJECT(), otherwise paths are wrong.
@@ -28,26 +30,38 @@ 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 "9:1:7")
+SET (CARES_LIB_VERSIONINFO "14:0:12")
-OPTION (CARES_STATIC "Build as a static library" OFF)
-OPTION (CARES_SHARED "Build as a shared library" ON)
-OPTION (CARES_INSTALL "Create installation targets (chain builders may want to disable this)" ON)
-OPTION (CARES_STATIC_PIC "Build the static library as PIC (position independent)" OFF)
-OPTION (CARES_BUILD_TESTS "Build and run tests" OFF)
+OPTION (CARES_STATIC "Build as a static library" OFF)
+OPTION (CARES_SHARED "Build as a shared library" ON)
+OPTION (CARES_INSTALL "Create installation targets (chain builders may want to disable this)" ON)
+OPTION (CARES_STATIC_PIC "Build the static library as PIC (position independent)" OFF)
+OPTION (CARES_BUILD_TESTS "Build and run tests" OFF)
OPTION (CARES_BUILD_CONTAINER_TESTS "Build and run container tests (implies CARES_BUILD_TESTS, Linux only)" OFF)
-OPTION (CARES_BUILD_TOOLS "Build tools" ON)
+OPTION (CARES_BUILD_TOOLS "Build tools" ON)
+OPTION (CARES_SYMBOL_HIDING "Hide private symbols in shared libraries" OFF)
+OPTION (CARES_THREADS "Build with thread-safety support" ON)
SET (CARES_RANDOM_FILE "/dev/urandom" CACHE STRING "Suitable File / Device Path for entropy, such as /dev/urandom")
+# Tests require a C++14 compiler
+IF (CARES_BUILD_TESTS OR CARES_BUILD_CONTAINER_TESTS)
+ set(CMAKE_CXX_STANDARD 14)
+ set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
+ set(CMAKE_CXX_EXTENSIONS FALSE)
+ enable_language(CXX)
+ENDIF ()
+
# Tests require static to be enabled on Windows to be able to access otherwise hidden symbols
-IF (CARES_BUILD_TESTS AND (NOT CARES_STATIC) AND WIN32)
+IF ((CARES_BUILD_TESTS OR CARES_BUILD_CONTAINER_TESTS) AND (NOT CARES_STATIC) AND WIN32)
SET (CARES_STATIC ON)
SET (CARES_STATIC_PIC ON)
- MESSAGE (WARNING "Static building was requested be disabled, but reenabled to support tests")
+ MESSAGE (WARNING "Static building was requested be disabled, but re-enabled to support tests")
ENDIF ()
+INCLUDE (EnableWarnings)
+
# allow linking against the static runtime library in msvc
IF (MSVC)
OPTION (CARES_MSVC_STATIC_RUNTIME "Link against the static runtime library" OFF)
@@ -70,11 +84,22 @@ IF (MSVC)
ENDIF ()
ENDIF ()
-# Keep build organized.
-SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}")
-SET (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
-SET (CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
-SET (PACKAGE_DIRECTORY ${PROJECT_BINARY_DIR}/package)
+IF (CARES_SYMBOL_HIDING)
+ IF (CMAKE_VERSION VERSION_LESS 3.12)
+ MESSAGE (FATAL_ERROR "Hiding symbols requires CMake 3.12")
+ ENDIF ()
+ CMAKE_POLICY (SET CMP0063 NEW)
+ENDIF ()
+
+# Keep build organized, but only if it is the top-level project.
+# CMake 3.21 or later has PROJECT_IS_TOP_LEVEL, but we aren't yet depending on
+# that version.
+IF (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
+ SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}")
+ SET (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
+ SET (CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
+ SET (PACKAGE_DIRECTORY ${PROJECT_BINARY_DIR}/package)
+ENDIF ()
# Destinations for installing different kinds of targets (pass to install command).
SET (TARGETS_INST_DEST
@@ -165,6 +190,7 @@ CARES_FUNCTION_IN_LIBRARY (clock_gettime rt HAVE_LIBRT)
# Look for necessary includes
+CHECK_INCLUDE_FILES (AvailabilityMacros.h HAVE_AVAILABILITYMACROS_H)
CHECK_INCLUDE_FILES (sys/types.h HAVE_SYS_TYPES_H)
CHECK_INCLUDE_FILES (sys/random.h HAVE_SYS_RANDOM_H)
CHECK_INCLUDE_FILES (sys/socket.h HAVE_SYS_SOCKET_H)
@@ -181,7 +207,12 @@ CHECK_INCLUDE_FILES (malloc.h HAVE_MALLOC_H)
CHECK_INCLUDE_FILES (memory.h HAVE_MEMORY_H)
CHECK_INCLUDE_FILES (netdb.h HAVE_NETDB_H)
CHECK_INCLUDE_FILES (netinet/in.h HAVE_NETINET_IN_H)
-CHECK_INCLUDE_FILES (net/if.h HAVE_NET_IF_H)
+# On old MacOS SDK versions, you must include sys/socket.h before net/if.h
+IF (HAVE_SYS_SOCKET_H)
+ CHECK_INCLUDE_FILES ("sys/socket.h;net/if.h" HAVE_NET_IF_H)
+ELSE ()
+ CHECK_INCLUDE_FILES (net/if.h HAVE_NET_IF_H)
+ENDIF ()
CHECK_INCLUDE_FILES (signal.h HAVE_SIGNAL_H)
CHECK_INCLUDE_FILES (socket.h HAVE_SOCKET_H)
CHECK_INCLUDE_FILES (stdbool.h HAVE_STDBOOL_H)
@@ -196,10 +227,14 @@ CHECK_INCLUDE_FILES (sys/select.h HAVE_SYS_SELECT_H)
CHECK_INCLUDE_FILES (sys/stat.h HAVE_SYS_STAT_H)
CHECK_INCLUDE_FILES (sys/time.h HAVE_SYS_TIME_H)
CHECK_INCLUDE_FILES (sys/uio.h HAVE_SYS_UIO_H)
+CHECK_INCLUDE_FILES (sys/random.h HAVE_SYS_RANDOM_H)
+CHECK_INCLUDE_FILES (sys/event.h HAVE_SYS_EVENT_H)
+CHECK_INCLUDE_FILES (sys/epoll.h HAVE_SYS_EPOLL_H)
+CHECK_INCLUDE_FILES (ifaddrs.h HAVE_IFADDRS_H)
CHECK_INCLUDE_FILES (time.h HAVE_TIME_H)
+CHECK_INCLUDE_FILES (poll.h HAVE_POLL_H)
CHECK_INCLUDE_FILES (dlfcn.h HAVE_DLFCN_H)
CHECK_INCLUDE_FILES (unistd.h HAVE_UNISTD_H)
-
# On OpenBSD, you must include sys/types.h before netinet/tcp.h
IF (HAVE_SYS_TYPES_H)
CHECK_INCLUDE_FILES ("sys/types.h;netinet/tcp.h" HAVE_NETINET_TCP_H)
@@ -213,23 +248,31 @@ ENDIF ()
IF (WIN32)
CHECK_INCLUDE_FILES ("winsock2.h;windows.h" HAVE_WINSOCK2_H)
CHECK_INCLUDE_FILES ("winsock2.h;ws2tcpip.h;windows.h" HAVE_WS2TCPIP_H)
+CHECK_INCLUDE_FILES ("winsock2.h;iphlpapi.h;windows.h" HAVE_IPHLPAPI_H)
+CHECK_INCLUDE_FILES ("winsock2.h;netioapi.h;windows.h" HAVE_NETIOAPI_H)
+CHECK_INCLUDE_FILES ("winsock2.h;mswsock.h;windows.h" HAVE_MSWSOCK_H)
CHECK_INCLUDE_FILES ("winsock.h;windows.h" HAVE_WINSOCK_H)
CHECK_INCLUDE_FILES (windows.h HAVE_WINDOWS_H)
+CHECK_INCLUDE_FILES ("windows.h;winternl.h" HAVE_WINTERNL_H)
+CHECK_INCLUDE_FILES ("windows.h;ntdef.h" HAVE_NTDEF_H)
+CHECK_INCLUDE_FILES ("windows.h;ntdef.h;ntstatus.h" HAVE_NTSTATUS_H)
+
+
ENDIF ()
# Set system-specific compiler flags
IF (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
LIST (APPEND SYSFLAGS -D_DARWIN_C_SOURCE)
ELSEIF (CMAKE_SYSTEM_NAME STREQUAL "Linux")
- LIST (APPEND SYSFLAGS -D_GNU_SOURCE -D_POSIX_C_SOURCE=199309L -D_XOPEN_SOURCE=600)
+ LIST (APPEND SYSFLAGS -D_GNU_SOURCE -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700)
ELSEIF (CMAKE_SYSTEM_NAME STREQUAL "SunOS")
- LIST (APPEND SYSFLAGS -D__EXTENSIONS__ -D_REENTRANT -D_XOPEN_SOURCE=600)
+ LIST (APPEND SYSFLAGS -D__EXTENSIONS__ -D_REENTRANT -D_XOPEN_SOURCE=700)
ELSEIF (CMAKE_SYSTEM_NAME STREQUAL "AIX")
- LIST (APPEND SYSFLAGS -D_ALL_SOURCE -D_XOPEN_SOURCE=600 -D_USE_IRS)
+ LIST (APPEND SYSFLAGS -D_ALL_SOURCE -D_XOPEN_SOURCE=700 -D_USE_IRS)
ELSEIF (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
# Don't define _XOPEN_SOURCE on FreeBSD, it actually reduces visibility instead of increasing it
ELSEIF (WIN32)
- LIST (APPEND SYSFLAGS -DWIN32_LEAN_AND_MEAN -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -D_WIN32_WINNT=0x0600)
+ LIST (APPEND SYSFLAGS -DWIN32_LEAN_AND_MEAN -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -D_WIN32_WINNT=0x0602)
ENDIF ()
ADD_DEFINITIONS(${SYSFLAGS})
@@ -271,12 +314,14 @@ MACRO (CARES_EXTRAINCLUDE_IFSET var include)
ENDIF ()
ENDMACRO ()
+CARES_EXTRAINCLUDE_IFSET (HAVE_AVAILABILITYMACROS_H AvailabilityMacros.h)
CARES_EXTRAINCLUDE_IFSET (HAVE_STDBOOL_H stdbool.h)
CARES_EXTRAINCLUDE_IFSET (HAVE_SYS_TYPES_H sys/types.h)
CARES_EXTRAINCLUDE_IFSET (HAVE_ARPA_INET_H arpa/inet.h)
CARES_EXTRAINCLUDE_IFSET (HAVE_ARPA_NAMESER_H arpa/nameser.h)
CARES_EXTRAINCLUDE_IFSET (HAVE_NETDB_H netdb.h)
CARES_EXTRAINCLUDE_IFSET (HAVE_NET_IF_H net/if.h)
+CARES_EXTRAINCLUDE_IFSET (HAVE_IFADDRS_H ifaddrs.h)
CARES_EXTRAINCLUDE_IFSET (HAVE_NETINET_IN_H netinet/in.h)
CARES_EXTRAINCLUDE_IFSET (HAVE_NETINET_TCP_H netinet/tcp.h)
CARES_EXTRAINCLUDE_IFSET (HAVE_SIGNAL_H signal.h)
@@ -289,12 +334,18 @@ CARES_EXTRAINCLUDE_IFSET (HAVE_SYS_SELECT_H sys/select.h)
CARES_EXTRAINCLUDE_IFSET (HAVE_SYS_SOCKET_H sys/socket.h)
CARES_EXTRAINCLUDE_IFSET (HAVE_SYS_SOCKIO_H sys/sockio.h)
CARES_EXTRAINCLUDE_IFSET (HAVE_SYS_TIME_H sys/time.h)
+CARES_EXTRAINCLUDE_IFSET (HAVE_SYS_STAT_H sys/stat.h)
CARES_EXTRAINCLUDE_IFSET (HAVE_SYS_UIO_H sys/uio.h)
+CARES_EXTRAINCLUDE_IFSET (HAVE_SYS_RANDOM_H sys/random.h)
+CARES_EXTRAINCLUDE_IFSET (HAVE_SYS_EVENT_H sys/event.h)
+CARES_EXTRAINCLUDE_IFSET (HAVE_SYS_EPOLL_H sys/epoll.h)
CARES_EXTRAINCLUDE_IFSET (HAVE_TIME_H time.h)
+CARES_EXTRAINCLUDE_IFSET (HAVE_POLL_H poll.h)
CARES_EXTRAINCLUDE_IFSET (HAVE_FCNTL_H fcntl.h)
CARES_EXTRAINCLUDE_IFSET (HAVE_UNISTD_H unistd.h)
CARES_EXTRAINCLUDE_IFSET (HAVE_WINSOCK2_H winsock2.h)
CARES_EXTRAINCLUDE_IFSET (HAVE_WS2TCPIP_H ws2tcpip.h)
+CARES_EXTRAINCLUDE_IFSET (HAVE_IPHLPAPI_H iphlpapi.h)
CARES_EXTRAINCLUDE_IFSET (HAVE_WINDOWS_H windows.h)
# Check Types
@@ -323,10 +374,8 @@ ENDMACRO ()
CARES_TYPE_EXISTS (socklen_t HAVE_SOCKLEN_T)
CARES_TYPE_EXISTS (SOCKET HAVE_TYPE_SOCKET)
-CARES_TYPE_EXISTS (bool HAVE_BOOL_T)
CARES_TYPE_EXISTS (ssize_t HAVE_SSIZE_T)
CARES_TYPE_EXISTS ("long long" HAVE_LONGLONG)
-CARES_TYPE_EXISTS (sig_atomic_t HAVE_SIG_ATOMIC_T)
CARES_TYPE_EXISTS ("struct addrinfo" HAVE_STRUCT_ADDRINFO)
CARES_TYPE_EXISTS ("struct in6_addr" HAVE_STRUCT_IN6_ADDR)
CARES_TYPE_EXISTS ("struct sockaddr_in6" HAVE_STRUCT_SOCKADDR_IN6)
@@ -351,13 +400,9 @@ IF ((NOT APPLE) OR IOS_V10 OR MACOS_V1012)
CHECK_SYMBOL_EXISTS (CLOCK_MONOTONIC "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_CLOCK_GETTIME_MONOTONIC)
ENDIF ()
-CHECK_STRUCT_HAS_MEMBER("struct sockaddr_in6" sin6_scope_id "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID LANGUAGE C)
+CHECK_STRUCT_HAS_MEMBER("struct sockaddr_in6" sin6_scope_id "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID LANGUAGE C)
-# Check for "LL" numeric suffix support
-CHECK_C_SOURCE_COMPILES ("int main() { int n=1234LL; return 0; }" HAVE_LL)
-
-CHECK_SYMBOL_EXISTS (bitncmp "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_BITNCMP)
CHECK_SYMBOL_EXISTS (closesocket "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_CLOSESOCKET)
CHECK_SYMBOL_EXISTS (CloseSocket "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_CLOSESOCKET_CAMEL)
CHECK_SYMBOL_EXISTS (connect "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_CONNECT)
@@ -365,8 +410,6 @@ CHECK_SYMBOL_EXISTS (fcntl "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_FCNTL)
CHECK_SYMBOL_EXISTS (freeaddrinfo "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_FREEADDRINFO)
CHECK_SYMBOL_EXISTS (getaddrinfo "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_GETADDRINFO)
CHECK_SYMBOL_EXISTS (getenv "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_GETENV)
-CHECK_SYMBOL_EXISTS (gethostbyaddr "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_GETHOSTBYADDR)
-CHECK_SYMBOL_EXISTS (gethostbyname "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_GETHOSTBYNAME)
CHECK_SYMBOL_EXISTS (gethostname "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_GETHOSTNAME)
CHECK_SYMBOL_EXISTS (getnameinfo "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_GETNAMEINFO)
CHECK_SYMBOL_EXISTS (getrandom "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_GETRANDOM)
@@ -374,6 +417,9 @@ CHECK_SYMBOL_EXISTS (getservbyport_r "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_GETSERV
CHECK_SYMBOL_EXISTS (getservbyname_r "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_GETSERVBYNAME_R)
CHECK_SYMBOL_EXISTS (gettimeofday "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_GETTIMEOFDAY)
CHECK_SYMBOL_EXISTS (if_indextoname "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_IF_INDEXTONAME)
+CHECK_SYMBOL_EXISTS (if_nametoindex "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_IF_NAMETOINDEX)
+CHECK_SYMBOL_EXISTS (ConvertInterfaceIndexToLuid "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_CONVERTINTERFACEINDEXTOLUID)
+CHECK_SYMBOL_EXISTS (ConvertInterfaceLuidToNameA "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_CONVERTINTERFACELUIDTONAMEA)
CHECK_SYMBOL_EXISTS (inet_net_pton "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_INET_NET_PTON)
IF (NOT WIN32)
# Disabled on Windows, because these functions are only really supported on Windows
@@ -399,6 +445,13 @@ CHECK_SYMBOL_EXISTS (strncmpi "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_STRNCMP
CHECK_SYMBOL_EXISTS (strnicmp "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_STRNICMP)
CHECK_SYMBOL_EXISTS (writev "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_WRITEV)
CHECK_SYMBOL_EXISTS (arc4random_buf "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_ARC4RANDOM_BUF)
+CHECK_SYMBOL_EXISTS (stat "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_STAT)
+CHECK_SYMBOL_EXISTS (getifaddrs "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_GETIFADDRS)
+CHECK_SYMBOL_EXISTS (poll "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_POLL)
+CHECK_SYMBOL_EXISTS (pipe "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_PIPE)
+CHECK_SYMBOL_EXISTS (pipe2 "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_PIPE2)
+CHECK_SYMBOL_EXISTS (kqueue "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_KQUEUE)
+CHECK_SYMBOL_EXISTS (epoll_create1 "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_EPOLL)
# On Android, the system headers may define __system_property_get(), but excluded
@@ -411,6 +464,43 @@ SET (CMAKE_REQUIRED_DEFINITIONS)
SET (CMAKE_REQUIRED_LIBRARIES)
+################################################################################
+# Threading Support
+#
+IF (CARES_THREADS)
+ IF (WIN32)
+ # Do nothing, always has threads
+ ELSE ()
+ # Need to prefer pthreads on platforms that may have more threading choices
+ # (e.g. Solaris)
+ SET (CMAKE_THREAD_PREFER_PTHREAD TRUE)
+ FIND_PACKAGE (Threads)
+
+ IF (Threads_FOUND)
+ # Fix solaris9 bug due to libc having pthread_create() stubs that always fail. CMake
+ # doesn't realize that the real pthread functions aren't in libc, so sets the pthread
+ # library CAKE_THREAD_LIBS_INIT variable to blank instead of to the correct "-lpthread".
+ IF (CMAKE_SYSTEM_NAME STREQUAL "SunOS" AND NOT CMAKE_THREAD_LIBS_INIT)
+ SET (CMAKE_THREAD_LIBS_INIT "-lpthread")
+ ENDIF ()
+
+ # PThread functions.
+ CHECK_INCLUDE_FILES (pthread.h HAVE_PTHREAD_H)
+ CHECK_INCLUDE_FILES (pthread_np.h HAVE_PTHREAD_NP_H)
+ CARES_EXTRAINCLUDE_IFSET (HAVE_PTHREAD_H pthread.h)
+ CARES_EXTRAINCLUDE_IFSET (HAVE_PTHREAD_NP_H pthread_np.h)
+ CHECK_SYMBOL_EXISTS (pthread_init "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_PTHREAD_INIT)
+ # Make sure libcares.pc.cmake knows about thread libraries on static builds
+ LIST (APPEND CARES_DEPENDENT_LIBS ${CMAKE_THREAD_LIBS_INIT})
+ ELSE ()
+ MESSAGE (WARNING "Threading support not found, disabling...")
+ SET (CARES_THREADS OFF)
+ ENDIF ()
+ ENDIF ()
+ENDIF ()
+
+
+
################################################################################
# recv, recvfrom, send, getnameinfo, gethostname
# ARGUMENTS AND RETURN VALUES
@@ -421,7 +511,7 @@ SET (CMAKE_REQUIRED_LIBRARIES)
# defaults. This should be much quicker and nearly as accurate ... and even
# if not, it probably won't matter in the least.
-IF (HAVE_SSIZE_T AND HAVE_SOCKLEN_T)
+IF (HAVE_SSIZE_T AND HAVE_SOCKLEN_T AND NOT WIN32)
# If we have ssize_t and socklen_t, the API is usually sane and uses ssize_t and size_t for lengths
SET (RECVFROM_TYPE_RETV ssize_t)
SET (RECVFROM_TYPE_ARG3 size_t)
@@ -567,9 +657,6 @@ ENDIF ()
IF (HAVE_SYS_TYPES_H)
SET (CARES_HAVE_SYS_TYPES_H 1)
ENDIF ()
-IF (HAVE_SYS_RANDOM_H)
- SET (CARES_HAVE_SYS_RANDOM_H 1)
-ENDIF()
IF (HAVE_SYS_SOCKET_H)
SET (CARES_HAVE_SYS_SOCKET_H 1)
ENDIF()
@@ -589,10 +676,6 @@ IF (HAVE_ARPA_NAMESER_COMPAT_H)
SET (CARES_HAVE_ARPA_NAMESER_COMPAT_H 1)
ENDIF()
-# Record toplevel CMakeLists.txt path
-set(CARES_TOPLEVEL_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
-
-
# TRANSFORM_MAKEFILE_INC
#
# This function consumes the "Makefile.inc" autotools file, and converts it into
@@ -656,7 +739,6 @@ IF (CARES_INSTALL)
# pkgconfig support
IF (NOT CARES_SHARED)
- SET (CPPFLAG_CARES_STATICLIB "-DCARES_STATICLIB")
FOREACH (LIB ${CARES_DEPENDENT_LIBS})
SET (CARES_PRIVATE_LIBS "${CARES_PRIVATE_LIBS} -l${LIB}")
ENDFOREACH ()
diff --git a/deps/cares/INSTALL.md b/deps/cares/INSTALL.md
index 9b2f847be8cbe2..de766aad283d1b 100644
--- a/deps/cares/INSTALL.md
+++ b/deps/cares/INSTALL.md
@@ -32,7 +32,7 @@ the same for both Git and official release tarballs.
AutoTools Build
===============
-### General Information, works on most Unix Platforms (Linux, FreeBSD, etc)
+### General Information, works on most Unix Platforms (Linux, FreeBSD, etc.)
A normal Unix installation is made in three or four steps (after you've
unpacked the source archive):
@@ -57,7 +57,7 @@ you need to specify that already when running configure:
If you happen to have write permission in that directory, you can do `make
install` without being root. An example of this would be to make a local
-install in your own home directory:
+installation in your own home directory:
./configure --prefix=$HOME
make
@@ -183,7 +183,7 @@ Method using a configure cross-compile (tested with Android NDK r7b):
./tools/make-standalone-toolchain.sh
- which creates a usual cross-compile toolchain. Lets assume that you put
+ which creates a usual cross-compile toolchain. Let's assume that you put
this toolchain below `/opt` then invoke configure with something
like:
@@ -213,7 +213,7 @@ CMake builds
============
Current releases of c-ares introduce a CMake v3+ build system that has been
-tested on most platforms including Windows, Linux, FreeBSD, MacOS, AIX and
+tested on most platforms including Windows, Linux, FreeBSD, macOS, AIX and
Solaris.
In the most basic form, building with CMake might look like:
@@ -233,18 +233,23 @@ Options
Options to CMake are passed on the command line using "-D${OPTION}=${VALUE}".
The values defined are all boolean and take values like On, Off, True, False.
-* CARES_STATIC - Build the static library (off by default)
-* CARES_SHARED - Build the shared library (on by default)
-* CARES_INSTALL - Hook in installation, useful to disable if chain building
-* CARES_STATIC_PIC - Build the static library as position-independent (off by
- default)
-
+| Option Name | Description | Default Value |
+|-----------------------------|-----------------------------------------------------------------------|----------------|
+| CARES_STATIC | Build the static library | Off |
+| CARES_SHARED | Build the shared library | On |
+| CARES_INSTALL | Hook in installation, useful to disable if chain building | On |
+| CARES_STATIC_PIC | Build the static library as position-independent | Off |
+| CARES_BUILD_TESTS | Build and run tests | Off |
+| CARES_BUILD_CONTAINER_TESTS | Build and run container tests (implies CARES_BUILD_TESTS, Linux only) | Off |
+| CARES_BUILD_TOOLS | Build tools | On |
+| CARES_SYMBOL_HIDING | Hide private symbols in shared libraries | Off |
+| CARES_THREADS | Build with thread-safety support | On |
Ninja
-----
Ninja is the next-generation build system meant for generators like CMake that
-heavily parallize builds. Its use is very similar to the normal build:
+heavily parallelize builds. Its use is very similar to the normal build:
```sh
cd /path/to/cmake/source
diff --git a/deps/cares/Makefile.Watcom b/deps/cares/Makefile.Watcom
index 6ea10e532bc4a4..0cbae5c53c3255 100644
--- a/deps/cares/Makefile.Watcom
+++ b/deps/cares/Makefile.Watcom
@@ -41,9 +41,9 @@ MD = mkdir
RD = rmdir /q /s 2>NUL
CP = copy
-CFLAGS = -3r -mf -hc -zff -zgf -zq -zm -zc -s -fr=con -w2 -fpi -oilrtfm -aa &
- -wcd=201 -bt=nt -d+ -dWIN32 -dCARES_BUILDING_LIBRARY &
- -dNTDDI_VERSION=0x06000000 -I. -I.\include -I.\src\lib $(SYS_INCL)
+CFLAGS = -3r -mf -hc -zff -zgf -zq -zm -zc -s -fr=con -w2 -fpi -oilrtfm -aa &
+ -wcd=201 -bt=nt -d+ -dWIN32 -dCARES_BUILDING_LIBRARY &
+ -dNTDDI_VERSION=0x06020000 -I. -I.\include -I.\src\lib $(SYS_INCL)
LFLAGS = option quiet, map, caseexact, eliminate
@@ -55,7 +55,7 @@ LFLAGS += debug all
CFLAGS += -d0
!endif
-CFLAGS += -d_WIN32_WINNT=0x0600
+CFLAGS += -d_WIN32_WINNT=0x0602
#
# Change to suite.
diff --git a/deps/cares/Makefile.am b/deps/cares/Makefile.am
index cc22ac13b31b96..a545f8e374f7c0 100644
--- a/deps/cares/Makefile.am
+++ b/deps/cares/Makefile.am
@@ -26,12 +26,12 @@ MSVCFILES = msvc_ver.inc buildconf.bat
# adig and ahost are just sample programs and thus not mentioned with the
# regular sources and headers
-EXTRA_DIST = AUTHORS CHANGES README.cares $(man_MANS) RELEASE-NOTES \
+EXTRA_DIST = AUTHORS CHANGES README.cares $(man_MANS) RELEASE-NOTES.md \
c-ares-config.cmake.in libcares.pc.cmake libcares.pc.in buildconf get_ver.awk \
maketgz TODO README.msvc $(MSVCFILES) INSTALL.md README.md LICENSE.md \
CMakeLists.txt Makefile.dj Makefile.m32 Makefile.netware Makefile.msvc \
- Makefile.Watcom AUTHORS CONTRIBUTING.md SECURITY.md TODO
-
+ Makefile.Watcom AUTHORS CONTRIBUTING.md SECURITY.md TODO \
+ cmake/EnableWarnings.cmake
CLEANFILES = $(PDFPAGES) $(HTMLPAGES)
diff --git a/deps/cares/Makefile.in b/deps/cares/Makefile.in
index 271369e15a67cd..d1c663d5488366 100644
--- a/deps/cares/Makefile.in
+++ b/deps/cares/Makefile.in
@@ -115,25 +115,24 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_ac_append_to_file.m4 \
$(top_srcdir)/m4/ax_ac_print_to_file.m4 \
$(top_srcdir)/m4/ax_add_am_macro_static.m4 \
$(top_srcdir)/m4/ax_am_macros_static.m4 \
+ $(top_srcdir)/m4/ax_append_compile_flags.m4 \
+ $(top_srcdir)/m4/ax_append_flag.m4 \
+ $(top_srcdir)/m4/ax_append_link_flags.m4 \
+ $(top_srcdir)/m4/ax_check_compile_flag.m4 \
$(top_srcdir)/m4/ax_check_gnu_make.m4 \
+ $(top_srcdir)/m4/ax_check_link_flag.m4 \
+ $(top_srcdir)/m4/ax_check_user_namespace.m4 \
+ $(top_srcdir)/m4/ax_check_uts_namespace.m4 \
$(top_srcdir)/m4/ax_code_coverage.m4 \
+ $(top_srcdir)/m4/ax_compiler_vendor.m4 \
$(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \
- $(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \
+ $(top_srcdir)/m4/ax_cxx_compile_stdcxx_14.m4 \
$(top_srcdir)/m4/ax_file_escapes.m4 \
+ $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/ax_require_defined.m4 \
- $(top_srcdir)/m4/cares-compilers.m4 \
- $(top_srcdir)/m4/cares-confopts.m4 \
- $(top_srcdir)/m4/cares-functions.m4 \
- $(top_srcdir)/m4/cares-reentrant.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
- $(top_srcdir)/m4/lt~obsolete.m4 \
- $(top_srcdir)/m4/xc-am-iface.m4 \
- $(top_srcdir)/m4/xc-cc-check.m4 \
- $(top_srcdir)/m4/xc-lt-iface.m4 \
- $(top_srcdir)/m4/xc-translit.m4 \
- $(top_srcdir)/m4/xc-val-flgs.m4 \
- $(top_srcdir)/m4/zz40-xc-ovr.m4 $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
@@ -228,8 +227,14 @@ am__define_uniq_tagged_files = \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | $(am__uniquify_input)`
am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/libcares.pc.in \
- AUTHORS INSTALL.md NEWS README.md TODO compile config.guess \
- config.sub depcomp install-sh ltmain.sh missing
+ $(top_srcdir)/config/compile $(top_srcdir)/config/config.guess \
+ $(top_srcdir)/config/config.sub \
+ $(top_srcdir)/config/install-sh $(top_srcdir)/config/ltmain.sh \
+ $(top_srcdir)/config/missing AUTHORS INSTALL.md NEWS README.md \
+ TODO compile config.guess config.sub config/compile \
+ config/config.guess config/config.sub config/install-sh \
+ config/ltmain.sh config/missing depcomp install-sh ltmain.sh \
+ missing
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
@@ -276,6 +281,8 @@ am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
distcleancheck_listfiles = find . -type f -print
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
+AM_CFLAGS = @AM_CFLAGS@
+AM_CPPFLAGS = @AM_CPPFLAGS@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AS = @AS@
@@ -284,14 +291,13 @@ AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BUILD_SUBDIRS = @BUILD_SUBDIRS@
-CARES_CFLAG_EXTRAS = @CARES_CFLAG_EXTRAS@
CARES_PRIVATE_LIBS = @CARES_PRIVATE_LIBS@
CARES_RANDOM_FILE = @CARES_RANDOM_FILE@
+CARES_SYMBOL_HIDING_CFLAG = @CARES_SYMBOL_HIDING_CFLAG@
CARES_VERSION_INFO = @CARES_VERSION_INFO@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
-CFLAG_CARES_SYMBOL_HIDING = @CFLAG_CARES_SYMBOL_HIDING@
CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@
CODE_COVERAGE_CPPFLAGS = @CODE_COVERAGE_CPPFLAGS@
CODE_COVERAGE_CXXFLAGS = @CODE_COVERAGE_CXXFLAGS@
@@ -299,7 +305,6 @@ CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@
CODE_COVERAGE_LIBS = @CODE_COVERAGE_LIBS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
-CPPFLAG_CARES_STATICLIB = @CPPFLAG_CARES_STATICLIB@
CSCOPE = @CSCOPE@
CTAGS = @CTAGS@
CXX = @CXX@
@@ -322,8 +327,10 @@ FGREP = @FGREP@
FILECMD = @FILECMD@
GCOV = @GCOV@
GENHTML = @GENHTML@
+GMOCK_CFLAGS = @GMOCK_CFLAGS@
+GMOCK_LIBS = @GMOCK_LIBS@
GREP = @GREP@
-HAVE_CXX11 = @HAVE_CXX11@
+HAVE_CXX14 = @HAVE_CXX14@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -357,6 +364,13 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_CXX = @PTHREAD_CXX@
+PTHREAD_LIBS = @PTHREAD_LIBS@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
@@ -376,6 +390,7 @@ am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
@@ -414,7 +429,6 @@ runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
-subdirs = @subdirs@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
@@ -426,11 +440,12 @@ MSVCFILES = msvc_ver.inc buildconf.bat
# adig and ahost are just sample programs and thus not mentioned with the
# regular sources and headers
-EXTRA_DIST = AUTHORS CHANGES README.cares $(man_MANS) RELEASE-NOTES \
+EXTRA_DIST = AUTHORS CHANGES README.cares $(man_MANS) RELEASE-NOTES.md \
c-ares-config.cmake.in libcares.pc.cmake libcares.pc.in buildconf get_ver.awk \
maketgz TODO README.msvc $(MSVCFILES) INSTALL.md README.md LICENSE.md \
CMakeLists.txt Makefile.dj Makefile.m32 Makefile.netware Makefile.msvc \
- Makefile.Watcom AUTHORS CONTRIBUTING.md SECURITY.md TODO
+ Makefile.Watcom AUTHORS CONTRIBUTING.md SECURITY.md TODO \
+ cmake/EnableWarnings.cmake
CLEANFILES = $(PDFPAGES) $(HTMLPAGES)
DISTCLEANFILES = include/ares_build.h
diff --git a/deps/cares/Makefile.m32 b/deps/cares/Makefile.m32
index e51e64b3f938ae..a01fe235d1311c 100644
--- a/deps/cares/Makefile.m32
+++ b/deps/cares/Makefile.m32
@@ -19,7 +19,7 @@ RANLIB = $(CROSSPREFIX)ranlib
#RM = rm -f
CP = cp -afv
-CFLAGS = $(CARES_CFLAG_EXTRAS) -O2 -Wall -I./include -I./src/lib -D_WIN32_WINNT=0x0600
+CFLAGS = $(CARES_CFLAG_EXTRAS) -O2 -Wall -I./include -I./src/lib -D_WIN32_WINNT=0x0602
CFLAGS += -DCARES_STATICLIB
LDFLAGS = $(CARES_LDFLAG_EXTRAS) -s
LIBS = -lws2_32 -liphlpapi
@@ -63,6 +63,7 @@ install:
chmod u-w ${DESTDIR}${libdir}/$(LIB)
${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 \
diff --git a/deps/cares/Makefile.msvc b/deps/cares/Makefile.msvc
index 17daa0c8c0cad6..c89454ec155d94 100644
--- a/deps/cares/Makefile.msvc
+++ b/deps/cares/Makefile.msvc
@@ -180,7 +180,7 @@ CFLAGS = /UWIN32 /DWATT32 /I$(WATT_ROOT)\inc
EX_LIBS_REL = $(WATT_ROOT)\lib\wattcpvc_imp.lib
EX_LIBS_DBG = $(WATT_ROOT)\lib\wattcpvc_imp_d.lib
!ELSE
-CFLAGS = /DWIN32 /D_WIN32_WINNT=0x0600
+CFLAGS = /DWIN32 /D_WIN32_WINNT=0x0602
EX_LIBS_REL = ws2_32.lib advapi32.lib kernel32.lib iphlpapi.lib
EX_LIBS_DBG = ws2_32.lib advapi32.lib kernel32.lib iphlpapi.lib
!ENDIF
@@ -437,6 +437,7 @@ install:
@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)
!ENDIF
diff --git a/deps/cares/Makefile.netware b/deps/cares/Makefile.netware
index 790b17a8e0196a..5ebbc76207dcfd 100644
--- a/deps/cares/Makefile.netware
+++ b/deps/cares/Makefile.netware
@@ -92,7 +92,7 @@ ifeq ($(LIBARCH),LIBC)
CFLAGS += -align 4
else
# PRELUDE = $(SDK_CLIB)/imports/clibpre.o
- # to avoid the __init_* / __deinit_* whoes dont use prelude from NDK
+ # to avoid the __init_* / __deinit_* whose dont use prelude from NDK
PRELUDE = "$(MWCW_PATH)/libraries/runtime/prelude.obj"
# CFLAGS += -include "$(MWCW_PATH)/headers/nlm_clib_prefix.h"
CFLAGS += -align 1
@@ -114,7 +114,7 @@ ifeq ($(LIBARCH),LIBC)
PRELUDE = $(SDK_LIBC)/imports/libcpre.gcc.o
else
# PRELUDE = $(SDK_CLIB)/imports/clibpre.gcc.o
- # to avoid the __init_* / __deinit_* whoes dont use prelude from NDK
+ # to avoid the __init_* / __deinit_* whose dont use prelude from NDK
# http://www.gknw.net/development/mk_nlm/gcc_pre.zip
PRELUDE = $(NDK_ROOT)/pre/prelude.o
CFLAGS += -include $(NDKBASE)/nlmconv/genlm.h
diff --git a/deps/cares/README.md b/deps/cares/README.md
index 40d3c08114eaaa..70aa67fce6997c 100644
--- a/deps/cares/README.md
+++ b/deps/cares/README.md
@@ -1,11 +1,12 @@
-c-ares
-======
+# [![c-ares logo](https://c-ares.org/art/c-ares-logo.svg)](https://c-ares.org/)
-[![Build Status](https://api.cirrus-ci.com/github/c-ares/c-ares.svg)](https://cirrus-ci.com/github/c-ares/c-ares)
+[![Build Status](https://api.cirrus-ci.com/github/c-ares/c-ares.svg?branch=main)](https://cirrus-ci.com/github/c-ares/c-ares)
[![Windows Build Status](https://ci.appveyor.com/api/projects/status/aevgc5914tm72pvs/branch/master?svg=true)](https://ci.appveyor.com/project/c-ares/c-ares/branch/master)
[![Coverage Status](https://coveralls.io/repos/github/c-ares/c-ares/badge.svg)](https://coveralls.io/github/c-ares/c-ares)
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/291/badge)](https://bestpractices.coreinfrastructure.org/projects/291)
[![Fuzzing Status](https://oss-fuzz-build-logs.storage.googleapis.com/badges/c-ares.svg)](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:c-ares)
+[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=c-ares_c-ares&metric=bugs)](https://sonarcloud.io/summary/new_code?id=c-ares_c-ares)
+[![Coverity Scan Status](https://scan.coverity.com/projects/c-ares/badge.svg)](https://scan.coverity.com/projects/c-ares)
This is c-ares, an asynchronous resolver library. It is intended for
applications which need to perform DNS queries without blocking, or need to
@@ -21,14 +22,13 @@ If you find bugs, correct flaws, have questions or have comments in general in
regard to c-ares (or by all means the original ares too), get in touch with us
on the c-ares mailing list: https://lists.haxx.se/listinfo/c-ares
-c-ares is distributed the MIT license.
+c-ares is distributed under the MIT license.
You'll find all c-ares details and news here:
https://c-ares.org/
-Notes for c-ares hackers
-------------------------
+## Notes for c-ares hackers
* The distributed `ares_build.h` file is only intended to be used on systems
which can not run the also distributed configure script.
@@ -47,7 +47,7 @@ Notes for c-ares hackers
* If you intend to distribute an already compiled c-ares library you **MUST**
also distribute along with it the generated `ares_build.h` which has been
- used to compile it. Otherwise the library will be of no use for the users of
+ used to compile it. Otherwise, the library will be of no use for the users of
the library that you have built. It is **your** responsibility to provide this
file. No one at the c-ares project can know how you have built the library.
diff --git a/deps/cares/RELEASE-NOTES b/deps/cares/RELEASE-NOTES
deleted file mode 100644
index 169a39fcb33b4e..00000000000000
--- a/deps/cares/RELEASE-NOTES
+++ /dev/null
@@ -1,74 +0,0 @@
-c-ares version 1.20.1
-
-This release resolves a significant issue in the 1.20.0 release.
-
-Bug fixes:
- o Resolve use-after-free issue when TCP connection is terminated before a
- response is returned [17]
- o Reduce number of queries for a load test case to prevent overloading some
- build systems
- o Fix fuzz test build target [18]
-
-
-c-ares 1.20.0 notes below:
-
-This is a feature and bugfix release with some significant internal changes.
-
-Changes:
- o Update from 1989 MIT license text to modern MIT license text [1]
- o Remove acountry from built tools as nerd.dk is gone [3]
- o Add new ARES_OPT_UDP_MAX_QUERIES configuration option to limit the number of
- queries that can be made from a single ephemeral port [7]
- o Default per-query timeout has been reduced to 2s with a 3x retry count [8]
- o Modernization: start implementing some common data structures that are easy
- to use and hard to misuse. This will make code refactoring easier and remove
- some varied implementations in use. This change also makes ares_timeout()
- more efficient [9]
- o Use SPDX identifiers and a REUSE CI job to verify [12]
- o rand: add support for getrandom() [14]
-
-Bug fixes:
- o TCP back to back queries were broken [2]
- o Ensure queries for ares_getaddrinfo() are not requeued during destruction [4]
- o ares_getaddrinfo() should not retry other address classes if one address
- class has already been returned [5]
- o Avoid production ill-formed result when qualifying a name with the root
- domain [6]
- o Fix missing prefix for CMake generated libcares.pc [10]
- o DNS server ports will now be read from system configuration instead of
- defaulting to port 53 [11]
- o Remove some unreachable code [13]
- o Replace usages of sprintf with snprintf [15]
- o Fix Watcom instructions and update Windows URLs [16]
-
-Thanks go to these friendly people for their efforts and contributions:
- Alexey A Tikhonov (@alexey-tikhonov)
- Ben Noordhuis (@bnoordhuis)
- Brad House (@bradh352)
- @Chilledheart
- Daniel Stenberg (@bagder)
- Douglas R. Reno (@renodr)
- Jérôme Duval (@korli)
- Sam Morris (@yrro)
- Tim Wojtulewicz (@timwoj)
-(9 contributors)
-
-References to bug reports and discussions on issues:
- [1] = https://github.com/c-ares/c-ares/pull/556
- [2] = https://github.com/c-ares/c-ares/pull/552
- [3] = https://github.com/c-ares/c-ares/pull/554
- [4] = https://github.com/c-ares/c-ares/pull/553
- [5] = https://github.com/c-ares/c-ares/pull/551
- [6] = https://github.com/c-ares/c-ares/pull/546
- [7] = https://github.com/c-ares/c-ares/pull/549
- [8] = https://github.com/c-ares/c-ares/pull/542
- [9] = https://github.com/c-ares/c-ares/pull/540
- [10] = https://github.com/c-ares/c-ares/pull/530
- [11] = https://github.com/c-ares/c-ares/pull/534
- [12] = https://github.com/c-ares/c-ares/commit/c1b00c41
- [13] = https://github.com/c-ares/c-ares/pull/527
- [14] = https://github.com/c-ares/c-ares/pull/526
- [15] = https://github.com/c-ares/c-ares/pull/525
- [16] = https://github.com/c-ares/c-ares/pull/524
- [17] = https://github.com/c-ares/c-ares/pull/562
- [18] = https://github.com/c-ares/c-ares/pull/559
diff --git a/deps/cares/RELEASE-NOTES.md b/deps/cares/RELEASE-NOTES.md
new file mode 100644
index 00000000000000..0fdcbc6b968488
--- /dev/null
+++ b/deps/cares/RELEASE-NOTES.md
@@ -0,0 +1,40 @@
+## c-ares version 1.27.0 - Feb 23 2024
+
+This is a security, feature, and bugfix release.
+
+Security:
+
+* Moderate. CVE-2024-25629. Reading malformatted `/etc/resolv.conf`,
+ `/etc/nsswitch.conf` or the `HOSTALIASES` file could result in a crash.
+ [GHSA-mg26-v6qh-x48q](https://github.com/c-ares/c-ares/security/advisories/GHSA-mg26-v6qh-x48q)
+
+Features:
+
+* New function `ares_queue_active_queries()` to retrieve number of in-flight
+ queries. [PR #712](https://github.com/c-ares/c-ares/pull/712)
+* New function `ares_queue_wait_empty()` to wait for the number of in-flight
+ queries to reach zero. [PR #710](https://github.com/c-ares/c-ares/pull/710)
+* New `ARES_FLAG_NO_DEFLT_SVR` for `ares_init_options()` to return a failure if
+ no DNS servers can be found rather than attempting to use `127.0.0.1`. This
+ also introduces a new ares status code of `ARES_ENOSERVER`. [PR #713](https://github.com/c-ares/c-ares/pull/713)
+
+Changes:
+
+* EDNS Packet size should be 1232 as per DNS Flag Day. [PR #705](https://github.com/c-ares/c-ares/pull/705)
+
+Bugfixes:
+
+* Windows DNS suffix search list memory leak. [PR #711](https://github.com/c-ares/c-ares/pull/711)
+* Fix warning due to ignoring return code of `write()`. [PR #709](https://github.com/c-ares/c-ares/pull/709)
+* CMake: don't override target output locations if not top-level. [Issue #708](https://github.com/c-ares/c-ares/issues/708)
+* Fix building c-ares without thread support. [PR #700](https://github.com/c-ares/c-ares/pull/700)
+
+Thanks go to these friendly people for their efforts and contributions for this release:
+
+* Anthony Alayo (@anthonyalayo)
+* Brad House (@bradh352)
+* Cheng Zhao (@zcbenz)
+* Cristian Rodríguez (@crrodriguez)
+* Daniel Stenberg (@bagder)
+* Oliver Welsh (@oliverwelsh)
+* Vojtěch Vobr (@vojtechvobr)
diff --git a/deps/cares/TODO b/deps/cares/TODO
index fa31cea6fb79b4..3b200926e352de 100644
--- a/deps/cares/TODO
+++ b/deps/cares/TODO
@@ -1,23 +1,4 @@
TODO
====
-ares_reinit()
-
-- To allow an app to force a re-read of /etc/resolv.conf etc, pretty much
- like the res_init() resolver function offers
-
-ares_gethostbyname
-
-- When built to support IPv6, it needs to also support PF_UNSPEC or similar,
- so that an application can ask for any protocol and then c-ares would return
- all known resolves and not just explicitly IPv4 _or_ IPv6 resolves.
-
-ares_process
-
-- Upon next ABI breakage ares_process() should be changed to return 'int'
- and return ARES_ENOTINITIALIZED if ares_library_init() has not been called.
-
-ares_process_fd
-
-- Upon next ABI breakage ares_process_fd() should be changed to return
- 'int' and return ARES_ENOTINITIALIZED if library has not been initialized.
+Please see https://github.com/c-ares/c-ares/issues
diff --git a/deps/cares/acinclude.m4 b/deps/cares/acinclude.m4
deleted file mode 100644
index 2644cdfa34b41e..00000000000000
--- a/deps/cares/acinclude.m4
+++ /dev/null
@@ -1,1916 +0,0 @@
-# Copyright (C) The c-ares project and its contributors
-# SPDX-License-Identifier: MIT
-
-dnl CURL_CHECK_DEF (SYMBOL, [INCLUDES], [SILENT])
-dnl -------------------------------------------------
-dnl Use the C preprocessor to find out if the given object-style symbol
-dnl is defined and get its expansion. This macro will not use default
-dnl includes even if no INCLUDES argument is given. This macro will run
-dnl silently when invoked with three arguments. If the expansion would
-dnl result in a set of double-quoted strings the returned expansion will
-dnl actually be a single double-quoted string concatenating all them.
-
-AC_DEFUN([CURL_CHECK_DEF], [
- AS_VAR_PUSHDEF([ac_HaveDef], [curl_cv_have_def_$1])dnl
- AS_VAR_PUSHDEF([ac_Def], [curl_cv_def_$1])dnl
- if test -z "$SED"; then
- AC_MSG_ERROR([SED not set. Cannot continue without SED being set.])
- fi
- if test -z "$GREP"; then
- AC_MSG_ERROR([GREP not set. Cannot continue without GREP being set.])
- fi
- ifelse($3,,[AC_MSG_CHECKING([for preprocessor definition of $1])])
- tmp_exp=""
- AC_PREPROC_IFELSE([
- AC_LANG_SOURCE(
-ifelse($2,,,[$2])[[
-#ifdef $1
-CURL_DEF_TOKEN $1
-#endif
- ]])
- ],[
- tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \
- "$GREP" CURL_DEF_TOKEN 2>/dev/null | \
- "$SED" 's/.*CURL_DEF_TOKEN[[ ]][[ ]]*//' 2>/dev/null | \
- "$SED" 's/[["]][[ ]]*[["]]//g' 2>/dev/null`
- if test -z "$tmp_exp" || test "$tmp_exp" = "$1"; then
- tmp_exp=""
- fi
- ])
- if test -z "$tmp_exp"; then
- AS_VAR_SET(ac_HaveDef, no)
- ifelse($3,,[AC_MSG_RESULT([no])])
- else
- AS_VAR_SET(ac_HaveDef, yes)
- AS_VAR_SET(ac_Def, $tmp_exp)
- ifelse($3,,[AC_MSG_RESULT([$tmp_exp])])
- fi
- AS_VAR_POPDEF([ac_Def])dnl
- AS_VAR_POPDEF([ac_HaveDef])dnl
-])
-
-
-dnl CURL_CHECK_DEF_CC (SYMBOL, [INCLUDES], [SILENT])
-dnl -------------------------------------------------
-dnl Use the C compiler to find out only if the given symbol is defined
-dnl or not, this can not find out its expansion. This macro will not use
-dnl default includes even if no INCLUDES argument is given. This macro
-dnl will run silently when invoked with three arguments.
-
-AC_DEFUN([CURL_CHECK_DEF_CC], [
- AS_VAR_PUSHDEF([ac_HaveDef], [curl_cv_have_def_$1])dnl
- ifelse($3,,[AC_MSG_CHECKING([for compiler definition of $1])])
- AC_COMPILE_IFELSE([
- AC_LANG_SOURCE(
-ifelse($2,,,[$2])[[
-int main (void)
-{
-#ifdef $1
- return 0;
-#else
- force compilation error
-#endif
-}
- ]])
- ],[
- tst_symbol_defined="yes"
- ],[
- tst_symbol_defined="no"
- ])
- if test "$tst_symbol_defined" = "yes"; then
- AS_VAR_SET(ac_HaveDef, yes)
- ifelse($3,,[AC_MSG_RESULT([yes])])
- else
- AS_VAR_SET(ac_HaveDef, no)
- ifelse($3,,[AC_MSG_RESULT([no])])
- fi
- AS_VAR_POPDEF([ac_HaveDef])dnl
-])
-
-
-dnl CARES_CHECK_LIB_XNET
-dnl -------------------------------------------------
-dnl Verify if X/Open network library is required.
-
-AC_DEFUN([CARES_CHECK_LIB_XNET], [
- AC_MSG_CHECKING([if X/Open network library is required])
- tst_lib_xnet_required="no"
- AC_COMPILE_IFELSE([
- AC_LANG_SOURCE([[
-int main (void)
-{
-#if defined(__hpux) && defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 600)
- return 0;
-#elif defined(__hpux) && defined(_XOPEN_SOURCE_EXTENDED)
- return 0;
-#else
- force compilation error
-#endif
-}
- ]])
- ],[
- tst_lib_xnet_required="yes"
- LIBS="$LIBS -lxnet"
- ])
- AC_MSG_RESULT([$tst_lib_xnet_required])
-])
-
-
-dnl CARES_CHECK_AIX_ALL_SOURCE
-dnl -------------------------------------------------
-dnl Provides a replacement of traditional AC_AIX with
-dnl an uniform behaviour across all autoconf versions,
-dnl and with our own placement rules.
-
-AC_DEFUN([CARES_CHECK_AIX_ALL_SOURCE], [
- AH_VERBATIM([_ALL_SOURCE],
- [/* Define to 1 if OS is AIX. */
-#ifndef _ALL_SOURCE
-# undef _ALL_SOURCE
-#endif])
- AC_BEFORE([$0], [AC_SYS_LARGEFILE])dnl
- AC_BEFORE([$0], [CARES_CONFIGURE_REENTRANT])dnl
- AC_MSG_CHECKING([if OS is AIX (to define _ALL_SOURCE)])
- AC_EGREP_CPP([yes_this_is_aix],[
-#ifdef _AIX
- yes_this_is_aix
-#endif
- ],[
- AC_MSG_RESULT([yes])
- AC_DEFINE(_ALL_SOURCE)
- ],[
- AC_MSG_RESULT([no])
- ])
-])
-
-
-dnl CURL_CHECK_HEADER_WINDOWS
-dnl -------------------------------------------------
-dnl Check for compilable and valid windows.h header
-
-AC_DEFUN([CURL_CHECK_HEADER_WINDOWS], [
- AC_CACHE_CHECK([for windows.h], [ac_cv_header_windows_h], [
- AC_COMPILE_IFELSE([
- AC_LANG_PROGRAM([[
-#undef inline
-#ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN
-#endif
-#include
- ]],[[
-#if defined(__CYGWIN__) || defined(__CEGCC__)
- HAVE_WINDOWS_H shall not be defined.
-#else
- int dummy=2*WINVER;
-#endif
- ]])
- ],[
- ac_cv_header_windows_h="yes"
- ],[
- ac_cv_header_windows_h="no"
- ])
- ])
- case "$ac_cv_header_windows_h" in
- yes)
- AC_DEFINE_UNQUOTED(HAVE_WINDOWS_H, 1,
- [Define to 1 if you have the windows.h header file.])
- AC_DEFINE_UNQUOTED(WIN32_LEAN_AND_MEAN, 1,
- [Define to avoid automatic inclusion of winsock.h])
- ;;
- esac
-])
-
-
-dnl CURL_CHECK_NATIVE_WINDOWS
-dnl -------------------------------------------------
-dnl Check if building a native Windows target
-
-AC_DEFUN([CURL_CHECK_NATIVE_WINDOWS], [
- AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
- AC_CACHE_CHECK([whether build target is a native Windows one], [ac_cv_native_windows], [
- if test "$ac_cv_header_windows_h" = "no"; then
- ac_cv_native_windows="no"
- else
- AC_COMPILE_IFELSE([
- AC_LANG_PROGRAM([[
- ]],[[
-#if defined(__MINGW32__) || defined(__MINGW32CE__) || \
- (defined(_MSC_VER) && (defined(_WIN32) || defined(_WIN64)))
- int dummy=1;
-#else
- Not a native Windows build target.
-#endif
- ]])
- ],[
- ac_cv_native_windows="yes"
- ],[
- ac_cv_native_windows="no"
- ])
- fi
- ])
- AM_CONDITIONAL(DOING_NATIVE_WINDOWS, test "x$ac_cv_native_windows" = xyes)
-])
-
-
-dnl CURL_CHECK_HEADER_WINSOCK
-dnl -------------------------------------------------
-dnl Check for compilable and valid winsock.h header
-
-AC_DEFUN([CURL_CHECK_HEADER_WINSOCK], [
- AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
- AC_CACHE_CHECK([for winsock.h], [ac_cv_header_winsock_h], [
- AC_COMPILE_IFELSE([
- AC_LANG_PROGRAM([[
-#undef inline
-#ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN
-#endif
-#include
-#include
- ]],[[
-#if defined(__CYGWIN__) || defined(__CEGCC__)
- HAVE_WINSOCK_H shall not be defined.
-#else
- int dummy=WSACleanup();
-#endif
- ]])
- ],[
- ac_cv_header_winsock_h="yes"
- ],[
- ac_cv_header_winsock_h="no"
- ])
- ])
- case "$ac_cv_header_winsock_h" in
- yes)
- AC_DEFINE_UNQUOTED(HAVE_WINSOCK_H, 1,
- [Define to 1 if you have the winsock.h header file.])
- ;;
- esac
-])
-
-
-dnl CURL_CHECK_HEADER_WINSOCK2
-dnl -------------------------------------------------
-dnl Check for compilable and valid winsock2.h header
-
-AC_DEFUN([CURL_CHECK_HEADER_WINSOCK2], [
- AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
- AC_CACHE_CHECK([for winsock2.h], [ac_cv_header_winsock2_h], [
- AC_COMPILE_IFELSE([
- AC_LANG_PROGRAM([[
-#undef inline
-#ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN
-#endif
-#include
-#include
- ]],[[
-#if defined(__CYGWIN__) || defined(__CEGCC__) || defined(__MINGW32CE__)
- HAVE_WINSOCK2_H shall not be defined.
-#else
- int dummy=2*IPPROTO_ESP;
-#endif
- ]])
- ],[
- ac_cv_header_winsock2_h="yes"
- ],[
- ac_cv_header_winsock2_h="no"
- ])
- ])
- case "$ac_cv_header_winsock2_h" in
- yes)
- AC_DEFINE_UNQUOTED(HAVE_WINSOCK2_H, 1,
- [Define to 1 if you have the winsock2.h header file.])
- ;;
- esac
-])
-
-
-dnl CURL_CHECK_HEADER_WS2TCPIP
-dnl -------------------------------------------------
-dnl Check for compilable and valid ws2tcpip.h header
-
-AC_DEFUN([CURL_CHECK_HEADER_WS2TCPIP], [
- AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
- AC_CACHE_CHECK([for ws2tcpip.h], [ac_cv_header_ws2tcpip_h], [
- AC_COMPILE_IFELSE([
- AC_LANG_PROGRAM([[
-#undef inline
-#ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN
-#endif
-#include
-#include
-#include
- ]],[[
-#if defined(__CYGWIN__) || defined(__CEGCC__) || defined(__MINGW32CE__)
- HAVE_WS2TCPIP_H shall not be defined.
-#else
- int dummy=2*IP_PKTINFO;
-#endif
- ]])
- ],[
- ac_cv_header_ws2tcpip_h="yes"
- ],[
- ac_cv_header_ws2tcpip_h="no"
- ])
- ])
- case "$ac_cv_header_ws2tcpip_h" in
- yes)
- AC_DEFINE_UNQUOTED(HAVE_WS2TCPIP_H, 1,
- [Define to 1 if you have the ws2tcpip.h header file.])
- ;;
- esac
-])
-
-
-dnl CURL_CHECK_HEADER_MALLOC
-dnl -------------------------------------------------
-dnl Check for compilable and valid malloc.h header,
-dnl and check if it is needed even with stdlib.h
-
-AC_DEFUN([CURL_CHECK_HEADER_MALLOC], [
- AC_CACHE_CHECK([for malloc.h], [ac_cv_header_malloc_h], [
- AC_COMPILE_IFELSE([
- AC_LANG_PROGRAM([[
-#include
- ]],[[
- void *p = malloc(10);
- void *q = calloc(10,10);
- free(p);
- free(q);
- ]])
- ],[
- ac_cv_header_malloc_h="yes"
- ],[
- ac_cv_header_malloc_h="no"
- ])
- ])
- if test "$ac_cv_header_malloc_h" = "yes"; then
- AC_DEFINE_UNQUOTED(HAVE_MALLOC_H, 1,
- [Define to 1 if you have the malloc.h header file.])
- #
- AC_COMPILE_IFELSE([
- AC_LANG_PROGRAM([[
-#include
- ]],[[
- void *p = malloc(10);
- void *q = calloc(10,10);
- free(p);
- free(q);
- ]])
- ],[
- curl_cv_need_header_malloc_h="no"
- ],[
- curl_cv_need_header_malloc_h="yes"
- ])
- #
- case "$curl_cv_need_header_malloc_h" in
- yes)
- AC_DEFINE_UNQUOTED(NEED_MALLOC_H, 1,
- [Define to 1 if you need the malloc.h header file even with stdlib.h])
- ;;
- esac
- fi
-])
-
-
-dnl CURL_CHECK_HEADER_MEMORY
-dnl -------------------------------------------------
-dnl Check for compilable and valid memory.h header,
-dnl and check if it is needed even with stdlib.h for
-dnl memory related functions.
-
-AC_DEFUN([CURL_CHECK_HEADER_MEMORY], [
- AC_CACHE_CHECK([for memory.h], [ac_cv_header_memory_h], [
- AC_COMPILE_IFELSE([
- AC_LANG_PROGRAM([[
-#include
- ]],[[
- void *p = malloc(10);
- void *q = calloc(10,10);
- free(p);
- free(q);
- ]])
- ],[
- ac_cv_header_memory_h="yes"
- ],[
- ac_cv_header_memory_h="no"
- ])
- ])
- if test "$ac_cv_header_memory_h" = "yes"; then
- AC_DEFINE_UNQUOTED(HAVE_MEMORY_H, 1,
- [Define to 1 if you have the memory.h header file.])
- #
- AC_COMPILE_IFELSE([
- AC_LANG_PROGRAM([[
-#include
- ]],[[
- void *p = malloc(10);
- void *q = calloc(10,10);
- free(p);
- free(q);
- ]])
- ],[
- curl_cv_need_header_memory_h="no"
- ],[
- curl_cv_need_header_memory_h="yes"
- ])
- #
- case "$curl_cv_need_header_memory_h" in
- yes)
- AC_DEFINE_UNQUOTED(NEED_MEMORY_H, 1,
- [Define to 1 if you need the memory.h header file even with stdlib.h])
- ;;
- esac
- fi
-])
-
-
-dnl CURL_CHECK_FUNC_GETNAMEINFO
-dnl -------------------------------------------------
-dnl Test if the getnameinfo function is available,
-dnl and check the types of five of its arguments.
-dnl If the function succeeds HAVE_GETNAMEINFO will be
-dnl defined, defining the types of the arguments in
-dnl GETNAMEINFO_TYPE_ARG1, GETNAMEINFO_TYPE_ARG2,
-dnl GETNAMEINFO_TYPE_ARG46 and GETNAMEINFO_TYPE_ARG7,
-dnl and also defining the type qualifier of first
-dnl argument in GETNAMEINFO_QUAL_ARG1.
-
-AC_DEFUN([CURL_CHECK_FUNC_GETNAMEINFO], [
- AC_REQUIRE([CURL_CHECK_HEADER_WS2TCPIP])dnl
- AC_CHECK_HEADERS(sys/types.h sys/socket.h netdb.h)
- #
- AC_MSG_CHECKING([for getnameinfo])
- AC_LINK_IFELSE([
- AC_LANG_FUNC_LINK_TRY([getnameinfo])
- ],[
- AC_MSG_RESULT([yes])
- curl_cv_getnameinfo="yes"
- ],[
- AC_MSG_RESULT([no])
- curl_cv_getnameinfo="no"
- ])
- #
- if test "$curl_cv_getnameinfo" != "yes"; then
- AC_MSG_CHECKING([deeper for getnameinfo])
- AC_LINK_IFELSE([
- AC_LANG_PROGRAM([[
- ]],[[
- getnameinfo();
- ]])
- ],[
- AC_MSG_RESULT([yes])
- curl_cv_getnameinfo="yes"
- ],[
- AC_MSG_RESULT([but still no])
- curl_cv_getnameinfo="no"
- ])
- fi
- #
- if test "$curl_cv_getnameinfo" != "yes"; then
- AC_MSG_CHECKING([deeper and deeper for getnameinfo])
- AC_LINK_IFELSE([
- AC_LANG_PROGRAM([[
-#undef inline
-#ifdef HAVE_WINDOWS_H
-#ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN
-#endif
-#include
-#ifdef HAVE_WINSOCK2_H
-#include
-#ifdef HAVE_WS2TCPIP_H
-#include
-#endif
-#endif
-#else
-#ifdef HAVE_SYS_TYPES_H
-#include
-#endif
-#ifdef HAVE_SYS_SOCKET_H
-#include
-#endif
-#ifdef HAVE_NETDB_H
-#include
-#endif
-#endif
- ]],[[
- getnameinfo(0, 0, 0, 0, 0, 0, 0);
- ]])
- ],[
- AC_MSG_RESULT([yes])
- curl_cv_getnameinfo="yes"
- ],[
- AC_MSG_RESULT([but still no])
- curl_cv_getnameinfo="no"
- ])
- fi
- #
- if test "$curl_cv_getnameinfo" = "yes"; then
- AC_CACHE_CHECK([types of arguments for getnameinfo],
- [curl_cv_func_getnameinfo_args], [
- curl_cv_func_getnameinfo_args="unknown"
- for gni_arg1 in 'struct sockaddr *' 'const struct sockaddr *' 'void *'; do
- for gni_arg2 in 'socklen_t' 'size_t' 'int'; do
- for gni_arg46 in 'size_t' 'int' 'socklen_t' 'unsigned int' 'DWORD'; do
- for gni_arg7 in 'int' 'unsigned int'; do
- if test "$curl_cv_func_getnameinfo_args" = "unknown"; then
- AC_COMPILE_IFELSE([
- AC_LANG_PROGRAM([[
-#undef inline
-#ifdef HAVE_WINDOWS_H
-#ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN
-#endif
-#if (!defined(_WIN32_WINNT)) || (_WIN32_WINNT < 0x0501)
-#undef _WIN32_WINNT
-#define _WIN32_WINNT 0x0501
-#endif
-#include
-#ifdef HAVE_WINSOCK2_H
-#include
-#ifdef HAVE_WS2TCPIP_H
-#include
-#endif
-#endif
-#define GNICALLCONV WSAAPI
-#else
-#ifdef HAVE_SYS_TYPES_H
-#include
-#endif
-#ifdef HAVE_SYS_SOCKET_H
-#include
-#endif
-#ifdef HAVE_NETDB_H
-#include
-#endif
-#define GNICALLCONV
-#endif
- extern int GNICALLCONV getnameinfo($gni_arg1, $gni_arg2,
- char *, $gni_arg46,
- char *, $gni_arg46,
- $gni_arg7);
- ]],[[
- $gni_arg2 salen=0;
- $gni_arg46 hostlen=0;
- $gni_arg46 servlen=0;
- $gni_arg7 flags=0;
- int res = getnameinfo(0, salen, 0, hostlen, 0, servlen, flags);
- ]])
- ],[
- curl_cv_func_getnameinfo_args="$gni_arg1,$gni_arg2,$gni_arg46,$gni_arg7"
- ])
- fi
- done
- done
- done
- done
- ]) # AC-CACHE-CHECK
- if test "$curl_cv_func_getnameinfo_args" = "unknown"; then
- AC_MSG_WARN([Cannot find proper types to use for getnameinfo args])
- AC_MSG_WARN([HAVE_GETNAMEINFO will not be defined])
- else
- gni_prev_IFS=$IFS; IFS=','
- set dummy `echo "$curl_cv_func_getnameinfo_args" | sed 's/\*/\*/g'`
- IFS=$gni_prev_IFS
- shift
- #
- gni_qual_type_arg1=$[1]
- #
- AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG2, $[2],
- [Define to the type of arg 2 for getnameinfo.])
- AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG46, $[3],
- [Define to the type of args 4 and 6 for getnameinfo.])
- AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG7, $[4],
- [Define to the type of arg 7 for getnameinfo.])
- #
- prev_sh_opts=$-
- #
- case $prev_sh_opts in
- *f*)
- ;;
- *)
- set -f
- ;;
- esac
- #
- case "$gni_qual_type_arg1" in
- const*)
- gni_qual_arg1=const
- gni_type_arg1=`echo $gni_qual_type_arg1 | sed 's/^const //'`
- ;;
- *)
- gni_qual_arg1=
- gni_type_arg1=$gni_qual_type_arg1
- ;;
- esac
- #
- AC_DEFINE_UNQUOTED(GETNAMEINFO_QUAL_ARG1, $gni_qual_arg1,
- [Define to the type qualifier of arg 1 for getnameinfo.])
- AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG1, $gni_type_arg1,
- [Define to the type of arg 1 for getnameinfo.])
- #
- case $prev_sh_opts in
- *f*)
- ;;
- *)
- set +f
- ;;
- esac
- #
- AC_DEFINE_UNQUOTED(HAVE_GETNAMEINFO, 1,
- [Define to 1 if you have the getnameinfo function.])
- ac_cv_func_getnameinfo="yes"
- fi
- fi
-])
-
-
-dnl TYPE_SOCKADDR_STORAGE
-dnl -------------------------------------------------
-dnl Check for struct sockaddr_storage. Most IPv6-enabled
-dnl hosts have it, but AIX 4.3 is one known exception.
-
-AC_DEFUN([TYPE_SOCKADDR_STORAGE],
-[
- AC_CHECK_TYPE([struct sockaddr_storage],
- AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
- [if struct sockaddr_storage is defined]), ,
- [
-#undef inline
-#ifdef HAVE_WINDOWS_H
-#ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN
-#endif
-#include
-#ifdef HAVE_WINSOCK2_H
-#include
-#endif
-#else
-#ifdef HAVE_SYS_TYPES_H
-#include
-#endif
-#ifdef HAVE_SYS_SOCKET_H
-#include
-#endif
-#ifdef HAVE_NETINET_IN_H
-#include
-#endif
-#ifdef HAVE_ARPA_INET_H
-#include
-#endif
-#endif
- ])
-])
-
-
-dnl CURL_CHECK_NI_WITHSCOPEID
-dnl -------------------------------------------------
-dnl Check for working NI_WITHSCOPEID in getnameinfo()
-
-AC_DEFUN([CURL_CHECK_NI_WITHSCOPEID], [
- AC_REQUIRE([CURL_CHECK_FUNC_GETNAMEINFO])dnl
- AC_REQUIRE([TYPE_SOCKADDR_STORAGE])dnl
- AC_CHECK_HEADERS(stdio.h sys/types.h sys/socket.h \
- netdb.h netinet/in.h arpa/inet.h)
- #
- AC_CACHE_CHECK([for working NI_WITHSCOPEID],
- [ac_cv_working_ni_withscopeid], [
- AC_RUN_IFELSE([
- AC_LANG_PROGRAM([[
-#ifdef HAVE_STDLIB_H
-#include
-#endif
-#ifdef HAVE_STDIO_H
-#include
-#endif
-#ifdef HAVE_SYS_TYPES_H
-#include
-#endif
-#ifdef HAVE_SYS_SOCKET_H
-#include
-#endif
-#ifdef HAVE_NETDB_H
-#include
-#endif
-#ifdef HAVE_NETINET_IN_H
-#include
-#endif
-#ifdef HAVE_ARPA_INET_H
-#include
-#endif
- ]],[[
-#if defined(NI_WITHSCOPEID) && defined(HAVE_GETNAMEINFO)
-#ifdef HAVE_STRUCT_SOCKADDR_STORAGE
- struct sockaddr_storage sa;
-#else
- unsigned char sa[256];
-#endif
- char hostbuf[NI_MAXHOST];
- int rc;
- GETNAMEINFO_TYPE_ARG2 salen = (GETNAMEINFO_TYPE_ARG2)sizeof(sa);
- GETNAMEINFO_TYPE_ARG46 hostlen = (GETNAMEINFO_TYPE_ARG46)sizeof(hostbuf);
- GETNAMEINFO_TYPE_ARG7 flags = NI_NUMERICHOST | NI_NUMERICSERV | NI_WITHSCOPEID;
- int fd = socket(AF_INET6, SOCK_STREAM, 0);
- if(fd < 0) {
- perror("socket()");
- return 1; /* Error creating socket */
- }
- rc = getsockname(fd, (GETNAMEINFO_TYPE_ARG1)&sa, &salen);
- if(rc) {
- perror("getsockname()");
- return 2; /* Error retrieving socket name */
- }
- rc = getnameinfo((GETNAMEINFO_TYPE_ARG1)&sa, salen, hostbuf, hostlen, NULL, 0, flags);
- if(rc) {
- printf("rc = %s\n", gai_strerror(rc));
- return 3; /* Error translating socket address */
- }
- return 0; /* Ok, NI_WITHSCOPEID works */
-#else
- return 4; /* Error, NI_WITHSCOPEID not defined or no getnameinfo() */
-#endif
- ]]) # AC-LANG-PROGRAM
- ],[
- # Exit code == 0. Program worked.
- ac_cv_working_ni_withscopeid="yes"
- ],[
- # Exit code != 0. Program failed.
- ac_cv_working_ni_withscopeid="no"
- ],[
- # Program is not run when cross-compiling. So we assume
- # NI_WITHSCOPEID will work if we are able to compile it.
- AC_COMPILE_IFELSE([
- AC_LANG_PROGRAM([[
-#include
-#include
-#include
- ]],[[
- unsigned int dummy= NI_NUMERICHOST | NI_NUMERICSERV | NI_WITHSCOPEID;
- ]])
- ],[
- ac_cv_working_ni_withscopeid="yes"
- ],[
- ac_cv_working_ni_withscopeid="no"
- ]) # AC-COMPILE-IFELSE
- ]) # AC-RUN-IFELSE
- ]) # AC-CACHE-CHECK
- case "$ac_cv_working_ni_withscopeid" in
- yes)
- AC_DEFINE(HAVE_NI_WITHSCOPEID, 1,
- [Define to 1 if NI_WITHSCOPEID exists and works.])
- ;;
- esac
-])
-
-
-dnl CURL_CHECK_FUNC_RECV
-dnl -------------------------------------------------
-dnl Test if the socket recv() function is available,
-dnl and check its return type and the types of its
-dnl arguments. If the function succeeds HAVE_RECV
-dnl will be defined, defining the types of the arguments
-dnl in RECV_TYPE_ARG1, RECV_TYPE_ARG2, RECV_TYPE_ARG3
-dnl and RECV_TYPE_ARG4, defining the type of the function
-dnl return value in RECV_TYPE_RETV.
-
-AC_DEFUN([CURL_CHECK_FUNC_RECV], [
- AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl
- AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
- AC_CHECK_HEADERS(sys/types.h sys/socket.h)
- #
- AC_MSG_CHECKING([for recv])
- AC_LINK_IFELSE([
- AC_LANG_PROGRAM([[
-#undef inline
-#ifdef HAVE_WINDOWS_H
-#ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN
-#endif
-#include
-#ifdef HAVE_WINSOCK2_H
-#include
-#else
-#ifdef HAVE_WINSOCK_H
-#include
-#endif
-#endif
-#else
-#ifdef HAVE_SYS_TYPES_H
-#include
-#endif
-#ifdef HAVE_SYS_SOCKET_H
-#include
-#endif
-#endif
- ]],[[
- recv(0, 0, 0, 0);
- ]])
- ],[
- AC_MSG_RESULT([yes])
- curl_cv_recv="yes"
- ],[
- AC_MSG_RESULT([no])
- curl_cv_recv="no"
- ])
- #
- if test "$curl_cv_recv" = "yes"; then
- AC_CACHE_CHECK([types of args and return type for recv],
- [curl_cv_func_recv_args], [
- curl_cv_func_recv_args="unknown"
- for recv_retv in 'int' 'ssize_t'; do
- for recv_arg1 in 'int' 'ssize_t' 'SOCKET'; do
- for recv_arg2 in 'char *' 'void *'; do
- for recv_arg3 in 'size_t' 'int' 'socklen_t' 'unsigned int'; do
- for recv_arg4 in 'int' 'unsigned int'; do
- if test "$curl_cv_func_recv_args" = "unknown"; then
- AC_COMPILE_IFELSE([
- AC_LANG_PROGRAM([[
-#undef inline
-#ifdef HAVE_WINDOWS_H
-#ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN
-#endif
-#include
-#ifdef HAVE_WINSOCK2_H
-#include
-#else
-#ifdef HAVE_WINSOCK_H
-#include
-#endif
-#endif
-#define RECVCALLCONV PASCAL
-#else
-#ifdef HAVE_SYS_TYPES_H
-#include
-#endif
-#ifdef HAVE_SYS_SOCKET_H
-#include
-#endif
-#define RECVCALLCONV
-#endif
- extern $recv_retv RECVCALLCONV
- recv($recv_arg1, $recv_arg2, $recv_arg3, $recv_arg4);
- ]],[[
- $recv_arg1 s=0;
- $recv_arg2 buf=0;
- $recv_arg3 len=0;
- $recv_arg4 flags=0;
- $recv_retv res = recv(s, buf, len, flags);
- ]])
- ],[
- curl_cv_func_recv_args="$recv_arg1,$recv_arg2,$recv_arg3,$recv_arg4,$recv_retv"
- ])
- fi
- done
- done
- done
- done
- done
- ]) # AC-CACHE-CHECK
- if test "$curl_cv_func_recv_args" = "unknown"; then
- AC_MSG_ERROR([Cannot find proper types to use for recv args])
- else
- recv_prev_IFS=$IFS; IFS=','
- set dummy `echo "$curl_cv_func_recv_args" | sed 's/\*/\*/g'`
- IFS=$recv_prev_IFS
- shift
- #
- AC_DEFINE_UNQUOTED(RECV_TYPE_ARG1, $[1],
- [Define to the type of arg 1 for recv.])
- AC_DEFINE_UNQUOTED(RECV_TYPE_ARG2, $[2],
- [Define to the type of arg 2 for recv.])
- AC_DEFINE_UNQUOTED(RECV_TYPE_ARG3, $[3],
- [Define to the type of arg 3 for recv.])
- AC_DEFINE_UNQUOTED(RECV_TYPE_ARG4, $[4],
- [Define to the type of arg 4 for recv.])
- AC_DEFINE_UNQUOTED(RECV_TYPE_RETV, $[5],
- [Define to the function return type for recv.])
- #
- AC_DEFINE_UNQUOTED(HAVE_RECV, 1,
- [Define to 1 if you have the recv function.])
- ac_cv_func_recv="yes"
- fi
- else
- AC_MSG_ERROR([Unable to link function recv])
- fi
-])
-
-
-dnl CURL_CHECK_FUNC_SEND
-dnl -------------------------------------------------
-dnl Test if the socket send() function is available,
-dnl and check its return type and the types of its
-dnl arguments. If the function succeeds HAVE_SEND
-dnl will be defined, defining the types of the arguments
-dnl in SEND_TYPE_ARG1, SEND_TYPE_ARG2, SEND_TYPE_ARG3
-dnl and SEND_TYPE_ARG4, defining the type of the function
-dnl return value in SEND_TYPE_RETV, and also defining the
-dnl type qualifier of second argument in SEND_QUAL_ARG2.
-
-AC_DEFUN([CURL_CHECK_FUNC_SEND], [
- AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl
- AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
- AC_CHECK_HEADERS(sys/types.h sys/socket.h)
- #
- AC_MSG_CHECKING([for send])
- AC_LINK_IFELSE([
- AC_LANG_PROGRAM([[
-#undef inline
-#ifdef HAVE_WINDOWS_H
-#ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN
-#endif
-#include
-#ifdef HAVE_WINSOCK2_H
-#include
-#else
-#ifdef HAVE_WINSOCK_H
-#include
-#endif
-#endif
-#else
-#ifdef HAVE_SYS_TYPES_H
-#include
-#endif
-#ifdef HAVE_SYS_SOCKET_H
-#include
-#endif
-#endif
- ]],[[
- send(0, 0, 0, 0);
- ]])
- ],[
- AC_MSG_RESULT([yes])
- curl_cv_send="yes"
- ],[
- AC_MSG_RESULT([no])
- curl_cv_send="no"
- ])
- #
- if test "$curl_cv_send" = "yes"; then
- AC_CACHE_CHECK([types of args and return type for send],
- [curl_cv_func_send_args], [
- curl_cv_func_send_args="unknown"
- for send_retv in 'int' 'ssize_t'; do
- for send_arg1 in 'int' 'ssize_t' 'SOCKET'; do
- for send_arg2 in 'char *' 'void *' 'const char *' 'const void *'; do
- for send_arg3 in 'size_t' 'int' 'socklen_t' 'unsigned int'; do
- for send_arg4 in 'int' 'unsigned int'; do
- if test "$curl_cv_func_send_args" = "unknown"; then
- AC_COMPILE_IFELSE([
- AC_LANG_PROGRAM([[
-#undef inline
-#ifdef HAVE_WINDOWS_H
-#ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN
-#endif
-#include
-#ifdef HAVE_WINSOCK2_H
-#include
-#else
-#ifdef HAVE_WINSOCK_H
-#include
-#endif
-#endif
-#define SENDCALLCONV PASCAL
-#else
-#ifdef HAVE_SYS_TYPES_H
-#include
-#endif
-#ifdef HAVE_SYS_SOCKET_H
-#include
-#endif
-#define SENDCALLCONV
-#endif
- extern $send_retv SENDCALLCONV
- send($send_arg1, $send_arg2, $send_arg3, $send_arg4);
- ]],[[
- $send_arg1 s=0;
- $send_arg3 len=0;
- $send_arg4 flags=0;
- $send_retv res = send(s, 0, len, flags);
- ]])
- ],[
- curl_cv_func_send_args="$send_arg1,$send_arg2,$send_arg3,$send_arg4,$send_retv"
- ])
- fi
- done
- done
- done
- done
- done
- ]) # AC-CACHE-CHECK
- if test "$curl_cv_func_send_args" = "unknown"; then
- AC_MSG_ERROR([Cannot find proper types to use for send args])
- else
- send_prev_IFS=$IFS; IFS=','
- set dummy `echo "$curl_cv_func_send_args" | sed 's/\*/\*/g'`
- IFS=$send_prev_IFS
- shift
- #
- send_qual_type_arg2=$[2]
- #
- AC_DEFINE_UNQUOTED(SEND_TYPE_ARG1, $[1],
- [Define to the type of arg 1 for send.])
- AC_DEFINE_UNQUOTED(SEND_TYPE_ARG3, $[3],
- [Define to the type of arg 3 for send.])
- AC_DEFINE_UNQUOTED(SEND_TYPE_ARG4, $[4],
- [Define to the type of arg 4 for send.])
- AC_DEFINE_UNQUOTED(SEND_TYPE_RETV, $[5],
- [Define to the function return type for send.])
- #
- prev_sh_opts=$-
- #
- case $prev_sh_opts in
- *f*)
- ;;
- *)
- set -f
- ;;
- esac
- #
- case "$send_qual_type_arg2" in
- const*)
- send_qual_arg2=const
- send_type_arg2=`echo $send_qual_type_arg2 | sed 's/^const //'`
- ;;
- *)
- send_qual_arg2=
- send_type_arg2=$send_qual_type_arg2
- ;;
- esac
- #
- AC_DEFINE_UNQUOTED(SEND_QUAL_ARG2, $send_qual_arg2,
- [Define to the type qualifier of arg 2 for send.])
- AC_DEFINE_UNQUOTED(SEND_TYPE_ARG2, $send_type_arg2,
- [Define to the type of arg 2 for send.])
- #
- case $prev_sh_opts in
- *f*)
- ;;
- *)
- set +f
- ;;
- esac
- #
- AC_DEFINE_UNQUOTED(HAVE_SEND, 1,
- [Define to 1 if you have the send function.])
- ac_cv_func_send="yes"
- fi
- else
- AC_MSG_ERROR([Unable to link function send])
- fi
-])
-
-
-dnl CURL_CHECK_FUNC_RECVFROM
-dnl -------------------------------------------------
-dnl Test if the socket recvfrom() function is available,
-dnl and check its return type and the types of its
-dnl arguments. If the function succeeds HAVE_RECVFROM
-dnl will be defined, defining the types of the arguments
-dnl in RECVFROM_TYPE_ARG1, RECVFROM_TYPE_ARG2, and so on
-dnl to RECVFROM_TYPE_ARG6, defining also the type of the
-dnl function return value in RECVFROM_TYPE_RETV.
-dnl Notice that the types returned for pointer arguments
-dnl will actually be the type pointed by the pointer.
-
-AC_DEFUN([CURL_CHECK_FUNC_RECVFROM], [
- AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl
- AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
- AC_CHECK_HEADERS(sys/types.h sys/socket.h)
- #
- AC_MSG_CHECKING([for recvfrom])
- AC_LINK_IFELSE([
- AC_LANG_PROGRAM([[
-#undef inline
-#ifdef HAVE_WINDOWS_H
-#ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN
-#endif
-#include
-#ifdef HAVE_WINSOCK2_H
-#include
-#else
-#ifdef HAVE_WINSOCK_H
-#include
-#endif
-#endif
-#else
-#ifdef HAVE_SYS_TYPES_H
-#include
-#endif
-#ifdef HAVE_SYS_SOCKET_H
-#include
-#endif
-#endif
- ]],[[
- recvfrom(0, 0, 0, 0, 0, 0);
- ]])
- ],[
- AC_MSG_RESULT([yes])
- curl_cv_recvfrom="yes"
- ],[
- AC_MSG_RESULT([no])
- curl_cv_recvfrom="no"
- ])
- #
- if test "$curl_cv_recvfrom" = "yes"; then
- AC_CACHE_CHECK([types of args and return type for recvfrom],
- [curl_cv_func_recvfrom_args], [
- curl_cv_func_recvfrom_args="unknown"
- for recvfrom_retv in 'int' 'ssize_t'; do
- for recvfrom_arg1 in 'int' 'ssize_t' 'SOCKET'; do
- for recvfrom_arg2 in 'char *' 'void *'; do
- for recvfrom_arg3 in 'size_t' 'int' 'socklen_t' 'unsigned int'; do
- for recvfrom_arg4 in 'int' 'unsigned int'; do
- for recvfrom_arg5 in 'struct sockaddr *' 'void *' 'const struct sockaddr *'; do
- for recvfrom_arg6 in 'socklen_t *' 'int *' 'unsigned int *' 'size_t *' 'void *'; do
- if test "$curl_cv_func_recvfrom_args" = "unknown"; then
- AC_COMPILE_IFELSE([
- AC_LANG_PROGRAM([[
-#undef inline
-#ifdef HAVE_WINDOWS_H
-#ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN
-#endif
-#include
-#ifdef HAVE_WINSOCK2_H
-#include
-#else
-#ifdef HAVE_WINSOCK_H
-#include
-#endif
-#endif
-#define RECVFROMCALLCONV PASCAL
-#else
-#ifdef HAVE_SYS_TYPES_H
-#include
-#endif
-#ifdef HAVE_SYS_SOCKET_H
-#include
-#endif
-#define RECVFROMCALLCONV
-#endif
- extern $recvfrom_retv RECVFROMCALLCONV
- recvfrom($recvfrom_arg1, $recvfrom_arg2,
- $recvfrom_arg3, $recvfrom_arg4,
- $recvfrom_arg5, $recvfrom_arg6);
- ]],[[
- $recvfrom_arg1 s=0;
- $recvfrom_arg2 buf=0;
- $recvfrom_arg3 len=0;
- $recvfrom_arg4 flags=0;
- $recvfrom_arg5 addr=0;
- $recvfrom_arg6 addrlen=0;
- $recvfrom_retv res=0;
- res = recvfrom(s, buf, len, flags, addr, addrlen);
- ]])
- ],[
- curl_cv_func_recvfrom_args="$recvfrom_arg1,$recvfrom_arg2,$recvfrom_arg3,$recvfrom_arg4,$recvfrom_arg5,$recvfrom_arg6,$recvfrom_retv"
- ])
- fi
- done
- done
- done
- done
- done
- done
- done
- ]) # AC-CACHE-CHECK
- # Nearly last minute change for this release starts here
- AC_DEFINE_UNQUOTED(HAVE_RECVFROM, 1,
- [Define to 1 if you have the recvfrom function.])
- ac_cv_func_recvfrom="yes"
- # Nearly last minute change for this release ends here
- if test "$curl_cv_func_recvfrom_args" = "unknown"; then
- AC_MSG_WARN([Cannot find proper types to use for recvfrom args])
- else
- recvfrom_prev_IFS=$IFS; IFS=','
- set dummy `echo "$curl_cv_func_recvfrom_args" | sed 's/\*/\*/g'`
- IFS=$recvfrom_prev_IFS
- shift
- #
- recvfrom_ptrt_arg2=$[2]
- recvfrom_qual_ptrt_arg5=$[5]
- recvfrom_ptrt_arg6=$[6]
- #
- AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG1, $[1],
- [Define to the type of arg 1 for recvfrom.])
- AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG3, $[3],
- [Define to the type of arg 3 for recvfrom.])
- AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG4, $[4],
- [Define to the type of arg 4 for recvfrom.])
- AC_DEFINE_UNQUOTED(RECVFROM_TYPE_RETV, $[7],
- [Define to the function return type for recvfrom.])
- #
- prev_sh_opts=$-
- #
- case $prev_sh_opts in
- *f*)
- ;;
- *)
- set -f
- ;;
- esac
- #
- case "$recvfrom_qual_ptrt_arg5" in
- const*)
- recvfrom_qual_arg5=const
- recvfrom_ptrt_arg5=`echo $recvfrom_qual_ptrt_arg5 | sed 's/^const //'`
- ;;
- *)
- recvfrom_qual_arg5=
- recvfrom_ptrt_arg5=$recvfrom_qual_ptrt_arg5
- ;;
- esac
- #
- recvfrom_type_arg2=`echo $recvfrom_ptrt_arg2 | sed 's/ \*//'`
- recvfrom_type_arg5=`echo $recvfrom_ptrt_arg5 | sed 's/ \*//'`
- recvfrom_type_arg6=`echo $recvfrom_ptrt_arg6 | sed 's/ \*//'`
- #
- AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG2, $recvfrom_type_arg2,
- [Define to the type pointed by arg 2 for recvfrom.])
- AC_DEFINE_UNQUOTED(RECVFROM_QUAL_ARG5, $recvfrom_qual_arg5,
- [Define to the type qualifier pointed by arg 5 for recvfrom.])
- AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG5, $recvfrom_type_arg5,
- [Define to the type pointed by arg 5 for recvfrom.])
- AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG6, $recvfrom_type_arg6,
- [Define to the type pointed by arg 6 for recvfrom.])
- #
- if test "$recvfrom_type_arg2" = "void"; then
- AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG2_IS_VOID, 1,
- [Define to 1 if the type pointed by arg 2 for recvfrom is void.])
- fi
- if test "$recvfrom_type_arg5" = "void"; then
- AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG5_IS_VOID, 1,
- [Define to 1 if the type pointed by arg 5 for recvfrom is void.])
- fi
- if test "$recvfrom_type_arg6" = "void"; then
- AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG6_IS_VOID, 1,
- [Define to 1 if the type pointed by arg 6 for recvfrom is void.])
- fi
- #
- case $prev_sh_opts in
- *f*)
- ;;
- *)
- set +f
- ;;
- esac
- #
- AC_DEFINE_UNQUOTED(HAVE_RECVFROM, 1,
- [Define to 1 if you have the recvfrom function.])
- ac_cv_func_recvfrom="yes"
- fi
- else
- AC_MSG_WARN([Unable to link function recvfrom])
- AC_MSG_WARN([Your system will be vulnerable to some forms of DNS cache poisoning])
- fi
-])
-
-
-dnl CURL_CHECK_MSG_NOSIGNAL
-dnl -------------------------------------------------
-dnl Check for MSG_NOSIGNAL
-
-AC_DEFUN([CURL_CHECK_MSG_NOSIGNAL], [
- AC_CHECK_HEADERS(sys/types.h sys/socket.h)
- AC_CACHE_CHECK([for MSG_NOSIGNAL], [ac_cv_msg_nosignal], [
- AC_COMPILE_IFELSE([
- AC_LANG_PROGRAM([[
-#undef inline
-#ifdef HAVE_WINDOWS_H
-#ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN
-#endif
-#include
-#ifdef HAVE_WINSOCK2_H
-#include
-#else
-#ifdef HAVE_WINSOCK_H
-#include
-#endif
-#endif
-#else
-#ifdef HAVE_SYS_TYPES_H
-#include
-#endif
-#ifdef HAVE_SYS_SOCKET_H
-#include
-#endif
-#endif
- ]],[[
- int flag=MSG_NOSIGNAL;
- ]])
- ],[
- ac_cv_msg_nosignal="yes"
- ],[
- ac_cv_msg_nosignal="no"
- ])
- ])
- case "$ac_cv_msg_nosignal" in
- yes)
- AC_DEFINE_UNQUOTED(HAVE_MSG_NOSIGNAL, 1,
- [Define to 1 if you have the MSG_NOSIGNAL flag.])
- ;;
- esac
-])
-
-
-dnl CURL_CHECK_STRUCT_TIMEVAL
-dnl -------------------------------------------------
-dnl Check for timeval struct
-
-AC_DEFUN([CURL_CHECK_STRUCT_TIMEVAL], [
- AC_REQUIRE([AC_HEADER_TIME])dnl
- AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl
- AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
- AC_CHECK_HEADERS(sys/types.h sys/time.h time.h sys/socket.h)
- AC_CACHE_CHECK([for struct timeval], [ac_cv_struct_timeval], [
- AC_COMPILE_IFELSE([
- AC_LANG_PROGRAM([[
-#undef inline
-#ifdef HAVE_WINDOWS_H
-#ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN
-#endif
-#include
-#ifdef HAVE_WINSOCK2_H
-#include
-#else
-#ifdef HAVE_WINSOCK_H
-#include
-#endif
-#endif
-#endif
-#ifdef HAVE_SYS_TYPES_H
-#include
-#endif
-#ifdef HAVE_SYS_TIME_H
-#include
-#ifdef TIME_WITH_SYS_TIME
-#include
-#endif
-#else
-#ifdef HAVE_TIME_H
-#include
-#endif
-#endif
-#ifdef HAVE_SYS_SOCKET_H
-#include
-#endif
- ]],[[
- struct timeval ts;
- ts.tv_sec = 0;
- ts.tv_usec = 0;
- ]])
- ],[
- ac_cv_struct_timeval="yes"
- ],[
- ac_cv_struct_timeval="no"
- ])
- ])
- case "$ac_cv_struct_timeval" in
- yes)
- AC_DEFINE_UNQUOTED(HAVE_STRUCT_TIMEVAL, 1,
- [Define to 1 if you have the timeval struct.])
- ;;
- esac
-])
-
-
-dnl TYPE_SIG_ATOMIC_T
-dnl -------------------------------------------------
-dnl Check if the sig_atomic_t type is available, and
-dnl verify if it is already defined as volatile.
-
-AC_DEFUN([TYPE_SIG_ATOMIC_T], [
- AC_CHECK_HEADERS(signal.h)
- AC_CHECK_TYPE([sig_atomic_t],[
- AC_DEFINE(HAVE_SIG_ATOMIC_T, 1,
- [Define to 1 if sig_atomic_t is an available typedef.])
- ], ,[
-#ifdef HAVE_SIGNAL_H
-#include
-#endif
- ])
- case "$ac_cv_type_sig_atomic_t" in
- yes)
- #
- AC_MSG_CHECKING([if sig_atomic_t is already defined as volatile])
- AC_LINK_IFELSE([
- AC_LANG_PROGRAM([[
-#ifdef HAVE_SIGNAL_H
-#include
-#endif
- ]],[[
- static volatile sig_atomic_t dummy = 0;
- ]])
- ],[
- AC_MSG_RESULT([no])
- ac_cv_sig_atomic_t_volatile="no"
- ],[
- AC_MSG_RESULT([yes])
- ac_cv_sig_atomic_t_volatile="yes"
- ])
- #
- if test "$ac_cv_sig_atomic_t_volatile" = "yes"; then
- AC_DEFINE(HAVE_SIG_ATOMIC_T_VOLATILE, 1,
- [Define to 1 if sig_atomic_t is already defined as volatile.])
- fi
- ;;
- esac
-])
-
-
-dnl TYPE_IN_ADDR_T
-dnl -------------------------------------------------
-dnl Check for in_addr_t: it is used to receive the return code of inet_addr()
-dnl and a few other things.
-
-AC_DEFUN([TYPE_IN_ADDR_T], [
- AC_CHECK_TYPE([in_addr_t], ,[
- dnl in_addr_t not available
- AC_CACHE_CHECK([for in_addr_t equivalent],
- [curl_cv_in_addr_t_equiv], [
- curl_cv_in_addr_t_equiv="unknown"
- for t in "unsigned long" int size_t unsigned long; do
- if test "$curl_cv_in_addr_t_equiv" = "unknown"; then
- AC_LINK_IFELSE([
- AC_LANG_PROGRAM([[
-#undef inline
-#ifdef HAVE_WINDOWS_H
-#ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN
-#endif
-#include
-#ifdef HAVE_WINSOCK2_H
-#include
-#else
-#ifdef HAVE_WINSOCK_H
-#include
-#endif
-#endif
-#else
-#ifdef HAVE_SYS_TYPES_H
-#include
-#endif
-#ifdef HAVE_SYS_SOCKET_H
-#include
-#endif
-#ifdef HAVE_NETINET_IN_H
-#include
-#endif
-#ifdef HAVE_ARPA_INET_H
-#include
-#endif
-#endif
- ]],[[
- $t data = inet_addr ("1.2.3.4");
- ]])
- ],[
- curl_cv_in_addr_t_equiv="$t"
- ])
- fi
- done
- ])
- case "$curl_cv_in_addr_t_equiv" in
- unknown)
- AC_MSG_ERROR([Cannot find a type to use in place of in_addr_t])
- ;;
- *)
- AC_DEFINE_UNQUOTED(in_addr_t, $curl_cv_in_addr_t_equiv,
- [Type to use in place of in_addr_t when system does not provide it.])
- ;;
- esac
- ],[
-#undef inline
-#ifdef HAVE_WINDOWS_H
-#ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN
-#endif
-#include
-#ifdef HAVE_WINSOCK2_H
-#include
-#else
-#ifdef HAVE_WINSOCK_H
-#include
-#endif
-#endif
-#else
-#ifdef HAVE_SYS_TYPES_H
-#include
-#endif
-#ifdef HAVE_SYS_SOCKET_H
-#include
-#endif
-#ifdef HAVE_NETINET_IN_H
-#include
-#endif
-#ifdef HAVE_ARPA_INET_H
-#include
-#endif
-#endif
- ])
-])
-
-
-dnl CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC
-dnl -------------------------------------------------
-dnl Check if monotonic clock_gettime is available.
-
-AC_DEFUN([CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC], [
- AC_REQUIRE([AC_HEADER_TIME])dnl
- AC_CHECK_HEADERS(sys/types.h sys/time.h time.h)
- AC_MSG_CHECKING([for monotonic clock_gettime])
- AC_COMPILE_IFELSE([
- AC_LANG_PROGRAM([[
-#ifdef HAVE_SYS_TYPES_H
-#include
-#endif
-#ifdef HAVE_SYS_TIME_H
-#include
-#ifdef TIME_WITH_SYS_TIME
-#include
-#endif
-#else
-#ifdef HAVE_TIME_H
-#include
-#endif
-#endif
- ]],[[
- struct timespec ts;
- (void)clock_gettime(CLOCK_MONOTONIC, &ts);
- ]])
- ],[
- AC_MSG_RESULT([yes])
- ac_cv_func_clock_gettime="yes"
- ],[
- AC_MSG_RESULT([no])
- ac_cv_func_clock_gettime="no"
- ])
- dnl Definition of HAVE_CLOCK_GETTIME_MONOTONIC is intentionally postponed
- dnl until library linking and run-time checks for clock_gettime succeed.
-])
-
-
-dnl CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC
-dnl -------------------------------------------------
-dnl If monotonic clock_gettime is available then,
-dnl check and prepended to LIBS any needed libraries.
-
-AC_DEFUN([CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC], [
- AC_REQUIRE([CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC])dnl
- #
- if test "$ac_cv_func_clock_gettime" = "yes"; then
- #
- AC_MSG_CHECKING([for clock_gettime in libraries])
- #
- curl_cv_save_LIBS="$LIBS"
- curl_cv_gclk_LIBS="unknown"
- #
- for x_xlibs in '' '-lrt' '-lposix4' ; do
- if test "$curl_cv_gclk_LIBS" = "unknown"; then
- if test -z "$x_xlibs"; then
- LIBS="$curl_cv_save_LIBS"
- else
- LIBS="$x_xlibs $curl_cv_save_LIBS"
- fi
- AC_LINK_IFELSE([
- AC_LANG_PROGRAM([[
-#ifdef HAVE_SYS_TYPES_H
-#include
-#endif
-#ifdef HAVE_SYS_TIME_H
-#include
-#ifdef TIME_WITH_SYS_TIME
-#include
-#endif
-#else
-#ifdef HAVE_TIME_H
-#include
-#endif
-#endif
- ]],[[
- struct timespec ts;
- (void)clock_gettime(CLOCK_MONOTONIC, &ts);
- ]])
- ],[
- curl_cv_gclk_LIBS="$x_xlibs"
- ])
- fi
- done
- #
- LIBS="$curl_cv_save_LIBS"
- #
- case X-"$curl_cv_gclk_LIBS" in
- X-unknown)
- AC_MSG_RESULT([cannot find clock_gettime])
- AC_MSG_WARN([HAVE_CLOCK_GETTIME_MONOTONIC will not be defined])
- ac_cv_func_clock_gettime="no"
- ;;
- X-)
- AC_MSG_RESULT([no additional lib required])
- ac_cv_func_clock_gettime="yes"
- ;;
- *)
- if test -z "$curl_cv_save_LIBS"; then
- LIBS="$curl_cv_gclk_LIBS"
- else
- LIBS="$curl_cv_gclk_LIBS $curl_cv_save_LIBS"
- fi
- AC_MSG_RESULT([$curl_cv_gclk_LIBS])
- ac_cv_func_clock_gettime="yes"
- ;;
- esac
- #
- dnl only do runtime verification when not cross-compiling
- if test "x$cross_compiling" != "xyes" &&
- test "$ac_cv_func_clock_gettime" = "yes"; then
- AC_MSG_CHECKING([if monotonic clock_gettime works])
- AC_RUN_IFELSE([
- AC_LANG_PROGRAM([[
-#ifdef HAVE_STDLIB_H
-#include
-#endif
-#ifdef HAVE_SYS_TYPES_H
-#include
-#endif
-#ifdef HAVE_SYS_TIME_H
-#include
-#ifdef TIME_WITH_SYS_TIME
-#include
-#endif
-#else
-#ifdef HAVE_TIME_H
-#include
-#endif
-#endif
- ]],[[
- struct timespec ts;
- if (0 == clock_gettime(CLOCK_MONOTONIC, &ts))
- exit(0);
- else
- exit(1);
- ]])
- ],[
- AC_MSG_RESULT([yes])
- ],[
- AC_MSG_RESULT([no])
- AC_MSG_WARN([HAVE_CLOCK_GETTIME_MONOTONIC will not be defined])
- ac_cv_func_clock_gettime="no"
- LIBS="$curl_cv_save_LIBS"
- ])
- fi
- #
- case "$ac_cv_func_clock_gettime" in
- yes)
- AC_DEFINE_UNQUOTED(HAVE_CLOCK_GETTIME_MONOTONIC, 1,
- [Define to 1 if you have the clock_gettime function and monotonic timer.])
- ;;
- esac
- #
- fi
- #
-])
-
-
-dnl CARES_CHECK_LIBS_CONNECT
-dnl -------------------------------------------------
-dnl Verify if network connect function is already available
-dnl using current libraries or if another one is required.
-
-AC_DEFUN([CARES_CHECK_LIBS_CONNECT], [
- AC_REQUIRE([CARES_INCLUDES_WINSOCK2])dnl
- AC_MSG_CHECKING([for connect in libraries])
- tst_connect_save_LIBS="$LIBS"
- tst_connect_need_LIBS="unknown"
- for tst_lib in '' '-lsocket' ; do
- if test "$tst_connect_need_LIBS" = "unknown"; then
- LIBS="$tst_lib $tst_connect_save_LIBS"
- AC_LINK_IFELSE([
- AC_LANG_PROGRAM([[
- $cares_includes_winsock2
- #ifndef HAVE_WINDOWS_H
- int connect(int, void*, int);
- #endif
- ]],[[
- if(0 != connect(0, 0, 0))
- return 1;
- ]])
- ],[
- tst_connect_need_LIBS="$tst_lib"
- ])
- fi
- done
- LIBS="$tst_connect_save_LIBS"
- #
- case X-"$tst_connect_need_LIBS" in
- X-unknown)
- AC_MSG_RESULT([cannot find connect])
- AC_MSG_ERROR([cannot find connect function in libraries.])
- ;;
- X-)
- AC_MSG_RESULT([yes])
- ;;
- *)
- AC_MSG_RESULT([$tst_connect_need_LIBS])
- LIBS="$tst_connect_need_LIBS $tst_connect_save_LIBS"
- ;;
- esac
-])
-
-
-dnl CARES_DEFINE_UNQUOTED (VARIABLE, [VALUE])
-dnl -------------------------------------------------
-dnl Like AC_DEFINE_UNQUOTED this macro will define a C preprocessor
-dnl symbol that can be further used in custom template configuration
-dnl files. This macro, unlike AC_DEFINE_UNQUOTED, does not use a third
-dnl argument for the description. Symbol definitions done with this
-dnl macro are intended to be exclusively used in handcrafted *.h.in
-dnl template files. Contrary to what AC_DEFINE_UNQUOTED does, this one
-dnl prevents autoheader generation and insertion of symbol template
-dnl stub and definition into the first configuration header file. Do
-dnl not use this macro as a replacement for AC_DEFINE_UNQUOTED, each
-dnl one serves different functional needs.
-
-AC_DEFUN([CARES_DEFINE_UNQUOTED], [
-cat >>confdefs.h <<_EOF
-[@%:@define] $1 ifelse($#, 2, [$2], 1)
-_EOF
-])
-
-dnl CARES_CONFIGURE_ARES_SOCKLEN_T
-dnl -------------------------------------------------
-dnl Find out suitable ares_socklen_t data type definition and size, making
-dnl appropriate definitions for template file ares_build.h.in
-dnl to properly configure and use the library.
-dnl
-dnl The need for the ares_socklen_t definition arises mainly to properly
-dnl interface HP-UX systems which on one hand have a typedef'ed socklen_t
-dnl data type which is 32 or 64-Bit wide depending on the data model being
-dnl used, and that on the other hand is only actually used when interfacing
-dnl the X/Open sockets provided in the xnet library.
-
-AC_DEFUN([CARES_CONFIGURE_ARES_SOCKLEN_T], [
- AC_REQUIRE([CARES_INCLUDES_WS2TCPIP])dnl
- AC_REQUIRE([CARES_INCLUDES_SYS_SOCKET])dnl
- AC_REQUIRE([CARES_PREPROCESS_CALLCONV])dnl
- #
- AC_MSG_CHECKING([for ares_socklen_t data type])
- cares_typeof_ares_socklen_t="unknown"
- for arg1 in int SOCKET; do
- for arg2 in 'struct sockaddr' void; do
- for t in socklen_t int size_t 'unsigned int' long 'unsigned long' void; do
- if test "$cares_typeof_ares_socklen_t" = "unknown"; then
- AC_COMPILE_IFELSE([
- AC_LANG_PROGRAM([[
- $cares_includes_ws2tcpip
- $cares_includes_sys_socket
- $cares_preprocess_callconv
- extern int FUNCALLCONV getpeername($arg1, $arg2 *, $t *);
- ]],[[
- $t *lenptr = 0;
- if(0 != getpeername(0, 0, lenptr))
- return 1;
- ]])
- ],[
- cares_typeof_ares_socklen_t="$t"
- ])
- fi
- done
- done
- done
- for t in socklen_t int; do
- if test "$cares_typeof_ares_socklen_t" = "void"; then
- AC_COMPILE_IFELSE([
- AC_LANG_PROGRAM([[
- $cares_includes_sys_socket
- typedef $t ares_socklen_t;
- ]],[[
- ares_socklen_t dummy;
- ]])
- ],[
- cares_typeof_ares_socklen_t="$t"
- ])
- fi
- done
- AC_MSG_RESULT([$cares_typeof_ares_socklen_t])
- if test "$cares_typeof_ares_socklen_t" = "void" ||
- test "$cares_typeof_ares_socklen_t" = "unknown"; then
- AC_MSG_ERROR([cannot find data type for ares_socklen_t.])
- fi
- #
- AC_MSG_CHECKING([size of ares_socklen_t])
- cares_sizeof_ares_socklen_t="unknown"
- cares_pull_headers_socklen_t="unknown"
- if test "$ac_cv_header_ws2tcpip_h" = "yes"; then
- tst_pull_header_checks='none ws2tcpip'
- tst_size_checks='4'
- else
- tst_pull_header_checks='none systypes syssocket'
- tst_size_checks='4 8 2'
- fi
- for tst_size in $tst_size_checks; do
- for tst_pull_headers in $tst_pull_header_checks; do
- if test "$cares_sizeof_ares_socklen_t" = "unknown"; then
- case $tst_pull_headers in
- ws2tcpip)
- tmp_includes="$cares_includes_ws2tcpip"
- ;;
- systypes)
- tmp_includes="$cares_includes_sys_types"
- ;;
- syssocket)
- tmp_includes="$cares_includes_sys_socket"
- ;;
- *)
- tmp_includes=""
- ;;
- esac
- AC_COMPILE_IFELSE([
- AC_LANG_PROGRAM([[
- $tmp_includes
- typedef $cares_typeof_ares_socklen_t ares_socklen_t;
- typedef char dummy_arr[sizeof(ares_socklen_t) == $tst_size ? 1 : -1];
- ]],[[
- ares_socklen_t dummy;
- ]])
- ],[
- cares_sizeof_ares_socklen_t="$tst_size"
- cares_pull_headers_socklen_t="$tst_pull_headers"
- ])
- fi
- done
- done
- AC_MSG_RESULT([$cares_sizeof_ares_socklen_t])
- if test "$cares_sizeof_ares_socklen_t" = "unknown"; then
- AC_MSG_ERROR([cannot find out size of ares_socklen_t.])
- fi
- #
- case $cares_pull_headers_socklen_t in
- ws2tcpip)
- CARES_DEFINE_UNQUOTED([CARES_PULL_WS2TCPIP_H])
- ;;
- systypes)
- CARES_DEFINE_UNQUOTED([CARES_PULL_SYS_TYPES_H])
- ;;
- syssocket)
- CARES_DEFINE_UNQUOTED([CARES_PULL_SYS_TYPES_H])
- CARES_DEFINE_UNQUOTED([CARES_PULL_SYS_SOCKET_H])
- ;;
- esac
- CARES_DEFINE_UNQUOTED([CARES_TYPEOF_ARES_SOCKLEN_T], [$cares_typeof_ares_socklen_t])
- CARES_DEFINE_UNQUOTED([CARES_SIZEOF_ARES_SOCKLEN_T], [$cares_sizeof_ares_socklen_t])
-])
-
-
-dnl This macro determines if the specified struct exists in the specified file
-dnl Syntax:
-dnl CARES_CHECK_STRUCT(headers, struct name, if found, [if not found])
-
-AC_DEFUN([CARES_CHECK_STRUCT], [
- AC_MSG_CHECKING([for struct $2])
- AC_TRY_COMPILE([$1],
- [
- struct $2 struct_instance;
- ], ac_struct="yes", ac_found="no")
- if test "$ac_struct" = "yes" ; then
- AC_MSG_RESULT(yes)
- $3
- else
- AC_MSG_RESULT(no)
- $4
- fi
-])
-
-dnl This macro determines if the specified constant exists in the specified file
-dnl Syntax:
-dnl CARES_CHECK_CONSTANT(headers, constant name, if found, [if not found])
-
-AC_DEFUN([CARES_CHECK_CONSTANT], [
- AC_MSG_CHECKING([for $2])
- AC_EGREP_CPP(VARIABLEWASDEFINED,
- [
- $1
-
- #ifdef $2
- VARIABLEWASDEFINED
- #else
- NJET
- #endif
- ], ac_constant="yes", ac_constant="no"
- )
- if test "$ac_constant" = "yes" ; then
- AC_MSG_RESULT(yes)
- $3
- else
- AC_MSG_RESULT(no)
- $4
- fi
-])
-
diff --git a/deps/cares/aclocal.m4 b/deps/cares/aclocal.m4
index ef2987bfa003df..ce7ad1c8a86a43 100644
--- a/deps/cares/aclocal.m4
+++ b/deps/cares/aclocal.m4
@@ -108,6 +108,43 @@ AC_DEFUN([AM_AUX_DIR_EXPAND],
am_aux_dir=`cd "$ac_aux_dir" && pwd`
])
+# AM_COND_IF -*- Autoconf -*-
+
+# Copyright (C) 2008-2021 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# _AM_COND_IF
+# _AM_COND_ELSE
+# _AM_COND_ENDIF
+# --------------
+# These macros are only used for tracing.
+m4_define([_AM_COND_IF])
+m4_define([_AM_COND_ELSE])
+m4_define([_AM_COND_ENDIF])
+
+# AM_COND_IF(COND, [IF-TRUE], [IF-FALSE])
+# ---------------------------------------
+# If the shell condition COND is true, execute IF-TRUE, otherwise execute
+# IF-FALSE. Allow automake to learn about conditional instantiating macros
+# (the AC_CONFIG_FOOS).
+AC_DEFUN([AM_COND_IF],
+[m4_ifndef([_AM_COND_VALUE_$1],
+ [m4_fatal([$0: no such condition "$1"])])dnl
+_AM_COND_IF([$1])dnl
+if test -z "$$1_TRUE"; then :
+ m4_n([$2])[]dnl
+m4_ifval([$3],
+[_AM_COND_ELSE([$1])dnl
+else
+ $3
+])dnl
+_AM_COND_ENDIF([$1])dnl
+fi[]dnl
+])
+
# AM_CONDITIONAL -*- Autoconf -*-
# Copyright (C) 1997-2021 Free Software Foundation, Inc.
@@ -1188,25 +1225,24 @@ m4_include([m4/ax_ac_append_to_file.m4])
m4_include([m4/ax_ac_print_to_file.m4])
m4_include([m4/ax_add_am_macro_static.m4])
m4_include([m4/ax_am_macros_static.m4])
+m4_include([m4/ax_append_compile_flags.m4])
+m4_include([m4/ax_append_flag.m4])
+m4_include([m4/ax_append_link_flags.m4])
+m4_include([m4/ax_check_compile_flag.m4])
m4_include([m4/ax_check_gnu_make.m4])
+m4_include([m4/ax_check_link_flag.m4])
+m4_include([m4/ax_check_user_namespace.m4])
+m4_include([m4/ax_check_uts_namespace.m4])
m4_include([m4/ax_code_coverage.m4])
+m4_include([m4/ax_compiler_vendor.m4])
m4_include([m4/ax_cxx_compile_stdcxx.m4])
-m4_include([m4/ax_cxx_compile_stdcxx_11.m4])
+m4_include([m4/ax_cxx_compile_stdcxx_14.m4])
m4_include([m4/ax_file_escapes.m4])
+m4_include([m4/ax_pthread.m4])
m4_include([m4/ax_require_defined.m4])
-m4_include([m4/cares-compilers.m4])
-m4_include([m4/cares-confopts.m4])
-m4_include([m4/cares-functions.m4])
-m4_include([m4/cares-reentrant.m4])
m4_include([m4/libtool.m4])
m4_include([m4/ltoptions.m4])
m4_include([m4/ltsugar.m4])
m4_include([m4/ltversion.m4])
m4_include([m4/lt~obsolete.m4])
-m4_include([m4/xc-am-iface.m4])
-m4_include([m4/xc-cc-check.m4])
-m4_include([m4/xc-lt-iface.m4])
-m4_include([m4/xc-translit.m4])
-m4_include([m4/xc-val-flgs.m4])
-m4_include([m4/zz40-xc-ovr.m4])
-m4_include([acinclude.m4])
+m4_include([m4/pkg.m4])
diff --git a/deps/cares/aminclude_static.am b/deps/cares/aminclude_static.am
index d35c73b8f4bf68..e3fc636c7b51a4 100644
--- a/deps/cares/aminclude_static.am
+++ b/deps/cares/aminclude_static.am
@@ -1,6 +1,6 @@
# aminclude_static.am generated automatically by Autoconf
-# from AX_AM_MACROS_STATIC on Sun Oct 8 23:23:39 CEST 2023
+# from AX_AM_MACROS_STATIC on Fri Feb 23 08:24:27 CET 2024
# Code coverage
diff --git a/deps/cares/cares.gyp b/deps/cares/cares.gyp
index 9797a3216ae882..e8ac0b75796e72 100644
--- a/deps/cares/cares.gyp
+++ b/deps/cares/cares.gyp
@@ -3,6 +3,7 @@
'cares_sources_common': [
'include/ares.h',
'include/ares_dns.h',
+ 'include/ares_dns_record.h',
'include/ares_nameser.h',
'include/ares_rules.h',
'include/ares_version.h',
@@ -11,28 +12,50 @@
'src/lib/ares__buf.c',
'src/lib/ares__buf.h',
'src/lib/ares__close_sockets.c',
+ 'src/lib/ares__hosts_file.c',
'src/lib/ares__htable.c',
'src/lib/ares__htable.h',
'src/lib/ares__htable_asvp.c',
'src/lib/ares__htable_asvp.h',
- 'src/lib/ares__htable_stvp.c',
- 'src/lib/ares__htable_stvp.h',
+ 'src/lib/ares__htable_strvp.c',
+ 'src/lib/ares__htable_strvp.h',
+ 'src/lib/ares__htable_szvp.c',
+ 'src/lib/ares__htable_szvp.h',
+ 'src/lib/ares__iface_ips.c',
+ 'src/lib/ares__iface_ips.h',
'src/lib/ares__llist.c',
'src/lib/ares__llist.h',
- 'src/lib/ares__get_hostent.c',
'src/lib/ares__parse_into_addrinfo.c',
'src/lib/ares__read_line.c',
- 'src/lib/ares__readaddrinfo.c',
'src/lib/ares__slist.c',
'src/lib/ares__slist.h',
+ 'src/lib/ares__socket.c',
'src/lib/ares__sortaddrinfo.c',
+ 'src/lib/ares__threads.c',
+ 'src/lib/ares__threads.h',
'src/lib/ares__timeval.c',
'src/lib/ares_android.c',
+ 'src/lib/ares_android.h',
'src/lib/ares_cancel.c',
'src/lib/ares_create_query.c',
'src/lib/ares_data.c',
'src/lib/ares_data.h',
'src/lib/ares_destroy.c',
+ 'src/lib/ares_dns_mapping.c',
+ 'src/lib/ares_dns_name.c',
+ 'src/lib/ares_dns_parse.c',
+ 'src/lib/ares_dns_record.c',
+ 'src/lib/ares_dns_private.h',
+ 'src/lib/ares_dns_write.c',
+ 'src/lib/ares_event.h',
+ 'src/lib/ares_event_win32.h',
+ 'src/lib/ares_event_epoll.c',
+ 'src/lib/ares_event_kqueue.c',
+ 'src/lib/ares_event_poll.c',
+ 'src/lib/ares_event_select.c',
+ 'src/lib/ares_event_thread.c',
+ 'src/lib/ares_event_wake_pipe.c',
+ 'src/lib/ares_event_win32.c',
'src/lib/ares_expand_name.c',
'src/lib/ares_expand_string.c',
'src/lib/ares_fds.c',
@@ -40,6 +63,7 @@
'src/lib/ares_free_string.c',
'src/lib/ares_freeaddrinfo.c',
'src/lib/ares_getaddrinfo.c',
+ 'src/lib/ares_getenv.c',
'src/lib/ares_getenv.h',
'src/lib/ares_gethostbyaddr.c',
'src/lib/ares_gethostbyname.c',
@@ -47,11 +71,10 @@
'src/lib/ares_getsock.c',
'src/lib/ares_inet_net_pton.h',
'src/lib/ares_init.c',
- 'src/lib/ares_ipv6.h',
'src/lib/ares_library_init.c',
+ 'src/lib/ares_ipv6.h',
+ 'src/lib/ares_math.c',
'src/lib/ares_mkquery.c',
- 'src/lib/ares_nowarn.c',
- 'src/lib/ares_nowarn.h',
'src/lib/ares_options.c',
'src/lib/ares_parse_a_reply.c',
'src/lib/ares_parse_aaaa_reply.c',
@@ -64,9 +87,11 @@
'src/lib/ares_parse_srv_reply.c',
'src/lib/ares_parse_txt_reply.c',
'src/lib/ares_parse_uri_reply.c',
+ 'src/lib/ares_platform.c',
'src/lib/ares_platform.h',
'src/lib/ares_private.h',
'src/lib/ares_process.c',
+ 'src/lib/ares_qcache.c',
'src/lib/ares_query.c',
'src/lib/ares_rand.c',
'src/lib/ares_search.c',
@@ -74,14 +99,16 @@
'src/lib/ares_setup.h',
'src/lib/ares_strcasecmp.c',
'src/lib/ares_strcasecmp.h',
- 'src/lib/ares_strdup.c',
- 'src/lib/ares_strdup.h',
+ 'src/lib/ares_str.c',
+ 'src/lib/ares_str.h',
'src/lib/ares_strerror.c',
'src/lib/ares_strsplit.c',
+ 'src/lib/ares_strsplit.h',
+ 'src/lib/ares_sysconfig.c',
+ 'src/lib/ares_sysconfig_files.c',
'src/lib/ares_timeout.c',
+ 'src/lib/ares_update_servers.c',
'src/lib/ares_version.c',
- 'src/lib/bitncmp.c',
- 'src/lib/bitncmp.h',
'src/lib/inet_net_pton.c',
'src/lib/inet_ntop.c',
'src/lib/setup_once.h',
@@ -91,9 +118,6 @@
'cares_sources_win': [
'src/lib/config-win32.h',
'src/lib/windows_port.c',
- 'src/lib/ares_getenv.c',
- 'src/lib/ares_iphlpapi.h',
- 'src/lib/ares_platform.c',
],
},
@@ -167,7 +191,7 @@
}],
[ 'OS not in "win android"', {
'cflags': [
- '--std=gnu89'
+ '--std=gnu11'
],
}],
[ 'OS=="linux"', {
diff --git a/deps/cares/cmake/EnableWarnings.cmake b/deps/cares/cmake/EnableWarnings.cmake
new file mode 100644
index 00000000000000..a394a8721f79b3
--- /dev/null
+++ b/deps/cares/cmake/EnableWarnings.cmake
@@ -0,0 +1,399 @@
+# Copyright (c) Monetra Technologies LLC
+# SPDX-License-Identifier: MIT
+
+# EnableWarnings.cmake
+#
+# Checks for and turns on a large number of warning C flags.
+#
+# Adds the following helper functions:
+#
+# remove_warnings(... list of warnings ...)
+# Turn off given list of individual warnings for all targets and subdirectories added after this.
+#
+# remove_all_warnings()
+# Remove all warning flags, add -w to suppress built-in warnings.
+#
+# remove_all_warnings_from_targets(... list of targets ...)
+# Suppress warnings for the given targets only.
+#
+# push_warnings()
+# Save current warning flags by pushing them onto an internal stack. Note that modifications to the internal
+# stack are only visible in the current CMakeLists.txt file and its children.
+#
+# Note: changing warning flags multiple times in the same directory only affects add_subdirectory() calls.
+# Targets in the directory will always use the warning flags in effect at the end of the CMakeLists.txt
+# file - this is due to really weird and annoying legacy behavior of CMAKE_C_FLAGS.
+#
+# pop_warnings()
+# Restore the last set of flags that were saved with push_warnings(). Note that modifications to the internal
+# stack are only visible in the current CMakeLists.txt file and its children.
+#
+
+if (_internal_enable_warnings_already_run)
+ return()
+endif ()
+set(_internal_enable_warnings_already_run TRUE)
+
+include(CheckCCompilerFlag)
+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
+
+
+# This function can be called in subdirectories, to prune out warnings that they don't want.
+# vararg: warning flags to remove from list of enabled warnings. All "no" flags after EXPLICIT_DISABLE
+# will be added to C flags.
+#
+# Ex.: remove_warnings(-Wall -Wdouble-promotion -Wcomment) prunes those warnings flags from the compile command.
+function(remove_warnings)
+ get_property(languages GLOBAL PROPERTY ENABLED_LANGUAGES)
+ set(langs C)
+ if ("CXX" IN_LIST languages)
+ list(APPEND langs CXX)
+ endif ()
+
+ foreach(lang ${langs})
+ set(toadd)
+ set(in_explicit_disable FALSE)
+ foreach (flag ${ARGN})
+ if (flag STREQUAL "EXPLICIT_DISABLE")
+ set(in_explicit_disable TRUE)
+ elseif (in_explicit_disable)
+ list(APPEND toadd "${flag}")
+ else ()
+ string(REGEX REPLACE "${flag}([ \t]+|$)" "" CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS}")
+ endif ()
+ endforeach ()
+ _int_enable_warnings_set_flags(lang ${toadd})
+ string(STRIP "${CMAKE_${lang}_FLAGS}" CMAKE_${lang}_FLAGS)
+ set(CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS}" PARENT_SCOPE)
+ endforeach()
+endfunction()
+
+
+# Explicitly suppress all warnings. As long as this flag is the last warning flag, warnings will be
+# suppressed even if earlier flags enabled warnings.
+function(remove_all_warnings)
+ get_property(languages GLOBAL PROPERTY ENABLED_LANGUAGES)
+ set(langs C)
+ if ("CXX" IN_LIST languages)
+ list(APPEND langs CXX)
+ endif ()
+
+ foreach(lang ${langs})
+ string(REGEX REPLACE "[-/][Ww][^ \t]*([ \t]+|$)" "" CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS}")
+ if (MSVC)
+ string(APPEND CMAKE_${lang}_FLAGS " /w")
+ else ()
+ string(APPEND CMAKE_${lang}_FLAGS " -w")
+ endif ()
+ string(STRIP "${CMAKE_${lang}_FLAGS}" CMAKE_${lang}_FLAGS)
+ set(CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS}" PARENT_SCOPE)
+ endforeach()
+endfunction()
+
+
+function(remove_all_warnings_from_targets)
+ foreach (target ${ARGN})
+ if (MSVC)
+ target_compile_options(${target} PRIVATE "/w")
+ else ()
+ target_compile_options(${target} PRIVATE "-w")
+ endif ()
+ endforeach()
+endfunction()
+
+
+# Save the current warning settings to an internal variable.
+function(push_warnings)
+ get_property(languages GLOBAL PROPERTY ENABLED_LANGUAGES)
+ set(langs C)
+ if ("CXX" IN_LIST languages)
+ list(APPEND langs CXX)
+ endif ()
+
+ foreach(lang ${langs})
+ if (CMAKE_${lang}_FLAGS MATCHES ";")
+ message(AUTHOR_WARNING "Cannot push warnings for ${lang}, CMAKE_${lang}_FLAGS contains semicolons")
+ continue()
+ endif ()
+ # Add current flags to end of internal list.
+ list(APPEND _enable_warnings_internal_${lang}_flags_stack "${CMAKE_${lang}_FLAGS}")
+ # Propagate results up to caller's scope.
+ set(_enable_warnings_internal_${lang}_flags_stack "${_enable_warnings_internal_${lang}_flags_stack}" PARENT_SCOPE)
+ endforeach()
+endfunction()
+
+
+# Restore the current warning settings from an internal variable.
+function(pop_warnings)
+ get_property(languages GLOBAL PROPERTY ENABLED_LANGUAGES)
+ set(langs C)
+ if ("CXX" IN_LIST languages)
+ list(APPEND langs CXX)
+ endif ()
+
+ foreach(lang ${langs})
+ if (NOT _enable_warnings_internal_${lang}_flags_stack)
+ continue()
+ endif ()
+ # Pop flags off of end of list, overwrite current flags with whatever we popped off.
+ list(GET _enable_warnings_internal_${lang}_flags_stack -1 CMAKE_${lang}_FLAGS)
+ list(REMOVE_AT _enable_warnings_internal_${lang}_flags_stack -1)
+ # Propagate results up to caller's scope.
+ set(_enable_warnings_internal_${lang}_flags_stack "${_enable_warnings_internal_${lang}_flags_stack}" PARENT_SCOPE)
+ string(STRIP "${CMAKE_${lang}_FLAGS}" CMAKE_${lang}_FLAGS)
+ set(CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS}" PARENT_SCOPE)
+ endforeach()
+endfunction()
diff --git a/deps/cares/config/aix/ares_config.h b/deps/cares/config/aix/ares_config.h
index de536cd4673611..55a219b0533bf0 100644
--- a/deps/cares/config/aix/ares_config.h
+++ b/deps/cares/config/aix/ares_config.h
@@ -1,60 +1,51 @@
-/* ares_config.h. Generated from ares_config.h.in by configure. */
-/* ares_config.h.in. Generated from configure.ac by autoheader. */
+/* src/lib/ares_config.h. Generated from ares_config.h.in by configure. */
+/* src/lib/ares_config.h.in. Generated from configure.ac by autoheader. */
-/* Define if building universal (internal helper macro) */
-/* #undef AC_APPLE_UNIVERSAL_BUILD */
-
-/* define this if ares is built for a big endian system */
-#define ARES_BIG_ENDIAN 1
-
-/* when building as static part of libcurl */
-/* #undef BUILDING_LIBCURL */
+/* a suitable file/device to read random data from */
+#define CARES_RANDOM_FILE "/dev/urandom"
-/* Defined for build that exposes internal static functions for testing. */
-/* #undef CARES_EXPOSE_STATICS */
+/* Set to 1 if non-pubilc shared library symbols are hidden */
+#define CARES_SYMBOL_HIDING 1
-/* Defined for build with symbol hiding. */
-/* #undef CARES_SYMBOL_HIDING */
+/* Threading enabled */
+#define CARES_THREADS 1
/* the signed version of size_t */
#define CARES_TYPEOF_ARES_SSIZE_T ssize_t
-/* Definition to make a library symbol externally visible. */
-/* #undef CARES_SYMBOL_SCOPE_EXTERN */
-
/* Use resolver library to configure cares */
/* #undef CARES_USE_LIBRESOLV */
/* if a /etc/inet dir is being used */
/* #undef ETC_INET */
-/* Define to the type of arg 2 for gethostname. */
-#define GETHOSTNAME_TYPE_ARG2 size_t
-
-/* Define to the type qualifier of arg 1 for getnameinfo. */
-#define GETNAMEINFO_QUAL_ARG1 const
+/* gethostname() arg2 type */
+#define GETHOSTNAME_TYPE_ARG2 size_t
-/* Define to the type of arg 1 for getnameinfo. */
-#define GETNAMEINFO_TYPE_ARG1 struct sockaddr *
+/* getnameinfo() arg1 type */
+#define GETNAMEINFO_TYPE_ARG1 struct sockaddr *
-/* Define to the type of arg 2 for getnameinfo. */
-#define GETNAMEINFO_TYPE_ARG2 socklen_t
+/* getnameinfo() arg2 type */
+#define GETNAMEINFO_TYPE_ARG2 socklen_t
-/* Define to the type of args 4 and 6 for getnameinfo. */
-#define GETNAMEINFO_TYPE_ARG46 size_t
+/* getnameinfo() arg4 and 6 type */
+#define GETNAMEINFO_TYPE_ARG46 socklen_t
-/* Define to the type of arg 7 for getnameinfo. */
-#define GETNAMEINFO_TYPE_ARG7 int
+/* getnameinfo() arg7 type */
+#define GETNAMEINFO_TYPE_ARG7 int
-/* Specifies the number of arguments to getservbyport_r */
-#define GETSERVBYPORT_R_ARGS 4
+/* number of arguments for getservbyname_r() */
+/* #undef GETSERVBYNAME_R_ARGS */
-/* Specifies the size of the buffer to pass to getservbyport_r */
-#define GETSERVBYPORT_R_BUFSIZE sizeof(struct servent_data)
+/* number of arguments for getservbyport_r() */
+#define GETSERVBYPORT_R_ARGS 4
-/* Define to 1 if you have AF_INET6. */
+/* Define to 1 if you have AF_INET6 */
#define HAVE_AF_INET6 1
+/* Define to 1 if you have `arc4random_buf` */
+/* #undef HAVE_ARC4RANDOM_BUF */
+
/* Define to 1 if you have the header file. */
#define HAVE_ARPA_INET_H 1
@@ -67,129 +58,131 @@
/* Define to 1 if you have the |