diff options
author | Phil Davis <phil.davis@inf.org> | 2016-04-15 17:40:21 +0545 |
---|---|---|
committer | Stephen Beaver <sbeaver@netgate.com> | 2016-04-20 07:53:25 -0400 |
commit | af69e4d63cd46c5503cf4578fb3adbf1fa745883 (patch) | |
tree | ce42b350a3d11c6913ac0dc73f1fde431a31c03d /src | |
parent | 048f29dce62d8398bf0187a9ca9ff1d0541031f5 (diff) | |
download | pfsense-af69e4d63cd46c5503cf4578fb3adbf1fa745883.zip pfsense-af69e4d63cd46c5503cf4578fb3adbf1fa745883.tar.gz |
Add checks in case there are dpinger param problems
in 2.3 installations that were upgraded from 2.2.* when the apinger to
dpinger params conversion code in upgrade_130_to_131() was not so good.
(cherry picked from commit f8f2eae491ac44ac5cdbd1fd3d38d7c2c36f48f8)
Diffstat (limited to 'src')
-rw-r--r-- | src/conf.default/config.xml | 2 | ||||
-rw-r--r-- | src/etc/inc/globals.inc | 2 | ||||
-rw-r--r-- | src/etc/inc/upgrade_config.inc | 59 |
3 files changed, 61 insertions, 2 deletions
diff --git a/src/conf.default/config.xml b/src/conf.default/config.xml index d33788e..3b76753 100644 --- a/src/conf.default/config.xml +++ b/src/conf.default/config.xml @@ -1,6 +1,6 @@ <?xml version="1.0"?> <pfsense> - <version>15.0</version> + <version>15.1</version> <lastchange/> <system> <optimization>normal</optimization> diff --git a/src/etc/inc/globals.inc b/src/etc/inc/globals.inc index 8b2e6ae..e7c9543 100644 --- a/src/etc/inc/globals.inc +++ b/src/etc/inc/globals.inc @@ -99,7 +99,7 @@ $g = array( "disablecrashreporter" => false, "crashreporterurl" => "https://crashreporter.pfsense.org/crash_reporter.php", "debug" => false, - "latest_config" => "15.0", + "latest_config" => "15.1", "nopkg_platforms" => array("cdrom"), "minimum_ram_warning" => "101", "minimum_ram_warning_text" => "128 MB", diff --git a/src/etc/inc/upgrade_config.inc b/src/etc/inc/upgrade_config.inc index 468ff30..72b7c7a 100644 --- a/src/etc/inc/upgrade_config.inc +++ b/src/etc/inc/upgrade_config.inc @@ -4833,4 +4833,63 @@ function upgrade_149_to_150() { } } } + +function upgrade_150_to_151() { + global $config; + + // Default dpinger parameters at time of this upgrade (2.3.1) + $default_interval = 500; + $default_alert_interval = 1000; + $default_loss_interval = 2000; + $default_time_period = 60000; + $default_latencyhigh = 500; + + // Check advanced gateway parameter relationships in case they are incorrect + foreach ($config['gateways']['gateway_item'] as &$gw) { + if (isset($gw['interval'])) { + $effective_interval = $gw['interval']; + } else { + $effective_interval = $default_interval; + } + + if (isset($gw['alert_interval'])) { + $effective_alert_interval = $gw['alert_interval']; + } else { + $effective_alert_interval = $default_alert_interval; + } + + if (isset($gw['loss_interval'])) { + $effective_loss_interval = $gw['loss_interval']; + } else { + $effective_loss_interval = $default_loss_interval; + } + + if (isset($gw['time_period'])) { + $effective_time_period = $gw['time_period']; + } else { + $effective_time_period = $default_time_period; + } + + if (isset($gw['latencyhigh'])) { + $effective_latencyhigh = $gw['latencyhigh']; + } else { + $effective_latencyhigh = $default_latencyhigh; + } + + // Loss interval has to be at least as big as high latency. + if ($effective_latencyhigh > $effective_loss_interval) { + $effective_loss_interval = $gw['loss_interval'] = $effective_latencyhigh; + } + + // Alert interval has to be at least as big as probe interval. + if ($effective_interval > $effective_alert_interval) { + $gw['alert_interval'] = $effective_interval; + } + + // The time period for averaging has to be more than 2 probes plus the loss interval. + if ((($effective_interval * 2) + $effective_loss_interval) >= $effective_time_period) { + $gw['time_period'] = ($effective_interval * 2) + $effective_loss_interval + 1; + } + } +} ?> |