Port of getdns and Stubby DNS resolver

Stubby is an application that acts as a local DNS stub resolver.

https://getdnsapi.net/
https://dnsprivacy.org/wiki/display/DP/DNS+Privacy+Daemon+-+Stubby

Ref #2682
This commit is contained in:
Ehmry - 2018-02-18 12:10:31 +01:00 committed by Christian Helmuth
parent 60eeddf639
commit 3faf7aab8f
10 changed files with 845 additions and 0 deletions

View File

@ -0,0 +1,2 @@
GETDNS_PORT_DIR := $(call select_from_ports,getdns)
INC_DIR += $(GETDNS_PORT_DIR)/include

View File

@ -0,0 +1,12 @@
include $(REP_DIR)/lib/import/import-libgetdns.mk
GLDNS_SRC_DIR := $(GETDNS_PORT_DIR)/src/lib/getdns/src/gldns
LIBS += libc libssl
INC_DIR += $(GLDNS_SRC_DIR)/..
INC_DIR += $(REP_DIR)/src/lib/getdns
SRC_C += $(notdir $(wildcard $(GLDNS_SRC_DIR)/*.c))
vpath %.c $(GLDNS_SRC_DIR)

View File

@ -0,0 +1,31 @@
include $(REP_DIR)/lib/import/import-libgetdns.mk
GETDNS_SRC_DIR := $(GETDNS_PORT_DIR)/src/lib/getdns/src
LIBS += libc libcrypto libssl libyaml
INC_DIR += $(GETDNS_SRC_DIR)
INC_DIR += $(GETDNS_SRC_DIR)/../stubby/src
INC_DIR += $(GETDNS_SRC_DIR)/util/auxiliary
INC_DIR += $(REP_DIR)/src/lib/getdns
SRC_C += \
const-info.c convert.c dict.c dnssec.c general.c \
list.c request-internal.c platform.c pubkey-pinning.c rr-dict.c \
rr-iter.c server.c stub.c sync.c ub_loop.c util-internal.c \
mdns.c context.c rbtree.c select_eventloop.c version.c \
CC_OPT += -D_BSD_SOURCE -D_DEFAULT_SOURCE
SRC_C += $(notdir $(wildcard $(GETDNS_SRC_DIR)/gldns/*.c))
SRC_C += $(notdir $(wildcard $(GETDNS_SRC_DIR)/jsmn/*.c))
SRC_C += $(notdir $(wildcard $(GETDNS_SRC_DIR)/ssl_dane/*.c))
vpath %.c $(GETDNS_SRC_DIR)
vpath %.c $(GETDNS_SRC_DIR)/extension
vpath %.c $(GETDNS_SRC_DIR)/gldns
vpath %.c $(GETDNS_SRC_DIR)/jsmn
vpath %.c $(GETDNS_SRC_DIR)/ssl_dane
vpath %.c $(GETDNS_SRC_DIR)/util
SHARED_LIB = 1

View File

@ -0,0 +1,182 @@
getdns_address T
getdns_address_sync T
getdns_cancel_callback T
getdns_context_config T
getdns_context_create T
getdns_context_create_with_extended_memory_functions T
getdns_context_create_with_memory_functions T
getdns_context_destroy T
getdns_context_detach_eventloop T
getdns_context_get_api_information T
getdns_context_get_append_name T
getdns_context_get_dns_root_servers T
getdns_context_get_dns_transport T
getdns_context_get_dns_transport_list T
getdns_context_get_dnssec_allowed_skew T
getdns_context_get_dnssec_trust_anchors T
getdns_context_get_edns_client_subnet_private T
getdns_context_get_edns_do_bit T
getdns_context_get_edns_extended_rcode T
getdns_context_get_edns_maximum_udp_payload_size T
getdns_context_get_edns_version T
getdns_context_get_eventloop T
getdns_context_get_follow_redirects T
getdns_context_get_hosts T
getdns_context_get_idle_timeout T
getdns_context_get_limit_outstanding_queries T
getdns_context_get_namespaces T
getdns_context_get_num_pending_requests T
getdns_context_get_resolution_type T
getdns_context_get_resolvconf T
getdns_context_get_round_robin_upstreams T
getdns_context_get_suffix T
getdns_context_get_timeout T
getdns_context_get_tls_authentication T
getdns_context_get_tls_backoff_time T
getdns_context_get_tls_ca_file T
getdns_context_get_tls_ca_path T
getdns_context_get_tls_cipher_list T
getdns_context_get_tls_connection_retries T
getdns_context_get_tls_curves_list T
getdns_context_get_tls_query_padding_blocksize T
getdns_context_get_trust_anchors_url T
getdns_context_get_trust_anchors_verify_CA T
getdns_context_get_trust_anchors_verify_email T
getdns_context_get_update_callback T
getdns_context_get_upstream_recursive_servers T
getdns_context_process_async T
getdns_context_run T
getdns_context_set_appdata_dir T
getdns_context_set_append_name T
getdns_context_set_context_update_callback T
getdns_context_set_dns_root_servers T
getdns_context_set_dns_transport T
getdns_context_set_dns_transport_list T
getdns_context_set_dnssec_allowed_skew T
getdns_context_set_dnssec_trust_anchors T
getdns_context_set_edns_client_subnet_private T
getdns_context_set_edns_do_bit T
getdns_context_set_edns_extended_rcode T
getdns_context_set_edns_maximum_udp_payload_size T
getdns_context_set_edns_version T
getdns_context_set_eventloop T
getdns_context_set_extended_memory_functions T
getdns_context_set_follow_redirects T
getdns_context_set_hosts T
getdns_context_set_idle_timeout T
getdns_context_set_limit_outstanding_queries T
getdns_context_set_listen_addresses T
getdns_context_set_logfunc T
getdns_context_set_memory_functions T
getdns_context_set_namespaces T
getdns_context_set_resolution_type T
getdns_context_set_resolvconf T
getdns_context_set_return_dnssec_status T
getdns_context_set_round_robin_upstreams T
getdns_context_set_suffix T
getdns_context_set_timeout T
getdns_context_set_tls_authentication T
getdns_context_set_tls_backoff_time T
getdns_context_set_tls_ca_file T
getdns_context_set_tls_ca_path T
getdns_context_set_tls_cipher_list T
getdns_context_set_tls_connection_retries T
getdns_context_set_tls_curves_list T
getdns_context_set_tls_query_padding_blocksize T
getdns_context_set_trust_anchors_url T
getdns_context_set_trust_anchors_verify_CA T
getdns_context_set_trust_anchors_verify_email T
getdns_context_set_update_callback T
getdns_context_set_upstream_recursive_servers T
getdns_context_set_use_threads T
getdns_context_unset_edns_maximum_udp_payload_size T
getdns_convert_alabel_to_ulabel T
getdns_convert_dns_name_to_fqdn T
getdns_convert_fqdn_to_dns_name T
getdns_convert_ulabel_to_alabel T
getdns_dict_create T
getdns_dict_create_with_context T
getdns_dict_create_with_extended_memory_functions T
getdns_dict_create_with_memory_functions T
getdns_dict_destroy T
getdns_dict_get_bindata T
getdns_dict_get_data_type T
getdns_dict_get_dict T
getdns_dict_get_int T
getdns_dict_get_list T
getdns_dict_get_names T
getdns_dict_remove_name T
getdns_dict_set_bindata T
getdns_dict_set_dict T
getdns_dict_set_int T
getdns_dict_set_list T
getdns_dict_util_get_string T
getdns_dict_util_set_string T
getdns_display_ip_address T
getdns_fp2rr_list T
getdns_general T
getdns_general_sync T
getdns_get_api_version T
getdns_get_api_version_number T
getdns_get_errorstr_by_id T
getdns_get_version T
getdns_get_version_number T
getdns_hostname T
getdns_hostname_sync T
getdns_list_create T
getdns_list_create_with_context T
getdns_list_create_with_extended_memory_functions T
getdns_list_create_with_memory_functions T
getdns_list_destroy T
getdns_list_get_bindata T
getdns_list_get_data_type T
getdns_list_get_dict T
getdns_list_get_int T
getdns_list_get_length T
getdns_list_get_list T
getdns_list_set_bindata T
getdns_list_set_dict T
getdns_list_set_int T
getdns_list_set_list T
getdns_msg_dict2str T
getdns_msg_dict2str_buf T
getdns_msg_dict2str_scan T
getdns_msg_dict2wire T
getdns_msg_dict2wire_buf T
getdns_msg_dict2wire_scan T
getdns_pretty_print_dict T
getdns_pretty_print_list T
getdns_pretty_snprint_dict T
getdns_pretty_snprint_list T
getdns_print_json_dict T
getdns_print_json_list T
getdns_pubkey_pin_create_from_string T
getdns_pubkey_pinset_sanity_check T
getdns_reply T
getdns_root_trust_anchor T
getdns_rr_dict2str T
getdns_rr_dict2str_buf T
getdns_rr_dict2str_scan T
getdns_rr_dict2wire T
getdns_rr_dict2wire_buf T
getdns_rr_dict2wire_scan T
getdns_service T
getdns_service_sync T
getdns_snprint_json_dict T
getdns_snprint_json_list T
getdns_str2bindata T
getdns_str2dict T
getdns_str2int T
getdns_str2list T
getdns_str2rr_dict T
getdns_strerror T
getdns_validate_dnssec T
getdns_validate_dnssec2 T
getdns_wire2msg_dict T
getdns_wire2msg_dict_buf T
getdns_wire2msg_dict_scan T
getdns_wire2rr_dict T
getdns_wire2rr_dict_buf T
getdns_wire2rr_dict_scan T
plain_mem_funcs_user_arg T
priv_getdns_context_mf T

View File

@ -0,0 +1 @@
8db5ca415bd07ed9f51a8ee4dbdc855aa978668f

View File

@ -0,0 +1,19 @@
LICENSE = BSD3
DOWNLOADS = getdns.archive
VERSION = 1.4.0
URL(getdns) := https://getdnsapi.net/releases/getdns-1-4-0/getdns-1.4.0.tar.gz
SHA(getdns) := 5955268b3ce3d0551ba8a20a97380a8ad3bcf302
DIR(getdns) := src/lib/getdns
DIRS := include/getdns
DIR_CONTENT(include/getdns) = src/lib/getdns/src/getdns/getdns_extra.h
default: include/getdns/getdns.h
include/getdns/getdns.h: src/lib/getdns/src/getdns/getdns.h.in
@$(MSG_GENERATE)$(notdir $@)
$(VERBOSE)mkdir -p $(dir $@)
$(VERBOSE)cp $< $@
src/lib/getdns/src/getdns/getdns.h.in: $(DOWNLOADS)

202
repos/ports/run/stubby.run Normal file
View File

@ -0,0 +1,202 @@
if {[have_spec linux]} {
puts "The [run_name] scenario requires QEMU networking."
exit 1
}
source ${genode_dir}/repos/base/run/platform_drv.inc
set build_components {
app/drill
app/sequence
app/stubby
core init
drivers/nic
drivers/rtc
drivers/timer
lib/vfs/jitterentropy
lib/vfs/lxip
server/nic_router
server/vfs
test/libc_getaddrinfo
}
append_platform_drv_build_components
build $build_components
create_boot_directory
append config {
<config>
<parent-provides>
<service name="CPU"/>
<service name="IO_MEM"/>
<service name="IO_PORT"/>
<service name="IRQ"/>
<service name="LOG"/>
<service name="PD"/>
<service name="RM"/>
<service name="ROM"/>
</parent-provides>
<default-route>
<service name="Nic"> <child name="nic_router"/> </service>
<any-service> <parent/> <any-child/> </any-service>
</default-route>
<default caps="128"/>}
append_platform_drv_config
append config {
<start name="timer">
<resource name="RAM" quantum="1M"/>
<provides> <service name="Timer"/> </provides>
</start>
<start name="rtc_drv">
<resource name="RAM" quantum="1M"/>
<provides> <service name="Rtc"/> </provides>
</start>
<start name="nic_drv">
<binary name="} [nic_drv_binary] {"/>
<resource name="RAM" quantum="4M"/>
<provides> <service name="Nic"/> </provides>
</start>
<start name="nic_router" caps="200">
<resource name="RAM" quantum="10M"/>
<provides><service name="Nic"/></provides>
<config verbose="no">
<policy label_prefix="vfs" domain="default" />
<policy label_prefix="stubby" domain="dns"/>
<domain name="uplink">
<nat domain="dns" tcp-ports="64" udp-ports="64"/>
</domain>
<domain name="dns" interface="10.0.53.1/24">
<ip dst="10.0.1.0/24" domain="default"/>
<tcp dst="10.0.4.0/24"><permit-any domain="default"/></tcp>
<udp dst="10.0.4.0/24"><permit-any domain="default"/></udp>
<tcp dst="0.0.0.0/0"><permit-any domain="uplink"/></tcp>
<udp dst="0.0.0.0/0"><permit-any domain="uplink"/></udp>
</domain>
<domain name="default" interface="10.0.1.1/24">
<dhcp-server ip_first="10.0.1.2"
ip_last="10.0.1.200"
ip_lease_time_sec="360"
dns_server="10.0.53.2"/>
<ip dst="10.0.53.0/24" domain="dns"/>
<udp dst="10.0.53.0/24"><permit-any domain="dns"/></udp>
<tcp dst="0.0.0.0/0"><permit-any domain="uplink"/></tcp>
<udp dst="0.0.0.0/0"><permit-any domain="uplink"/></udp>
</domain>
</config>
<route>
<service name="Nic"> <child name="nic_drv"/> </service>
<any-service> <parent/> <any-child/> </any-service>
</route>
</start>
<start name="stubby" caps="512">
<resource name="RAM" quantum="32M"/>
<config>
<vfs>
<ram/>
<dir name="etc">
<inline name="resolv.conf">nameserver 10.0.2.3</inline> </dir>
<dir name="dev">
<log/> <null/> <rtc/>
<jitterentropy name="random"/>
</dir>
<dir name="socket">
<lxip ip_addr="10.0.53.2" netmask="255.255.255.0" gateway="10.0.53.1"/>
</dir>
<inline name="stubby.yaml">
listen_addresses:
- 10.0.53.2
</inline>
</vfs>
<libc stdout="/dev/log" stderr="/dev/log" rtc="/dev/rtc" socket="/socket"/>
<env key="HOME" value="/"/>
<arg value="stubby"/>
<arg value="-C"/>
<arg value="/stubby.yaml"/>
</config>
</start>
<start name="vfs">
<resource name="RAM" quantum="32M"/>
<provides> <service name="File_system"/> </provides>
<config>
<vfs>
<dir name="etc">
<inline name="resolv.conf">nameserver 10.0.53.2</inline>
</dir>
<dir name="socket"> <lxip dhcp="yes"/> </dir>
</vfs>
<default-policy writeable="yes" root="/"/>
</config>
</start>
<start name="application" caps="256">
<binary name="sequence"/>
<resource name="RAM" quantum="8M"/>
<config>
<start name="getaddrinfo">
<binary name="test-libc_getaddrinfo"/>
<config>
<vfs>
<fs/>
<dir name="dev"> <log/> </dir>
</vfs>
<libc stdout="/dev/log" socket="/socket"/>
<arg value="test-libc_getenv"/>
<arg value="genode.org"/>
<arg value="hypervisor.org"/>
<arg value="example.com"/>
</config>
</start>
<start name="ldns">
<binary name="drill"/>
<config>
<vfs>
<fs/>
<dir name="dev"> <log/> </dir>
</vfs>
<libc stdout="/dev/log" stderr="/dev/log" rtc="/dev/rtc" socket="/socket"/>
<arg value="drill"/>
<arg value="genode.org"/>
<arg value="@10.0.53.2"/>
</config>
</start>
</config>
</start>
</config>
}
install_config $config
set boot_modules {
core init ld.lib.so
drill
libc.lib.so libm.lib.so posix.lib.so
libcrypto.lib.so
libgetdns.lib.so
libssl.lib.so
lxip.lib.so vfs_lxip.lib.so
nic_router
rtc_drv
sequence
stubby
timer
test-libc_getaddrinfo
vfs
vfs_jitterentropy.lib.so
}
# platform-specific modules
append_platform_drv_boot_modules
lappend boot_modules [nic_drv_binary]
build_boot_image $boot_modules
append qemu_args " -nographic -net nic,model=e1000 -net user -net dump,file=[run_dir]/dump.pcap"
run_genode_until "child \"application\" exited with exit value 0.*\n" 120
if {[have_include "power_on/qemu"]} {
puts "\ntraffic dump at [run_dir]/dump.pcap"
}

View File

@ -0,0 +1,58 @@
/* hand-tweaked automess */
#define HAVE_ASSERT_H 1
#define HAVE_ATTR_FORMAT 1
#define HAVE_ATTR_UNUSED 1
#define HAVE_GETDNS_GETDNS_EXTRA_H 1
#define HAVE_INTTYPES_H 1
#define HAVE_LIBGETDNS 1
#define HAVE_LIBYAML 1
#define HAVE_MEMORY_H 1
#define HAVE_STDARG_H 1
#define HAVE_STDINT_H 1
#define HAVE_STDIO_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRINGS_H 1
#define HAVE_STRING_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_UNISTD_H 1
#define PACKAGE "stubby"
#define PACKAGE_BUGREPORT ""
#define PACKAGE_NAME "Stubby"
#define PACKAGE_STRING "Stubby"
#define PACKAGE_TARNAME "stubby"
#define PACKAGE_URL ""
#define PACKAGE_VERSION ""
#define STDC_HEADERS 1
#define VERSION ""
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <stdio.h>
#include <stdarg.h>
#include <inttypes.h>
#ifdef HAVE_ATTR_FORMAT
# define ATTR_FORMAT(archetype, string_index, first_to_check) \
__attribute__ ((format (archetype, string_index, first_to_check)))
#else /* !HAVE_ATTR_FORMAT */
# define ATTR_FORMAT(archetype, string_index, first_to_check) /* empty */
#endif /* !HAVE_ATTR_FORMAT */
#if defined(__cplusplus)
# define ATTR_UNUSED(x)
#elif defined(HAVE_ATTR_UNUSED)
# define ATTR_UNUSED(x) x __attribute__((unused))
#else /* !HAVE_ATTR_UNUSED */
# define ATTR_UNUSED(x) x
#endif /* !HAVE_ATTR_UNUSED */
#ifndef HAVE_GETDNS_YAML2DICT
# define USE_YAML_CONFIG 1
#endif
#define yaml_string_to_json_string stubby_yaml_string_to_json_string
#define PRIsz "zu"
#include <arpa/inet.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <errno.h>
#define HAVE_NETDB_H
#define HAVE_TIME_H

View File

@ -0,0 +1,18 @@
TARGET = stubby
LIBS += libc posix libgetdns getdns-gldns libcrypto libyaml
STUBBY_DIR := $(call select_from_ports,getdns)/src/lib/getdns/stubby
STUBBY_SRC_DIR := $(STUBBY_DIR)/src
SRC_C += stubby.c convert_yaml_to_json.c
INC_DIR += $(PRG_DIR) $(STUBBY_SRC_DIR)
INC_DIR += $(STUBBY_SRC_DIR)/../../src
INC_DIR += $(STUBBY_SRC_DIR)/../../src/util/auxiliary
CC_DEF += -DHAVE_CONFIG_H -DSTUBBYCONFDIR=\"/\" -DRUNSTATEDIR=\"/\"
CC_DEF += -DSTUBBY_PACKAGE=\"stubby\" -DSTUBBY_PACKAGE_STRING=\"0.2.2\"
vpath %.c $(STUBBY_SRC_DIR)
vpath %.c $(STUBBY_SRC_DIR)/yaml

View File

@ -0,0 +1,320 @@
//#define ANCHOR_DEBUG 1
//#define DAEMON_DEBUG 1
#define DNSSEC_ROADBLOCK_AVOIDANCE 1
#define DRAFT_RRTYPES 1
#define EDNS_COOKIES 1
#define EDNS_COOKIE_OPCODE 10
#define EDNS_COOKIE_ROLLOVER_TIME (24 * 60 * 60)
#define EDNS_PADDING_OPCODE 12
#define GETDNS_FN_HOSTS "/etc/hosts"
#define GETDNS_FN_RESOLVCONF "/etc/resolv.conf"
#define HAVE_ARPA_INET_H 1
#define HAVE_ATTR_FORMAT 1
#define HAVE_ATTR_UNUSED 1
#define HAVE_DECL_ARC4RANDOM 0
#define HAVE_DECL_ARC4RANDOM_UNIFORM 0
#define HAVE_DECL_INET_NTOP 0
#define HAVE_DECL_INET_PTON 0
#define HAVE_DECL_NID_SECP384R1 1
#define HAVE_DECL_NID_X9_62_PRIME256V1 1
#define HAVE_DECL_SK_SSL_COMP_POP_FREE 1
#define HAVE_DECL_SSL_COMP_GET_COMPRESSION_METHODS 1
//#define HAVE_DECL_SSL_CTX_SET1_CURVES_LIST 1
#define HAVE_DECL_SSL_CTX_SET_ECDH_AUTO 1
//#define HAVE_DECL_SSL_SET1_CURVES_LIST 1
#define HAVE_DECL_STRLCPY 0
#define HAVE_DLFCN_H 1
#define HAVE_ENDIAN_H 1
#define HAVE_ENGINE_LOAD_CRYPTODEV 1
#define HAVE_EVP_DSS1 1
#define HAVE_EVP_MD5 1
#define HAVE_EVP_PKEY_BASE_ID 1
#define HAVE_EVP_PKEY_KEYGEN 1
#define HAVE_EVP_SHA1 1
#define HAVE_EVP_SHA224 1
#define HAVE_EVP_SHA256 1
#define HAVE_EVP_SHA384 1
#define HAVE_EVP_SHA512 1
#define HAVE_FCNTL 1
#define HAVE_FIPS_MODE 1
#define HAVE_GETADDRINFO 1
#define HAVE_GETAUXVAL 1
#define HAVE_HMAC_UPDATE 1
#define HAVE_INET_NTOP 1
#define HAVE_INET_PTON 1
#define HAVE_INTTYPES_H 1
#define HAVE_LIBYAML 1
#define HAVE_LIMITS_H 1
#define HAVE_MEMORY_H 1
#define HAVE_NETDB_H 1
#define HAVE_NETINET_IN_H 1
#define HAVE_OPENSSL_BN_H 1
#define HAVE_OPENSSL_CONFIG 1
#define HAVE_OPENSSL_CONF_H 1
#define HAVE_OPENSSL_DSA_H 1
#define HAVE_OPENSSL_ENGINE_H 1
#define HAVE_OPENSSL_ERR_H 1
#define HAVE_OPENSSL_RAND_H 1
#define HAVE_OPENSSL_RSA_H 1
#define HAVE_OPENSSL_SSL_H 1
//#define HAVE_POLL_H 1
//#define HAVE_PTHREAD 1
#define HAVE_SIGADDSET 1
#define HAVE_SIGEMPTYSET 1
#define HAVE_SIGFILLSET 1
#define HAVE_SIGNAL_H 1
#define HAVE_SIGSET_T 1
#define HAVE_SSL /**/
//#define HAVE_SSL_HN_AUTH 1
// FIXME
#define HAVE_STDARG_H 1
#define HAVE_STDINT_H 1
#define HAVE_STDIO_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRINGS_H 1
#define HAVE_STRING_H 1
#define HAVE_STRPTIME 1
//#define HAVE_SYS_POLL_H 1
#define HAVE_SYS_RESOURCE_H 1
#define HAVE_SYS_SELECT_H 1
#define HAVE_SYS_SOCKET_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_SYS_SYSCTL_H 1
#define HAVE_SYS_TIME_H 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_TIME_H 1
#define HAVE_TLS_v1_2 1
#define HAVE_UNISTD_H 1
#define HAVE_U_CHAR 1
//#define HAVE_X509_CHECK_HOST 1
#define HAVE___FUNC__ 1
#define LT_OBJDIR ".libs/"
#define MAXIMUM_UPSTREAM_OPTION_SPACE 3000
#define MAX_CNAME_REFERRALS 100
#define PACKAGE_BUGREPORT "team@getdnsapi.net"
#define PACKAGE_NAME "getdns"
#define PACKAGE_STRING "getdns 1.4.0"
#define PACKAGE_TARNAME "getdns"
#define PACKAGE_URL "https://getdnsapi.net"
#define PACKAGE_VERSION "1.4.0"
//#define REQ_DEBUG 1
#define RETSIGTYPE void
//#define SCHED_DEBUG 1
//#define SEC_DEBUG 1
//#define SERVER_DEBUG 1
#define STDC_HEADERS 1
#define STRPTIME_WORKS 1
#define STUBBY_PACKAGE "stubby"
#define STUBBY_PACKAGE_STRING ""
//#define STUB_DEBUG 1
#define STUB_NATIVE_DNSSEC 1
#define SYSCONFDIR sysconfdir
#define TRUST_ANCHOR_FILE "/getdns-root.key"
#define USE_DANESSL 1
#define USE_DSA 1
#define USE_ECDSA 1
#define USE_GOST 1
#define USE_SHA1 1
#define USE_SHA2 1
#ifdef HAVE___FUNC__
#define __FUNC__ __func__
#else
#define __FUNC__ __FUNCTION__
#endif
#ifdef GETDNS_ON_WINDOWS
# ifndef FD_SETSIZE
# define FD_SETSIZE 1024
# endif
# ifndef WINVER
# define WINVER 0x0600 // 0x0502
# endif
# ifndef _WIN32_WINNT
# define _WIN32_WINNT 0x0600 // 0x0502
# endif
# ifdef HAVE_WS2TCPIP_H
# include <ws2tcpip.h>
# endif
# ifdef _MSC_VER
# if _MSC_VER >= 1800
# define PRIsz "zu"
# else
# define PRIsz "Iu"
# endif
# else
# define PRIsz "Iu"
# endif
# ifdef HAVE_WINSOCK2_H
# include <winsock2.h>
# endif
# ifdef HAVE_WINSOCK2_H
# define FD_SET_T (u_int)
# else
# define FD_SET_T
# endif
/* Windows wants us to use _strdup instead of strdup */
# ifndef strdup
# define strdup _strdup
# endif
#else
# define PRIsz "zu"
#endif
#include <stdint.h>
#include <stdio.h>
#include <unistd.h>
#include <assert.h>
#include <string.h>
#ifdef __cplusplus
extern "C" {
#endif
#if STDC_HEADERS
#include <stdlib.h>
#include <stddef.h>
#endif
#if !defined(HAVE_STRLCPY) || !HAVE_DECL_STRLCPY || !defined(strlcpy)
size_t strlcpy(char *dst, const char *src, size_t siz);
#else
#ifndef __BSD_VISIBLE
#define __BSD_VISIBLE 1
#endif
#endif
#if !defined(HAVE_ARC4RANDOM) || !HAVE_DECL_ARC4RANDOM
uint32_t arc4random(void);
#endif
#if !defined(HAVE_ARC4RANDOM_UNIFORM) || !HAVE_DECL_ARC4RANDOM_UNIFORM
uint32_t arc4random_uniform(uint32_t upper_bound);
#endif
#ifndef HAVE_ARC4RANDOM
void explicit_bzero(void* buf, size_t len);
int getentropy(void* buf, size_t len);
void arc4random_buf(void* buf, size_t n);
void _ARC4_LOCK(void);
void _ARC4_UNLOCK(void);
#endif
#ifndef HAVE_DECL_INET_PTON
int inet_pton(int af, const char* src, void* dst);
#endif /* HAVE_INET_PTON */
#ifndef HAVE_DECL_INET_NTOP
const char *inet_ntop(int af, const void *src, char *dst, size_t size);
#endif
#ifdef USE_WINSOCK
# ifndef _CUSTOM_VSNPRINTF
# define _CUSTOM_VSNPRINTF
static inline int _gldns_custom_vsnprintf(char *str, size_t size, const char *format, va_list ap)
{ int r = vsnprintf(str, size, format, ap); return r == -1 ? _vscprintf(format, ap) : r; }
# define vsnprintf _gldns_custom_vsnprintf
# endif
#endif
#ifdef __cplusplus
}
#endif
#define USE_GLDNS 1
#ifdef HAVE_SSL
# define GLDNS_BUILD_CONFIG_HAVE_SSL 1
#endif
#ifdef HAVE_STDARG_H
#include <stdarg.h>
#endif
#include <errno.h>
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
#ifdef HAVE_OPENSSL_SSL_H
#include <openssl/ssl.h>
#endif
#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
#endif
#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif
#ifdef HAVE_SYS_LIMITS_H
#include <sys/limits.h>
#endif
#ifdef PATH_MAX
#define _GETDNS_PATH_MAX PATH_MAX
#else
#define _GETDNS_PATH_MAX 2048
#endif
#ifndef PRIu64
#define PRIu64 "llu"
#endif
#ifdef HAVE_ATTR_FORMAT
# define ATTR_FORMAT(archetype, string_index, first_to_check) \
__attribute__ ((format (archetype, string_index, first_to_check)))
#else /* !HAVE_ATTR_FORMAT */
# define ATTR_FORMAT(archetype, string_index, first_to_check) /* empty */
#endif /* !HAVE_ATTR_FORMAT */
#if defined(DOXYGEN)
# define ATTR_UNUSED(x) x
#elif defined(__cplusplus)
# define ATTR_UNUSED(x)
#elif defined(HAVE_ATTR_UNUSED)
# define ATTR_UNUSED(x) x __attribute__((unused))
#else /* !HAVE_ATTR_UNUSED */
# define ATTR_UNUSED(x) x
#endif /* !HAVE_ATTR_UNUSED */
#ifdef TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
#else
# ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
# else
# include <time.h>
# endif
#endif
#ifdef __cplusplus
extern "C" {
#endif
#if !defined(HAVE_STRPTIME) || !defined(STRPTIME_WORKS)
#define strptime unbound_strptime
struct tm;
char *strptime(const char *s, const char *format, struct tm *tm);
#endif
#if !defined(HAVE_SIGSET_T) && defined(HAVE__SIGSET_T)
typedef _sigset_t sigset_t;
#endif
#if !defined(HAVE_SIGEMPTYSET)
# define sigemptyset(pset) (*(pset) = 0)
#endif
#if !defined(HAVE_SIGFILLSET)
# define sigfillset(pset) (*(pset) = (sigset_t)-1)
#endif
#if !defined(HAVE_SIGADDSET)
# define sigaddset(pset, num) (*(pset) |= (1L<<(num)))
#endif
#ifdef HAVE_LIBUNBOUND
# include <unbound.h>
# ifdef HAVE_UNBOUND_EVENT_H
# include <unbound-event.h>
# else
# ifdef HAVE_UNBOUND_EVENT_API
# ifndef _UB_EVENT_PRIMITIVES
# define _UB_EVENT_PRIMITIVES
struct ub_event_base;
struct ub_ctx* ub_ctx_create_ub_event(struct ub_event_base* base);
typedef void (*ub_event_callback_t)(void*, int, void*, int, int, char*);
int ub_resolve_event(struct ub_ctx* ctx, const char* name, int rrtype,
int rrclass, void* mydata, ub_event_callback_t callback, int* async_id);
# endif
# endif
# endif
#endif
#ifdef __cplusplus
}
#endif