summaryrefslogtreecommitdiffstats
path: root/usr/local/www/system_routes_edit.php
diff options
context:
space:
mode:
authorRenato Botelho <garga@FreeBSD.org>2013-03-04 09:37:24 -0300
committerRenato Botelho <garga@FreeBSD.org>2013-03-04 09:37:24 -0300
commit74889b22327fedff1a1a1d994f8dc67860098763 (patch)
tree80e6a438b80c5113b54bf387bff1cf2576164534 /usr/local/www/system_routes_edit.php
parente480d64bc5eb7a9accaad93b8845df1bf8bbb2f3 (diff)
downloadpfsense-74889b22327fedff1a1a1d994f8dc67860098763.zip
pfsense-74889b22327fedff1a1a1d994f8dc67860098763.tar.gz
When adding a new static route, check if network address conflicts with interfaces. It will complement ticket #2852
Diffstat (limited to 'usr/local/www/system_routes_edit.php')
-rwxr-xr-xusr/local/www/system_routes_edit.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/usr/local/www/system_routes_edit.php b/usr/local/www/system_routes_edit.php
index 1a27e88..673eb7f 100755
--- a/usr/local/www/system_routes_edit.php
+++ b/usr/local/www/system_routes_edit.php
@@ -158,6 +158,24 @@ if ($_POST) {
$input_errors[] = gettext("A route to these destination networks already exists") . ": " . implode(", ", $overlaps);
}
+ if (is_array($config['interfaces'])) {
+ foreach ($config['interfaces'] as $if) {
+ if (is_ipaddrv4($_POST['network'])
+ && isset($if['ipaddr']) && isset($if['subnet'])
+ && is_ipaddrv4($if['ipaddr']) && is_numeric($if['subnet'])
+ && ($_POST['network_subnet'] == $if['subnet'])
+ && (gen_subnet($_POST['network'], $_POST['network_subnet']) == gen_subnet($if['ipaddr'], $if['subnet'])))
+ $input_errors[] = sprintf(gettext("This network conflicts with address configured on interface %s."), $if['descr']);
+
+ else if (is_ipaddrv6($_POST['network'])
+ && isset($if['ipaddrv6']) && isset($if['subnetv6'])
+ && is_ipaddrv6($if['ipaddrv6']) && is_numeric($if['subnetv6'])
+ && ($_POST['network_subnet'] == $if['subnetv6'])
+ && (gen_subnetv6($_POST['network'], $_POST['network_subnet']) == gen_subnetv6($if['ipaddrv6'], $if['subnetv6'])))
+ $input_errors[] = sprintf(gettext("This network conflicts with address configured on interface %s."), $if['descr']);
+ }
+ }
+
if (!$input_errors) {
$route = array();
$route['network'] = $osn;
OpenPOWER on IntegriCloud