diff options
Diffstat (limited to 'config/bandwidthd')
-rw-r--r-- | config/bandwidthd/bandwidthd.inc | 26 | ||||
-rw-r--r-- | config/bandwidthd/bandwidthd.xml | 22 |
2 files changed, 43 insertions, 5 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'])) { diff --git a/config/bandwidthd/bandwidthd.xml b/config/bandwidthd/bandwidthd.xml index 1668f748..c7d6044d 100644 --- a/config/bandwidthd/bandwidthd.xml +++ b/config/bandwidthd/bandwidthd.xml @@ -46,7 +46,7 @@ <name>bandwidthd</name> <version>0.6</version> <title>Diagnostics: Bandwidthd</title> - <aftersaveredirect>/pkg_edit.php?xml=bandwidthd.xml&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&id=0</url> + <url>/pkg_edit.php?xml=bandwidthd.xml</url> </menu> <service> <name>bandwidthd</name> @@ -119,6 +119,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 +169,7 @@ </description> <type>checkbox</type> <default_value>on</default_value> + <enablefields>meta_refresh,skipintervals,graphcutoff</enablefields> </field> <field> <fielddescr>Meta Refresh</fielddescr> @@ -194,6 +209,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 +295,7 @@ <type>textarea</type> <encoding>base64</encoding> <cols>65</cols> - <rows>1</rows> + <rows>5</rows> <advancedfield/> </field> </fields> |