aboutsummaryrefslogtreecommitdiffstats
path: root/config/tinydns/tinydns.inc
diff options
context:
space:
mode:
authorAnton <github@digitsolutions.nl>2013-11-18 22:01:59 +0100
committerJeremy Brown <jeremy.b@infosend.com>2014-07-31 16:27:47 -0700
commit075315233f0de50dae533e0606a6313c2cab32aa (patch)
tree41d40d4824ff61a5f867edafbd0ddf155a03f578 /config/tinydns/tinydns.inc
parent12f2f1c53716d470e346734ac3d5925003669e0e (diff)
downloadpfsense-packages-075315233f0de50dae533e0606a6313c2cab32aa.tar.gz
pfsense-packages-075315233f0de50dae533e0606a6313c2cab32aa.tar.bz2
pfsense-packages-075315233f0de50dae533e0606a6313c2cab32aa.zip
Make tinydns failover IPv6 comaptible
Diffstat (limited to 'config/tinydns/tinydns.inc')
-rw-r--r--config/tinydns/tinydns.inc53
1 files changed, 36 insertions, 17 deletions
diff --git a/config/tinydns/tinydns.inc b/config/tinydns/tinydns.inc
index 36746784..c3e95439 100644
--- a/config/tinydns/tinydns.inc
+++ b/config/tinydns/tinydns.inc
@@ -399,44 +399,60 @@ function tinydns_setup_ping_items() {
* status and create a database of the status information that we can use.
*/
foreach($config['installedpackages']['tinydnsdomains']['config'] as $domain) {
- if($domain['monitorip'] <> "")
- $monitorip = $domain['monitorip'];
- $interface = $domain['interface'];
+ if(!$domain['monitorip'])
+ continue;
+ if($domain['recordtype'] == "AAAA")
+ $inet = "inet6";
+ else
+ $inet = "";
+ $monitorip = $domain['monitorip'];
+ $interface = $domain['interface'];
if($domain['row']) {
foreach($domain['row'] as $row) {
if($row['pingthreshold'])
$pingthreshold = $row['pingthreshold'];
else
- $row['pingthreshold'] = "";
+ $pingthreshold = "";
+
+ if($row['wanpingthreshold'])
+ $wanpingthreshold = $row['wanpingthreshold'];
+ else
+ $wanpingthreshold = "";
+
+ $info = get_interface_info($row['interface']);
+ if($domain['recordtype'] == "AAAA")
+ $ip = $info['ipaddrv6'];
+ else
+ $ip = $info['ipaddr'];
+
if($row['monitorip']) {
if(!in_array($row['monitorip'], $processed)) {
- $info = get_interface_info($row['interface']);
- $ip = $info['ipaddr'];
- fwrite($fd, $ip . "|" . $row['monitorip'] . "|1|/usr/local/pkg/tinydns_down.php|/usr/local/pkg/tinydns_up.php|{$pingthreshold}\n");
+ fwrite($fd, $ip . "|" . $row['monitorip'] . "|1|/usr/local/pkg/tinydns_down.php|/usr/local/pkg/tinydns_up.php|{$pingthreshold}|{$wanpingthreshold}|{$inet}\n");
$processed[] = $row['monitorip'];
}
} else {
if(!in_array($monitorip, $processed)) {
- $info = get_interface_info($interface);
- $ip = $info['ipaddr'];
- fwrite($fd, $ip . "|" . $monitorip . "|1|/usr/local/pkg/tinydns_down.php|/usr/local/pkg/tinydns_up.php|{$pingthreshold}\n");
+ fwrite($fd, $ip . "|" . $monitorip . "|1|/usr/local/pkg/tinydns_down.php|/usr/local/pkg/tinydns_up.php|{$pingthreshold}|{$wanpingthreshold}|{$inet}\n");
$processed[] = $monitorip;
}
}
}
}
+
+ $info = get_interface_info($domain['interface']);
+ if($domain['recordtype'] == "AAAA")
+ $ip = $info['ipaddrv6'];
+ else
+ $ip = $info['ipaddr'];
+
if($domain['monitorip']) {
if(!in_array($domain['monitorip'], $processed)) {
- $info = get_interface_info($domain['interface']);
- $ip = $info['ipaddr'];
- fwrite($fd, $ip . "|" . $domain['monitorip'] . "|1|/usr/local/pkg/tinydns_down.php|/usr/local/pkg/tinydns_up.php|{$pingthreshold}\n");
+ fwrite($fd, $ip . "|" . $domain['monitorip'] . "|1|/usr/local/pkg/tinydns_down.php|/usr/local/pkg/tinydns_up.php|{$pingthreshold}|{$wanpingthreshold}|{$inet}\n");
$processed[] = $domain['monitorip'];
}
} else {
if(!in_array($row['failoverip'], $processed)) {
- $info = get_interface_info($domain['interface']);
- $ip = $info['ipaddr'];
- fwrite($fd, $ip . "|" . $row['failoverip'] . "|1|/usr/local/pkg/tinydns_down.php|/usr/local/pkg/tinydns_up.php|{$pingthreshold}\n");
+ fwrite($fd, $ip . "|" . $row['failoverip'] . "|1|/usr/local/pkg/tinydns_down.php|/usr/local/pkg/tinydns_up.php|{$pingthreshold}|{$wanpingthreshold}|{$inet}\n");
$processed[] = $row['failoverip'];
}
}
@@ -1108,6 +1124,9 @@ function tinydns_get_dns_record_type($tinydnsrecord) {
case($tinydnsrecord[0] == "+"):
$rtype = "A";
break;
+ case($tinydnsrecord[0] == ":"):
+ $rtype = "AAAA";
+ break;
case($tinydnsrecord[0] == "@"):
$rtype = "MX";
break;
@@ -1302,4 +1321,4 @@ function tinydns_cleanup_addedit_form_record() {
}
}
-?>
+?> \ No newline at end of file