aboutsummaryrefslogtreecommitdiffstats
path: root/config/bandwidthd
diff options
context:
space:
mode:
Diffstat (limited to 'config/bandwidthd')
-rw-r--r--config/bandwidthd/bandwidthd.inc29
-rw-r--r--config/bandwidthd/bandwidthd.priv.inc37
-rw-r--r--config/bandwidthd/bandwidthd.xml28
3 files changed, 85 insertions, 9 deletions
diff --git a/config/bandwidthd/bandwidthd.inc b/config/bandwidthd/bandwidthd.inc
index 9364cbbc..d7973433 100644
--- a/config/bandwidthd/bandwidthd.inc
+++ b/config/bandwidthd/bandwidthd.inc
@@ -45,13 +45,10 @@ switch ($pfs_version) {
}
function bandwidthd_install_deinstall() {
- conf_mount_rw();
- stop_service("bandwidthd");
mwexec("/bin/rm -rf " . PKG_BANDWIDTHD_BASE . "/htdocs");
mwexec("/bin/rm -f /usr/local/www/bandwidthd");
// Remove the cron job, if it is there
install_cron_job("/bin/kill -HUP `cat /var/run/bandwidthd.pid`", false);
- conf_mount_ro();
}
function bandwidthd_install_config() {
@@ -81,6 +78,17 @@ function bandwidthd_install_config() {
$subnets .= "subnet " . gen_subnet(get_interface_ip($iface),get_interface_subnet($iface)) . "/" . get_interface_subnet($iface) . "\n";
}
}
+
+ /* Configure extra stats subnet(s) */
+ $subnets_extra = explode(';', str_replace(' ', '', $bandwidthd_config['subnets_extra']));
+ if (is_array($subnets_extra)) {
+ foreach ($subnets_extra as $sn) {
+ if (!empty($sn) && is_subnetv4($sn)) {
+ $subnets .= "subnet {$sn}\n";
+ }
+ }
+ }
+
$promiscuous_val = ($bandwidthd_config['promiscuous'] != "" ? "promiscuous true" : "promiscuous false");
$sensor_id_string_val = ($bandwidthd_config['sensorid'] != "" ? "sensor_id \"{$bandwidthd_config['sensorid']}\"" : "");
@@ -105,7 +113,7 @@ function bandwidthd_install_config() {
/* Advanced Filter */
if ($bandwidthd_config['advfilter']) {
- $filter_text_val = "filter " . escapeshellarg(base64_decode($bandwidthd_config['advfilter']));
+ $filter_text_val = 'filter "' . base64_decode($bandwidthd_config['advfilter']) . '"';
} else {
$filter_text_val = "";
}
@@ -282,7 +290,7 @@ EOD;
}
/* Cron job for graphs */
- if (($bandwidthd_config['enable']) && ($output_cdf)) {
+ if (($bandwidthd_config['enable']) && ($bandwidthd_config['outputcdf'])) {
// Use cron job to rotate logs every day at 00:01
install_cron_job("/bin/kill -HUP `cat /var/run/bandwidthd.pid`", true, "1", "0");
} else {
@@ -379,6 +387,17 @@ function bandwidthd_validate_input($post, &$input_errors) {
} else {
$input_errors[] = "You must select at least on interface under 'Subnet(s) for Statistics Collection'.";
}
+ // Extra subnets
+ if ($post['subnets_extra']) {
+ $subnets_extra = explode(';', str_replace(' ', '', $post['subnets_extra']));
+ if (is_array($subnets_extra)) {
+ foreach ($subnets_extra as $sn) {
+ if (!is_subnetv4($sn)) {
+ $input_errors[] = gettext("'Extra Subnet(s) for Statistics Collection' may only contain valid IPv4 subnet(s).");
+ }
+ }
+ }
+ }
// Only support sane characters in Sensor ID
if ($post['sensorid']) {
if ((!is_hostname($post['sensorid'])) && !preg_match("/^[a-zA-Z0-9\-\=\(\):. ]*$/", $post['sensorid'])) {
diff --git a/config/bandwidthd/bandwidthd.priv.inc b/config/bandwidthd/bandwidthd.priv.inc
new file mode 100644
index 00000000..4cde70a9
--- /dev/null
+++ b/config/bandwidthd/bandwidthd.priv.inc
@@ -0,0 +1,37 @@
+<?php
+/*
+ bandwidthd.priv.inc
+ part of pfSense (http://www.pfSense.org/)
+ Copyright (C) 2015 ESF, LLC
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+*/
+global $priv_list;
+
+$priv_list['page-diagnostics-bandwidthd-settings'] = array();
+$priv_list['page-diagnostics-bandwidthd-settings']['name'] = "WebCfg - Diagnostics: BandwidthD settings";
+$priv_list['page-diagnostics-bandwidthd-settings']['descr'] = "Allow access to BandwidthD package settings GUI";
+$priv_list['page-diagnostics-bandwidthd-settings']['match'] = array();
+$priv_list['page-diagnostics-bandwidthd-settings']['match'][] = "pkg_edit.php?xml=bandwidthd.xml*";
+
+?>
diff --git a/config/bandwidthd/bandwidthd.xml b/config/bandwidthd/bandwidthd.xml
index 1668f748..83aaa1e0 100644
--- a/config/bandwidthd/bandwidthd.xml
+++ b/config/bandwidthd/bandwidthd.xml
@@ -44,9 +44,9 @@
]]>
</copyright>
<name>bandwidthd</name>
- <version>0.6</version>
+ <version>0.6.1</version>
<title>Diagnostics: Bandwidthd</title>
- <aftersaveredirect>/pkg_edit.php?xml=bandwidthd.xml&amp;id=0</aftersaveredirect>
+ <aftersaveredirect>/pkg_edit.php?xml=bandwidthd.xml</aftersaveredirect>
<include_file>/usr/local/pkg/bandwidthd.inc</include_file>
<menu>
<name>BandwidthD</name>
@@ -58,7 +58,7 @@
<name>BandwidthD Settings</name>
<tooltiptext></tooltiptext>
<section>Diagnostics</section>
- <url>/pkg_edit.php?xml=bandwidthd.xml&amp;id=0</url>
+ <url>/pkg_edit.php?xml=bandwidthd.xml</url>
</menu>
<service>
<name>bandwidthd</name>
@@ -83,6 +83,10 @@
<prefix>/usr/local/pkg/</prefix>
<item>https://packages.pfsense.org/packages/config/bandwidthd/bandwidthd.inc</item>
</additional_files_needed>
+ <additional_files_needed>
+ <prefix>/etc/inc/priv/</prefix>
+ <item>https://packages.pfsense.org/packages/config/bandwidthd/bandwidthd.priv.inc</item>
+ </additional_files_needed>
<fields>
<field>
<name>General Options</name>
@@ -119,6 +123,20 @@
<required/>
</field>
<field>
+ <fielddescr>Extra Subnet(s) for Statistics Collection</fielddescr>
+ <fieldname>subnets_extra</fieldname>
+ <description>
+ <![CDATA[
+ Specify additional IPv4 subnet(s) in CIDR notation for statistics collection (or leave empty if none).
+ For multiple subnets, separate entries with ';'<br />
+ (Example: 192.168.1.0/24;10.0.0.0/24)<br />
+ <strong>Note: Do NOT specify any local subnets already selected in 'Subnet(s) for Statistics Collection' above!</strong>
+ ]]>
+ </description>
+ <type>input</type>
+ <size>50</size>
+ </field>
+ <field>
<fielddescr>Promiscuous</fielddescr>
<fieldname>promiscuous</fieldname>
<description>
@@ -155,6 +173,7 @@
</description>
<type>checkbox</type>
<default_value>on</default_value>
+ <enablefields>meta_refresh,skipintervals,graphcutoff</enablefields>
</field>
<field>
<fielddescr>Meta Refresh</fielddescr>
@@ -194,6 +213,7 @@
<fieldname>outputcdf</fieldname>
<description>Log data to CDF files log*.cdf</description>
<type>checkbox</type>
+ <enablefields>recovercdf</enablefields>
</field>
<field>
<fielddescr>Recover CDF</fielddescr>
@@ -279,7 +299,7 @@
<type>textarea</type>
<encoding>base64</encoding>
<cols>65</cols>
- <rows>1</rows>
+ <rows>5</rows>
<advancedfield/>
</field>
</fields>