From 06891fefd79590da394d32a81a0a6942db10c6e5 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 21 Dec 2009 12:39:58 -0800 Subject: Don't allow setting speed/duplex if hardware doesn't support it Bug 4994 If hardware does not have ethtool interface to allow setting speed/duplex, then do not allow user to commit change. --- scripts/vyatta-interfaces.pl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/vyatta-interfaces.pl b/scripts/vyatta-interfaces.pl index a496e66b..caba8b6f 100755 --- a/scripts/vyatta-interfaces.pl +++ b/scripts/vyatta-interfaces.pl @@ -580,8 +580,10 @@ sub set_speed_duplex { if ($autoneg) { return if ($nspeed eq 'auto'); } else { - return if (defined $ospeed && defined $oduplex && - $nspeed eq $ospeed && $nduplex eq $oduplex); + die "Device $intf does not support setting speed/duplex\n" + unless (defined($ospeed) && defined($oduplex)); + + return if (($nspeed eq $ospeed) && ($nduplex eq $oduplex)); } my @cmd = ('sudo', 'ethtool', '-s', $intf ); -- cgit v1.2.3