diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2008-12-22 01:32:52 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2008-12-22 01:32:52 +0000 |
commit | b5bc1a3ae4cddc96f52339ba4da1b75778eb4ee4 (patch) | |
tree | 03e8e91e16e798f33efbf1916b95fd99e68b5f0d /usr/local | |
parent | cd860b6201bf6d577c58850d8ac2627528710e01 (diff) | |
download | pfsense-b5bc1a3ae4cddc96f52339ba4da1b75778eb4ee4.zip pfsense-b5bc1a3ae4cddc96f52339ba4da1b75778eb4ee4.tar.gz |
* Minor whitespace fixes
* Kill off process if running and user turns off option as well
Diffstat (limited to 'usr/local')
-rwxr-xr-x | usr/local/www/firewall_nat_1to1_edit.php | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/usr/local/www/firewall_nat_1to1_edit.php b/usr/local/www/firewall_nat_1to1_edit.php index 47d3e26..4ea9da4 100755 --- a/usr/local/www/firewall_nat_1to1_edit.php +++ b/usr/local/www/firewall_nat_1to1_edit.php @@ -83,13 +83,13 @@ if ($_POST) { if (($_POST['internal'] && !is_ipaddr($_POST['internal']))) { $input_errors[] = "A valid internal subnet must be specified."; } - + if (is_ipaddr($config['interfaces']['wan']['ipaddr'])) { if (check_subnets_overlap($_POST['external'], $_POST['subnet'], $config['interfaces']['wan']['ipaddr'], 32)) $input_errors[] = "The WAN IP address may not be used in a 1:1 rule."; } - + /* check for overlaps with other 1:1 */ foreach ($a_1to1 as $natent) { if (isset($id) && ($a_1to1[$id]) && ($a_1to1[$id] === $natent)) @@ -103,7 +103,7 @@ if ($_POST) { //break; } } - + /* check for overlaps with advanced outbound NAT */ if (is_array($config['nat']['advancedoutbound']['rule'])) { foreach ($config['nat']['advancedoutbound']['rule'] as $natent) { @@ -117,11 +117,15 @@ if ($_POST) { if (!$input_errors) { $natent = array(); - - if($a_1to1[$id]['external'] != $_POST['external'] or $a_1to1[$id]['internal'] != $_POST['internal']) { - $helpers = `/bin/ps awux | grep "p 21 {$a_1to1[$id]['internal']} {$a_1to1[$id]['external']}" | grep -v grep | awk '{ print $2 }'`; - if($helpers) - exec("kill $helpers"); + + /* Is there a ftp-proxy process running? Kill it off if the items IP is changing. */ + if($a_1to1[$id]['useftphelper']) { + if($a_1to1[$id]['external'] != $_POST['external'] or + $a_1to1[$id]['internal'] != $_POST['internal'] or !$_POST['useftphelper']) { + $helpers = `/bin/ps awux | grep "p 21 {$a_1to1[$id]['internal']} {$a_1to1[$id]['external']}" | grep -v grep | awk '{ print $2 }'`; + if($helpers) + exec("kill $helpers"); + } } $natent['external'] = $_POST['external']; $natent['internal'] = $_POST['internal']; @@ -129,14 +133,14 @@ if ($_POST) { $natent['descr'] = $_POST['descr']; $natent['useftphelper'] = $_POST['useftphelper']; $natent['interface'] = $_POST['interface']; - + if (isset($id) && $a_1to1[$id]) $a_1to1[$id] = $natent; else $a_1to1[] = $natent; - + touch($d_natconfdirty_path); - + write_config(); header("Location: firewall_nat_1to1.php"); |