Merge branch 'develop'

This commit is contained in:
Willem Toorop 2018-03-12 12:25:58 +01:00
commit a820c0124d
65 changed files with 313 additions and 314 deletions

1
.gitignore vendored
View File

@ -39,6 +39,7 @@ src/test/check_getdns_ev
src/test/scratchpad
src/test/scratchpad.c
src/tools/getdns_query
src/tools/getdns_server_mon
src/stubby
doc/*.3
src/getdns/getdns.h

4
.gitmodules vendored
View File

@ -4,7 +4,8 @@
branch = getdns
[submodule "src/yxml"]
path = src/yxml
url = git://g.blicky.net/yxml.git
url = https://github.com/getdnsapi/yxml.git
branch = master
[submodule "stubby"]
path = stubby
url = https://github.com/getdnsapi/stubby.git
@ -12,3 +13,4 @@
[submodule "src/ssl_dane"]
path = src/ssl_dane
url = https://github.com/getdnsapi/ssl_dane
branch = getdns

View File

@ -1,3 +1,21 @@
* 2018-03-12: Version 1.4.1
* Bugfix #388: Prevent fallback to an earlier tries upstream within a
single query. Thanks Robert Groenenberg
* PR #387: Compile with OpenSSL with deprecated APIs disabled.
Thanks Rosen Penev
* PR #386: UDP failover improvements:
- When all UDP upstreams fail, retry them (more or less) equally
- Limit maximum UDP backoff (default to 1000)
This is configurable with the --with-max-udp-backoff configure
option.
Thanks Robert Groenenberg
* Bugfix: Find zonecut with DS queries (instead of SOA queries).
Thanks Elmer Lastdrager
* Bugfix #385: Verifying insecure NODATA answers (broken since 1.2.1).
Thanks hanvinke
* PR #384: Fix minor spelling and formatting. Thanks dkg.
* Bugfix #382: Parallel install of getdns_query and getdns_server_mon
* 2018-02-21: Version 1.4.0
* .so revision bump to please fedora packaging system.
Thanks Paul Wouters
@ -18,7 +36,7 @@
be wildcard expansions when used with DNSSEC proofs. Only direct
queries for those types are allowed to be wildcard expansions.
* Bugfix PR#379: Miscelleneous double free or corruption, and corrupted
memory double linked list detected issue, whith serving functionality.
memory double linked list detected issue, with serving functionality.
Thanks maddie and Bruno Pagani
* Security Bugfix PR#293: Check sha256 pinset's
with OpenSSL native DANE functions for OpenSSL >= 1.1.0
@ -235,7 +253,7 @@
Allow misshing "address_type" in address dicts.
* TLS session resumption
* -C <config file> option to getdns_query to configure context
from a json like formated file. The output of -i (print API
from a json like formatted file. The output of -i (print API
information) can be used as config file directly.
Settings may also be given in this format as arguments of
the getdns_query command directly.
@ -384,7 +402,7 @@
* 2015-09-04: Version 0.3.2
* Fix returned upstreams list by getdns_context_get_api_information()
* Fix some autoconf issues when srcdir != builddir
* Fix remove build date from manpage version for reproducable builds
* Fix remove build date from manpage version for reproducible builds
* Fix transport fallback issues plus transport fallback unit test script
* Fix string bindata's need not contain trailing zero byte
* --enable-stub-only configure option for stub only operation.
@ -537,7 +555,7 @@
* Build from separate build directory
* Anticipate libunbound not returning the answer packet
* Pretty print bindata's representing IP addresses
* Anticipate absense of implicit DSO linking
* Anticipate absence of implicit DSO linking
* Mention getdns specific options to configure in INSTALL
Thanks Paul Hoffman
* Mac OSX package built instructions for generic user in README.md

View File

@ -128,7 +128,7 @@ install-getdns_query: install-lib
uninstall-getdns_query:
cd src/tools && $(MAKE) $@
install-getdns_server_mon: install-lib
install-getdns_server_mon: install-lib @INSTALL_GETDNS_QUERY@
cd src/tools && $(MAKE) $@
uninstall-getdns_server_mon:

View File

@ -36,7 +36,7 @@ sinclude(./m4/acx_getaddrinfo.m4)
sinclude(./m4/ax_check_compile_flag.m4)
sinclude(./m4/pkg.m4)
AC_INIT([getdns], [1.4.0], [team@getdnsapi.net], [getdns], [https://getdnsapi.net])
AC_INIT([getdns], [1.4.1], [team@getdnsapi.net], [getdns], [https://getdnsapi.net])
# Autoconf 2.70 will have set up runstatedir. 2.69 is frequently (Debian)
# patched to do the same, but frequently (MacOS) not. So add a with option
@ -49,10 +49,11 @@ AC_ARG_WITH([piddir],
[with_piddir=${default_piddir}])
AC_SUBST([runstatedir], [$with_piddir])
# Dont forget to put a dash in front of the release candidate!!!
# Don't forget to put a dash in front of the release candidate!!!
# That is how it is done with semantic versioning!
#
AC_SUBST(RELEASE_CANDIDATE, [])
AC_SUBST(STUBBY_RELEASE_CANDIDATE, [])
# Set current date from system if not set
AC_ARG_WITH([current-date],
@ -62,13 +63,13 @@ AC_ARG_WITH([current-date],
[CURRENT_DATE="`date -u +%Y-%m-%dT%H:%M:%SZ`"])
AC_SUBST(GETDNS_VERSION, ["AC_PACKAGE_VERSION$RELEASE_CANDIDATE"])
AC_SUBST(GETDNS_NUMERIC_VERSION, [0x01040000])
AC_SUBST(GETDNS_NUMERIC_VERSION, [0x01040100])
AC_SUBST(API_VERSION, ["December 2015"])
AC_SUBST(API_NUMERIC_VERSION, [0x07df0c00])
GETDNS_COMPILATION_COMMENT="AC_PACKAGE_NAME $GETDNS_VERSION configured on $CURRENT_DATE for the $API_VERSION version of the API"
AC_DEFINE_UNQUOTED([STUBBY_PACKAGE], ["stubby"], [Stubby package])
AC_DEFINE_UNQUOTED([STUBBY_PACKAGE_STRING], ["0.2.2$RELEASE_CANDIDATE"], [Stubby package string])
AC_DEFINE_UNQUOTED([STUBBY_PACKAGE_STRING], ["0.2.2$STUBBY_RELEASE_CANDIDATE"], [Stubby package string])
# Library version
# ---------------
@ -102,9 +103,10 @@ AC_DEFINE_UNQUOTED([STUBBY_PACKAGE_STRING], ["0.2.2$RELEASE_CANDIDATE"], [Stubby
# getdns-1.2.0 had libversion 8:0:2
# getdns-1.2.1 had libversion 8:1:2
# getdns-1.3.0 had libversion 9:0:3
# getdns-1.4.0 has libversion 10:0:0
# getdns-1.4.0 had libversion 10:0:0
# getdns-1.4.1 has libversion 10:1:0
#
GETDNS_LIBVERSION=10:0:0
GETDNS_LIBVERSION=10:1:0
AC_SUBST(GETDNS_COMPILATION_COMMENT)
AC_SUBST(GETDNS_LIBVERSION)
@ -377,6 +379,10 @@ no)
;;
esac
AC_ARG_WITH(max-udp-backoff, AS_HELP_STRING([--with-max-udp-backoff=<number of queries>],
[Set the maximum number of messages that can be sent to other upstreams before the upstream which has previously timed out will be tried again. (defaults to 1000)]),, [withval="1000"])
AC_DEFINE_UNQUOTED([UDP_MAX_BACKOFF], [$withval], [Maximum number of queries an failed UDP upstream passes before it will retry])
#---- check for pthreads library
AC_ARG_WITH(libpthread, AS_HELP_STRING([--without-libpthread],
[Disable libpthread (default is autodetect)]),
@ -630,7 +636,27 @@ case "$enable_dsa" in
*) dnl default
# detect if DSA is supported, and turn it off if not.
AC_CHECK_FUNC(DSA_SIG_new, [
AC_DEFINE_UNQUOTED([USE_DSA], [1], [Define this to enable DSA support.])
AC_CHECK_TYPE(DSA_SIG*, [
AC_DEFINE_UNQUOTED([USE_DSA], [1], [Define this to enable DSA support.])
], [if test "x$enable_dsa" = "xyes"; then AC_MSG_ERROR([OpenSSL does not support DSA and you used --enable-dsa.])
fi ], [
AC_INCLUDES_DEFAULT
#ifdef HAVE_OPENSSL_ENGINE_H
# include <openssl/engine.h>
#endif
#ifdef HAVE_OPENSSL_RAND_H
#include <openssl/rand.h>
#endif
#ifdef HAVE_OPENSSL_CONF_H
#include <openssl/conf.h>
#endif
#ifdef HAVE_OPENSSL_ENGINE_H
#include <openssl/engine.h>
#endif
])
], [if test "x$enable_dsa" = "xyes"; then AC_MSG_ERROR([OpenSSL does not support DSA and you used --enable-dsa.])
fi ])
;;
@ -1469,7 +1495,7 @@ AH_BOTTOM([
#ifdef GETDNS_ON_WINDOWS
/* On windows it is allowed to increase the FD_SETSIZE
* (and nescessary to make our custom eventloop work)
* (and necessary to make our custom eventloop work)
* See: https://support.microsoft.com/en-us/kb/111855
*/
# ifndef FD_SETSIZE

