summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@vyatta.com>2011-03-25 15:28:51 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2011-03-25 16:18:24 -0700
commit99f2bd7644d9dea1240fc007fefc47a4b02f5d95 (patch)
tree6142b94b0d44cb133c1d69fa64ae0ac69073a0aa
parent09fced43e4a6ea0d7f8e45c80a5c81d104a68424 (diff)
downloadvyatta-cfg-system-99f2bd7644d9dea1240fc007fefc47a4b02f5d95.tar.gz
vyatta-cfg-system-99f2bd7644d9dea1240fc007fefc47a4b02f5d95.zip
Fix use of uninitialized ospeed
If speed can not be determined then ospeed is undef. (cherry picked from commit dd7f6937e0cbe4f4705f4dde9a333852ba21f7c9)
-rwxr-xr-xscripts/vyatta-interfaces.pl15
1 files changed, 7 insertions, 8 deletions
diff --git a/scripts/vyatta-interfaces.pl b/scripts/vyatta-interfaces.pl
index c209abbe..e15e0ce7 100755
--- a/scripts/vyatta-interfaces.pl
+++ b/scripts/vyatta-interfaces.pl
@@ -451,14 +451,13 @@ sub set_speed_duplex {
# read old values to avoid meaningless speed changes
my ($autoneg, $ospeed, $oduplex) = get_ethtool($intf);
- if (defined($autoneg)) {
- if ($autoneg == 1) {
- # Device is already 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));
- }
+
+ if (defined($autoneg) && $autoneg == 1) {
+ # Device is already in autonegotiation mode
+ return if ($nspeed eq 'auto');
+ } elsif (defined($ospeed) && defined($oduplex)) {
+ # Device has explicit speed/duplex but they already match
+ return if (($nspeed eq $ospeed) && ($nduplex eq $oduplex));
}
my $cmd = "$ETHTOOL -s $intf";