aboutsummaryrefslogtreecommitdiffstats
path: root/config/bandwidthd
diff options
context:
space:
mode:
authordoktornotor <notordoktor@gmail.com>2015-08-31 12:21:18 +0200
committerdoktornotor <notordoktor@gmail.com>2015-08-31 12:21:18 +0200
commit56331a96e93b2f58c9db0870fb8074490ba00b04 (patch)
tree00d47d711b5f0252a6c53b4684bed3aceaa3b652 /config/bandwidthd
parentd69f749a1fa008007073714b3b3dbbbc43ef4155 (diff)
downloadpfsense-packages-56331a96e93b2f58c9db0870fb8074490ba00b04.tar.gz
pfsense-packages-56331a96e93b2f58c9db0870fb8074490ba00b04.tar.bz2
pfsense-packages-56331a96e93b2f58c9db0870fb8074490ba00b04.zip
bandwidthd - re-add custom subnets feature, fix advanced filter
bandwidthd explodes on using single quotes in config... sigh
Diffstat (limited to 'config/bandwidthd')
-rw-r--r--config/bandwidthd/bandwidthd.inc24
1 files changed, 23 insertions, 1 deletions
diff --git a/config/bandwidthd/bandwidthd.inc b/config/bandwidthd/bandwidthd.inc
index 0029a05d..0c93c861 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 = "";
}
@@ -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'])) {