diff options
author | Seth Mos <seth.mos@xs4all.nl> | 2008-11-06 15:04:11 +0000 |
---|---|---|
committer | Seth Mos <seth.mos@xs4all.nl> | 2008-11-06 15:04:11 +0000 |
commit | da7c792a53ae6e6b83f8189fac84767c163ce710 (patch) | |
tree | 9231b2edbbba8871e24ba529853cac014d551c12 | |
parent | d2c97ea1941c733776c040f2143fead617865a67 (diff) | |
download | pfsense-da7c792a53ae6e6b83f8189fac84767c163ce710.zip pfsense-da7c792a53ae6e6b83f8189fac84767c163ce710.tar.gz |
Only delete routes if they exist.
-rw-r--r-- | etc/inc/system.inc | 5 |
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); |