aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhil Davis <phil.davis@world.inf.org>2012-07-15 12:49:51 +0545
committerPhil Davis <phil.davis@world.inf.org>2012-07-15 12:49:51 +0545
commit337ff37bacb9cd5797b110845e31b8f54bf92888 (patch)
tree748cd0b8556123325049ab1a95c76b755b98ba05
parentecbb8b086cc2defd17d1ecbae844b9d293e16e28 (diff)
downloadpfsense-packages-337ff37bacb9cd5797b110845e31b8f54bf92888.tar.gz
pfsense-packages-337ff37bacb9cd5797b110845e31b8f54bf92888.tar.bz2
pfsense-packages-337ff37bacb9cd5797b110845e31b8f54bf92888.zip
Put standard pfsense version check logic so it will default correctly for future versions of pfsense.
Previously, promiscuous mode was always stuck on - the bandwidthd default is "promiscuous true" and the code assumed the default was "false". This fix always specifies promiscuous mode explicitly so that it does not matter what the default is, the setting will always follow whatever the user has selected in the GUI check box. See forum thread http://forum.pfsense.org/index.php/topic,50878.0.html
-rw-r--r--config/bandwidthd/bandwidthd.inc23
1 files changed, 16 insertions, 7 deletions
diff --git a/config/bandwidthd/bandwidthd.inc b/config/bandwidthd/bandwidthd.inc
index da7260bc..bf0f5794 100644
--- a/config/bandwidthd/bandwidthd.inc
+++ b/config/bandwidthd/bandwidthd.inc
@@ -28,11 +28,17 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-if (substr(trim(file_get_contents("/etc/version")),0,3) == "2.1") {
- define('PKG_BANDWIDTHD_BASE', '/usr/pbi/bandwidthd-' . php_uname("m") . '/bandwidthd');
-} else {
- define('PKG_BANDWIDTHD_BASE', '/usr/local/bandwidthd');
-}
+// Check pfSense version
+$pfs_version = substr(trim(file_get_contents("/etc/version")),0,3);
+switch ($pfs_version) {
+ case "1.2":
+ case "2.0":
+ define('PKG_BANDWIDTHD_BASE', '/usr/local/bandwidthd');
+ break;
+ default:
+ define('PKG_BANDWIDTHD_BASE', '/usr/pbi/bandwidthd-' . php_uname("m") . '/bandwidthd');
+ }
+// End: Check pfSense version
function bandwidthd_install_deinstall() {
conf_mount_rw();
@@ -72,6 +78,9 @@ function bandwidthd_install_config() {
$promiscuous = $config['installedpackages']['bandwidthd']['config'][0]['promiscuous'];
if($promiscuous)
$promiscuous = "promiscuous true\n";
+ else
+ $promiscuous = "promiscuous false\n";
+
$graph_cutoff = $config['installedpackages']['bandwidthd']['config'][0]['graphcutoff'];
if($graph_cutoff)
$graph_cutoff = "graph_cutoff $graph_cutoff\n";
@@ -82,7 +91,7 @@ function bandwidthd_install_config() {
if($config['installedpackages']['bandwidthd']['config'][0]['active_interface']){
$ifdescrs = array($config['installedpackages']['bandwidthd']['config'][0]['active_interface']);
} else {
- log_error("You should specify a interface for bandwidthd to listen on. exiting.");
+ log_error("You should specify an interface for bandwidthd to listen on. Exiting.");
}
$subnets_custom = split(';',str_replace(' ','',$config['installedpackages']['bandwidthd']['config'][0]['subnets_custom']));
@@ -215,4 +224,4 @@ EOF;
}
-?>
+?> \ No newline at end of file