aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2006-12-08 17:17:30 +0000
committerScott Ullrich <sullrich@pfsense.org>2006-12-08 17:17:30 +0000
commitcb53501d44312bccd147debb868056534f0d878b (patch)
tree1e98d6776eed9d095331b7d6c790954ecf906063
parent5a1d86151907d0abeb7ede6224546a27a2c4e5df (diff)
downloadpfsense-packages-cb53501d44312bccd147debb868056534f0d878b.tar.gz
pfsense-packages-cb53501d44312bccd147debb868056534f0d878b.tar.bz2
pfsense-packages-cb53501d44312bccd147debb868056534f0d878b.zip
* Hook into ping_hosts.sh
* Reload zone database upon host down or up status
-rw-r--r--packages/tinydns/tinydns.inc6
-rw-r--r--packages/tinydns/tinydns.xml10
-rw-r--r--packages/tinydns/tinydns_down.php37
-rw-r--r--packages/tinydns/tinydns_up.php37
4 files changed, 88 insertions, 2 deletions
diff --git a/packages/tinydns/tinydns.inc b/packages/tinydns/tinydns.inc
index d270171d..cc4371fa 100644
--- a/packages/tinydns/tinydns.inc
+++ b/packages/tinydns/tinydns.inc
@@ -153,6 +153,8 @@ function tinydns_setup_ping_items() {
global $g, $config;
if(!$config['installedpackages']['tinydnsdomains'])
return;
+ $wanif = get_real_wan_interface();
+ $ip = find_interface_ip($wanif);
conf_mount_rw();
/* XXX: make this work with other packages */
$fd = fopen("/var/db/pkgpinghosts", "w");
@@ -164,10 +166,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, $domain['ipaddress'] . "\n");
+ fwrite($fd, $ip . "|" . $domain['ipaddress'] . "|3|/usr/local/pkg/tinydns_down.php|/usr/local/pkg/tinydns_up.php\n");
if($domain['row']) {
foreach($domain['row'] as $row) {
- fwrite($fd, $row['ipaddress'] . "\n");
+ fwrite($fd, $ip . "|" . $row['ipaddress'] . "|3|/usr/local/pkg/tinydns_down.php|/usr/local/pkg/tinydns_up.php\n");
}
}
}
diff --git a/packages/tinydns/tinydns.xml b/packages/tinydns/tinydns.xml
index 7229d5c0..d5c75220 100644
--- a/packages/tinydns/tinydns.xml
+++ b/packages/tinydns/tinydns.xml
@@ -34,6 +34,16 @@
<chmod>077</chmod>
<item>http://www.pfsense.com/packages/config/tinydns/tinydns_filter.xml</item>
</additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/pkg/</prefix>
+ <chmod>077</chmod>
+ <item>http://www.pfsense.com/packages/config/tinydns/tinydns_down.php</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/pkg/</prefix>
+ <chmod>077</chmod>
+ <item>http://www.pfsense.com/packages/config/tinydns/tinydns_up.php</item>
+ </additional_files_needed>
<custom_php_install_command>
tinydns_custom_php_install_command();
</custom_php_install_command>
diff --git a/packages/tinydns/tinydns_down.php b/packages/tinydns/tinydns_down.php
new file mode 100644
index 00000000..cdc9a088
--- /dev/null
+++ b/packages/tinydns/tinydns_down.php
@@ -0,0 +1,37 @@
+#!/usr/local/bin/php -f
+<?php
+
+/* $Id$ */
+/*
+ tinydns_down.php
+ Copyright (C) 2006 Scott Ullrich
+ part of pfSense
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+*/
+
+require("/usr/local/pkg/tinydns.inc");
+
+tinydns_create_zone_file();
+
+?> \ No newline at end of file
diff --git a/packages/tinydns/tinydns_up.php b/packages/tinydns/tinydns_up.php
new file mode 100644
index 00000000..10a9201c
--- /dev/null
+++ b/packages/tinydns/tinydns_up.php
@@ -0,0 +1,37 @@
+#!/usr/local/bin/php -f
+<?php
+
+/* $Id$ */
+/*
+ tinydns_up.php
+ Copyright (C) 2006 Scott Ullrich
+ part of pfSense
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+*/
+
+require("/usr/local/pkg/tinydns.inc");
+
+tinydns_create_zone_file();
+
+?> \ No newline at end of file