Allow setup on any interface
authorJamie Cameron <jcameron@webmin.com>
Sat, 2 Feb 2008 23:24:53 +0000 (23:24 +0000)
committerJamie Cameron <jcameron@webmin.com>
Sat, 2 Feb 2008 23:24:53 +0000 (23:24 +0000)
bandwidth/CHANGELOG
bandwidth/index.cgi
bandwidth/lang/en
bandwidth/setup.cgi

index 60bb76a..6d9aeef 100644 (file)
@@ -6,3 +6,5 @@ Added the ability to specify multiple ports with a range like 100-200.
 This module will now work with FreeBSD's IPFW firewall too, although data counts may not be completely accurate as individual packet sizes are not logged. Instead, only the average packet size for each hour is available.
 Firewall rules are now correctly created even when using Shorewall, by adding them to the /etc/shorewall/start file.
 The module now also supports the IPFilter firewall, although counts may not be accurate on fast network interfaces, as IPFilter appears to not log all packets.
+---- Changes since 1.390 ----
+Bandwidth monitoring can now be setup on an interface that isn't currently active, including patterns like ppp+.
index 25bcc84..b431814 100755 (executable)
@@ -105,7 +105,10 @@ if (($missingrule || !$sysconf) && $access{'setup'}) {
                push(@ifaces, $i->{'fullname'}) if ($i->{'virtual'} eq '');
                }
        print &ui_select("iface", $config{'iface'},
-                        [ map { [ $_, $_ ] } &unique(@ifaces) ]);
+                        [ (map { [ $_, $_ ] } &unique(@ifaces)),
+                          [ '', $text{'index_other'} ] ],
+                        1, 0, $config{'iface'} ? 1 : 0)." ".
+             &ui_textbox("other", undef, 10);
        print &ui_submit($text{'index_setup'});
        print &ui_form_end();
        print "<p>\n";
index 0f52275..31ee44e 100644 (file)
@@ -13,6 +13,7 @@ index_missing3=Several firewall rules must be added, and a syslog configuration
 index_missing2=Several firewall rules must be added.
 index_missing1=A syslog configuration entry must be created.
 index_iface=External network interface
+index_other=Other..
 index_setup=Setup Now
 index_by=Show traffic by
 index_hour=hour
@@ -66,6 +67,7 @@ acl_setup=Can setup and disable monitoring?
 turnoff_ecannot=You are not allowed to disable monitoring
 
 setup_ecannot=You are not allowed to enable monitoring
+setup_eiface=Missing or invalid interface name
 setup_ezone=Failed to fine Shorewall zone for the selected interface
 
 system_firewall=IPtables
index 141ced3..2c7fb40 100755 (executable)
@@ -5,8 +5,12 @@ require './bandwidth-lib.pl';
 &ReadParse();
 $access{'setup'} || &error($text{'setup_ecannot'});
 
+# Work out interface
+$iface = $in{'iface'} || $in{'other'};
+$iface =~ /^\S+$/ || &error($text{'setup_eiface'});
+
 # Add missing firewall rules
-$err = &setup_rules($in{'iface'});
+$err = &setup_rules($iface);
 &error($err) if ($err);
 
 if ($syslog_module eq "syslog") {
@@ -91,7 +95,7 @@ else {
 
 # Save the interface
 &lock_file($module_config_file);
-$config{'iface'} = $in{'iface'};
+$config{'iface'} = $iface;
 &save_module_config();
 &unlock_file($module_config_file);
 
@@ -113,6 +117,6 @@ if (!$job) {
        &unlock_file(&cron::cron_file($job));
        }
 
-&webmin_log("setup", undef, $in{'iface'});
+&webmin_log("setup", undef, $iface);
 &redirect("");