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