]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
Sync with trunk
authorYuri Schaeffer <yuri@nlnetlabs.nl>
Tue, 19 Feb 2013 09:05:35 +0000 (09:05 +0000)
committerYuri Schaeffer <yuri@nlnetlabs.nl>
Tue, 19 Feb 2013 09:05:35 +0000 (09:05 +0000)
git-svn-id: file:///svn/unbound/branches/edns-subnet@2847 be551aaa-1e26-0410-a405-d3ace91eadb9

26 files changed:
daemon/daemon.c
daemon/unbound.c
doc/Changelog
doc/libunbound.3.in
doc/unbound.doxygen
iterator/iter_fwd.c
iterator/iter_hints.c
libunbound/libworker.c
libunbound/unbound.h
services/localzone.c
smallapp/unbound-host.c
testcode/do-tests.sh
testcode/ldns-testpkts.h
testcode/mini_tpkg.sh
testcode/unitmain.c
testdata/common.sh
testdata/fwd_zero.tpkg
testdata/nss_compile.tpkg [new file with mode: 0644]
util/iana_ports.inc
util/net_help.c
util/netevent.c
util/random.c
util/storage/lookup3.c
validator/val_nsec3.c
validator/val_secalgo.c
winrc/win_svc.c

index 40cca8e909edb8eb68ff43fd5f5ab1e119c31eb3..5b81859eb07547cde13967d19bd8a4cf033196a9 100644 (file)
@@ -57,7 +57,8 @@
 #endif
 
 #ifdef HAVE_NSS
-#include <nss3/nss.h>
+/* nss3 */
+#include "nss.h"
 #endif
 
 #include <ldns/ldns.h>
@@ -215,7 +216,7 @@ daemon_init(void)
        comp_meth = (void*)SSL_COMP_get_compression_methods();
 #  endif
        (void)SSL_library_init();
-#  if defined(OPENSSL_THREADS) && !defined(THREADS_DISABLED)
+#  if defined(HAVE_SSL) && defined(OPENSSL_THREADS) && !defined(THREADS_DISABLED)
        if(!ub_openssl_lock_init())
                fatal_exit("could not init openssl locks");
 #  endif
@@ -594,7 +595,7 @@ daemon_delete(struct daemon* daemon)
        ERR_remove_state(0);
        ERR_free_strings();
        RAND_cleanup();
-#  if defined(OPENSSL_THREADS) && !defined(THREADS_DISABLED)
+#  if defined(HAVE_SSL) && defined(OPENSSL_THREADS) && !defined(THREADS_DISABLED)
        ub_openssl_lock_delete();
 #  endif
 #elif defined(HAVE_NSS)
index 87679a0882a8a4d926c0cfa8b15b8edbf25dc80f..934b75f4bee5a78c9017d9dbb83347283be0fb18 100644 (file)
@@ -88,7 +88,8 @@
 #endif
 
 #ifdef HAVE_NSS
-#  include <nss3/nss.h>
+/* nss3 */
+#  include "nss.h"
 #endif
 
 /** global debug value to keep track of heap memory allocation */
index 46a97ae96d872e261a1a3019c16a4e151a88ce66..38290b03c5e0d4b2b9ba4a55aa43effd2274d47a 100644 (file)
@@ -1,3 +1,25 @@
+15 February 2013: Wouter
+       - fix defines in lookup3 for bigendian bsd alpha
+
+11 February 2013: Wouter
+       - Fixup openssl_thread init code to only run if compiled with SSL.
+
+7 February 2013: Wouter
+       - detect endianness in lookup3 on BSD.
+       - add libunbound.ttl at end of result structure, version bump for
+         libunbound and binary backwards compatible, but 1.4.19 is not
+         forward compatible with 1.4.20.
+       - update iana port list.
+
+30 January 2013: Wouter
+       - includes and have_ssl fixes for nss.
+
+29 January 2013: Wouter
+       - printout name of zone with duplicate fwd and hint errors.
+
+28 January 2013: Wouter
+       - updated fwd_zero for newer nc. Updated common.sh for newer netstat.
+
 17 January 2013: Wouter
        - unbound-anchors checks the emailAddress of the signer of the
          root.xml file, default is dnssec@iana.org.  It also checks that
