Show interface status on linux
authorJamie Cameron <jcameron@webmin.com>
Wed, 4 May 2011 21:46:03 +0000 (14:46 -0700)
committerJamie Cameron <jcameron@webmin.com>
Wed, 4 May 2011 21:46:03 +0000 (14:46 -0700)
net/CHANGELOG
net/edit_aifc.cgi
net/lang/en
net/linux-lib.pl
net/list_ifcs.cgi
spam/lang/nl

index 687717f..3c20e66 100644 (file)
@@ -57,3 +57,5 @@ Added a field for editing the MAC address to apply at boot time on Redhat and De
 Include hostname configuration files in backups, thanks to Caspar Smit.
 ---- Changes since 1.530 ----
 Static IPv6 addresses and default routes on Redhat, CentOS, Fedora, Debian and Ubuntu Linux systems, and Solaris can now be viewed and managed.
+---- Changes since 1.550 ----
+The speed, link status and duplex of active ethernet interfaces is now shown on the active interfaces page.
index 659a0dc..bec15d1 100755 (executable)
@@ -165,6 +165,18 @@ if ($a && $a->{'virtual'} eq "") {
                "(<a href='edit_aifc.cgi?new=1&virtual=$a->{'name'}'>".
                "$text{'ifcs_addvirt'}</a>)");
        }
+
+# Physical parameters
+if (defined($a->{'link'})) {
+       print &ui_table_row($text{'ifcs_link'},
+               $a->{'link'} ? $text{'ifcs_linkyes'}
+                            : "<font color=red>$text{'ifcs_linkno'}</font>");
+       }
+if ($a->{'speed'}) {
+       print &ui_table_row($text{'ifcs_speed'}, $a->{'speed'}.
+               ($a->{'duplex'} ? " ".&text('ifcs_duplex', $a->{'duplex'})
+                               : ""));
+       }
      
 # End of the form
 print &ui_table_end();
index 1441b8d..aafccbc 100644 (file)
@@ -48,6 +48,11 @@ ifcs_address6=IPv6 address
 ifcs_netmask6=Netmask
 ifcs_mode6a=IPv6 addresses
 ifcs_none6=IPv6 disabled
+ifcs_link=Network link status
+ifcs_linkyes=Connected
+ifcs_linkno=Dis-connected
+ifcs_speed=Interface speed
+ifcs_duplex=, $1 duplex
 
 aifc_create=Create Active Interface
 aifc_edit=Edit Active Interface
index a49b17b..9ec7038 100755 (executable)
@@ -13,6 +13,7 @@ while(<IFC>) {
        else { $lines[$#lines] .= $_; }
        }
 close(IFC);
+my $ethtool = &has_command("ethtool");
 foreach $l (@lines) {
        local %ifc;
        $l =~ /^([^:\s]+)/; $ifc{'name'} = $1;
@@ -39,6 +40,21 @@ foreach $l (@lines) {
        $ifc{'scope6'} = \@scope6;
        $ifc{'edit'} = ($ifc{'name'} !~ /^ppp/);
        $ifc{'index'} = scalar(@rv);
+
+       # Get current status for ethtool
+       if ($ifc{'fullname'} =~ /^eth(\d+)$/ && $ethtool) {
+               my $out = &backquote_logged(
+                       "$ethtool $ifc{'fullname'} 2>/dev/null");
+               if ($out =~ /Speed:\s+(\S+)/i) {
+                       $ifc{'speed'} = $1;
+                       }
+               if ($out =~ /Duplex:\s+(\S+)/i) {
+                       $ifc{'duplex'} = $1;
+                       }
+               if ($out =~ /Link\s+detected:\s+(\S+)/i) {
+                       $ifc{'link'} = lc($1) eq 'yes' ? 1 : 0;
+                       }
+               }
        push(@rv, \%ifc);
        }
 return @rv;
index e6e97fa..222f66c 100755 (executable)
@@ -80,7 +80,8 @@ if (!$access{'bootonly'}) {
                push(@cols, &iface_type($a->{'name'}).
                      ($a->{'virtual'} eq "" ||
                       $mod ? "" : " ($text{'ifcs_virtual'})").
-                     (%minfo ? " ($minfo{'desc'})" : ""));
+                     (%minfo ? " ($minfo{'desc'})" : "").
+                     ($a->{'speed'} ? " ".$a->{'speed'} : ""));
                push(@cols, &html_escape($a->{'address'}));
                push(@cols, &html_escape($a->{'netmask'}));
                if (&supports_address6()) {
index 2670d9e..e05d372 100644 (file)
@@ -301,7 +301,7 @@ simple_name=Test naam
 simple_regexp=Overeenkomende expressie
 simple_score=Score om toe te voegen
 simple_switch=Schakel naar geavanceerde mode ..
-simple_title=$header_title
+simple_title=Header en Body Tests
 user_bodymax=DCC body checksum tellen voordat het overeenkomt
 user_dcc=Locatie van DCC cli&#235;nt programma
 user_desc=De opties op deze pagina zijn meest gerelateerd tot de paden en settings die SpamAssassin gebruikt voor de externe spam identificatie pakketten Razor, DCC en Pyzor. U kunt SpamAssassin ook vertellen dat hij DNS moet opzoeken of niet.