dlopen(driver)
and then call to init()
and destroy()
functions from the
drivers. That is it.Because a lot of logic in BIND is not exposed to plugins (or not split into functions at all!), the bind-dyndb-ldap has to re-implement a lot of BIND logic itself. Of course, this means that we introduce a lot of new bugs.
For example zone configuration logic in BIND consists of (roughly):
All this logic has to be re-implemented in bind-dyndb-ldap:
ldap_helper.c
reimplement zone configuration logic:We can quantify this problem by categorizing all source files to several categories. Rough statistics for C files in bind-dyndb-ldap source tree:
File | Functionality | Line count |
---|---|---|
acl.c | ACL parser | 634 |
empty_zones.c | Empty zone handling | 466 |
fwd_register.c | Forward zone handling | 143 |
ldap_driver.c | BIND driver plumbing | 1129 |
ldap_helper.c (part 2) | Zone configuration | 1100 |
lock.c | Utility: locking | 57 |
log.c | Utility: log | 24 |
rbt_helper.c | Utility: red-black tree | 179 |
settings.c | Utility: configuration | 661 |
zone_register.c | Master zone handling | 626 |
zone.c | Master zone handling | 148 |
File | Functionality | Line count |
---|---|---|
fs.c | File system utilities | 116 |
krb5_helper.c | Kerberos support | 191 |
semaphore.c | Utility: semaphore | 130 |
str.c | Utility: strings | 312 |
zone_manager.c | Driver instance management | 200 |
File | Functionality | Line count |
---|---|---|
ldap_convert.c | LDAP data format utilitity | 459 |
ldap_entry.c | LDAP entry parser | 594 |
ldap_helper.c (part 1) | LDAP plumbing | 3571 |
metadb.c | LDAP metadata handling | 407 |
mldap.c | LDAP metadata handling | 539 |
syncrepl.c | LDAP: SyncRepl | 537 |
File | Functionality | Line count |
---|---|---|
syncptr.c | PTR record synchronization | 530 |
Duplicated code and glue is 6117 / 12753 lines = 48 % of code base. Functionality is implemented by 6637 / 12753 lines = 52 % of code base.
It has to be taken into account that the code which integrates with BIND (the glue code) is often harder to write and debug than the feature code.
Alternative metric to number of code lines is number of tickets.
Configuration in BIND - /etc/named.conf
:
zone "fwd.example." IN {
type forward;
forward only;
forwarders { 192.0.2.1; };
};
Implementation of this trivial configuration in bind-dyndb-ldap (roughly) consists of:
File | Functionality | Line count |
---|---|---|
empty_zones.c | Empty zone handling | 466 |
fwd_register.c | Forward zone handling | 143 |
ldap_helper.c | Forward zone parser | 300 |
bind-dyndb-ldap implementation consist of ~ 900 lines of code = 7 % of code base
Configuration in BIND - /etc/named.conf
:
zone "static.example." IN {
type master;
file "static.example.db";
allow-update { none; };
};
Implementation of basic functionality in bind-dyndb-ldap (roughly) consists of:
File | Functionality | Line count |
---|---|---|
ldap_driver.c | Gluing the database to BIND | 1100 |
ldap_helper.c | Zone management and parser | 852 |
zone.c | Support for zone loading | 50 |
zone_register.c | Master zone handling | 626 |
bind-dyndb-ldap implementation consist of ~ 1640 lines of code = 13 % of code base
Configuration in BIND - /etc/named.conf
:
zone "static.example." IN {
type master;
file "dynamic.example.db";
update-policy { grant fred.example.net name example.net A; };
};
Implementation of dynamic update functionality in bind-dyndb-ldap (roughly) consists of:
File | Functionality | Line count |
---|---|---|
acl.c | ACL parser | 634 |
fs.c | Journal cleaning | 116 |
ldap_helper.c | Zone update hooks | 500 |
zone.c | Zone journal | 100 |
bind-dyndb-ldap implementation consist of ~ 1350 lines of code = 11 % of code base
(this is related to bypassing standard interfaces mentioned above)
Options: