From 0882c6d2395499810d56d08e3f6d51caccbb5aeb Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Mon, 28 Jan 2008 23:56:55 +0000 Subject: Use ip_in_subnet() to correctly determineif we have a matching real ip address defined somewhere before allowing the CARP address to be added. --- usr/local/www/firewall_virtual_ip_edit.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'usr/local') diff --git a/usr/local/www/firewall_virtual_ip_edit.php b/usr/local/www/firewall_virtual_ip_edit.php index 29827b4..f52529d 100755 --- a/usr/local/www/firewall_virtual_ip_edit.php +++ b/usr/local/www/firewall_virtual_ip_edit.php @@ -132,12 +132,10 @@ if ($_POST) { for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) $iflist['opt' . $i] = 'opt' . $i; foreach($iflist as $if) { - $ww_subnet_ip = return_first_two_octets($config['interfaces'][$if]['ipaddr']); - $ww_subnet_bits = return_first_two_octets($config['interfaces'][$if]['subnet']); - if($ww_subnet_ip == $subnet_ip and $ww_subnet_bits == $_POST['subnet_bits']) { + $ww_subnet_ip = $config['interfaces'][$if]['ipaddr']; + $ww_subnet_bits = $config['interfaces'][$if]['subnet']; + if (ip_in_subnet($_POST['subnet'], gen_subnet($ww_subnet_ip, $ww_subnet_bits) . "/" . $ww_subnet_bits)) $found = true; - break; - } } if($found == false) { $cannot_find = $_POST['subnet'] . "/" . $_POST['subnet_bits'] ; -- cgit v1.1