Compare commits

...
Author SHA1 Message Date
Wouter Wijngaards 4642bcb0bc Fix daemonize on Solaris 10.
git-svn-id: file:///svn/unbound/trunk@2026 be551aaa-1e26-0410-a405-d3ace91eadb9
2010-03-11 13:28:53 +00:00
Wouter Wijngaards 698b9df9de MacPorts fix.
git-svn-id: file:///svn/unbound/trunk@2025 be551aaa-1e26-0410-a405-d3ace91eadb9
2010-03-11 12:52:58 +00:00
Wouter Wijngaards ae83a2b706 - fix for memory alignment in struct sock_list allocation.
git-svn-id: file:///svn/unbound/trunk@2024 be551aaa-1e26-0410-a405-d3ace91eadb9
2010-03-11 11:19:14 +00:00
Wouter Wijngaards 6cf3327d8d - fix for memory alignment in struct sock_list allocation.
git-svn-id: file:///svn/unbound/trunk@2023 be551aaa-1e26-0410-a405-d3ace91eadb9
2010-03-11 11:18:40 +00:00
Wouter Wijngaards 62298b8bfc --enable-alloc-nonregional
git-svn-id: file:///svn/unbound/trunk@2022 be551aaa-1e26-0410-a405-d3ace91eadb9
2010-03-11 09:35:08 +00:00
Wouter Wijngaards c12752d6fc more userfriendly make test
git-svn-id: file:///svn/unbound/trunk@2021 be551aaa-1e26-0410-a405-d3ace91eadb9
2010-03-10 13:01:52 +00:00
Wouter Wijngaards 0f90647174 Add ipv6 stub test.
git-svn-id: file:///svn/unbound/trunk@2020 be551aaa-1e26-0410-a405-d3ace91eadb9
2010-03-10 12:36:59 +00:00
Wouter Wijngaards d1df3df96a nicer printf format conversion.
git-svn-id: file:///svn/unbound/trunk@2019 be551aaa-1e26-0410-a405-d3ace91eadb9
2010-03-10 12:11:54 +00:00
Wouter Wijngaards 6b5f246343 Portability of alloc-lite
git-svn-id: file:///svn/unbound/trunk@2018 be551aaa-1e26-0410-a405-d3ace91eadb9
2010-03-10 12:05:14 +00:00
Wouter Wijngaards b1c920bc8a and mark realloc freed data
git-svn-id: file:///svn/unbound/trunk@2017 be551aaa-1e26-0410-a405-d3ace91eadb9
2010-03-10 12:01:56 +00:00
Wouter Wijngaards 6f1c044381 fix for proto
git-svn-id: file:///svn/unbound/trunk@2016 be551aaa-1e26-0410-a405-d3ace91eadb9
2010-03-10 11:39:07 +00:00
Wouter Wijngaards 46df44f321 alloc_lite works
git-svn-id: file:///svn/unbound/trunk@2015 be551aaa-1e26-0410-a405-d3ace91eadb9
2010-03-10 11:01:33 +00:00
Wouter Wijngaards 0000843c32 --enable-alloc-lite
git-svn-id: file:///svn/unbound/trunk@2014 be551aaa-1e26-0410-a405-d3ace91eadb9
2010-03-09 16:26:53 +00:00
Wouter Wijngaards 99eb762c24 trunk moves to 1.4.3
git-svn-id: file:///svn/unbound/trunk@2013 be551aaa-1e26-0410-a405-d3ace91eadb9
2010-03-09 09:40:48 +00:00
Wouter Wijngaards 18b9d266d5 tag 1.4.2 release.
git-svn-id: file:///svn/unbound/trunk@2012 be551aaa-1e26-0410-a405-d3ace91eadb9
2010-03-09 08:55:50 +00:00
16 changed files with 445 additions and 39 deletions
+9 -1
View File
@@ -420,6 +420,12 @@
/* default username */
#undef UB_USERNAME
/* use to enable lightweight alloc assertions, for debug use */
#undef UNBOUND_ALLOC_LITE
/* use malloc not regions, for debug use */
#undef UNBOUND_ALLOC_NONREGIONAL
/* use statistics for allocs and frees, for debug use */
#undef UNBOUND_ALLOC_STATS
@@ -832,7 +838,9 @@ void unbound_stat_free_log(void *ptr, const char* file, int line,
const char* func);
void *unbound_stat_realloc_log(void *ptr, size_t size, const char* file,
int line, const char* func);
#endif /* UNBOUND_ALLOC_STATS */
#elif defined(UNBOUND_ALLOC_LITE)
# include "util/alloc.h"
#endif /* UNBOUND_ALLOC_LITE and UNBOUND_ALLOC_STATS */
/** default port for DNS traffic. */
#define UNBOUND_DNS_PORT 53
Vendored
+146 -25
View File
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.63 for unbound 1.4.2.
# Generated by GNU Autoconf 2.63 for unbound 1.4.3.
#
# Report bugs to <unbound-bugs@nlnetlabs.nl>.
#
@@ -745,8 +745,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='unbound'
PACKAGE_TARNAME='unbound'
PACKAGE_VERSION='1.4.2'
PACKAGE_STRING='unbound 1.4.2'
PACKAGE_VERSION='1.4.3'
PACKAGE_STRING='unbound 1.4.3'
PACKAGE_BUGREPORT='unbound-bugs@nlnetlabs.nl'
# Factoring default headers for most tests.
@@ -932,6 +932,8 @@ with_libevent
enable_staticexe
enable_lock_checks
enable_alloc_checks
enable_alloc_lite
enable_alloc_nonregional
enable_largefile
with_ldns
with_ldns_builtin
@@ -1500,7 +1502,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures unbound 1.4.2 to adapt to many kinds of systems.
\`configure' configures unbound 1.4.3 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1565,7 +1567,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of unbound 1.4.2:";;
short | recursive ) echo "Configuration of unbound 1.4.3:";;
esac
cat <<\_ACEOF
@@ -1587,7 +1589,13 @@ Optional Features:
event, ldns libs, for debug purposes
--enable-lock-checks enable to check lock and unlock calls, for debug
purposes
--enable-alloc-checks enable to check memory allocation, for debug
--enable-alloc-checks enable to memory allocation statistics, for debug
purposes
--enable-alloc-lite enable for lightweight alloc assertions, for debug
purposes
--enable-alloc-nonregional
enable nonregional allocs, slow but exposes regional
allocations to other memory purifiers, for debug
purposes
--disable-largefile omit support for large files
@@ -1711,7 +1719,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
unbound configure 1.4.2
unbound configure 1.4.3
generated by GNU Autoconf 2.63
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1725,7 +1733,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by unbound $as_me 1.4.2, which was
It was created by unbound $as_me 1.4.3, which was
generated by GNU Autoconf 2.63. Invocation command line was
$ $0 $@
@@ -2095,7 +2103,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
LIBUNBOUND_CURRENT=2
LIBUNBOUND_REVISION=2
LIBUNBOUND_REVISION=3
LIBUNBOUND_AGE=0
# 1.0.0 had 0:12:0
# 1.0.1 had 0:13:0
@@ -2113,6 +2121,7 @@ LIBUNBOUND_AGE=0
# 1.4.0 had 1:5:0 (not 2:0:0) # ub_result.why_bogus
# 1.4.1 had 2:1:0
# 1.4.2 had 2:2:0
# 1.4.3 had 2:3:0
# Current -- the number of the binary API that we're implementing
# Revision -- which iteration of the implementation of the binary
@@ -7289,13 +7298,13 @@ if test "${lt_cv_nm_interface+set}" = set; then
else
lt_cv_nm_interface="BSD nm"
echo "int some_variable = 0;" > conftest.$ac_ext
(eval echo "\"\$as_me:7292: $ac_compile\"" >&5)
(eval echo "\"\$as_me:7301: $ac_compile\"" >&5)
(eval "$ac_compile" 2>conftest.err)
cat conftest.err >&5
(eval echo "\"\$as_me:7295: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
(eval echo "\"\$as_me:7304: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
(eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
cat conftest.err >&5
(eval echo "\"\$as_me:7298: output\"" >&5)
(eval echo "\"\$as_me:7307: output\"" >&5)
cat conftest.out >&5
if $GREP 'External.*some_variable' conftest.out > /dev/null; then
lt_cv_nm_interface="MS dumpbin"
@@ -8500,7 +8509,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
echo '#line 8503 "configure"' > conftest.$ac_ext
echo '#line 8512 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -9867,11 +9876,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:9870: $lt_compile\"" >&5)
(eval echo "\"\$as_me:9879: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:9874: \$? = $ac_status" >&5
echo "$as_me:9883: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -10206,11 +10215,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:10209: $lt_compile\"" >&5)
(eval echo "\"\$as_me:10218: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:10213: \$? = $ac_status" >&5
echo "$as_me:10222: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -10311,11 +10320,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:10314: $lt_compile\"" >&5)
(eval echo "\"\$as_me:10323: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:10318: \$? = $ac_status" >&5
echo "$as_me:10327: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -10366,11 +10375,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:10369: $lt_compile\"" >&5)
(eval echo "\"\$as_me:10378: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:10373: \$? = $ac_status" >&5
echo "$as_me:10382: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -13169,7 +13178,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 13172 "configure"
#line 13181 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13265,7 +13274,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 13268 "configure"
#line 13277 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -19264,6 +19273,23 @@ if test "${enable_alloc_checks+set}" = set; then
enableval=$enable_alloc_checks;
fi
# Check whether --enable-alloc-lite was given.
if test "${enable_alloc_lite+set}" = set; then
enableval=$enable_alloc_lite;
fi
# Check whether --enable-alloc-nonregional was given.
if test "${enable_alloc_nonregional+set}" = set; then
enableval=$enable_alloc_nonregional;
fi
if test x_$enable_alloc_nonregional = x_yes; then
cat >>confdefs.h <<\_ACEOF
#define UNBOUND_ALLOC_NONREGIONAL 1
_ACEOF
fi
if test x_$enable_alloc_checks = x_yes; then
cat >>confdefs.h <<\_ACEOF
@@ -19271,6 +19297,13 @@ cat >>confdefs.h <<\_ACEOF
_ACEOF
else
if test x_$enable_alloc_lite = x_yes; then
cat >>confdefs.h <<\_ACEOF
#define UNBOUND_ALLOC_LITE 1
_ACEOF
else
for ac_header in stdlib.h
@@ -19524,6 +19557,7 @@ _ACEOF
fi
fi
fi
@@ -22871,6 +22905,92 @@ _ACEOF
fi
{ $as_echo "$as_me:$LINENO: checking for ldns_key_buf2rsa_raw" >&5
$as_echo_n "checking for ldns_key_buf2rsa_raw... " >&6; }
if test "${ac_cv_func_ldns_key_buf2rsa_raw+set}" = set; then
$as_echo_n "(cached) " >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Define ldns_key_buf2rsa_raw to an innocuous variant, in case <limits.h> declares ldns_key_buf2rsa_raw.
For example, HP-UX 11i <limits.h> declares gettimeofday. */
#define ldns_key_buf2rsa_raw innocuous_ldns_key_buf2rsa_raw
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char ldns_key_buf2rsa_raw (); below.
Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
<limits.h> exists even on freestanding compilers. */
#ifdef __STDC__
# include <limits.h>
#else
# include <assert.h>
#endif
#undef ldns_key_buf2rsa_raw
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char ldns_key_buf2rsa_raw ();
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined __stub_ldns_key_buf2rsa_raw || defined __stub___ldns_key_buf2rsa_raw
choke me
#endif
int
main ()
{
return ldns_key_buf2rsa_raw ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest$ac_exeext && {
test "$cross_compiling" = yes ||
$as_test_x conftest$ac_exeext
}; then
ac_cv_func_ldns_key_buf2rsa_raw=yes
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_func_ldns_key_buf2rsa_raw=no
fi
rm -rf conftest.dSYM
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_ldns_key_buf2rsa_raw" >&5
$as_echo "$ac_cv_func_ldns_key_buf2rsa_raw" >&6; }
for ac_header in ldns/ldns.h
do
@@ -22934,6 +23054,7 @@ fi
done
if test $ac_cv_lib_ldns_ldns_buffer_copy = yes \
-a $ac_cv_func_ldns_key_buf2rsa_raw = yes \
-a $ac_cv_header_ldns_ldns_h = yes; then
{ $as_echo "$as_me:$LINENO: checking for ldns_b32_ntop_extended_hex" >&5
$as_echo_n "checking for ldns_b32_ntop_extended_hex... " >&6; }
@@ -23576,7 +23697,7 @@ exec 6>&1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by unbound $as_me 1.4.2, which was
This file was extended by unbound $as_me 1.4.3, which was
generated by GNU Autoconf 2.63. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -23639,7 +23760,7 @@ Report bugs to <bug-autoconf@gnu.org>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_version="\\
unbound config.status 1.4.2
unbound config.status 1.4.3
configured by $0, generated by GNU Autoconf 2.63,
with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
+23 -5
View File
@@ -6,10 +6,10 @@ sinclude(acx_pthread.m4)
sinclude(acx_python.m4)
sinclude(ac_pkg_swig.m4)
AC_INIT(unbound, 1.4.2, unbound-bugs@nlnetlabs.nl, unbound)
AC_INIT(unbound, 1.4.3, unbound-bugs@nlnetlabs.nl, unbound)
LIBUNBOUND_CURRENT=2
LIBUNBOUND_REVISION=2
LIBUNBOUND_REVISION=3
LIBUNBOUND_AGE=0
# 1.0.0 had 0:12:0
# 1.0.1 had 0:13:0
@@ -27,6 +27,7 @@ LIBUNBOUND_AGE=0
# 1.4.0 had 1:5:0 (not 2:0:0) # ub_result.why_bogus
# 1.4.1 had 2:1:0
# 1.4.2 had 2:2:0
# 1.4.3 had 2:3:0
# Current -- the number of the binary API that we're implementing
# Revision -- which iteration of the implementation of the binary
@@ -515,12 +516,25 @@ fi
# set memory allocation checking if requested
AC_ARG_ENABLE(alloc-checks, AC_HELP_STRING([--enable-alloc-checks],
[ enable to check memory allocation, for debug purposes ]),
[ enable to memory allocation statistics, for debug purposes ]),
, )
AC_ARG_ENABLE(alloc-lite, AC_HELP_STRING([--enable-alloc-lite],
[ enable for lightweight alloc assertions, for debug purposes ]),
, )
AC_ARG_ENABLE(alloc-nonregional, AC_HELP_STRING([--enable-alloc-nonregional],
[ enable nonregional allocs, slow but exposes regional allocations to other memory purifiers, for debug purposes ]),
, )
if test x_$enable_alloc_nonregional = x_yes; then
AC_DEFINE(UNBOUND_ALLOC_NONREGIONAL, 1, [use malloc not regions, for debug use])
fi
if test x_$enable_alloc_checks = x_yes; then
AC_DEFINE(UNBOUND_ALLOC_STATS, 1, [use statistics for allocs and frees, for debug use])
else
ACX_FUNC_MALLOC([unbound])
if test x_$enable_alloc_lite = x_yes; then
AC_DEFINE(UNBOUND_ALLOC_LITE, 1, [use to enable lightweight alloc assertions, for debug use])
else
ACX_FUNC_MALLOC([unbound])
fi
fi
AC_FUNC_CHOWN
@@ -594,8 +608,10 @@ AC_ARG_WITH(ldns-builtin, AC_HELP_STRING([--with-ldns-builtin],
# check if ldns is good enough
if test "$use_ldns_builtin" = "no"; then
AC_CHECK_LIB(ldns, ldns_buffer_copy)
AC_CHECK_FUNC(ldns_key_buf2rsa_raw)
AC_CHECK_HEADERS([ldns/ldns.h],,, [AC_INCLUDES_DEFAULT])
if test $ac_cv_lib_ldns_ldns_buffer_copy = yes \
-a $ac_cv_func_ldns_key_buf2rsa_raw = yes \
-a $ac_cv_header_ldns_ldns_h = yes; then
dnl ldns was found, check compat functions
AC_CHECK_FUNC([ldns_b32_ntop_extended_hex],, [
@@ -770,7 +786,9 @@ void unbound_stat_free_log(void *ptr, const char* file, int line,
const char* func);
void *unbound_stat_realloc_log(void *ptr, size_t size, const char* file,
int line, const char* func);
#endif /* UNBOUND_ALLOC_STATS */
#elif defined(UNBOUND_ALLOC_LITE)
# include "util/alloc.h"
#endif /* UNBOUND_ALLOC_LITE and UNBOUND_ALLOC_STATS */
/** default port for DNS traffic. */
#define UNBOUND_DNS_PORT 53
+2 -2
View File
@@ -313,7 +313,7 @@ detach(void)
if(daemon(1, 0) != 0)
fatal_exit("daemon failed: %s", strerror(errno));
#else /* no HAVE_DAEMON */
#ifdef HAVE_WORKING_FORK
#ifdef HAVE_FORK
int fd;
/* Take off... */
switch (fork()) {
@@ -337,7 +337,7 @@ detach(void)
if (fd > 2)
(void)close(fd);
}
#endif /* HAVE_WORKING_FORK */
#endif /* HAVE_FORK */
#endif /* HAVE_DAEMON */
}
+17
View File
@@ -1,3 +1,20 @@
11 March 2010: Wouter
- another memory allocation option: --enable-alloc-nonregional.
exposes the regional allocations to other memory purifiers.
- fix for memory alignment in struct sock_list allocation.
- Fix for MacPorts ldns without ssl default, unbound checks if ldns
has dnssec functionality and uses the builtin if not.
- Fix daemonize on Solaris 10, it did not detach from terminal.
10 March 2010: Wouter
- --enable-alloc-lite works with test set.
- portability in the testset: printf format conversions, prototypes.
9 March 2010: Wouter
- tag 1.4.2 created.
- trunk is 1.4.3 in development.
- --enable-alloc-lite debug option.
8 March 2010: Wouter
- iana portlist updated.
+7
View File
@@ -484,8 +484,15 @@ setup_qinfo_edns(struct libworker* w, struct ctx_query* q,
if(!rdf) {
return 0;
}
#ifdef UNBOUND_ALLOC_LITE
qinfo->qname = memdup(ldns_rdf_data(rdf), ldns_rdf_size(rdf));
qinfo->qname_len = ldns_rdf_size(rdf);
ldns_rdf_deep_free(rdf);
rdf = 0;
#else
qinfo->qname = ldns_rdf_data(rdf);
qinfo->qname_len = ldns_rdf_size(rdf);
#endif
edns->edns_present = 1;
edns->ext_rcode = 0;
edns->edns_version = 0;
+8
View File
@@ -48,6 +48,14 @@
#undef free
#undef realloc
#endif
#ifdef UNBOUND_ALLOC_LITE
#undef malloc
#undef calloc
#undef free
#undef realloc
#undef strdup
#define unbound_lite_wrapstr(s) s
#endif
#include "libunbound/unbound.h"
#include <ldns/ldns.h>
+7
View File
@@ -45,6 +45,13 @@
#include "libunbound/context.h"
#include "util/locks.h"
#include "util/log.h"
#ifdef UNBOUND_ALLOC_LITE
#undef malloc
#undef calloc
#undef realloc
#undef free
#undef strdup
#endif
/** keeping track of the async ids */
struct track_id {
+6 -1
View File
@@ -7,9 +7,14 @@ NEED_XXD='fwd_compress_c00c.tpkg fwd_zero.tpkg'
NEED_NC='fwd_compress_c00c.tpkg fwd_zero.tpkg'
NEED_CURL='06-ianaports.tpkg'
NEED_WHOAMI='07-confroot.tpkg'
NEED_IPV6='fwd_ancil.tpkg fwd_tcp_tc6.tpkg'
NEED_IPV6='fwd_ancil.tpkg fwd_tcp_tc6.tpkg stub_udp6.tpkg'
NEED_NOMINGW='tcp_sigpipe.tpkg 07-confroot.tpkg 08-host-lib.tpkg fwd_ancil.tpkg'
# test if dig, wdiff and ldns-testns are available.
if test ! -x "`which dig 2>&1`"; then echo No 'dig' in path; exit 1; fi
if test ! -x "`which wdiff 2>&1`"; then echo No 'wdiff' in path; exit 1; fi
if test ! -x "`which ldns-testns 2>&1`"; then echo No 'ldns-testns' in path; exit 1; fi
# test for ipv6, uses streamptcp peculiarity.
if ./streamtcp -f ::1 2>&1 | grep "not supported" >/dev/null 2>&1; then
HAVE_IPV6=no
+8
View File
@@ -74,6 +74,14 @@
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#ifdef UNBOUND_ALLOC_LITE
#undef malloc
#undef calloc
#undef realloc
#undef free
#undef strdup
#define unbound_lite_wrapstr(s) s
#endif
struct todo_item;
struct labdata;
+8 -4
View File
@@ -31,8 +31,12 @@ struct sockaddr_storage;
/** string to show in warnings and errors */
static const char* prog_name = "ldns-testpkts";
#ifndef UTIL_LOG_H
/** verbosity definition for compat */
enum verbosity_value { NO_VERBOSE=0 };
#endif
/** logging routine, provided by caller */
void verbose(int lvl, const char* msg, ...);
void verbose(enum verbosity_value lvl, const char* msg, ...) ATTR_FORMAT(printf, 2, 3);
/** print error and exit */
static void error(const char* msg, ...)
@@ -589,12 +593,12 @@ match_list(ldns_rr_list* q, ldns_rr_list *p, bool mttl)
{
if(ldns_rr_compare(ldns_rr_list_rr(q, i),
ldns_rr_list_rr(p, i)) != 0) {
verbose(3, "rr %d different", i);
verbose(3, "rr %d different", (int)i);
return 0;
}
if(mttl && ldns_rr_ttl(ldns_rr_list_rr(q, i)) !=
ldns_rr_ttl(ldns_rr_list_rr(p, i))) {
verbose(3, "rr %d ttl different", i);
verbose(3, "rr %d ttl different", (int)i);
return 0;
}
}
@@ -768,7 +772,7 @@ handle_query(uint8_t* inbuf, ssize_t inlen, struct entry* entries, int* count,
query_rr = ldns_rr_list_rr(ldns_pkt_question(query_pkt), 0);
verbose(1, "query %d: id %d: %s %d bytes: ", ++(*count), (int)ldns_pkt_id(query_pkt),
(transport==transport_tcp)?"TCP":"UDP", inlen);
(transport==transport_tcp)?"TCP":"UDP", (int)inlen);
if(verbose_out) ldns_rr_print(verbose_out, query_rr);
if(verbose_out) ldns_pkt_print(verbose_out, query_pkt);
BIN
View File
Binary file not shown.
+165
View File
@@ -472,3 +472,168 @@ void *unbound_stat_realloc_log(void *ptr, size_t size, const char* file,
}
#endif /* UNBOUND_ALLOC_STATS */
#ifdef UNBOUND_ALLOC_LITE
#undef malloc
#undef calloc
#undef free
#undef realloc
/** length of prefix and suffix */
static size_t lite_pad = 16;
/** prefix value to check */
static char* lite_pre = "checkfront123456";
/** suffix value to check */
static char* lite_post= "checkafter123456";
void *unbound_stat_malloc_lite(size_t size, const char* file, int line,
const char* func)
{
/* [prefix .. len .. actual data .. suffix] */
void* res = malloc(size+lite_pad*2+sizeof(size_t));
if(!res) return NULL;
memmove(res, lite_pre, lite_pad);
memmove(res+lite_pad, &size, sizeof(size_t));
memset(res+lite_pad+sizeof(size_t), 0x1a, size); /* init the memory */
memmove(res+lite_pad+size+sizeof(size_t), lite_post, lite_pad);
return res+lite_pad+sizeof(size_t);
}
void *unbound_stat_calloc_lite(size_t nmemb, size_t size, const char* file,
int line, const char* func)
{
size_t req = nmemb * size;
void* res = malloc(req+lite_pad*2+sizeof(size_t));
if(!res) return NULL;
memmove(res, lite_pre, lite_pad);
memmove(res+lite_pad, &req, sizeof(size_t));
memset(res+lite_pad+sizeof(size_t), 0, req);
memmove(res+lite_pad+req+sizeof(size_t), lite_post, lite_pad);
return res+lite_pad+sizeof(size_t);
}
void unbound_stat_free_lite(void *ptr, const char* file, int line,
const char* func)
{
void* real;
size_t orig = 0;
if(!ptr) return;
real = ptr-lite_pad-sizeof(size_t);
if(memcmp(real, lite_pre, lite_pad) != 0) {
log_err("free(): prefix failed %s:%d %s", file, line, func);
log_hex("prefix here", real, lite_pad);
log_hex(" should be", lite_pre, lite_pad);
fatal_exit("alloc assertion failed");
}
memmove(&orig, real+lite_pad, sizeof(size_t));
if(memcmp(real+lite_pad+orig+sizeof(size_t), lite_post, lite_pad)!=0){
log_err("free(): suffix failed %s:%d %s", file, line, func);
log_err("alloc size is %d", (int)orig);
log_hex("suffix here", real+lite_pad+orig+sizeof(size_t),
lite_pad);
log_hex(" should be", lite_post, lite_pad);
fatal_exit("alloc assertion failed");
}
memset(real, 0xdd, orig+lite_pad*2+sizeof(size_t)); /* mark it */
free(real);
}
void *unbound_stat_realloc_lite(void *ptr, size_t size, const char* file,
int line, const char* func)
{
/* always free and realloc (no growing) */
void* real, *newa;
size_t orig = 0;
if(!ptr) {
/* like malloc() */
return unbound_stat_malloc_lite(size, file, line, func);
}
if(!size) {
/* like free() */
unbound_stat_free_lite(ptr, file, line, func);
return NULL;
}
/* change allocation size and copy */
real = ptr-lite_pad-sizeof(size_t);
if(memcmp(real, lite_pre, lite_pad) != 0) {
log_err("realloc(): prefix failed %s:%d %s", file, line, func);
log_hex("prefix here", real, lite_pad);
log_hex(" should be", lite_pre, lite_pad);
fatal_exit("alloc assertion failed");
}
memmove(&orig, real+lite_pad, sizeof(size_t));
if(memcmp(real+lite_pad+orig+sizeof(size_t), lite_post, lite_pad)!=0){
log_err("realloc(): suffix failed %s:%d %s", file, line, func);
log_err("alloc size is %d", (int)orig);
log_hex("suffix here", real+lite_pad+orig+sizeof(size_t),
lite_pad);
log_hex(" should be", lite_post, lite_pad);
fatal_exit("alloc assertion failed");
}
/* new alloc and copy over */
newa = unbound_stat_malloc_lite(size, file, line, func);
if(!newa)
return NULL;
if(orig < size)
memmove(newa, ptr, orig);
else memmove(newa, ptr, size);
memset(real, 0xdd, orig+lite_pad*2+sizeof(size_t)); /* mark it */
free(real);
return newa;
}
char* unbound_strdup_lite(const char* s, const char* file, int line,
const char* func)
{
/* this routine is made to make sure strdup() uses the malloc_lite */
size_t l = strlen(s)+1;
char* n = (char*)unbound_stat_malloc_lite(l, file, line, func);
if(!n) return NULL;
memmove(n, s, l);
return n;
}
char* unbound_lite_wrapstr(char* s)
{
char* n = unbound_strdup_lite(s, __FILE__, __LINE__, __func__);
free(s);
return n;
}
#undef ldns_pkt2wire
ldns_status unbound_lite_pkt2wire(uint8_t **dest, const ldns_pkt *p,
size_t *size)
{
uint8_t* md = NULL;
size_t ms = 0;
ldns_status s = ldns_pkt2wire(&md, p, &ms);
if(md) {
*dest = unbound_stat_malloc_lite(ms, __FILE__, __LINE__,
__func__);
*size = ms;
if(!*dest) { free(md); return LDNS_STATUS_MEM_ERR; }
memcpy(*dest, md, ms);
free(md);
} else {
*dest = NULL;
*size = 0;
}
return s;
}
#undef i2d_DSA_SIG
int unbound_lite_i2d_DSA_SIG(DSA_SIG* dsasig, unsigned char** sig)
{
unsigned char* n = NULL;
int r= i2d_DSA_SIG(dsasig, &n);
if(n) {
*sig = unbound_stat_malloc_lite((size_t)r, __FILE__, __LINE__,
__func__);
if(!*sig) return -1;
memcpy(*sig, n, (size_t)r);
free(n);
return r;
}
*sig = NULL;
return r;
}
#endif /* UNBOUND_ALLOC_LITE */
+33
View File
@@ -176,4 +176,37 @@ void alloc_reg_release(struct alloc_cache* alloc, struct regional* r);
void alloc_set_id_cleanup(struct alloc_cache* alloc, void (*cleanup)(void*),
void* arg);
#ifdef UNBOUND_ALLOC_LITE
# define malloc(s) unbound_stat_malloc_lite(s, __FILE__, __LINE__, __func__)
# define calloc(n,s) unbound_stat_calloc_lite(n, s, __FILE__, __LINE__, __func__)
# define free(p) unbound_stat_free_lite(p, __FILE__, __LINE__, __func__)
# define realloc(p,s) unbound_stat_realloc_lite(p, s, __FILE__, __LINE__, __func__)
void *unbound_stat_malloc_lite(size_t size, const char* file, int line,
const char* func);
void *unbound_stat_calloc_lite(size_t nmemb, size_t size, const char* file,
int line, const char* func);
void unbound_stat_free_lite(void *ptr, const char* file, int line,
const char* func);
void *unbound_stat_realloc_lite(void *ptr, size_t size, const char* file,
int line, const char* func);
# ifdef strdup
# undef strdup
# endif
# define strdup(s) unbound_strdup_lite(s, __FILE__, __LINE__, __func__)
char* unbound_strdup_lite(const char* s, const char* file, int line,
const char* func);
char* unbound_lite_wrapstr(char* s);
# define ldns_rr2str(rr) unbound_lite_wrapstr(ldns_rr2str(rr))
# define ldns_rdf2str(rdf) unbound_lite_wrapstr(ldns_rdf2str(rdf))
# define ldns_rr_type2str(t) unbound_lite_wrapstr(ldns_rr_type2str(t))
# define ldns_rr_class2str(c) unbound_lite_wrapstr(ldns_rr_class2str(c))
# define ldns_rr_list2str(r) unbound_lite_wrapstr(ldns_rr_list2str(r))
# define ldns_pkt2str(p) unbound_lite_wrapstr(ldns_pkt2str(p))
# define ldns_pkt_rcode2str(r) unbound_lite_wrapstr(ldns_pkt_rcode2str(r))
# define ldns_pkt2wire(a, r, s) unbound_lite_pkt2wire(a, r, s)
ldns_status unbound_lite_pkt2wire(uint8_t **dest, const ldns_pkt *p, size_t *size);
# define i2d_DSA_SIG(d, s) unbound_lite_i2d_DSA_SIG(d, s)
int unbound_lite_i2d_DSA_SIG(DSA_SIG* dsasig, unsigned char** sig);
#endif /* UNBOUND_ALLOC_LITE */
#endif /* UTIL_ALLOC_H */
+1 -1
View File
@@ -497,7 +497,7 @@ void sock_list_insert(struct sock_list** list, struct sockaddr_storage* addr,
socklen_t len, struct regional* region)
{
struct sock_list* add = (struct sock_list*)regional_alloc(region,
sizeof(add->next) + sizeof(add->len) + (size_t)len);
sizeof(*add) - sizeof(add->addr) + (size_t)len);
if(!add) {
log_err("out of memory in socketlist insert");
return;
+5
View File
@@ -54,8 +54,13 @@
/** Default reasonable size for chunks */
#define REGIONAL_CHUNK_SIZE 8192
#ifdef UNBOUND_ALLOC_NONREGIONAL
/** All objects allocated outside of chunks, for debug */
#define REGIONAL_LARGE_OBJECT_SIZE 0
#else
/** Default size for large objects - allocated outside of chunks. */
#define REGIONAL_LARGE_OBJECT_SIZE 2048
#endif
struct regional*
regional_create()