mirror of https://github.com/getdnsapi/getdns.git
Merge branch 'develop' into release/1.1.0-alpha3
This commit is contained in:
commit
37cced78fc
|
@ -96,10 +96,16 @@ AC_PROG_CPP
|
|||
AC_CANONICAL_HOST
|
||||
|
||||
CFLAGS="$CFLAGS"
|
||||
WPEDANTICFLAG=""
|
||||
WNOERRORFLAG=""
|
||||
AC_PROG_CC_C99
|
||||
AX_CHECK_COMPILE_FLAG([-xc99],[CFLAGS="$CFLAGS -xc99"],[],[])
|
||||
AX_CHECK_COMPILE_FLAG([-Wall],[CFLAGS="$CFLAGS -Wall"],[],[])
|
||||
AX_CHECK_COMPILE_FLAG([-Wall],[CFLAGS="$CFLAGS -Wextra"],[],[])
|
||||
AX_CHECK_COMPILE_FLAG([-Wextra],[CFLAGS="$CFLAGS -Wextra"],[],[])
|
||||
AX_CHECK_COMPILE_FLAG([-Wpedantic],[WPEDANTICFLAG="-Wpedantic"],[],[])
|
||||
AX_CHECK_COMPILE_FLAG([-Wno-error=unused-parameter],[WNOERRORFLAG="-Wno-error=unused-parameter"],[],[])
|
||||
AC_SUBST(WPEDANTICFLAG)
|
||||
AC_SUBST(WNOERRORFLAG)
|
||||
|
||||
case "$host_os" in
|
||||
linux* ) CFLAGS="$CFLAGS -D_BSD_SOURCE -D_DEFAULT_SOURCE"
|
||||
|
|
|
@ -48,7 +48,9 @@ srcdir = @srcdir@
|
|||
LIBTOOL = ../libtool
|
||||
|
||||
CC=@CC@
|
||||
CFLAGS=-I$(srcdir) -I. @CFLAGS@ @CPPFLAGS@
|
||||
CFLAGS=-I$(srcdir) -I. @CFLAGS@ @CPPFLAGS@ $(XTRA_CFLAGS)
|
||||
WPEDANTICFLAG=@WPEDANTICFLAG@
|
||||
WNOERRORFLAG=@WNOERRORFLAG@
|
||||
LDFLAGS=@LDFLAGS@ @LIBS@
|
||||
|
||||
EXTENSION_LIBEVENT_LIB=@EXTENSION_LIBEVENT_LIB@
|
||||
|
@ -85,38 +87,38 @@ NON_C99_OBJS=context.lo libuv.lo
|
|||
.SUFFIXES: .c .o .a .lo .h
|
||||
|
||||
.c.o:
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
$(CC) $(CFLAGS) $(WPEDANTICFLAG) -c $< -o $@
|
||||
|
||||
.c.lo:
|
||||
$(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) -c $< -o $@
|
||||
$(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) $(WPEDANTICFLAG) -c $< -o $@
|
||||
|
||||
default: all
|
||||
|
||||
all: libgetdns.la $(EXTENSION_LIBEVENT_LIB) $(EXTENSION_LIBUV_LIB) $(EXTENSION_LIBEV_LIB)
|
||||
|
||||
$(GETDNS_OBJ):
|
||||
$(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) -c $(srcdir)/$(@:.lo=.c) -o $@
|
||||
$(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) $(WPEDANTICFLAG) -c $(srcdir)/$(@:.lo=.c) -o $@
|
||||
|
||||
$(GLDNS_OBJ):
|
||||
$(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) -c $(srcdir)/gldns/$(@:.lo=.c) -o $@
|
||||
$(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) $(WPEDANTICFLAG) -c $(srcdir)/gldns/$(@:.lo=.c) -o $@
|
||||
|
||||
$(COMPAT_OBJ):
|
||||
$(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) -Wno-error=pedantic -c $(srcdir)/compat/$(@:.lo=.c) -o $@
|
||||
$(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) -c $(srcdir)/compat/$(@:.lo=.c) -o $@
|
||||
|
||||
$(UTIL_OBJ):
|
||||
$(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) -Wno-error=pedantic -Wno-error=unused-parameter -c $(srcdir)/util/$(@:.lo=.c) -o $@
|
||||
$(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) $(WNOERRORFLAG) -c $(srcdir)/util/$(@:.lo=.c) -o $@
|
||||
|
||||
$(JSMN_OBJ):
|
||||
$(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) -DJSMN_GETDNS -c $(srcdir)/jsmn/$(@:.lo=.c) -o $@
|
||||
|
||||
$(EXTENSION_OBJ):
|
||||
$(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) -c $(srcdir)/extension/$(@:.lo=.c) -o $@
|
||||
$(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) $(WPEDANTICFLAG) -c $(srcdir)/extension/$(@:.lo=.c) -o $@
|
||||
|
||||
context.lo:
|
||||
$(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) $(C99COMPATFLAGS) -c $(srcdir)/context.c -o context.lo
|
||||
$(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) $(WPEDANTICFLAG) $(C99COMPATFLAGS) -c $(srcdir)/context.c -o context.lo
|
||||
|
||||
libuv.lo:
|
||||
$(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) $(C99COMPATFLAGS) -c $(srcdir)/extension/libuv.c -o libuv.lo
|
||||
$(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) $(WPEDANTICFLAG) $(C99COMPATFLAGS) -c $(srcdir)/extension/libuv.c -o libuv.lo
|
||||
|
||||
install: libgetdns.la
|
||||
$(INSTALL) -m 755 -d $(DESTDIR)$(includedir)
|
||||
|
@ -139,19 +141,18 @@ uninstall:
|
|||
if test $(have_libev) = 1; then $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$(EXTENSION_LIBEV_LIB) ; fi
|
||||
|
||||
libgetdns_ext_event.la: libgetdns.la libevent.lo
|
||||
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) -o $@ libevent.lo libgetdns.la $(LDFLAGS) $(EXTENSION_LIBEVENT_LDFLAGS) $(EXTENSION_LIBEVENT_EXT_LIBS) -rpath $(libdir) -version-info $(libversion) -no-undefined -export-symbols $(srcdir)/extension/libevent.symbols
|
||||
$(LIBTOOL) --tag=CC --mode=link $(CC) -o $@ libevent.lo libgetdns.la $(LDFLAGS) $(EXTENSION_LIBEVENT_LDFLAGS) $(EXTENSION_LIBEVENT_EXT_LIBS) -rpath $(libdir) -version-info $(libversion) -no-undefined -export-symbols $(srcdir)/extension/libevent.symbols
|
||||
|
||||
libgetdns_ext_uv.la: libgetdns.la libuv.lo
|
||||
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) -o $@ libuv.lo libgetdns.la $(LDFLAGS) $(EXTENSION_LIBUV_LDFLAGS) $(EXTENSION_LIBUV_EXT_LIBS) -rpath $(libdir) -version-info $(libversion) -no-undefined -export-symbols $(srcdir)/extension/libuv.symbols
|
||||
$(LIBTOOL) --tag=CC --mode=link $(CC) -o $@ libuv.lo libgetdns.la $(LDFLAGS) $(EXTENSION_LIBUV_LDFLAGS) $(EXTENSION_LIBUV_EXT_LIBS) -rpath $(libdir) -version-info $(libversion) -no-undefined -export-symbols $(srcdir)/extension/libuv.symbols
|
||||
|
||||
|
||||
libgetdns_ext_ev.la: libgetdns.la libev.lo
|
||||
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) -o $@ libev.lo libgetdns.la $(LDFLAGS) $(EXTENSION_LIBEV_LDFLAGS) $(EXTENSION_LIBEV_EXT_LIBS) -rpath $(libdir) -version-info $(libversion) -no-undefined -export-symbols $(srcdir)/extension/libev.symbols
|
||||
$(LIBTOOL) --tag=CC --mode=link $(CC) -o $@ libev.lo libgetdns.la $(LDFLAGS) $(EXTENSION_LIBEV_LDFLAGS) $(EXTENSION_LIBEV_EXT_LIBS) -rpath $(libdir) -version-info $(libversion) -no-undefined -export-symbols $(srcdir)/extension/libev.symbols
|
||||
|
||||
|
||||
libgetdns.la: $(GETDNS_OBJ) version.lo context.lo default_eventloop.lo $(GLDNS_OBJ) $(COMPAT_OBJ) $(UTIL_OBJ) $(JSMN_OBJ)
|
||||
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) -o $@ $(GETDNS_OBJ) version.lo context.lo default_eventloop.lo $(GLDNS_OBJ) $(COMPAT_OBJ) $(UTIL_OBJ) $(JSMN_OBJ) $(LDFLAGS) -rpath $(libdir) -version-info $(libversion) -no-undefined -export-symbols $(srcdir)/libgetdns.symbols
|
||||
|
||||
$(LIBTOOL) --tag=CC --mode=link $(CC) -o $@ $(GETDNS_OBJ) version.lo context.lo default_eventloop.lo $(GLDNS_OBJ) $(COMPAT_OBJ) $(UTIL_OBJ) $(JSMN_OBJ) $(LDFLAGS) -rpath $(libdir) -version-info $(libversion) -no-undefined -export-symbols $(srcdir)/libgetdns.symbols
|
||||
|
||||
test: all
|
||||
cd test && $(MAKE) $@
|
||||
|
|
|
@ -38,6 +38,9 @@
|
|||
#ifndef GETDNS_ON_WINDOWS
|
||||
#include <sys/mman.h>
|
||||
#endif
|
||||
#if defined(GETDNS_ON_WINDOWS) && !defined(MAP_INHERIT_ZERO)
|
||||
#define explicit_bzero(rnd, rnd_size) memset(rnd, 0, rnd_size)
|
||||
#endif
|
||||
|
||||
#define KEYSTREAM_ONLY
|
||||
#include "chacha_private.h"
|
||||
|
@ -136,7 +139,15 @@ _rs_stir_if_needed(size_t len)
|
|||
{
|
||||
#ifndef MAP_INHERIT_ZERO
|
||||
static pid_t _rs_pid = 0;
|
||||
#ifdef GETDNS_ON_WINDOWS
|
||||
/*
|
||||
* TODO: if compiling for the Windows Runtime, use GetCurrentProcessId(),
|
||||
* but this requires linking with kernel32.lib
|
||||
*/
|
||||
pid_t pid = _getpid();
|
||||
#else
|
||||
pid_t pid = getpid();
|
||||
#endif
|
||||
|
||||
/* If a system lacks MAP_INHERIT_ZERO, resort to getpid() */
|
||||
if (_rs_pid == 0 || _rs_pid != pid) {
|
||||
|
|
|
@ -39,7 +39,7 @@ arc4random_uniform(uint32_t upper_bound)
|
|||
return 0;
|
||||
|
||||
/* 2**32 % x == (2**32 - x) % x */
|
||||
min = -upper_bound % upper_bound;
|
||||
min = ((uint32_t)(-(int32_t)upper_bound)) % upper_bound;
|
||||
|
||||
/*
|
||||
* This could theoretically loop forever but each retry has
|
||||
|
|
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
* Copyright (c) 2016 Christian Huitema <huitema@huitema.net>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Numerous places in the code make reference to the Unix/Linux
|
||||
* "gettimeofday()" function, which is not available in the standard
|
||||
* windows libraries. This code provides a compatible implementation.
|
||||
*/
|
||||
#include "config.h"
|
||||
|
||||
#ifdef GETDNS_ON_WINDOWS
|
||||
int gettimeofday(struct timeval* tv, struct timezone* tz)
|
||||
{
|
||||
FILETIME ft;
|
||||
uint64_t now = 0;
|
||||
|
||||
/*
|
||||
* The GetSystemTimeAsFileTime API returns the number
|
||||
* of 100-nanosecond intervals since January 1, 1601 (UTC),
|
||||
* in FILETIME format.
|
||||
*/
|
||||
GetSystemTimeAsFileTime(&ft);
|
||||
|
||||
/*
|
||||
* Convert to plain 64 bit format, without making
|
||||
* assumptions about the FILETIME structure alignment.
|
||||
*/
|
||||
now |= ft.dwHighDateTime;
|
||||
now <<= 32;
|
||||
now |= ft.dwLowDateTime;
|
||||
/*
|
||||
* Convert units from 100ns to 1us
|
||||
*/
|
||||
now /= 10;
|
||||
/*
|
||||
* Account for microseconds elapsed between 1601 and 1970.
|
||||
*/
|
||||
now -= 11644473600000000ULL;
|
||||
|
||||
if (tv != NULL)
|
||||
{
|
||||
uint64_t sec = now / 1000000;
|
||||
uint64_t usec = now % 1000000;
|
||||
|
||||
tv->tv_sec = (long)sec;
|
||||
tv->tv_usec = (long)usec;
|
||||
}
|
||||
|
||||
if (tz != NULL)
|
||||
{
|
||||
/*
|
||||
* TODO: implement a timezone retrieval function.
|
||||
* Not urgent, since the GetDNS code always set this parameter to NULL.
|
||||
*/
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* GETDNS_ON_WINDOWS */
|
|
@ -440,7 +440,7 @@ sockaddr_dict(getdns_context *context, struct sockaddr *sa)
|
|||
break;
|
||||
|
||||
port = ntohs(((struct sockaddr_in6 *)sa)->sin6_port);
|
||||
if (port != GETDNS_PORT_DNS && port != GETDNS_PORT_DNS &&
|
||||
if (port != GETDNS_PORT_ZERO && port != GETDNS_PORT_DNS &&
|
||||
getdns_dict_set_int(address, "port", (uint32_t)port))
|
||||
break;
|
||||
|
||||
|
@ -682,7 +682,13 @@ _getdns_upstreams_dereference(getdns_upstreams *upstreams)
|
|||
SSL_free(upstream->tls_obj);
|
||||
}
|
||||
if (upstream->fd != -1)
|
||||
{
|
||||
#ifdef USE_WINSOCK
|
||||
closesocket(upstream->fd);
|
||||
#else
|
||||
close(upstream->fd);
|
||||
#endif
|
||||
}
|
||||
while (pin) {
|
||||
sha256_pin_t *nextpin = pin->next;
|
||||
GETDNS_FREE(upstreams->mf, pin);
|
||||
|
@ -775,7 +781,11 @@ _getdns_upstream_shutdown(getdns_upstream *upstream)
|
|||
upstream->tls_obj = NULL;
|
||||
}
|
||||
if (upstream->fd != -1) {
|
||||
#ifdef USE_WINSOCK
|
||||
closesocket(upstream->fd);
|
||||
#else
|
||||
close(upstream->fd);
|
||||
#endif
|
||||
upstream->fd = -1;
|
||||
}
|
||||
/* Set connection ready for use again*/
|
||||
|
@ -837,7 +847,7 @@ static getdns_tsig_info const * const last_tsig_info =
|
|||
|
||||
const getdns_tsig_info *_getdns_get_tsig_info(getdns_tsig_algo tsig_alg)
|
||||
{
|
||||
return tsig_alg > n_tsig_infos - 1
|
||||
return ((unsigned) tsig_alg > n_tsig_infos - 1)
|
||||
|| tsig_info[tsig_alg].alg == GETDNS_NO_TSIG ? NULL
|
||||
: &tsig_info[tsig_alg];
|
||||
}
|
||||
|
@ -1023,6 +1033,7 @@ set_os_defaults_windows(struct getdns_context *context)
|
|||
getdns_upstream *upstream;
|
||||
size_t length;
|
||||
int s;
|
||||
uint32_t info_err = 0;
|
||||
|
||||
if (context->fchg_resolvconf == NULL) {
|
||||
context->fchg_resolvconf =
|
||||
|
@ -1055,15 +1066,16 @@ set_os_defaults_windows(struct getdns_context *context)
|
|||
if (info == NULL)
|
||||
return GETDNS_RETURN_GENERIC_ERROR;
|
||||
|
||||
if (GetNetworkParams(info, &buflen) == ERROR_BUFFER_OVERFLOW) {
|
||||
if ((info_err = GetNetworkParams(info, &buflen)) == ERROR_BUFFER_OVERFLOW) {
|
||||
free(info);
|
||||
info = (FIXED_INFO *)malloc(buflen);
|
||||
if (info == NULL)
|
||||
return GETDNS_RETURN_GENERIC_ERROR;
|
||||
info_err = GetNetworkParams(info, &buflen);
|
||||
}
|
||||
|
||||
if (GetNetworkParams(info, &buflen) == NO_ERROR) {
|
||||
ptr = info->DnsServerList.Next;
|
||||
if (info_err == NO_ERROR) {
|
||||
ptr = &info->DnsServerList;
|
||||
*domain = 0;
|
||||
while (ptr) {
|
||||
for (size_t i = 0; i < GETDNS_UPSTREAM_TRANSPORTS; i++) {
|
||||
|
@ -1080,11 +1092,12 @@ set_os_defaults_windows(struct getdns_context *context)
|
|||
freeaddrinfo(result);
|
||||
}
|
||||
ptr = ptr->Next;
|
||||
|
||||
}
|
||||
free(info);
|
||||
}
|
||||
|
||||
if (info != NULL)
|
||||
free(info);
|
||||
|
||||
suffix = getdns_list_create_with_context(context);
|
||||
|
||||
if (get_dns_suffix_windows(suffix, domain)) {
|
||||
|
@ -2001,11 +2014,13 @@ getdns_context_set_tls_authentication(getdns_context *context,
|
|||
return GETDNS_RETURN_GOOD;
|
||||
} /* getdns_context_set_tls_authentication_list */
|
||||
|
||||
#ifdef HAVE_LIBUNBOUND
|
||||
static void
|
||||
set_ub_limit_outstanding_queries(struct getdns_context* context, uint16_t value) {
|
||||
set_ub_limit_outstanding_queries(getdns_context* context, uint16_t value) {
|
||||
/* num-queries-per-thread */
|
||||
set_ub_number_opt(context, "num-queries-per-thread:", value);
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
* getdns_context_set_limit_outstanding_queries
|
||||
*
|
||||
|
@ -2015,7 +2030,9 @@ getdns_context_set_limit_outstanding_queries(struct getdns_context *context,
|
|||
uint16_t limit)
|
||||
{
|
||||
RETURN_IF_NULL(context, GETDNS_RETURN_INVALID_PARAMETER);
|
||||
#ifdef HAVE_LIBUNBOUND
|
||||
set_ub_limit_outstanding_queries(context, limit);
|
||||
#endif
|
||||
if (limit != context->limit_outstanding_queries) {
|
||||
context->limit_outstanding_queries = limit;
|
||||
dispatch_updated(context,
|
||||
|
@ -2319,7 +2336,7 @@ getdns_context_set_suffix(getdns_context *context, getdns_list *value)
|
|||
if (gldns_str2wire_dname_buf(name, dname, &dname_len))
|
||||
return GETDNS_RETURN_GENERIC_ERROR;
|
||||
|
||||
gldns_buffer_write_u8(&gbuf, dname_len);
|
||||
gldns_buffer_write_u8(&gbuf, (uint8_t) dname_len);
|
||||
gldns_buffer_write(&gbuf, dname, dname_len);
|
||||
}
|
||||
if (r == GETDNS_RETURN_NO_SUCH_LIST_ITEM)
|
||||
|
@ -2387,11 +2404,13 @@ getdns_context_set_dnssec_trust_anchors(
|
|||
return GETDNS_RETURN_GOOD;
|
||||
} /* getdns_context_set_dnssec_trust_anchors */
|
||||
|
||||
#ifdef HAVE_LIBUNBOUND
|
||||
static void
|
||||
set_ub_dnssec_allowed_skew(struct getdns_context* context, uint32_t value) {
|
||||
set_ub_number_opt(context, "val-sig-skew-min:", value);
|
||||
set_ub_number_opt(context, "val-sig-skew-max:", value);
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
* getdns_context_set_dnssec_allowed_skew
|
||||
*
|
||||
|
@ -2401,7 +2420,9 @@ getdns_context_set_dnssec_allowed_skew(struct getdns_context *context,
|
|||
uint32_t value)
|
||||
{
|
||||
RETURN_IF_NULL(context, GETDNS_RETURN_INVALID_PARAMETER);
|
||||
#ifdef HAVE_LIBUNBOUND
|
||||
set_ub_dnssec_allowed_skew(context, value);
|
||||
#endif
|
||||
if (value != context->dnssec_allowed_skew) {
|
||||
context->dnssec_allowed_skew = value;
|
||||
dispatch_updated(context, GETDNS_CONTEXT_CODE_DNSSEC_ALLOWED_SKEW);
|
||||
|
@ -2669,6 +2690,7 @@ error:
|
|||
} /* getdns_context_set_upstream_recursive_servers */
|
||||
|
||||
|
||||
#ifdef HAVE_LIBUNBOUND
|
||||
static void
|
||||
set_ub_edns_maximum_udp_payload_size(struct getdns_context* context,
|
||||
int value) {
|
||||
|
@ -2676,6 +2698,7 @@ set_ub_edns_maximum_udp_payload_size(struct getdns_context* context,
|
|||
if (value >= 512 && value <= 65535)
|
||||
set_ub_number_opt(context, "edns-buffer-size:", (uint16_t)value);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* getdns_context_set_edns_maximum_udp_payload_size
|
||||
|
@ -2692,7 +2715,9 @@ getdns_context_set_edns_maximum_udp_payload_size(struct getdns_context *context,
|
|||
if (value < 512)
|
||||
value = 512;
|
||||
|
||||
#ifdef HAVE_LIBUNBOUND
|
||||
set_ub_edns_maximum_udp_payload_size(context, value);
|
||||
#endif
|
||||
if (value != context->edns_maximum_udp_payload_size) {
|
||||
context->edns_maximum_udp_payload_size = value;
|
||||
dispatch_updated(context,
|
||||
|
@ -3557,7 +3582,7 @@ _getdns_context_local_namespace_resolve(
|
|||
getdns_context *context = dnsreq->context;
|
||||
host_name_addrs *hnas;
|
||||
uint8_t lookup[256];
|
||||
getdns_list empty_list = { 0 };
|
||||
getdns_list empty_list = { 0, 0, NULL, { NULL, {{ NULL, NULL, NULL }}}};
|
||||
getdns_bindata bindata;
|
||||
getdns_list *jaa;
|
||||
size_t i;
|
||||
|
|
|
@ -57,6 +57,15 @@
|
|||
#include "convert.h"
|
||||
#include "debug.h"
|
||||
|
||||
/* strdup is marked deprecated by the Windows compiler */
|
||||
#ifndef STRDUP
|
||||
#ifdef GETDNS_ON_WINDOWS
|
||||
#define STRDUP(x) _strdup(x)
|
||||
#else
|
||||
#define STRDUP(x) strdup(x)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
getdns_return_t
|
||||
getdns_convert_dns_name_to_fqdn(
|
||||
const getdns_bindata *dns_name_wire_fmt, char **fqdn_as_string)
|
||||
|
@ -201,7 +210,7 @@ getdns_display_ip_address(const struct getdns_bindata
|
|||
buff,
|
||||
256);
|
||||
if (ipStr) {
|
||||
return strdup(ipStr);
|
||||
return STRDUP(ipStr);
|
||||
}
|
||||
} else if (bindata_of_ipv4_or_ipv6_address->size == 16) {
|
||||
const char *ipStr = inet_ntop(AF_INET6,
|
||||
|
@ -209,7 +218,7 @@ getdns_display_ip_address(const struct getdns_bindata
|
|||
buff,
|
||||
256);
|
||||
if (ipStr) {
|
||||
return strdup(ipStr);
|
||||
return STRDUP(ipStr);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
|
|
|
@ -65,7 +65,7 @@ static char *_json_ptr_first(const struct mem_funcs *mf,
|
|||
if (!(next_ref = strchr(jptr, '/')))
|
||||
next_ref = strchr(jptr, '\0');
|
||||
|
||||
if (next_ref - jptr + 1 > first_sz || !first)
|
||||
if ((unsigned)(next_ref - jptr + 1) > first_sz || !first)
|
||||
first = GETDNS_XMALLOC(*mf, char, next_ref - jptr + 1);
|
||||
|
||||
for (j = first, k = jptr; k < next_ref; j++, k++)
|
||||
|
|
13
src/dnssec.c
13
src/dnssec.c
|
@ -559,7 +559,7 @@ static chain_head *add_rrset2val_chain(struct mem_funcs *mf,
|
|||
if (! _dname_is_parent(*label, head->rrset.name))
|
||||
break;
|
||||
}
|
||||
if (label - labels > max_labels) {
|
||||
if ((unsigned)(label - labels) > max_labels) {
|
||||
max_labels = label - labels;
|
||||
max_head = head;
|
||||
}
|
||||
|
@ -616,6 +616,11 @@ static chain_head *add_rrset2val_chain(struct mem_funcs *mf,
|
|||
head->node_count = node_count;
|
||||
|
||||
if (!node_count) {
|
||||
/* When this head has no nodes of itself, it must have found
|
||||
* another head which has nodes for its labels (i.e. max_head)
|
||||
*/
|
||||
assert(max_head != NULL);
|
||||
|
||||
head->parent = max_head->parent;
|
||||
return head;
|
||||
}
|
||||
|
@ -857,6 +862,7 @@ static getdns_dict *CD_extension(getdns_dns_req *dnsreq)
|
|||
? dnssec_ok_checking_disabled_roadblock_avoidance
|
||||
: dnssec_ok_checking_disabled_avoid_roadblocks;
|
||||
#else
|
||||
(void)dnsreq;
|
||||
return dnssec_ok_checking_disabled;
|
||||
#endif
|
||||
}
|
||||
|
@ -1089,6 +1095,9 @@ static void val_chain_node_soa_cb(getdns_dns_req *dnsreq)
|
|||
_getdns_rrset *rrset;
|
||||
|
||||
_getdns_context_clear_outbound_request(dnsreq);
|
||||
/* 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
|
||||
|
@ -1626,7 +1635,7 @@ static int nsec3_iteration_count_high(_getdns_rrtype_iter *dnskey, _getdns_rrset
|
|||
return gldns_read_uint16(rr->rr_i.rr_type + 12) > 150;
|
||||
}
|
||||
|
||||
static int check_dates(int32_t now, int32_t skew, int32_t exp, int32_t inc)
|
||||
static int check_dates(time_t now, int32_t skew, int32_t exp, int32_t inc)
|
||||
{
|
||||
return (exp - inc > 0) && (inc - now < skew) && (now - exp < skew);
|
||||
}
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "extension/default_eventloop.h"
|
||||
#include "debug.h"
|
||||
#include "types-internal.h"
|
||||
|
@ -33,7 +35,7 @@ static uint64_t get_now_plus(uint64_t amount)
|
|||
{
|
||||
struct timeval tv;
|
||||
uint64_t now;
|
||||
|
||||
|
||||
if (gettimeofday(&tv, NULL)) {
|
||||
perror("gettimeofday() failed");
|
||||
exit(EXIT_FAILURE);
|
||||
|
@ -83,8 +85,7 @@ default_eventloop_schedule(getdns_eventloop *loop,
|
|||
#endif
|
||||
default_loop->fd_events[fd] = event;
|
||||
default_loop->fd_timeout_times[fd] = get_now_plus(timeout);
|
||||
event->ev = (void *) (intptr_t) (fd + 1);
|
||||
|
||||
event->ev = (void *)(intptr_t)(fd + 1);
|
||||
DEBUG_SCHED( "scheduled read/write at %d\n", fd);
|
||||
return GETDNS_RETURN_GOOD;
|
||||
}
|
||||
|
@ -103,9 +104,8 @@ default_eventloop_schedule(getdns_eventloop *loop,
|
|||
for (i = 0; i < MAX_TIMEOUTS; i++) {
|
||||
if (default_loop->timeout_events[i] == NULL) {
|
||||
default_loop->timeout_events[i] = event;
|
||||
default_loop->timeout_times[i] = get_now_plus(timeout);
|
||||
event->ev = (void *) (intptr_t) (i + 1);
|
||||
|
||||
default_loop->timeout_times[i] = get_now_plus(timeout);
|
||||
event->ev = (void *)(intptr_t)(i + 1);
|
||||
DEBUG_SCHED( "scheduled timeout at %d\n", (int)i);
|
||||
return GETDNS_RETURN_GOOD;
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ default_eventloop_clear(getdns_eventloop *loop, getdns_eventloop_event *event)
|
|||
DEBUG_SCHED( "%s(loop: %p, event: %p)\n", __FUNCTION__, loop, event);
|
||||
|
||||
i = (intptr_t)event->ev - 1;
|
||||
if (i < 0 || i > FD_SETSIZE) {
|
||||
if (i < 0 || i >= FD_SETSIZE) {
|
||||
return GETDNS_RETURN_GENERIC_ERROR;
|
||||
}
|
||||
if (event->timeout_cb && !event->read_cb && !event->write_cb) {
|
||||
|
@ -231,8 +231,8 @@ default_eventloop_run_once(getdns_eventloop *loop, int blocking)
|
|||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 0;
|
||||
} else {
|
||||
tv.tv_sec = (timeout - now) / 1000000;
|
||||
tv.tv_usec = (timeout - now) % 1000000;
|
||||
tv.tv_sec = (long)((timeout - now) / 1000000);
|
||||
tv.tv_usec = (long)((timeout - now) % 1000000);
|
||||
}
|
||||
if (select(max_fd + 1, &readfds, &writefds, NULL,
|
||||
(timeout == TIMEOUT_FOREVER ? NULL : &tv)) < 0) {
|
||||
|
|
|
@ -353,6 +353,9 @@ _getdns_list_copy(const struct getdns_list * srclist,
|
|||
retval = _getdns_list_append_dict(*dstlist,
|
||||
srclist->items[i].data.dict);
|
||||
break;
|
||||
default:
|
||||
retval = GETDNS_RETURN_WRONG_TYPE_REQUESTED;
|
||||
break;
|
||||
}
|
||||
if (retval != GETDNS_RETURN_GOOD) {
|
||||
getdns_list_destroy(*dstlist);
|
||||
|
|
|
@ -65,20 +65,20 @@
|
|||
|
||||
getdns_dict dnssec_ok_checking_disabled_spc = {
|
||||
{ RBTREE_NULL, 0, (int (*)(const void *, const void *)) strcmp },
|
||||
{ 0 }
|
||||
{ NULL, {{ NULL, NULL, NULL }}}
|
||||
};
|
||||
getdns_dict *dnssec_ok_checking_disabled = &dnssec_ok_checking_disabled_spc;
|
||||
|
||||
getdns_dict dnssec_ok_checking_disabled_roadblock_avoidance_spc = {
|
||||
{ RBTREE_NULL, 0, (int (*)(const void *, const void *)) strcmp },
|
||||
{ 0 }
|
||||
{ NULL, {{ NULL, NULL, NULL }}}
|
||||
};
|
||||
getdns_dict *dnssec_ok_checking_disabled_roadblock_avoidance
|
||||
= &dnssec_ok_checking_disabled_roadblock_avoidance_spc;
|
||||
|
||||
getdns_dict dnssec_ok_checking_disabled_avoid_roadblocks_spc = {
|
||||
{ RBTREE_NULL, 0, (int (*)(const void *, const void *)) strcmp },
|
||||
{ 0 }
|
||||
{ NULL, {{ NULL, NULL, NULL }}}
|
||||
};
|
||||
getdns_dict *dnssec_ok_checking_disabled_avoid_roadblocks
|
||||
= &dnssec_ok_checking_disabled_avoid_roadblocks_spc;
|
||||
|
@ -262,10 +262,10 @@ _getdns_network_req_clear_upstream_options(getdns_network_req * req)
|
|||
{
|
||||
size_t pktlen;
|
||||
if (req->opt) {
|
||||
gldns_write_uint16(req->opt + 9, req->base_query_option_sz);
|
||||
gldns_write_uint16(req->opt + 9, (uint16_t) req->base_query_option_sz);
|
||||
req->response = req->opt + 11 + req->base_query_option_sz;
|
||||
pktlen = req->response - req->query;
|
||||
gldns_write_uint16(req->query - 2, pktlen);
|
||||
gldns_write_uint16(req->query - 2, (uint16_t) pktlen);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -428,7 +428,7 @@ _getdns_network_req_add_tsig(getdns_network_req *req)
|
|||
gldns_buffer_write_u16(&gbuf, GETDNS_RRCLASS_ANY); /* Class */
|
||||
gldns_buffer_write_u32(&gbuf, 0); /* TTL */
|
||||
gldns_buffer_write_u16(&gbuf,
|
||||
tsig_info->dname_len + 10 + md_len + 6); /* RdLen */
|
||||
(uint16_t)(tsig_info->dname_len + 10 + md_len + 6)); /* RdLen */
|
||||
gldns_buffer_write(&gbuf,
|
||||
tsig_info->dname, tsig_info->dname_len); /* Algorithm Name */
|
||||
gldns_buffer_write_u48(&gbuf, time(NULL)); /* Time Signed */
|
||||
|
@ -565,7 +565,7 @@ _getdns_network_validate_tsig(getdns_network_req *req)
|
|||
return;
|
||||
|
||||
gldns_buffer_write_u16(&gbuf, 0); /* Other len */
|
||||
other_len = gldns_read_uint16(rdf->pos);
|
||||
other_len = (uint8_t) gldns_read_uint16(rdf->pos);
|
||||
if (other_len != rdf->nxt - rdf->pos - 2)
|
||||
return;
|
||||
if (other_len)
|
||||
|
@ -930,7 +930,7 @@ _getdns_dns_req_new(getdns_context *context, getdns_eventloop *loop,
|
|||
request_type, dnssec_extension_set, with_opt,
|
||||
edns_maximum_udp_payload_size,
|
||||
edns_extended_rcode, edns_version, edns_do_bit,
|
||||
opt_options_size, noptions, options,
|
||||
(uint16_t) opt_options_size, noptions, options,
|
||||
netreq_sz - sizeof(getdns_network_req), max_query_sz,
|
||||
extensions);
|
||||
|
||||
|
@ -941,7 +941,7 @@ _getdns_dns_req_new(getdns_context *context, getdns_eventloop *loop,
|
|||
dnssec_extension_set, with_opt,
|
||||
edns_maximum_udp_payload_size,
|
||||
edns_extended_rcode, edns_version, edns_do_bit,
|
||||
opt_options_size, noptions, options,
|
||||
(uint16_t) opt_options_size, noptions, options,
|
||||
netreq_sz - sizeof(getdns_network_req), max_query_sz,
|
||||
extensions);
|
||||
|
||||
|
|
|
@ -433,7 +433,7 @@ hip_hit_2wire(
|
|||
return GETDNS_RETURN_NEED_MORE_SPACE;
|
||||
}
|
||||
*rdf_len = value->size;
|
||||
rdata[0] = value->size;
|
||||
rdata[0] = (uint8_t) value->size;
|
||||
(void)memcpy(rdf, value->data, value->size);
|
||||
return GETDNS_RETURN_GOOD;
|
||||
}
|
||||
|
@ -506,7 +506,7 @@ hip_public_key_2wire(
|
|||
return GETDNS_RETURN_NEED_MORE_SPACE;
|
||||
}
|
||||
*rdf_len = value->size;
|
||||
gldns_write_uint16(rdata + 2, value->size);
|
||||
gldns_write_uint16(rdata + 2, (uint16_t) value->size);
|
||||
(void)memcpy(rdf, value->data, value->size);
|
||||
return GETDNS_RETURN_GOOD;
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ find_rrtype(_getdns_rr_iter *i)
|
|||
/* Past the last RR in the pkt */
|
||||
if (i->pkt &&
|
||||
(size_t)GLDNS_QDCOUNT(i->pkt) + GLDNS_ANCOUNT(i->pkt) +
|
||||
GLDNS_NSCOUNT(i->pkt) + GLDNS_ARCOUNT(i->pkt) <= i->n)
|
||||
GLDNS_NSCOUNT(i->pkt) + GLDNS_ARCOUNT(i->pkt) <= i->n)
|
||||
goto done;
|
||||
|
||||
for (pos = i->pos; pos + 4 < i->pkt_end; pos += *pos + 1)
|
||||
|
@ -101,7 +101,7 @@ done:
|
|||
}
|
||||
|
||||
_getdns_rr_iter *
|
||||
_getdns_rr_iter_init(_getdns_rr_iter *i, const uint8_t *pkt, size_t pkt_len)
|
||||
_getdns_rr_iter_init(_getdns_rr_iter *i, const uint8_t *pkt, const size_t pkt_len)
|
||||
{
|
||||
assert(i);
|
||||
|
||||
|
@ -119,7 +119,7 @@ _getdns_rr_iter_init(_getdns_rr_iter *i, const uint8_t *pkt, size_t pkt_len)
|
|||
|
||||
_getdns_rr_iter *
|
||||
_getdns_single_rr_iter_init(
|
||||
_getdns_rr_iter *i, const uint8_t *wire, size_t wire_len)
|
||||
_getdns_rr_iter *i, const uint8_t *wire, const size_t wire_len)
|
||||
{
|
||||
assert(i);
|
||||
|
||||
|
|
|
@ -86,19 +86,19 @@ const uint8_t *_getdns_owner_if_or_as_decompressed(
|
|||
static inline _getdns_section
|
||||
_getdns_rr_iter_section(_getdns_rr_iter *i)
|
||||
{
|
||||
return !i->pkt ? (i->nxt - i->rr_type == 4 ? SECTION_QUESTION
|
||||
: SECTION_ANSWER )
|
||||
return ! i->pkt ? (i->nxt - i->rr_type == 4 ? SECTION_QUESTION
|
||||
: SECTION_ANSWER )
|
||||
: i->n < (size_t)GLDNS_QDCOUNT(i->pkt) ? SECTION_QUESTION
|
||||
: i->n < (size_t)GLDNS_QDCOUNT(i->pkt)
|
||||
+ GLDNS_ANCOUNT(i->pkt) ? SECTION_ANSWER
|
||||
+ GLDNS_ANCOUNT(i->pkt) ? SECTION_ANSWER
|
||||
: i->n < (size_t)GLDNS_QDCOUNT(i->pkt)
|
||||
+ GLDNS_ANCOUNT(i->pkt)
|
||||
+ GLDNS_NSCOUNT(i->pkt) ? SECTION_AUTHORITY
|
||||
+ GLDNS_ANCOUNT(i->pkt)
|
||||
+ GLDNS_NSCOUNT(i->pkt) ? SECTION_AUTHORITY
|
||||
: i->n < (size_t)GLDNS_QDCOUNT(i->pkt)
|
||||
+ GLDNS_ANCOUNT(i->pkt)
|
||||
+ GLDNS_NSCOUNT(i->pkt)
|
||||
+ GLDNS_ARCOUNT(i->pkt) ? SECTION_ADDITIONAL
|
||||
: SECTION_ANY;
|
||||
+ GLDNS_ANCOUNT(i->pkt)
|
||||
+ GLDNS_NSCOUNT(i->pkt)
|
||||
+ GLDNS_ARCOUNT(i->pkt) ? SECTION_ADDITIONAL
|
||||
: SECTION_ANY;
|
||||
}
|
||||
|
||||
/* Utility functions to read rr_type and rr_class from a rr iterator */
|
||||
|
|
45
src/stub.c
45
src/stub.c
|
@ -86,7 +86,7 @@ static void upstream_idle_timeout_cb(void *userarg);
|
|||
static void upstream_schedule_netreq(getdns_upstream *upstream,
|
||||
getdns_network_req *netreq);
|
||||
static void upstream_reschedule_events(getdns_upstream *upstream,
|
||||
size_t idle_timeout);
|
||||
uint64_t idle_timeout);
|
||||
static int upstream_working_ok(getdns_upstream *upstream);
|
||||
static int upstream_auth_status_ok(getdns_upstream *upstream,
|
||||
getdns_network_req *netreq);
|
||||
|
@ -398,6 +398,7 @@ tcp_connect(getdns_upstream *upstream, getdns_transport_list_t transport)
|
|||
if (transport == GETDNS_TRANSPORT_TCP)
|
||||
return fd;
|
||||
#elif USE_OSX_TCP_FASTOPEN
|
||||
(void)transport;
|
||||
sa_endpoints_t endpoints;
|
||||
endpoints.sae_srcif = 0;
|
||||
endpoints.sae_srcaddr = NULL;
|
||||
|
@ -413,12 +414,18 @@ tcp_connect(getdns_upstream *upstream, getdns_transport_list_t transport)
|
|||
}
|
||||
}
|
||||
return fd;
|
||||
#else
|
||||
(void)transport;
|
||||
#endif
|
||||
if (connect(fd, (struct sockaddr *)&upstream->addr,
|
||||
upstream->addr_len) == -1) {
|
||||
if (_getdns_EINPROGRESS || _getdns_EWOULDBLOCK)
|
||||
return fd;
|
||||
#ifdef USE_WINSOCK
|
||||
closesocket(fd);
|
||||
#else
|
||||
close(fd);
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
return fd;
|
||||
|
@ -557,7 +564,13 @@ _getdns_cancel_stub_request(getdns_network_req *netreq)
|
|||
DEBUG_STUB("%s %-35s: MSG: %p\n",
|
||||
STUB_DEBUG_CLEANUP, __FUNCTION__, netreq);
|
||||
stub_cleanup(netreq);
|
||||
if (netreq->fd >= 0) close(netreq->fd);
|
||||
if (netreq->fd >= 0) {
|
||||
#ifdef USE_WINSOCK
|
||||
closesocket(netreq->fd);
|
||||
#else
|
||||
close(netreq->fd);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -570,7 +583,11 @@ stub_timeout_cb(void *userarg)
|
|||
netreq->state = NET_REQ_TIMED_OUT;
|
||||
/* Handle upstream*/
|
||||
if (netreq->fd >= 0) {
|
||||
#ifdef USE_WINSOCK
|
||||
closesocket(netreq->fd);
|
||||
#else
|
||||
close(netreq->fd);
|
||||
#endif
|
||||
netreq->upstream->udp_timeouts++;
|
||||
#if defined(DAEMON_DEBUG) && DAEMON_DEBUG
|
||||
if (netreq->upstream->udp_timeouts % 100 == 0)
|
||||
|
@ -798,8 +815,13 @@ stub_tcp_write(int fd, getdns_tcp_state *tcp, getdns_network_req *netreq)
|
|||
|
||||
/* Coming back from an earlier unfinished write or handshake.
|
||||
* Try to send remaining data */
|
||||
#ifdef USE_WINSOCK
|
||||
written = send(fd, tcp->write_buf + tcp->written,
|
||||
tcp->write_buf_len - tcp->written, 0);
|
||||
#else
|
||||
written = write(fd, tcp->write_buf + tcp->written,
|
||||
tcp->write_buf_len - tcp->written);
|
||||
#endif
|
||||
if (written == -1) {
|
||||
if (_getdns_EWOULDBLOCK)
|
||||
return STUB_TCP_WOULDBLOCK;
|
||||
|
@ -1236,10 +1258,10 @@ stub_tls_write(getdns_upstream *upstream, getdns_tcp_state *tcp,
|
|||
|
||||
static uint64_t
|
||||
_getdns_get_time_as_uintt64() {
|
||||
|
||||
|
||||
struct timeval tv;
|
||||
uint64_t now;
|
||||
|
||||
|
||||
if (gettimeofday(&tv, NULL)) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -1247,6 +1269,7 @@ _getdns_get_time_as_uintt64() {
|
|||
return now;
|
||||
}
|
||||
|
||||
|
||||
/**************************/
|
||||
/* UDP callback functions */
|
||||
/**************************/
|
||||
|
@ -1284,8 +1307,12 @@ stub_udp_read_cb(void *userarg)
|
|||
upstream, netreq->response, read))
|
||||
return; /* Client cookie didn't match? */
|
||||
|
||||
#ifdef USE_WINSOCK
|
||||
closesocket(netreq->fd);
|
||||
#else
|
||||
close(netreq->fd);
|
||||
netreq->fd = -1;
|
||||
#endif
|
||||
while (GLDNS_TC_WIRE(netreq->response)) {
|
||||
DEBUG_STUB("%s %-35s: MSG: %p TC bit set in response \n", STUB_DEBUG_READ,
|
||||
__FUNCTION__, netreq);
|
||||
|
@ -1357,7 +1384,11 @@ stub_udp_write_cb(void *userarg)
|
|||
netreq->fd, (const void *)netreq->query, pkt_len, 0,
|
||||
(struct sockaddr *)&netreq->upstream->addr,
|
||||
netreq->upstream->addr_len)) {
|
||||
#ifdef USE_WINSOCK
|
||||
closesocket(netreq->fd);
|
||||
#else
|
||||
close(netreq->fd);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
GETDNS_SCHEDULE_EVENT(
|
||||
|
@ -1781,7 +1812,11 @@ upstream_connect(getdns_upstream *upstream, getdns_transport_list_t transport,
|
|||
upstream->tls_obj = tls_create_object(dnsreq, fd, upstream);
|
||||
if (upstream->tls_obj == NULL) {
|
||||
upstream_failed(upstream, 1);
|
||||
#ifdef USE_WINSOCK
|
||||
closesocket(fd);
|
||||
#else
|
||||
close(fd);
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
upstream->tls_hs_state = GETDNS_HS_WRITE;
|
||||
|
@ -1879,7 +1914,7 @@ fallback_on_write(getdns_network_req *netreq)
|
|||
}
|
||||
|
||||
static void
|
||||
upstream_reschedule_events(getdns_upstream *upstream, size_t idle_timeout) {
|
||||
upstream_reschedule_events(getdns_upstream *upstream, uint64_t idle_timeout) {
|
||||
|
||||
DEBUG_STUB("%s %-35s: FD: %d \n", STUB_DEBUG_SCHEDULE,
|
||||
__FUNCTION__, upstream->fd);
|
||||
|
|
|
@ -57,7 +57,8 @@ CHECK_EVENT_PROG=@CHECK_EVENT_PROG@
|
|||
CHECK_EV_PROG=@CHECK_EV_PROG@
|
||||
|
||||
CC=@CC@
|
||||
CFLAGS=-I$(srcdir)/.. -I$(srcdir) -I.. $(cflags) @CFLAGS@ @CPPFLAGS@
|
||||
CFLAGS=-I$(srcdir)/.. -I$(srcdir) -I.. $(cflags) @CFLAGS@ @CPPFLAGS@ $(XTRA_CFLAGS)
|
||||
WPEDANTICFLAG=@WPEDANTICFLAG@
|
||||
LDFLAGS=-L.. @LDFLAGS@
|
||||
LDLIBS=../libgetdns.la @LIBS@
|
||||
CHECK_LIBS=@CHECK_LIBS@
|
||||
|
@ -79,53 +80,53 @@ PROGRAMS=tests_dict tests_list tests_namespaces tests_stub_async tests_stub_sync
|
|||
.SUFFIXES: .c .o .a .lo .h
|
||||
|
||||
.c.o:
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
$(CC) $(CFLAGS) $(WPEDANTICFLAG) -c $< -o $@
|
||||
|
||||
.c.lo:
|
||||
$(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) -c $< -o $@
|
||||
$(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) $(WPEDANTICFLAG) -c $< -o $@
|
||||
|
||||
default: all
|
||||
|
||||
all: $(PROGRAMS)
|
||||
|
||||
$(ALL_OBJS):
|
||||
$(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) -c $(srcdir)/$(@:.lo=.c) -o $@
|
||||
$(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) $(WPEDANTICFLAG) -c $(srcdir)/$(@:.lo=.c) -o $@
|
||||
|
||||
$(NON_C99_OBJS):
|
||||
$(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600 -c $(srcdir)/$(@:.lo=.c) -o $@
|
||||
$(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) $(WPEDANTICFLAG) -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600 -c $(srcdir)/$(@:.lo=.c) -o $@
|
||||
|
||||
tests_dict: tests_dict.lo testmessages.lo
|
||||
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -o $@ tests_dict.lo testmessages.lo
|
||||
$(LIBTOOL) --tag=CC --mode=link $(CC) $(LDFLAGS) $(LDLIBS) -o $@ tests_dict.lo testmessages.lo
|
||||
|
||||
tests_list: tests_list.lo testmessages.lo
|
||||
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -o $@ tests_list.lo testmessages.lo
|
||||
$(LIBTOOL) --tag=CC --mode=link $(CC) $(LDFLAGS) $(LDLIBS) -o $@ tests_list.lo testmessages.lo
|
||||
|
||||
tests_namespaces: tests_namespaces.lo
|
||||
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -o $@ tests_namespaces.lo
|
||||
$(LIBTOOL) --tag=CC --mode=link $(CC) $(LDFLAGS) $(LDLIBS) -o $@ tests_namespaces.lo
|
||||
|
||||
tests_stub_async: tests_stub_async.lo testmessages.lo
|
||||
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -o $@ tests_stub_async.lo testmessages.lo
|
||||
$(LIBTOOL) --tag=CC --mode=link $(CC) $(LDFLAGS) $(LDLIBS) -o $@ tests_stub_async.lo testmessages.lo
|
||||
|
||||
tests_stub_sync: tests_stub_sync.lo
|
||||
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -o $@ tests_stub_sync.lo
|
||||
$(LIBTOOL) --tag=CC --mode=link $(CC) $(LDFLAGS) $(LDLIBS) -o $@ tests_stub_sync.lo
|
||||
|
||||
check_getdns_common: check_getdns_common.lo
|
||||
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -o $@ check_getdns_common.lo
|
||||
$(LIBTOOL) --tag=CC --mode=link $(CC) $(LDFLAGS) $(LDLIBS) -o $@ check_getdns_common.lo
|
||||
|
||||
check_getdns: check_getdns.lo check_getdns_common.lo check_getdns_context_set_timeout.lo check_getdns_transport.lo check_getdns_selectloop.lo
|
||||
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) $(CHECK_CFLAGS) $(CHECK_LIBS) -o $@ check_getdns.lo check_getdns_common.lo check_getdns_context_set_timeout.lo check_getdns_transport.lo check_getdns_selectloop.lo
|
||||
$(LIBTOOL) --tag=CC --mode=link $(CC) $(LDFLAGS) $(LDLIBS) $(CHECK_LIBS) -o $@ check_getdns.lo check_getdns_common.lo check_getdns_context_set_timeout.lo check_getdns_transport.lo check_getdns_selectloop.lo
|
||||
|
||||
check_getdns_event: check_getdns.lo check_getdns_common.lo check_getdns_context_set_timeout.lo check_getdns_transport.lo check_getdns_libevent.lo ../libgetdns_ext_event.la
|
||||
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) -o $@ check_getdns.lo check_getdns_common.lo check_getdns_context_set_timeout.lo check_getdns_transport.lo check_getdns_libevent.lo $(LDFLAGS) $(LDLIBS) $(CHECK_CFLAGS) $(CHECK_LIBS) ../libgetdns_ext_event.la $(EXTENSION_LIBEVENT_LDFLAGS) $(EXTENSION_LIBEVENT_EXT_LIBS)
|
||||
$(LIBTOOL) --tag=CC --mode=link $(CC) -o $@ check_getdns.lo check_getdns_common.lo check_getdns_context_set_timeout.lo check_getdns_transport.lo check_getdns_libevent.lo $(LDFLAGS) $(LDLIBS) $(CHECK_LIBS) ../libgetdns_ext_event.la $(EXTENSION_LIBEVENT_LDFLAGS) $(EXTENSION_LIBEVENT_EXT_LIBS)
|
||||
|
||||
check_getdns_uv: check_getdns.lo check_getdns_common.lo check_getdns_context_set_timeout.lo check_getdns_transport.lo check_getdns_libuv.lo ../libgetdns_ext_uv.la
|
||||
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) -o $@ check_getdns.lo check_getdns_common.lo check_getdns_context_set_timeout.lo check_getdns_transport.lo check_getdns_libuv.lo $(LDFLAGS) $(LDLIBS) $(CHECK_CFLAGS) $(CHECK_LIBS) ../libgetdns_ext_uv.la $(EXTENSION_LIBUV_LDFLAGS) $(EXTENSION_LIBUV_EXT_LIBS)
|
||||
$(LIBTOOL) --tag=CC --mode=link $(CC) -o $@ check_getdns.lo check_getdns_common.lo check_getdns_context_set_timeout.lo check_getdns_transport.lo check_getdns_libuv.lo $(LDFLAGS) $(LDLIBS) $(CHECK_LIBS) ../libgetdns_ext_uv.la $(EXTENSION_LIBUV_LDFLAGS) $(EXTENSION_LIBUV_EXT_LIBS)
|
||||
|
||||
check_getdns_ev: check_getdns.lo check_getdns_common.lo check_getdns_context_set_timeout.lo check_getdns_transport.lo check_getdns_libev.lo ../libgetdns_ext_ev.la
|
||||
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) -o $@ check_getdns.lo check_getdns_common.lo check_getdns_context_set_timeout.lo check_getdns_transport.lo check_getdns_libev.lo $(LDFLAGS) $(LDLIBS) $(CHECK_CFLAGS) $(CHECK_LIBS) ../libgetdns_ext_ev.la $(EXTENSION_LIBEV_LDFLAGS) $(EXTENSION_LIBEV_EXT_LIBS)
|
||||
$(LIBTOOL) --tag=CC --mode=link $(CC) -o $@ check_getdns.lo check_getdns_common.lo check_getdns_context_set_timeout.lo check_getdns_transport.lo check_getdns_libev.lo $(LDFLAGS) $(LDLIBS) $(CHECK_LIBS) ../libgetdns_ext_ev.la $(EXTENSION_LIBEV_LDFLAGS) $(EXTENSION_LIBEV_EXT_LIBS)
|
||||
|
||||
scratchpad: scratchpad.lo
|
||||
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) -o $@ scratchpad.lo $(LDFLAGS) $(LDLIBS)
|
||||
$(LIBTOOL) --tag=CC --mode=link $(CC) -o $@ scratchpad.lo $(LDFLAGS) $(LDLIBS)
|
||||
|
||||
scratchpad.lo: scratchpad.c
|
||||
|
||||
|
|
|
@ -149,6 +149,7 @@
|
|||
* rcode = 0
|
||||
*/
|
||||
void verify_getdns_address_6(struct extracted_response *ex_response);
|
||||
fn_cont fn_ref = { verify_getdns_address_6 };
|
||||
struct getdns_context *context = NULL; \
|
||||
void* eventloop = NULL; \
|
||||
getdns_transaction_t transaction_id = 0;
|
||||
|
@ -157,7 +158,7 @@
|
|||
EVENT_BASE_CREATE;
|
||||
|
||||
ASSERT_RC(getdns_address(context, "google.com", NULL,
|
||||
verify_getdns_address_6, &transaction_id, callbackfn),
|
||||
&fn_ref, &transaction_id, callbackfn),
|
||||
GETDNS_RETURN_GOOD, "Return code from getdns_address()");
|
||||
|
||||
RUN_EVENT_LOOP;
|
||||
|
@ -183,6 +184,7 @@
|
|||
* ancount = 1 (number of records in ANSWER section)
|
||||
*/
|
||||
void verify_getdns_address_7(struct extracted_response *ex_response);
|
||||
fn_cont fn_ref = { verify_getdns_address_7 };
|
||||
struct getdns_context *context = NULL; \
|
||||
void* eventloop = NULL; \
|
||||
getdns_transaction_t transaction_id = 0;
|
||||
|
@ -191,7 +193,7 @@
|
|||
EVENT_BASE_CREATE;
|
||||
|
||||
ASSERT_RC(getdns_address(context, "localhost", NULL,
|
||||
verify_getdns_address_7, &transaction_id, callbackfn),
|
||||
&fn_ref, &transaction_id, callbackfn),
|
||||
GETDNS_RETURN_GOOD, "Return code from getdns_address()");
|
||||
|
||||
RUN_EVENT_LOOP;
|
||||
|
@ -213,6 +215,7 @@
|
|||
* rcode = 3 (NXDOMAIN)
|
||||
*/
|
||||
void verify_getdns_address_8(struct extracted_response *ex_response);
|
||||
fn_cont fn_ref = { verify_getdns_address_8 };
|
||||
struct getdns_context *context = NULL; \
|
||||
void* eventloop = NULL; \
|
||||
getdns_transaction_t transaction_id = 0;
|
||||
|
@ -222,7 +225,7 @@
|
|||
EVENT_BASE_CREATE;
|
||||
|
||||
ASSERT_RC(getdns_address(context, "hostnamedoesntexist", NULL,
|
||||
verify_getdns_address_8, &transaction_id, callbackfn),
|
||||
&fn_ref, &transaction_id, callbackfn),
|
||||
GETDNS_RETURN_GOOD, "Return code from getdns_address()");
|
||||
|
||||
RUN_EVENT_LOOP;
|
||||
|
|
|
@ -55,6 +55,7 @@
|
|||
* expect: GETDNS_RETURN_UNKNOWN_TRANSACTION
|
||||
*/
|
||||
void verify_getdns_cancel_callback(struct extracted_response *ex_response);
|
||||
fn_cont fn_ref = { verify_getdns_cancel_callback };
|
||||
struct getdns_context *context = NULL;
|
||||
void* eventloop = NULL;
|
||||
getdns_transaction_t transaction_id = 0;
|
||||
|
@ -65,7 +66,7 @@
|
|||
EVENT_BASE_CREATE;
|
||||
|
||||
ASSERT_RC(getdns_general(context, "google.com", GETDNS_RRTYPE_A, NULL,
|
||||
verify_getdns_cancel_callback, &transaction_id, callbackfn),
|
||||
&fn_ref, &transaction_id, callbackfn),
|
||||
GETDNS_RETURN_GOOD, "Return code from getdns_general()");
|
||||
|
||||
RUN_EVENT_LOOP;
|
||||
|
@ -86,6 +87,7 @@
|
|||
* expect: GETDNS_RETURN_UNKNOWN_TRANSACTION
|
||||
*/
|
||||
void verify_getdns_cancel_callback(struct extracted_response *ex_response);
|
||||
fn_cont fn_ref = { verify_getdns_cancel_callback };
|
||||
struct getdns_context *context = NULL;
|
||||
void* eventloop = NULL;
|
||||
getdns_transaction_t transaction_id = 0;
|
||||
|
@ -96,7 +98,7 @@
|
|||
EVENT_BASE_CREATE;
|
||||
|
||||
ASSERT_RC(getdns_general(context, "google.com", GETDNS_RRTYPE_A, NULL,
|
||||
verify_getdns_cancel_callback, &transaction_id, callbackfn),
|
||||
&fn_ref, &transaction_id, callbackfn),
|
||||
GETDNS_RETURN_GOOD, "Return code from getdns_general()");
|
||||
|
||||
RUN_EVENT_LOOP;
|
||||
|
@ -133,7 +135,8 @@
|
|||
struct getdns_context *context = NULL;
|
||||
void* eventloop = NULL;
|
||||
getdns_transaction_t transaction_id = 0;
|
||||
getdns_transaction_t transaction_id_array[10] = {};
|
||||
getdns_transaction_t transaction_id_array[10]
|
||||
= {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
int i;
|
||||
int odd = 0;
|
||||
int even = 0;
|
||||
|
@ -212,7 +215,8 @@
|
|||
struct getdns_context *context = NULL;
|
||||
void* eventloop = NULL;
|
||||
getdns_transaction_t transaction_id = 0;
|
||||
getdns_transaction_t transaction_id_array[10] = {};
|
||||
getdns_transaction_t transaction_id_array[10]
|
||||
= {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
int i;
|
||||
int odd = 0;
|
||||
int even = 0;
|
||||
|
@ -295,7 +299,8 @@
|
|||
struct getdns_bindata address_data = { 4, (void *)"\x08\x08\x08\x08" };
|
||||
struct getdns_dict *address = NULL;
|
||||
getdns_transaction_t transaction_id = 0;
|
||||
getdns_transaction_t transaction_id_array[10] = {};
|
||||
getdns_transaction_t transaction_id_array[10]
|
||||
= {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
int i;
|
||||
int odd = 0;
|
||||
int even = 0;
|
||||
|
@ -381,7 +386,8 @@
|
|||
struct getdns_context *context = NULL;
|
||||
void* eventloop = NULL;
|
||||
getdns_transaction_t transaction_id = 0;
|
||||
getdns_transaction_t transaction_id_array[10] = {};
|
||||
getdns_transaction_t transaction_id_array[10]
|
||||
= {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
int i;
|
||||
int odd = 0;
|
||||
int even = 0;
|
||||
|
|
|
@ -339,7 +339,7 @@ void callbackfn(struct getdns_context *context,
|
|||
getdns_transaction_t transaction_id)
|
||||
{
|
||||
typedef void (*fn_ptr)(struct extracted_response *ex_response);
|
||||
fn_ptr fn = userarg;
|
||||
fn_ptr fn = ((fn_cont *)userarg)->fn;
|
||||
(void)context; (void)transaction_id;
|
||||
|
||||
/*
|
||||
|
|
|
@ -211,6 +211,10 @@
|
|||
struct getdns_dict *response,
|
||||
void *userarg,
|
||||
getdns_transaction_t transaction_id);
|
||||
|
||||
typedef struct fn_cont {
|
||||
void (*fn)(struct extracted_response *ex_response);
|
||||
} fn_cont;
|
||||
/*
|
||||
* callbackfn is the callback function given to all
|
||||
* asynchronous query tests. It is expected to only
|
||||
|
|
|
@ -68,6 +68,7 @@
|
|||
* expect: callback should be called before getdns_context_destroy() returns
|
||||
*/
|
||||
void verify_getdns_context_destroy(struct extracted_response *ex_response);
|
||||
fn_cont fn_ref = { verify_getdns_context_destroy };
|
||||
struct getdns_context *context = NULL;
|
||||
void* eventloop = NULL;
|
||||
getdns_transaction_t transaction_id = 0;
|
||||
|
@ -78,7 +79,7 @@
|
|||
EVENT_BASE_CREATE;
|
||||
|
||||
ASSERT_RC(getdns_general(context, "google.com", GETDNS_RRTYPE_A, NULL,
|
||||
verify_getdns_context_destroy, &transaction_id, callbackfn),
|
||||
&fn_ref, &transaction_id, callbackfn),
|
||||
GETDNS_RETURN_GOOD, "Return code from getdns_general()");
|
||||
|
||||
RUN_EVENT_LOOP;
|
||||
|
@ -95,6 +96,7 @@
|
|||
* expect: callback should be called before getdns_context_destroy() returns
|
||||
*/
|
||||
void verify_getdns_context_destroy(struct extracted_response *ex_response);
|
||||
fn_cont fn_ref = { verify_getdns_context_destroy };
|
||||
struct getdns_context *context = NULL;
|
||||
void* eventloop = NULL;
|
||||
getdns_transaction_t transaction_id = 0;
|
||||
|
@ -105,7 +107,7 @@
|
|||
EVENT_BASE_CREATE;
|
||||
|
||||
ASSERT_RC(getdns_address(context, "google.com", NULL,
|
||||
verify_getdns_context_destroy, &transaction_id, callbackfn),
|
||||
&fn_ref, &transaction_id, callbackfn),
|
||||
GETDNS_RETURN_GOOD, "Return code from getdns_address()");
|
||||
|
||||
RUN_EVENT_LOOP;
|
||||
|
@ -122,6 +124,7 @@
|
|||
* expect: callback should be called before getdns_context_destroy() returns
|
||||
*/
|
||||
void verify_getdns_context_destroy(struct extracted_response *ex_response);
|
||||
fn_cont fn_ref = { verify_getdns_context_destroy };
|
||||
struct getdns_context *context = NULL;
|
||||
void* eventloop = NULL;
|
||||
struct getdns_bindata address_type = { 5, (void *)"IPv4" };
|
||||
|
@ -141,7 +144,7 @@
|
|||
GETDNS_RETURN_GOOD, "Return code from getdns_dict_set_bindata");
|
||||
|
||||
ASSERT_RC(getdns_hostname(context, address, NULL,
|
||||
verify_getdns_context_destroy, &transaction_id, callbackfn),
|
||||
&fn_ref, &transaction_id, callbackfn),
|
||||
GETDNS_RETURN_GOOD, "Return code from getdns_address()");
|
||||
|
||||
RUN_EVENT_LOOP;
|
||||
|
@ -159,6 +162,7 @@
|
|||
* expect: callback should be called before getdns_context_destroy() returns
|
||||
*/
|
||||
void verify_getdns_context_destroy(struct extracted_response *ex_response);
|
||||
fn_cont fn_ref = { verify_getdns_context_destroy };
|
||||
struct getdns_context *context = NULL;
|
||||
void* eventloop = NULL;
|
||||
getdns_transaction_t transaction_id = 0;
|
||||
|
@ -169,7 +173,7 @@
|
|||
EVENT_BASE_CREATE;
|
||||
|
||||
ASSERT_RC(getdns_service(context, "google.com", NULL,
|
||||
verify_getdns_context_destroy, &transaction_id, callbackfn),
|
||||
&fn_ref, &transaction_id, callbackfn),
|
||||
GETDNS_RETURN_GOOD, "Return code from getdns_service()");
|
||||
|
||||
RUN_EVENT_LOOP;
|
||||
|
|
|
@ -151,6 +151,7 @@
|
|||
* ancount = 0 (number of records in ANSWER section)
|
||||
*/
|
||||
void verify_getdns_general_6(struct extracted_response *ex_response);
|
||||
fn_cont fn_ref = { verify_getdns_general_6 };
|
||||
struct getdns_context *context = NULL; \
|
||||
void* eventloop = NULL; \
|
||||
getdns_transaction_t transaction_id = 0;
|
||||
|
@ -159,7 +160,7 @@
|
|||
EVENT_BASE_CREATE;
|
||||
|
||||
ASSERT_RC(getdns_general(context, "google.com", 0, NULL,
|
||||
verify_getdns_general_6, &transaction_id, callbackfn),
|
||||
&fn_ref, &transaction_id, callbackfn),
|
||||
GETDNS_RETURN_GOOD, "Return code from getdns_general()");
|
||||
|
||||
RUN_EVENT_LOOP;
|
||||
|
@ -184,6 +185,7 @@
|
|||
* ancount = 0 (number of records in ANSWER section)
|
||||
*/
|
||||
void verify_getdns_general_7(struct extracted_response *ex_response);
|
||||
fn_cont fn_ref = { verify_getdns_general_7 };
|
||||
struct getdns_context *context = NULL; \
|
||||
void* eventloop = NULL; \
|
||||
getdns_transaction_t transaction_id = 0;
|
||||
|
@ -192,7 +194,7 @@
|
|||
EVENT_BASE_CREATE;
|
||||
|
||||
ASSERT_RC(getdns_general(context, "google.com", 65279, NULL,
|
||||
verify_getdns_general_7, &transaction_id, callbackfn),
|
||||
&fn_ref, &transaction_id, callbackfn),
|
||||
GETDNS_RETURN_GOOD, "Return code from getdns_general()");
|
||||
|
||||
RUN_EVENT_LOOP;
|
||||
|
@ -218,6 +220,7 @@
|
|||
* and equals number of A records ("type": 1) in "answer" list
|
||||
*/
|
||||
void verify_getdns_general_8(struct extracted_response *ex_response);
|
||||
fn_cont fn_ref = { verify_getdns_general_8 };
|
||||
struct getdns_context *context = NULL; \
|
||||
void* eventloop = NULL; \
|
||||
getdns_transaction_t transaction_id = 0;
|
||||
|
@ -226,7 +229,7 @@
|
|||
EVENT_BASE_CREATE;
|
||||
|
||||
ASSERT_RC(getdns_general(context, "google.com", GETDNS_RRTYPE_A, NULL,
|
||||
verify_getdns_general_8, &transaction_id, callbackfn),
|
||||
&fn_ref, &transaction_id, callbackfn),
|
||||
GETDNS_RETURN_GOOD, "Return code from getdns_general()");
|
||||
|
||||
RUN_EVENT_LOOP;
|
||||
|
@ -252,6 +255,7 @@
|
|||
* and equals number of AAAA records ("type": 28) in "answer" list
|
||||
*/
|
||||
void verify_getdns_general_9(struct extracted_response *ex_response);
|
||||
fn_cont fn_ref = { verify_getdns_general_9 };
|
||||
struct getdns_context *context = NULL; \
|
||||
void* eventloop = NULL; \
|
||||
getdns_transaction_t transaction_id = 0;
|
||||
|
@ -260,7 +264,7 @@
|
|||
EVENT_BASE_CREATE;
|
||||
|
||||
ASSERT_RC(getdns_general(context, "google.com", GETDNS_RRTYPE_AAAA, NULL,
|
||||
verify_getdns_general_9, &transaction_id, callbackfn),
|
||||
&fn_ref, &transaction_id, callbackfn),
|
||||
GETDNS_RETURN_GOOD, "Return code from getdns_general()");
|
||||
|
||||
RUN_EVENT_LOOP;
|
||||
|
@ -287,6 +291,7 @@
|
|||
* and SOA record ("type": 6) present in "authority" list
|
||||
*/
|
||||
void verify_getdns_general_10(struct extracted_response *ex_response);
|
||||
fn_cont fn_ref = { verify_getdns_general_10 };
|
||||
struct getdns_context *context = NULL; \
|
||||
void* eventloop = NULL; \
|
||||
getdns_transaction_t transaction_id = 0;
|
||||
|
@ -296,7 +301,7 @@
|
|||
EVENT_BASE_CREATE;
|
||||
|
||||
ASSERT_RC(getdns_general(context, name, GETDNS_RRTYPE_TXT, NULL,
|
||||
verify_getdns_general_10, &transaction_id, callbackfn),
|
||||
&fn_ref, &transaction_id, callbackfn),
|
||||
GETDNS_RETURN_GOOD, "Return code from getdns_general()");
|
||||
|
||||
RUN_EVENT_LOOP;
|
||||
|
@ -322,6 +327,7 @@
|
|||
* ancount = 0 (number of records in ANSWER section)
|
||||
*/
|
||||
void verify_getdns_general_11(struct extracted_response *ex_response);
|
||||
fn_cont fn_ref = { verify_getdns_general_11 };
|
||||
struct getdns_context *context = NULL; \
|
||||
void* eventloop = NULL; \
|
||||
getdns_transaction_t transaction_id = 0;
|
||||
|
@ -330,7 +336,7 @@
|
|||
EVENT_BASE_CREATE;
|
||||
|
||||
ASSERT_RC(getdns_general(context, "willem.getdnsapi.net", GETDNS_RRTYPE_MX, NULL,
|
||||
verify_getdns_general_11, &transaction_id, callbackfn),
|
||||
&fn_ref, &transaction_id, callbackfn),
|
||||
GETDNS_RETURN_GOOD, "Return code from getdns_general()");
|
||||
|
||||
RUN_EVENT_LOOP;
|
||||
|
@ -356,6 +362,7 @@
|
|||
* and equals number of A records ("type": 1) in "answer" list
|
||||
*/
|
||||
void verify_getdns_general_12(struct extracted_response *ex_response);
|
||||
fn_cont fn_ref = { verify_getdns_general_12 };
|
||||
struct getdns_context *context = NULL; \
|
||||
void* eventloop = NULL; \
|
||||
getdns_transaction_t transaction_id = 0;
|
||||
|
@ -364,7 +371,7 @@
|
|||
EVENT_BASE_CREATE;
|
||||
|
||||
ASSERT_RC(getdns_general(context, "google.com", GETDNS_RRTYPE_A, NULL,
|
||||
verify_getdns_general_12, &transaction_id, callbackfn),
|
||||
&fn_ref, &transaction_id, callbackfn),
|
||||
GETDNS_RETURN_GOOD, "Return code from getdns_general()");
|
||||
|
||||
RUN_EVENT_LOOP;
|
||||
|
|
|
@ -315,6 +315,7 @@
|
|||
* expect: response with correct hostname
|
||||
*/
|
||||
void verify_getdns_hostname_10(struct extracted_response *ex_response);
|
||||
fn_cont fn_ref = { verify_getdns_hostname_10 };
|
||||
struct getdns_context *context = NULL;
|
||||
struct getdns_dict *address = NULL;
|
||||
struct getdns_bindata address_type = { 5, (void *)"IPv4" };
|
||||
|
@ -333,7 +334,7 @@
|
|||
EVENT_BASE_CREATE;
|
||||
|
||||
ASSERT_RC(getdns_hostname(context, address, NULL,
|
||||
verify_getdns_hostname_10, &transaction_id, callbackfn),
|
||||
&fn_ref, &transaction_id, callbackfn),
|
||||
GETDNS_RETURN_GOOD, "Return code from getdns_hostname()");
|
||||
|
||||
RUN_EVENT_LOOP;
|
||||
|
@ -356,6 +357,7 @@
|
|||
* expect: response with no hostname
|
||||
*/
|
||||
void verify_getdns_hostname_11(struct extracted_response *ex_response);
|
||||
fn_cont fn_ref = { verify_getdns_hostname_11 };
|
||||
struct getdns_context *context = NULL;
|
||||
struct getdns_dict *address = NULL;
|
||||
struct getdns_bindata address_type = { 5, (void *)"IPv4" };
|
||||
|
@ -374,7 +376,7 @@
|
|||
EVENT_BASE_CREATE;
|
||||
|
||||
ASSERT_RC(getdns_hostname(context, address, NULL,
|
||||
verify_getdns_hostname_11, &transaction_id, callbackfn),
|
||||
&fn_ref, &transaction_id, callbackfn),
|
||||
GETDNS_RETURN_GOOD, "Return code from getdns_hostname()");
|
||||
|
||||
RUN_EVENT_LOOP;
|
||||
|
@ -398,6 +400,7 @@
|
|||
* expect: response with correct hostname
|
||||
*/
|
||||
void verify_getdns_hostname_12(struct extracted_response *ex_response);
|
||||
fn_cont fn_ref = { verify_getdns_hostname_12 };
|
||||
struct getdns_context *context = NULL;
|
||||
struct getdns_dict *address = NULL;
|
||||
struct getdns_bindata address_type = { 5, (void *)"IPv6" };
|
||||
|
@ -419,7 +422,7 @@
|
|||
EVENT_BASE_CREATE;
|
||||
|
||||
ASSERT_RC(getdns_hostname(context, address, NULL,
|
||||
verify_getdns_hostname_12, &transaction_id, callbackfn),
|
||||
&fn_ref, &transaction_id, callbackfn),
|
||||
GETDNS_RETURN_GOOD, "Return code from getdns_hostname()");
|
||||
|
||||
RUN_EVENT_LOOP;
|
||||
|
@ -442,6 +445,7 @@
|
|||
* expect: response with no hostname
|
||||
*/
|
||||
void verify_getdns_hostname_13(struct extracted_response *ex_response);
|
||||
fn_cont fn_ref = { verify_getdns_hostname_13 };
|
||||
struct getdns_context *context = NULL;
|
||||
struct getdns_dict *address = NULL;
|
||||
struct getdns_bindata address_type = { 5, (void *)"IPv6" };
|
||||
|
@ -460,7 +464,7 @@
|
|||
EVENT_BASE_CREATE;
|
||||
|
||||
ASSERT_RC(getdns_hostname(context, address, NULL,
|
||||
verify_getdns_hostname_13, &transaction_id, callbackfn),
|
||||
&fn_ref, &transaction_id, callbackfn),
|
||||
GETDNS_RETURN_GOOD, "Return code from getdns_hostname()");
|
||||
|
||||
RUN_EVENT_LOOP;
|
||||
|
|
|
@ -148,6 +148,7 @@
|
|||
* expect: NXDOMAIN response (with SOA record)
|
||||
*/
|
||||
void verify_getdns_service_7(struct extracted_response *ex_response);
|
||||
fn_cont fn_ref = { verify_getdns_service_7 };
|
||||
struct getdns_context *context = NULL; \
|
||||
void* eventloop = NULL; \
|
||||
getdns_transaction_t transaction_id = 0;
|
||||
|
@ -157,7 +158,7 @@
|
|||
EVENT_BASE_CREATE;
|
||||
|
||||
ASSERT_RC(getdns_service(context, "nitinsinghit.com", NULL,
|
||||
verify_getdns_address_8, &transaction_id, callbackfn),
|
||||
&fn_ref, &transaction_id, callbackfn),
|
||||
GETDNS_RETURN_GOOD, "Return code from getdns_service()");
|
||||
|
||||
RUN_EVENT_LOOP;
|
||||
|
|
|
@ -25,14 +25,4 @@ done
|
|||
rm -fr "${BUILDDIR}/build"
|
||||
mkdir "${BUILDDIR}/build"
|
||||
cd "${BUILDDIR}/build"
|
||||
if [ -z "$CFLAGS" ]
|
||||
then
|
||||
if (echo $*|grep -q CFLAGS)
|
||||
then
|
||||
"${SRCROOT}/configure" $* --prefix "${BUILDDIR}/install"
|
||||
else
|
||||
"${SRCROOT}/configure" CFLAGS="-Wpedantic -Werror" $* --prefix "${BUILDDIR}/install"
|
||||
fi
|
||||
else
|
||||
"${SRCROOT}/configure" $* --prefix "${BUILDDIR}/install"
|
||||
fi
|
||||
"${SRCROOT}/configure" $* --prefix "${BUILDDIR}/install"
|
||||
|
|
|
@ -5,4 +5,4 @@
|
|||
[ -f .tpkg.var.test ] && source .tpkg.var.test
|
||||
|
||||
cd "${BUILDDIR}/build"
|
||||
make
|
||||
make XTRA_CFLAGS='-Werror'
|
||||
|
|
|
@ -25,14 +25,4 @@ done
|
|||
rm -fr "${BUILDDIR}/build-stub-only"
|
||||
mkdir "${BUILDDIR}/build-stub-only"
|
||||
cd "${BUILDDIR}/build-stub-only"
|
||||
if [ -z "$CFLAGS" ]
|
||||
then
|
||||
if (echo $*|grep -q CFLAGS)
|
||||
then
|
||||
"${SRCROOT}/configure" $* --enable-stub-only
|
||||
else
|
||||
"${SRCROOT}/configure" CFLAGS="-Wpedantic -Werror" $* --enable-stub-only
|
||||
fi
|
||||
else
|
||||
"${SRCROOT}/configure" $* --enable-stub-only
|
||||
fi
|
||||
"${SRCROOT}/configure" $* --enable-stub-only
|
||||
|
|
|
@ -5,4 +5,4 @@
|
|||
[ -f .tpkg.var.test ] && source .tpkg.var.test
|
||||
|
||||
cd "${BUILDDIR}/build-stub-only"
|
||||
make
|
||||
make XTRA_CFLAGS='-Werror'
|
||||
|
|
|
@ -7,32 +7,10 @@
|
|||
rm -fr "${BUILDDIR}/build-event-loops"
|
||||
mkdir "${BUILDDIR}/build-event-loops"
|
||||
cd "${BUILDDIR}/build-event-loops"
|
||||
if [ -z "$CFLAGS" ]
|
||||
then
|
||||
if (echo $*|grep -q CFLAGS)
|
||||
then
|
||||
"${SRCROOT}/configure" $* --enable-all-drafts --with-getdns_query --with-libevent --with-libev --with-libuv \
|
||||
|| "${SRCROOT}/configure" $* --enable-all-drafts --with-getdns_query --with-libevent --with-libev \
|
||||
|| "${SRCROOT}/configure" $* --enable-all-drafts --with-getdns_query --with-libevent --with-libuv \
|
||||
|| "${SRCROOT}/configure" $* --enable-all-drafts --with-getdns_query --with-libev --with-libuv \
|
||||
|| "${SRCROOT}/configure" $* --enable-all-drafts --with-getdns_query --with-libevent \
|
||||
|| "${SRCROOT}/configure" $* --enable-all-drafts --with-getdns_query --with-libev \
|
||||
|| "${SRCROOT}/configure" $* --enable-all-drafts --with-getdns_query --with-libuv
|
||||
else
|
||||
"${SRCROOT}/configure" CFLAGS="-Wpedantic -Werror" $* --enable-all-drafts --with-getdns_query --with-libevent --with-libev --with-libuv \
|
||||
|| "${SRCROOT}/configure" CFLAGS="-Wpedantic -Werror" $* --enable-all-drafts --with-getdns_query --with-libevent --with-libev \
|
||||
|| "${SRCROOT}/configure" CFLAGS="-Wpedantic -Werror" $* --enable-all-drafts --with-getdns_query --with-libevent --with-libuv \
|
||||
|| "${SRCROOT}/configure" CFLAGS="-Wpedantic -Werror" $* --enable-all-drafts --with-getdns_query --with-libev --with-libuv \
|
||||
|| "${SRCROOT}/configure" CFLAGS="-Wpedantic -Werror" $* --enable-all-drafts --with-getdns_query --with-libevent \
|
||||
|| "${SRCROOT}/configure" CFLAGS="-Wpedantic -Werror" $* --enable-all-drafts --with-getdns_query --with-libev \
|
||||
|| "${SRCROOT}/configure" CFLAGS="-Wpedantic -Werror" $* --enable-all-drafts --with-getdns_query --with-libuv
|
||||
fi
|
||||
else
|
||||
"${SRCROOT}/configure" $* --enable-all-drafts --with-getdns_query --with-libevent --with-libev --with-libuv \
|
||||
|| "${SRCROOT}/configure" $* --enable-all-drafts --with-getdns_query --with-libevent --with-libev \
|
||||
|| "${SRCROOT}/configure" $* --enable-all-drafts --with-getdns_query --with-libevent --with-libuv \
|
||||
|| "${SRCROOT}/configure" $* --enable-all-drafts --with-getdns_query --with-libev --with-libuv \
|
||||
|| "${SRCROOT}/configure" $* --enable-all-drafts --with-getdns_query --with-libevent \
|
||||
|| "${SRCROOT}/configure" $* --enable-all-drafts --with-getdns_query --with-libev \
|
||||
|| "${SRCROOT}/configure" $* --enable-all-drafts --with-getdns_query --with-libuv
|
||||
fi
|
||||
"${SRCROOT}/configure" $* --enable-all-drafts --with-getdns_query --with-libevent --with-libev --with-libuv \
|
||||
|| "${SRCROOT}/configure" $* --enable-all-drafts --with-getdns_query --with-libevent --with-libev \
|
||||
|| "${SRCROOT}/configure" $* --enable-all-drafts --with-getdns_query --with-libevent --with-libuv \
|
||||
|| "${SRCROOT}/configure" $* --enable-all-drafts --with-getdns_query --with-libev --with-libuv \
|
||||
|| "${SRCROOT}/configure" $* --enable-all-drafts --with-getdns_query --with-libevent \
|
||||
|| "${SRCROOT}/configure" $* --enable-all-drafts --with-getdns_query --with-libev \
|
||||
|| "${SRCROOT}/configure" $* --enable-all-drafts --with-getdns_query --with-libuv
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
BaseName: 315-event-loops-compile
|
||||
Version: 1.0
|
||||
Description: Compile
|
||||
CreationDate: do 8 dec 2016 23:38:18 CET
|
||||
Maintainer: Willem Toorop
|
||||
Category:
|
||||
Component:
|
||||
CmdDepends:
|
||||
Depends: 300-event-loops-configure.tpkg
|
||||
Help:
|
||||
Pre: 315-event-loops-compile.pre
|
||||
Post: 315-event-loops-compile.post
|
||||
Test: 315-event-loops-compile.test
|
||||
AuxFiles:
|
||||
Passed:
|
||||
Failure:
|
|
@ -1,4 +1,4 @@
|
|||
# #-- 326-event-loops-compile.post --#
|
||||
# #-- 315-event-loops-compile.post --#
|
||||
# source the master var file when it's there
|
||||
if [ -f ../.tpkg.var.master ]
|
||||
then
|
|
@ -1,4 +1,4 @@
|
|||
# #-- 326-event-loops-compile.pre--#
|
||||
# #-- 315-event-loops-compile.pre--#
|
||||
# source the master var file when it's there
|
||||
if [ -f ../.tpkg.var.master ]
|
||||
then
|
|
@ -1,8 +1,8 @@
|
|||
# #-- 326-event-loops-compile.test --#
|
||||
# #-- 315-event-loops-compile.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-event-loops"
|
||||
make
|
||||
make XTRA_CFLAGS='-Werror'
|
|
@ -5,4 +5,5 @@
|
|||
[ -f .tpkg.var.test ] && source .tpkg.var.test
|
||||
|
||||
cd "${BUILDDIR}/build-event-loops"
|
||||
make clean
|
||||
make
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
BaseName: 323-event-loops-configure
|
||||
Version: 1.0
|
||||
Description: Configure for maximum coverage
|
||||
CreationDate: do 8 dec 2016 16:21:08 CET
|
||||
Maintainer: Willem Toorop
|
||||
Category:
|
||||
Component:
|
||||
CmdDepends:
|
||||
Depends:
|
||||
Help:
|
||||
Pre: 323-event-loops-configure.pre
|
||||
Post:
|
||||
Test: 323-event-loops-configure.test
|
||||
AuxFiles:
|
||||
Passed:
|
||||
Failure:
|
|
@ -1,14 +0,0 @@
|
|||
# #-- 323-event-loops-configure.pre--#
|
||||
# source the master var file when it's there
|
||||
if [ -f ../.tpkg.var.master ]
|
||||
then
|
||||
source ../.tpkg.var.master
|
||||
else
|
||||
(
|
||||
cd ..
|
||||
[ -f "${TPKG_SRCDIR}/setup-env.sh" ] \
|
||||
&& sh "${TPKG_SRCDIR}/setup-env.sh"
|
||||
) && source ../.tpkg.var.master
|
||||
fi
|
||||
# use .tpkg.var.test for in test variable passing
|
||||
[ -f .tpkg.var.test ] && source .tpkg.var.test
|
|
@ -1,16 +0,0 @@
|
|||
# #-- 323-event-loops-configure.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
|
||||
|
||||
rm -fr "${BUILDDIR}/build-event-loops"
|
||||
mkdir "${BUILDDIR}/build-event-loops"
|
||||
cd "${BUILDDIR}/build-event-loops"
|
||||
"${SRCROOT}/configure" $* --enable-all-drafts --enable-all-debugging --with-getdns_query --with-libevent --with-libev --with-libuv \
|
||||
|| "${SRCROOT}/configure" $* --enable-all-drafts --enable-all-debugging --with-getdns_query --with-libevent --with-libev \
|
||||
|| "${SRCROOT}/configure" $* --enable-all-drafts --enable-all-debugging --with-getdns_query --with-libevent --with-libuv \
|
||||
|| "${SRCROOT}/configure" $* --enable-all-drafts --enable-all-debugging --with-getdns_query --with-libev --with-libuv \
|
||||
|| "${SRCROOT}/configure" $* --enable-all-drafts --enable-all-debugging --with-getdns_query --with-libevent \
|
||||
|| "${SRCROOT}/configure" $* --enable-all-drafts --enable-all-debugging --with-getdns_query --with-libev \
|
||||
|| "${SRCROOT}/configure" $* --enable-all-drafts --enable-all-debugging --with-getdns_query --with-libuv
|
|
@ -1,16 +0,0 @@
|
|||
BaseName: 326-event-loops-compile
|
||||
Version: 1.0
|
||||
Description: Compile
|
||||
CreationDate: do 8 dec 2016 16:21:21 CET
|
||||
Maintainer: Willem Toorop
|
||||
Category:
|
||||
Component:
|
||||
CmdDepends:
|
||||
Depends: 300-event-loops-configure.tpkg
|
||||
Help:
|
||||
Pre: 326-event-loops-compile.pre
|
||||
Post: 326-event-loops-compile.post
|
||||
Test: 326-event-loops-compile.test
|
||||
AuxFiles:
|
||||
Passed:
|
||||
Failure:
|
|
@ -1382,7 +1382,8 @@ static void _getdns_reply2wire_buf(gldns_buffer *buf, getdns_dict *reply)
|
|||
{
|
||||
getdns_dict *rr_dict, *q_dict, *h_dict;
|
||||
getdns_list *section;
|
||||
size_t i, pkt_start, ancount, nscount;
|
||||
size_t i, pkt_start;
|
||||
uint16_t ancount, nscount;
|
||||
uint32_t qtype, qclass = GETDNS_RRCLASS_IN, rcode = GETDNS_RCODE_NOERROR;
|
||||
getdns_bindata *qname;
|
||||
|
||||
|
@ -1436,7 +1437,8 @@ static void _getdns_reply2wire_buf(gldns_buffer *buf, getdns_dict *reply)
|
|||
static void _getdns_list2wire_buf(gldns_buffer *buf, getdns_list *l)
|
||||
{
|
||||
getdns_dict *rr_dict;
|
||||
size_t i, pkt_start, ancount;
|
||||
size_t i, pkt_start;
|
||||
uint16_t ancount;
|
||||
uint32_t qtype, qclass = GETDNS_RRCLASS_IN;
|
||||
getdns_bindata *qname;
|
||||
|
||||
|
|
Loading…
Reference in New Issue