summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2009-06-09 14:59:43 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2009-08-12 22:03:56 -0700
commit093cfe75a832c333e83e08bbb37a082e811a9e44 (patch)
tree7ba015900a84b04589524d1f89f03d2de1046502 /scripts
parentff66196fb742317d6721706ad8d2965cf5c6d221 (diff)
downloadvyatta-op-093cfe75a832c333e83e08bbb37a082e811a9e44.tar.gz
vyatta-op-093cfe75a832c333e83e08bbb37a082e811a9e44.zip
Fix handling of invalid bonding name
Bug 4514
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/vyatta-show-bonding.pl6
1 files changed, 6 insertions, 0 deletions
diff --git a/scripts/vyatta-show-bonding.pl b/scripts/vyatta-show-bonding.pl
index 5b0a314..902be4e 100755
--- a/scripts/vyatta-show-bonding.pl
+++ b/scripts/vyatta-show-bonding.pl
@@ -81,6 +81,9 @@ sub show_brief {
printf $format, 'Interface', 'Mode', 'State', 'Link', 'Slaves';
foreach my $intf (sort @interfaces) {
+ die "Invalid bonding interface: $intf\n"
+ unless (-d "/sys/class/net/$intf/bonding" );
+
my $mode = get_sysfs_value( $intf, "bonding/mode" );
my ( $name, $num ) = split (/ /, $mode);
$mode = $modes[$num] ? $modes[$num] : $name;
@@ -98,6 +101,9 @@ sub show {
printf $format, "Interface", "RX: bytes", "packets", "TX: bytes", "packets";
foreach my $intf (sort @interfaces) {
+ die "Invalid bonding interface: $intf\n"
+ unless (-d "/sys/class/net/$intf/bonding" );
+
my @slaves = split( / /, get_sysfs_value( $intf, "bonding/slaves" ) );
printf $format, $intf, get_sysfs_value( $intf, "statistics/rx_bytes" ),
get_sysfs_value( $intf, "statistics/rx_packets" ),