diff options
author | Stephen Hemminger <shemminger@vyatta.com> | 2011-03-25 15:28:51 -0700 |
---|---|---|
committer | Stephen Hemminger <shemminger@vyatta.com> | 2011-03-25 15:38:01 -0700 |
commit | dd7f6937e0cbe4f4705f4dde9a333852ba21f7c9 (patch) | |
tree | 2938ed6deab34619fb63b8ec3fd71ac564c83476 | |
parent | 83e28f37c7b89b3502e97e719fc6ff3bcec6594f (diff) | |
download | vyatta-cfg-quagga-dd7f6937e0cbe4f4705f4dde9a333852ba21f7c9.tar.gz vyatta-cfg-quagga-dd7f6937e0cbe4f4705f4dde9a333852ba21f7c9.zip |
Fix use of uninitialized ospeed
If speed can not be determined then ospeed is undef.
-rwxr-xr-x | scripts/vyatta-interfaces.pl | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/scripts/vyatta-interfaces.pl b/scripts/vyatta-interfaces.pl index c2ec9a44..30b35c05 100755 --- a/scripts/vyatta-interfaces.pl +++ b/scripts/vyatta-interfaces.pl @@ -452,14 +452,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"; |