View File

@ -53,9 +53,9 @@ Local configuration via API or local file (e.g. /etc/getdns.conf, ~/.getdnsrc)
- max TTL/TTL override (separate for pos/neg cache entries)
- inclusions (use cache for specified domains) (maybe over-eng)
- exceptions (avoid ache for specified domains) (maybe over-eng)
- persistant vs. transitory cache
- persistent vs. transitory cache
- cache data store via Berkely db to allow for persistance
- cache data store via Berkely db to allow for persistence
- negative cache TTL derived from SOA

View File

@ -31,7 +31,7 @@ void callback(getdns_context *context,
assert( callback_type == GETDNS_CALLBACK_COMPLETE );
if ((r = getdns_dict_get_list(response, "/replies_tree/0/answer", &answer)))
fprintf(stderr, "Could not get \"answer\" section from first reply in the reponse");
fprintf(stderr, "Could not get \"answer\" section from first reply in the response");
else if ((r = getdns_list_get_length(answer, &n_answers)))
fprintf(stderr, "Could not get replies_tree\'s length");

View File

@ -35,7 +35,7 @@ void callback(getdns_context *context,
assert( callback_type == GETDNS_CALLBACK_COMPLETE );
if ((r = getdns_dict_get_int(response, "status", &status)))
fprintf(stderr, "Could not get \"status\" from reponse");
fprintf(stderr, "Could not get \"status\" from response");
else if (status != GETDNS_RESPSTATUS_GOOD)
fprintf(stderr, "The search had no results, and a return value of %"PRIu32".\n", status);

View File

@ -31,7 +31,7 @@ void callback(getdns_context *context,
assert( callback_type == GETDNS_CALLBACK_COMPLETE );
if ((r = getdns_dict_get_list(response, "replies_tree", &replies_tree)))
fprintf(stderr, "Could not get \"replies_tree\" from reponse");
fprintf(stderr, "Could not get \"replies_tree\" from response");
else if ((r = getdns_list_get_length(replies_tree, &n_replies)))
fprintf(stderr, "Could not get replies_tree\'s length");

View File

@ -173,7 +173,7 @@ extensions. See <a href="#Extensions">the section below</a> for information on h
the extensions used for a request.</p>
<p class=define><code><b>*userarg</b></code></p>
<p class=descrip>A void* that is passed to the function, which the funciton
<p class=descrip>A void* that is passed to the function, which the function
returns to the callback function untouched. <code>userarg</code> can be used by the callback
function for any user-specific data needed. This can be NULL.</p>
@ -1507,7 +1507,7 @@ function.</p>
<span class="n">assert</span><span class="p">(</span> <span class="n">callback_type</span> <span class="o">==</span> <span class="n">GETDNS_CALLBACK_COMPLETE</span> <span class="p">);</span>
<span class="k">if</span> <span class="p">((</span><span class="n">r</span> <span class="o">=</span> <span class="n">getdns_dict_get_int</span><span class="p">(</span><span class="n">response</span><span class="p">,</span> <span class="s">&quot;status&quot;</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">status</span><span class="p">)))</span>
<span class="n">fprintf</span><span class="p">(</span><span class="n">stderr</span><span class="p">,</span> <span class="s">&quot;Could not get </span><span class="se">\&quot;</span><span class="s">status</span><span class="se">\&quot;</span><span class="s"> from reponse&quot;</span><span class="p">);</span>
<span class="n">fprintf</span><span class="p">(</span><span class="n">stderr</span><span class="p">,</span> <span class="s">&quot;Could not get </span><span class="se">\&quot;</span><span class="s">status</span><span class="se">\&quot;</span><span class="s"> from response&quot;</span><span class="p">);</span>
<span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="n">status</span> <span class="o">!=</span> <span class="n">GETDNS_RESPSTATUS_GOOD</span><span class="p">)</span>
<span class="n">fprintf</span><span class="p">(</span><span class="n">stderr</span><span class="p">,</span> <span class="s">&quot;The search had no results, and a return value of %&quot;</span><span class="n">PRIu32</span><span class="s">&quot;.</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">,</span> <span class="n">status</span><span class="p">);</span>
@ -1622,7 +1622,7 @@ their TTLs.</p>
<span class="n">assert</span><span class="p">(</span> <span class="n">callback_type</span> <span class="o">==</span> <span class="n">GETDNS_CALLBACK_COMPLETE</span> <span class="p">);</span>
<span class="k">if</span> <span class="p">((</span><span class="n">r</span> <span class="o">=</span> <span class="n">getdns_dict_get_list</span><span class="p">(</span><span class="n">response</span><span class="p">,</span> <span class="s">&quot;replies_tree&quot;</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">replies_tree</span><span class="p">)))</span>
<span class="n">fprintf</span><span class="p">(</span><span class="n">stderr</span><span class="p">,</span> <span class="s">&quot;Could not get </span><span class="se">\&quot;</span><span class="s">replies_tree</span><span class="se">\&quot;</span><span class="s"> from reponse&quot;</span><span class="p">);</span>
<span class="n">fprintf</span><span class="p">(</span><span class="n">stderr</span><span class="p">,</span> <span class="s">&quot;Could not get </span><span class="se">\&quot;</span><span class="s">replies_tree</span><span class="se">\&quot;</span><span class="s"> from response&quot;</span><span class="p">);</span>
<span class="k">else</span> <span class="k">if</span> <span class="p">((</span><span class="n">r</span> <span class="o">=</span> <span class="n">getdns_list_get_length</span><span class="p">(</span><span class="n">replies_tree</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">n_replies</span><span class="p">)))</span>
<span class="n">fprintf</span><span class="p">(</span><span class="n">stderr</span><span class="p">,</span> <span class="s">&quot;Could not get replies_tree</span><span class="se">\&#39;</span><span class="s">s length&quot;</span><span class="p">);</span>
@ -1854,7 +1854,7 @@ as it is for the synchronous example, it is just done in <code>main()</code>.</p
<span class="n">assert</span><span class="p">(</span> <span class="n">callback_type</span> <span class="o">==</span> <span class="n">GETDNS_CALLBACK_COMPLETE</span> <span class="p">);</span>
<span class="k">if</span> <span class="p">((</span><span class="n">r</span> <span class="o">=</span> <span class="n">getdns_dict_get_list</span><span class="p">(</span><span class="n">response</span><span class="p">,</span> <span class="s">&quot;/replies_tree/0/answer&quot;</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">answer</span><span class="p">)))</span>
<span class="n">fprintf</span><span class="p">(</span><span class="n">stderr</span><span class="p">,</span> <span class="s">&quot;Could not get </span><span class="se">\&quot;</span><span class="s">answer</span><span class="se">\&quot;</span><span class="s"> section from first reply in the reponse&quot;</span><span class="p">);</span>
<span class="n">fprintf</span><span class="p">(</span><span class="n">stderr</span><span class="p">,</span> <span class="s">&quot;Could not get </span><span class="se">\&quot;</span><span class="s">answer</span><span class="se">\&quot;</span><span class="s"> section from first reply in the response&quot;</span><span class="p">);</span>
<span class="k">else</span> <span class="k">if</span> <span class="p">((</span><span class="n">r</span> <span class="o">=</span> <span class="n">getdns_list_get_length</span><span class="p">(</span><span class="n">answer</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">n_answers</span><span class="p">)))</span>
<span class="n">fprintf</span><span class="p">(</span><span class="n">stderr</span><span class="p">,</span> <span class="s">&quot;Could not get replies_tree</span><span class="se">\&#39;</span><span class="s">s length&quot;</span><span class="p">);</span>

View File

@ -93,6 +93,7 @@ static struct const_info consts_info[] = {
{ 632, "GETDNS_CONTEXT_CODE_TLS_CA_FILE", GETDNS_CONTEXT_CODE_TLS_CA_FILE_TEXT },
{ 633, "GETDNS_CONTEXT_CODE_TLS_CIPHER_LIST", GETDNS_CONTEXT_CODE_TLS_CIPHER_LIST_TEXT },
{ 634, "GETDNS_CONTEXT_CODE_TLS_CURVES_LIST", GETDNS_CONTEXT_CODE_TLS_CURVES_LIST_TEXT },
{ 699, "GETDNS_CONTEXT_CODE_MAX_BACKOFF_VALUE", GETDNS_CONTEXT_CODE_MAX_BACKOFF_VALUE_TEXT },
{ 700, "GETDNS_CALLBACK_COMPLETE", GETDNS_CALLBACK_COMPLETE_TEXT },
{ 701, "GETDNS_CALLBACK_CANCEL", GETDNS_CALLBACK_CANCEL_TEXT },
{ 702, "GETDNS_CALLBACK_TIMEOUT", GETDNS_CALLBACK_TIMEOUT_TEXT },
@ -176,6 +177,7 @@ static struct const_name_info consts_name_info[] = {
{ "GETDNS_CONTEXT_CODE_HOSTS", 630 },
{ "GETDNS_CONTEXT_CODE_IDLE_TIMEOUT", 617 },
{ "GETDNS_CONTEXT_CODE_LIMIT_OUTSTANDING_QUERIES", 606 },
{ "GETDNS_CONTEXT_CODE_MAX_BACKOFF_VALUE", 699 },
{ "GETDNS_CONTEXT_CODE_MEMORY_FUNCTIONS", 615 },
{ "GETDNS_CONTEXT_CODE_NAMESPACES", 600 },
{ "GETDNS_CONTEXT_CODE_PUBKEY_PINSET", 621 },

View File

@ -39,6 +39,14 @@
#ifndef CONST_INFO_H_
#define CONST_INFO_H_
#include "getdns/getdns.h"
#include "getdns/getdns_extra.h"
#ifndef GETDNS_CONTEXT_CODE_MAX_BACKOFF_VALUE
#define GETDNS_CONTEXT_CODE_MAX_BACKOFF_VALUE 699
#define GETDNS_CONTEXT_CODE_MAX_BACKOFF_VALUE_TEXT "Change related to getdns_context_set_max_backoff_value"
#endif
struct const_info {
int code;
const char *name;

View File

@ -93,6 +93,7 @@ typedef unsigned short in_port_t;
#ifdef USE_DANESSL
# include "ssl_dane/danessl.h"
#endif
#include "const-info.h"
#define GETDNS_PORT_ZERO 0
#define GETDNS_PORT_DNS 53
@ -679,6 +680,7 @@ upstreams_create(getdns_context *context, size_t size)
r->count = 0;
r->current_udp = 0;
r->current_stateful = 0;
r->max_backoff_value = context->max_backoff_value;
r->tls_backoff_time = context->tls_backoff_time;
r->tls_connection_retries = context->tls_connection_retries;
r->log = context->log;
@ -1664,6 +1666,7 @@ getdns_context_create_with_extended_memory_functions(
result->tls_backoff_time = 3600;
result->tls_connection_retries = 2;
result->limit_outstanding_queries = 0;
result->max_backoff_value = UDP_MAX_BACKOFF;
/* unbound context is initialized here */
/* Unbound needs SSL to be init'ed this early when TLS is used. However we
@ -2362,6 +2365,28 @@ getdns_context_set_round_robin_upstreams(getdns_context *context, uint8_t value)
return GETDNS_RETURN_GOOD;
} /* getdns_context_set_round_robin_upstreams */
/**
* Set the maximum number of messages that can be sent to other upstreams
* before the upstream which has previously timed out will be tried again.
* @see getdns_context_get_max_backoff_value
* @param[in] context The context to configure
* @param[in[ value Number of messages sent to other upstreams before
* retrying the upstream which had timed out.
* @return GETDNS_RETURN_GOOD on success
* @return GETDNS_RETURN_INVALID_PARAMETER if context is null.
*/
getdns_return_t
getdns_context_set_max_backoff_value(getdns_context *context, uint16_t value)
{
RETURN_IF_NULL(context, GETDNS_RETURN_INVALID_PARAMETER);
context->max_backoff_value = value;
dispatch_updated(context, GETDNS_CONTEXT_CODE_MAX_BACKOFF_VALUE);
return GETDNS_RETURN_GOOD;
} /* getdns_context_set_max_backoff_value */
/*
* getdns_context_set_tls_backoff_time
*
@ -3931,6 +3956,8 @@ _get_context_settings(getdns_context* context)
context->tls_auth)
|| getdns_dict_set_int(result, "round_robin_upstreams",
context->round_robin_upstreams)
|| getdns_dict_set_int(result, "max_backoff_value",
context->max_backoff_value)
|| getdns_dict_set_int(result, "tls_backoff_time",
context->tls_backoff_time)
|| getdns_dict_set_int(result, "tls_connection_retries",
@ -4378,6 +4405,25 @@ getdns_context_get_round_robin_upstreams(getdns_context *context,
return GETDNS_RETURN_GOOD;
}
/**
* Get the maximum number of messages that can be sent to other upstreams
* before the upstream which has previously timed out will be tried again.
* @see getdns_context_set_max_backoff_value
* @param[in] context The context from which to get the setting
* @param[out] value Number of messages sent to other upstreams before
* retrying the upstream which had timed out.
* @return GETDNS_RETURN_GOOD on success
* @return GETDNS_RETURN_INVALID_PARAMETER if context is null.
*/
getdns_return_t
getdns_context_get_max_backoff_value(getdns_context *context,
uint16_t* value) {
RETURN_IF_NULL(context, GETDNS_RETURN_INVALID_PARAMETER);
RETURN_IF_NULL(value, GETDNS_RETURN_INVALID_PARAMETER);
*value = context->max_backoff_value;
return GETDNS_RETURN_GOOD;
}
getdns_return_t
getdns_context_get_tls_backoff_time(getdns_context *context,
uint16_t* value) {

View File

@ -263,6 +263,7 @@ typedef struct getdns_upstreams {
size_t count;
size_t current_udp;
size_t current_stateful;
uint16_t max_backoff_value;
uint16_t tls_backoff_time;
uint16_t tls_connection_retries;
getdns_log_config log;
@ -357,6 +358,7 @@ struct getdns_context {
getdns_tls_authentication_t tls_auth; /* What user requested for TLS*/
getdns_tls_authentication_t tls_auth_min; /* Derived minimum auth allowed*/
uint8_t round_robin_upstreams;
uint16_t max_backoff_value;
uint16_t tls_backoff_time;
uint16_t tls_connection_retries;

View File

@ -79,8 +79,8 @@
/* Outline of operations in this file
* ==================================
*
* Data structure to represent the delegation/referal hierarchy
* ------------------------------------------------------------
* Data structure to represent the delegation/referral hierarchy
* -------------------------------------------------------------
* Both the "dnssec_return_validation_chain" extension, and the
* getdns_validate_dnssec() function use the same structs to represent the
* involved pieces of the DNS in a hierarchical manner.
@ -134,7 +134,7 @@
* in a _getdns_rrset, and the rrsig_iter to iterate over the RRSIGs covering
* the RRs in the _getdns_rrset.
*
* The _getdns_rrsets are already equiped with name/rr_class and rr_type when
* The _getdns_rrsets are already equipped with name/rr_class and rr_type when
* constructing the linked list of chain_nodes up to the root for a chain_head.
* They are substantiated with the wireformat packets that are returned with
* the queries that were sheduled in the context of the
@ -146,7 +146,7 @@
* of non-existance.
*
* The getdns_validate_dnssec() function, after it constructed the chain_heads
* hierarchy, creates an artifical packet for the support records and equips
* hierarchy, creates an artificial packet for the support records and equips
* all the ds and dnskey _getdns_rrsets on the chain_nodes with this packet.
*
* The _getdns_rrset + support function and data types are defined in section:
@ -506,8 +506,6 @@ struct chain_node {
getdns_network_req *ds_req;
int ds_signer;
getdns_network_req *soa_req;
chain_head *chains;
};
@ -521,7 +519,6 @@ struct chain_node {
static void val_chain_sched(chain_head *head, const uint8_t *dname);
static void val_chain_sched_ds(chain_head *head, const uint8_t *dname);
static void val_chain_sched_signer(chain_head *head, _getdns_rrsig_iter *rrsig);
static void val_chain_sched_soa(chain_head *head, const uint8_t *dname);
static chain_head *add_rrset2val_chain(struct mem_funcs *mf,
chain_head **chain_p, _getdns_rrset *rrset, getdns_network_req *netreq)
@ -663,7 +660,6 @@ static chain_head *add_rrset2val_chain(struct mem_funcs *mf,
node->dnskey.sections = head->rrset.sections;
node->ds_req = NULL;
node->dnskey_req = NULL;
node->soa_req = NULL;
node->ds_signer = -1;
node->dnskey_signer = -1;
@ -822,9 +818,9 @@ static void add_pkt2val_chain(struct mem_funcs *mf,
if (rrset->rr_type == GETDNS_RRTYPE_SOA)
val_chain_sched_ds(head, rrset->name);
else if (rrset->rr_type == GETDNS_RRTYPE_CNAME)
val_chain_sched_soa(head, rrset->name + *rrset->name + 1);
val_chain_sched_ds(head, rrset->name + *rrset->name + 1);
else
val_chain_sched_soa(head, rrset->name);
val_chain_sched_ds(head, rrset->name);
}
}
@ -838,6 +834,11 @@ static void add_question2val_chain(struct mem_funcs *mf,
const uint8_t *qname, uint16_t qtype, uint16_t qclass,
getdns_network_req *netreq)
{
_getdns_rrset_iter *i, i_spc;
_getdns_rrset *rrset;
_getdns_rrsig_iter rrsig_spc;
size_t n_soas;
_getdns_rrset_spc q_rrset;
chain_head *head;
@ -863,9 +864,29 @@ static void add_question2val_chain(struct mem_funcs *mf,
debug_sec_print_rrset("Adding NX rrset: ", &q_rrset.rrset);
head = add_rrset2val_chain(mf, chain_p, &q_rrset.rrset, netreq);
/* On empty packet, find SOA (zonecut) for the qname */
if (head && GLDNS_ANCOUNT(pkt) == 0 && GLDNS_NSCOUNT(pkt) == 0)
val_chain_sched_soa(head, q_rrset.rrset.name);
/* Insecure SOA indicating a zonecut in the authority section?
* Then schedule a DS query at the zonecut for insecure proof.
*/
n_soas = 0;
for ( i = _getdns_rrset_iter_init(&i_spc, pkt, pkt_len
, SECTION_AUTHORITY)
; i ; i = _getdns_rrset_iter_next(i)) {
rrset = _getdns_rrset_iter_value(i);
debug_sec_print_rrset("rrset: ", rrset);
if (rrset->rr_type != GETDNS_RRTYPE_SOA)
continue;
n_soas += 1;
if (_getdns_rrsig_iter_init(&rrsig_spc, rrset))
continue;
val_chain_sched_ds(head, rrset->name);
}
/* No answer and no SOA indicating a zonecut? Find zonecut */
if (n_soas == 0)
val_chain_sched_ds(head, q_rrset.rrset.name);
}
@ -887,55 +908,6 @@ static getdns_dict *CD_extension(getdns_dns_req *dnsreq)
}
static void check_chain_complete(chain_head *chain);
static void val_chain_node_soa_cb(getdns_dns_req *dnsreq);
static void val_chain_sched_soa_node(chain_node *node)
{
getdns_context *context;
getdns_eventloop *loop;
char name[1024];
context = node->chains->netreq->owner->context;
loop = node->chains->netreq->owner->loop;
if (!gldns_wire2str_dname_buf(
(UNCONST_UINT8_p)node->ds.name, 256, name, sizeof(name)))
return;
DEBUG_SEC("schedule SOA lookup for %s\n", name);
node->lock++;
if (! node->soa_req &&
_getdns_general_loop(context, loop, name, GETDNS_RRTYPE_SOA,
CD_extension(node->chains->netreq->owner), node, &node->soa_req,
NULL, val_chain_node_soa_cb))
node->soa_req = NULL;
if (node->lock) node->lock--;
}
/* A SOA lookup is scheduled as a last resort. No signatures were found and
* no SOA in the authority section. If a SOA query returns an actual SOA
* answer, then a DS/DNSKEY lookup will follow the acquire the link of the
* authentication chain.
*/
static void val_chain_sched_soa(chain_head *head, const uint8_t *dname)
{
chain_node *node;
if (!head->netreq)
return;
if (!*dname)
return;
for ( node = head->parent
; node && !_dname_equal(dname, node->ds.name)
; node = node->parent);
if (node)
val_chain_sched_soa_node(node);
}
static chain_head *_dnskey_query(const chain_node *node)
{
@ -1124,60 +1096,13 @@ static void val_chain_node_cb(getdns_dns_req *dnsreq)
/* No signed DS and no signed proof of non-existance.
* Search further up the tree...
*/
val_chain_sched_soa_node(node->parent);
val_chain_sched_ds_node(node->parent);
if (node->lock) node->lock--;
check_chain_complete(node->chains);
}
static void val_chain_node_soa_cb(getdns_dns_req *dnsreq)
{
chain_node *node = (chain_node *)dnsreq->user_pointer;
getdns_network_req *netreq = dnsreq->netreqs[0];
_getdns_rrset_iter i_spc, *i;
_getdns_rrset *rrset;
/* A SOA query is always scheduled with a node as the user argument.
*/
assert(node != NULL);
for ( i = _getdns_rrset_iter_init(&i_spc, netreq->response
, netreq->response_len
, SECTION_ANSWER)
; i
; i = _getdns_rrset_iter_next(i)) {
rrset = _getdns_rrset_iter_value(i);
if (rrset->rr_type != GETDNS_RRTYPE_SOA)
continue;
while (node &&
! _dname_equal(node->ds.name, rrset->name))
node = node->parent;
if (node) {
node->lock++;
val_chain_sched_ds_node(node);
} else {
/* SOA for a different name */
node = (chain_node *)dnsreq->user_pointer;
if (node->parent) {
node->lock++;
val_chain_sched_soa_node(node->parent);
}
}
break;
}
if (!i && node->parent) {
node->lock++;
val_chain_sched_soa_node(node->parent);
}
if (node->lock) node->lock--;
check_chain_complete(node->chains);
}
/*************************** DNSSEC Validation *****************************
*****************************************************************************/
@ -2902,9 +2827,6 @@ static size_t count_outstanding_requests(chain_head *head)
if (!_getdns_netreq_finished(node->ds_req))
count++;
if (!_getdns_netreq_finished(node->soa_req))
count++;
}
return count + count_outstanding_requests(head->next);
}
@ -3412,12 +3334,6 @@ void _getdns_validation_chain_timeout(getdns_dns_req *dnsreq)
node->ds_req->owner);
node->ds_req = NULL;
}
if (!_getdns_netreq_finished(node->soa_req)) {
_getdns_context_cancel_request(
node->soa_req->owner);
node->soa_req = NULL;
}
}
head = next;
}
@ -3457,10 +3373,6 @@ void _getdns_cancel_validation_chain(getdns_dns_req *dnsreq)
if (node->ds_req)
_getdns_context_cancel_request(
node->ds_req->owner);
if (node->soa_req)
_getdns_context_cancel_request(
node->soa_req->owner);
}
GETDNS_FREE(head->my_mf, head);
head = next;

View File

@ -1392,7 +1392,7 @@ char *getdns_display_ip_address(const getdns_bindata
* @param value The callback function that will be called when any context is
* changed. A update callback function can be deregistered by
* passing NULL.
* @return GETDNS_RETURN_GOOD when succesful.
* @return GETDNS_RETURN_GOOD when successful.
* @return GETDNS_RETURN_INVALID_PARAMETER when context was NULL.
*/
getdns_return_t

View File

@ -591,7 +591,7 @@ getdns_context_set_logfunc(getdns_context *context, void *userarg,
* to be created if it does not exist. When NULL is
* given, the default location is used which is
* ${HOME}/.getdns/ on Unix line systems (Linux, BSD's,
* MacOS), and %AppData%\getnds\ on Windows.
* MacOS), and %AppData%\getdns\ on Windows.
* @return GETDNS_RETURN_GOOD when successful
* @return GETDNS_RETURN_INVALID_PARAMETER when context was NULL.
*/
@ -700,7 +700,7 @@ getdns_context_set_trust_anchors_verify_email(
* @see getdns_context_get_resolvconf
* @see getdns_context_set_hosts
* @param[in] context The context to configure
* @param[in] resolvonf Defaults to /etc/resolv.conf
* @param[in] resolvconf Defaults to /etc/resolv.conf
* @return GETDNS_RETURN_GOOD when successful and error code otherwise.
*/
getdns_return_t
@ -768,7 +768,6 @@ getdns_return_t
getdns_context_set_tls_curves_list(
getdns_context *context, const char *curves_list);
/**
* Get the current resolution type setting from this context.
* @see getdns_context_set_resolution_type
@ -829,10 +828,10 @@ getdns_context_get_dns_transport_list(getdns_context *context,
size_t* transport_count, getdns_transport_list_t **transports);
/**
* Get the current limit for oustanding queries setting from this context.
* Get the current limit for outstanding queries setting from this context.
* @see getdns_context_set_limit_outstanding_queries
* @param[in] context The context from which to get the setting
* @param[out] limit The current limit for oustanding queries
* @param[out] limit The current limit for outstanding queries
* @return GETDNS_RETURN_GOOD when successful
* @return GETDNS_RETURN_INVALID_PARAMETER when context or limit was NULL.
*/
@ -1055,7 +1054,7 @@ getdns_return_t
getdns_context_get_tls_query_padding_blocksize(getdns_context *context, uint16_t* value);
/**
* Get whether the upstream needs to be authenticated whith DNS over TLS.
* Get whether the upstream needs to be authenticated with DNS over TLS.
* @see getdns_context_set_tls_authentication
* @see authvaulesandtext
* @param[in] context The context from which to get the setting
@ -1076,7 +1075,7 @@ getdns_context_get_tls_authentication(getdns_context *context,
/**
* Get whether the context is configured to round robin queries over the available
* upstreams.
* @see getdns_context_get_round_robin_upstreams
* @see getdns_context_set_round_robin_upstreams
* @param[in] context The context from which to get the setting
* @param[out] value 1 if the setting is on, 0 otherwise
* @return GETDNS_RETURN_GOOD when successful
@ -1229,7 +1228,7 @@ getdns_context_get_trust_anchors_verify_email(
* @see getdns_context_set_resolvconf
* @see getdns_context_get_hosts
* @param[in] context The context to configure
* @param[out] resolvonf NULL if the context was not initialized with a
* @param[out] resolvconf NULL if the context was not initialized with a
* resolv.conf file.
* @return GETDNS_RETURN_GOOD when successful and error code otherwise.
*/
@ -1303,7 +1302,6 @@ getdns_return_t
getdns_context_get_tls_curves_list(
getdns_context *context, const char **curves_list);
/** @}
*/
@ -1359,7 +1357,7 @@ uint32_t getdns_get_api_version_number(void);
/**
* Returns a text describing the getdns error code, or NULL when the error
* code is unkown.
* code is unknown.
* @param err The error code for which to return the describing text
* @return The describing text for the error code. The string is in library
* space and the caller must *not* free this.
@ -1716,7 +1714,7 @@ getdns_rr_dict2wire_buf(
* the buffer and point right after the just written RR.
* @param wire_sz On input the size of the wire buffer,
* On output the amount of wireformat needed for the
* wireformat will have been substracted from wire_sz.
* wireformat will have been subtracted from wire_sz.
* @return GETDNS_RETURN_GOOD on success or an error code on failure.
* GETDNS_RETURN_NEED_MORE_SPACE will be returned when the buffer was too
* small. The function will pretend that it had written beyond the end
@ -1808,7 +1806,7 @@ getdns_rr_dict2str_buf(
* the buffer and point right after the just written RR.
* @param str_len On input the size of the str buffer,
* On output the number of characters needed for the
* string will have been substracted from strlen.
* string will have been subtracted from strlen.
* @return GETDNS_RETURN_GOOD on success or an error code on failure.
* GETDNS_RETURN_NEED_MORE_SPACE will be returned when the buffer was too
* small. The function will pretend that it had written beyond the end
@ -1887,7 +1885,7 @@ getdns_msg_dict2wire_buf(
* the buffer and point right after the just written RR.
* @param wire_sz On input the size of the wire buffer,
* On output the amount of wireformat needed for the
* wireformat will have been substracted from wire_sz.
* wireformat will have been subtracted from wire_sz.
* @return GETDNS_RETURN_GOOD on success or an error code on failure.
* GETDNS_RETURN_NEED_MORE_SPACE will be returned when the buffer was too
* small. The function will pretend that it had written beyond the end
@ -1979,7 +1977,7 @@ getdns_msg_dict2str_buf(
* the buffer and point right after the just written RR.
* @param str_len On input the size of the str buffer,
* On output the number of characters needed for the
* string will have been substracted from strlen.
* string will have been subtracted from strlen.
* @return GETDNS_RETURN_GOOD on success or an error code on failure.
* GETDNS_RETURN_NEED_MORE_SPACE will be returned when the buffer was too
* small. The function will pretend that it had written beyond the end
@ -2131,7 +2129,7 @@ typedef void (*getdns_request_handler_t)(
* On failure, the current set of listening addresses is left in place.
* Also, if there is overlap in listening_addresses between the active set
* and the newly given set, the ones in the active set will remain in their
* current condition and will not be closed and reopened, also all assoicated
* current condition and will not be closed and reopened, also all associated
* DNS transactions will remain.
*/
getdns_return_t

View File

@ -58,7 +58,7 @@ time_t gldns_mktime_from_utc(const struct tm *tm);
* The function interprets time as the number of seconds since epoch
* with respect to now using serial arithmetics (rfc1982).
* That number of seconds is then converted to broken-out time information.
* This is especially usefull when converting the inception and expiration
* This is especially useful when converting the inception and expiration
* fields of RRSIG records.
*
* \param[in] time number of seconds since epoch (midnight, January 1st, 1970)

View File

@ -332,13 +332,13 @@ enum gldns_enum_rdf_type
GLDNS_RDF_TYPE_NSEC3_NEXT_OWNER,
/** 4 shorts represented as 4 * 16 bit hex numbers
* seperated by colons. For NID and L64.
* separated by colons. For NID and L64.
*/
GLDNS_RDF_TYPE_ILNP64,
/** 6 * 8 bit hex numbers seperated by dashes. For EUI48. */
/** 6 * 8 bit hex numbers separated by dashes. For EUI48. */
GLDNS_RDF_TYPE_EUI48,
/** 8 * 8 bit hex numbers seperated by dashes. For EUI64. */
/** 8 * 8 bit hex numbers separated by dashes. For EUI64. */
GLDNS_RDF_TYPE_EUI64,
/** A non-zero sequence of US-ASCII letters and numbers in lower case.

View File

@ -1638,7 +1638,7 @@ void _getdns_mdns_context_destroy(struct getdns_context *context)
}
}
/* TODO: actualy delete what is required.. */
/* TODO: actually delete what is required.. */
static void
mdns_cleanup(getdns_network_req *netreq)
{

View File

@ -59,7 +59,7 @@ typedef struct getdns_mdns_known_record
* The data part contains:
* - 64 bit time stamp
* - 32 bit word describing the record size
* - 32 bit word describing teh allocated memory size
* - 32 bit word describing the allocated memory size
* - valid DNS response, including 1 query and N answers, 0 AUTH, 0 AD.
* For economy, the names of all answers are encoded using header compression, pointing
* to the name in the query, i.e. offset 12 from beginning of message.

View File

@ -14,7 +14,7 @@ cat > const-info.c << END_OF_HEAD
static struct const_info consts_info[] = {
{ -1, NULL, "/* <unknown getdns value> */" },
END_OF_HEAD
gawk '/^[ ]+GETDNS_[A-Z_]+[ ]+=[ ]+[0-9]+/{ key = sprintf("%7d", $3); consts[key] = $1; }/^#define GETDNS_[A-Z_]+[ ]+[0-9]+/ && !/^#define GETDNS_RRTYPE/ && !/^#define GETDNS_RRCLASS/ && !/^#define GETDNS_OPCODE/ && !/^#define GETDNS_RCODE/ && !/_TEXT/{ key = sprintf("%7d", $3); consts[key] = $2; }/^#define GETDNS_[A-Z_]+[ ]+\(\(getdns_(return|append_name)_t) [0-9]+ \)/{ key = sprintf("%7d", $4); consts[key] = $2; }END{ n = asorti(consts, const_vals); for ( i = 1; i <= n; i++) { val = const_vals[i]; name = consts[val]; print "\t{ "val", \""name"\", "name"_TEXT },"}}' getdns/getdns_extra.h.in getdns/getdns.h.in | sed 's/,,/,/g' >> const-info.c
gawk '/^[ ]+GETDNS_[A-Z_]+[ ]+=[ ]+[0-9]+/{ key = sprintf("%7d", $3); consts[key] = $1; }/^#define GETDNS_[A-Z_]+[ ]+[0-9]+/ && !/^#define GETDNS_RRTYPE/ && !/^#define GETDNS_RRCLASS/ && !/^#define GETDNS_OPCODE/ && !/^#define GETDNS_RCODE/ && !/_TEXT/{ key = sprintf("%7d", $3); consts[key] = $2; }/^#define GETDNS_[A-Z_]+[ ]+\(\(getdns_(return|append_name)_t) [0-9]+ \)/{ key = sprintf("%7d", $4); consts[key] = $2; }END{ n = asorti(consts, const_vals); for ( i = 1; i <= n; i++) { val = const_vals[i]; name = consts[val]; print "\t{ "val", \""name"\", "name"_TEXT },"}}' getdns/getdns_extra.h.in getdns/getdns.h.in const-info.h| sed 's/,,/,/g' >> const-info.c
cat >> const-info.c << END_OF_TAIL
};
@ -49,7 +49,7 @@ getdns_get_errorstr_by_id(uint16_t err)
static struct const_name_info consts_name_info[] = {
END_OF_TAIL
gawk '/^[ ]+GETDNS_[A-Z_]+[ ]+=[ ]+[0-9]+/{ key = sprintf("%d", $3); consts[$1] = key; }/^#define GETDNS_[A-Z_]+[ ]+[0-9]+/ && !/_TEXT/{ key = sprintf("%d", $3); consts[$2] = key; }/^#define GETDNS_[A-Z_]+[ ]+\(\(getdns_(return|append_name)_t) [0-9]+ \)/{ key = sprintf("%d", $4); consts[$2] = key; }END{ n = asorti(consts, const_vals); for ( i = 1; i <= n; i++) { val = const_vals[i]; name = consts[val]; print "\t{ \""val"\", "name" },"}}' getdns/getdns.h.in getdns/getdns_extra.h.in | sed 's/,,/,/g' >> const-info.c
gawk '/^[ ]+GETDNS_[A-Z_]+[ ]+=[ ]+[0-9]+/{ key = sprintf("%d", $3); consts[$1] = key; }/^#define GETDNS_[A-Z_]+[ ]+[0-9]+/ && !/_TEXT/{ key = sprintf("%d", $3); consts[$2] = key; }/^#define GETDNS_[A-Z_]+[ ]+\(\(getdns_(return|append_name)_t) [0-9]+ \)/{ key = sprintf("%d", $4); consts[$2] = key; }END{ n = asorti(consts, const_vals); for ( i = 1; i <= n; i++) { val = const_vals[i]; name = consts[val]; print "\t{ \""val"\", "name" },"}}' getdns/getdns.h.in getdns/getdns_extra.h.in const-info.h| sed 's/,,/,/g' >> const-info.c
cat >> const-info.c << END_OF_TAIL
};

View File

@ -134,6 +134,7 @@ netreq_reset(getdns_network_req *net_req)
uint8_t *buf;
/* variables that need to be reset on reinit
*/
net_req->first_upstream = NULL;
net_req->unbound_id = -1;
_getdns_netreq_change_state(net_req, NET_REQ_NOT_SENT);
if (net_req->query_id_registered) {
@ -767,7 +768,7 @@ _getdns_dns_req_new(getdns_context *context, getdns_eventloop *loop,
request_type == GETDNS_RRTYPE_AAAA );
/* Reserve for the buffer at least one more byte
* (to test for udp overflow) (hence the + 1),
* And align on the 8 byte boundry (hence the (x + 7) / 8 * 8)
* And align on the 8 byte boundary (hence the (x + 7) / 8 * 8)
*/
size_t max_query_sz, max_response_sz, netreq_sz, dnsreq_base_sz;
uint8_t *region, *suffixes;

View File

@ -255,7 +255,12 @@ _getdns_cancel_reply(getdns_context *context, connection *conn)
{
struct mem_funcs *mf;
if (!context || !conn)
if (!conn)
return;
if (context && context->server &&
_getdns_rbtree_search(&context->server->connections_set, conn)
!= &conn->super)
return;
if (conn->l->transport == GETDNS_TRANSPORT_TCP) {
@ -293,13 +298,14 @@ getdns_reply(
size_t len;
getdns_return_t r;
if (!context || !conn)
if (!conn)
return GETDNS_RETURN_INVALID_PARAMETER;
if (!context->server)
return GETDNS_RETURN_GENERIC_ERROR;;
if (!context || !context->server) {
if (!context)
context = conn->l->set->context;
if (_getdns_rbtree_search(&context->server->connections_set, conn)
} else if (_getdns_rbtree_search(&context->server->connections_set, conn)
!= &conn->super)
return GETDNS_RETURN_NO_SUCH_LIST_ITEM;
@ -750,11 +756,16 @@ static void free_listen_set_when_done(listen_set *set)
for (i = 0; i < set->count; i++) {
listener *l = &set->items[i];
if (l->fd >= 0)
if (l->fd >= 0) {
DEBUG_SERVER("Listener %d still listening on %d\n",
(int)i, l->fd);
return;
if (l->connections)
}
if (l->connections) {
DEBUG_SERVER("Listener %d still has connections %p\n",
(int)i, (void *)l->connections);
return;
}
}
GETDNS_FREE(*mf, set);
DEBUG_SERVER("Listen set: %p freed\n", (void *)set);

View File

@ -112,7 +112,7 @@ rollover_secret()
return;
/* Remember previous secret, in to keep answering on rollover
* boundry with old cookie.
* boundary with old cookie.
*/
prev_secret = secret;
secret = arc4random();
@ -460,8 +460,13 @@ stub_next_upstream(getdns_network_req *netreq)
{
getdns_dns_req *dnsreq = netreq->owner;
if (! --netreq->upstream->to_retry)
netreq->upstream->to_retry = -(netreq->upstream->back_off *= 2);
if (! --netreq->upstream->to_retry) {
/* Limit back_off value to configured maximum */
if (netreq->upstream->back_off * 2 > dnsreq->context->max_backoff_value)
netreq->upstream->to_retry = -(dnsreq->context->max_backoff_value);
else
netreq->upstream->to_retry = -(netreq->upstream->back_off *= 2);
}
dnsreq->upstreams->current_udp+=GETDNS_UPSTREAM_TRANSPORTS;
if (dnsreq->upstreams->current_udp >= dnsreq->upstreams->count)
@ -899,7 +904,7 @@ tls_verify_callback(int preverify_ok, X509_STORE_CTX *ctx)
"%-40s : Conn failed: TLS - *Failure* - Pinset validation failure\n",
upstream->addr_str);
}
/* If nothing has failed yet and we had credentials, we have succesfully authenticated*/
/* If nothing has failed yet and we had credentials, we have successfully authenticated*/
if (preverify_ok == 0)
upstream->tls_auth_state = GETDNS_AUTH_FAILED;
else if (upstream->tls_auth_state == GETDNS_AUTH_NONE &&
@ -1590,6 +1595,7 @@ stub_udp_read_cb(void *userarg)
netreq->debug_end_time = _getdns_get_time_as_uintt64();
_getdns_netreq_change_state(netreq, NET_REQ_FINISHED);
upstream->udp_responses++;
upstream->back_off = 1;
if (upstream->udp_responses == 1 ||
upstream->udp_responses % 100 == 0)
_getdns_upstream_log(upstream, GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_INFO,
@ -1640,7 +1646,7 @@ stub_udp_write_cb(void *userarg)
, STUB_DEBUG_WRITE, __FUNC__, (void *)netreq
, _getdns_errnostr());
else
DEBUG_STUB( "%s %-35s: MSG: %p returned: %d, expeced: %d\n"
DEBUG_STUB( "%s %-35s: MSG: %p returned: %d, expected: %d\n"
, STUB_DEBUG_WRITE, __FUNC__, (void *)netreq
, (int)written, (int)pkt_len);
#endif
@ -1972,9 +1978,9 @@ upstream_valid(getdns_upstream *upstream,
getdns_network_req *netreq,
int backoff_ok)
{
/* Checking upstreams with backoff_ok true will aslo return upstreams
/* Checking upstreams with backoff_ok true will also return upstreams
that are in a backoff state. Otherwise only use upstreams that have
a 'good' connection state. backoff_ok is usefull when no upstreams at all
a 'good' connection state. backoff_ok is useful when no upstreams at all
are valid, for example when the network connection is down and need to
keep trying to connect before failing completely. */
if (!(upstream->transport == transport && upstream_usable(upstream, backoff_ok)))
@ -2152,6 +2158,7 @@ upstream_select_stateful(getdns_network_req *netreq, getdns_transport_list_t tra
return upstream;
}
/* Used for UDP only */
static getdns_upstream *
upstream_select(getdns_network_req *netreq)
{
@ -2161,6 +2168,7 @@ upstream_select(getdns_network_req *netreq)
if (!upstreams->count)
return NULL;
/* First UPD/TCP upstream is always at i=0 and then start of each upstream block*/
/* TODO: Have direct access to sets of upstreams for different transports*/
for (i = 0; i < upstreams->count; i+=GETDNS_UPSTREAM_TRANSPORTS)
@ -2178,14 +2186,18 @@ upstream_select(getdns_network_req *netreq)
i = 0;
} while (i != upstreams->current_udp);
/* Select upstream with the lowest back_off value */
upstream = upstreams->upstreams;
for (i = 0; i < upstreams->count; i+=GETDNS_UPSTREAM_TRANSPORTS)
if (upstreams->upstreams[i].back_off <
upstream->back_off)
if (upstreams->upstreams[i].back_off < upstream->back_off)
upstream = &upstreams->upstreams[i];
if (upstream->back_off > 1)
upstream->back_off--;
/* Restrict back_off in case no upstream is available to achieve
(more or less) round-robin retry on all upstreams. */
if (upstream->back_off > 4) {
for (i = 0; i < upstreams->count; i+=GETDNS_UPSTREAM_TRANSPORTS)
upstreams->upstreams[i].back_off = 2;
}
upstream->to_retry = 1;
upstreams->current_udp = upstream - upstreams->upstreams;
return upstream;
@ -2296,8 +2308,13 @@ upstream_find_for_netreq(getdns_network_req *netreq)
return STUB_TRY_AGAIN_LATER;
return -1;
}
if (upstream == netreq->first_upstream)
continue;
netreq->transport_current = i;
netreq->upstream = upstream;
if (!netreq->first_upstream)
netreq->first_upstream = upstream;
netreq->keepalive_sent = 0;
DEBUG_STUB("%s %-35s: MSG: %p found upstream %p with transport %d, fd: %d\n", STUB_DEBUG_SCHEDULE, __FUNC__, (void*)netreq, (void *)upstream, (int)netreq->transports[i], fd);

View File

@ -148,7 +148,7 @@
getdns_bindata *version_str = NULL;
/* Note that stricly this test just establishes that the requested transport
and the reported transport are consistent, it does not guarentee which
and the reported transport are consistent, it does not guarantee which
transport is used on the wire...*/
CONTEXT_CREATE(TRUE);

View File

@ -25,4 +25,4 @@ done
rm -fr "${BUILDDIR}/build"
mkdir "${BUILDDIR}/build"
cd "${BUILDDIR}/build"
"${SRCROOT}/configure" $* --prefix "${BUILDDIR}/install" --enable-debug-anchor
"${SRCROOT}/configure" $* --prefix "${BUILDDIR}/install"

View File

@ -5,4 +5,4 @@
[ -f .tpkg.var.test ] && source .tpkg.var.test
cd "${BUILDDIR}/build"
make XTRA_CFLAGS='-Werror' -j 4
make XTRA_CFLAGS='-g -Werror' -j 4

View File

@ -5,4 +5,6 @@
[ -f .tpkg.var.test ] && source .tpkg.var.test
cd "${BUILDDIR}/build"
make -j 4 install
make -j 4 install \
&& echo "export GETDNS_QUERY=\"${BUILDDIR}/build/src/tools/getdns_query\"" \
>> ../.tpkg.var.master

View File

@ -1,16 +0,0 @@
BaseName: 110-link
Version: 1.0
Description: Link getdns_query program
CreationDate: do dec 10 11:10:11 CET 2015
Maintainer: Willem Toorop
Category:
Component:
CmdDepends:
Depends: 100-compile.tpkg
Help:
Pre:
Post:
Test: 110-link.test
AuxFiles:
Passed:
Failure:

View File

@ -1,10 +0,0 @@
# #-- 110-link.test --#
# source the master var file when it's there
[ -f ../.tpkg.var.master ] && source ../.tpkg.var.master
# use .tpkg.var.test for in test variable passing
[ -f .tpkg.var.test ] && source .tpkg.var.test
cd "${BUILDDIR}/build"
make -j 4 getdns_query \
&& echo "export GETDNS_QUERY=\"${BUILDDIR}/build/src/tools/getdns_query\"" \
>> ../.tpkg.var.master

View File

@ -1,16 +0,0 @@
BaseName: 115-install-linked
Version: 1.0
Description: Install the getdns_query program
CreationDate: vr dec 18 10:52:26 CET 2015
Maintainer: Willem Toorop
Category:
Component:
CmdDepends:
Depends: 110-link.tpkg
Help:
Pre:
Post:
Test: 115-install-linked.test
AuxFiles:
Passed:
Failure:

View File

@ -1,8 +0,0 @@
# #-- 115-install-linked.test --#
# source the master var file when it's there
[ -f ../.tpkg.var.master ] && source ../.tpkg.var.master
# use .tpkg.var.test for in test variable passing
[ -f .tpkg.var.test ] && source .tpkg.var.test
cd "${BUILDDIR}/build"
make -j 4 install-getdns_query

View File

@ -6,7 +6,7 @@ Maintainer: Willem Toorop
Category:
Component:
CmdDepends:
Depends: 110-link.tpkg
Depends: 105-install.tpkg
Help:
Pre:
Post:

View File

@ -1 +1,2 @@
. DS 19036 8 2 49aac11d7b6f6446702e54a1607371607a1a41855200fd2ce1cdde32f24e8fb5
. DS 20326 8 2 e06d44b80b8f1d39a95c0b0d7c65d08458e880409bbc683457104237c7f8ec8d

View File

@ -6,7 +6,7 @@ Maintainer: Willem Toorop
Category:
Component:
CmdDepends: valgrind
Depends: 110-link.tpkg
Depends: 105-install.tpkg
Help:
Pre:
Post:

View File

@ -6,7 +6,7 @@ Maintainer: Willem Toorop
Category:
Component:
CmdDepends:
Depends: 110-link.tpkg
Depends: 105-install.tpkg
Help:
Pre:
Post:

View File

@ -1,4 +1,4 @@
BaseName: 200-stub-only-compile
BaseName: 200-stub-only-compile-install
Version: 1.0
Description: Create builddir and compile stub only
CreationDate: do dec 10 11:08:24 CET 2015
@ -8,9 +8,9 @@ Component:
CmdDepends:
Depends:
Help:
Pre: 200-stub-only-compile.pre
Post: 200-stub-only-compile.post
Test: 200-stub-only-compile.test
Pre: 200-stub-only-compile-install.pre
Post: 200-stub-only-compile-install.post
Test: 200-stub-only-compile-install.test
AuxFiles:
Passed:
Failure:

View File

@ -25,4 +25,4 @@ done
rm -fr "${BUILDDIR}/build-stub-only"
mkdir "${BUILDDIR}/build-stub-only"
cd "${BUILDDIR}/build-stub-only"
"${SRCROOT}/configure" $* --prefix "${BUILDDIR}/install-stub-only" --enable-stub-only
"${SRCROOT}/configure" $* --prefix "${BUILDDIR}/install-stub-only" --enable-stub-only --enable-debug-server --enable-debug-anchor

View File

@ -5,4 +5,6 @@
[ -f .tpkg.var.test ] && source .tpkg.var.test
cd "${BUILDDIR}/build-stub-only"
make XTRA_CFLAGS='-Werror' -j 4
make XTRA_CFLAGS='-g -Werror' -j 4 install \
&& echo "export GETDNS_STUB_QUERY=\"${BUILDDIR}/build-stub-only/src/tools/getdns_query\"" \
>> ../.tpkg.var.master

View File

@ -1,16 +0,0 @@
BaseName: 210-stub-only-link
Version: 1.0
Description: Link getdns_query program
CreationDate: do dec 10 11:08:37 CET 2015
Maintainer: Willem Toorop
Category:
Component:
CmdDepends:
Depends: 200-stub-only-compile.tpkg
Help:
Pre:
Post:
Test: 210-stub-only-link.test
AuxFiles:
Passed:
Failure:

View File

@ -1,10 +0,0 @@
# #-- 210-stub-only-link.test --#
# source the master var file when it's there
[ -f ../.tpkg.var.master ] && source ../.tpkg.var.master
# use .tpkg.var.test for in test variable passing
[ -f .tpkg.var.test ] && source .tpkg.var.test
cd "${BUILDDIR}/build-stub-only"
make -j 4 getdns_query \
&& echo "export GETDNS_STUB_QUERY=\"${BUILDDIR}/build-stub-only/src/tools/getdns_query\"" \
>> ../.tpkg.var.master

View File

@ -6,7 +6,7 @@ Maintainer: Willem Toorop
Category:
Component:
CmdDepends:
Depends: 210-stub-only-link.tpkg
Depends: 200-stub-only-compile-install.tpkg
Help:
Pre:
Post:

View File

@ -1 +0,0 @@
. DS 19036 8 2 49aac11d7b6f6446702e54a1607371607a1a41855200fd2ce1cdde32f24e8fb5

View File

@ -1,12 +1,12 @@
BaseName: 225-stub-only-valgrind-checks
Version: 1.0
Description: Run valgrind to detect memory leaks
Description: Run getdns_query in valgrind + Zero configuration DNSSEC test
CreationDate: ma mrt 21 16:24:56 CET 2016
Maintainer: Willem Toorop
Category:
Component:
CmdDepends: valgrind
Depends: 210-stub-only-link.tpkg
Depends: 200-stub-only-compile-install.tpkg
Help:
Pre:
Post:

View File

@ -6,7 +6,7 @@ Maintainer: Willem Toorop
Category:
Component:
CmdDepends:
Depends: 210-stub-only-link.tpkg
Depends: 200-stub-only-compile-install.tpkg
Help:
Pre:
Post:

View File

@ -6,7 +6,7 @@ Maintainer: Willem Toorop
Category:
Component:
CmdDepends:
Depends: 200-stub-only-compile.tpkg
Depends: 200-stub-only-compile-install.tpkg
Help:
Pre: 250-json-pointers.pre
Post:

View File

@ -6,7 +6,7 @@ Maintainer: Jim Hague
Category:
Component:
CmdDepends:
Depends: 200-stub-only-compile.tpkg
Depends: 200-stub-only-compile-install.tpkg
Help:
Pre: 255-yaml-config.pre
Post:

View File

@ -6,7 +6,7 @@ Maintainer: Willem Toorop
Category:
Component:
CmdDepends:
Depends: 200-stub-only-compile.tpkg
Depends: 200-stub-only-compile-install.tpkg
Help: 260-conversion-functions.help
Pre: 260-conversion-functions.pre
Post:

View File

@ -6,7 +6,7 @@ Maintainer: Hoda Rohani
Category:
Component:
CmdDepends:
Depends: 200-stub-only-compile.tpkg
Depends: 200-stub-only-compile-install.tpkg
Help:
Pre: 265-supported-rrs.pre
Post:

View File

@ -85,7 +85,7 @@ int main()
fprintf(stderr, "Could not do lookup");
else if ((r = getdns_dict_remove_name(response, "replies_full")))
fprintf(stderr, "Could not remove reponse['replies_full']");
fprintf(stderr, "Could not remove response['replies_full']");
else if ((r = getdns_dict_remove_name(response, "/replies_tree/0/header/id")))
fprintf(stderr, "Could not remove ID from response");

View File

@ -6,7 +6,7 @@ Maintainer: Willem Toorop
Category:
Component:
CmdDepends:
Depends: 200-stub-only-compile.tpkg
Depends: 200-stub-only-compile-install.tpkg
Help:
Pre: 270-header-extension.pre
Post:

View File

@ -6,7 +6,7 @@ Maintainer: Hoda Rohani
Category:
Component:
CmdDepends:
Depends: 210-stub-only-link.tpkg
Depends: 200-stub-only-compile-install.tpkg
Help:
Pre: 275-server-capabilities.pre
Post:

View File

@ -21,10 +21,14 @@ make && "${BUILDDIR}/build-stub-only/libtool" exec valgrind -v --log-file=valgri
${GETDNS_STUB_QUERY} -s -q @${LOCALHOST}:$PORT TXT quit.
)
if grep -q 'definitely lost: [^0]' valgrind.log
if ! awk '/^==.*(definitely|indirectly|possibly) lost/{print;if($4>0)exit(1)}' valgrind.log
then
cat valgrind.log
exit 1
fi
if ! awk '/^==.* ERROR SUMMARY/{print;if($4>0)exit(1)}' valgrind.log
then
cat valgrind.log
echo "error: Memory loss!"
exit 1
fi
if ! grep -q '"status": GETDNS_RESPSTATUS_ALL_TIMEOUT' time_out

View File

@ -6,7 +6,7 @@ Maintainer: Willem Toorop
Category: Resource depletion
Component:
CmdDepends:
Depends: 210-stub-only-link.tpkg
Depends: 200-stub-only-compile-install.tpkg
Help:
Pre: 280-limit_outstanding_queries.pre
Post:

View File

@ -19,13 +19,13 @@ echo "# queries: $NQUERIES"
# which is smaller than 5 seconds default query timeout value,
# so the test should succeed.
make && "./${TPKG_NAME}" ${LOCALHOST} | (
make && "${BUILDDIR}/build-stub-only/libtool" exec valgrind -v --log-file=valgrind.log --leak-check=full --error-exitcode=1 --track-origins=yes "./${TPKG_NAME}" ${LOCALHOST} | (
read PORT
${GETDNS_STUB_QUERY} @${LOCALHOST}:$PORT TXT \
${GETDNS_STUB_QUERY} -s @${LOCALHOST}:$PORT TXT \
-a -F "./${TPKG_NAME}.queries" \
"{limit_outstanding_queries:$QLIMIT}" 2>&1 > out
${GETDNS_STUB_QUERY} -q @${LOCALHOST}:$PORT TXT quit.
${GETDNS_STUB_QUERY} -s -q @${LOCALHOST}:$PORT TXT quit.
) && grep '"n_requests: [0-9][0-9]*"' out | sed -e 's/^.*n_requests: //g' -e 's/".*$//g' \
| awk -vQLIMIT=$QLIMIT -vNQUERIES=$NQUERIES '
@ -43,4 +43,15 @@ END{
exit(-1);
} else
print "SUCCESS: No more than "QLIMIT" outstanding queries: "max_outstanding;
}'
}' && (
if ! awk '/^==.*(definitely|indirectly|possibly) lost/{print;if($4>0)exit(1)}' valgrind.log
then
cat valgrind.log
exit 1
fi
if ! awk '/^==.* ERROR SUMMARY/{print;if($4>0)exit(1)}' valgrind.log
then
cat valgrind.log
exit 1
fi
)

View File

@ -6,7 +6,7 @@ Maintainer: Willem Toorop
Category: Resource depletion
Component:
CmdDepends:
Depends: 210-stub-only-link.tpkg
Depends: 200-stub-only-compile-install.tpkg
Help:
Pre: 285-out_of_filedescriptors.pre
Post:

View File

@ -27,13 +27,13 @@ echo "# queries: $NQUERIES"
# which is smaller than 5 seconds default query timeout value,
# so the test should succeed.
make && "./${TPKG_NAME}" ${LOCALHOST}| (
make && "${BUILDDIR}/build-stub-only/libtool" exec valgrind -v --log-file=valgrind.log --leak-check=full --error-exitcode=1 --track-origins=yes "./${TPKG_NAME}" ${LOCALHOST}| (
read PORT
ulimit -n $QLIMIT
${GETDNS_STUB_QUERY} @${LOCALHOST}:$PORT TXT \
${GETDNS_STUB_QUERY} -s @${LOCALHOST}:$PORT TXT \
-a -F "./${TPKG_NAME}.queries" 2>&1 > out
${GETDNS_STUB_QUERY} -q @${LOCALHOST}:$PORT TXT quit.
${GETDNS_STUB_QUERY} -s -q @${LOCALHOST}:$PORT TXT quit.
) && grep '"n_requests: [0-9][0-9]*"' out | sed -e 's/^.*n_requests: //g' -e 's/".*$//g' \
| awk -vQLIMIT=$QLIMIT -vNQUERIES=$NQUERIES '
@ -51,4 +51,15 @@ END{
exit(-1);
} else
print "SUCCESS: No more than "QLIMIT" outstanding queries: "max_outstanding;
}'
}' && (
if ! awk '/^==.*(definitely|indirectly|possibly) lost/{print;if($4>0)exit(1)}' valgrind.log
then
cat valgrind.log
exit 1
fi
if ! awk '/^==.* ERROR SUMMARY/{print;if($4>0)exit(1)}' valgrind.log
then
cat valgrind.log
exit 1
fi
)

View File

@ -6,7 +6,7 @@ Maintainer: Hoda Rohani
Category:
Component:
CmdDepends:
Depends: 210-stub-only-link.tpkg
Depends: 200-stub-only-compile-install.tpkg
Help:
Pre:
Post:

View File

@ -5,4 +5,4 @@
[ -f .tpkg.var.test ] && source .tpkg.var.test
cd "${BUILDDIR}/build-event-loops"
make XTRA_CFLAGS=-Werror -j 4
make XTRA_CFLAGS="-g -Werror" -j 4 install

View File

@ -3,7 +3,7 @@
export SRCDIR=`dirname $0`
. `dirname $0`/setup-env.sh
# pass a single test name as the first paramter (without .tpgk extension)
# pass a single test name as the first parameter (without .tpgk extension)
ONE_TEST=$1
shift

View File

@ -83,7 +83,7 @@ function write_result() {
}
function epoch() {
# make this sorta portable allthough not needed now
# make this sorta portable although not needed now
epoch=0
case $OSTYPE in
linux*)
@ -819,7 +819,7 @@ done
# this enhances the template from above
## Post Processing of some of these variables
# dsc_aux is a comma seperated list of files, max 8 files
# dsc_aux is a comma separated list of files, max 8 files
i=$( echo $dsc_aux | awk -F', ?' '{ print $1 "\n" $2 "\n" $3 "\n" $4 "\n" \
$5 "\n" $6 "\n" $7 "\n" $8 }' )
dsc_aux_files=($i)
@ -833,7 +833,7 @@ dsc_cmddepends_files_total=${#dsc_cmddepends_files[*]}
for i in ${dsc_cmddepends_files[*]}; do
find_cmd $i
done
# depends can also be a comma seperated list of package
# depends can also be a comma separated list of package
# TODO
# check is the aux files are also really in the shar

View File

@ -715,7 +715,7 @@ static exit_value get_report_info(struct test_info_s *test_info,
"expire=%s;",
buf);
} else {
printf("Certicate expires:\t%s UTC\n", buf);
printf("Certificate expires:\t%s UTC\n", buf);
}
}
}
@ -1407,7 +1407,7 @@ static exit_value test_dnssec_validate(struct test_info_s *test_info,
/*
* Only now get report info from the first search, so that any
* verbose output appears after the context/reponse dumps.
* verbose output appears after the context/response dumps.
*/
if ((xit = get_report_info(test_info, response, NULL, NULL, NULL)) != EXIT_OK)
return xit;

View File

@ -221,6 +221,7 @@ typedef struct getdns_network_req
getdns_redirects_t follow_redirects;
/* For stub resolving */
struct getdns_upstream *first_upstream;
struct getdns_upstream *upstream;
int fd;
getdns_transport_list_t transports[GETDNS_TRANSPORTS_MAX];
@ -246,7 +247,7 @@ typedef struct getdns_network_req
size_t debug_udp;
/* When more space is needed for the wire_data response than is
* available in wire_data[], it will be allocated seperately.
* available in wire_data[], it will be allocated separately.
* response will then not point to wire_data anymore.
*/
uint8_t *query;
@ -380,8 +381,8 @@ typedef struct getdns_dns_req {
*
* Memory for these netreqs has been allocated by the same malloc
* operation that reserved space for this getdns_dns_req.
* They will thus be freed as part of the desctruction of this struct,
* and do not need to be freed seperately.
* They will thus be freed as part of the destruction of this struct,
* and do not need to be freed separately.
*/
getdns_network_req *netreqs[];