From: Ralph Dolmans Date: Wed, 31 May 2017 11:45:39 +0000 (+0000) Subject: - Also use global local-zones when there is a matching view that does not have X-Git-Tag: release-1.6.4rc1~32 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=69828ed94bde188b4835e9346704100e9edbbd5d;p=thirdparty%2Funbound.git - Also use global local-zones when there is a matching view that does not have any local-zone specified. git-svn-id: file:///svn/unbound/trunk@4202 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/doc/Changelog b/doc/Changelog index b30fbe009..3b13a2c00 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,3 +1,7 @@ +31 May 2017: Ralph + - Also use global local-zones when there is a matching view that does + not have any local-zone specified. + 31 May 2017: Wouter - Fix #1273: cachedb.c doesn't compile with -Wextra. - If MSG_FASTOPEN gives EPIPE fallthrough to try normal tcp write. diff --git a/doc/unbound.conf.5.in b/doc/unbound.conf.5.in index c9979d47c..ed8cb11b3 100644 --- a/doc/unbound.conf.5.in +++ b/doc/unbound.conf.5.in @@ -1400,7 +1400,7 @@ clauses. Each with a \fBname:\fR and zero or more \fBlocal\-zone\fR and \fBlocal\-data\fR elements. View can be mapped to requests by specifying the view name in an \fBaccess\-control\-view\fR element. Options from matching views will override global options. Global options will be used if no matching -view is found. +view is found, or when the matching view does not have the option specified. .TP .B name: \fI Name of the view. Must be unique. This name is used in access\-control\-view @@ -1408,7 +1408,11 @@ elements. .TP .B local\-zone: \fI View specific local\-zone elements. Has the same types and behaviour as the -global local\-zone elements. +global local\-zone elements. When there is at least one local\-zone specified +and view\-first is no, the default local-zones will be added to this view. +Defaults can be disabled using the nodefault type. When view\-first is yes or +when a view does not have a local\-zone, the global local\-zone will be used +including it's default zones. .TP .B local\-data: \fI"" View specific local\-data elements. Has the same behaviour as the global diff --git a/services/localzone.c b/services/localzone.c index 3ab1ce861..a19b52526 100644 --- a/services/localzone.c +++ b/services/localzone.c @@ -1590,7 +1590,7 @@ local_zones_answer(struct local_zones* zones, struct module_env* env, lock_rw_rdlock(&z->lock); lzt = z->type; } - if(!z && !view->isfirst){ + if(view->local_zones && !z && !view->isfirst){ lock_rw_unlock(&view->lock); return 0; } diff --git a/services/view.c b/services/view.c index e7b3d692e..c6709e58f 100644 --- a/services/view.c +++ b/services/view.c @@ -178,9 +178,31 @@ views_apply_cfg(struct views* vs, struct config_file* cfg) * configured as type transparent */ for(nd = cv->local_zones_nodefault; nd; nd = nd->next) { - cfg_str2list_insert(&lz_cfg.local_zones, - strdup(nd->str), - strdup("nodefault")); + char* nd_str, *nd_type; + nd_str = strdup(nd->str); + if(!nd_str) { + log_err("out of memory"); + lock_rw_unlock(&v->lock); + return 0; + } + nd_type = strdup("nodefault"); + if(!nd_type) { + log_err("out of memory"); + free(nd_str); + lock_rw_unlock(&v->lock); + return 0; + } + if(!cfg_str2list_insert( + &lz_cfg.local_zones, nd_str, + nd_type)) { + log_err("failed to insert " + "default zones into " + "local-zone list"); + free(nd_str); + free(nd_type); + lock_rw_unlock(&v->lock); + return 0; + } } } if(!local_zones_apply_cfg(v->local_zones, &lz_cfg)){