]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
localzon setup.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Tue, 20 Nov 2007 16:38:41 +0000 (16:38 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Tue, 20 Nov 2007 16:38:41 +0000 (16:38 +0000)
git-svn-id: file:///svn/unbound/trunk@772 be551aaa-1e26-0410-a405-d3ace91eadb9

doc/unbound.conf.5
services/localzone.c [new file with mode: 0644]
services/localzone.h [new file with mode: 0644]
util/config_file.h

index e9a0f43a8dac471f020e2779bd64abc9ea403fb4..a904a797c4efd1609bb3203172cd1b2827cece77 100644 (file)
@@ -326,7 +326,7 @@ Configure a local zone. The type determines the answer to give if there is
 no match from local-data. The types are deny, refuse, static, transparent, 
 redirect, nodefault, and are explained below. After that the default settings
 are listed. Use local-data: to enter data into the local zone. Answers for
-local zones are authoritative DNS answers.
+local zones are authoritative DNS answers. By default the zones are class IN.
 .Bl -tag -width indent
 .It \fIdeny\fR 
 Do not send an answer, drop the query.
diff --git a/services/localzone.c b/services/localzone.c
new file mode 100644 (file)
index 0000000..f27e226
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * services/localzone.c - local zones authority service.
+ *
+ * Copyright (c) 2007, NLnet Labs. All rights reserved.
+ *
+ * This software is open source.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 
+ * Neither the name of the NLNET LABS nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * \file
+ *
+ * This file contains functions to enable local zone authority service.
+ */
+#include "config.h"
+#include "services/localzone.h"
+
diff --git a/services/localzone.h b/services/localzone.h
new file mode 100644 (file)
index 0000000..606b4ab
--- /dev/null
@@ -0,0 +1,135 @@
+/*
+ * services/localzone.h - local zones authority service.
+ *
+ * Copyright (c) 2007, NLnet Labs. All rights reserved.
+ *
+ * This software is open source.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 
+ * Neither the name of the NLNET LABS nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * \file
+ *
+ * This file contains functions to enable local zone authority service.
+ */
+
+#ifndef SERVICES_LOCALZONE_H
+#define SERVICES_LOCALZONE_H
+#include "util/rbtree.h"
+struct ub_packed_rrset_key;
+struct regional;
+
+/**
+ * Local zone type
+ * This type determines processing for queries that did not match
+ * local-data directly.
+ */
+enum localzone_type {
+       /** drop query */
+       local_zone_deny = 0,
+       /** answer with error */
+       local_zone_refuse,
+       /** answer nxdomain or nodata */
+       local_zone_static,
+       /** resolve normally */
+       local_zone_transparent,
+       /** answer with data at zone apex */
+       local_zone_redirect,
+       /** remove default AS112 blocking contents for zone
+        * nodefault is used in config not during service. */
+       local_zone_nodefault
+};
+
+/**
+ * Local zones storage, shared.
+ * Fixed at startup, so, readonly, no locks or mutexes necessary.
+ */
+struct local_zones {
+       /** rbtree of struct local_zone */
+       rbtree_t zones;
+};
+
+/**
+ * Local zone. A locally served authoritative zone.
+ */
+struct local_zone {
+       /** rbtree node, key is name and class */
+       rbnode_t node;
+       /** parent zone, if any. */
+       struct local_zone* parent;
+
+       /** zone name, in uncompressed wireformat */
+       uint8_t* name;
+       /** length of zone name */
+       size_t name_len;
+       /** number of labels in zone name */
+       int name_labs;
+       /** the class of this zone */
+       uint16_t dclass;
+
+       /** how to process zone */
+       enum localzone_type type;
+
+       /** in this region the zone's data is allocated.
+        * the struct local_zone itself is malloced. */
+       struct regional* region;
+       /** local data for this zone
+        * rbtree of struct local_data */
+       rbtree_t data;
+       /** if data contains zone apex SOA data, this is a ptr to it. */
+       struct ub_packed_rrset_key* apex;
+};
+
+/**
+ * Local data. One domain name, and the RRs to go with it.
+ */
+struct local_data {
+       /** rbtree node, key is name only */
+       rbnode_t node;
+       /** domain name */
+       uint8_t* name;
+       /** length of name */
+       size_t namelen;
+       /** number of labels in name */
+       int namelabs;
+       /** the data rrsets, match type and class, linked list */
+       struct local_rrset* rrsets;
+};
+
+/**
+ * A local data RRset
+ */
+struct local_rrset {
+       /** next in list */
+       struct local_rrset* next;
+       /** RRset data item */
+       struct ub_packed_rrset_key* rrset;
+};
+
+#endif /* SERVICES_LOCALZONE_H */
index 4dcf05ece6a457484cb2463c8a35bf8016c5f54f..940450b0c1a3b4fb92ada55add3a4405a4ac5b91 100644 (file)
@@ -271,7 +271,7 @@ int cfg_strlist_insert(struct config_strlist** head, char* item);
  * Insert string into str2list.
  * @param head: pointer to str2list head variable.
  * @param item: new item. malloced by caller. If NULL the insertion fails.
- * @param item: 2nd string, malloced by caller. If NULL the insertion fails.
+ * @param i2: 2nd string, malloced by caller. If NULL the insertion fails.
  * @return: true on success.
  */
 int cfg_str2list_insert(struct config_str2list** head, char* item, char* i2);