summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2010-03-17 11:28:36 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2010-03-17 15:59:27 -0700
commit1a79376bddf1d374418a7159fc981a2b90764243 (patch)
tree729ad8bca02795187fed55bde37499b860bc8cbe
parent8d9ff57a1ddb60801d5032cdc6a939fc5a9cd57b (diff)
downloadvyatta-cfg-system-1a79376bddf1d374418a7159fc981a2b90764243.tar.gz
vyatta-cfg-system-1a79376bddf1d374418a7159fc981a2b90764243.zip
Handle devices that do not report ethtool
Some devices might not report ethtool settings, but still allow ethtool configuration of speed/duplex. Bug 5466 (cherry picked from commit ba4639d5d1fd9c20d180d80f2a2fc95a8cde9494)
-rwxr-xr-xscripts/vyatta-interfaces.pl18
1 files 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 );