From ba4639d5d1fd9c20d180d80f2a2fc95a8cde9494 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Wed, 17 Mar 2010 11:28:36 -0700 Subject: Handle devices that do not report ethtool Some devices might not report ethtool settings, but still allow ethtool configuration of speed/duplex. Bug 5466 --- scripts/vyatta-interfaces.pl | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/scripts/vyatta-interfaces.pl b/scripts/vyatta-interfaces.pl index 30ba30fa..cbb6abf6 100755 --- a/scripts/vyatta-interfaces.pl +++ b/scripts/vyatta-interfaces.pl @@ -576,16 +576,14 @@ sub set_speed_duplex { die "Missing --dev argument\n" unless $intf; my ($ospeed, $oduplex, $autoneg) = get_ethtool($intf); - unless ($ospeed) { - # Device does not support ethtool or does not report speed - die "Device $intf does not support setting speed/duplex\n" - unless ($nspeed eq 'auto'); - } elsif ($autoneg) { - # Device is in autonegotiation mode - return if ($nspeed eq 'auto'); - } else { - # Device has explicit speed/duplex - return if (($nspeed eq $ospeed) && ($nduplex eq $oduplex)); + if ($ospeed) { + if ($autoneg) { + # Device is in autonegotiation mode + return if ($nspeed eq 'auto'); + } else { + # Device has explicit speed/duplex but they already match + return if (($nspeed eq $ospeed) && ($nduplex eq $oduplex)); + } } my @cmd = ('sudo', 'ethtool', '-s', $intf ); -- cgit v1.2.3