summaryrefslogtreecommitdiffstats
path: root/usr/local/www/firewall_virtual_ip_edit.php
diff options
context:
space:
mode:
authorErmal <eri@pfsense.org>2010-09-01 15:51:38 +0000
committerErmal <eri@pfsense.org>2010-09-01 15:51:38 +0000
commite847108459441367a88a6e8185165f2e33690d67 (patch)
treef6fef1f6cd75052641248cef39dbfa069203147a /usr/local/www/firewall_virtual_ip_edit.php
parent8e0c376055498bf0a43ff2114062cd8ef8992a09 (diff)
downloadpfsense-e847108459441367a88a6e8185165f2e33690d67.zip
pfsense-e847108459441367a88a6e8185165f2e33690d67.tar.gz
Ticket #866 #632. Save old settings or actions to be taken for reconfiguring a route/vip on a tmp file and make use that information when apply settings buttons is clicked. This makes the gui behave as expected.
Diffstat (limited to 'usr/local/www/firewall_virtual_ip_edit.php')
-rwxr-xr-xusr/local/www/firewall_virtual_ip_edit.php38
1 files changed, 14 insertions, 24 deletions
diff --git a/usr/local/www/firewall_virtual_ip_edit.php b/usr/local/www/firewall_virtual_ip_edit.php
index 214d127..60baccd 100755
--- a/usr/local/www/firewall_virtual_ip_edit.php
+++ b/usr/local/www/firewall_virtual_ip_edit.php
@@ -149,11 +149,7 @@ if ($_POST) {
if (!ip_in_subnet($_POST['subnet'], gen_subnet($parent_ip, $parent_sn) . "/" . $parent_sn) && !ip_in_interface_alias_subnet($_POST['interface'], $_POST['subnet'])) {
$cannot_find = $_POST['subnet'] . "/" . $_POST['subnet_bits'] ;
$input_errors[] = sprintf(gettext("Sorry, we could not locate an interface with a matching subnet for %s. Please add an IP alias in this subnet on this interface."),$cannot_find);
- } else if ($parent_sn != $_POST['subnet_bits'])
- $input_errors[] = gettext("Subnet bits needs to be the same as the parent interface.");
-
- if (isset($id) && ($a_vip[$id]) && $a_vip[$id]['vhid'] != $_POST['vhid'])
- interface_vip_bring_down($a_vip[$id]);
+ }
}
if (isset($id) && ($a_vip[$id])) {
@@ -163,18 +159,12 @@ if ($_POST) {
$vipiface = $a_vip[$id]['interface'];
foreach ($a_vip as $vip) {
if ($vip['interface'] == $vipiface && $vip['mode'] == "carp") {
- if (ip_in_subnet($vip['subnet'], gen_subnet($a_vip[$id]['subnet'], $a_vip[$id]['subnet_bits']) . "/" . $a_vip[$id]['subnet_bits'])) {
+ if (ip_in_subnet($vip['subnet'], gen_subnet($a_vip[$id]['subnet'], $a_vip[$id]['subnet_bits']) . "/" . $a_vip[$id]['subnet_bits']))
$input_errors[] = gettext("This entry cannot be modified because it is still referenced by CARP") . " {$vip['descr']}.";
- $bringdown = false;
- }
}
}
}
- if (bringdown == false)
- interface_vip_bring_down($a_vip[$id]);
}
- if ($a_vip[$id]['interface'] != $_POST['interface'])
- interface_vip_bring_down($a_vip[$id]);
}
if (!$input_errors) {
@@ -220,27 +210,27 @@ if ($_POST) {
unset($vipent['alias-subnet']);
}
- if (isset($id) && $a_vip[$id]) {
+ if (!isset($id))
+ $id = count($a_vip);
+ if (file_exists("{$g['tmp_path']}/.firewall_virtual_ip.apply"))
+ $toapplylist = unserialize(file_get_contents("{$g['tmp_path']}/.firewall_virtual_ip.apply"));
+ else
+ $toapplylist = array();
+
+ $toapplylist[$id] = $a_vip[$id];
+ if (!empty($a_vip[$id])) {
/* modify all virtual IP rules with this address */
for ($i = 0; isset($config['nat']['rule'][$i]); $i++) {
if ($config['nat']['rule'][$i]['destination']['address'] == $a_vip[$id]['subnet'])
$config['nat']['rule'][$i]['destination']['address'] = $vipent['subnet'];
}
- $a_vip[$id] = $vipent;
- } else
- $a_vip[] = $vipent;
+ }
+ $a_vip[$id] = $vipent;
mark_subsystem_dirty('vip');
write_config();
- if (!isset($id))
- $id = count($a_vip) - 1;
- if (file_exists("{$g['tmp_path']}/firewall_virtual_ip.apply"))
- $toapplylist = unserialize(file_get_contents("{$g['tmp_path']}/firewall_virtual_ip.apply"));
- else
- $toapplylist = array();
- $toapplylist[] = $id;
- file_put_contents("{$g['tmp_path']}/firewall_virtual_ip.apply", serialize($toapplylist));
+ file_put_contents("{$g['tmp_path']}/.firewall_virtual_ip.apply", serialize($toapplylist));
header("Location: firewall_virtual_ip.php");
exit;
}
OpenPOWER on IntegriCloud