]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Also use global local-zones when there is a matching view that does not have
authorRalph Dolmans <ralph@nlnetlabs.nl>
Wed, 31 May 2017 11:45:39 +0000 (11:45 +0000)
committerRalph Dolmans <ralph@nlnetlabs.nl>
Wed, 31 May 2017 11:45:39 +0000 (11:45 +0000)
  any local-zone specified.

git-svn-id: file:///svn/unbound/trunk@4202 be551aaa-1e26-0410-a405-d3ace91eadb9

doc/Changelog
doc/unbound.conf.5.in
services/localzone.c
services/view.c

index b30fbe00921f939a34938281fe492beec941fb1a..3b13a2c00a7c597ba194c5571e5b11f0b60c3d9a 100644 (file)
@@ -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.
index c9979d47c883a63b05bce1e0af03cc1e6dcd19cc..ed8cb11b3e04aa963f7c0f7ef377296aa5a175ff 100644 (file)
@@ -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<view name>
 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<zone> <type>
 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"<resource record string>"
 View specific local\-data elements. Has the same behaviour as the global
index 3ab1ce8618af261168f811e9f372f8dafbd4ab1b..a19b5252643f3b538bd02a73a56a9667d59feed3 100644 (file)
@@ -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;
                }
index e7b3d692e15a97a2aa8be95908a7c27365019783..c6709e58fd6ac729480b3a7b7bd1e8d34de5df9a 100644 (file)
@@ -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)){