mirror of https://github.com/getdnsapi/getdns.git
Merge pull request #152 from wtoorop/devel/codebase-maintenance
Devel/codebase maintenance
This commit is contained in:
commit
735892cb99
|
@ -7,12 +7,11 @@ addons:
|
||||||
apt:
|
apt:
|
||||||
packages:
|
packages:
|
||||||
- libunbound-dev
|
- libunbound-dev
|
||||||
- libldns-dev
|
|
||||||
- libidn11-dev
|
- libidn11-dev
|
||||||
- check
|
- check
|
||||||
- libevent-dev
|
- libevent-dev
|
||||||
- libev-dev
|
- libev-dev
|
||||||
- bc
|
- valgrind
|
||||||
script:
|
script:
|
||||||
- mkdir tests
|
- mkdir tests
|
||||||
- cd tests
|
- cd tests
|
||||||
|
|
21
configure.ac
21
configure.ac
|
@ -524,6 +524,17 @@ then
|
||||||
AC_CHECK_LIB([idn], [idna_to_ascii_8z], [], [found_all_libs=0])
|
AC_CHECK_LIB([idn], [idna_to_ascii_8z], [], [found_all_libs=0])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
AC_ARG_ENABLE(unbound-event-api, AC_HELP_STRING([--disable-unbound-event-api], [Disable usage of libunbounds event API]))
|
||||||
|
case "$enable_unbound_event_api" in
|
||||||
|
no)
|
||||||
|
my_enable_unbound_event_api=0
|
||||||
|
;;
|
||||||
|
yes|*)
|
||||||
|
my_enable_unbound_event_api=1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
if test $my_with_libunbound = 1
|
if test $my_with_libunbound = 1
|
||||||
then
|
then
|
||||||
AC_CHECK_HEADERS([unbound-event.h],,, [AC_INCLUDES_DEFAULT])
|
AC_CHECK_HEADERS([unbound-event.h],,, [AC_INCLUDES_DEFAULT])
|
||||||
|
@ -531,9 +542,13 @@ then
|
||||||
AC_CHECK_LIB([unbound], [ub_fd], [
|
AC_CHECK_LIB([unbound], [ub_fd], [
|
||||||
AC_DEFINE_UNQUOTED([HAVE_LIBUNBOUND], [1], [Define to 1 if you have the `unbound' library (-lunbound).]) dnl `
|
AC_DEFINE_UNQUOTED([HAVE_LIBUNBOUND], [1], [Define to 1 if you have the `unbound' library (-lunbound).]) dnl `
|
||||||
LIBS="-lunbound $LIBS"
|
LIBS="-lunbound $LIBS"
|
||||||
AC_CHECK_FUNC([ub_ctx_create_ub_event], [
|
|
||||||
AC_DEFINE_UNQUOTED([HAVE_UNBOUND_EVENT_API], [1], [Define this when libunbound is compiled with the --enable-event-api option.])
|
if test $my_enable_unbound_event_api = 1
|
||||||
])
|
then
|
||||||
|
AC_CHECK_FUNC([ub_ctx_create_ub_event], [
|
||||||
|
AC_DEFINE_UNQUOTED([HAVE_UNBOUND_EVENT_API], [1], [Define this when libunbound is compiled with the --enable-event-api option.])
|
||||||
|
])
|
||||||
|
fi
|
||||||
AC_CHECK_FUNCS([ub_ctx_set_stub])
|
AC_CHECK_FUNCS([ub_ctx_set_stub])
|
||||||
], [found_all_libs=0])
|
], [found_all_libs=0])
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -149,16 +149,24 @@ depend:
|
||||||
|
|
||||||
# Dependencies for the examples
|
# Dependencies for the examples
|
||||||
example-all-functions.lo example-all-functions.o: $(srcdir)/example-all-functions.c $(srcdir)/getdns_libevent.h \
|
example-all-functions.lo example-all-functions.o: $(srcdir)/example-all-functions.c $(srcdir)/getdns_libevent.h \
|
||||||
../../src/config.h ../../src/getdns/getdns.h \
|
../../src/config.h \
|
||||||
$(srcdir)/../../src/getdns/getdns_ext_libevent.h ../../src/getdns/getdns_extra.h
|
../../src/getdns/getdns.h \
|
||||||
example-reverse.lo example-reverse.o: $(srcdir)/example-reverse.c $(srcdir)/getdns_libevent.h ../../src/config.h \
|
$(srcdir)/../../src/getdns/getdns_ext_libevent.h \
|
||||||
../../src/getdns/getdns.h $(srcdir)/../../src/getdns/getdns_ext_libevent.h \
|
../../src/getdns/getdns_extra.h
|
||||||
|
example-reverse.lo example-reverse.o: $(srcdir)/example-reverse.c $(srcdir)/getdns_libevent.h \
|
||||||
|
../../src/config.h \
|
||||||
|
../../src/getdns/getdns.h \
|
||||||
|
$(srcdir)/../../src/getdns/getdns_ext_libevent.h \
|
||||||
../../src/getdns/getdns_extra.h
|
../../src/getdns/getdns_extra.h
|
||||||
example-simple-answers.lo example-simple-answers.o: $(srcdir)/example-simple-answers.c $(srcdir)/getdns_libevent.h \
|
example-simple-answers.lo example-simple-answers.o: $(srcdir)/example-simple-answers.c $(srcdir)/getdns_libevent.h \
|
||||||
../../src/config.h ../../src/getdns/getdns.h \
|
../../src/config.h \
|
||||||
$(srcdir)/../../src/getdns/getdns_ext_libevent.h ../../src/getdns/getdns_extra.h
|
../../src/getdns/getdns.h \
|
||||||
|
$(srcdir)/../../src/getdns/getdns_ext_libevent.h \
|
||||||
|
../../src/getdns/getdns_extra.h
|
||||||
example-synchronous.lo example-synchronous.o: $(srcdir)/example-synchronous.c $(srcdir)/getdns_core_only.h \
|
example-synchronous.lo example-synchronous.o: $(srcdir)/example-synchronous.c $(srcdir)/getdns_core_only.h \
|
||||||
../../src/getdns/getdns.h
|
../../src/getdns/getdns.h
|
||||||
example-tree.lo example-tree.o: $(srcdir)/example-tree.c $(srcdir)/getdns_libevent.h ../../src/config.h \
|
example-tree.lo example-tree.o: $(srcdir)/example-tree.c $(srcdir)/getdns_libevent.h \
|
||||||
../../src/getdns/getdns.h $(srcdir)/../../src/getdns/getdns_ext_libevent.h \
|
../../src/config.h \
|
||||||
|
../../src/getdns/getdns.h \
|
||||||
|
$(srcdir)/../../src/getdns/getdns_ext_libevent.h \
|
||||||
../../src/getdns/getdns_extra.h
|
../../src/getdns/getdns_extra.h
|
||||||
|
|
272
src/Makefile.in
272
src/Makefile.in
|
@ -225,107 +225,189 @@ depend:
|
||||||
FORCE:
|
FORCE:
|
||||||
|
|
||||||
# Dependencies for gldns, utils, the extensions and compat functions
|
# Dependencies for gldns, utils, the extensions and compat functions
|
||||||
const-info.lo const-info.o: $(srcdir)/const-info.c getdns/getdns.h getdns/getdns_extra.h \
|
const-info.lo const-info.o: $(srcdir)/const-info.c \
|
||||||
getdns/getdns.h $(srcdir)/const-info.h
|
getdns/getdns.h \
|
||||||
context.lo context.o: $(srcdir)/context.c config.h $(srcdir)/debug.h $(srcdir)/gldns/str2wire.h $(srcdir)/gldns/rrdef.h \
|
getdns/getdns_extra.h \
|
||||||
$(srcdir)/gldns/wire2str.h $(srcdir)/context.h getdns/getdns.h getdns/getdns_extra.h \
|
$(srcdir)/const-info.h
|
||||||
getdns/getdns.h $(srcdir)/types-internal.h $(srcdir)/util/rbtree.h \
|
context.lo context.o: $(srcdir)/context.c \
|
||||||
$(srcdir)/extension/default_eventloop.h config.h getdns/getdns_extra.h $(srcdir)/ub_loop.h \
|
config.h $(srcdir)/debug.h \
|
||||||
|
$(srcdir)/gldns/str2wire.h $(srcdir)/gldns/rrdef.h $(srcdir)/gldns/wire2str.h $(srcdir)/context.h \
|
||||||
|
getdns/getdns.h \
|
||||||
|
getdns/getdns_extra.h \
|
||||||
|
$(srcdir)/types-internal.h $(srcdir)/util/rbtree.h $(srcdir)/extension/default_eventloop.h $(srcdir)/ub_loop.h \
|
||||||
$(srcdir)/util-internal.h $(srcdir)/rr-iter.h $(srcdir)/rr-dict.h $(srcdir)/gldns/gbuffer.h $(srcdir)/gldns/pkthdr.h \
|
$(srcdir)/util-internal.h $(srcdir)/rr-iter.h $(srcdir)/rr-dict.h $(srcdir)/gldns/gbuffer.h $(srcdir)/gldns/pkthdr.h \
|
||||||
$(srcdir)/dnssec.h $(srcdir)/stub.h $(srcdir)/list.h $(srcdir)/dict.h $(srcdir)/pubkey-pinning.h
|
$(srcdir)/dnssec.h $(srcdir)/stub.h $(srcdir)/list.h $(srcdir)/dict.h $(srcdir)/pubkey-pinning.h
|
||||||
convert.lo convert.o: $(srcdir)/convert.c config.h getdns/getdns.h getdns/getdns_extra.h \
|
convert.lo convert.o: $(srcdir)/convert.c \
|
||||||
getdns/getdns.h $(srcdir)/util-internal.h $(srcdir)/context.h $(srcdir)/types-internal.h $(srcdir)/util/rbtree.h \
|
config.h \
|
||||||
$(srcdir)/extension/default_eventloop.h config.h getdns/getdns_extra.h $(srcdir)/ub_loop.h \
|
getdns/getdns.h \
|
||||||
$(srcdir)/rr-iter.h $(srcdir)/rr-dict.h $(srcdir)/gldns/gbuffer.h $(srcdir)/gldns/pkthdr.h $(srcdir)/gldns/wire2str.h \
|
getdns/getdns_extra.h \
|
||||||
$(srcdir)/gldns/str2wire.h $(srcdir)/gldns/rrdef.h $(srcdir)/dict.h $(srcdir)/list.h $(srcdir)/convert.h
|
$(srcdir)/util-internal.h $(srcdir)/context.h $(srcdir)/types-internal.h $(srcdir)/util/rbtree.h \
|
||||||
dict.lo dict.o: $(srcdir)/dict.c config.h $(srcdir)/types-internal.h getdns/getdns.h \
|
$(srcdir)/extension/default_eventloop.h $(srcdir)/ub_loop.h $(srcdir)/debug.h $(srcdir)/rr-iter.h $(srcdir)/rr-dict.h \
|
||||||
getdns/getdns_extra.h getdns/getdns.h $(srcdir)/util/rbtree.h $(srcdir)/util-internal.h \
|
$(srcdir)/gldns/gbuffer.h $(srcdir)/gldns/pkthdr.h $(srcdir)/gldns/wire2str.h $(srcdir)/gldns/str2wire.h \
|
||||||
$(srcdir)/context.h $(srcdir)/extension/default_eventloop.h config.h getdns/getdns_extra.h \
|
$(srcdir)/gldns/rrdef.h $(srcdir)/dict.h $(srcdir)/list.h $(srcdir)/convert.h
|
||||||
$(srcdir)/ub_loop.h $(srcdir)/rr-iter.h $(srcdir)/rr-dict.h $(srcdir)/gldns/gbuffer.h $(srcdir)/gldns/pkthdr.h $(srcdir)/dict.h \
|
dict.lo dict.o: $(srcdir)/dict.c \
|
||||||
$(srcdir)/list.h $(srcdir)/const-info.h $(srcdir)/gldns/wire2str.h
|
config.h \
|
||||||
dnssec.lo dnssec.o: $(srcdir)/dnssec.c config.h $(srcdir)/debug.h getdns/getdns.h $(srcdir)/context.h \
|
$(srcdir)/types-internal.h \
|
||||||
getdns/getdns_extra.h getdns/getdns.h $(srcdir)/types-internal.h $(srcdir)/util/rbtree.h \
|
getdns/getdns.h \
|
||||||
$(srcdir)/extension/default_eventloop.h config.h getdns/getdns_extra.h $(srcdir)/ub_loop.h \
|
getdns/getdns_extra.h \
|
||||||
|
$(srcdir)/util/rbtree.h $(srcdir)/util-internal.h $(srcdir)/context.h $(srcdir)/extension/default_eventloop.h \
|
||||||
|
$(srcdir)/ub_loop.h $(srcdir)/debug.h $(srcdir)/rr-iter.h $(srcdir)/rr-dict.h $(srcdir)/gldns/gbuffer.h $(srcdir)/gldns/pkthdr.h \
|
||||||
|
$(srcdir)/dict.h $(srcdir)/list.h $(srcdir)/const-info.h $(srcdir)/gldns/wire2str.h
|
||||||
|
dnssec.lo dnssec.o: $(srcdir)/dnssec.c \
|
||||||
|
config.h $(srcdir)/debug.h \
|
||||||
|
getdns/getdns.h \
|
||||||
|
$(srcdir)/context.h \
|
||||||
|
getdns/getdns_extra.h \
|
||||||
|
$(srcdir)/types-internal.h $(srcdir)/util/rbtree.h $(srcdir)/extension/default_eventloop.h $(srcdir)/ub_loop.h \
|
||||||
$(srcdir)/util-internal.h $(srcdir)/rr-iter.h $(srcdir)/rr-dict.h $(srcdir)/gldns/gbuffer.h $(srcdir)/gldns/pkthdr.h \
|
$(srcdir)/util-internal.h $(srcdir)/rr-iter.h $(srcdir)/rr-dict.h $(srcdir)/gldns/gbuffer.h $(srcdir)/gldns/pkthdr.h \
|
||||||
$(srcdir)/dnssec.h $(srcdir)/gldns/str2wire.h $(srcdir)/gldns/rrdef.h $(srcdir)/gldns/wire2str.h $(srcdir)/gldns/keyraw.h \
|
$(srcdir)/dnssec.h $(srcdir)/gldns/str2wire.h $(srcdir)/gldns/rrdef.h $(srcdir)/gldns/wire2str.h $(srcdir)/gldns/keyraw.h \
|
||||||
$(srcdir)/gldns/parseutil.h $(srcdir)/general.h $(srcdir)/dict.h $(srcdir)/list.h $(srcdir)/util/val_secalgo.h
|
$(srcdir)/gldns/parseutil.h $(srcdir)/general.h $(srcdir)/dict.h $(srcdir)/list.h $(srcdir)/util/val_secalgo.h
|
||||||
general.lo general.o: $(srcdir)/general.c config.h $(srcdir)/general.h getdns/getdns.h $(srcdir)/types-internal.h \
|
general.lo general.o: $(srcdir)/general.c \
|
||||||
getdns/getdns_extra.h getdns/getdns.h $(srcdir)/util/rbtree.h $(srcdir)/gldns/wire2str.h \
|
config.h $(srcdir)/general.h \
|
||||||
$(srcdir)/context.h $(srcdir)/extension/default_eventloop.h config.h getdns/getdns_extra.h \
|
getdns/getdns.h \
|
||||||
$(srcdir)/ub_loop.h $(srcdir)/util-internal.h $(srcdir)/rr-iter.h $(srcdir)/rr-dict.h $(srcdir)/gldns/gbuffer.h \
|
$(srcdir)/types-internal.h \
|
||||||
$(srcdir)/gldns/pkthdr.h $(srcdir)/dnssec.h $(srcdir)/stub.h $(srcdir)/dict.h
|
getdns/getdns_extra.h \
|
||||||
list.lo list.o: $(srcdir)/list.c $(srcdir)/types-internal.h getdns/getdns.h getdns/getdns_extra.h \
|
$(srcdir)/util/rbtree.h $(srcdir)/ub_loop.h $(srcdir)/debug.h $(srcdir)/gldns/wire2str.h $(srcdir)/context.h \
|
||||||
getdns/getdns.h $(srcdir)/util/rbtree.h $(srcdir)/util-internal.h config.h $(srcdir)/context.h \
|
$(srcdir)/extension/default_eventloop.h $(srcdir)/util-internal.h $(srcdir)/rr-iter.h $(srcdir)/rr-dict.h \
|
||||||
$(srcdir)/extension/default_eventloop.h config.h getdns/getdns_extra.h $(srcdir)/ub_loop.h \
|
$(srcdir)/gldns/gbuffer.h $(srcdir)/gldns/pkthdr.h $(srcdir)/dnssec.h $(srcdir)/stub.h $(srcdir)/dict.h
|
||||||
$(srcdir)/rr-iter.h $(srcdir)/rr-dict.h $(srcdir)/gldns/gbuffer.h $(srcdir)/gldns/pkthdr.h $(srcdir)/list.h $(srcdir)/dict.h
|
list.lo list.o: $(srcdir)/list.c $(srcdir)/types-internal.h \
|
||||||
pubkey-pinning.lo pubkey-pinning.o: $(srcdir)/pubkey-pinning.c config.h $(srcdir)/debug.h getdns/getdns.h \
|
getdns/getdns.h \
|
||||||
$(srcdir)/context.h getdns/getdns.h getdns/getdns_extra.h $(srcdir)/types-internal.h \
|
getdns/getdns_extra.h \
|
||||||
$(srcdir)/util/rbtree.h $(srcdir)/extension/default_eventloop.h config.h \
|
$(srcdir)/util/rbtree.h $(srcdir)/util-internal.h \
|
||||||
getdns/getdns_extra.h $(srcdir)/ub_loop.h
|
config.h $(srcdir)/context.h \
|
||||||
request-internal.lo request-internal.o: $(srcdir)/request-internal.c config.h $(srcdir)/types-internal.h \
|
$(srcdir)/extension/default_eventloop.h $(srcdir)/ub_loop.h $(srcdir)/debug.h $(srcdir)/rr-iter.h $(srcdir)/rr-dict.h \
|
||||||
getdns/getdns.h getdns/getdns_extra.h getdns/getdns.h $(srcdir)/util/rbtree.h \
|
$(srcdir)/gldns/gbuffer.h $(srcdir)/gldns/pkthdr.h $(srcdir)/list.h $(srcdir)/dict.h
|
||||||
$(srcdir)/util-internal.h $(srcdir)/context.h $(srcdir)/extension/default_eventloop.h config.h \
|
pubkey-pinning.lo pubkey-pinning.o: $(srcdir)/pubkey-pinning.c \
|
||||||
getdns/getdns_extra.h $(srcdir)/ub_loop.h $(srcdir)/rr-iter.h $(srcdir)/rr-dict.h $(srcdir)/gldns/gbuffer.h \
|
config.h $(srcdir)/debug.h \
|
||||||
$(srcdir)/gldns/pkthdr.h $(srcdir)/gldns/rrdef.h $(srcdir)/gldns/str2wire.h $(srcdir)/gldns/rrdef.h $(srcdir)/dict.h \
|
getdns/getdns.h \
|
||||||
$(srcdir)/debug.h
|
$(srcdir)/context.h \
|
||||||
rr-dict.lo rr-dict.o: $(srcdir)/rr-dict.c $(srcdir)/rr-dict.h config.h getdns/getdns.h $(srcdir)/gldns/gbuffer.h \
|
getdns/getdns_extra.h \
|
||||||
$(srcdir)/util-internal.h $(srcdir)/context.h getdns/getdns_extra.h getdns/getdns.h \
|
$(srcdir)/types-internal.h $(srcdir)/util/rbtree.h $(srcdir)/extension/default_eventloop.h $(srcdir)/ub_loop.h \
|
||||||
$(srcdir)/types-internal.h $(srcdir)/util/rbtree.h $(srcdir)/extension/default_eventloop.h config.h \
|
$(srcdir)/util-internal.h $(srcdir)/rr-iter.h $(srcdir)/rr-dict.h $(srcdir)/gldns/gbuffer.h $(srcdir)/gldns/pkthdr.h
|
||||||
getdns/getdns_extra.h $(srcdir)/ub_loop.h $(srcdir)/rr-iter.h $(srcdir)/gldns/pkthdr.h $(srcdir)/dict.h
|
request-internal.lo request-internal.o: $(srcdir)/request-internal.c \
|
||||||
rr-iter.lo rr-iter.o: $(srcdir)/rr-iter.c $(srcdir)/rr-iter.h getdns/getdns.h $(srcdir)/rr-dict.h config.h \
|
config.h \
|
||||||
|
$(srcdir)/types-internal.h \
|
||||||
|
getdns/getdns.h \
|
||||||
|
getdns/getdns_extra.h \
|
||||||
|
$(srcdir)/util/rbtree.h $(srcdir)/util-internal.h $(srcdir)/context.h $(srcdir)/extension/default_eventloop.h \
|
||||||
|
$(srcdir)/ub_loop.h $(srcdir)/debug.h $(srcdir)/rr-iter.h $(srcdir)/rr-dict.h $(srcdir)/gldns/gbuffer.h $(srcdir)/gldns/pkthdr.h \
|
||||||
|
$(srcdir)/gldns/rrdef.h $(srcdir)/gldns/str2wire.h $(srcdir)/gldns/rrdef.h $(srcdir)/dict.h
|
||||||
|
rr-dict.lo rr-dict.o: $(srcdir)/rr-dict.c $(srcdir)/rr-dict.h \
|
||||||
|
config.h \
|
||||||
|
getdns/getdns.h \
|
||||||
|
$(srcdir)/gldns/gbuffer.h $(srcdir)/util-internal.h $(srcdir)/context.h \
|
||||||
|
getdns/getdns_extra.h \
|
||||||
|
$(srcdir)/types-internal.h $(srcdir)/util/rbtree.h $(srcdir)/extension/default_eventloop.h $(srcdir)/ub_loop.h \
|
||||||
|
$(srcdir)/debug.h $(srcdir)/rr-iter.h $(srcdir)/gldns/pkthdr.h $(srcdir)/dict.h
|
||||||
|
rr-iter.lo rr-iter.o: $(srcdir)/rr-iter.c $(srcdir)/rr-iter.h \
|
||||||
|
getdns/getdns.h \
|
||||||
|
$(srcdir)/rr-dict.h config.h \
|
||||||
$(srcdir)/gldns/gbuffer.h $(srcdir)/gldns/pkthdr.h $(srcdir)/gldns/rrdef.h
|
$(srcdir)/gldns/gbuffer.h $(srcdir)/gldns/pkthdr.h $(srcdir)/gldns/rrdef.h
|
||||||
stub.lo stub.o: $(srcdir)/stub.c config.h $(srcdir)/debug.h $(srcdir)/stub.h getdns/getdns.h $(srcdir)/types-internal.h \
|
stub.lo stub.o: $(srcdir)/stub.c \
|
||||||
getdns/getdns_extra.h getdns/getdns.h $(srcdir)/util/rbtree.h $(srcdir)/gldns/gbuffer.h \
|
config.h $(srcdir)/debug.h \
|
||||||
$(srcdir)/gldns/pkthdr.h $(srcdir)/gldns/rrdef.h $(srcdir)/gldns/str2wire.h $(srcdir)/gldns/rrdef.h \
|
$(srcdir)/stub.h \
|
||||||
$(srcdir)/gldns/wire2str.h $(srcdir)/rr-iter.h $(srcdir)/rr-dict.h $(srcdir)/context.h \
|
getdns/getdns.h \
|
||||||
$(srcdir)/extension/default_eventloop.h config.h getdns/getdns_extra.h $(srcdir)/ub_loop.h \
|
$(srcdir)/types-internal.h \
|
||||||
$(srcdir)/util-internal.h $(srcdir)/general.h $(srcdir)/pubkey-pinning.h
|
getdns/getdns_extra.h \
|
||||||
sync.lo sync.o: $(srcdir)/sync.c config.h getdns/getdns.h getdns/getdns_extra.h \
|
$(srcdir)/util/rbtree.h $(srcdir)/gldns/gbuffer.h $(srcdir)/gldns/pkthdr.h $(srcdir)/gldns/rrdef.h \
|
||||||
getdns/getdns.h
|
$(srcdir)/gldns/str2wire.h $(srcdir)/gldns/rrdef.h $(srcdir)/gldns/wire2str.h $(srcdir)/rr-iter.h $(srcdir)/rr-dict.h \
|
||||||
ub_loop.lo ub_loop.o: $(srcdir)/ub_loop.c $(srcdir)/ub_loop.h config.h getdns/getdns.h \
|
$(srcdir)/context.h $(srcdir)/extension/default_eventloop.h $(srcdir)/ub_loop.h $(srcdir)/util-internal.h \
|
||||||
getdns/getdns_extra.h getdns/getdns.h $(srcdir)/types-internal.h $(srcdir)/util/rbtree.h
|
$(srcdir)/general.h $(srcdir)/pubkey-pinning.h
|
||||||
util-internal.lo util-internal.o: $(srcdir)/util-internal.c config.h getdns/getdns.h $(srcdir)/dict.h \
|
sync.lo sync.o: $(srcdir)/sync.c \
|
||||||
$(srcdir)/util/rbtree.h $(srcdir)/types-internal.h getdns/getdns_extra.h getdns/getdns.h \
|
getdns/getdns.h \
|
||||||
$(srcdir)/list.h $(srcdir)/util-internal.h $(srcdir)/context.h $(srcdir)/extension/default_eventloop.h config.h \
|
config.h $(srcdir)/context.h \
|
||||||
getdns/getdns_extra.h $(srcdir)/ub_loop.h $(srcdir)/rr-iter.h $(srcdir)/rr-dict.h $(srcdir)/gldns/gbuffer.h \
|
getdns/getdns_extra.h \
|
||||||
$(srcdir)/gldns/pkthdr.h $(srcdir)/gldns/str2wire.h $(srcdir)/gldns/rrdef.h
|
$(srcdir)/types-internal.h $(srcdir)/util/rbtree.h $(srcdir)/extension/default_eventloop.h $(srcdir)/ub_loop.h \
|
||||||
version.lo version.o: version.c
|
$(srcdir)/debug.h $(srcdir)/general.h $(srcdir)/util-internal.h $(srcdir)/rr-iter.h $(srcdir)/rr-dict.h $(srcdir)/gldns/gbuffer.h \
|
||||||
gbuffer.lo gbuffer.o: $(srcdir)/gldns/gbuffer.c config.h $(srcdir)/gldns/gbuffer.h
|
$(srcdir)/gldns/pkthdr.h $(srcdir)/dnssec.h $(srcdir)/stub.h $(srcdir)/gldns/wire2str.h
|
||||||
keyraw.lo keyraw.o: $(srcdir)/gldns/keyraw.c config.h $(srcdir)/gldns/keyraw.h $(srcdir)/gldns/rrdef.h
|
ub_loop.lo ub_loop.o: $(srcdir)/ub_loop.c $(srcdir)/ub_loop.h \
|
||||||
parse.lo parse.o: $(srcdir)/gldns/parse.c config.h $(srcdir)/gldns/parse.h $(srcdir)/gldns/parseutil.h \
|
config.h \
|
||||||
|
getdns/getdns.h \
|
||||||
|
getdns/getdns_extra.h \
|
||||||
|
$(srcdir)/types-internal.h $(srcdir)/util/rbtree.h $(srcdir)/debug.h
|
||||||
|
util-internal.lo util-internal.o: $(srcdir)/util-internal.c \
|
||||||
|
config.h \
|
||||||
|
getdns/getdns.h \
|
||||||
|
$(srcdir)/dict.h $(srcdir)/util/rbtree.h $(srcdir)/types-internal.h \
|
||||||
|
getdns/getdns_extra.h \
|
||||||
|
$(srcdir)/list.h $(srcdir)/util-internal.h $(srcdir)/context.h $(srcdir)/extension/default_eventloop.h $(srcdir)/ub_loop.h \
|
||||||
|
$(srcdir)/debug.h $(srcdir)/rr-iter.h $(srcdir)/rr-dict.h $(srcdir)/gldns/gbuffer.h $(srcdir)/gldns/pkthdr.h \
|
||||||
|
$(srcdir)/gldns/str2wire.h $(srcdir)/gldns/rrdef.h
|
||||||
|
gbuffer.lo gbuffer.o: $(srcdir)/gldns/gbuffer.c \
|
||||||
|
config.h \
|
||||||
$(srcdir)/gldns/gbuffer.h
|
$(srcdir)/gldns/gbuffer.h
|
||||||
parseutil.lo parseutil.o: $(srcdir)/gldns/parseutil.c config.h $(srcdir)/gldns/parseutil.h
|
keyraw.lo keyraw.o: $(srcdir)/gldns/keyraw.c \
|
||||||
rrdef.lo rrdef.o: $(srcdir)/gldns/rrdef.c config.h $(srcdir)/gldns/rrdef.h $(srcdir)/gldns/parseutil.h
|
config.h \
|
||||||
str2wire.lo str2wire.o: $(srcdir)/gldns/str2wire.c config.h $(srcdir)/gldns/str2wire.h $(srcdir)/gldns/rrdef.h \
|
$(srcdir)/gldns/keyraw.h $(srcdir)/gldns/rrdef.h
|
||||||
$(srcdir)/gldns/wire2str.h $(srcdir)/gldns/gbuffer.h $(srcdir)/gldns/parse.h $(srcdir)/gldns/parseutil.h
|
parse.lo parse.o: $(srcdir)/gldns/parse.c \
|
||||||
wire2str.lo wire2str.o: $(srcdir)/gldns/wire2str.c config.h $(srcdir)/gldns/wire2str.h $(srcdir)/gldns/str2wire.h \
|
config.h \
|
||||||
$(srcdir)/gldns/rrdef.h $(srcdir)/gldns/pkthdr.h $(srcdir)/gldns/parseutil.h $(srcdir)/gldns/gbuffer.h \
|
$(srcdir)/gldns/parse.h $(srcdir)/gldns/parseutil.h $(srcdir)/gldns/gbuffer.h
|
||||||
$(srcdir)/gldns/keyraw.h
|
parseutil.lo parseutil.o: $(srcdir)/gldns/parseutil.c \
|
||||||
arc4_lock.lo arc4_lock.o: $(srcdir)/compat/arc4_lock.c config.h
|
config.h \
|
||||||
arc4random.lo arc4random.o: $(srcdir)/compat/arc4random.c config.h $(srcdir)/compat/chacha_private.h
|
$(srcdir)/gldns/parseutil.h
|
||||||
arc4random_uniform.lo arc4random_uniform.o: $(srcdir)/compat/arc4random_uniform.c config.h
|
rrdef.lo rrdef.o: $(srcdir)/gldns/rrdef.c \
|
||||||
explicit_bzero.lo explicit_bzero.o: $(srcdir)/compat/explicit_bzero.c config.h
|
config.h \
|
||||||
getentropy_linux.lo getentropy_linux.o: $(srcdir)/compat/getentropy_linux.c config.h
|
$(srcdir)/gldns/rrdef.h $(srcdir)/gldns/parseutil.h
|
||||||
getentropy_osx.lo getentropy_osx.o: $(srcdir)/compat/getentropy_osx.c config.h
|
str2wire.lo str2wire.o: $(srcdir)/gldns/str2wire.c \
|
||||||
getentropy_solaris.lo getentropy_solaris.o: $(srcdir)/compat/getentropy_solaris.c config.h
|
config.h \
|
||||||
|
$(srcdir)/gldns/str2wire.h $(srcdir)/gldns/rrdef.h $(srcdir)/gldns/wire2str.h $(srcdir)/gldns/gbuffer.h \
|
||||||
|
$(srcdir)/gldns/parse.h $(srcdir)/gldns/parseutil.h
|
||||||
|
wire2str.lo wire2str.o: $(srcdir)/gldns/wire2str.c \
|
||||||
|
config.h \
|
||||||
|
$(srcdir)/gldns/wire2str.h $(srcdir)/gldns/str2wire.h $(srcdir)/gldns/rrdef.h $(srcdir)/gldns/pkthdr.h \
|
||||||
|
$(srcdir)/gldns/parseutil.h $(srcdir)/gldns/gbuffer.h $(srcdir)/gldns/keyraw.h
|
||||||
|
arc4_lock.lo arc4_lock.o: $(srcdir)/compat/arc4_lock.c \
|
||||||
|
config.h
|
||||||
|
arc4random.lo arc4random.o: $(srcdir)/compat/arc4random.c \
|
||||||
|
config.h \
|
||||||
|
$(srcdir)/compat/chacha_private.h
|
||||||
|
arc4random_uniform.lo arc4random_uniform.o: $(srcdir)/compat/arc4random_uniform.c \
|
||||||
|
config.h
|
||||||
|
explicit_bzero.lo explicit_bzero.o: $(srcdir)/compat/explicit_bzero.c \
|
||||||
|
config.h
|
||||||
|
getentropy_linux.lo getentropy_linux.o: $(srcdir)/compat/getentropy_linux.c \
|
||||||
|
config.h
|
||||||
|
getentropy_osx.lo getentropy_osx.o: $(srcdir)/compat/getentropy_osx.c \
|
||||||
|
config.h
|
||||||
|
getentropy_solaris.lo getentropy_solaris.o: $(srcdir)/compat/getentropy_solaris.c \
|
||||||
|
config.h
|
||||||
getentropy_win.lo getentropy_win.o: $(srcdir)/compat/getentropy_win.c
|
getentropy_win.lo getentropy_win.o: $(srcdir)/compat/getentropy_win.c
|
||||||
inet_ntop.lo inet_ntop.o: $(srcdir)/compat/inet_ntop.c config.h
|
inet_ntop.lo inet_ntop.o: $(srcdir)/compat/inet_ntop.c \
|
||||||
inet_pton.lo inet_pton.o: $(srcdir)/compat/inet_pton.c config.h
|
config.h
|
||||||
sha512.lo sha512.o: $(srcdir)/compat/sha512.c config.h
|
inet_pton.lo inet_pton.o: $(srcdir)/compat/inet_pton.c \
|
||||||
strlcpy.lo strlcpy.o: $(srcdir)/compat/strlcpy.c config.h
|
config.h
|
||||||
rbtree.lo rbtree.o: $(srcdir)/util/rbtree.c config.h $(srcdir)/util/log.h $(srcdir)/debug.h config.h \
|
sha512.lo sha512.o: $(srcdir)/compat/sha512.c \
|
||||||
$(srcdir)/util/fptr_wlist.h $(srcdir)/util/rbtree.h
|
config.h
|
||||||
val_secalgo.lo val_secalgo.o: $(srcdir)/util/val_secalgo.c config.h $(srcdir)/util/val_secalgo.h $(srcdir)/util/log.h \
|
strlcpy.lo strlcpy.o: $(srcdir)/compat/strlcpy.c \
|
||||||
$(srcdir)/debug.h config.h $(srcdir)/gldns/rrdef.h $(srcdir)/gldns/keyraw.h $(srcdir)/gldns/gbuffer.h
|
config.h
|
||||||
|
rbtree.lo rbtree.o: $(srcdir)/util/rbtree.c \
|
||||||
|
config.h \
|
||||||
|
$(srcdir)/util/log.h $(srcdir)/debug.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/rbtree.h
|
||||||
|
val_secalgo.lo val_secalgo.o: $(srcdir)/util/val_secalgo.c \
|
||||||
|
config.h \
|
||||||
|
$(srcdir)/util/val_secalgo.h $(srcdir)/util/log.h $(srcdir)/debug.h $(srcdir)/gldns/rrdef.h $(srcdir)/gldns/keyraw.h \
|
||||||
|
$(srcdir)/gldns/gbuffer.h
|
||||||
default_eventloop.lo default_eventloop.o: $(srcdir)/extension/default_eventloop.c \
|
default_eventloop.lo default_eventloop.o: $(srcdir)/extension/default_eventloop.c \
|
||||||
$(srcdir)/extension/default_eventloop.h config.h getdns/getdns.h \
|
$(srcdir)/extension/default_eventloop.h \
|
||||||
getdns/getdns_extra.h $(srcdir)/debug.h config.h
|
config.h \
|
||||||
libev.lo libev.o: $(srcdir)/extension/libev.c config.h $(srcdir)/types-internal.h getdns/getdns.h \
|
getdns/getdns.h \
|
||||||
getdns/getdns_extra.h getdns/getdns.h $(srcdir)/util/rbtree.h \
|
getdns/getdns_extra.h \
|
||||||
$(srcdir)/getdns/getdns_ext_libev.h getdns/getdns_extra.h
|
$(srcdir)/debug.h
|
||||||
libevent.lo libevent.o: $(srcdir)/extension/libevent.c config.h $(srcdir)/types-internal.h \
|
libev.lo libev.o: $(srcdir)/extension/libev.c \
|
||||||
getdns/getdns.h getdns/getdns_extra.h getdns/getdns.h $(srcdir)/util/rbtree.h \
|
config.h \
|
||||||
$(srcdir)/getdns/getdns_ext_libevent.h getdns/getdns_extra.h
|
$(srcdir)/types-internal.h \
|
||||||
libuv.lo libuv.o: $(srcdir)/extension/libuv.c config.h $(srcdir)/debug.h config.h $(srcdir)/types-internal.h \
|
getdns/getdns.h \
|
||||||
getdns/getdns.h getdns/getdns_extra.h getdns/getdns.h $(srcdir)/util/rbtree.h \
|
getdns/getdns_extra.h \
|
||||||
$(srcdir)/getdns/getdns_ext_libuv.h getdns/getdns_extra.h
|
$(srcdir)/util/rbtree.h $(srcdir)/getdns/getdns_ext_libev.h
|
||||||
|
libevent.lo libevent.o: $(srcdir)/extension/libevent.c \
|
||||||
|
config.h \
|
||||||
|
$(srcdir)/types-internal.h \
|
||||||
|
getdns/getdns.h \
|
||||||
|
getdns/getdns_extra.h \
|
||||||
|
$(srcdir)/util/rbtree.h $(srcdir)/getdns/getdns_ext_libevent.h
|
||||||
|
libuv.lo libuv.o: $(srcdir)/extension/libuv.c \
|
||||||
|
config.h $(srcdir)/debug.h \
|
||||||
|
$(srcdir)/types-internal.h \
|
||||||
|
getdns/getdns.h \
|
||||||
|
getdns/getdns_extra.h \
|
||||||
|
$(srcdir)/util/rbtree.h $(srcdir)/getdns/getdns_ext_libuv.h
|
||||||
|
|
272
src/context.c
272
src/context.c
|
@ -323,7 +323,8 @@ local_host_cmp(const void *id1, const void *id2)
|
||||||
return canonical_dname_compare(id1, id2);
|
return canonical_dname_compare(id1, id2);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
/** return 0 on success */
|
||||||
|
static int
|
||||||
add_local_host(getdns_context *context, getdns_dict *address, const char *str)
|
add_local_host(getdns_context *context, getdns_dict *address, const char *str)
|
||||||
{
|
{
|
||||||
uint8_t host_name[256];
|
uint8_t host_name[256];
|
||||||
|
@ -334,7 +335,7 @@ add_local_host(getdns_context *context, getdns_dict *address, const char *str)
|
||||||
getdns_list **addrs;
|
getdns_list **addrs;
|
||||||
|
|
||||||
if (gldns_str2wire_dname_buf(str, host_name, &host_name_len))
|
if (gldns_str2wire_dname_buf(str, host_name, &host_name_len))
|
||||||
return;
|
return -1;
|
||||||
|
|
||||||
canonicalize_dname(host_name);
|
canonicalize_dname(host_name);
|
||||||
|
|
||||||
|
@ -343,7 +344,7 @@ add_local_host(getdns_context *context, getdns_dict *address, const char *str)
|
||||||
|
|
||||||
if (!(hnas = (host_name_addrs *)GETDNS_XMALLOC(context->mf,
|
if (!(hnas = (host_name_addrs *)GETDNS_XMALLOC(context->mf,
|
||||||
uint8_t, sizeof(host_name_addrs) + host_name_len)))
|
uint8_t, sizeof(host_name_addrs) + host_name_len)))
|
||||||
return;
|
return -1;
|
||||||
|
|
||||||
hnas->ipv4addrs = NULL;
|
hnas->ipv4addrs = NULL;
|
||||||
hnas->ipv6addrs = NULL;
|
hnas->ipv6addrs = NULL;
|
||||||
|
@ -361,18 +362,23 @@ add_local_host(getdns_context *context, getdns_dict *address, const char *str)
|
||||||
: address_type->data[3] == '6'? &hnas->ipv4addrs : NULL)) {
|
: address_type->data[3] == '6'? &hnas->ipv4addrs : NULL)) {
|
||||||
|
|
||||||
if (!hnas_found) GETDNS_FREE(context->mf, hnas);
|
if (!hnas_found) GETDNS_FREE(context->mf, hnas);
|
||||||
return;
|
return -1;
|
||||||
}
|
}
|
||||||
if (!*addrs && !(*addrs = getdns_list_create_with_context(context))) {
|
if (!*addrs && !(*addrs = getdns_list_create_with_context(context))) {
|
||||||
if (!hnas_found) GETDNS_FREE(context->mf, hnas);
|
if (!hnas_found) GETDNS_FREE(context->mf, hnas);
|
||||||
return;
|
return -1;
|
||||||
}
|
}
|
||||||
if (_getdns_list_append_dict(*addrs, address) && !hnas_found) {
|
if (_getdns_list_append_this_dict(*addrs, address)) {
|
||||||
getdns_list_destroy(*addrs);
|
if (!hnas_found) {
|
||||||
GETDNS_FREE(context->mf, hnas);
|
getdns_list_destroy(*addrs);
|
||||||
|
GETDNS_FREE(context->mf, hnas);
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
|
||||||
} else if (!hnas_found)
|
} else if (!hnas_found)
|
||||||
(void)_getdns_rbtree_insert(&context->local_hosts, &hnas->node);
|
(void)_getdns_rbtree_insert(&context->local_hosts, &hnas->node);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static getdns_dict *
|
static getdns_dict *
|
||||||
|
@ -518,8 +524,8 @@ create_local_hosts(getdns_context *context)
|
||||||
str_addr_dict(context, start_of_word)))
|
str_addr_dict(context, start_of_word)))
|
||||||
/* Unparseable address */
|
/* Unparseable address */
|
||||||
break; /* skip to next line */
|
break; /* skip to next line */
|
||||||
} else
|
} else if (!add_local_host(context, address, start_of_word))
|
||||||
add_local_host(context, address, start_of_word);
|
address = NULL;
|
||||||
|
|
||||||
start_of_word = NULL;
|
start_of_word = NULL;
|
||||||
*pos = prev_c;
|
*pos = prev_c;
|
||||||
|
@ -543,7 +549,8 @@ read_more: ;
|
||||||
if (address) {
|
if (address) {
|
||||||
/* One last name for this address? */
|
/* One last name for this address? */
|
||||||
if (start_of_word && !start_of_line)
|
if (start_of_word && !start_of_line)
|
||||||
add_local_host(context, address, start_of_word);
|
if (!add_local_host(context, address, start_of_word))
|
||||||
|
address = NULL;
|
||||||
getdns_dict_destroy(address);
|
getdns_dict_destroy(address);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1442,36 +1449,45 @@ set_ub_number_opt(struct getdns_context *ctx, char *opt, uint16_t value)
|
||||||
static void
|
static void
|
||||||
getdns_context_request_count_changed(getdns_context *context)
|
getdns_context_request_count_changed(getdns_context *context)
|
||||||
{
|
{
|
||||||
DEBUG_SCHED("getdns_context_request_count_changed(%d)\n",
|
size_t prev_count;
|
||||||
(int) context->outbound_requests.count);
|
|
||||||
if (context->outbound_requests.count) {
|
|
||||||
if (context->ub_event.ev) return;
|
|
||||||
|
|
||||||
DEBUG_SCHED("gc_request_count_changed "
|
if (context->ub_event_scheduling) {
|
||||||
"-> ub schedule(el_ev = %p, el_ev->ev = %p)\n",
|
return;
|
||||||
&context->ub_event, context->ub_event.ev);
|
}
|
||||||
|
context->ub_event_scheduling++;
|
||||||
|
do {
|
||||||
|
prev_count = context->outbound_requests.count;
|
||||||
|
DEBUG_SCHED("getdns_context_request_count_changed(%d)\n",
|
||||||
|
(int) context->outbound_requests.count);
|
||||||
|
if (context->outbound_requests.count && ! context->ub_event.ev){
|
||||||
|
DEBUG_SCHED("gc_request_count_changed "
|
||||||
|
"-> ub schedule(el_ev = %p, el_ev->ev = %p)\n",
|
||||||
|
&context->ub_event, context->ub_event.ev);
|
||||||
#ifndef USE_WINSOCK
|
#ifndef USE_WINSOCK
|
||||||
#ifdef HAVE_UNBOUND_EVENT_API
|
#ifdef HAVE_UNBOUND_EVENT_API
|
||||||
if (!_getdns_ub_loop_enabled(&context->ub_loop))
|
if (!_getdns_ub_loop_enabled(&context->ub_loop))
|
||||||
#endif
|
#endif
|
||||||
context->extension->vmt->schedule(
|
context->extension->vmt->schedule(
|
||||||
context->extension, ub_fd(context->unbound_ctx),
|
context->extension,
|
||||||
TIMEOUT_FOREVER, &context->ub_event);
|
ub_fd(context->unbound_ctx),
|
||||||
|
TIMEOUT_FOREVER, &context->ub_event);
|
||||||
#endif
|
#endif
|
||||||
}
|
} else if (! context->outbound_requests.count &&
|
||||||
else if (context->ub_event.ev) /* Only test if count == 0! */ {
|
context->ub_event.ev) {
|
||||||
DEBUG_SCHED("gc_request_count_changed "
|
DEBUG_SCHED("gc_request_count_changed "
|
||||||
"-> ub clear(el_ev = %p, el_ev->ev = %p)\n",
|
"-> ub clear(el_ev = %p, el_ev->ev = %p)\n",
|
||||||
&context->ub_event, context->ub_event.ev);
|
&context->ub_event, context->ub_event.ev);
|
||||||
|
|
||||||
#ifndef USE_WINSOCK
|
#ifndef USE_WINSOCK
|
||||||
#ifdef HAVE_UNBOUND_EVENT_API
|
#ifdef HAVE_UNBOUND_EVENT_API
|
||||||
if (!_getdns_ub_loop_enabled(&context->ub_loop))
|
if (!_getdns_ub_loop_enabled(&context->ub_loop))
|
||||||
#endif
|
#endif
|
||||||
context->extension->vmt->clear(
|
context->extension->vmt->clear(
|
||||||
context->extension, &context->ub_event);
|
context->extension, &context->ub_event);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
} while (prev_count != context->outbound_requests.count);
|
||||||
|
context->ub_event_scheduling--;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1528,6 +1544,7 @@ rebuild_ub_ctx(struct getdns_context* context) {
|
||||||
context->ub_event.write_cb = NULL;
|
context->ub_event.write_cb = NULL;
|
||||||
context->ub_event.timeout_cb = NULL;
|
context->ub_event.timeout_cb = NULL;
|
||||||
context->ub_event.ev = NULL;
|
context->ub_event.ev = NULL;
|
||||||
|
context->ub_event_scheduling = 0;
|
||||||
|
|
||||||
return GETDNS_RETURN_GOOD;
|
return GETDNS_RETURN_GOOD;
|
||||||
}
|
}
|
||||||
|
@ -3156,87 +3173,122 @@ upstream_port(getdns_upstream *upstream)
|
||||||
static getdns_dict*
|
static getdns_dict*
|
||||||
_get_context_settings(getdns_context* context)
|
_get_context_settings(getdns_context* context)
|
||||||
{
|
{
|
||||||
getdns_return_t r = GETDNS_RETURN_GOOD;
|
getdns_dict *result = getdns_dict_create_with_context(context);
|
||||||
getdns_dict* result = getdns_dict_create_with_context(context);
|
|
||||||
getdns_list *list;
|
getdns_list *list;
|
||||||
|
size_t i;
|
||||||
|
|
||||||
if (!result) {
|
if (!result)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
|
||||||
/* int fields */
|
/* int fields */
|
||||||
r = getdns_dict_set_int(result, "timeout", context->timeout);
|
if ( getdns_dict_set_int(result, "timeout",
|
||||||
r = getdns_dict_set_int(result, "idle_timeout", context->idle_timeout);
|
context->timeout)
|
||||||
r |= getdns_dict_set_int(result, "limit_outstanding_queries", context->limit_outstanding_queries);
|
|| getdns_dict_set_int(result, "idle_timeout",
|
||||||
r |= getdns_dict_set_int(result, "dnssec_allowed_skew", context->dnssec_allowed_skew);
|
context->idle_timeout)
|
||||||
r |= getdns_dict_set_int(result, "follow_redirects", context->follow_redirects);
|
|| getdns_dict_set_int(result, "limit_outstanding_queries",
|
||||||
if (context->edns_maximum_udp_payload_size != -1)
|
context->limit_outstanding_queries)
|
||||||
r |= getdns_dict_set_int(result, "edns_maximum_udp_payload_size",
|
|| getdns_dict_set_int(result, "dnssec_allowed_skew",
|
||||||
context->edns_maximum_udp_payload_size);
|
context->dnssec_allowed_skew)
|
||||||
r |= getdns_dict_set_int(result, "edns_extended_rcode", context->edns_extended_rcode);
|
|| getdns_dict_set_int(result, "follow_redirects",
|
||||||
r |= getdns_dict_set_int(result, "edns_version", context->edns_version);
|
context->follow_redirects)
|
||||||
r |= getdns_dict_set_int(result, "edns_do_bit", context->edns_do_bit);
|
|| ( context->edns_maximum_udp_payload_size != -1
|
||||||
r |= getdns_dict_set_int(result, "append_name", context->append_name);
|
&& getdns_dict_set_int(result, "edns_maximum_udp_payload_size",
|
||||||
/* list fields */
|
context->edns_maximum_udp_payload_size))
|
||||||
if (!getdns_context_get_suffix(context, &list)) {
|
|| getdns_dict_set_int(result, "edns_extended_rcode",
|
||||||
r |= getdns_dict_set_list(result, "suffix", list);
|
context->edns_extended_rcode)
|
||||||
|
|| getdns_dict_set_int(result, "edns_version",
|
||||||
|
context->edns_version)
|
||||||
|
|| getdns_dict_set_int(result, "edns_do_bit",
|
||||||
|
context->edns_do_bit)
|
||||||
|
|| getdns_dict_set_int(result, "append_name",
|
||||||
|
context->append_name)
|
||||||
|
|| getdns_dict_set_int(result, "tls_authentication",
|
||||||
|
context->tls_auth))
|
||||||
|
goto error;
|
||||||
|
|
||||||
|
/* list fields */
|
||||||
|
if (getdns_context_get_suffix(context, &list))
|
||||||
|
goto error;
|
||||||
|
|
||||||
|
if (_getdns_dict_set_this_list(result, "suffix", list)) {
|
||||||
getdns_list_destroy(list);
|
getdns_list_destroy(list);
|
||||||
|
goto error;
|
||||||
}
|
}
|
||||||
if (!getdns_context_get_upstream_recursive_servers(context, &list)) {
|
if (getdns_context_get_upstream_recursive_servers(context, &list))
|
||||||
r |= getdns_dict_set_list(result, "upstream_recursive_servers",
|
goto error;
|
||||||
list);
|
|
||||||
|
if (_getdns_dict_set_this_list(
|
||||||
|
result, "upstream_recursive_servers", list)) {
|
||||||
getdns_list_destroy(list);
|
getdns_list_destroy(list);
|
||||||
|
goto error;
|
||||||
}
|
}
|
||||||
if (context->dns_transport_count > 0) {
|
if (context->dns_transport_count > 0) {
|
||||||
|
/* create a namespace list */
|
||||||
|
if (!(list = getdns_list_create_with_context(context)))
|
||||||
|
goto error;
|
||||||
|
|
||||||
|
for (i = 0; i < context->dns_transport_count; ++i) {
|
||||||
|
if (getdns_list_set_int(list, i,
|
||||||
|
context->dns_transports[i])) {
|
||||||
|
getdns_list_destroy(list);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (_getdns_dict_set_this_list(
|
||||||
|
result, "dns_transport_list", list)) {
|
||||||
|
getdns_list_destroy(list);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (context->namespace_count > 0) {
|
||||||
/* create a namespace list */
|
/* create a namespace list */
|
||||||
size_t i;
|
if (!(list = getdns_list_create_with_context(context)))
|
||||||
getdns_list* transports = getdns_list_create_with_context(context);
|
goto error;
|
||||||
if (transports) {
|
|
||||||
for (i = 0; i < context->dns_transport_count; ++i) {
|
for (i = 0; i < context->namespace_count; ++i) {
|
||||||
r |= getdns_list_set_int(transports, i, context->dns_transports[i]);
|
if (getdns_list_set_int(list, i,
|
||||||
}
|
context->namespaces[i])) {
|
||||||
r |= getdns_dict_set_list(result, "dns_transport_list", transports);
|
getdns_list_destroy(list);
|
||||||
getdns_list_destroy(transports);
|
goto error;
|
||||||
}
|
}
|
||||||
r |= getdns_dict_set_int(result, "tls_authentication", context->tls_auth);
|
}
|
||||||
}
|
if (_getdns_dict_set_this_list(result, "namespaces", list)) {
|
||||||
if (context->namespace_count > 0) {
|
getdns_list_destroy(list);
|
||||||
/* create a namespace list */
|
return NULL;
|
||||||
size_t i;
|
}
|
||||||
getdns_list* namespaces = getdns_list_create_with_context(context);
|
}
|
||||||
if (namespaces) {
|
return result;
|
||||||
for (i = 0; i < context->namespace_count; ++i) {
|
error:
|
||||||
r |= getdns_list_set_int(namespaces, i, context->namespaces[i]);
|
getdns_dict_destroy(result);
|
||||||
}
|
return NULL;
|
||||||
r |= getdns_dict_set_list(result, "namespaces", namespaces);
|
|
||||||
getdns_list_destroy(namespaces);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (r != GETDNS_RETURN_GOOD) {
|
|
||||||
getdns_dict_destroy(result);
|
|
||||||
result = NULL;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getdns_dict*
|
getdns_dict*
|
||||||
getdns_context_get_api_information(getdns_context* context) {
|
getdns_context_get_api_information(getdns_context* context)
|
||||||
getdns_return_t r = GETDNS_RETURN_GOOD;
|
{
|
||||||
getdns_dict* result = getdns_dict_create_with_context(context);
|
getdns_dict* result;
|
||||||
getdns_dict* settings;
|
getdns_dict* settings;
|
||||||
if (!result) {
|
|
||||||
return NULL;
|
if ((result = getdns_dict_create_with_context(context))
|
||||||
}
|
|
||||||
r = getdns_dict_util_set_string(result, "version_string", GETDNS_VERSION);
|
&& ! getdns_dict_util_set_string(
|
||||||
r |= getdns_dict_util_set_string(result, "implementation_string", PACKAGE_URL);
|
result, "version_string", GETDNS_VERSION)
|
||||||
r |= getdns_dict_set_int(result, "resolution_type", context->resolution_type);
|
|
||||||
settings = _get_context_settings(context);
|
&& ! getdns_dict_util_set_string(
|
||||||
r |= getdns_dict_set_dict(result, "all_context", settings);
|
result, "implementation_string", PACKAGE_URL)
|
||||||
getdns_dict_destroy(settings);
|
|
||||||
if (r != GETDNS_RETURN_GOOD) {
|
&& ! getdns_dict_set_int(
|
||||||
getdns_dict_destroy(result);
|
result, "resolution_type", context->resolution_type)
|
||||||
result = NULL;
|
|
||||||
}
|
&& (settings = _get_context_settings(context))) {
|
||||||
return result;
|
|
||||||
|
if (!_getdns_dict_set_this_dict(result,"all_context",settings))
|
||||||
|
return result;
|
||||||
|
|
||||||
|
getdns_dict_destroy(settings);
|
||||||
|
}
|
||||||
|
getdns_dict_destroy(result);
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
getdns_return_t
|
getdns_return_t
|
||||||
|
@ -3336,17 +3388,17 @@ _getdns_context_local_namespace_resolve(
|
||||||
}
|
}
|
||||||
if (!(jaa = getdns_list_create_with_context(context)))
|
if (!(jaa = getdns_list_create_with_context(context)))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
for (i = 0; !getdns_list_get_dict(hnas->ipv4addrs, i, &addr); i++)
|
for (i = 0; !getdns_list_get_dict(hnas->ipv4addrs, i, &addr); i++)
|
||||||
if (_getdns_list_append_dict(jaa, addr))
|
if (_getdns_list_append_dict(jaa, addr))
|
||||||
break;
|
break;
|
||||||
for (i = 0; !getdns_list_get_dict(hnas->ipv6addrs, i, &addr); i++)
|
for (i = 0; !getdns_list_get_dict(hnas->ipv6addrs, i, &addr); i++)
|
||||||
if (_getdns_list_append_dict(jaa, addr))
|
if (_getdns_list_append_dict(jaa, addr))
|
||||||
break;
|
break;
|
||||||
if (!getdns_dict_set_list(*response, "just_address_answers", jaa)) {
|
if (!_getdns_dict_set_this_list(*response, "just_address_answers", jaa))
|
||||||
getdns_list_destroy(jaa);
|
|
||||||
return GETDNS_RETURN_GOOD;
|
return GETDNS_RETURN_GOOD;
|
||||||
}
|
else
|
||||||
getdns_list_destroy(jaa);
|
getdns_list_destroy(jaa);
|
||||||
error:
|
error:
|
||||||
getdns_dict_destroy(*response);
|
getdns_dict_destroy(*response);
|
||||||
return GETDNS_RETURN_GENERIC_ERROR;
|
return GETDNS_RETURN_GENERIC_ERROR;
|
||||||
|
@ -3652,14 +3704,16 @@ getdns_context_get_upstream_recursive_servers(getdns_context *context,
|
||||||
if ((_getdns_get_pubkey_pinset_list(context,
|
if ((_getdns_get_pubkey_pinset_list(context,
|
||||||
upstream->tls_pubkey_pinset,
|
upstream->tls_pubkey_pinset,
|
||||||
&pins) == GETDNS_RETURN_GOOD) &&
|
&pins) == GETDNS_RETURN_GOOD) &&
|
||||||
(r = getdns_dict_set_list(d, "tls_pubkey_pinset", pins)))
|
(r = _getdns_dict_set_this_list(d, "tls_pubkey_pinset", pins))) {
|
||||||
|
getdns_list_destroy(pins);
|
||||||
break;
|
break;
|
||||||
getdns_list_destroy(pins);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!r)
|
if (!r)
|
||||||
r = _getdns_list_append_dict(upstreams, d);
|
if (!(r = _getdns_list_append_this_dict(upstreams, d)))
|
||||||
|
d = NULL;
|
||||||
getdns_dict_destroy(d);
|
getdns_dict_destroy(d);
|
||||||
}
|
}
|
||||||
if (r)
|
if (r)
|
||||||
|
|
|
@ -248,6 +248,8 @@ struct getdns_context {
|
||||||
|
|
||||||
#ifdef HAVE_LIBUNBOUND
|
#ifdef HAVE_LIBUNBOUND
|
||||||
getdns_eventloop_event ub_event;
|
getdns_eventloop_event ub_event;
|
||||||
|
/* lock to prevent nested ub_event scheduling */
|
||||||
|
int ub_event_scheduling;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* The default extension */
|
/* The default extension */
|
||||||
|
|
|
@ -567,8 +567,8 @@ _getdns_fp2rr_list(struct mem_funcs *mf,
|
||||||
continue;
|
continue;
|
||||||
if ((r = _getdns_wire2rr_dict(mf, rr, len, &rr_dict)))
|
if ((r = _getdns_wire2rr_dict(mf, rr, len, &rr_dict)))
|
||||||
break;
|
break;
|
||||||
r = _getdns_list_append_dict(rrs, rr_dict);
|
if ((r = _getdns_list_append_this_dict(rrs, rr_dict)))
|
||||||
getdns_dict_destroy(rr_dict);
|
getdns_dict_destroy(rr_dict);
|
||||||
}
|
}
|
||||||
if (rr)
|
if (rr)
|
||||||
GETDNS_FREE(*mf, rr);
|
GETDNS_FREE(*mf, rr);
|
||||||
|
@ -637,9 +637,8 @@ _getdns_wire2msg_dict_scan(struct mem_funcs *mf,
|
||||||
SET_WIRE_CNT(arcount, ARCOUNT);
|
SET_WIRE_CNT(arcount, ARCOUNT);
|
||||||
|
|
||||||
/* header */
|
/* header */
|
||||||
if ((r = getdns_dict_set_dict(result, "header", header)))
|
if ((r = _getdns_dict_set_this_dict(result, "header", header)))
|
||||||
goto error;
|
goto error;
|
||||||
getdns_dict_destroy(header);
|
|
||||||
header = NULL;
|
header = NULL;
|
||||||
eop = *wire + 12;
|
eop = *wire + 12;
|
||||||
|
|
||||||
|
@ -655,25 +654,32 @@ _getdns_wire2msg_dict_scan(struct mem_funcs *mf,
|
||||||
|
|
||||||
switch ((section = _getdns_rr_iter_section(rr_iter))) {
|
switch ((section = _getdns_rr_iter_section(rr_iter))) {
|
||||||
case GLDNS_SECTION_QUESTION:
|
case GLDNS_SECTION_QUESTION:
|
||||||
if ((r = getdns_dict_set_dict(
|
if ((r = _getdns_dict_set_this_dict(
|
||||||
result, "question", rr_dict)))
|
result, "question", rr_dict)))
|
||||||
goto error;
|
goto error;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if ((r = _getdns_list_append_dict(
|
if ((r = _getdns_list_append_this_dict(
|
||||||
sections[section], rr_dict)))
|
sections[section], rr_dict)))
|
||||||
goto error;
|
goto error;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
rr_dict = NULL;
|
rr_dict = NULL;
|
||||||
}
|
}
|
||||||
if ((r = getdns_dict_set_list(result, "answer",
|
if (!(r = _getdns_dict_set_this_list(result, "answer",
|
||||||
sections[GLDNS_SECTION_ANSWER])) ||
|
sections[GLDNS_SECTION_ANSWER])))
|
||||||
(r = getdns_dict_set_list(result, "authority",
|
sections[GLDNS_SECTION_ANSWER] = NULL;
|
||||||
sections[GLDNS_SECTION_AUTHORITY])) ||
|
else goto error;
|
||||||
(r = getdns_dict_set_list(result, "additional",
|
|
||||||
sections[GLDNS_SECTION_ADDITIONAL])))
|
if (!(r = _getdns_dict_set_this_list(result, "authority",
|
||||||
goto error;
|
sections[GLDNS_SECTION_AUTHORITY])))
|
||||||
|
sections[GLDNS_SECTION_AUTHORITY] = NULL;
|
||||||
|
else goto error;
|
||||||
|
|
||||||
|
if (!(r = _getdns_dict_set_this_list(result, "additional",
|
||||||
|
sections[GLDNS_SECTION_ADDITIONAL])))
|
||||||
|
sections[GLDNS_SECTION_ADDITIONAL] = NULL;
|
||||||
|
else goto error;
|
||||||
|
|
||||||
*wire_len -= (eop - *wire);
|
*wire_len -= (eop - *wire);
|
||||||
*wire = eop;
|
*wire = eop;
|
||||||
|
|
64
src/dict.c
64
src/dict.c
|
@ -530,51 +530,75 @@ getdns_dict_destroy(struct getdns_dict *dict)
|
||||||
|
|
||||||
/*---------------------------------------- getdns_dict_set_dict */
|
/*---------------------------------------- getdns_dict_set_dict */
|
||||||
getdns_return_t
|
getdns_return_t
|
||||||
getdns_dict_set_dict(
|
_getdns_dict_set_this_dict(
|
||||||
getdns_dict *dict, const char *name, const getdns_dict *child_dict)
|
getdns_dict *dict, const char *name, getdns_dict *child_dict)
|
||||||
{
|
{
|
||||||
getdns_item *item;
|
getdns_item *item;
|
||||||
getdns_dict *newdict;
|
|
||||||
getdns_return_t r;
|
getdns_return_t r;
|
||||||
|
|
||||||
if (!dict || !name || !child_dict)
|
if (!dict || !name || !child_dict)
|
||||||
return GETDNS_RETURN_INVALID_PARAMETER;
|
return GETDNS_RETURN_INVALID_PARAMETER;
|
||||||
|
|
||||||
if ((r = _getdns_dict_copy(child_dict, &newdict)))
|
if ((r = _getdns_dict_find_and_add(dict, name, &item)))
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
if ((r = _getdns_dict_find_and_add(dict, name, &item))) {
|
|
||||||
getdns_dict_destroy(newdict);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
item->dtype = t_dict;
|
item->dtype = t_dict;
|
||||||
item->data.dict = newdict;
|
item->data.dict = child_dict;
|
||||||
return GETDNS_RETURN_GOOD;
|
return GETDNS_RETURN_GOOD;
|
||||||
} /* getdns_dict_set_dict */
|
} /* getdns_dict_set_dict */
|
||||||
|
|
||||||
|
getdns_return_t
|
||||||
|
getdns_dict_set_dict(
|
||||||
|
getdns_dict *dict, const char *name, const getdns_dict *child_dict)
|
||||||
|
{
|
||||||
|
getdns_dict *newdict;
|
||||||
|
getdns_return_t r;
|
||||||
|
|
||||||
|
if ((r = _getdns_dict_copy(child_dict, &newdict)))
|
||||||
|
return r;
|
||||||
|
|
||||||
|
if ((r = _getdns_dict_set_this_dict(dict, name, newdict)))
|
||||||
|
getdns_dict_destroy(newdict);
|
||||||
|
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------- getdns_dict_set_list */
|
/*---------------------------------------- getdns_dict_set_list */
|
||||||
getdns_return_t
|
getdns_return_t
|
||||||
getdns_dict_set_list(
|
_getdns_dict_set_this_list(
|
||||||
getdns_dict *dict, const char *name, const getdns_list *child_list)
|
getdns_dict *dict, const char *name, getdns_list *child_list)
|
||||||
{
|
{
|
||||||
getdns_item *item;
|
getdns_item *item;
|
||||||
getdns_list *newlist;
|
|
||||||
getdns_return_t r;
|
getdns_return_t r;
|
||||||
|
|
||||||
if (!dict || !name || !child_list)
|
if (!dict || !name || !child_list)
|
||||||
return GETDNS_RETURN_INVALID_PARAMETER;
|
return GETDNS_RETURN_INVALID_PARAMETER;
|
||||||
|
|
||||||
|
if ((r = _getdns_dict_find_and_add(dict, name, &item)))
|
||||||
|
return r;
|
||||||
|
|
||||||
|
item->dtype = t_list;
|
||||||
|
item->data.list = child_list;
|
||||||
|
return GETDNS_RETURN_GOOD;
|
||||||
|
} /* getdns_dict_set_list */
|
||||||
|
|
||||||
|
getdns_return_t
|
||||||
|
getdns_dict_set_list(
|
||||||
|
getdns_dict *dict, const char *name, const getdns_list *child_list)
|
||||||
|
{
|
||||||
|
getdns_list *newlist;
|
||||||
|
getdns_return_t r;
|
||||||
|
|
||||||
if ((r = _getdns_list_copy(child_list, &newlist)))
|
if ((r = _getdns_list_copy(child_list, &newlist)))
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
if ((r = _getdns_dict_find_and_add(dict, name, &item))) {
|
if ((r = _getdns_dict_set_this_list(dict, name, newlist)))
|
||||||
getdns_list_destroy(newlist);
|
getdns_list_destroy(newlist);
|
||||||
return r;
|
|
||||||
}
|
return r;
|
||||||
item->dtype = t_list;
|
}
|
||||||
item->data.list = newlist;
|
|
||||||
return GETDNS_RETURN_GOOD;
|
|
||||||
} /* getdns_dict_set_list */
|
|
||||||
|
|
||||||
/*---------------------------------------- getdns_dict_set_bindata */
|
/*---------------------------------------- getdns_dict_set_bindata */
|
||||||
getdns_return_t
|
getdns_return_t
|
||||||
|
@ -598,7 +622,7 @@ _getdns_dict_set_const_bindata(
|
||||||
item->dtype = t_bindata;
|
item->dtype = t_bindata;
|
||||||
item->data.bindata = newbindata;
|
item->data.bindata = newbindata;
|
||||||
return GETDNS_RETURN_GOOD;
|
return GETDNS_RETURN_GOOD;
|
||||||
} /* getdns_dict_set_bindata */
|
}
|
||||||
|
|
||||||
getdns_return_t
|
getdns_return_t
|
||||||
getdns_dict_set_bindata(
|
getdns_dict_set_bindata(
|
||||||
|
|
18
src/dnssec.c
18
src/dnssec.c
|
@ -3079,8 +3079,8 @@ static void append_rrs2val_chain_list(getdns_context *ctxt,
|
||||||
&ctxt->mf, &rr->rr_i)))
|
&ctxt->mf, &rr->rr_i)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
(void)_getdns_list_append_dict(val_chain_list, rr_dict);
|
if (_getdns_list_append_this_dict(val_chain_list, rr_dict))
|
||||||
getdns_dict_destroy(rr_dict);
|
getdns_dict_destroy(rr_dict);
|
||||||
}
|
}
|
||||||
for ( rrsig = rrsig_iter_init(&rrsig_spc, rrset)
|
for ( rrsig = rrsig_iter_init(&rrsig_spc, rrset)
|
||||||
; rrsig; rrsig = rrsig_iter_next(rrsig)) {
|
; rrsig; rrsig = rrsig_iter_next(rrsig)) {
|
||||||
|
@ -3098,8 +3098,8 @@ static void append_rrs2val_chain_list(getdns_context *ctxt,
|
||||||
&ctxt->mf, &rrsig->rr_i)))
|
&ctxt->mf, &rrsig->rr_i)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
(void)_getdns_list_append_dict(val_chain_list, rr_dict);
|
if (_getdns_list_append_this_dict(val_chain_list, rr_dict))
|
||||||
getdns_dict_destroy(rr_dict);
|
getdns_dict_destroy(rr_dict);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3130,8 +3130,8 @@ static void append_empty_ds2val_chain_list(
|
||||||
(void) getdns_dict_set_bindata(rdata_dict, "rdata_raw", &bindata);
|
(void) getdns_dict_set_bindata(rdata_dict, "rdata_raw", &bindata);
|
||||||
getdns_dict_destroy(rdata_dict);
|
getdns_dict_destroy(rdata_dict);
|
||||||
|
|
||||||
(void)_getdns_list_append_dict(val_chain_list, rr_dict);
|
if (_getdns_list_append_this_dict(val_chain_list, rr_dict))
|
||||||
getdns_dict_destroy(rr_dict);
|
getdns_dict_destroy(rr_dict);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void check_chain_complete(chain_head *chain)
|
static void check_chain_complete(chain_head *chain)
|
||||||
|
@ -3239,9 +3239,9 @@ static void check_chain_complete(chain_head *chain)
|
||||||
|
|
||||||
response_dict = _getdns_create_getdns_response(dnsreq);
|
response_dict = _getdns_create_getdns_response(dnsreq);
|
||||||
if (val_chain_list) {
|
if (val_chain_list) {
|
||||||
(void) getdns_dict_set_list(
|
if (_getdns_dict_set_this_list(
|
||||||
response_dict, "validation_chain", val_chain_list);
|
response_dict, "validation_chain", val_chain_list))
|
||||||
getdns_list_destroy(val_chain_list);
|
getdns_list_destroy(val_chain_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Final user callback */
|
/* Final user callback */
|
||||||
|
|
|
@ -60,16 +60,23 @@ default_eventloop_schedule(getdns_eventloop *loop,
|
||||||
, fd, FD_SETSIZE);
|
, fd, FD_SETSIZE);
|
||||||
return GETDNS_RETURN_GENERIC_ERROR;
|
return GETDNS_RETURN_GENERIC_ERROR;
|
||||||
}
|
}
|
||||||
|
if (fd >= 0 && !(event->read_cb || event->write_cb)) {
|
||||||
|
DEBUG_SCHED("WARNING: fd event without "
|
||||||
|
"read or write cb!\n");
|
||||||
|
fd = -1;
|
||||||
|
}
|
||||||
if (fd >= 0) {
|
if (fd >= 0) {
|
||||||
if (!(event->read_cb || event->write_cb)) {
|
|
||||||
DEBUG_SCHED("ERROR: fd event without "
|
|
||||||
"read or write cb!\n");
|
|
||||||
return GETDNS_RETURN_GENERIC_ERROR;
|
|
||||||
}
|
|
||||||
#if defined(SCHED_DEBUG) && SCHED_DEBUG
|
#if defined(SCHED_DEBUG) && SCHED_DEBUG
|
||||||
if (default_loop->fd_events[fd]) {
|
if (default_loop->fd_events[fd]) {
|
||||||
DEBUG_SCHED( "ERROR: Event present at fd slot: %p!\n"
|
if (default_loop->fd_events[fd] == event) {
|
||||||
, default_loop->fd_events[fd]);
|
DEBUG_SCHED("WARNING: Event %p not cleared "
|
||||||
|
"before being rescheduled!\n"
|
||||||
|
, default_loop->fd_events[fd]);
|
||||||
|
} else {
|
||||||
|
DEBUG_SCHED("ERROR: A different event is "
|
||||||
|
"already present at fd slot: %p!\n"
|
||||||
|
, default_loop->fd_events[fd]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
default_loop->fd_events[fd] = event;
|
default_loop->fd_events[fd] = event;
|
||||||
|
|
49
src/list.c
49
src/list.c
|
@ -335,22 +335,23 @@ _getdns_list_copy(const struct getdns_list * srclist,
|
||||||
switch (srclist->items[i].dtype) {
|
switch (srclist->items[i].dtype) {
|
||||||
case t_int:
|
case t_int:
|
||||||
retval = _getdns_list_append_int(*dstlist,
|
retval = _getdns_list_append_int(*dstlist,
|
||||||
srclist->items[i].data.n);
|
srclist->items[i].data.n);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case t_list:
|
case t_list:
|
||||||
retval = _getdns_list_append_list(*dstlist,
|
retval = getdns_list_set_list(*dstlist,
|
||||||
srclist->items[i].data.list);
|
(*dstlist)->numinuse, srclist->items[i].data.list);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case t_bindata:
|
case t_bindata:
|
||||||
retval = _getdns_list_append_bindata(*dstlist,
|
retval = _getdns_list_append_const_bindata(*dstlist,
|
||||||
srclist->items[i].data.bindata);
|
srclist->items[i].data.bindata->size,
|
||||||
|
srclist->items[i].data.bindata->data);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case t_dict:
|
case t_dict:
|
||||||
retval = _getdns_list_append_dict(*dstlist,
|
retval = _getdns_list_append_dict(*dstlist,
|
||||||
srclist->items[i].data.dict);
|
srclist->items[i].data.dict);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (retval != GETDNS_RETURN_GOOD) {
|
if (retval != GETDNS_RETURN_GOOD) {
|
||||||
|
@ -506,6 +507,23 @@ _getdns_list_request_index(getdns_list *list, size_t index)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*---------------------------------------- getdns_list_set_dict */
|
/*---------------------------------------- getdns_list_set_dict */
|
||||||
|
static getdns_return_t
|
||||||
|
_getdns_list_set_this_dict(
|
||||||
|
getdns_list *list, size_t index, getdns_dict *child_dict)
|
||||||
|
{
|
||||||
|
getdns_return_t r;
|
||||||
|
|
||||||
|
if (!list || !child_dict)
|
||||||
|
return GETDNS_RETURN_INVALID_PARAMETER;
|
||||||
|
|
||||||
|
if ((r = _getdns_list_request_index(list, index)))
|
||||||
|
return r;
|
||||||
|
|
||||||
|
list->items[index].dtype = t_dict;
|
||||||
|
list->items[index].data.dict = child_dict;
|
||||||
|
return GETDNS_RETURN_GOOD;
|
||||||
|
} /* getdns_list_set_dict */
|
||||||
|
|
||||||
getdns_return_t
|
getdns_return_t
|
||||||
getdns_list_set_dict(
|
getdns_list_set_dict(
|
||||||
getdns_list *list, size_t index, const getdns_dict *child_dict)
|
getdns_list *list, size_t index, const getdns_dict *child_dict)
|
||||||
|
@ -519,13 +537,10 @@ getdns_list_set_dict(
|
||||||
if ((r = _getdns_dict_copy(child_dict, &newdict)))
|
if ((r = _getdns_dict_copy(child_dict, &newdict)))
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
if ((r = _getdns_list_request_index(list, index))) {
|
if ((r = _getdns_list_set_this_dict(list, index, newdict)))
|
||||||
getdns_dict_destroy(newdict);
|
getdns_dict_destroy(newdict);
|
||||||
return r;
|
|
||||||
}
|
return r;
|
||||||
list->items[index].dtype = t_dict;
|
|
||||||
list->items[index].data.dict = newdict;
|
|
||||||
return GETDNS_RETURN_GOOD;
|
|
||||||
} /* getdns_list_set_dict */
|
} /* getdns_list_set_dict */
|
||||||
|
|
||||||
/*---------------------------------------- getdns_list_set_list */
|
/*---------------------------------------- getdns_list_set_list */
|
||||||
|
@ -616,16 +631,10 @@ _getdns_list_append_dict(getdns_list *list, const getdns_dict *child_dict)
|
||||||
return getdns_list_set_dict(list, list->numinuse, child_dict);
|
return getdns_list_set_dict(list, list->numinuse, child_dict);
|
||||||
}
|
}
|
||||||
getdns_return_t
|
getdns_return_t
|
||||||
_getdns_list_append_list(getdns_list *list, const getdns_list *child_list)
|
_getdns_list_append_this_dict(getdns_list *list, getdns_dict *child_dict)
|
||||||
{
|
{
|
||||||
if (!list) return GETDNS_RETURN_INVALID_PARAMETER;
|
if (!list) return GETDNS_RETURN_INVALID_PARAMETER;
|
||||||
return getdns_list_set_list(list, list->numinuse, child_list);
|
return _getdns_list_set_this_dict(list, list->numinuse, child_dict);
|
||||||
}
|
|
||||||
getdns_return_t
|
|
||||||
_getdns_list_append_bindata(getdns_list *list, const getdns_bindata *child_bindata)
|
|
||||||
{
|
|
||||||
if (!list) return GETDNS_RETURN_INVALID_PARAMETER;
|
|
||||||
return getdns_list_set_bindata(list, list->numinuse, child_bindata);
|
|
||||||
}
|
}
|
||||||
getdns_return_t
|
getdns_return_t
|
||||||
_getdns_list_append_const_bindata(
|
_getdns_list_append_const_bindata(
|
||||||
|
|
|
@ -54,6 +54,7 @@
|
||||||
#include <openssl/x509.h>
|
#include <openssl/x509.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "context.h"
|
#include "context.h"
|
||||||
|
#include "util-internal.h"
|
||||||
|
|
||||||
/* we only support sha256 at the moment. adding support for another
|
/* we only support sha256 at the moment. adding support for another
|
||||||
digest is more complex than just adding another entry here. in
|
digest is more complex than just adding another entry here. in
|
||||||
|
@ -156,11 +157,9 @@ getdns_dict* getdns_pubkey_pin_create_from_string(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PKP_SC_ERR(e) { \
|
#define PKP_SC_ERR(e) { \
|
||||||
err.size = sizeof(e); \
|
|
||||||
err.data = (uint8_t*)e; \
|
|
||||||
if (errorlist) \
|
if (errorlist) \
|
||||||
getdns_list_set_bindata(errorlist, \
|
_getdns_list_append_const_bindata(errorlist, \
|
||||||
preverrs + errorcount, &err); \
|
sizeof(e), e); \
|
||||||
errorcount++; \
|
errorcount++; \
|
||||||
}
|
}
|
||||||
#define PKP_SC_HARDERR(e, val) { \
|
#define PKP_SC_HARDERR(e, val) { \
|
||||||
|
@ -170,15 +169,10 @@ getdns_return_t getdns_pubkey_pinset_sanity_check(
|
||||||
const getdns_list* pinset,
|
const getdns_list* pinset,
|
||||||
getdns_list* errorlist)
|
getdns_list* errorlist)
|
||||||
{
|
{
|
||||||
size_t errorcount = 0, preverrs = 0, pins = 0, i;
|
size_t errorcount = 0, pins = 0, i;
|
||||||
getdns_bindata err;
|
|
||||||
getdns_dict * pin;
|
getdns_dict * pin;
|
||||||
getdns_bindata * data;
|
getdns_bindata * data;
|
||||||
|
|
||||||
if (errorlist)
|
|
||||||
if (getdns_list_get_length(errorlist, &preverrs))
|
|
||||||
return GETDNS_RETURN_INVALID_PARAMETER;
|
|
||||||
|
|
||||||
if (getdns_list_get_length(pinset, &pins))
|
if (getdns_list_get_length(pinset, &pins))
|
||||||
PKP_SC_HARDERR("Can't get length of pinset",
|
PKP_SC_HARDERR("Can't get length of pinset",
|
||||||
GETDNS_RETURN_INVALID_PARAMETER);
|
GETDNS_RETURN_INVALID_PARAMETER);
|
||||||
|
@ -281,7 +275,6 @@ _getdns_get_pubkey_pinset_list(getdns_context *ctx,
|
||||||
uint8_t buf[SHA256_DIGEST_LENGTH];
|
uint8_t buf[SHA256_DIGEST_LENGTH];
|
||||||
getdns_bindata value = { .size = SHA256_DIGEST_LENGTH, .data = buf };
|
getdns_bindata value = { .size = SHA256_DIGEST_LENGTH, .data = buf };
|
||||||
getdns_dict *pin = NULL;
|
getdns_dict *pin = NULL;
|
||||||
size_t idx = 0;
|
|
||||||
|
|
||||||
if (out == NULL)
|
if (out == NULL)
|
||||||
return GETDNS_RETURN_MEMORY_ERROR;
|
return GETDNS_RETURN_MEMORY_ERROR;
|
||||||
|
@ -296,9 +289,8 @@ _getdns_get_pubkey_pinset_list(getdns_context *ctx,
|
||||||
memcpy(buf, pinset_in->pin, sizeof(buf));
|
memcpy(buf, pinset_in->pin, sizeof(buf));
|
||||||
if (r = getdns_dict_set_bindata(pin, "value", &value), r)
|
if (r = getdns_dict_set_bindata(pin, "value", &value), r)
|
||||||
goto fail;
|
goto fail;
|
||||||
if (r = getdns_list_set_dict(out, idx++, pin), r)
|
if (r = _getdns_list_append_this_dict(out, pin), r)
|
||||||
goto fail;
|
goto fail;
|
||||||
getdns_dict_destroy(pin);
|
|
||||||
pin = NULL;
|
pin = NULL;
|
||||||
pinset_in = pinset_in->next;
|
pinset_in = pinset_in->next;
|
||||||
}
|
}
|
||||||
|
|
|
@ -845,6 +845,7 @@ _getdns_dns_req_new(getdns_context *context, getdns_eventloop *loop,
|
||||||
}
|
}
|
||||||
} else if (result->append_name ==
|
} else if (result->append_name ==
|
||||||
GETDNS_APPEND_NAME_ONLY_TO_SINGLE_LABEL_AFTER_FAILURE &&
|
GETDNS_APPEND_NAME_ONLY_TO_SINGLE_LABEL_AFTER_FAILURE &&
|
||||||
|
result->name[0] &&
|
||||||
result->name[result->name[0]+1] != 0) {
|
result->name[result->name[0]+1] != 0) {
|
||||||
/* We have multiple labels, no appending */
|
/* We have multiple labels, no appending */
|
||||||
result->suffix_len = no_suffixes[0];
|
result->suffix_len = no_suffixes[0];
|
||||||
|
|
|
@ -1823,7 +1823,7 @@ upstream_reschedule_events(getdns_upstream *upstream, size_t idle_timeout) {
|
||||||
upstream->event.timeout_cb = upstream_idle_timeout_cb;
|
upstream->event.timeout_cb = upstream_idle_timeout_cb;
|
||||||
if (upstream->tcp.write_error != 0)
|
if (upstream->tcp.write_error != 0)
|
||||||
idle_timeout = 0;
|
idle_timeout = 0;
|
||||||
GETDNS_SCHEDULE_EVENT(upstream->loop, upstream->fd,
|
GETDNS_SCHEDULE_EVENT(upstream->loop, -1,
|
||||||
idle_timeout, &upstream->event);
|
idle_timeout, &upstream->event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1985,7 +1985,10 @@ _getdns_submit_stub_request(getdns_network_req *netreq)
|
||||||
* to begin with) worth the complexity of divergent code paths?
|
* to begin with) worth the complexity of divergent code paths?
|
||||||
*/
|
*/
|
||||||
GETDNS_SCHEDULE_EVENT(
|
GETDNS_SCHEDULE_EVENT(
|
||||||
dnsreq->loop, netreq->upstream->fd, /*dnsreq->context->timeout,*/
|
dnsreq->loop,
|
||||||
|
( dnsreq->loop != netreq->upstream->loop /* Synchronous lookup? */
|
||||||
|
? netreq->upstream->fd : -1),
|
||||||
|
/*dnsreq->context->timeout,*/
|
||||||
(transport == GETDNS_TRANSPORT_TLS ?
|
(transport == GETDNS_TRANSPORT_TLS ?
|
||||||
dnsreq->context->timeout /2 : dnsreq->context->timeout),
|
dnsreq->context->timeout /2 : dnsreq->context->timeout),
|
||||||
getdns_eventloop_event_init(&netreq->event, netreq, NULL,
|
getdns_eventloop_event_init(&netreq->event, netreq, NULL,
|
||||||
|
|
|
@ -57,9 +57,7 @@ typedef struct getdns_sync_data {
|
||||||
static getdns_return_t
|
static getdns_return_t
|
||||||
getdns_sync_data_init(getdns_context *context, getdns_sync_data *data)
|
getdns_sync_data_init(getdns_context *context, getdns_sync_data *data)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_LIBUNBOUND
|
|
||||||
getdns_eventloop *ext = &context->sync_eventloop.loop;
|
getdns_eventloop *ext = &context->sync_eventloop.loop;
|
||||||
#endif
|
|
||||||
|
|
||||||
data->context = context;
|
data->context = context;
|
||||||
data->to_run = 1;
|
data->to_run = 1;
|
||||||
|
@ -145,6 +143,7 @@ getdns_general_sync(getdns_context *context, const char *name,
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
getdns_sync_loop_run(&data);
|
getdns_sync_loop_run(&data);
|
||||||
|
getdns_sync_data_cleanup(&data);
|
||||||
|
|
||||||
return (*response = data.response) ?
|
return (*response = data.response) ?
|
||||||
GETDNS_RETURN_GOOD : GETDNS_RETURN_GENERIC_ERROR;
|
GETDNS_RETURN_GOOD : GETDNS_RETURN_GENERIC_ERROR;
|
||||||
|
@ -170,6 +169,7 @@ getdns_address_sync(getdns_context *context, const char *name,
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
getdns_sync_loop_run(&data);
|
getdns_sync_loop_run(&data);
|
||||||
|
getdns_sync_data_cleanup(&data);
|
||||||
|
|
||||||
return (*response = data.response) ?
|
return (*response = data.response) ?
|
||||||
GETDNS_RETURN_GOOD : GETDNS_RETURN_GENERIC_ERROR;
|
GETDNS_RETURN_GOOD : GETDNS_RETURN_GENERIC_ERROR;
|
||||||
|
@ -195,6 +195,7 @@ getdns_hostname_sync(getdns_context *context, getdns_dict *address,
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
getdns_sync_loop_run(&data);
|
getdns_sync_loop_run(&data);
|
||||||
|
getdns_sync_data_cleanup(&data);
|
||||||
|
|
||||||
return (*response = data.response) ?
|
return (*response = data.response) ?
|
||||||
GETDNS_RETURN_GOOD : GETDNS_RETURN_GENERIC_ERROR;
|
GETDNS_RETURN_GOOD : GETDNS_RETURN_GENERIC_ERROR;
|
||||||
|
@ -220,6 +221,7 @@ getdns_service_sync(getdns_context *context, const char *name,
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
getdns_sync_loop_run(&data);
|
getdns_sync_loop_run(&data);
|
||||||
|
getdns_sync_data_cleanup(&data);
|
||||||
|
|
||||||
return (*response = data.response) ?
|
return (*response = data.response) ?
|
||||||
GETDNS_RETURN_GOOD : GETDNS_RETURN_GENERIC_ERROR;
|
GETDNS_RETURN_GOOD : GETDNS_RETURN_GENERIC_ERROR;
|
||||||
|
|
|
@ -153,10 +153,12 @@ nolibcheck:
|
||||||
|
|
||||||
test: $(NOLIBCHECK) all
|
test: $(NOLIBCHECK) all
|
||||||
(cd $(srcdir)/../.. && find . -type f -executable -and \( -name "*.[ch]" -or -name "*.html" -or -name "*.in" -or -name "*.good" -or -name "*.ac" \) | awk 'BEGIN{e=0}{print("ERROR! Executable bit found on", $$0);e=1}END{exit(e)}')
|
(cd $(srcdir)/../.. && find . -type f -executable -and \( -name "*.[ch]" -or -name "*.html" -or -name "*.in" -or -name "*.good" -or -name "*.ac" \) | awk 'BEGIN{e=0}{print("ERROR! Executable bit found on", $$0);e=1}END{exit(e)}')
|
||||||
./$(CHECK_GETDNS)
|
rm -f fails
|
||||||
if test $(have_libevent) = 1 ; then ./$(CHECK_EVENT_PROG) ; fi
|
CK_LOG_FILE_NAME="$(CHECK_GETDNS).log" ./$(CHECK_GETDNS) || echo "$(CHECK_GETDNS) failed" >> fails
|
||||||
if test $(have_libev) = 1 ; then ./$(CHECK_EV_PROG) ; fi
|
if test $(have_libevent) = 1 ; then CK_LOG_FILE_NAME="$(CHECK_EVENT_PROG).log" ./$(CHECK_EVENT_PROG) || echo "$(CHECK_EVENT_PROG) failed" >> fails; fi
|
||||||
if test $(have_libuv) = 1 ; then ./$(CHECK_UV_PROG) ; fi
|
if test $(have_libev) = 1 ; then CK_LOG_FILE_NAME="$(CHECK_EV_PROG).log" ./$(CHECK_EV_PROG) || echo "$(CHECK_EV_PROG) failed" >> fails; fi
|
||||||
|
if test $(have_libuv) = 1 ; then CK_LOG_FILE_NAME="$(CHECK_UV_PROG).log" ./$(CHECK_UV_PROG) || echo "$(CHECK_UV_PROG) failed" >> fails; fi
|
||||||
|
test ! -e fails
|
||||||
@echo "All tests OK"
|
@echo "All tests OK"
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
@ -219,21 +221,24 @@ depend:
|
||||||
.PHONY: clean test
|
.PHONY: clean test
|
||||||
|
|
||||||
# Dependencies for the unit tests
|
# Dependencies for the unit tests
|
||||||
check_getdns.lo check_getdns.o: $(srcdir)/check_getdns.c ../getdns/getdns.h $(srcdir)/check_getdns_common.h \
|
check_getdns.lo check_getdns.o: $(srcdir)/check_getdns.c \
|
||||||
../getdns/getdns_extra.h $(srcdir)/check_getdns_general.h \
|
../getdns/getdns.h \
|
||||||
$(srcdir)/check_getdns_general_sync.h $(srcdir)/check_getdns_address.h \
|
$(srcdir)/check_getdns_common.h \
|
||||||
$(srcdir)/check_getdns_address_sync.h $(srcdir)/check_getdns_hostname.h \
|
../getdns/getdns_extra.h \
|
||||||
$(srcdir)/check_getdns_hostname_sync.h $(srcdir)/check_getdns_context_create.h \
|
$(srcdir)/check_getdns_general.h $(srcdir)/check_getdns_general_sync.h \
|
||||||
$(srcdir)/check_getdns_context_destroy.h $(srcdir)/check_getdns_cancel_callback.h \
|
$(srcdir)/check_getdns_address.h $(srcdir)/check_getdns_address_sync.h \
|
||||||
$(srcdir)/check_getdns_list_get_length.h $(srcdir)/check_getdns_list_get_data_type.h \
|
$(srcdir)/check_getdns_hostname.h $(srcdir)/check_getdns_hostname_sync.h \
|
||||||
$(srcdir)/check_getdns_list_get_dict.h $(srcdir)/check_getdns_list_get_list.h \
|
$(srcdir)/check_getdns_context_create.h $(srcdir)/check_getdns_context_destroy.h \
|
||||||
$(srcdir)/check_getdns_list_get_int.h $(srcdir)/check_getdns_list_get_bindata.h \
|
$(srcdir)/check_getdns_cancel_callback.h $(srcdir)/check_getdns_list_get_length.h \
|
||||||
$(srcdir)/check_getdns_dict_get_names.h $(srcdir)/check_getdns_dict_get_data_type.h \
|
$(srcdir)/check_getdns_list_get_data_type.h $(srcdir)/check_getdns_list_get_dict.h \
|
||||||
$(srcdir)/check_getdns_dict_get_dict.h $(srcdir)/check_getdns_dict_get_list.h \
|
$(srcdir)/check_getdns_list_get_list.h $(srcdir)/check_getdns_list_get_int.h \
|
||||||
$(srcdir)/check_getdns_dict_get_bindata.h $(srcdir)/check_getdns_dict_get_int.h \
|
$(srcdir)/check_getdns_list_get_bindata.h $(srcdir)/check_getdns_dict_get_names.h \
|
||||||
$(srcdir)/check_getdns_dict_destroy.h $(srcdir)/check_getdns_dict_set_dict.h \
|
$(srcdir)/check_getdns_dict_get_data_type.h $(srcdir)/check_getdns_dict_get_dict.h \
|
||||||
$(srcdir)/check_getdns_dict_set_list.h $(srcdir)/check_getdns_dict_set_bindata.h \
|
$(srcdir)/check_getdns_dict_get_list.h $(srcdir)/check_getdns_dict_get_bindata.h \
|
||||||
$(srcdir)/check_getdns_dict_set_int.h $(srcdir)/check_getdns_convert_ulabel_to_alabel.h \
|
$(srcdir)/check_getdns_dict_get_int.h $(srcdir)/check_getdns_dict_destroy.h \
|
||||||
|
$(srcdir)/check_getdns_dict_set_dict.h $(srcdir)/check_getdns_dict_set_list.h \
|
||||||
|
$(srcdir)/check_getdns_dict_set_bindata.h $(srcdir)/check_getdns_dict_set_int.h \
|
||||||
|
$(srcdir)/check_getdns_convert_ulabel_to_alabel.h \
|
||||||
$(srcdir)/check_getdns_convert_alabel_to_ulabel.h $(srcdir)/check_getdns_pretty_print_dict.h \
|
$(srcdir)/check_getdns_convert_alabel_to_ulabel.h $(srcdir)/check_getdns_pretty_print_dict.h \
|
||||||
$(srcdir)/check_getdns_display_ip_address.h \
|
$(srcdir)/check_getdns_display_ip_address.h \
|
||||||
$(srcdir)/check_getdns_context_set_context_update_callback.h \
|
$(srcdir)/check_getdns_context_set_context_update_callback.h \
|
||||||
|
@ -241,36 +246,63 @@ check_getdns.lo check_getdns.o: $(srcdir)/check_getdns.c ../getdns/getdns.h $(sr
|
||||||
$(srcdir)/check_getdns_context_set_upstream_recursive_servers.h \
|
$(srcdir)/check_getdns_context_set_upstream_recursive_servers.h \
|
||||||
$(srcdir)/check_getdns_service.h $(srcdir)/check_getdns_service_sync.h \
|
$(srcdir)/check_getdns_service.h $(srcdir)/check_getdns_service_sync.h \
|
||||||
$(srcdir)/check_getdns_transport.h
|
$(srcdir)/check_getdns_transport.h
|
||||||
check_getdns_common.lo check_getdns_common.o: $(srcdir)/check_getdns_common.c ../getdns/getdns.h \
|
check_getdns_common.lo check_getdns_common.o: $(srcdir)/check_getdns_common.c \
|
||||||
../config.h $(srcdir)/check_getdns_common.h ../getdns/getdns_extra.h \
|
../getdns/getdns.h \
|
||||||
|
../config.h \
|
||||||
|
$(srcdir)/check_getdns_common.h \
|
||||||
|
../getdns/getdns_extra.h \
|
||||||
$(srcdir)/check_getdns_eventloop.h
|
$(srcdir)/check_getdns_eventloop.h
|
||||||
check_getdns_context_set_timeout.lo check_getdns_context_set_timeout.o: $(srcdir)/check_getdns_context_set_timeout.c \
|
check_getdns_context_set_timeout.lo check_getdns_context_set_timeout.o: $(srcdir)/check_getdns_context_set_timeout.c \
|
||||||
$(srcdir)/check_getdns_context_set_timeout.h $(srcdir)/check_getdns_common.h \
|
$(srcdir)/check_getdns_context_set_timeout.h $(srcdir)/check_getdns_common.h \
|
||||||
../getdns/getdns.h ../getdns/getdns_extra.h
|
../getdns/getdns.h \
|
||||||
|
../getdns/getdns_extra.h
|
||||||
check_getdns_libev.lo check_getdns_libev.o: $(srcdir)/check_getdns_libev.c $(srcdir)/check_getdns_eventloop.h \
|
check_getdns_libev.lo check_getdns_libev.o: $(srcdir)/check_getdns_libev.c $(srcdir)/check_getdns_eventloop.h \
|
||||||
../config.h ../getdns/getdns.h $(srcdir)/../getdns/getdns_ext_libev.h \
|
../config.h \
|
||||||
../getdns/getdns_extra.h $(srcdir)/check_getdns_common.h
|
../getdns/getdns.h \
|
||||||
|
$(srcdir)/../getdns/getdns_ext_libev.h \
|
||||||
|
../getdns/getdns_extra.h \
|
||||||
|
$(srcdir)/check_getdns_common.h
|
||||||
check_getdns_libevent.lo check_getdns_libevent.o: $(srcdir)/check_getdns_libevent.c $(srcdir)/check_getdns_eventloop.h \
|
check_getdns_libevent.lo check_getdns_libevent.o: $(srcdir)/check_getdns_libevent.c $(srcdir)/check_getdns_eventloop.h \
|
||||||
../config.h ../getdns/getdns.h $(srcdir)/../getdns/getdns_ext_libevent.h \
|
../config.h \
|
||||||
../getdns/getdns_extra.h $(srcdir)/check_getdns_libevent.h $(srcdir)/check_getdns_common.h
|
../getdns/getdns.h \
|
||||||
|
$(srcdir)/../getdns/getdns_ext_libevent.h \
|
||||||
|
../getdns/getdns_extra.h \
|
||||||
|
$(srcdir)/check_getdns_libevent.h $(srcdir)/check_getdns_common.h
|
||||||
check_getdns_libuv.lo check_getdns_libuv.o: $(srcdir)/check_getdns_libuv.c $(srcdir)/check_getdns_eventloop.h \
|
check_getdns_libuv.lo check_getdns_libuv.o: $(srcdir)/check_getdns_libuv.c $(srcdir)/check_getdns_eventloop.h \
|
||||||
../config.h ../getdns/getdns.h $(srcdir)/../getdns/getdns_ext_libuv.h \
|
../config.h \
|
||||||
../getdns/getdns_extra.h $(srcdir)/check_getdns_common.h
|
../getdns/getdns.h \
|
||||||
|
$(srcdir)/../getdns/getdns_ext_libuv.h \
|
||||||
|
../getdns/getdns_extra.h \
|
||||||
|
$(srcdir)/check_getdns_common.h
|
||||||
check_getdns_selectloop.lo check_getdns_selectloop.o: $(srcdir)/check_getdns_selectloop.c \
|
check_getdns_selectloop.lo check_getdns_selectloop.o: $(srcdir)/check_getdns_selectloop.c \
|
||||||
$(srcdir)/check_getdns_eventloop.h ../config.h ../getdns/getdns.h \
|
$(srcdir)/check_getdns_eventloop.h \
|
||||||
|
../config.h \
|
||||||
|
../getdns/getdns.h \
|
||||||
../getdns/getdns_extra.h
|
../getdns/getdns_extra.h
|
||||||
check_getdns_transport.lo check_getdns_transport.o: $(srcdir)/check_getdns_transport.c \
|
check_getdns_transport.lo check_getdns_transport.o: $(srcdir)/check_getdns_transport.c \
|
||||||
$(srcdir)/check_getdns_transport.h $(srcdir)/check_getdns_common.h ../getdns/getdns.h \
|
$(srcdir)/check_getdns_transport.h $(srcdir)/check_getdns_common.h \
|
||||||
|
../getdns/getdns.h \
|
||||||
../getdns/getdns_extra.h
|
../getdns/getdns_extra.h
|
||||||
getdns_query.lo getdns_query.o: $(srcdir)/getdns_query.c ../config.h $(srcdir)/../debug.h ../config.h \
|
getdns_query.lo getdns_query.o: $(srcdir)/getdns_query.c \
|
||||||
../getdns/getdns.h ../getdns/getdns_extra.h
|
../config.h \
|
||||||
scratchpad.template.lo scratchpad.template.o: scratchpad.template.c ../getdns/getdns.h \
|
$(srcdir)/../debug.h \
|
||||||
|
../getdns/getdns.h \
|
||||||
|
../getdns/getdns_extra.h
|
||||||
|
scratchpad.template.lo scratchpad.template.o: scratchpad.template.c \
|
||||||
|
../getdns/getdns.h \
|
||||||
../getdns/getdns_extra.h
|
../getdns/getdns_extra.h
|
||||||
testmessages.lo testmessages.o: $(srcdir)/testmessages.c $(srcdir)/testmessages.h
|
testmessages.lo testmessages.o: $(srcdir)/testmessages.c $(srcdir)/testmessages.h
|
||||||
tests_dict.lo tests_dict.o: $(srcdir)/tests_dict.c $(srcdir)/testmessages.h ../getdns/getdns.h
|
tests_dict.lo tests_dict.o: $(srcdir)/tests_dict.c $(srcdir)/testmessages.h \
|
||||||
tests_list.lo tests_list.o: $(srcdir)/tests_list.c $(srcdir)/testmessages.h ../getdns/getdns.h
|
../getdns/getdns.h
|
||||||
tests_namespaces.lo tests_namespaces.o: $(srcdir)/tests_namespaces.c $(srcdir)/testmessages.h ../getdns/getdns.h
|
tests_list.lo tests_list.o: $(srcdir)/tests_list.c $(srcdir)/testmessages.h \
|
||||||
tests_stub_async.lo tests_stub_async.o: $(srcdir)/tests_stub_async.c ../config.h $(srcdir)/testmessages.h \
|
../getdns/getdns.h
|
||||||
../getdns/getdns.h ../getdns/getdns_extra.h
|
tests_namespaces.lo tests_namespaces.o: $(srcdir)/tests_namespaces.c $(srcdir)/testmessages.h \
|
||||||
tests_stub_sync.lo tests_stub_sync.o: $(srcdir)/tests_stub_sync.c $(srcdir)/testmessages.h ../getdns/getdns.h \
|
../getdns/getdns.h
|
||||||
|
tests_stub_async.lo tests_stub_async.o: $(srcdir)/tests_stub_async.c \
|
||||||
|
../config.h \
|
||||||
|
$(srcdir)/testmessages.h \
|
||||||
|
../getdns/getdns.h \
|
||||||
|
../getdns/getdns_extra.h
|
||||||
|
tests_stub_sync.lo tests_stub_sync.o: $(srcdir)/tests_stub_sync.c $(srcdir)/testmessages.h \
|
||||||
|
../getdns/getdns.h \
|
||||||
../getdns/getdns_extra.h
|
../getdns/getdns_extra.h
|
||||||
|
|
|
@ -20,3 +20,10 @@ A typical flow might be illustrated via tests_list:
|
||||||
|
|
||||||
Some of the tests that remain to be implemented:
|
Some of the tests that remain to be implemented:
|
||||||
- memory leak testing integrated into the test progs
|
- memory leak testing integrated into the test progs
|
||||||
|
|
||||||
|
libcheck facilitates selectively debugging of specific cases.
|
||||||
|
Example usage:
|
||||||
|
$ CK_LOG_FILE_NAME="/dev/stderr" CK_FORK=no \
|
||||||
|
CK_RUN_SUITE="getdns_context_set_timeout()" CK_RUN_CASE="Positive" \
|
||||||
|
../../libtool exe gdb --args ./check_getdns
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,6 @@ main (int argc, char** argv)
|
||||||
{
|
{
|
||||||
int number_failed;
|
int number_failed;
|
||||||
SRunner *sr ;
|
SRunner *sr ;
|
||||||
char log_fn[1024], *exe_fn;
|
|
||||||
|
|
||||||
Suite *getdns_general_suite(void);
|
Suite *getdns_general_suite(void);
|
||||||
Suite *getdns_general_sync_suite(void);
|
Suite *getdns_general_sync_suite(void);
|
||||||
|
@ -153,20 +152,6 @@ main (int argc, char** argv)
|
||||||
srunner_add_suite(sr,getdns_service_sync_suite());
|
srunner_add_suite(sr,getdns_service_sync_suite());
|
||||||
srunner_add_suite(sr,getdns_transport_suite());
|
srunner_add_suite(sr,getdns_transport_suite());
|
||||||
|
|
||||||
if ((exe_fn = strrchr(argv[0], '/')) && *exe_fn) {
|
|
||||||
exe_fn += 1;
|
|
||||||
if (exe_fn[0] == 'l' && exe_fn[1] == 't' && exe_fn[2] == '-') {
|
|
||||||
exe_fn += 3;
|
|
||||||
}
|
|
||||||
if (strlen(strncpy(log_fn, exe_fn, sizeof(log_fn) - 1)) < sizeof(log_fn) - 5) {
|
|
||||||
(void) strncat(log_fn, ".log", 4);
|
|
||||||
srunner_set_log(sr, log_fn);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
srunner_set_log(sr, "check_getdns.log");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
srunner_set_log(sr, "check_getdns.log");
|
|
||||||
srunner_run_all(sr, CK_NORMAL);
|
srunner_run_all(sr, CK_NORMAL);
|
||||||
number_failed = srunner_ntests_failed(sr);
|
number_failed = srunner_ntests_failed(sr);
|
||||||
srunner_free(sr);
|
srunner_free(sr);
|
||||||
|
|
|
@ -1219,6 +1219,7 @@ getdns_return_t do_the_call(void)
|
||||||
if (r != GETDNS_RETURN_GOOD) {
|
if (r != GETDNS_RETURN_GOOD) {
|
||||||
fprintf(stderr, "An error occurred: %d '%s'\n", (int)r,
|
fprintf(stderr, "An error occurred: %d '%s'\n", (int)r,
|
||||||
getdns_get_errorstr_by_id(r));
|
getdns_get_errorstr_by_id(r));
|
||||||
|
getdns_dict_destroy(address);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
if (response && !quiet) {
|
if (response && !quiet) {
|
||||||
|
@ -1242,6 +1243,7 @@ getdns_return_t do_the_call(void)
|
||||||
if (response)
|
if (response)
|
||||||
getdns_dict_destroy(response);
|
getdns_dict_destroy(response);
|
||||||
}
|
}
|
||||||
|
getdns_dict_destroy(address);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
. DS 19036 8 2 49aac11d7b6f6446702e54a1607371607a1a41855200fd2ce1cdde32f24e8fb5
|
|
@ -0,0 +1,16 @@
|
||||||
|
BaseName: 125-valgrind-checks
|
||||||
|
Version: 1.0
|
||||||
|
Description: Run valgrind to detect memory leaks
|
||||||
|
CreationDate: ma mrt 21 15:59:59 CET 2016
|
||||||
|
Maintainer: Willem Toorop
|
||||||
|
Category:
|
||||||
|
Component:
|
||||||
|
CmdDepends:
|
||||||
|
Depends: 110-link.tpkg
|
||||||
|
Help:
|
||||||
|
Pre:
|
||||||
|
Post:
|
||||||
|
Test: 125-valgrind-checks.test
|
||||||
|
AuxFiles:
|
||||||
|
Passed:
|
||||||
|
Failure:
|
|
@ -0,0 +1,26 @@
|
||||||
|
# #-- 125-valgrind-checks.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
|
||||||
|
|
||||||
|
cat >queries <<EOT
|
||||||
|
NS .
|
||||||
|
-A getdnsapi.net
|
||||||
|
qwerlkjhasdfpuiqwyerm.1234kjhrqwersv.com
|
||||||
|
-G TXT bogus.nlnetlabs.nl
|
||||||
|
-H 8.8.8.8
|
||||||
|
-H 2a04:b900:0:100::37
|
||||||
|
EOT
|
||||||
|
(
|
||||||
|
if ! "${BUILDDIR}/build/libtool" exec valgrind -v --log-file=valgrind.log --leak-check=full --error-exitcode=1 --track-origins=yes "${GETDNS_QUERY}" -F queries -f "${TPKG_NAME}.ds" +dnssec_return_validation_chain
|
||||||
|
then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
) 2>&1 > output
|
||||||
|
if ! awk '/^==.*(definitely|indirectly|possibly) lost/{print;if($4>0)exit(1)}' valgrind.log
|
||||||
|
then
|
||||||
|
cat valgrind.log
|
||||||
|
cat output
|
||||||
|
exit 1
|
||||||
|
fi
|
|
@ -0,0 +1 @@
|
||||||
|
. DS 19036 8 2 49aac11d7b6f6446702e54a1607371607a1a41855200fd2ce1cdde32f24e8fb5
|
|
@ -0,0 +1,16 @@
|
||||||
|
BaseName: 225-stub-only-valgrind-checks
|
||||||
|
Version: 1.0
|
||||||
|
Description: Run valgrind to detect memory leaks
|
||||||
|
CreationDate: ma mrt 21 16:24:56 CET 2016
|
||||||
|
Maintainer: Willem Toorop
|
||||||
|
Category:
|
||||||
|
Component:
|
||||||
|
CmdDepends:
|
||||||
|
Depends: 110-link.tpkg
|
||||||
|
Help:
|
||||||
|
Pre:
|
||||||
|
Post:
|
||||||
|
Test: 225-stub-only-valgrind-checks.test
|
||||||
|
AuxFiles:
|
||||||
|
Passed:
|
||||||
|
Failure:
|
|
@ -0,0 +1,26 @@
|
||||||
|
# #-- 225-stub-only-valgrind-checks.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
|
||||||
|
|
||||||
|
cat >queries <<EOT
|
||||||
|
NS .
|
||||||
|
-A getdnsapi.net
|
||||||
|
qwerlkjhasdfpuiqwyerm.1234kjhrqwersv.com
|
||||||
|
-G TXT bogus.nlnetlabs.nl
|
||||||
|
-H 8.8.8.8
|
||||||
|
-H 2a04:b900:0:100::37
|
||||||
|
EOT
|
||||||
|
(
|
||||||
|
if ! "${BUILDDIR}/build-stub-only/libtool" exec valgrind -v --log-file=valgrind.log --leak-check=full --error-exitcode=1 --track-origins=yes "${GETDNS_STUB_QUERY}" -F queries -f "${TPKG_NAME}.ds" +dnssec_return_validation_chain
|
||||||
|
then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
) 2>&1 > output
|
||||||
|
if ! awk '/^==.*(definitely|indirectly|possibly) lost/{print;if($4>0)exit(1)}' valgrind.log
|
||||||
|
then
|
||||||
|
cat valgrind.log
|
||||||
|
cat output
|
||||||
|
exit 1
|
||||||
|
fi
|
|
@ -132,6 +132,7 @@ static int my_event_base_dispatch(struct ub_event_base* base)
|
||||||
/* We run the event loop extension for which this ub_event_base is an
|
/* We run the event loop extension for which this ub_event_base is an
|
||||||
* interface ourselfs, so no need to let libunbound call dispatch.
|
* interface ourselfs, so no need to let libunbound call dispatch.
|
||||||
*/
|
*/
|
||||||
|
DEBUG_SCHED("UB_LOOP ERROR: my_event_base_dispatch()\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,20 +146,36 @@ static int my_event_base_loopexit(struct ub_event_base* base, struct timeval* tv
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CLEAR_MY_EVENT(ev) \
|
static void clear_my_event(my_event *ev)
|
||||||
do { (ev)->loop->extension->vmt->clear((ev)->loop->extension, \
|
{
|
||||||
&(ev)->gev); (ev)->added = 0; if ((ev)->active) { \
|
DEBUG_SCHED("UB_LOOP: to clear %p(%d, %d, %"PRIu64"), total: %d\n"
|
||||||
*(ev)->active = 0; (ev)->active = NULL; }} while(0)
|
, ev, ev->fd, ev->bits, ev->timeout, ev->loop->n_events);
|
||||||
|
(ev)->loop->extension->vmt->clear((ev)->loop->extension, &(ev)->gev);
|
||||||
|
(ev)->added = 0;
|
||||||
|
if ((ev)->active) {
|
||||||
|
*(ev)->active = 0;
|
||||||
|
(ev)->active = NULL;
|
||||||
|
}
|
||||||
|
DEBUG_SCHED("UB_LOOP: %p(%d, %d, %"PRIu64") cleared, total: %d\n"
|
||||||
|
, ev, ev->fd, ev->bits, ev->timeout, --ev->loop->n_events);
|
||||||
|
}
|
||||||
|
|
||||||
static getdns_return_t schedule_my_event(my_event *ev)
|
static getdns_return_t schedule_my_event(my_event *ev)
|
||||||
{
|
{
|
||||||
getdns_return_t r;
|
getdns_return_t r;
|
||||||
|
|
||||||
if (ev->gev.read_cb || ev->gev.write_cb || ev->gev.write_cb) {
|
DEBUG_SCHED("UB_LOOP: to schedule %p(%d, %d, %"PRIu64"), total: %d\n"
|
||||||
|
, ev, ev->fd, ev->bits, ev->timeout, ev->loop->n_events);
|
||||||
|
if (ev->gev.read_cb || ev->gev.write_cb || ev->gev.timeout_cb) {
|
||||||
if ((r = ev->loop->extension->vmt->schedule(
|
if ((r = ev->loop->extension->vmt->schedule(
|
||||||
ev->loop->extension, ev->fd, ev->timeout, &ev->gev)))
|
ev->loop->extension, ev->fd, ev->timeout, &ev->gev))) {
|
||||||
|
DEBUG_SCHED("UB_LOOP ERROR: scheduling event: %p\n", ev);
|
||||||
return r;
|
return r;
|
||||||
|
}
|
||||||
ev->added = 1;
|
ev->added = 1;
|
||||||
|
DEBUG_SCHED("UB_LOOP: event %p(%d, %d, %"PRIu64") scheduled, "
|
||||||
|
"total: %d\n", ev, ev->fd, ev->bits, ev->timeout
|
||||||
|
, ++ev->loop->n_events);
|
||||||
}
|
}
|
||||||
return GETDNS_RETURN_GOOD;
|
return GETDNS_RETURN_GOOD;
|
||||||
}
|
}
|
||||||
|
@ -184,7 +201,7 @@ static void read_cb(void *userarg)
|
||||||
if (active) {
|
if (active) {
|
||||||
ev->active = NULL;
|
ev->active = NULL;
|
||||||
if ((ev->bits & UB_EV_PERSIST) == 0)
|
if ((ev->bits & UB_EV_PERSIST) == 0)
|
||||||
CLEAR_MY_EVENT(ev);
|
clear_my_event(ev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,7 +226,7 @@ static void write_cb(void *userarg)
|
||||||
if (active) {
|
if (active) {
|
||||||
ev->active = NULL;
|
ev->active = NULL;
|
||||||
if ((ev->bits & UB_EV_PERSIST) == 0)
|
if ((ev->bits & UB_EV_PERSIST) == 0)
|
||||||
CLEAR_MY_EVENT(ev);
|
clear_my_event(ev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,7 +241,7 @@ static void timeout_cb(void *userarg)
|
||||||
if (active) {
|
if (active) {
|
||||||
ev->active = NULL;
|
ev->active = NULL;
|
||||||
if ((ev->bits & UB_EV_PERSIST) == 0)
|
if ((ev->bits & UB_EV_PERSIST) == 0)
|
||||||
CLEAR_MY_EVENT(ev);
|
clear_my_event(ev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,7 +251,7 @@ static getdns_return_t set_gev_callbacks(my_event* ev, short bits)
|
||||||
|
|
||||||
if (ev->bits != bits) {
|
if (ev->bits != bits) {
|
||||||
if (added)
|
if (added)
|
||||||
CLEAR_MY_EVENT(ev);
|
clear_my_event(ev);
|
||||||
|
|
||||||
ev->gev.read_cb = bits & UB_EV_READ ? read_cb : NULL;
|
ev->gev.read_cb = bits & UB_EV_READ ? read_cb : NULL;
|
||||||
ev->gev.write_cb = bits & UB_EV_WRITE ? write_cb : NULL;
|
ev->gev.write_cb = bits & UB_EV_WRITE ? write_cb : NULL;
|
||||||
|
@ -263,7 +280,7 @@ static void my_event_set_fd(struct ub_event* ub_ev, int fd)
|
||||||
|
|
||||||
if (ev->fd != fd) {
|
if (ev->fd != fd) {
|
||||||
if (ev->added) {
|
if (ev->added) {
|
||||||
CLEAR_MY_EVENT(ev);
|
clear_my_event(ev);
|
||||||
ev->fd = fd;
|
ev->fd = fd;
|
||||||
(void) schedule_my_event(ev);
|
(void) schedule_my_event(ev);
|
||||||
} else
|
} else
|
||||||
|
@ -279,7 +296,7 @@ static void my_event_free(struct ub_event* ev)
|
||||||
static int my_event_del(struct ub_event* ev)
|
static int my_event_del(struct ub_event* ev)
|
||||||
{
|
{
|
||||||
if (AS_MY_EVENT(ev)->added)
|
if (AS_MY_EVENT(ev)->added)
|
||||||
CLEAR_MY_EVENT(AS_MY_EVENT(ev));
|
clear_my_event(AS_MY_EVENT(ev));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -315,11 +332,13 @@ static int my_timer_add(struct ub_event* ub_ev, struct ub_event_base* base,
|
||||||
{
|
{
|
||||||
my_event *ev = AS_MY_EVENT(ub_ev);
|
my_event *ev = AS_MY_EVENT(ub_ev);
|
||||||
|
|
||||||
if (!base || !cb || !tv || AS_UB_LOOP(base) != ev->loop)
|
if (!base || !cb || !tv || AS_UB_LOOP(base) != ev->loop) {
|
||||||
|
DEBUG_SCHED("UB_LOOP ERROR: my_timer_add()\n");
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (ev->added)
|
if (ev->added)
|
||||||
CLEAR_MY_EVENT(ev);
|
clear_my_event(ev);
|
||||||
|
|
||||||
ev->cb = cb;
|
ev->cb = cb;
|
||||||
ev->arg = arg;
|
ev->arg = arg;
|
||||||
|
@ -335,12 +354,14 @@ static int my_timer_del(struct ub_event* ev)
|
||||||
static int my_signal_add(struct ub_event* ub_ev, struct timeval* tv)
|
static int my_signal_add(struct ub_event* ub_ev, struct timeval* tv)
|
||||||
{
|
{
|
||||||
/* Only unbound daaemon workers use signals */
|
/* Only unbound daaemon workers use signals */
|
||||||
|
DEBUG_SCHED("UB_LOOP ERROR: signal_add()\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int my_signal_del(struct ub_event* ub_ev)
|
static int my_signal_del(struct ub_event* ub_ev)
|
||||||
{
|
{
|
||||||
/* Only unbound daaemon workers use signals */
|
/* Only unbound daaemon workers use signals */
|
||||||
|
DEBUG_SCHED("UB_LOOP ERROR: signal_del()\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -439,6 +460,9 @@ void _getdns_ub_loop_init(_getdns_ub_loop *loop, struct mem_funcs *mf, getdns_ev
|
||||||
loop->mf = *mf;
|
loop->mf = *mf;
|
||||||
loop->extension = extension;
|
loop->extension = extension;
|
||||||
loop->running = 1;
|
loop->running = 1;
|
||||||
|
#if defined(SCHED_DEBUG) && SCHED_DEBUG
|
||||||
|
loop->n_events = 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
#include "getdns/getdns.h"
|
#include "getdns/getdns.h"
|
||||||
#include "getdns/getdns_extra.h"
|
#include "getdns/getdns_extra.h"
|
||||||
#include "types-internal.h"
|
#include "types-internal.h"
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
#ifdef HAVE_UNBOUND_EVENT_H
|
#ifdef HAVE_UNBOUND_EVENT_H
|
||||||
#include <unbound-event.h>
|
#include <unbound-event.h>
|
||||||
|
@ -61,6 +62,9 @@ typedef struct _getdns_ub_loop {
|
||||||
struct mem_funcs mf;
|
struct mem_funcs mf;
|
||||||
getdns_eventloop *extension;
|
getdns_eventloop *extension;
|
||||||
int running;
|
int running;
|
||||||
|
#if defined(SCHED_DEBUG) && SCHED_DEBUG
|
||||||
|
int n_events;
|
||||||
|
#endif
|
||||||
} _getdns_ub_loop;
|
} _getdns_ub_loop;
|
||||||
|
|
||||||
void _getdns_ub_loop_init(_getdns_ub_loop *loop, struct mem_funcs *mf, getdns_eventloop *extension);
|
void _getdns_ub_loop_init(_getdns_ub_loop *loop, struct mem_funcs *mf, getdns_eventloop *extension);
|
||||||
|
|
|
@ -329,11 +329,10 @@ _getdns_rr_iter2rr_dict(struct mem_funcs *mf, _getdns_rr_iter *i)
|
||||||
_getdns_list_create_with_mf(mf)))
|
_getdns_list_create_with_mf(mf)))
|
||||||
goto rdata_error;
|
goto rdata_error;
|
||||||
|
|
||||||
if (_getdns_list_append_dict(
|
if (_getdns_list_append_this_dict(
|
||||||
repeat_list, repeat_dict))
|
repeat_list, repeat_dict))
|
||||||
goto rdata_error;
|
goto rdata_error;
|
||||||
|
|
||||||
getdns_dict_destroy(repeat_dict);
|
|
||||||
repeat_dict = NULL;
|
repeat_dict = NULL;
|
||||||
}
|
}
|
||||||
if (!(repeat_dict =
|
if (!(repeat_dict =
|
||||||
|
@ -364,22 +363,19 @@ _getdns_rr_iter2rr_dict(struct mem_funcs *mf, _getdns_rr_iter *i)
|
||||||
if (!repeat_list && !(repeat_list =
|
if (!repeat_list && !(repeat_list =
|
||||||
_getdns_list_create_with_mf(mf)))
|
_getdns_list_create_with_mf(mf)))
|
||||||
goto rdata_error;
|
goto rdata_error;
|
||||||
if (_getdns_list_append_dict(repeat_list, repeat_dict))
|
if (_getdns_list_append_this_dict(repeat_list, repeat_dict))
|
||||||
goto rdata_error;
|
goto rdata_error;
|
||||||
getdns_dict_destroy(repeat_dict);
|
|
||||||
repeat_dict = NULL;
|
repeat_dict = NULL;
|
||||||
}
|
}
|
||||||
if (repeat_list) {
|
if (repeat_list) {
|
||||||
if (getdns_dict_set_list(rdata_dict,
|
if (_getdns_dict_set_this_list(rdata_dict,
|
||||||
rdf_storage.rdd_repeat->name, repeat_list))
|
rdf_storage.rdd_repeat->name, repeat_list))
|
||||||
goto rdata_error;
|
goto rdata_error;
|
||||||
getdns_list_destroy(repeat_list);
|
|
||||||
repeat_list = NULL;
|
repeat_list = NULL;
|
||||||
}
|
}
|
||||||
if (getdns_dict_set_dict(rr_dict, "rdata", rdata_dict))
|
if (_getdns_dict_set_this_dict(rr_dict, "rdata", rdata_dict))
|
||||||
goto rdata_error;
|
goto rdata_error;
|
||||||
|
|
||||||
getdns_dict_destroy(rdata_dict);
|
|
||||||
return rr_dict;
|
return rr_dict;
|
||||||
|
|
||||||
rdata_error:
|
rdata_error:
|
||||||
|
@ -529,8 +525,9 @@ _getdns_create_reply_dict(getdns_context *context, getdns_network_req *req,
|
||||||
SET_WIRE_CNT(arcount, ARCOUNT);
|
SET_WIRE_CNT(arcount, ARCOUNT);
|
||||||
|
|
||||||
/* header */
|
/* header */
|
||||||
if ((r = getdns_dict_set_dict(result, "header", header)))
|
if ((r = _getdns_dict_set_this_dict(result, "header", header)))
|
||||||
goto error;
|
goto error;
|
||||||
|
header = NULL;
|
||||||
|
|
||||||
canonical_name = req->owner->name;
|
canonical_name = req->owner->name;
|
||||||
canonical_name_len = req->owner->name_len;
|
canonical_name_len = req->owner->name_len;
|
||||||
|
@ -548,14 +545,14 @@ _getdns_create_reply_dict(getdns_context *context, getdns_network_req *req,
|
||||||
section = _getdns_rr_iter_section(rr_iter);
|
section = _getdns_rr_iter_section(rr_iter);
|
||||||
if (section == GLDNS_SECTION_QUESTION) {
|
if (section == GLDNS_SECTION_QUESTION) {
|
||||||
|
|
||||||
if (getdns_dict_set_dict(result, "question", rr_dict))
|
if (_getdns_dict_set_this_dict(result, "question", rr_dict))
|
||||||
goto error;
|
goto error;
|
||||||
|
else rr_dict = NULL;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (_getdns_list_append_dict(sections[section], rr_dict))
|
if (_getdns_list_append_this_dict(sections[section], rr_dict))
|
||||||
goto error;
|
goto error;
|
||||||
|
else rr_dict = NULL;
|
||||||
|
|
||||||
rr_type = gldns_read_uint16(rr_iter->rr_type);
|
rr_type = gldns_read_uint16(rr_iter->rr_type);
|
||||||
if (section > GLDNS_SECTION_QUESTION &&
|
if (section > GLDNS_SECTION_QUESTION &&
|
||||||
|
@ -589,6 +586,9 @@ _getdns_create_reply_dict(getdns_context *context, getdns_network_req *req,
|
||||||
&rdf_iter_storage, rr_iter)))
|
&rdf_iter_storage, rr_iter)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (!just_addrs)
|
||||||
|
continue;
|
||||||
|
|
||||||
bin_size = rdf_iter->nxt - rdf_iter->pos;
|
bin_size = rdf_iter->nxt - rdf_iter->pos;
|
||||||
bin_data = rdf_iter->pos;
|
bin_data = rdf_iter->pos;
|
||||||
if (!set_dict(&rr_dict, getdns_dict_create_with_context(context)) ||
|
if (!set_dict(&rr_dict, getdns_dict_create_with_context(context)) ||
|
||||||
|
@ -599,22 +599,26 @@ _getdns_create_reply_dict(getdns_context *context, getdns_network_req *req,
|
||||||
_getdns_dict_set_const_bindata(
|
_getdns_dict_set_const_bindata(
|
||||||
rr_dict, "address_data", bin_size, bin_data) ||
|
rr_dict, "address_data", bin_size, bin_data) ||
|
||||||
|
|
||||||
(just_addrs && _getdns_list_append_dict(just_addrs, rr_dict))) {
|
_getdns_list_append_this_dict(just_addrs, rr_dict)) {
|
||||||
|
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
rr_dict = NULL;
|
||||||
}
|
}
|
||||||
if (getdns_dict_set_list(result, "answer",
|
if (!_getdns_dict_set_this_list(result, "answer",
|
||||||
sections[GLDNS_SECTION_ANSWER]) ||
|
sections[GLDNS_SECTION_ANSWER]))
|
||||||
|
sections[GLDNS_SECTION_ANSWER] = NULL;
|
||||||
|
else goto error;
|
||||||
|
|
||||||
getdns_dict_set_list(result, "authority",
|
if (!_getdns_dict_set_this_list(result, "authority",
|
||||||
sections[GLDNS_SECTION_AUTHORITY]) ||
|
sections[GLDNS_SECTION_AUTHORITY]))
|
||||||
|
sections[GLDNS_SECTION_AUTHORITY] = NULL;
|
||||||
|
else goto error;
|
||||||
|
|
||||||
getdns_dict_set_list(result, "additional",
|
if (!_getdns_dict_set_this_list(result, "additional",
|
||||||
sections[GLDNS_SECTION_ADDITIONAL])) {
|
sections[GLDNS_SECTION_ADDITIONAL]))
|
||||||
|
sections[GLDNS_SECTION_ADDITIONAL] = NULL;
|
||||||
goto error;
|
else goto error;
|
||||||
}
|
|
||||||
|
|
||||||
/* other stuff
|
/* other stuff
|
||||||
* Note that spec doesn't explicitely mention these.
|
* Note that spec doesn't explicitely mention these.
|
||||||
|
@ -731,8 +735,9 @@ _getdns_create_reply_dict(getdns_context *context, getdns_network_req *req,
|
||||||
_getdns_list_append_int(bad_dns, GETDNS_BAD_DNS_ALL_NUMERIC_LABEL))
|
_getdns_list_append_int(bad_dns, GETDNS_BAD_DNS_ALL_NUMERIC_LABEL))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (getdns_dict_set_list(result, "bad_dns", bad_dns))
|
if (_getdns_dict_set_this_list(result, "bad_dns", bad_dns))
|
||||||
goto error;
|
goto error;
|
||||||
|
else bad_dns = NULL;
|
||||||
|
|
||||||
goto success;
|
goto success;
|
||||||
error:
|
error:
|
||||||
|
@ -788,7 +793,7 @@ _getdns_create_call_reporting_dict(
|
||||||
_getdns_sockaddr_to_dict(
|
_getdns_sockaddr_to_dict(
|
||||||
context, &netreq->upstream->addr, &address_debug);
|
context, &netreq->upstream->addr, &address_debug);
|
||||||
|
|
||||||
if (getdns_dict_set_dict(netreq_debug, "query_to", address_debug)) {
|
if (_getdns_dict_set_this_dict(netreq_debug,"query_to",address_debug)){
|
||||||
getdns_dict_destroy(address_debug);
|
getdns_dict_destroy(address_debug);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -802,8 +807,6 @@ _getdns_create_call_reporting_dict(
|
||||||
getdns_dict_destroy(netreq_debug);
|
getdns_dict_destroy(netreq_debug);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
getdns_dict_destroy(address_debug);
|
|
||||||
|
|
||||||
if (transport != GETDNS_TRANSPORT_UDP) {
|
if (transport != GETDNS_TRANSPORT_UDP) {
|
||||||
/* Report the idle timeout actually used on the connection. Must trim,
|
/* Report the idle timeout actually used on the connection. Must trim,
|
||||||
maximum used in practice is 6553500ms, but this is stored in a uint64_t.*/
|
maximum used in practice is 6553500ms, but this is stored in a uint64_t.*/
|
||||||
|
@ -848,7 +851,6 @@ _getdns_create_getdns_response(getdns_dns_req *completed_request)
|
||||||
getdns_dict *reply;
|
getdns_dict *reply;
|
||||||
getdns_bindata *canonical_name = NULL;
|
getdns_bindata *canonical_name = NULL;
|
||||||
int nreplies = 0, nanswers = 0, nsecure = 0, ninsecure = 0, nbogus = 0;
|
int nreplies = 0, nanswers = 0, nsecure = 0, ninsecure = 0, nbogus = 0;
|
||||||
getdns_bindata full_data;
|
|
||||||
getdns_dict *netreq_debug;
|
getdns_dict *netreq_debug;
|
||||||
|
|
||||||
/* info (bools) about dns_req */
|
/* info (bools) about dns_req */
|
||||||
|
@ -950,7 +952,7 @@ _getdns_create_getdns_response(getdns_dns_req *completed_request)
|
||||||
netreq->tsig_status))
|
netreq->tsig_status))
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
if (_getdns_list_append_dict(replies_tree, reply)) {
|
if (_getdns_list_append_this_dict(replies_tree, reply)) {
|
||||||
getdns_dict_destroy(reply);
|
getdns_dict_destroy(reply);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
@ -960,40 +962,38 @@ _getdns_create_getdns_response(getdns_dns_req *completed_request)
|
||||||
_getdns_create_call_reporting_dict(context,netreq)))
|
_getdns_create_call_reporting_dict(context,netreq)))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (_getdns_list_append_dict(
|
if (_getdns_list_append_this_dict(
|
||||||
call_reporting, netreq_debug)) {
|
call_reporting, netreq_debug)) {
|
||||||
|
|
||||||
getdns_dict_destroy(netreq_debug);
|
getdns_dict_destroy(netreq_debug);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
getdns_dict_destroy(netreq_debug);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getdns_dict_destroy(reply);
|
if (_getdns_list_append_const_bindata(replies_full,
|
||||||
|
netreq->response_len, netreq->response))
|
||||||
/* buffer */
|
|
||||||
full_data.data = netreq->response;
|
|
||||||
full_data.size = netreq->response_len;
|
|
||||||
if (_getdns_list_append_bindata(replies_full, &full_data))
|
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
if (getdns_dict_set_list(result, "replies_tree", replies_tree))
|
if (_getdns_dict_set_this_list(result, "replies_tree", replies_tree))
|
||||||
goto error;
|
goto error;
|
||||||
getdns_list_destroy(replies_tree);
|
replies_tree = NULL;
|
||||||
|
|
||||||
if (call_reporting &&
|
if (call_reporting) {
|
||||||
getdns_dict_set_list(result, "call_reporting", call_reporting))
|
if (_getdns_dict_set_this_list(
|
||||||
goto error_free_call_reporting;
|
result, "call_reporting", call_reporting))
|
||||||
|
goto error_free_call_reporting;
|
||||||
if (getdns_dict_set_list(result, "replies_full", replies_full))
|
call_reporting = NULL;
|
||||||
|
}
|
||||||
|
if (_getdns_dict_set_this_list(result, "replies_full", replies_full))
|
||||||
goto error_free_replies_full;
|
goto error_free_replies_full;
|
||||||
getdns_list_destroy(replies_full);
|
replies_full = NULL;
|
||||||
|
|
||||||
if (just_addrs && getdns_dict_set_list(
|
|
||||||
result, GETDNS_STR_KEY_JUST_ADDRS, just_addrs))
|
|
||||||
goto error_free_result;
|
|
||||||
getdns_list_destroy(just_addrs);
|
|
||||||
|
|
||||||
|
if (just_addrs) {
|
||||||
|
if (_getdns_dict_set_this_list(
|
||||||
|
result, GETDNS_STR_KEY_JUST_ADDRS, just_addrs))
|
||||||
|
goto error_free_result;
|
||||||
|
just_addrs = NULL;
|
||||||
|
}
|
||||||
if (getdns_dict_set_int(result, GETDNS_STR_KEY_STATUS,
|
if (getdns_dict_set_int(result, GETDNS_STR_KEY_STATUS,
|
||||||
nreplies == 0 ? GETDNS_RESPSTATUS_ALL_TIMEOUT :
|
nreplies == 0 ? GETDNS_RESPSTATUS_ALL_TIMEOUT :
|
||||||
completed_request->dnssec_return_only_secure && nsecure == 0 && ninsecure > 0
|
completed_request->dnssec_return_only_secure && nsecure == 0 && ninsecure > 0
|
||||||
|
@ -1291,8 +1291,8 @@ void _getdns_wire2list(uint8_t *pkt, size_t pkt_len, getdns_list *l)
|
||||||
if (!(rr_dict = _getdns_rr_iter2rr_dict(&l->mf, rr)))
|
if (!(rr_dict = _getdns_rr_iter2rr_dict(&l->mf, rr)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
(void)_getdns_list_append_dict(l, rr_dict);
|
if (_getdns_list_append_this_dict(l, rr_dict))
|
||||||
getdns_dict_destroy(rr_dict);
|
getdns_dict_destroy(rr_dict);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,12 +71,12 @@ getdns_return_t getdns_apply_network_result(getdns_network_req* netreq,
|
||||||
* @return GETDNS_RETURN_GOOD on success
|
* @return GETDNS_RETURN_GOOD on success
|
||||||
* @return GETDNS_RETURN_GENERAL_ERROR if out of memory
|
* @return GETDNS_RETURN_GENERAL_ERROR if out of memory
|
||||||
*/
|
*/
|
||||||
|
getdns_return_t _getdns_list_append_this_dict(getdns_list *list,
|
||||||
|
getdns_dict *child_dict);
|
||||||
|
|
||||||
getdns_return_t _getdns_list_append_dict(getdns_list *list,
|
getdns_return_t _getdns_list_append_dict(getdns_list *list,
|
||||||
const getdns_dict *child_dict);
|
const getdns_dict *child_dict);
|
||||||
getdns_return_t _getdns_list_append_list(getdns_list *list,
|
|
||||||
const getdns_list *child_list);
|
|
||||||
getdns_return_t _getdns_list_append_bindata(getdns_list *list,
|
|
||||||
const getdns_bindata *child_bindata);
|
|
||||||
getdns_return_t _getdns_list_append_string(getdns_list *list,
|
getdns_return_t _getdns_list_append_string(getdns_list *list,
|
||||||
const char *value);
|
const char *value);
|
||||||
|
|
||||||
|
@ -86,6 +86,12 @@ getdns_return_t _getdns_list_append_int(getdns_list *list,
|
||||||
getdns_return_t _getdns_list_append_const_bindata(getdns_list *list,
|
getdns_return_t _getdns_list_append_const_bindata(getdns_list *list,
|
||||||
size_t size, const void *data);
|
size_t size, const void *data);
|
||||||
|
|
||||||
|
getdns_return_t _getdns_dict_set_this_dict(getdns_dict *dict,
|
||||||
|
const char *name, getdns_dict *child_dict);
|
||||||
|
|
||||||
|
getdns_return_t _getdns_dict_set_this_list(getdns_dict *dict,
|
||||||
|
const char *name, getdns_list *child_list);
|
||||||
|
|
||||||
getdns_return_t _getdns_dict_set_const_bindata(getdns_dict *dict,
|
getdns_return_t _getdns_dict_set_const_bindata(getdns_dict *dict,
|
||||||
const char *name, size_t size, const void *data);
|
const char *name, size_t size, const void *data);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue