diff options
-rw-r--r-- | config/bandwidthd/bandwidthd.inc | 26 | ||||
-rw-r--r-- | config/bandwidthd/bandwidthd.xml | 22 | ||||
-rw-r--r-- | pkg_config.10.xml | 2 |
3 files changed, 44 insertions, 6 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> diff --git a/pkg_config.10.xml b/pkg_config.10.xml index 3011c7c9..2c4b1588 100644 --- a/pkg_config.10.xml +++ b/pkg_config.10.xml @@ -929,7 +929,7 @@ <website>http://bandwidthd.sourceforge.net/</website> <descr>BandwidthD tracks usage of TCP/IP network subnets and builds html files with graphs to display utilization. Charts are built by individual IPs, and by default display utilization over 2 day, 8 day, 40 day, and 400 day periods. Furthermore, each ip address's utilization can be logged out at intervals of 3.3 minutes, 10 minutes, 1 hour or 12 hours in cdf format, or to a backend database server. HTTP, TCP, UDP, ICMP, VPN, and P2P traffic are color coded.</descr> <category>System</category> - <version>0.6.1</version> + <version>0.6.2</version> <status>BETA</status> <required_version>2.2</required_version> <depends_on_package_pbi>bandwidthd-2.0.1_6-##ARCH##.pbi</depends_on_package_pbi> |