diff options
author | Renato Botelho <garga@FreeBSD.org> | 2013-03-16 08:34:50 -0300 |
---|---|---|
committer | Renato Botelho <garga@FreeBSD.org> | 2013-03-16 08:34:50 -0300 |
commit | fba196c34bc06b6c60b331e46b4cc34ee9079a03 (patch) | |
tree | a30652dd1d873dea07b89d56bbbef34d4ed43f03 /usr/local | |
parent | e1968b0ddcf86b34bd718420ac94e2408e06e345 (diff) | |
download | pfsense-fba196c34bc06b6c60b331e46b4cc34ee9079a03.zip pfsense-fba196c34bc06b6c60b331e46b4cc34ee9079a03.tar.gz |
Avoid deleting the RA Subnet when IP is invalid, also simplify it a bit
Diffstat (limited to 'usr/local')
-rw-r--r-- | usr/local/www/services_router_advertisements.php | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/usr/local/www/services_router_advertisements.php b/usr/local/www/services_router_advertisements.php index 0f81b89..3211986 100644 --- a/usr/local/www/services_router_advertisements.php +++ b/usr/local/www/services_router_advertisements.php @@ -88,7 +88,7 @@ if (!$if || !isset($iflist[$if])) { } } -if (is_array($config['dhcpdv6'][$if])){ +if (is_array($config['dhcpdv6'][$if])) { /* RA specific */ $pconfig['ramode'] = $config['dhcpdv6'][$if]['ramode']; $pconfig['rapriority'] = $config['dhcpdv6'][$if]['rapriority']; @@ -101,9 +101,8 @@ if (is_array($config['dhcpdv6'][$if])){ $pconfig['subnets'] = $config['dhcpdv6'][$if]['subnets']['item']; } -if (!is_array($pconfig['subnets'])) { +if (!is_array($pconfig['subnets'])) $pconfig['subnets'] = array(); -} $advertise_modes = array("disabled" => "Disabled", "router" => "Router Only", @@ -121,7 +120,6 @@ $subnets_help = gettext("Subnets are specified in CIDR format. " . "If no subnets are specified here, the Router Advertisement (RA) Daemon will advertise to the subnet to which the router's interface is assigned."); if ($_POST) { - unset($input_errors); $pconfig = $_POST; @@ -131,22 +129,19 @@ if ($_POST) { $pconfig['subnets'] = array(); for ($x = 0; $x < 5000; $x += 1) { $address = trim($_POST['subnet_address' . $x]); - $bits = trim($_POST['subnet_bits' . $x]); - if ($address === "") { + if ($address === "") continue; - } - if (is_ipaddrv6($address)) { - if ($bits === "") { - $pconfig['subnets'][] = $address . "/128"; - } else { - $pconfig['subnets'][] = $address . "/" . $bits; - } - } - else if (is_alias($address)) { + + $bits = trim($_POST['subnet_bits' . $x]); + if ($bits === "") + $bits = "128"; + + if (is_alias($address)) { $pconfig['subnets'][] = $address; - } - else { - $input_errors[] = sprintf(gettext("An invalid subnet or alias was specified. [%s/%s]"), $address, $bits); + } else { + $pconfig['subnets'][] = $address . "/" . $bits; + if (!is_ipaddrv6($address)) + $input_errors[] = sprintf(gettext("An invalid subnet or alias was specified. [%s/%s]"), $address, $bits); } } |