Skip to content

Commit b23387a

Browse files
committed
Merge remote-tracking branch 'nlnet/master'
* nlnet/master: (35 commits) - Add unit test for validation of repeated use of a DNAME record. - Fix validation for repeated use of a DNAME record. - Fix typos for 'the the' in text. - Fix memory leak in setup of dsa sig. - Skip unbound-dnstap-socket unit test when not compiled with --enable-debug. - Fix to squelch connection reset by peer errors from log. And fix that the tcp read errors are labeled as initial for the first calls. - Fix memory leak on exit for unbound-dnstap-socket; creates false negatives during testing. - Fix memory leak when reload_keep_cache is used and num-threads changes. - Enable AddressSanitizer error detection in tdir tests. - Fix for NLnetLabs#1079: fix RPZ taglist in iterator callback that no client info is like no taglist intersection. - Fix NLnetLabs#1079: tags from tagged rpz zones are no longer honored after upgrade from 1.19.3 to 1.20.0. Changelog note for NLnetLabs#1078. - Merge NLnetLabs#1078: Only check old pid if no username. Only check old pid if no username - Update patch to remove 'command' shell builtin and update error text. unbound-control-setup: check openssl - Fix unused variable warning on compilation with no thread support. - Fix spelling of tcp-idle-timeout docs, from Michael Tokarev. - Fix to enable that SERVFAIL is cached, for a short period, for more cases. In the cases where limits are exceeded. Changelog entry for NLnetLabs#1059: - Fix NLnetLabs#1059: Intermittent DNS blocking failure with local-zone and always_nxdomain. Addition of local_zones dynamically via unbound-control was not finding the zone's parent correctly. Proper parent identification for dynamically entered local zones (NLnetLabs#1076) ...
2 parents 8c096c1 + 9603924 commit b23387a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+2069
-982
lines changed

cachedb/cachedb.c

Lines changed: 31 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -322,30 +322,30 @@ error_response(struct module_qstate* qstate, int id, int rcode)
322322

