summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am1
-rw-r--r--scripts/vyatta-show-interfaces.pl360
-rw-r--r--templates/clear/interfaces/bridge/counters/node.def2
-rw-r--r--templates/clear/interfaces/bridge/node.def1
-rw-r--r--templates/clear/interfaces/bridge/node.tag/counters/node.def2
-rw-r--r--templates/clear/interfaces/bridge/node.tag/node.def4
-rw-r--r--templates/clear/interfaces/counters/node.def2
-rw-r--r--templates/clear/interfaces/ethernet/counters/node.def2
-rw-r--r--templates/clear/interfaces/ethernet/node.def1
-rw-r--r--templates/clear/interfaces/ethernet/node.tag/counters/node.def2
-rw-r--r--templates/clear/interfaces/ethernet/node.tag/node.def4
-rw-r--r--templates/clear/interfaces/loopback/counters/node.def2
-rw-r--r--templates/clear/interfaces/loopback/node.def1
-rw-r--r--templates/clear/interfaces/loopback/node.tag/counters/node.def2
-rw-r--r--templates/clear/interfaces/loopback/node.tag/node.def4
-rw-r--r--templates/clear/interfaces/tunnel/counters/node.def2
-rw-r--r--templates/clear/interfaces/tunnel/node.def1
-rw-r--r--templates/clear/interfaces/tunnel/node.tag/counters/node.def2
-rw-r--r--templates/clear/interfaces/tunnel/node.tag/node.def4
-rw-r--r--templates/show/interfaces/bridge/detail/node.def2
-rw-r--r--templates/show/interfaces/bridge/node.def2
-rw-r--r--templates/show/interfaces/bridge/node.tag/brief/node.def2
-rw-r--r--templates/show/interfaces/bridge/node.tag/node.def5
-rw-r--r--templates/show/interfaces/detail/node.def2
-rw-r--r--templates/show/interfaces/ethernet/detail/node.def2
-rw-r--r--templates/show/interfaces/ethernet/node.def2
-rw-r--r--templates/show/interfaces/ethernet/node.tag/brief/node.def2
-rw-r--r--templates/show/interfaces/ethernet/node.tag/node.def12
-rw-r--r--templates/show/interfaces/ethernet/node.tag/physical/node.def2
-rw-r--r--templates/show/interfaces/ethernet/node.tag/vif/node.tag/brief/node.def2
-rw-r--r--templates/show/interfaces/ethernet/node.tag/vif/node.tag/node.def8
-rw-r--r--templates/show/interfaces/ethernet/node.tag/vif/node.tag/physical/node.def2
-rw-r--r--templates/show/interfaces/loopback/detail/node.def2
-rw-r--r--templates/show/interfaces/loopback/node.def3
-rw-r--r--templates/show/interfaces/loopback/node.tag/brief/node.def2
-rw-r--r--templates/show/interfaces/loopback/node.tag/node.def2
-rw-r--r--templates/show/interfaces/node.def2
-rw-r--r--templates/show/interfaces/tunnel/detail/node.def2
-rw-r--r--templates/show/interfaces/tunnel/node.def3
-rw-r--r--templates/show/interfaces/tunnel/node.tag/brief/node.def2
-rw-r--r--templates/show/interfaces/tunnel/node.tag/node.def2
41 files changed, 445 insertions, 19 deletions
diff --git a/Makefile.am b/Makefile.am
index 4e9c1eb..6eaec65 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -12,6 +12,7 @@ alloweddir = $(datadir)/vyatta-op/functions/allowed
allowed_DATA = functions/allowed/hosts
bin_SCRIPTS = scripts/vyatta-show-interfaces
+bin_SCRIPTS += scripts/vyatta-show-interfaces.pl
bin_SCRIPTS += scripts/vyatta-show-version
bin_SCRIPTS += scripts/vyatta-show-dhclient.pl
diff --git a/scripts/vyatta-show-interfaces.pl b/scripts/vyatta-show-interfaces.pl
new file mode 100644
index 0000000..cd90104
--- /dev/null
+++ b/scripts/vyatta-show-interfaces.pl
@@ -0,0 +1,360 @@
+#!/usr/bin/perl
+#
+# Module: vyatta-show-interfaces.pl
+#
+# **** License ****
+# Version: VPL 1.0
+#
+# The contents of this file are subject to the Vyatta Public License
+# Version 1.0 ("License"); you may not use this file except in
+# compliance with the License. You may obtain a copy of the License at
+# http://www.vyatta.com/vpl
+#
+# Software distributed under the License is distributed on an "AS IS"
+# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+# the License for the specific language governing rights and limitations
+# under the License.
+#
+# This code was originally developed by Vyatta, Inc.
+# Portions created by Vyatta are Copyright (C) 2007 Vyatta, Inc.
+# All Rights Reserved.
+#
+# Author: Stig Thormodsrud
+# Date: February 2008
+# Description: Script to display interface information
+#
+# **** End License ****
+#
+
+use lib "/opt/vyatta/share/perl5/";
+use VyattaConfig;
+use Getopt::Long;
+use POSIX;
+
+use strict;
+use warnings;
+
+#
+# valid interfaces
+#
+my %intf_hash = (
+ ethernet => 'eth',
+ serial => 'wan',
+ tunnel => 'tun',
+ bridge => 'br',
+ loopback => 'lo',
+ pppoe => 'pppoe',
+ multilink => 'ml',
+ );
+
+#
+# valid actions
+#
+my %action_hash = (
+ 'show' => \&run_show_intf,
+ 'show-brief' => \&run_show_intf_brief,
+ 'clear' => \&run_clear_intf,
+ 'reset' => \&run_reset_intf,
+ );
+
+
+my $clear_stats_dir = '/var/run/vyatta';
+my $clear_file_magic = 'XYZZYX';
+
+my @rx_stat_vars =
+ qw/rx_bytes rx_packets rx_errors rx_dropped rx_over_errors multicast/;
+my @tx_stat_vars =
+ qw/tx_bytes tx_packets tx_errors tx_dropped tx_carrier_errors collisions/;
+
+sub get_intf_type {
+ my $intf = shift;
+
+ my $base;
+ if ($intf =~ m/([a-zA-Z]+)\d*/) {
+ $base = $1;
+ } else {
+ die "unknown intf type [$intf]\n";
+ }
+
+ foreach my $intf_type (keys(%intf_hash)) {
+ if ($intf_hash{$intf_type} eq $base) {
+ return $intf_type;
+ }
+ }
+ return undef;
+}
+
+sub get_intf_description {
+ my $intf = shift;
+
+ my $intf_type = get_intf_type($intf);
+ if (!defined $intf_type) {
+ return "";
+ }
+ my $config = new VyattaConfig;
+ my $path;
+ if ($intf =~ m/([a-zA-Z]+\d+)\.(\d+)/) {
+ $path = "interfaces $intf_type $1 vif $2";
+ } else {
+ $path = "interfaces $intf_type $intf";
+ }
+ $config->setLevel($path);
+ my $description = $config->returnOrigValue("description");
+ if (defined $description) {
+ return $description;
+ } else {
+ return "";
+ }
+}
+
+sub get_intf_stats {
+ my $intf = shift;
+
+ my %stats = ();
+ foreach my $var (@rx_stat_vars, @tx_stat_vars) {
+ $stats{$var} = `cat /sys/class/net/$intf/statistics/$var`;
+ }
+ return %stats;
+}
+
+sub get_intf_statsfile {
+ my $intf = shift;
+
+ return "$clear_stats_dir/$intf.stats";
+}
+
+sub get_clear_stats {
+ my $intf = shift;
+
+ my %stats = ();
+ foreach my $var (@rx_stat_vars, @tx_stat_vars) {
+ $stats{$var} = 0;
+ }
+ my $FILE;
+ my $filename = get_intf_statsfile($intf);
+ if (!open($FILE, "<", $filename)) {
+ return %stats;
+ }
+
+ my $magic = <$FILE>; chomp $magic;
+ if ($magic ne $clear_file_magic) {
+ print "bad magic [$intf]\n";
+ return %stats;
+ }
+ my $timestamp = <$FILE>; chomp $timestamp;
+ $stats{'timestamp'} = $timestamp;
+ my ($var, $val);
+ while (<$FILE>) {
+ chop;
+ ($var, $val) = split(/,/);
+ $stats{$var} = $val;
+ }
+ close($FILE);
+ return %stats;
+}
+
+sub get_ipaddr {
+ my $intf = shift;
+
+ my @addr_list = ();
+ my @lines = `ip addr show $intf | grep 'inet '`;
+ foreach my $line (@lines) {
+ if ($line =~ m/inet (\d+\.\d+\.\d+\.\d+)\/(\d+)/) {
+ push @addr_list, "$1/$2";
+ }
+ }
+ chomp @addr_list;
+ return @addr_list;
+}
+
+sub get_state_link {
+ my $intf = shift;
+
+ my $IFF_UP = 0x1;
+ my ($state, $link);
+ my $flags = `cat /sys/class/net/$intf/flags 2> /dev/null`;
+ my $carrier = `cat /sys/class/net/$intf/carrier 2> /dev/null`;
+ chomp $flags; chomp $carrier;
+ my $hex_flags = hex($flags);
+ if ($hex_flags & $IFF_UP) {
+ $state = "up";
+ } else {
+ $state = "admin down";
+ }
+ if ($carrier eq "1") {
+ $link = "up";
+ } else {
+ $link = "down";
+ }
+ return ($state, $link);
+}
+
+sub is_valid_intf {
+ my ($intf) = @_;
+
+ if (-e "/sys/class/net/$intf") {
+ return 1;
+ }
+ return 0;
+}
+
+sub is_valid_intf_type {
+ my $intf_type = shift;
+
+ if (defined $intf_hash{$intf_type}) {
+ return 1;
+ }
+ return 0;
+}
+
+sub get_intf_for_type {
+ my $intf_type = shift;
+
+ my $intf_prefix = $intf_hash{$intf_type};
+ my @list = `cd /sys/class/net; ls -d $intf_prefix\* 2> /dev/null`;
+ chomp @list;
+ return @list;
+}
+
+
+#
+# The "action" routines
+#
+
+sub run_show_intf {
+ my @intfs = @_;
+
+ foreach my $intf (@intfs) {
+ my %clear = get_clear_stats($intf);
+ my $description = get_intf_description($intf);
+ my $timestamp = $clear{'timestamp'};
+ my $line = `ip addr show $intf | sed 's/^[0-9]*: //'`; chomp $line;
+ print "$line\n";
+ if (defined $timestamp and $timestamp ne "") {
+ my $time_str = strftime("%a %b %d %R:%S %Z %Y",
+ localtime($timestamp));
+ print " Last clear: $time_str\n";
+ }
+ if (defined $description and $description ne "") {
+ print " Description: $description\n";
+ }
+ print "\n";
+ my %stats = get_intf_stats($intf);
+ # todo: handle counter wrap
+ printf(" %10s %10s %10s %10s %10s %10s\n", "RX: bytes", "packets",
+ "errors", "dropped", "overrun", "mcast");
+ printf(" %10d %10d %10d %10d %10d %10d\n",
+ $stats{'rx_bytes'} - $clear{'rx_bytes'},
+ $stats{'rx_packets'} - $clear{'rx_packets'},
+ $stats{'rx_errors'} - $clear{'rx_errors'}, ,
+ $stats{'rx_dropped'} - $clear{'rx_dropped'},
+ $stats{'rx_over_errors'} - $clear{'rx_over_errors'},
+ $stats{'multicast'} - $clear{'multicast'});
+ printf(" %10s %10s %10s %10s %10s %10s\n", "TX: bytes", "packets",
+ "errors", "dropped", "carrier", "collisions");
+ printf(" %10d %10d %10d %10d %10d %10d\n\n",
+ $stats{'tx_bytes'} - $clear{'tx_bytes'},
+ $stats{'tx_packets'} - $clear{'tx_packets'},
+ $stats{'tx_errors'} - $clear{'tx_errors'},
+ $stats{'tx_dropped'} - $clear{'tx_dropped'},
+ $stats{'tx_carrier_errors'} - $clear{'tx_carrier_errors'},
+ $stats{'collisions'} - $clear{'collisions'});
+ }
+}
+
+sub run_show_intf_brief {
+ my @intfs = @_;
+
+ my $format = "%-12s %-18s %-11s %-6s %-29s\n";
+ printf($format, "Interface","IP Address","State","Link","Description");
+ foreach my $intf (@intfs) {
+ my @ip_addr = get_ipaddr($intf);
+ my ($state, $link) = get_state_link($intf);
+ my $description = get_intf_description($intf);
+ $description = substr($description, 0, 29); # make it fit on 1 line
+ if (scalar(@ip_addr) == 0) {
+ printf($format, $intf, "-", $state, $link, $description);
+ } else {
+ foreach my $ip (@ip_addr) {
+ printf($format, $intf, $ip, $state, $link, $description);
+ }
+ }
+ }
+}
+
+sub run_clear_intf {
+ my @intfs = @_;
+
+ foreach my $intf (@intfs) {
+ my %stats = get_intf_stats($intf);
+ my $FILE;
+ my $filename = get_intf_statsfile($intf);
+ if (!open($FILE, ">", $filename)) {
+ die "Couldn't open $filename [$!]\n";
+ }
+ print "Clearing $intf\n";
+ print $FILE $clear_file_magic, "\n", time(), "\n";
+ my ($var, $val);
+ while (($var, $val) = each (%stats)) {
+ print $FILE $var, ",", $val;
+ }
+ close($FILE);
+ }
+}
+
+sub run_reset_intf {
+ my @intfs = @_;
+
+ foreach my $intf (@intfs) {
+ my $filename = get_intf_stats($intf);
+ system("rm -f $filename");
+ }
+}
+
+
+#
+# main
+#
+my @intf_list = ();
+my ($intf_type, $intf, $action);
+GetOptions("intf-type=s" => \$intf_type,
+ "intf=s" => \$intf,
+ "action=s" => \$action,
+);
+
+if (defined $intf) {
+ if (!is_valid_intf($intf)) {
+ die "Invalid interface [$intf]\n";
+ }
+ push @intf_list, $intf;
+} elsif (defined $intf_type) {
+ if (!is_valid_intf_type($intf_type)) {
+ die "Invalid interface type [$intf_type]\n";
+ }
+ @intf_list = get_intf_for_type($intf_type);
+} else {
+ #
+ # get all interfaces
+ #
+ foreach my $type (sort(keys (%intf_hash))) {
+ push @intf_list, get_intf_for_type($type);
+ }
+}
+
+if (! defined $action) {
+ $action = 'show';
+}
+
+my $func;
+if (defined $action_hash{$action}) {
+ $func = $action_hash{$action};
+} else {
+ die "Invalid action [$action]\n";
+}
+
+#
+# make it so...
+#
+&$func(@intf_list);
+
+# end of file
diff --git a/templates/clear/interfaces/bridge/counters/node.def b/templates/clear/interfaces/bridge/counters/node.def
new file mode 100644
index 0000000..ad13229
--- /dev/null
+++ b/templates/clear/interfaces/bridge/counters/node.def
@@ -0,0 +1,2 @@
+help: Clear all bridge interface counters
+run: sudo ${vyatta_bindir}/vyatta-show-interfaces.pl --action=clear --intf-type=$3
diff --git a/templates/clear/interfaces/bridge/node.def b/templates/clear/interfaces/bridge/node.def
new file mode 100644
index 0000000..a89b724
--- /dev/null
+++ b/templates/clear/interfaces/bridge/node.def
@@ -0,0 +1 @@
+help: Clear bridge interface information
diff --git a/templates/clear/interfaces/bridge/node.tag/counters/node.def b/templates/clear/interfaces/bridge/node.tag/counters/node.def
new file mode 100644
index 0000000..985e9ab
--- /dev/null
+++ b/templates/clear/interfaces/bridge/node.tag/counters/node.def
@@ -0,0 +1,2 @@
+help: Clear interface counters for a given interface
+run: sudo ${vyatta_bindir}/vyatta-show-interfaces.pl --action=clear --intf=$4
diff --git a/templates/clear/interfaces/bridge/node.tag/node.def b/templates/clear/interfaces/bridge/node.tag/node.def
new file mode 100644
index 0000000..4b6256e
--- /dev/null
+++ b/templates/clear/interfaces/bridge/node.tag/node.def
@@ -0,0 +1,4 @@
+help: Clear interface information for a given interface
+allowed: local -a array ;
+ array=( /sys/class/net/br* ) ;
+ echo -n ${array[@]##*/}
diff --git a/templates/clear/interfaces/counters/node.def b/templates/clear/interfaces/counters/node.def
new file mode 100644
index 0000000..252251a
--- /dev/null
+++ b/templates/clear/interfaces/counters/node.def
@@ -0,0 +1,2 @@
+help: Clear interface counters for all interfaces
+run: sudo ${vyatta_bindir}/vyatta-show-interfaces.pl --action=clear
diff --git a/templates/clear/interfaces/ethernet/counters/node.def b/templates/clear/interfaces/ethernet/counters/node.def
new file mode 100644
index 0000000..e05e218
--- /dev/null
+++ b/templates/clear/interfaces/ethernet/counters/node.def
@@ -0,0 +1,2 @@
+help: Clear all Ethernet interface counters
+run: sudo ${vyatta_bindir}/vyatta-show-interfaces.pl --action=clear --intf-type=$3
diff --git a/templates/clear/interfaces/ethernet/node.def b/templates/clear/interfaces/ethernet/node.def
new file mode 100644
index 0000000..3e6f0dc
--- /dev/null
+++ b/templates/clear/interfaces/ethernet/node.def
@@ -0,0 +1 @@
+help: Clear Ethernet interface information
diff --git a/templates/clear/interfaces/ethernet/node.tag/counters/node.def b/templates/clear/interfaces/ethernet/node.tag/counters/node.def
new file mode 100644
index 0000000..985e9ab
--- /dev/null
+++ b/templates/clear/interfaces/ethernet/node.tag/counters/node.def
@@ -0,0 +1,2 @@
+help: Clear interface counters for a given interface
+run: sudo ${vyatta_bindir}/vyatta-show-interfaces.pl --action=clear --intf=$4
diff --git a/templates/clear/interfaces/ethernet/node.tag/node.def b/templates/clear/interfaces/ethernet/node.tag/node.def
new file mode 100644
index 0000000..4f39ebf
--- /dev/null
+++ b/templates/clear/interfaces/ethernet/node.tag/node.def
@@ -0,0 +1,4 @@
+help: Clear interface information for a given interface
+allowed: local -a array ;
+ array=( /sys/class/net/eth* ) ;
+ echo -n ${array[@]##*/}
diff --git a/templates/clear/interfaces/loopback/counters/node.def b/templates/clear/interfaces/loopback/counters/node.def
new file mode 100644
index 0000000..5ebcd3d
--- /dev/null
+++ b/templates/clear/interfaces/loopback/counters/node.def
@@ -0,0 +1,2 @@
+help: Clear all loopback interface counters
+run: sudo ${vyatta_bindir}/vyatta-show-interfaces.pl --action=clear --intf-type=$3
diff --git a/templates/clear/interfaces/loopback/node.def b/templates/clear/interfaces/loopback/node.def
new file mode 100644
index 0000000..eb3221f
--- /dev/null
+++ b/templates/clear/interfaces/loopback/node.def
@@ -0,0 +1 @@
+help: Clear loopback interface information
diff --git a/templates/clear/interfaces/loopback/node.tag/counters/node.def b/templates/clear/interfaces/loopback/node.tag/counters/node.def
new file mode 100644
index 0000000..985e9ab
--- /dev/null
+++ b/templates/clear/interfaces/loopback/node.tag/counters/node.def
@@ -0,0 +1,2 @@
+help: Clear interface counters for a given interface
+run: sudo ${vyatta_bindir}/vyatta-show-interfaces.pl --action=clear --intf=$4
diff --git a/templates/clear/interfaces/loopback/node.tag/node.def b/templates/clear/interfaces/loopback/node.tag/node.def
new file mode 100644
index 0000000..cfefa98
--- /dev/null
+++ b/templates/clear/interfaces/loopback/node.tag/node.def
@@ -0,0 +1,4 @@
+help: Clear interface counters for a given interface
+allowed: local -a array ;
+ array=( /sys/class/net/lo* ) ;
+ echo -n ${array[@]##*/}
diff --git a/templates/clear/interfaces/tunnel/counters/node.def b/templates/clear/interfaces/tunnel/counters/node.def
new file mode 100644
index 0000000..c856a04
--- /dev/null
+++ b/templates/clear/interfaces/tunnel/counters/node.def
@@ -0,0 +1,2 @@
+help: Clear all tunnel interface counters
+run: sudo ${vyatta_bindir}/vyatta-show-interfaces.pl --action=clear --intf-type=$3
diff --git a/templates/clear/interfaces/tunnel/node.def b/templates/clear/interfaces/tunnel/node.def
new file mode 100644
index 0000000..c704813
--- /dev/null
+++ b/templates/clear/interfaces/tunnel/node.def
@@ -0,0 +1 @@
+help: Clear tunnel interface information
diff --git a/templates/clear/interfaces/tunnel/node.tag/counters/node.def b/templates/clear/interfaces/tunnel/node.tag/counters/node.def
new file mode 100644
index 0000000..985e9ab
--- /dev/null
+++ b/templates/clear/interfaces/tunnel/node.tag/counters/node.def
@@ -0,0 +1,2 @@
+help: Clear interface counters for a given interface
+run: sudo ${vyatta_bindir}/vyatta-show-interfaces.pl --action=clear --intf=$4
diff --git a/templates/clear/interfaces/tunnel/node.tag/node.def b/templates/clear/interfaces/tunnel/node.tag/node.def
new file mode 100644
index 0000000..cf85a2c
--- /dev/null
+++ b/templates/clear/interfaces/tunnel/node.tag/node.def
@@ -0,0 +1,4 @@
+help: Clear interface information for a given interface
+allowed: local -a array ;
+ array=( /sys/class/net/tun* ) ;
+ echo -n ${array[@]##*/}
diff --git a/templates/show/interfaces/bridge/detail/node.def b/templates/show/interfaces/bridge/detail/node.def
new file mode 100644
index 0000000..442317a
--- /dev/null
+++ b/templates/show/interfaces/bridge/detail/node.def
@@ -0,0 +1,2 @@
+help: Show detailed bridge interface information
+run: ${vyatta_bindir}/vyatta-show-interfaces.pl --intf-type=bridge --action=show
diff --git a/templates/show/interfaces/bridge/node.def b/templates/show/interfaces/bridge/node.def
new file mode 100644
index 0000000..006dc64
--- /dev/null
+++ b/templates/show/interfaces/bridge/node.def
@@ -0,0 +1,2 @@
+help: Show bridge interface information
+run: ${vyatta_bindir}/vyatta-show-interfaces.pl --intf-type=bridge --action=show-brief
diff --git a/templates/show/interfaces/bridge/node.tag/brief/node.def b/templates/show/interfaces/bridge/node.tag/brief/node.def
new file mode 100644
index 0000000..b277607
--- /dev/null
+++ b/templates/show/interfaces/bridge/node.tag/brief/node.def
@@ -0,0 +1,2 @@
+help: Show summary of a given bridge interface information
+run: ${vyatta_bindir}/vyatta-show-interfaces.pl --intf=$4 --action=show-brief
diff --git a/templates/show/interfaces/bridge/node.tag/node.def b/templates/show/interfaces/bridge/node.tag/node.def
new file mode 100644
index 0000000..9248741
--- /dev/null
+++ b/templates/show/interfaces/bridge/node.tag/node.def
@@ -0,0 +1,5 @@
+help: Show given bridge interface information
+allowed: local -a array ;
+ array=( /sys/class/net/br* ) ;
+ echo -n ${array[@]##*/}
+run: ${vyatta_bindir}/vyatta-show-interfaces.pl --intf=$4
diff --git a/templates/show/interfaces/detail/node.def b/templates/show/interfaces/detail/node.def
new file mode 100644
index 0000000..f875ce8
--- /dev/null
+++ b/templates/show/interfaces/detail/node.def
@@ -0,0 +1,2 @@
+help: Show detail information of all interfaces
+run: ${vyatta_bindir}/vyatta-show-interfaces.pl --action=show
diff --git a/templates/show/interfaces/ethernet/detail/node.def b/templates/show/interfaces/ethernet/detail/node.def
new file mode 100644
index 0000000..9883539
--- /dev/null
+++ b/templates/show/interfaces/ethernet/detail/node.def
@@ -0,0 +1,2 @@
+help: Show ethernet interface information
+run: ${vyatta_bindir}/vyatta-show-interfaces.pl --intf-type=ethernet --action=show
diff --git a/templates/show/interfaces/ethernet/node.def b/templates/show/interfaces/ethernet/node.def
index 9ece668..5c31928 100644
--- a/templates/show/interfaces/ethernet/node.def
+++ b/templates/show/interfaces/ethernet/node.def
@@ -1,2 +1,2 @@
help: Show ethernet interface information
-run: ${vyatta_bindir}/vyatta-show-interfaces ethernet
+run: ${vyatta_bindir}/vyatta-show-interfaces.pl --intf-type=ethernet --action=show-brief
diff --git a/templates/show/interfaces/ethernet/node.tag/brief/node.def b/templates/show/interfaces/ethernet/node.tag/brief/node.def
new file mode 100644
index 0000000..52b3870
--- /dev/null
+++ b/templates/show/interfaces/ethernet/node.tag/brief/node.def
@@ -0,0 +1,2 @@
+help: Show given ethernet interface information
+run: ${vyatta_bindir}/vyatta-show-interfaces.pl --intf=$4 --action=show-brief
diff --git a/templates/show/interfaces/ethernet/node.tag/node.def b/templates/show/interfaces/ethernet/node.tag/node.def
index cf3e112..3dab472 100644
--- a/templates/show/interfaces/ethernet/node.tag/node.def
+++ b/templates/show/interfaces/ethernet/node.tag/node.def
@@ -1,5 +1,9 @@
help: Show given ethernet interface information
-allowed: local -a array ;
- array=( /sys/class/net/{eth,vmnet}* ) ;
- echo -n ${array[@]##*/}
-run: ${vyatta_bindir}/vyatta-show-interfaces ethernet $4
+allowed: for dev in /sys/class/net/*;
+ do if [[ -L $dev/device ]]
+ then if [[ $(cat $dev/type) -eq 1 ]]
+ then echo -n ${dev##*/} " "
+ fi
+ fi
+ done
+run: ${vyatta_bindir}/vyatta-show-interfaces.pl --intf=$4
diff --git a/templates/show/interfaces/ethernet/node.tag/physical/node.def b/templates/show/interfaces/ethernet/node.tag/physical/node.def
index a9628fd..98f0170 100644
--- a/templates/show/interfaces/ethernet/node.tag/physical/node.def
+++ b/templates/show/interfaces/ethernet/node.tag/physical/node.def
@@ -1,3 +1,3 @@
help: Show physical device information of given ethernet interface
allowed: ""
-run: sudo ${vyatta_bindir}/sudo-users/ethtool $4
+run: sudo ${vyatta_bindir}/sudo-users/ethtool $4; sudo ${vyatta_bindir}/sudo-users/ethtool -i $4
diff --git a/templates/show/interfaces/ethernet/node.tag/vif/node.tag/brief/node.def b/templates/show/interfaces/ethernet/node.tag/vif/node.tag/brief/node.def
new file mode 100644
index 0000000..956be62
--- /dev/null
+++ b/templates/show/interfaces/ethernet/node.tag/vif/node.tag/brief/node.def
@@ -0,0 +1,2 @@
+help: Show given virtual network interface information
+run: ${vyatta_bindir}/vyatta-show-interfaces.pl --intf=$4.$6 --action=show-brief
diff --git a/templates/show/interfaces/ethernet/node.tag/vif/node.tag/node.def b/templates/show/interfaces/ethernet/node.tag/vif/node.tag/node.def
index 68d3b02..813637b 100644
--- a/templates/show/interfaces/ethernet/node.tag/vif/node.tag/node.def
+++ b/templates/show/interfaces/ethernet/node.tag/vif/node.tag/node.def
@@ -1,5 +1,5 @@
help: Show given virtual network interface information
-allowed: for eth in /sys/class/net/eth${4}.* ; do
- echo ${eth/*eth${4}./} ;
- done
-run: ${vyatta_bindir}/vyatta-show-interfaces ethernet $4 vif $6
+allowed: local -a array ;
+ array=( /sys/class/net/${COMP_WORDS[3]}.* ) ;
+ echo -n ${array[@]##*.}
+run: ${vyatta_bindir}/vyatta-show-interfaces.pl --intf=$4.$6
diff --git a/templates/show/interfaces/ethernet/node.tag/vif/node.tag/physical/node.def b/templates/show/interfaces/ethernet/node.tag/vif/node.tag/physical/node.def
deleted file mode 100644
index 9769aaa..0000000
--- a/templates/show/interfaces/ethernet/node.tag/vif/node.tag/physical/node.def
+++ /dev/null
@@ -1,2 +0,0 @@
-help: Show given virtual network interface pseudo-physical information
-run: sudo ${vyatta_bindir}/sudo-users/ethtool $4.$6
diff --git a/templates/show/interfaces/loopback/detail/node.def b/templates/show/interfaces/loopback/detail/node.def
new file mode 100644
index 0000000..759407a
--- /dev/null
+++ b/templates/show/interfaces/loopback/detail/node.def
@@ -0,0 +1,2 @@
+help: Show loopback interface information
+run: ${vyatta_bindir}/vyatta-show-interfaces.pl --intf-type=loopback
diff --git a/templates/show/interfaces/loopback/node.def b/templates/show/interfaces/loopback/node.def
index cbf6238..bee95ea 100644
--- a/templates/show/interfaces/loopback/node.def
+++ b/templates/show/interfaces/loopback/node.def
@@ -1,3 +1,2 @@
help: Show loopback interface information
-run: ${vyatta_bindir}/vyatta-show-interfaces loopback
-
+run: ${vyatta_bindir}/vyatta-show-interfaces.pl --intf-type=loopback --action=show-brief
diff --git a/templates/show/interfaces/loopback/node.tag/brief/node.def b/templates/show/interfaces/loopback/node.tag/brief/node.def
new file mode 100644
index 0000000..ca5cc37
--- /dev/null
+++ b/templates/show/interfaces/loopback/node.tag/brief/node.def
@@ -0,0 +1,2 @@
+help: Show summary of given loopback interface information
+run: ${vyatta_bindir}/vyatta-show-interfaces.pl --intf=$4 --action=show-brief
diff --git a/templates/show/interfaces/loopback/node.tag/node.def b/templates/show/interfaces/loopback/node.tag/node.def
index f1c11ed..ff6eec5 100644
--- a/templates/show/interfaces/loopback/node.tag/node.def
+++ b/templates/show/interfaces/loopback/node.tag/node.def
@@ -2,4 +2,4 @@ help: Show given loopback interface information
allowed: local -a array ;
array=( /sys/class/net/lo* ) ;
echo -n ${array[@]##*/}
-run: ${vyatta_bindir}/vyatta-show-interfaces loopback $4
+run: ${vyatta_bindir}/vyatta-show-interfaces.pl --intf=$4
diff --git a/templates/show/interfaces/node.def b/templates/show/interfaces/node.def
index c898266..aac2ea3 100644
--- a/templates/show/interfaces/node.def
+++ b/templates/show/interfaces/node.def
@@ -1,2 +1,2 @@
help: Show network interface information
-run: ${vyatta_bindir}/vyatta-show-interfaces
+run: ${vyatta_bindir}/vyatta-show-interfaces.pl --action=show-brief
diff --git a/templates/show/interfaces/tunnel/detail/node.def b/templates/show/interfaces/tunnel/detail/node.def
new file mode 100644
index 0000000..d3c8d95
--- /dev/null
+++ b/templates/show/interfaces/tunnel/detail/node.def
@@ -0,0 +1,2 @@
+help: Show tunnel interface information
+run: ${vyatta_bindir}/vyatta-show-interfaces.pl --intf-type=tunnel --action=show \ No newline at end of file
diff --git a/templates/show/interfaces/tunnel/node.def b/templates/show/interfaces/tunnel/node.def
index bfc03ba..568578b 100644
--- a/templates/show/interfaces/tunnel/node.def
+++ b/templates/show/interfaces/tunnel/node.def
@@ -1,3 +1,2 @@
help: Show tunnel interface information
-run: ${vyatta_bindir}/vyatta-show-interfaces tunnel
-
+run: ${vyatta_bindir}/vyatta-show-interfaces.pl --intf-type=tunnel --action=show-brief
diff --git a/templates/show/interfaces/tunnel/node.tag/brief/node.def b/templates/show/interfaces/tunnel/node.tag/brief/node.def
new file mode 100644
index 0000000..cf2b8da
--- /dev/null
+++ b/templates/show/interfaces/tunnel/node.tag/brief/node.def
@@ -0,0 +1,2 @@
+help: Show given tunnel interface information
+run: ${vyatta_bindir}/vyatta-show-interfaces.pl --intf=$4 --action=show-brief
diff --git a/templates/show/interfaces/tunnel/node.tag/node.def b/templates/show/interfaces/tunnel/node.tag/node.def
index c119ab0..12630bd 100644
--- a/templates/show/interfaces/tunnel/node.tag/node.def
+++ b/templates/show/interfaces/tunnel/node.tag/node.def
@@ -2,4 +2,4 @@ help: Show given tunnel interface information
allowed: local -a array ;
array=( /sys/class/net/tun* ) ;
echo -n ${array[@]##*/}
-run: ${vyatta_bindir}/vyatta-show-interfaces tunnel $4
+run: ${vyatta_bindir}/vyatta-show-interfaces.pl --intf=$4