diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2006-12-08 23:14:08 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2006-12-08 23:14:08 +0000 |
commit | 1a7508a028869639588d0550ef1a6b7c5d183437 (patch) | |
tree | 527d32632f51925d0461d8bc5e6cc5bf65d69b95 | |
parent | 90e49b5d1125b143f29c84b0adbdb114e9d853a4 (diff) | |
download | pfsense-packages-1a7508a028869639588d0550ef1a6b7c5d183437.tar.gz pfsense-packages-1a7508a028869639588d0550ef1a6b7c5d183437.tar.bz2 pfsense-packages-1a7508a028869639588d0550ef1a6b7c5d183437.zip |
Add wan congestion triggers based on MS
-rw-r--r-- | packages/tinydns/tinydns.inc | 22 | ||||
-rw-r--r-- | packages/tinydns/tinydns_domains.xml | 6 |
2 files changed, 26 insertions, 2 deletions
diff --git a/packages/tinydns/tinydns.inc b/packages/tinydns/tinydns.inc index 501ba8d9..792b6a86 100644 --- a/packages/tinydns/tinydns.inc +++ b/packages/tinydns/tinydns.inc @@ -160,13 +160,23 @@ function tinydns_custom_php_changeip_command() { conf_mount_ro(); } -function tinydns_get_record_status($record) { +function tinydns_get_record_status($record, $pingthreshold, $wanpingthreshold) { global $g, $config; if(file_exists("/var/db/pingstatus/{$record}")) { $status = file_get_contents("/var/db/pingstatus/{$record}"); if($status == "DOWN") return false; } + if($pingthreshold) { + $current_ms = file_get_contents("/var/db/pingmsstatus/$record"); + if($pingthreshold > $current_ms) + return false; + } + if($wanpingthreshold) { + $current_avg = file_get_contents("/var/db/wanaverage"); + if($wanpingthreshold > $current_avg) + return false; + } return true; } @@ -248,7 +258,15 @@ function tinydns_create_zone_file() { if($domain['row']) { foreach($domain['row'] as $row) { if($row['loadbalance']) { - $status = tinydns_get_record_status($row['failoverip']); + if($row['pingthreshold']) + $pingthreshold = $row['pingthreshold']; + else + $pingthreshold = ""; + if($row['wanpingthreshold']) + $wanpingthreshold = $row['wanpingthreshold']; + else + $wanpingthreshold = ""; + $status = tinydns_get_record_status($row['failoverip'], $pingthreshold, $wanpingthreshold); if($status) { $record_data = tinydns_get_rowline_data($row['failoverip'], $domain['recordtype'], $ttl, $hostname); fwrite($fd, $record_data . "\n"); diff --git a/packages/tinydns/tinydns_domains.xml b/packages/tinydns/tinydns_domains.xml index 907d77e8..1c1ce7fb 100644 --- a/packages/tinydns/tinydns_domains.xml +++ b/packages/tinydns/tinydns_domains.xml @@ -96,6 +96,12 @@ <description>When the MS time is surpassed, item will failover to next host</description> <type>input</type> </rowhelperfield> + <rowhelperfield> + <fielddescr>Wan ping threshold</fielddescr> + <fieldname>wanpingthreshold</fieldname> + <description>When the WAN MS ping time is surpassed, item will failover to next host</description> + <type>input</type> + </rowhelperfield> </rowhelper> </field> </fields> |