323323
/**
324324
* Hash the query name, type, class and dbacess-secret into lookup buffer.
325-
* @param qstate: query state with query info
326-
* and env->cfg with secret.
325+
* @param qinfo: query info
326+
* @param env: with env->cfg with secret.
327327
* @param buf: returned buffer with hash to lookup
328328
* @param len: length of the buffer.
329329
*/
330330
static void
331-
calc_hash(struct module_qstate* qstate, char* buf, size_t len)
331+
calc_hash(struct query_info* qinfo, struct module_env* env, char* buf,
332+
size_t len)
332333
{
333334
uint8_t clear[1024];
334335
size_t clen = 0;
335336
uint8_t hash[CACHEDB_HASHSIZE/8];
336337
const char* hex = "0123456789ABCDEF";
337-
const char* secret = qstate->env->cfg->cachedb_secret;
338+
const char* secret = env->cfg->cachedb_secret;
338339
size_t i;
339340

340341
/* copy the hash info into the clear buffer */
341-
if(clen + qstate->qinfo.qname_len < sizeof(clear)) {
342-
memmove(clear+clen, qstate->qinfo.qname,
343-
qstate->qinfo.qname_len);
344-
clen += qstate->qinfo.qname_len;
342+
if(clen + qinfo->qname_len < sizeof(clear)) {
343+
memmove(clear+clen, qinfo->qname, qinfo->qname_len);
344+
clen += qinfo->qname_len;
345345
}
346346
if(clen + 4 < sizeof(clear)) {
347-
uint16_t t = htons(qstate->qinfo.qtype);
348-
uint16_t c = htons(qstate->qinfo.qclass);
347+
uint16_t t = htons(qinfo->qtype);
348+
uint16_t c = htons(qinfo->qclass);
349349
memmove(clear+clen, &t, 2);
350350
memmove(clear+clen+2, &c, 2);
351351
clen += 4;
@@ -645,7 +645,7 @@ cachedb_extcache_lookup(struct module_qstate* qstate, struct cachedb_env* ie,
645645
int* msg_expired)
646646
{
647647
char key[(CACHEDB_HASHSIZE/8)*2+1];
648-
calc_hash(qstate, key, sizeof(key));
648+
calc_hash(&qstate->qinfo, qstate->env, key, sizeof(key));
649649

650650
/* call backend to fetch data for key into scratch buffer */
651651
if( !(*ie->backend->lookup)(qstate->env, ie, key,
@@ -672,7 +672,7 @@ static void
672672
cachedb_extcache_store(struct module_qstate* qstate, struct cachedb_env* ie)
673673
{
674674
char key[(CACHEDB_HASHSIZE/8)*2+1];
675-
calc_hash(qstate, key, sizeof(key));
675+
calc_hash(&qstate->qinfo, qstate->env, key, sizeof(key));
676676

677677
/* prepare data in scratch buffer */
678678
if(!prep_data(qstate, qstate->env->scratch_buffer))
@@ -745,6 +745,10 @@ cachedb_intcache_store(struct module_qstate* qstate, int msg_expired)
745745
* going to be now-3 seconds. Making it expired
746746
* in the cache. */
747747
set_msg_ttl(qstate->return_msg, (time_t)-3);
748+
/* The expired entry does not get checked by the validator
749+
* and we need a validation value for it. */
750+
if(qstate->env->cfg->cachedb_check_when_serve_expired)
751+
qstate->return_msg->rep->security = sec_status_insecure;
748752
}
749753
(void)dns_cache_store(qstate->env, &qstate->qinfo,
750754
qstate->return_msg->rep, 0, qstate->prefetch_leeway, 0,
@@ -1003,21 +1007,26 @@ cachedb_is_enabled(struct module_stack* mods, struct module_env* env)
10031007
}
10041008

10051009
void cachedb_msg_remove(struct module_qstate* qstate)
1010+
{
1011+
cachedb_msg_remove_qinfo(qstate->env, &qstate->qinfo);
1012+
}
1013+
1014+
void cachedb_msg_remove_qinfo(struct module_env* env, struct query_info* qinfo)
10061015
{
10071016
char key[(CACHEDB_HASHSIZE/8)*2+1];
1008-
int id = modstack_find(qstate->env->modstack, "cachedb");
1009-
struct cachedb_env* ie = (struct cachedb_env*)qstate->env->modinfo[id];
1017+
int id = modstack_find(env->modstack, "cachedb");
1018+
struct cachedb_env* ie = (struct cachedb_env*)env->modinfo[id];
10101019

1011-
log_query_info(VERB_ALGO, "cachedb msg remove", &qstate->qinfo);
1012-
calc_hash(qstate, key, sizeof(key));
1013-
sldns_buffer_clear(qstate->env->scratch_buffer);
1014-
sldns_buffer_write_u32(qstate->env->scratch_buffer, 0);
1015-
sldns_buffer_flip(qstate->env->scratch_buffer);
1020+
log_query_info(VERB_ALGO, "cachedb msg remove", qinfo);
1021+
calc_hash(qinfo, env, key, sizeof(key));
1022+
sldns_buffer_clear(env->scratch_buffer);
1023+
sldns_buffer_write_u32(env->scratch_buffer, 0);
1024+
sldns_buffer_flip(env->scratch_buffer);
10161025

10171026
/* call backend */
1018-
(*ie->backend->store)(qstate->env, ie, key,
1019-
sldns_buffer_begin(qstate->env->scratch_buffer),
1020-
sldns_buffer_limit(qstate->env->scratch_buffer),
1027+
(*ie->backend->store)(env, ie, key,
1028+
sldns_buffer_begin(env->scratch_buffer),
1029+
sldns_buffer_limit(env->scratch_buffer),
10211030
0);
10221031
}
10231032
#endif /* USE_CACHEDB */

cachedb/cachedb.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,3 +126,11 @@ int cachedb_is_enabled(struct module_stack* mods, struct module_env* env);
126126
* @param qstate: query state.
127127
*/
128128
void cachedb_msg_remove(struct module_qstate* qstate);
129+
130+
/**
131+
* Remove message from the cachedb cache, by query info.
132+
* @param env: module environment to look up cachedb state.
133+
* @param qinfo: the message to remove.
134+
*/
135+
void cachedb_msg_remove_qinfo(struct module_env* env,
136+
struct query_info* qinfo);

configure

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#! /bin/sh
22
# Guess values for system-dependent variables and create Makefiles.
3-
# Generated by GNU Autoconf 2.71 for unbound 1.20.0.
3+
# Generated by GNU Autoconf 2.71 for unbound 1.20.1.
44
#
55
# Report bugs to <unbound-bugs@nlnetlabs.nl or https://github.com/NLnetLabs/unbound/issues>.
66
#
@@ -622,8 +622,8 @@ MAKEFLAGS=
622622
# Identity of this package.
623623
PACKAGE_NAME='unbound'
624624
PACKAGE_TARNAME='unbound'
625-
PACKAGE_VERSION='1.20.0'
626-
PACKAGE_STRING='unbound 1.20.0'
625+
PACKAGE_VERSION='1.20.1'
626+
PACKAGE_STRING='unbound 1.20.1'
627627
PACKAGE_BUGREPORT='unbound-bugs@nlnetlabs.nl or https://github.com/NLnetLabs/unbound/issues'
628628
PACKAGE_URL=''
629629

@@ -1508,7 +1508,7 @@ if test "$ac_init_help" = "long"; then
15081508
# Omit some internal or obsolete options to make the list less imposing.
15091509
# This message is too long to be a string in the A/UX 3.1 sh.
15101510
cat <<_ACEOF
1511-
\`configure' configures unbound 1.20.0 to adapt to many kinds of systems.
1511+
\`configure' configures unbound 1.20.1 to adapt to many kinds of systems.
15121512

15131513
Usage: $0 [OPTION]... [VAR=VALUE]...
15141514

@@ -1574,7 +1574,7 @@ fi
15741574

15751575
if test -n "$ac_init_help"; then
15761576
case $ac_init_help in
1577-
short | recursive ) echo "Configuration of unbound 1.20.0:";;
1577+
short | recursive ) echo "Configuration of unbound 1.20.1:";;
15781578
esac
15791579
cat <<\_ACEOF
15801580

@@ -1821,7 +1821,7 @@ fi
18211821
test -n "$ac_init_help" && exit $ac_status
18221822
if $ac_init_version; then
18231823
cat <<\_ACEOF
1824-
unbound configure 1.20.0
1824+
unbound configure 1.20.1
18251825
generated by GNU Autoconf 2.71
18261826

18271827
Copyright (C) 2021 Free Software Foundation, Inc.
@@ -2478,7 +2478,7 @@ cat >config.log <<_ACEOF
24782478
This file contains any messages produced by compilers while
24792479
running configure, to aid debugging if configure makes a mistake.
24802480

2481-
It was created by unbound $as_me 1.20.0, which was
2481+
It was created by unbound $as_me 1.20.1, which was
24822482
generated by GNU Autoconf 2.71. Invocation command line was
24832483

24842484
$ $0$ac_configure_args_raw
@@ -3242,11 +3242,11 @@ UNBOUND_VERSION_MAJOR=1
32423242

32433243
UNBOUND_VERSION_MINOR=20
32443244

3245-
UNBOUND_VERSION_MICRO=0
3245+
UNBOUND_VERSION_MICRO=1
32463246

32473247

32483248
LIBUNBOUND_CURRENT=9
3249-
LIBUNBOUND_REVISION=27
3249+
LIBUNBOUND_REVISION=28
32503250
LIBUNBOUND_AGE=1
32513251
# 1.0.0 had 0:12:0
32523252
# 1.0.1 had 0:13:0
@@ -3341,6 +3341,7 @@ LIBUNBOUND_AGE=1
33413341
# 1.19.2 had 9:25:1
33423342
# 1.19.3 had 9:26:1
33433343
# 1.20.0 had 9:27:1
3344+
# 1.20.1 had 9:28:1
33443345

33453346
# Current -- the number of the binary API that we're implementing
33463347
# Revision -- which iteration of the implementation of the binary
@@ -24466,7 +24467,7 @@ printf "%s\n" "#define MAXSYSLOGMSGLEN 10240" >>confdefs.h
2446624467

2446724468

2446824469

24469-
version=1.20.0
24470+
version=1.20.1
2447024471

2447124472
date=`date +'%b %e, %Y'`
2447224473

@@ -24978,7 +24979,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
2497824979
# report actual input values of CONFIG_FILES etc. instead of their
2497924980
# values after options handling.
2498024981
ac_log="
24981-
This file was extended by unbound $as_me 1.20.0, which was
24982+
This file was extended by unbound $as_me 1.20.1, which was
2498224983
generated by GNU Autoconf 2.71. Invocation command line was
2498324984

2498424985
CONFIG_FILES = $CONFIG_FILES
@@ -25046,7 +25047,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
2504625047
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
2504725048
ac_cs_config='$ac_cs_config_escaped'
2504825049
ac_cs_version="\\
25049-
unbound config.status 1.20.0
25050+
unbound config.status 1.20.1
2505025051
configured by $0, generated by GNU Autoconf 2.71,
2505125052
with options \\"\$ac_cs_config\\"
2505225053

configure.ac

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ sinclude(dnscrypt/dnscrypt.m4)
1111
# must be numbers. ac_defun because of later processing
1212
m4_define([VERSION_MAJOR],[1])
1313
m4_define([VERSION_MINOR],[20])
14-
m4_define([VERSION_MICRO],[0])
14+
m4_define([VERSION_MICRO],[1])
1515
AC_INIT([unbound],m4_defn([VERSION_MAJOR]).m4_defn([VERSION_MINOR]).m4_defn([VERSION_MICRO]),[unbound-bugs@nlnetlabs.nl or https://github.com/NLnetLabs/unbound/issues],[unbound])
1616
AC_SUBST(UNBOUND_VERSION_MAJOR, [VERSION_MAJOR])
1717
AC_SUBST(UNBOUND_VERSION_MINOR, [VERSION_MINOR])
1818
AC_SUBST(UNBOUND_VERSION_MICRO, [VERSION_MICRO])
1919

2020
LIBUNBOUND_CURRENT=9
21-
LIBUNBOUND_REVISION=27
21+
LIBUNBOUND_REVISION=28
2222
LIBUNBOUND_AGE=1
2323
# 1.0.0 had 0:12:0
2424
# 1.0.1 had 0:13:0
@@ -113,6 +113,7 @@ LIBUNBOUND_AGE=1
113113
# 1.19.2 had 9:25:1
114114
# 1.19.3 had 9:26:1
115115
# 1.20.0 had 9:27:1
116+
# 1.20.1 had 9:28:1
116117

117118
# Current -- the number of the binary API that we're implementing
118119
# Revision -- which iteration of the implementation of the binary

daemon/daemon.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,10 @@ daemon_clear_allocs(struct daemon* daemon)
503503
{
504504
int i;
505505

506-
for(i=0; i<daemon->num; i++) {
506+
/* daemon->num may be different during reloads (after configuration
507+
* read). Use old_num which has the correct value used to setup the
508+
* worker_allocs */
509+
for(i=0; i<daemon->old_num; i++) {
507510
alloc_clear(daemon->worker_allocs[i]);
508511
free(daemon->worker_allocs[i]);
509512
}

0 commit comments

Comments
 (0)