aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2007-01-28 01:43:59 +0000
committerScott Ullrich <sullrich@pfsense.org>2007-01-28 01:43:59 +0000
commit623eea27ddeec21c189f80e26f06956ec55273f9 (patch)
treee6a5a02ab08e31d6aafff517bf1e92bfce9fc323
parentce1646e6b92e57708a3a1e43eafe598d86d380b1 (diff)
downloadpfsense-packages-623eea27ddeec21c189f80e26f06956ec55273f9.tar.gz
pfsense-packages-623eea27ddeec21c189f80e26f06956ec55273f9.tar.bz2
pfsense-packages-623eea27ddeec21c189f80e26f06956ec55273f9.zip
* Do not install ping entries more than once
* Only ping 1 packet to speed up process
-rw-r--r--packages/tinydns/tinydns.inc37
1 files changed, 27 insertions, 10 deletions
diff --git a/packages/tinydns/tinydns.inc b/packages/tinydns/tinydns.inc
index bfdee609..1c5155db 100644
--- a/packages/tinydns/tinydns.inc
+++ b/packages/tinydns/tinydns.inc
@@ -197,6 +197,7 @@ function tinydns_setup_ping_items() {
$wanif = get_real_wan_interface();
$ip = find_interface_ip($wanif);
conf_mount_rw();
+ $processed = array();
/* XXX: make this work with other packages */
$fd = fopen("/var/db/pkgpinghosts", "w");
if(!$fd) {
@@ -207,7 +208,10 @@ 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) {
- fwrite($fd, $ip . "|" . $domain['ipaddress'] . "|3|/usr/local/pkg/tinydns_down.php|/usr/local/pkg/tinydns_up.php\n");
+ if(!in_array($domain['ipaddress'], $processed)) {
+ fwrite($fd, $ip . "|" . $domain['ipaddress'] . "|1|/usr/local/pkg/tinydns_down.php|/usr/local/pkg/tinydns_up.php\n");
+ $processed[] = $domain['ipaddress'];
+ }
if($domain['monitorip'] <> "")
$monitorip = $domain['monitorip'];
if($domain['row']) {
@@ -216,17 +220,30 @@ function tinydns_setup_ping_items() {
$pingthreshold = $row['pingthreshold'];
else
$row['pingthreshold'] = "";
- if($row['monitorip'])
- fwrite($fd, $ip . "|" . $row['monitorip'] . "|3|/usr/local/pkg/tinydns_down.php|/usr/local/pkg/tinydns_up.php|{$pingthreshold}\n");
- else
- fwrite($fd, $ip . "|" . $monitorip . "|3|/usr/local/pkg/tinydns_down.php|/usr/local/pkg/tinydns_up.php|{$pingthreshold}\n");
+ if($row['monitorip']) {
+ if(!in_array($row['monitorip'], $processed)) {
+ fwrite($fd, $ip . "|" . $row['monitorip'] . "|1|/usr/local/pkg/tinydns_down.php|/usr/local/pkg/tinydns_up.php|{$pingthreshold}\n");
+ $processed[] = $row['monitorip'];
+ }
+ } else {
+ if(!in_array($monitorip, $processed)) {
+ fwrite($fd, $ip . "|" . $monitorip . "|1|/usr/local/pkg/tinydns_down.php|/usr/local/pkg/tinydns_up.php|{$pingthreshold}\n");
+ $processed[] = $monitorip;
+ }
+ }
+ }
+ }
+ if($domain['monitorip']) {
+ if(!in_array($domain['monitorip'], $processed)) {
+ fwrite($fd, $ip . "|" . $domain['monitorip'] . "|1|/usr/local/pkg/tinydns_down.php|/usr/local/pkg/tinydns_up.php|{$pingthreshold}\n");
+ $processed[] = $domain['monitorip'];
+ }
+ } else {
+ if(!in_array($row['failoverip'], $processed)) {
+ fwrite($fd, $ip . "|" . $row['failoverip'] . "|1|/usr/local/pkg/tinydns_down.php|/usr/local/pkg/tinydns_up.php|{$pingthreshold}\n");
+ $processed[] = $row['failoverip'];
}
}
- if($domain['monitorip'])
- fwrite($fd, $ip . "|" . $domain['monitorip'] . "|3|/usr/local/pkg/tinydns_down.php|/usr/local/pkg/tinydns_up.php|{$pingthreshold}\n");
- else
- fwrite($fd, $ip . "|" . $row['failoverip'] . "|3|/usr/local/pkg/tinydns_down.php|/usr/local/pkg/tinydns_up.php|{$pingthreshold}\n");
-
}
fclose($fd);
conf_mount_ro();