diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2008-11-20 14:15:10 -0800 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2008-11-20 14:15:10 -0800 |
commit | 10ebe0dbf9e7a01c2dc93253a0d2bafe788b8fa9 (patch) | |
tree | 093d405f0d25810902a7a46b43f02515be56e090 /scripts/vyatta-show-bonding.pl | |
parent | fc48b389b3d124cbf466c44ee4fb22a5e0f244eb (diff) | |
download | vyatta-op-10ebe0dbf9e7a01c2dc93253a0d2bafe788b8fa9.tar.gz vyatta-op-10ebe0dbf9e7a01c2dc93253a0d2bafe788b8fa9.zip |
Decode bonding modes
Bugfix 3945
Decode bonding mode names (match configuration values).
Diffstat (limited to 'scripts/vyatta-show-bonding.pl')
-rwxr-xr-x | scripts/vyatta-show-bonding.pl | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/scripts/vyatta-show-bonding.pl b/scripts/vyatta-show-bonding.pl index 8a0daee..5b0a314 100755 --- a/scripts/vyatta-show-bonding.pl +++ b/scripts/vyatta-show-bonding.pl @@ -66,14 +66,25 @@ sub get_state_link { return ( $state, $link ); } +my @modes = ( "round-robin", + "active-backup", + "xor-hash", + "broadcast", + "802.3ad", + "transmit-load-balance", + "adaptive-load-balance" +); + sub show_brief { my @interfaces = @_; - my $format = "%-12s %-10s %-8s %-6s %s\n"; + my $format = "%-12s %-22s %-8s %-6s %s\n"; printf $format, 'Interface', 'Mode', 'State', 'Link', 'Slaves'; foreach my $intf (sort @interfaces) { my $mode = get_sysfs_value( $intf, "bonding/mode" ); - $mode =~ s/ [0-9]+$//; + my ( $name, $num ) = split (/ /, $mode); + $mode = $modes[$num] ? $modes[$num] : $name; + my ( $state, $link ) = get_state_link($intf); my $slaves = get_sysfs_value( $intf, "bonding/slaves" ); printf $format, $intf, $mode, $state, $link, |