From fceaec0ccf3e2f35959219c5e5498fdfda29a8db Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Mon, 7 Feb 2011 00:21:40 -0500 Subject: Add SRV record support. --- config/tinydns/tinydns.inc | 10 +++++++--- config/tinydns/tinydns_domains.xml | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 3 deletions(-) (limited to 'config/tinydns') diff --git a/config/tinydns/tinydns.inc b/config/tinydns/tinydns.inc index 501c019d..6bdf71ba 100644 --- a/config/tinydns/tinydns.inc +++ b/config/tinydns/tinydns.inc @@ -535,7 +535,7 @@ function tinydns_create_zone_file() { log_error("tinydns_get_backup_record returned $ipaddress "); } } - $record_data = tinydns_get_rowline_data($ipaddress, $domain['recordtype'], $ttl, $hostname, $domain['rdns'], $dist); + $record_data = tinydns_get_rowline_data($ipaddress, $domain['recordtype'], $ttl, $hostname, $domain['rdns'], $dist, $domain['src_port'], $domain['src_weight'], $domain['src_priority'], $domain['src_timestamp']); if($record_data) { fwrite($fd, $record_data . "\n"); if ($domain['rdns'] || ($domain['recordtype'] == 'PTR')) { @@ -558,7 +558,7 @@ function tinydns_create_zone_file() { $wanpingthreshold = ""; $status = tinydns_get_record_status($row['failoverip'], $pingthreshold, $wanpingthreshold); if($status == "DOWN") { - $record_data = tinydns_get_rowline_data($row['failoverip'], $domain['recordtype'], $ttl, $hostname, ""); + $record_data = tinydns_get_rowline_data($row['failoverip'], $domain['recordtype'], $ttl, $hostname, "", $domain['rdns'], $dist, $domain['src_port'], $domain['src_weight'], $domain['src_priority'], $domain['src_timestamp']); fwrite($fd, $record_data . "\n"); } } @@ -696,7 +696,7 @@ function tinydns_do_xmlrpc_sync($sync_to_ip, $password) { } /* formats data as a tinydns data row item */ -function tinydns_get_rowline_data($recordip, $recordtype, $ttl, $hostname, $rdns, $dist) { +function tinydns_get_rowline_data($recordip, $recordtype, $ttl, $hostname, $rdns, $dist, $srv_port = "5000", $srv_weight = "0", $srv_priority = "0", $srv_timestamp = "1") { if($ttl) $ttl_string = ":{$ttl}"; else @@ -760,6 +760,10 @@ function tinydns_get_rowline_data($recordip, $recordtype, $ttl, $hostname, $rdns $record_data = "6{$hostname}:{$recip_san}{$ttl_string}"; } break; + case "SRV": + $recip_san = str_replace(":", "", $recordip); + $record_data = "S{$hostname}:{$recip_san}{$rec_port}{$rec_weight}{$srv_priority}{$ttl_string}{$srv_timestamp}"; + break; case "CNAME": // Cfqdn:p:ttl:timestamp:lo $record_data = "C{$hostname}:{$recordip}{$ttl_string}"; diff --git a/config/tinydns/tinydns_domains.xml b/config/tinydns/tinydns_domains.xml index 6c1cdc6e..9e4238de 100644 --- a/config/tinydns/tinydns_domains.xml +++ b/config/tinydns/tinydns_domains.xml @@ -175,6 +175,7 @@ + @@ -195,12 +196,44 @@ input 4 + + DNS record time to live (in seconds) + ttl + input + 35 + + + (SRV) Server record port + srv_port + input + 35 + + + (SRV) Server record weight + srv_weight + input + 35 + + + (SRV) Server record timestamp + srv_timestamp + input + 35 + DNS record time to live (in seconds) ttl input 35 + + DNS record time to live (in seconds) + ttl + input + 35 + + + listtopic Reverse lookup -- cgit v1.2.3