summaryrefslogtreecommitdiffstats
path: root/usr/local/www/firewall_virtual_ip_edit.php
diff options
context:
space:
mode:
authorRenato Botelho <garga@FreeBSD.org>2013-03-01 10:02:21 -0300
committerRenato Botelho <garga@FreeBSD.org>2013-03-01 10:02:21 -0300
commit17ff2c46c266863b7c7b0af2ef5e39bf2894171a (patch)
tree90260adbd0af900096e3ef91e3788c22ef72ba56 /usr/local/www/firewall_virtual_ip_edit.php
parent0692dea8739c9bcba7578fc16fb7d024f0fd3c2c (diff)
downloadpfsense-17ff2c46c266863b7c7b0af2ef5e39bf2894171a.zip
pfsense-17ff2c46c266863b7c7b0af2ef5e39bf2894171a.tar.gz
Add check for ipv6 subnet when adding aliases with CARP parents
Diffstat (limited to 'usr/local/www/firewall_virtual_ip_edit.php')
-rwxr-xr-xusr/local/www/firewall_virtual_ip_edit.php13
1 files changed, 10 insertions, 3 deletions
diff --git a/usr/local/www/firewall_virtual_ip_edit.php b/usr/local/www/firewall_virtual_ip_edit.php
index db36848..a018ddf 100755
--- a/usr/local/www/firewall_virtual_ip_edit.php
+++ b/usr/local/www/firewall_virtual_ip_edit.php
@@ -167,9 +167,16 @@ if ($_POST) {
break;
case "ipalias":
if (strstr($_POST['interface'], "_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'])) {
+ if (is_ipaddrv4($_POST['subnet'])) {
+ $parent_ip = get_interface_ip($_POST['interface']);
+ $parent_sn = get_interface_subnet($_POST['interface']);
+ $subnet = gen_subnet($parent_ip, $parent_sn);
+ } else if (is_ipaddrv6($_POST['subnet'])) {
+ $parent_ip = get_interface_ipv6($_POST['interface']);
+ $parent_sn = get_interface_subnetv6($_POST['interface']);
+ $subnet = gen_subnetv6($parent_ip, $parent_sn);
+ }
+ if (isset($parent_ip) && !ip_in_subnet($_POST['subnet'], "{$subnet}/{$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);
}
OpenPOWER on IntegriCloud