index c825c2eb4620fa29d9613363080b9ecfb626c6c3..ce9c059b3700158ea0c97a3508ef8dae983d467c 100644 (file)
@@ -359,6 +359,7 @@ The result of the DNS resolution and validation is returned as
                int secure;  /* true if result is secure */
                int bogus;   /* true if a security failure happened */
                char* why_bogus; /* string with error if bogus */
+               int ttl;     /* number of seconds the result is valid */
        };
 .fi
 .P
index 290380c66a0e3e35e852b4bd228cd143694e04b8..2ae3deca878fe34ce946cd36e5a0cd2b8e0f7fdd 100644 (file)
@@ -559,6 +559,12 @@ MAX_INITIALIZER_LINES  = 30
 
 SHOW_USED_FILES        = YES
 
+# If the sources in your project are distributed over multiple directories
+# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
+# in the documentation. The default is NO.
+
+#SHOW_DIRECTORIES       = YES
+
 # Set the SHOW_FILES tag to NO to disable the generation of the Files page.
 # This will remove the Files entry from the Quick Index and from the
 # Folder Tree View (if specified). The default is YES.
@@ -970,6 +976,12 @@ HTML_COLORSTYLE_GAMMA  = 80
 
 HTML_TIMESTAMP         = YES
 
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
+# files or namespaces will be aligned in HTML using tables. If set to
+# NO a bullet list will be used.
+
+#HTML_ALIGN_MEMBERS     = YES
+
 # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
 # documentation will contain sections that can be hidden and shown after the
 # page has loaded.
@@ -1163,7 +1175,7 @@ GENERATE_TREEVIEW      = NO
 # documentation. Note that a value of 0 will completely suppress the enum
 # values from appearing in the overview section.
 
-ENUM_VALUES_PER_LINE   = 4
+#USE_INLINE_TREES       = NO
 
 # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
 # used to set the initial width (in pixels) of the frame in which the tree
