mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
Add safety belts since only aliases on same subnet can be added to an carp(4)
This commit is contained in:
parent
dc2bb9e542
commit
a5a6ab2892
@ -134,7 +134,9 @@ if ($_POST) {
|
||||
/* make sure new ip is within the subnet of a valid ip
|
||||
* on one of our interfaces (wan, lan optX)
|
||||
*/
|
||||
if ($_POST['mode'] == "carp" or $_POST['mode'] == "carpdev-dhcp") {
|
||||
switch ($_POST['mode']) {
|
||||
case "carp":
|
||||
case "carpdev-dhcp":
|
||||
/* verify against reusage of vhids */
|
||||
$idtracker = 0;
|
||||
foreach($config['virtualip']['vip'] as $vip) {
|
||||
@ -151,8 +153,20 @@ if ($_POST) {
|
||||
$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);
|
||||
}
|
||||
break;
|
||||
case "ipalias":
|
||||
if (substr($_POST['interface'], 0, 3) == "vip") {
|
||||
$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) && !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);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (isset($id) && ($a_vip[$id])) {
|
||||
if ($a_vip[$id]['mode'] != $_POST['mode']) {
|
||||
$bringdown = false;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user