aboutsummaryrefslogtreecommitdiffstats
path: root/config/tinydns
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2010-11-10 16:02:03 -0500
committerjim-p <jimp@pfsense.org>2010-11-10 16:02:03 -0500
commit90b413bae3c32a5aff5ea2f45bcd0e01a16b7197 (patch)
tree898be8ffde17b5d1c59feb4821d923d3691eafa1 /config/tinydns
parent75af13012b8b9ac7cc5a1959e68dc9ef6211908b (diff)
downloadpfsense-packages-90b413bae3c32a5aff5ea2f45bcd0e01a16b7197.tar.gz
pfsense-packages-90b413bae3c32a5aff5ea2f45bcd0e01a16b7197.tar.bz2
pfsense-packages-90b413bae3c32a5aff5ea2f45bcd0e01a16b7197.zip
Detect if we have an IP or a hostname in an MX record and set the field appropriately.
Diffstat (limited to 'config/tinydns')
-rw-r--r--config/tinydns/tinydns.inc10
1 files changed, 9 insertions, 1 deletions
diff --git a/config/tinydns/tinydns.inc b/config/tinydns/tinydns.inc
index 9de8da9d..dbfbd2a8 100644
--- a/config/tinydns/tinydns.inc
+++ b/config/tinydns/tinydns.inc
@@ -715,9 +715,17 @@ function tinydns_get_rowline_data($recordip, $recordtype, $ttl, $hostname, $rdns
break;
case "MX":
// @fqdn:ip:x:dist:ttl:timestamp:lo
+ // ^- This is a hostname
if(!$dist)
$dist = "10"; // default to 10 if no preference has been defined. 0 is ugly.
- $record_data = "@{$hostname}::{$recordip}:{$dist}{$ttl_string}";
+
+ // Check if we were given an IP, if so, put it in the ip field and leave the x field blank.
+ // Otherwise leave the IP blank and put in the hostname.
+ if (is_ipaddr($recordip))
+ $record_string = "{$recordip}:";
+ else
+ $record_string = ":{$recordip}";
+ $record_data = "@{$hostname}:{$record_string}:{$dist}{$ttl_string}";
break;
case "PTR":
/* "^" creates "PTR" record only to allow reverse DNS */