BIND 10 trac1947-cont, updated. eabb375e7dfc94f67aab7e4d8e372d71db9885c1 [1976] Provide default configuration for static data source
BIND 10 source code commits
bind10-changes at lists.isc.org
Wed Jul 4 09:10:25 UTC 2012
The branch, trac1947-cont has been updated
via eabb375e7dfc94f67aab7e4d8e372d71db9885c1 (commit)
via a0607f2c1a78586f6f54490c5a0c9e284a2caefc (commit)
via 95833885795b723c5c1586d23827ea42c37b1789 (commit)
via 97659d0862864670a3b45e8ae2c672b0d7029b2b (commit)
via b7c8ced3bac54e5e4560bdc39d15a74f4636fd88 (commit)
from 90593cc3f05fbd272f11fc57c876487f9dbc3813 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit eabb375e7dfc94f67aab7e4d8e372d71db9885c1
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Wed Jul 4 11:08:46 2012 +0200
[1976] Provide default configuration for static data source
So users don't have to set it up, but they can disable it if they want.
commit a0607f2c1a78586f6f54490c5a0c9e284a2caefc
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Wed Jul 4 11:04:49 2012 +0200
[1976] Load defaults
Due to some bugs, if nothing is set, the default is not taken into
account. This workaround assures it is loaded at startup. Any future
update is because of a change, so it will work as well.
commit 95833885795b723c5c1586d23827ea42c37b1789
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Wed Jul 4 11:02:19 2012 +0200
[1976] Take the correct part of configuration
Actually, we needed a subitem of the configuration. We can't have a
top-level named set, so we need to extract the named set in the
callback.
commit 97659d0862864670a3b45e8ae2c672b0d7029b2b
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Wed Jul 4 10:58:22 2012 +0200
[1976] Provide only one error message
When we don't find a list for the given class, we should provide only
one answer, not pack two error messages into the same packet.
commit b7c8ced3bac54e5e4560bdc39d15a74f4636fd88
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Wed Jul 4 10:54:46 2012 +0200
[1976] Make the static zone servable
The Query class insists there must be a NS record at the origin, so
adding one. It points to non-existing A record, but that does not seem
to be a problem (and the NS makes no sense in this case anyway).
-----------------------------------------------------------------------
Summary of changes:
configure.ac | 1 +
src/bin/auth/auth_srv.cc | 1 +
src/bin/auth/datasrc_configurator.h | 4 +++-
src/bin/auth/main.cc | 5 +++++
.../auth/tests/datasrc_configurator_unittest.cc | 22 +++++++++++++-------
src/bin/cfgmgr/plugins/Makefile.am | 5 ++++-
.../plugins/{datasrc.spec => datasrc.spec.pre.in} | 10 ++++++++-
src/lib/datasrc/static.zone.pre | 2 ++
8 files changed, 39 insertions(+), 11 deletions(-)
rename src/bin/cfgmgr/plugins/{datasrc.spec => datasrc.spec.pre.in} (87%)
-----------------------------------------------------------------------
diff --git a/configure.ac b/configure.ac
index 70df25d..cc68f4b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1137,6 +1137,7 @@ AC_CONFIG_FILES([Makefile
AC_OUTPUT([doc/version.ent
src/bin/cfgmgr/b10-cfgmgr.py
src/bin/cfgmgr/tests/b10-cfgmgr_test.py
+ src/bin/cfgmgr/plugins/datasrc.spec.pre
src/bin/cmdctl/cmdctl.py
src/bin/cmdctl/run_b10-cmdctl.sh
src/bin/cmdctl/tests/cmdctl_test
diff --git a/src/bin/auth/auth_srv.cc b/src/bin/auth/auth_srv.cc
index ce2f00c..dbba26f 100644
--- a/src/bin/auth/auth_srv.cc
+++ b/src/bin/auth/auth_srv.cc
@@ -675,6 +675,7 @@ AuthSrvImpl::processNormalQuery(const IOMessage& io_message, Message& message,
query_.process(*list, qname, qtype, message, dnssec_ok);
} else {
makeErrorMessage(renderer_, message, buffer, Rcode::REFUSED());
+ return (true);
}
} catch (const Exception& ex) {
LOG_ERROR(auth_logger, AUTH_PROCESS_FAIL).arg(ex.what());
diff --git a/src/bin/auth/datasrc_configurator.h b/src/bin/auth/datasrc_configurator.h
index 6197d34..a4fb2a0 100644
--- a/src/bin/auth/datasrc_configurator.h
+++ b/src/bin/auth/datasrc_configurator.h
@@ -48,7 +48,9 @@ private:
isc::data::ConstElementPtr config,
const isc::config::ConfigData&)
{
- reconfigure(config);
+ if (config->contains("classes")) {
+ reconfigure(config->get("classes"));
+ }
}
static Server* server_;
static isc::config::ModuleCCSession* session_;
diff --git a/src/bin/auth/main.cc b/src/bin/auth/main.cc
index 4207ba6..be854c9 100644
--- a/src/bin/auth/main.cc
+++ b/src/bin/auth/main.cc
@@ -207,6 +207,11 @@ main(int argc, char* argv[]) {
// Start the data source configuration
DataSourceConfigurator::init(config_session, auth_server);
+ // HACK: The default is not passed to the handler. This one will
+ // get the default (or, current value). Further updates will work
+ // the usual way.
+ DataSourceConfigurator::reconfigure(
+ config_session->getRemoteConfigValue("data_sources", "classes"));
// Now start asynchronous read.
config_session->start();
diff --git a/src/bin/auth/tests/datasrc_configurator_unittest.cc b/src/bin/auth/tests/datasrc_configurator_unittest.cc
index c7b90a7..9c009fd 100644
--- a/src/bin/auth/tests/datasrc_configurator_unittest.cc
+++ b/src/bin/auth/tests/datasrc_configurator_unittest.cc
@@ -115,9 +115,15 @@ protected:
void SetUp() {
init();
}
+ ElementPtr buildConfig(const string& config) const {
+ const ElementPtr internal(Element::fromJSON(config));
+ const ElementPtr external(Element::fromJSON("{\"version\": 1}"));
+ external->set("classes", internal);
+ return (external);
+ }
void doInInit() {
const ElementPtr
- config(Element::fromJSON("{\"IN\": [{\"type\": \"xxx\"}]}"));
+ config(buildConfig("{\"IN\": [{\"type\": \"xxx\"}]}"));
session.addMessage(createCommand("config_update", config), "data_sources",
"*");
mccs->checkCommand();
@@ -163,7 +169,7 @@ TEST_F(DatasrcConfiguratorTest, modifyList) {
doInInit();
// And now change the configuration of the list
const ElementPtr
- config(Element::fromJSON("{\"IN\": [{\"type\": \"yyy\"}]}"));
+ config(buildConfig("{\"IN\": [{\"type\": \"yyy\"}]}"));
session.addMessage(createCommand("config_update", config), "data_sources",
"*");
log_ = "";
@@ -177,7 +183,7 @@ TEST_F(DatasrcConfiguratorTest, modifyList) {
// Check we can have multiple lists at once
TEST_F(DatasrcConfiguratorTest, multiple) {
const ElementPtr
- config(Element::fromJSON("{\"IN\": [{\"type\": \"yyy\"}], "
+ config(buildConfig("{\"IN\": [{\"type\": \"yyy\"}], "
"\"CH\": [{\"type\": \"xxx\"}]}"));
session.addMessage(createCommand("config_update", config), "data_sources",
"*");
@@ -198,8 +204,8 @@ TEST_F(DatasrcConfiguratorTest, multiple) {
TEST_F(DatasrcConfiguratorTest, updateAdd) {
doInInit();
const ElementPtr
- config(Element::fromJSON("{\"IN\": [{\"type\": \"yyy\"}], "
- "\"CH\": [{\"type\": \"xxx\"}]}"));
+ config(buildConfig("{\"IN\": [{\"type\": \"yyy\"}], "
+ "\"CH\": [{\"type\": \"xxx\"}]}"));
session.addMessage(createCommand("config_update", config), "data_sources",
"*");
log_ = "";
@@ -216,7 +222,7 @@ TEST_F(DatasrcConfiguratorTest, updateAdd) {
TEST_F(DatasrcConfiguratorTest, updateDelete) {
doInInit();
const ElementPtr
- config(Element::fromJSON("{}"));
+ config(buildConfig("{}"));
session.addMessage(createCommand("config_update", config), "data_sources",
"*");
log_ = "";
@@ -230,8 +236,8 @@ TEST_F(DatasrcConfiguratorTest, rollbackAddition) {
doInInit();
// The configuration is wrong. However, the CH one will get done first.
const ElementPtr
- config(Element::fromJSON("{\"IN\": [{\"type\": 13}], "
- "\"CH\": [{\"type\": \"xxx\"}]}"));
+ config(buildConfig("{\"IN\": [{\"type\": 13}], "
+ "\"CH\": [{\"type\": \"xxx\"}]}"));
session.addMessage(createCommand("config_update", config), "data_sources",
"*");
log_ = "";
diff --git a/src/bin/cfgmgr/plugins/Makefile.am b/src/bin/cfgmgr/plugins/Makefile.am
index a6a3362..4431127 100644
--- a/src/bin/cfgmgr/plugins/Makefile.am
+++ b/src/bin/cfgmgr/plugins/Makefile.am
@@ -1,6 +1,9 @@
SUBDIRS = tests
-EXTRA_DIST = README logging.spec tsig_keys.spec datasrc.spec
+EXTRA_DIST = README logging.spec tsig_keys.spec
+
+datasrc.spec: datasrc.spec.pre
+ $(SED) -e "s|@@PKGDATADIR@@|$(pkgdatadir)|" datasrc.spec.pre >$@
config_plugindir = @prefix@/share/@PACKAGE@/config_plugins
config_plugin_DATA = logging.spec tsig_keys.spec datasrc.spec
diff --git a/src/bin/cfgmgr/plugins/datasrc.spec b/src/bin/cfgmgr/plugins/datasrc.spec
deleted file mode 100644
index fb06792..0000000
--- a/src/bin/cfgmgr/plugins/datasrc.spec
+++ /dev/null
@@ -1,58 +0,0 @@
-{
- "module_spec": {
- "module_name": "data_sources",
- "module_description": "The sources of authoritative DNS data",
- "config_data": [
- {
- "item_name": "classes",
- "item_type": "named_set",
- "item_optional": false,
- "item_default": {},
- "named_set_item_spec": {
- "item_name": "class",
- "item_type": "list",
- "item_optional": false,
- "item_default": [],
- "list_item_spec": {
- "item_name": "source",
- "item_type": "map",
- "item_optional": false,
- "item_default": {},
- "map_item_spec": [
- {
- "item_name": "type",
- "item_type": "string",
- "item_optional": false,
- "item_default": ""
- },
- {
- "item_name": "params",
- "item_type": "any",
- "item_optional": false,
- "item_default": null
- },
- {
- "item_name": "cache-enable",
- "item_type": "boolean",
- "item_optional": false,
- "item_default": false
- },
- {
- "item_name": "cache-zones",
- "item_type": "list",
- "item_optional": true,
- "list_item_spec": {
- "item_name": "zone",
- "item_type": "string",
- "item_optional": false,
- "item_default": ""
- }
- }
- ]
- }
- }
- }
- ],
- "commands": []
- }
-}
diff --git a/src/bin/cfgmgr/plugins/datasrc.spec.pre.in b/src/bin/cfgmgr/plugins/datasrc.spec.pre.in
new file mode 100644
index 0000000..5bd20bb
--- /dev/null
+++ b/src/bin/cfgmgr/plugins/datasrc.spec.pre.in
@@ -0,0 +1,66 @@
+{
+ "module_spec": {
+ "module_name": "data_sources",
+ "module_description": "The sources of authoritative DNS data",
+ "config_data": [
+ {
+ "item_name": "classes",
+ "item_type": "named_set",
+ "item_optional": false,
+ "item_default": {
+ "CH": [
+ {
+ "type": "static",
+ "cache-enable": false,
+ "params": "@@PKGDATADIR@@/static.zone"
+ }
+ ]
+ },
+ "named_set_item_spec": {
+ "item_name": "class",
+ "item_type": "list",
+ "item_optional": false,
+ "item_default": [],
+ "list_item_spec": {
+ "item_name": "source",
+ "item_type": "map",
+ "item_optional": false,
+ "item_default": {},
+ "map_item_spec": [
+ {
+ "item_name": "type",
+ "item_type": "string",
+ "item_optional": false,
+ "item_default": ""
+ },
+ {
+ "item_name": "params",
+ "item_type": "any",
+ "item_optional": false,
+ "item_default": null
+ },
+ {
+ "item_name": "cache-enable",
+ "item_type": "boolean",
+ "item_optional": false,
+ "item_default": false
+ },
+ {
+ "item_name": "cache-zones",
+ "item_type": "list",
+ "item_optional": true,
+ "list_item_spec": {
+ "item_name": "zone",
+ "item_type": "string",
+ "item_optional": false,
+ "item_default": ""
+ }
+ }
+ ]
+ }
+ }
+ }
+ ],
+ "commands": []
+ }
+}
diff --git a/src/lib/datasrc/static.zone.pre b/src/lib/datasrc/static.zone.pre
index 16a7379..13c0c9d 100644
--- a/src/lib/datasrc/static.zone.pre
+++ b/src/lib/datasrc/static.zone.pre
@@ -6,7 +6,9 @@
;;
;; in the bindctl.
+;; This is here mostly for technical reasons.
BIND. 0 CH SOA bind. authors.bind. 0 28800 7200 604800 86400
+BIND. 0 CH NS BIND.
VERSION.BIND. 0 CH TXT "@@VERSION_STRING@@"
;; HOSTNAME.BIND 0 CH TXT "localhost"
More information about the bind10-changes
mailing list