aboutsummaryrefslogtreecommitdiffstats
path: root/config/bandwidthd/bandwidthd.inc
diff options
context:
space:
mode:
Diffstat (limited to 'config/bandwidthd/bandwidthd.inc')
-rw-r--r--config/bandwidthd/bandwidthd.inc26
1 files changed, 24 insertions, 2 deletions
diff --git a/config/bandwidthd/bandwidthd.inc b/config/bandwidthd/bandwidthd.inc
index 0029a05d..d7973433 100644
--- a/config/bandwidthd/bandwidthd.inc
+++ b/config/bandwidthd/bandwidthd.inc
@@ -78,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']}\"" : "");
@@ -102,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 = "";
}
@@ -279,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 {
@@ -376,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'])) {