summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSeth Mos <seth.mos@xs4all.nl>2008-11-06 15:04:11 +0000
committerSeth Mos <seth.mos@xs4all.nl>2008-11-06 15:04:11 +0000
commitda7c792a53ae6e6b83f8189fac84767c163ce710 (patch)
tree9231b2edbbba8871e24ba529853cac014d551c12
parentd2c97ea1941c733776c040f2143fead617865a67 (diff)
downloadpfsense-da7c792a53ae6e6b83f8189fac84767c163ce710.zip
pfsense-da7c792a53ae6e6b83f8189fac84767c163ce710.tar.gz
Only delete routes if they exist.
-rw-r--r--etc/inc/system.inc5
1 files changed, 4 insertions, 1 deletions
diff --git a/etc/inc/system.inc b/etc/inc/system.inc
index 20559bc..bc7436d 100644
--- a/etc/inc/system.inc
+++ b/etc/inc/system.inc
@@ -231,6 +231,9 @@ function system_routing_configure() {
mwexec("/sbin/sysctl net.inet.ip.fastforwarding=1");
/* clear out old routes, if necessary */
+ exec("/sbin/netstat -rn", $route_arr, $retval);
+ $route_str = implode("\n", $route_arr);
+
if (file_exists("{$g['vardb_path']}/routes.db")) {
$fd = fopen("{$g['vardb_path']}/routes.db", "r");
if (!$fd) {
@@ -239,7 +242,7 @@ function system_routing_configure() {
}
while (!feof($fd)) {
$oldrt = fgets($fd);
- if ($oldrt)
+ if (preg_match("/{$oldrt}/", $route_str))
mwexec("/sbin/route delete " . escapeshellarg($oldrt));
}
fclose($fd);
OpenPOWER on IntegriCloud