README
1<!--
2Copyright (C) Internet Systems Consortium, Inc. ("ISC")
3
4SPDX-License-Identifier: MPL-2.0 and ISC
5
6This Source Code Form is subject to the terms of the Mozilla Public
7License, v. 2.0. If a copy of the MPL was not distributed with this
8file, you can obtain one at https://mozilla.org/MPL/2.0/.
9
10See the COPYRIGHT file distributed with this work for additional
11information regarding copyright ownership.
12
13Copyright (C) Red Hat
14
15Permission to use, copy, modify, and/or distribute this software for any
16purpose with or without fee is hereby granted, provided that the above
17copyright notice and this permission notice appear in all copies.
18
19THE SOFTWARE IS PROVIDED "AS IS" AND AUTHORS DISCLAIMS ALL WARRANTIES WITH
20REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
21AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
22INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
23LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
24OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
25PERFORMANCE OF THIS SOFTWARE.
26-->
27
28To use the Dynamic DB sample driver, run named and check the log.
29
30 $ cd testing
31 $ named -gc named.conf
32
33You should be able to see something like:
34
35zone test/IN: loaded serial 0
36zone arpa/IN: loaded serial 0
37
38This means that the sample driver created empty zones "test." and
39"arpa." as defined by "arg" parameters in named.conf.
40
41$ dig @localhost test.
42
43should work as usual and you should be able to see the dummy zone with
44NS record pointing to the zone apex and A record with 127.0.0.1:
45
46;; ANSWER SECTION:
47test. 86400 IN A 127.0.0.1
48test. 86400 IN NS test.
49test. 86400 IN SOA test. test. 0 28800 7200 604800 86400
50
51This driver creates two empty zones and allows query/transfer/update to
52all IP addresses for demonstration purposes.
53
54The driver wraps the RBT database implementation used natively by BIND,
55and modifies the addrdataset() and substractrdataset() functions to do
56additional work during dynamic updates.
57
58A dynamic update modifies the target zone as usual. After that, the
59driver detects whether the modified RR was of type A or AAAA, and if so,
60attempts to appropriately generate or delete a matching PTR record in
61one of the two zones managed by the driver.
62
63E.g.:
64
65$ nsupdate
66> update add a.test. 300 IN A 192.0.2.1
67> send
68
69will add the A record
70a.test. 300 IN A 192.0.2.1
71
72and also automatically generate the PTR record
731.2.0.192.in-addr.arpa. 300 IN PTR a.test.
74
75AXFR and RR deletion via dynamic updates should work as usual. Deletion
76of a type A or AAAA record should delete the corresponding PTR record
77too.
78
79The zone is stored only in memory, and all changes will be lost on
80reload/reconfig.
81
82Hints for code readers:
83- Driver initialization starts in driver.c: dyndb_init() function.
84- New database implementation is registered by calling dns_db_register()
85 and passing a function pointer to it. This sample uses the function
86 create_db() to initialize the database.
87- Zones are created later in instance.c: load_sample_instance_zones().
88- Database entry points are in structure db.c: dns_dbmethods_t
89 sampledb_methods
90- sampledb_methods points to an implementation of the database interface.
91 See the db.c: addrdataset() implementation and look at how the RBT
92 database instance is wrapped into an additional layer of logic.
93