summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2015-11-23 07:35:01 -0200
committerRenato Botelho <renato@netgate.com>2015-11-23 07:35:01 -0200
commit5540759e049386ff09cd2e2a89f04f93f7ab2686 (patch)
tree94a0878edb0e171e5d142dafc98fc2cf75ab2180
parentda6f84829696e203afe36c6497ff0fda91630a58 (diff)
downloadpfsense-5540759e049386ff09cd2e2a89f04f93f7ab2686.zip
pfsense-5540759e049386ff09cd2e2a89f04f93f7ab2686.tar.gz
Optimize upgrade_128_to_129()
-rw-r--r--src/etc/inc/upgrade_config.inc18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/etc/inc/upgrade_config.inc b/src/etc/inc/upgrade_config.inc
index a09d5d8..147dc4e 100644
--- a/src/etc/inc/upgrade_config.inc
+++ b/src/etc/inc/upgrade_config.inc
@@ -4109,17 +4109,15 @@ function upgrade_128_to_129() {
global $config;
/* net.inet.ip.fastforwarding does not exist in 2.3. */
- if (isset($config['sysctl']) && is_array($config['sysctl']) &&
- isset($config['sysctl']['item']) && is_array($config['sysctl']['item'])) {
- $i = 0;
- $tmp['item'] = array();
- foreach ($config['sysctl']['item'] as $sysctl) {
- if ($sysctl['tunable'] === "net.inet.ip.fastforwarding")
- continue;
- $tmp['item'][$i++] = $sysctl;
+ if (!isset($config['sysctl']['item']) ||
+ !is_array($config['sysctl']['item'])) {
+ return;
+ }
+
+ foreach ($config['sysctl']['item'] as $idx => $sysctl) {
+ if ($sysctl['tunable'] == "net.inet.ip.fastforwarding") {
+ unset($config['sysctl']['item'][$idx]);
}
- $config['sysctl'] = $tmp;
- unset($tmp);
}
}
OpenPOWER on IntegriCloud