diff options
-rw-r--r-- | packages/tinydns/tinydns.inc | 20 | ||||
-rw-r--r-- | packages/tinydns/tinydns_domains.xml | 12 |
2 files changed, 22 insertions, 10 deletions
diff --git a/packages/tinydns/tinydns.inc b/packages/tinydns/tinydns.inc index 7bfd44e0..591610be 100644 --- a/packages/tinydns/tinydns.inc +++ b/packages/tinydns/tinydns.inc @@ -121,27 +121,29 @@ function tinydns_create_zone_file() { conf_mount_rw(); $fd = fopen("/service/tinydns/root/data", "w"); if($config['installedpackages']['tinydnsdomains']) - foreach($config['installedpackages']['tinydnsdomains'] as $domain) { - $record_type = ""; + foreach($config['installedpackages']['tinydnsdomains']['config'] as $domain) { + $record_data = ""; + $hostname = $domain['hostname']; + $ipaddress = $domain['ipaddress']; switch ($domain['recordtype']) { case "SOA": - $record_type = "."; + $record_data = ".{$hostname}::{$ipaddress}"; break; case "MX": - $record_type = "@"; + $record_data = "@{$hostname}:{$ipaddress}"; break; case "A": - $record_type = "+"; + $record_data = "+{$hostname}:{$ipaddress}"; break; case "PTR": - $record_type = "="; + $record_data = "={$hostname}:{$ipaddress}"; break; case "CNAME": - $record_type = "C"; + $record_data = "C{$hostname}:{$ipaddress}"; break; } - if($record_type) - fwrite($fd, $record_type . ":" . $domain['hostname'] . "\n"); + if($record_data) + fwrite($fd, $record_data . "\n"); } fclose($fd); /* tell tinydns to reload zone file */ diff --git a/packages/tinydns/tinydns_domains.xml b/packages/tinydns/tinydns_domains.xml index a16c2369..548bad4c 100644 --- a/packages/tinydns/tinydns_domains.xml +++ b/packages/tinydns/tinydns_domains.xml @@ -43,7 +43,14 @@ </options> </field> <field> - <fieldname>Failover Threshhold</fieldname> + <fieldname>ipaddress</fieldname> + <fielddescr>IP Address or hostname that record points to</fielddescr> + <description>Enter the IP Address that this record will point to (primary). The only exception is for NS type records where we expect a complete hostname to point to a A record.</description> + <required/> + <type>input</type> + </field> + <field> + <fieldname>Threshhold</fieldname> <fielddescr>Time in minutes before DNS switches to backup host</fielddescr> <type>input</type> </field> @@ -59,4 +66,7 @@ </rowhelper> </field> </fields> + <custom_php_resync_config_command> + tinydns_create_zone_file(); + </custom_php_resync_config_command> </packagegui> |