a00f9e2f50675bd43cc6a9fe2669709162a2ccb4Evan HuntTo use the Dynamic DB sample driver, run named and check the log.
a00f9e2f50675bd43cc6a9fe2669709162a2ccb4Evan Hunt $ cd testing
a00f9e2f50675bd43cc6a9fe2669709162a2ccb4Evan HuntYou should be able to see something like:
a00f9e2f50675bd43cc6a9fe2669709162a2ccb4Evan Huntzone test/IN: loaded serial 0
a00f9e2f50675bd43cc6a9fe2669709162a2ccb4Evan Huntzone arpa/IN: loaded serial 0
a00f9e2f50675bd43cc6a9fe2669709162a2ccb4Evan HuntThis means that the sample driver created empty zones "test." and
a00f9e2f50675bd43cc6a9fe2669709162a2ccb4Evan Hunt"arpa." as defined by "arg" parameters in named.conf.
a00f9e2f50675bd43cc6a9fe2669709162a2ccb4Evan Hunt$ dig @localhost test.
a00f9e2f50675bd43cc6a9fe2669709162a2ccb4Evan Huntshould work as usual and you should be able to see the dummy zone with
a00f9e2f50675bd43cc6a9fe2669709162a2ccb4Evan HuntNS record pointing to the zone apex and A record with 127.0.0.1:
a00f9e2f50675bd43cc6a9fe2669709162a2ccb4Evan Hunt;; ANSWER SECTION:
a00f9e2f50675bd43cc6a9fe2669709162a2ccb4Evan Hunttest. 86400 IN A 127.0.0.1
a00f9e2f50675bd43cc6a9fe2669709162a2ccb4Evan Hunttest. 86400 IN NS test.
a00f9e2f50675bd43cc6a9fe2669709162a2ccb4Evan Hunttest. 86400 IN SOA test. test. 0 28800 7200 604800 86400
a00f9e2f50675bd43cc6a9fe2669709162a2ccb4Evan HuntThis driver creates two empty zones and allows query/transfer/update to
a00f9e2f50675bd43cc6a9fe2669709162a2ccb4Evan Huntall IP addresses for demonstration purposes.
a00f9e2f50675bd43cc6a9fe2669709162a2ccb4Evan HuntThe driver wraps the RBT database implementation used natively by BIND,
a00f9e2f50675bd43cc6a9fe2669709162a2ccb4Evan Huntand modifies the addrdataset() and substractrdataset() functions to do
a00f9e2f50675bd43cc6a9fe2669709162a2ccb4Evan Huntadditional work during dynamic updates.
a00f9e2f50675bd43cc6a9fe2669709162a2ccb4Evan HuntA dynamic update modifies the target zone as usual. After that, the
a00f9e2f50675bd43cc6a9fe2669709162a2ccb4Evan Huntdriver detects whether the modified RR was of type A or AAAA, and if so,
a00f9e2f50675bd43cc6a9fe2669709162a2ccb4Evan Huntattempts to appropriately generate or delete a matching PTR record in
a00f9e2f50675bd43cc6a9fe2669709162a2ccb4Evan Huntone of the two zones managed by the driver.
a00f9e2f50675bd43cc6a9fe2669709162a2ccb4Evan Hunt> update add a.test. 300 IN A 192.0.2.1
a00f9e2f50675bd43cc6a9fe2669709162a2ccb4Evan Huntwill add the A record
a00f9e2f50675bd43cc6a9fe2669709162a2ccb4Evan Hunta.test. 300 IN A 192.0.2.1
a00f9e2f50675bd43cc6a9fe2669709162a2ccb4Evan Huntand also automatically generate the PTR record
a00f9e2f50675bd43cc6a9fe2669709162a2ccb4Evan HuntAXFR and RR deletion via dynamic updates should work as usual. Deletion
a00f9e2f50675bd43cc6a9fe2669709162a2ccb4Evan Huntof a type A or AAAA record should delete the corresponding PTR record
a00f9e2f50675bd43cc6a9fe2669709162a2ccb4Evan HuntThe zone is stored only in memory, and all changes will be lost on
a00f9e2f50675bd43cc6a9fe2669709162a2ccb4Evan HuntHints for code readers:
a00f9e2f50675bd43cc6a9fe2669709162a2ccb4Evan Hunt- Driver initialization starts in driver.c: dyndb_init() function.
a00f9e2f50675bd43cc6a9fe2669709162a2ccb4Evan Hunt- New database implementation is registered by calling dns_db_register()
a00f9e2f50675bd43cc6a9fe2669709162a2ccb4Evan Hunt and passing a function pointer to it. This sample uses the function
a00f9e2f50675bd43cc6a9fe2669709162a2ccb4Evan Hunt create_db() to initialize the database.
a00f9e2f50675bd43cc6a9fe2669709162a2ccb4Evan Hunt- Zones are created later in instance.c: load_sample_instance_zones().
a00f9e2f50675bd43cc6a9fe2669709162a2ccb4Evan Hunt- Database entry points are in structure db.c: dns_dbmethods_t
a00f9e2f50675bd43cc6a9fe2669709162a2ccb4Evan Hunt sampledb_methods
a00f9e2f50675bd43cc6a9fe2669709162a2ccb4Evan Hunt- sampledb_methods points to an implementation of the database interface.
a00f9e2f50675bd43cc6a9fe2669709162a2ccb4Evan Hunt See the db.c: addrdataset() implementation and look at how the RBT
a00f9e2f50675bd43cc6a9fe2669709162a2ccb4Evan Hunt database instance is wrapped into an additional layer of logic.