index 3f91b527f5240cef12eac3a11a4cab00f343f8ad..0b3b6525c26b6e3575cc0086abbd96b0c209bf56 100644 (file)
@@ -128,7 +128,9 @@ forwards_insert_data(struct iter_forwards* fwd, uint16_t c, uint8_t* nm,
        node->namelabs = nmlabs;
        node->dp = dp;
        if(!rbtree_insert(fwd->tree, &node->node)) {
-               log_err("duplicate forward zone ignored.");
+               char buf[257];
+               dname_str(nm, buf);
+               log_err("duplicate forward zone %s ignored.", buf);
                delegpt_free_mlc(dp);
                free(node->name);
                free(node);
index 53ac8ff0f0c5c7a1f735ccda62a0782536ac2401..cde3a7e1bac3d8f4ab6aa646beaa4dbadf0d7192 100644 (file)
@@ -172,7 +172,9 @@ hints_insert(struct iter_hints* hints, uint16_t c, struct delegpt* dp,
        node->noprime = (uint8_t)noprime;
        if(!name_tree_insert(&hints->tree, &node->node, dp->name, dp->namelen,
                dp->namelabs, c)) {
-               log_err("second hints ignored.");
+               char buf[257];
+               dname_str(dp->name, buf);
+               log_err("second hints for zone %s ignored.", buf);
                delegpt_free_mlc(dp);
                free(node);
        }
index 78d71f8e3b49858de0aaab242fcbce5a9bcd13e3..89068a5ad6ca1f177e9e35fa2d07e7b055ef00b1 100644 (file)
@@ -44,7 +44,9 @@
 #include "config.h"
 #include <ldns/dname.h>
 #include <ldns/wire2host.h>
+#ifdef HAVE_SSL
 #include <openssl/ssl.h>
+#endif
 #include "libunbound/libworker.h"
 #include "libunbound/context.h"
 #include "libunbound/unbound.h"
@@ -88,7 +90,9 @@ libworker_delete(struct libworker* w)
                ub_randfree(w->env->rnd);
                free(w->env);
        }
+#ifdef HAVE_SSL
        SSL_CTX_free(w->sslctx);
+#endif
        outside_network_delete(w->back);
        comm_base_delete(w->base);
        free(w);
@@ -417,15 +421,18 @@ fill_canon(struct ub_result* res, uint8_t* s)
 /** fill data into result */
 static int
 fill_res(struct ub_result* res, struct ub_packed_rrset_key* answer,
-       uint8_t* finalcname, struct query_info* rq)
+       uint8_t* finalcname, struct query_info* rq, struct reply_info* rep)
 {
        size_t i;
        struct packed_rrset_data* data;
+       res->ttl = 0;
        if(!answer) {
                if(finalcname) {
                        if(!fill_canon(res, finalcname))
                                return 0; /* out of memory */
                }
+               if(rep->rrset_count != 0)
+                       res->ttl = (int)rep->ttl;
                res->data = (char**)calloc(1, sizeof(char*));
                res->len = (int*)calloc(1, sizeof(int));
                return (res->data && res->len);
@@ -446,6 +453,21 @@ fill_res(struct ub_result* res, struct ub_packed_rrset_key* answer,
                if(!res->data[i])
                        return 0; /* out of memory */
        }
+       /* ttl for positive answers, from CNAME and answer RRs */
+       if(data->count != 0) {
+               size_t j;
+               res->ttl = (int)data->ttl;
+               for(j=0; j<rep->an_numrrsets; j++) {
+                       struct packed_rrset_data* d =
+                               (struct packed_rrset_data*)rep->rrsets[j]->
+                               entry.data;
+                       if((int)d->ttl < res->ttl)
+                               res->ttl = (int)d->ttl;
+               }
+       }
+       /* ttl for negative answers */
+       if(data->count == 0 && rep->rrset_count != 0)
+               res->ttl = (int)rep->ttl;
        res->data[data->count] = NULL;
        res->len[data->count] = 0;
        return 1;
@@ -465,7 +487,7 @@ libworker_enter_result(struct ub_result* res, ldns_buffer* buf,
                return; /* error parsing buf, or out of memory */
        }
        if(!fill_res(res, reply_find_answer_rrset(&rq, rep), 
-               reply_find_final_cname_target(&rq, rep), &rq))
+               reply_find_final_cname_target(&rq, rep), &rq, rep))
                return; /* out of memory */
        /* rcode, havedata, nxdomain, secure, bogus */
        res->rcode = (int)FLAGS_GET_RCODE(rep->flags);
index 085f9f53415f1ae5d98e56a9ab6bb4ea15b22107..d435bf28d35e433283870e30f295d3c3c59dce17 100644 (file)
@@ -193,6 +193,12 @@ struct ub_result {
         * Is NULL if the result is not bogus.
         */
        char* why_bogus;
+
+       /**
+        * TTL for the result, in seconds.  If the security is bogus, then
+        * you also cannot trust this value.
+        */
+       int ttl;
 };
 
 /**
index 98d69433e3083b1ed8eb1cf0200be679d03632a4..9fdab51c108154e297eb74dcd109da5b475ca7f0 100644 (file)
@@ -449,8 +449,8 @@ lz_enter_rr_into_zone(struct local_zone* z, ldns_buffer* buf,
        struct local_data* node;
        struct local_rrset* rrset;
        struct packed_rrset_data* pd;
-       uint16_t rrtype, rrclass;
-       uint32_t ttl;
+       uint16_t rrtype = 0, rrclass = 0;
+       uint32_t ttl = 0;
        if(!get_rr_content(rrstr, &nm, &rrtype, &rrclass, &ttl, buf)) {
                log_err("bad local-data: %s", rrstr);
                return 0;
index ed52a551f9fc1c24af20e2a392b26e7338e20615..715aa4a6516bc9cff4df1f9fdc9ef73ce7eefd0d 100644 (file)
@@ -62,7 +62,8 @@
 #include "libunbound/unbound.h"
 #include <ldns/ldns.h>
 #ifdef HAVE_NSS
-#include <nss3/nss.h>
+/* nss3 */
+#include "nss.h"
 #endif
 
 /** verbosity for unbound-host app */
index 84d2ef566fd928ad07ee7cfe1cb8de5c524a4488..2fc67716134c4c607ef67064d9ff57ead463114e 100755 (executable)
@@ -51,7 +51,7 @@ for test in `ls *.tpkg`; do
                fi
        fi
        if test $SKIP -eq 0; then
-               echo $test
+               #echo -n "$test "
                sh ../testcode/mini_tpkg.sh -a ../.. exe $test
        else
                echo "skip $test"
index b6acacccb55c77aca08fb40801f6b70fa5dba213..26a71dad8dd1381c08a04c6b4ca0e6b3d54d97eb 100644 (file)
@@ -207,7 +207,7 @@ struct entry {
 /**
  * reads the canned reply file and returns a list of structs 
  * does an exit on error.
- * @param name: path of file
+ * @param name: name of the file to read.
  * @param skip_whitespace: skip leftside whitespace.
  */
 struct entry* read_datafile(const char* name, int skip_whitespace);
index ebf27a7d48a17dd36b47588d958b47a377be7ba3..cdc334e21e56e0c4a01766d171aa8ab2b746240b 100755 (executable)
@@ -26,7 +26,7 @@ if test "$1" = "report" || test "$2" = "report"; then
                        fi
                else
                        if test -f "result.$name"; then
-                               echo "!! FAILED !! : $name"
+                               echo "\033[01;31m!! FAILED !!\033[00m : $name"
                        else
                                echo ">> SKIPPED<< : $name"
                        fi
@@ -66,6 +66,8 @@ else
        shell="sh"
 fi
 
+echo -n "$name: \t"
+
 # check already done
 if test -f .done-$name; then
        echo "minitpkg .done-$name exists. skip test."
@@ -73,7 +75,7 @@ if test -f .done-$name; then
 fi
 
 # Extract
-echo "minitpkg extract $1 to $dir"
+#echo "minitpkg extract $1 to $dir"
 mkdir $dir
 gzip -cd $name.tpkg | (cd $dir; tar xf -)
 cd $dir
@@ -84,7 +86,7 @@ echo "minitpkg exe $name" > $result
 grep "Description:" $name.dsc >> $result 2>&1
 echo "DateRunStart: "`date "+%s" 2>/dev/null` >> $result
 if test -f $name.pre; then
-       echo "minitpkg exe $name.pre"
+       #echo "minitpkg exe $name.pre"
        echo "minitpkg exe $name.pre" >> $result
        $shell $name.pre $args >> $result
        if test $? -ne 0; then
@@ -92,22 +94,22 @@ if test -f $name.pre; then
        fi
 fi
 if test -f $name.test; then
-       echo "minitpkg exe $name.test"
+       #echo "minitpkg exe $name.test"
        echo "minitpkg exe $name.test" >> $result
        $shell $name.test $args >>$result 2>&1
        if test $? -ne 0; then
                echo "$name: FAILED" >> $result
-               echo "$name: FAILED"
+               echo "\033[01;31mFAILED\033[00m"
                success="no"
        else
                echo "$name: PASSED" >> $result
                echo "$name: PASSED" > ../.done-$name
-               echo "$name: PASSED"
+               echo "\033[01;32mPASSED\033[00m"
                success="yes"
        fi
 fi
 if test -f $name.post; then
-       echo "minitpkg exe $name.post"
+       #echo "minitpkg exe $name.post"
        echo "minitpkg exe $name.post" >> $result
        $shell $name.post $args >> $result
        if test $? -ne 0; then
index 6dcb95eb9f0e6c29c7dc1f0717879f4a9daef1a4..122f09b86149c53c5a2e75913e95c84b41ef49a0 100644 (file)
@@ -57,7 +57,8 @@
 #endif
 
 #ifdef HAVE_NSS
-#include "nss3/nss.h"
+/* nss3 */
+#include "nss.h"
 #endif
 
 #include <ldns/ldns.h>
index 8e3b2293ec671cd75ed013f8a41ddec80cf24b04..2a8ec7bb34bfd32183d0fc3a5cc31852dabd59da 100644 (file)
@@ -116,7 +116,7 @@ get_random_port () {
                # depending on uname try to check for collisions in port numbers
                case "`uname`" in
                linux|Linux)
-                       plist=`netstat -n -A ip -A ip6 -a | sed -e 's/^.*:\([0-9]*\) .*$/\1/'`
+                       plist=`netstat -n -A ip -A ip6 -a 2>/dev/null | sed -e 's/^.*:\([0-9]*\) .*$/\1/'`
                ;;
                FreeBSD|freebsd|NetBSD|netbsd|OpenBSD|openbsd)
                        plist=`netstat -n -a | grep "^[ut][dc]p[46] " | sed -e 's/^.*\.\([0-9]*\) .*$/\1/'`
index 151d695635f297aa1c65b4e3efc617dd93ec8766..adadef133c850ddf703d0804c19178e1758dbdc7 100644 (file)
Binary files a/testdata/fwd_zero.tpkg and b/testdata/fwd_zero.tpkg differ
diff --git a/testdata/nss_compile.tpkg b/testdata/nss_compile.tpkg
new file mode 100644 (file)
index 0000000..6be7bc4
Binary files /dev/null and b/testdata/nss_compile.tpkg differ
index d6d2ceedf0895e27f28a30cb281859700a1d2bf8..3d26078f6e975f58220d02afc15bd7d19ae1094c 100644 (file)
 7799,
 7800,
 7801,
+7802,
 7810,
 7845,
 7846,
index 054fa50860302e4653bf21fe8fec427b16062bee..64bd876dcbb1641a0934652b9323292a47af4181 100644 (file)
@@ -726,7 +726,7 @@ void* outgoing_ssl_fd(void* sslctx, int fd)
 #endif
 }
 
