diff options
author | Renato Botelho <garga@FreeBSD.org> | 2013-04-15 12:12:07 -0300 |
---|---|---|
committer | Renato Botelho <garga@FreeBSD.org> | 2013-04-15 12:12:25 -0300 |
commit | 25c3f30c612dba4c7ee6c15eed3f9feee28d5603 (patch) | |
tree | b67d52c903cd4308f3fdaec9e103be3696987a8e | |
parent | ef593cd3c06bcc9c314639697e65bb59dfbc56f8 (diff) | |
download | pfsense-25c3f30c612dba4c7ee6c15eed3f9feee28d5603.zip pfsense-25c3f30c612dba4c7ee6c15eed3f9feee28d5603.tar.gz |
Be able to delete static routes that uses aliases. Fixes #2948
-rwxr-xr-x | usr/local/www/system_routes.php | 37 |
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; } } |