diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2010-04-05 22:10:13 -0700 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2010-04-05 22:10:13 -0700 |
commit | 0f258c68899fa3f48315c92225db8762ac73c4a5 (patch) | |
tree | a775e017860cca1e914f914326241ac433b7d44a /scripts/vyatta-interfaces.pl | |
parent | 8cd6dce2f7f6ed058ada32b875377fc3e4c61432 (diff) | |
download | vyatta-cfg-system-0f258c68899fa3f48315c92225db8762ac73c4a5.tar.gz vyatta-cfg-system-0f258c68899fa3f48315c92225db8762ac73c4a5.zip |
Ignore errors from ethtool when setting speed/duplex
Many virtual devices don't implement speed/duplex, so just ignore
any errors.
Diffstat (limited to 'scripts/vyatta-interfaces.pl')
-rwxr-xr-x | scripts/vyatta-interfaces.pl | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/scripts/vyatta-interfaces.pl b/scripts/vyatta-interfaces.pl index 90a4e0f9..8970790f 100755 --- a/scripts/vyatta-interfaces.pl +++ b/scripts/vyatta-interfaces.pl @@ -586,13 +586,14 @@ sub set_speed_duplex { } } - my @cmd = ('sudo', 'ethtool', '-s', $intf ); + my $cmd = "sudo /usr/sbin/ethtool -s $intf"; if ($nspeed eq 'auto') { - push @cmd, qw(autoneg on); + $cmd .= " autoneg on"; } else { - push @cmd, 'speed', $nspeed, 'duplex', $nduplex, 'autoneg', 'off'; + $cmd .= " speed $nspeed duplex $nduplex autoneg off"; } - exec @cmd; - die "Command failed: ", join(' ', @cmd); + # ignore errors since many devices don't allow setting speed/duplex + $cmd .= " 2>/dev/null"; + system ($cmd); } |