summaryrefslogtreecommitdiff
path: root/scripts/vyatta-interfaces.pl
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/vyatta-interfaces.pl')
-rwxr-xr-xscripts/vyatta-interfaces.pl13
1 files changed, 7 insertions, 6 deletions
diff --git a/scripts/vyatta-interfaces.pl b/scripts/vyatta-interfaces.pl
index 5b7f2cee..90d8dfc7 100755
--- a/scripts/vyatta-interfaces.pl
+++ b/scripts/vyatta-interfaces.pl
@@ -546,7 +546,7 @@ sub show_config_path {
sub get_ethtool {
my $dev = shift;
- open( my $ethtool, "sudo /usr/sbin/ethtool $dev 2>/dev/null |" )
+ open( my $ethtool, "-|", "sudo /usr/sbin/ethtool $dev 2>/dev/null" )
or die "ethtool failed: $!\n";
# ethtool produces:
@@ -588,13 +588,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);
}