diff options
Diffstat (limited to 'cachedb/cachedb.c')
-rw-r--r-- | cachedb/cachedb.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/cachedb/cachedb.c b/cachedb/cachedb.c index 80bdc380f3f6f..a6a609dcb68d5 100644 --- a/cachedb/cachedb.c +++ b/cachedb/cachedb.c @@ -43,6 +43,7 @@ #include "config.h" #ifdef USE_CACHEDB #include "cachedb/cachedb.h" +#include "cachedb/redis.h" #include "util/regional.h" #include "util/net_help.h" #include "util/config_file.h" @@ -56,7 +57,20 @@ #include "sldns/wire2str.h" #include "sldns/sbuffer.h" -#define CACHEDB_HASHSIZE 256 /* bit hash */ +/* header file for htobe64 */ +#ifdef HAVE_ENDIAN_H +# include <endian.h> +#endif +#ifdef HAVE_SYS_ENDIAN_H +# include <sys/endian.h> +#endif +#ifdef HAVE_LIBKERN_OSBYTEORDER_H +/* In practice this is specific to MacOS X. We assume it doesn't have +* htobe64/be64toh but has alternatives with a different name. */ +# include <libkern/OSByteOrder.h> +# define htobe64(x) OSSwapHostToBigInt64(x) +# define be64toh(x) OSSwapBigToHostInt64(x) +#endif /** the unit test testframe for cachedb, its module state contains * a cache for a couple queries (in memory). */ @@ -176,6 +190,10 @@ static struct cachedb_backend testframe_backend = { "testframe", static struct cachedb_backend* cachedb_find_backend(const char* str) { +#ifdef USE_REDIS + if(strcmp(str, redis_backend.name) == 0) + return &redis_backend; +#endif if(strcmp(str, testframe_backend.name) == 0) return &testframe_backend; /* TODO add more backends here */ @@ -571,7 +589,8 @@ cachedb_intcache_lookup(struct module_qstate* qstate) qstate->region, qstate->env->scratch, 1 /* no partial messages with only a CNAME */ ); - if(!msg && qstate->env->neg_cache) { + if(!msg && qstate->env->neg_cache && + iter_qname_indicates_dnssec(qstate->env, &qstate->qinfo)) { /* lookup in negative cache; may result in * NOERROR/NODATA or NXDOMAIN answers that need validation */ msg = val_neg_getmsg(qstate->env->neg_cache, &qstate->qinfo, |