-#if defined(OPENSSL_THREADS) && !defined(THREADS_DISABLED)
+#if defined(HAVE_SSL) && defined(OPENSSL_THREADS) && !defined(THREADS_DISABLED)
 /** global lock list for openssl locks */
 static lock_basic_t *ub_openssl_locks = NULL;
 
@@ -751,7 +751,7 @@ ub_crypto_lock_cb(int mode, int type, const char *ATTR_UNUSED(file),
 
 int ub_openssl_lock_init(void)
 {
-#if defined(OPENSSL_THREADS) && !defined(THREADS_DISABLED)
+#if defined(HAVE_SSL) && defined(OPENSSL_THREADS) && !defined(THREADS_DISABLED)
        int i;
        ub_openssl_locks = (lock_basic_t*)malloc(
                sizeof(lock_basic_t)*CRYPTO_num_locks());
@@ -768,7 +768,7 @@ int ub_openssl_lock_init(void)
 
 void ub_openssl_lock_delete(void)
 {
-#if defined(OPENSSL_THREADS) && !defined(THREADS_DISABLED)
+#if defined(HAVE_SSL) && defined(OPENSSL_THREADS) && !defined(THREADS_DISABLED)
        int i;
        if(!ub_openssl_locks)
                return;
index 3c1c69d7e1b837861550466510b04f7ced0ce8ea..e30302a470fb0bedb9f367e5b3e4170fd335a6b7 100644 (file)
 #  endif /* USE_WINSOCK */
 #else /* USE_MINI_EVENT */
    /* we use libevent */
-#  include <event.h>
+#  ifdef HAVE_EVENT_H
+#    include <event.h>
+#  else
+#    include "event.h"
+#  endif
 #endif /* USE_MINI_EVENT */
 
 /**
index 5b61aef7f3bdbedfb94bd7d53fa37e4cd1f48f7e..5d71fcfa4c12d0460fec8ab63b487b8ff7f9041c 100644 (file)
 #include <openssl/rc4.h>
 #include <openssl/err.h>
 #elif defined(HAVE_NSS)
-#include <nspr4/prerror.h>
-#include <nss3/secport.h>
-#include <nss3/pk11pub.h>
+/* nspr4 */
+#include "prerror.h"
+/* nss3 */
+#include "secport.h"
+#include "pk11pub.h"
 #endif
 
 /** 
index 8195775d19abc383df610dc8adc9c553f1352e3b..a8c49863e0c45efe431dea5a253e1136ef4568d0 100644 (file)
@@ -1,4 +1,5 @@
 /*
+  February 2013(Wouter) patch defines for BSD endianness, from Brad Smith.
   January 2012(Wouter) added randomised initial value, fallout from 28c3.
   March 2007(Wouter) adapted from lookup3.c original, add config.h include.
      added #ifdef VALGRIND to remove 298,384,660 'unused variable k8' warnings.
@@ -52,6 +53,12 @@ on 1 byte), but shoehorning those bytes into integers efficiently is messy.
 #ifdef linux
 # include <endian.h>    /* attempt to define endianness */
 #endif
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__)
+#include <sys/endian.h> /* attempt to define endianness */
+#endif
+#ifdef __OpenBSD__
+#include <machine/endian.h> /* attempt to define endianness */
+#endif
 
 /* random initial value */
 static uint32_t raninit = (uint32_t)0xdeadbeef;
@@ -68,12 +75,19 @@ hash_set_raninit(uint32_t v)
  */
 #if (defined(__BYTE_ORDER) && defined(__LITTLE_ENDIAN) && \
      __BYTE_ORDER == __LITTLE_ENDIAN) || \
+    (defined(_BYTE_ORDER) && defined(_LITTLE_ENDIAN) && \
+     _BYTE_ORDER == _LITTLE_ENDIAN) || \
     (defined(i386) || defined(__i386__) || defined(__i486__) || \
      defined(__i586__) || defined(__i686__) || defined(vax) || defined(MIPSEL))
 # define HASH_LITTLE_ENDIAN 1
 # define HASH_BIG_ENDIAN 0
+#elif (!defined(_BYTE_ORDER) && !defined(__BYTE_ORDER) && defined(_BIG_ENDIAN))
+# define HASH_LITTLE_ENDIAN 0
+# define HASH_BIG_ENDIAN 1
 #elif (defined(__BYTE_ORDER) && defined(__BIG_ENDIAN) && \
        __BYTE_ORDER == __BIG_ENDIAN) || \
