summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2006-01-24 23:51:44 +0000
committerScott Ullrich <sullrich@pfsense.org>2006-01-24 23:51:44 +0000
commitc1f5a46b862d66c3de0aa4f615335f43ceaacd36 (patch)
treeac97b20a83ac31f135a39aaba46381e09f13c916
parent8eb6935927629eee4e945fc3e0506d5ee4962959 (diff)
downloadpfsense-c1f5a46b862d66c3de0aa4f615335f43ceaacd36.zip
pfsense-c1f5a46b862d66c3de0aa4f615335f43ceaacd36.tar.gz
MFC vpn ping code
-rw-r--r--etc/crontab1
-rw-r--r--etc/inc/vpn.inc13
-rwxr-xr-xusr/local/www/vpn_ipsec_edit.php13
3 files changed, 27 insertions, 0 deletions
diff --git a/etc/crontab b/etc/crontab
index c830ac8..f866b96 100644
--- a/etc/crontab
+++ b/etc/crontab
@@ -7,3 +7,4 @@ HOME=/var/log
1 * 1 * * root /usr/bin/nice -n20 /etc/rc.update_bogons.sh
*/60 * * * * root /usr/bin/nice -n20 /usr/local/sbin/expiretable -v -t 3600 sshlockout
1 1 * * * root /usr/bin/nice -n20 /etc/rc.dyndns.update
+*/5 * * * * root /usr/bin/nice -n20 /etc/ping_hosts.sh
diff --git a/etc/inc/vpn.inc b/etc/inc/vpn.inc
index cd5c8cb..c45ca6a 100644
--- a/etc/inc/vpn.inc
+++ b/etc/inc/vpn.inc
@@ -88,6 +88,10 @@ function find_last_gif_device() {
function vpn_ipsec_configure($ipchg = false) {
global $config, $g, $sa, $sn;
+ /* get the automatic /etc/ping_hosts.sh ready */
+ unlink_if_exists("/var/db/ipsecpinghosts");
+ touch("/var/db/ipsecpinghosts");
+
if($g['booting'] == true) {
/* determine if we should load the via padlock module */
$dmesg_boot = `cat /var/log/dmesg.boot | grep CPU`;
@@ -192,6 +196,15 @@ function vpn_ipsec_configure($ipchg = false) {
$tunnel['remote-gateway'] = $tmp;
}
+ /* add entry to host pinger */
+ if($tunnel['pinghost']) {
+ $pfd = fopen("/var/db/ipsecpinghosts","a");
+ $srcip = find_interface_ip($config['interfaces']['lan']['if']);
+ $dstip = $tunnel['pinghost'];
+ fwrite($pfd, "$srcip|$dstip|3");
+ fclose($pfd);
+ }
+
if(isset($tunnel['creategif'])) {
$number_of_gifs = find_last_gif_device();
$number_of_gifs++;
diff --git a/usr/local/www/vpn_ipsec_edit.php b/usr/local/www/vpn_ipsec_edit.php
index 257efd1..90a2cd7 100755
--- a/usr/local/www/vpn_ipsec_edit.php
+++ b/usr/local/www/vpn_ipsec_edit.php
@@ -90,6 +90,7 @@ if (isset($id) && $a_ipsec[$id]) {
$pconfig['p2pfsgroup'] = $a_ipsec[$id]['p2']['pfsgroup'];
$pconfig['p2lifetime'] = $a_ipsec[$id]['p2']['lifetime'];
$pconfig['descr'] = $a_ipsec[$id]['descr'];
+ $pconfig['pinghost'] = $a_ipsec[$id]['pinghost'];
} else {
/* defaults */
@@ -226,6 +227,7 @@ if ($_POST) {
$ipsecent['p2']['pfsgroup'] = $_POST['p2pfsgroup'];
$ipsecent['p2']['lifetime'] = $_POST['p2lifetime'];
$ipsecent['descr'] = $_POST['descr'];
+ $ipsecent['pinghost'] = $_POST['pinghost'];
if (isset($id) && $a_ipsec[$id])
$a_ipsec[$id] = $ipsecent;
@@ -551,6 +553,17 @@ function methodsel_change() {
seconds</td>
</tr>
<tr>
+ <td colspan="2" class="list" height="12"></td>
+ </tr>
+ <tr>
+ <td colspan="2" valign="top" class="listtopic">Keep alive</td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell">Automatically ping host</td>
+ <td width="78%" class="vtable">
+ <input name="pinghost" type="text" class="formfld" id="pinghost" size="20" value="<?=$pconfig['pinghost'];?>"></td>
+ </tr>
+ <tr>
<td width="22%" valign="top">&nbsp;</td>
<td width="78%">
<input name="Submit" type="submit" class="formbtn" value="Save">
OpenPOWER on IntegriCloud