summaryrefslogtreecommitdiffstats
path: root/usr/local/www/firewall_virtual_ip_edit.php
diff options
context:
space:
mode:
authorErmal Luçi <eri@pfsense.org>2009-10-01 15:18:17 +0000
committerErmal Luçi <eri@pfsense.org>2009-10-01 15:19:42 +0000
commitabcb2bed927c18f29b12972f023b253c703132d1 (patch)
treee06b5f0da200a6694b2d3a5ba79907fb6de06b46 /usr/local/www/firewall_virtual_ip_edit.php
parent6b0c587976d5941bce0b7e569a519f7e7fcbc62a (diff)
downloadpfsense-abcb2bed927c18f29b12972f023b253c703132d1.zip
pfsense-abcb2bed927c18f29b12972f023b253c703132d1.tar.gz
* Convert carp/vips code to behave the same as other interfaces.
* Make optimizations around it. * Make sure when we reload teh underlying interface we reload carp too. * Some fixes around the code. Reviewed-by: scott@ and billm@
Diffstat (limited to 'usr/local/www/firewall_virtual_ip_edit.php')
-rwxr-xr-xusr/local/www/firewall_virtual_ip_edit.php25
1 files changed, 8 insertions, 17 deletions
diff --git a/usr/local/www/firewall_virtual_ip_edit.php b/usr/local/www/firewall_virtual_ip_edit.php
index f04f297..efe82fb 100755
--- a/usr/local/www/firewall_virtual_ip_edit.php
+++ b/usr/local/www/firewall_virtual_ip_edit.php
@@ -119,7 +119,7 @@ if ($_POST) {
}
}
}
-
+
/* make sure new ip is within the subnet of a valid ip
* on one of our interfaces (wan, lan optX)
*/
@@ -135,22 +135,13 @@ if ($_POST) {
}
if($_POST['password'] == "")
$input_errors[] = "You must specify a CARP password that is shared between the two VHID members.";
- $can_post = true;
- $found = false;
- $subnet_ip = return_first_two_octets($_POST['subnet']);
- $iflist = get_configured_interface_list_by_realif(false, true);
- foreach($iflist as $realif => $if) {
- $ww_subnet_ip = get_interface_ip($if);
- $ww_subnet_bits = get_interface_subnet($if);
- if (ip_in_subnet($_POST['subnet'], gen_subnet($ww_subnet_ip, $ww_subnet_bits) . "/" . $ww_subnet_bits))
- $found = true;
- }
- if($found == false) {
+
+ $parent_ip = get_interface_ip($_POST['interface']);
+ $parent_sn = get_interface_subnet($_POST['interface']);
+ if (!ip_in_subnet($_POST['subnet'], gen_subnet($parent_ip, $parent_sn) . "/" . $parent_sn)) {
$cannot_find = $_POST['subnet'] . "/" . $_POST['subnet_bits'] ;
- $can_post = false;
- }
- if($can_post == false)
$input_errors[] = "Sorry, we could not locate an interface with a matching subnet for {$cannot_find}. Please add an IP alias in this subnet on this interface.";
+ }
}
if (!$input_errors) {
@@ -198,7 +189,7 @@ if ($_POST) {
if (isset($id) && $a_vip[$id]) {
if ($_POST['mode'] == "ipalias")
- mwexec("/sbin/ifconfig " . get_real_interface($a_vip[$id]['interface']) . " delete {$a_vip[$id]['subnet']}");
+ interface_vip_bring_down($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]['external-address'] == $a_vip[$id]['subnet'])
@@ -212,7 +203,7 @@ if ($_POST) {
write_config();
- header("Location: firewall_virtual_ip.php");
+ header("Location: firewall_virtual_ip.php?changes=mods&id={$id}");
exit;
}
}
OpenPOWER on IntegriCloud