+      (defined(_BYTE_ORDER) && defined(_BIG_ENDIAN) && \
+       _BYTE_ORDER == _BIG_ENDIAN) || \
       (defined(sparc) || defined(POWERPC) || defined(mc68000) || defined(sel))
 # define HASH_LITTLE_ENDIAN 0
 # define HASH_BIG_ENDIAN 1
index bb75aeb6f082a2231d2274e70de4484f99054685..20580c0d755fc450ccb6290554eef3819f392fb6 100644 (file)
@@ -46,7 +46,8 @@
 #include "openssl/ssl.h"
 #endif
 #ifdef HAVE_NSS
-#include <nss3/sechash.h>
+/* nss3 */
+#include "sechash.h"
 #endif
 #include "validator/val_nsec3.h"
 #include "validator/validator.h"
index 676399733553907555b51c7a0e88cd6706deff5b..5cca578b1be150b0d6baff58bff13e383a65b8c9 100644 (file)
@@ -553,12 +553,14 @@ verify_canonrrset(ldns_buffer* buf, int algo, unsigned char* sigblock,
 /**************************************************/
 #elif defined(HAVE_NSS)
 /* libnss implementation */
-#include <nss3/sechash.h>
-#include <nss3/pk11pub.h>
-#include <nss3/keyhi.h>
-#include <nss3/secerr.h>
-#include <nss3/cryptohi.h>
-#include <nspr4/prerror.h>
+/* nss3 */
+#include "sechash.h"
+#include "pk11pub.h"
+#include "keyhi.h"
+#include "secerr.h"
+#include "cryptohi.h"
+/* nspr4 */
+#include "prerror.h"
 
 size_t
 ds_digest_size_supported(int algo)
index 7ac8b2611130983d652f4cf45babfdea9432e469..cafda7bca409ade2dac6ccf73e93b15a2997d018 100644 (file)
@@ -380,6 +380,9 @@ service_deinit(struct daemon* daemon, struct config_file* cfg)
        daemon_delete(daemon);
 }
 
+#ifdef DOXYGEN
+#define ATTR_UNUSED(x) x
+#endif
 /**
  * The main function for the service.
  * Called by the services API when starting unbound on windows in background.