summaryrefslogtreecommitdiffstats
path: root/usr/local/www/system_routes.php
diff options
context:
space:
mode:
authorRenato Botelho <garga@FreeBSD.org>2013-04-15 12:12:07 -0300
committerRenato Botelho <garga@FreeBSD.org>2013-04-15 12:12:25 -0300
commit25c3f30c612dba4c7ee6c15eed3f9feee28d5603 (patch)
treeb67d52c903cd4308f3fdaec9e103be3696987a8e /usr/local/www/system_routes.php
parentef593cd3c06bcc9c314639697e65bb59dfbc56f8 (diff)
downloadpfsense-25c3f30c612dba4c7ee6c15eed3f9feee28d5603.zip
pfsense-25c3f30c612dba4c7ee6c15eed3f9feee28d5603.tar.gz
Be able to delete static routes that uses aliases. Fixes #2948
Diffstat (limited to 'usr/local/www/system_routes.php')
-rwxr-xr-xusr/local/www/system_routes.php37
1 files changed, 26 insertions, 11 deletions
diff --git a/usr/local/www/system_routes.php b/usr/local/www/system_routes.php
index b331dbb..b5dd849 100755
--- a/usr/local/www/system_routes.php
+++ b/usr/local/www/system_routes.php
@@ -80,18 +80,33 @@ if ($_POST) {
if ($_GET['act'] == "del") {
if ($a_routes[$_GET['id']]) {
- $changedesc .= gettext("removed route to") . " " . $a_routes[$_GET['id']['route']];
- list($ip, $mask) = explode("/", $a_routes[$_GET['id']]['network']);
- if (is_ipaddr($ip)) {
- $family = "";
- if(is_ipaddrv6($ip))
- $family = "-inet6";
- mwexec("/sbin/route delete {$family} " . escapeshellarg($a_routes[$_GET['id']]['network']));
- unset($a_routes[$_GET['id']]);
- write_config($changedesc);
- header("Location: system_routes.php");
- exit;
+ $changedesc .= gettext("removed route to") . " " . $a_routes[$_GET['id']]['route'];
+
+ $targets = array();
+ if (is_alias($a_routes[$_GET['id']]['network'])) {
+ foreach (filter_expand_alias_array($a_routes[$_GET['id']]['network']) as $tgt) {
+ if (is_ipaddrv4($tgt))
+ $tgt .= "/32";
+ else if (is_ipaddrv6($tgt))
+ $tgt .= "/128";
+ if (!is_subnet($tgt))
+ continue;
+ $targets[] = $tgt;
+ }
+ } else {
+ $targets[] = $a_routes[$_GET['id']]['network'];
}
+
+ foreach ($targets as $tgt) {
+ $family = (is_subnetv6($tgt) ? "-inet6" : "-inet");
+ mwexec("/sbin/route delete {$family} " . escapeshellarg($tgt));
+ }
+
+ unset($a_routes[$_GET['id']]);
+ unset($targets);
+ write_config($changedesc);
+ header("Location: system_routes.php");
+ exit;
}
}
OpenPOWER on IntegriCloud