summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2009-08-27 09:54:36 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2009-08-27 09:54:36 -0700
commita84810d27eb4bbc721c0ee326fe64589ffcf2f3c (patch)
treefd50c96a8949da8ffd8edaaf0884705f58b11708
parent694826938f19a97640a7b87a73e5e06eb572e63c (diff)
downloadvyatta-cfg-a84810d27eb4bbc721c0ee326fe64589ffcf2f3c.tar.gz
vyatta-cfg-a84810d27eb4bbc721c0ee326fe64589ffcf2f3c.zip
Failure to set address should fail the commit
The script was hiding any error exit codes from 'ip' command. Switch to using exec so that error exits fail the commit. Discovered when testing with IPV6 disabled.
-rwxr-xr-xscripts/vyatta-interfaces.pl9
1 files changed, 6 insertions, 3 deletions
diff --git a/scripts/vyatta-interfaces.pl b/scripts/vyatta-interfaces.pl
index 86410c1..567e3b7 100755
--- a/scripts/vyatta-interfaces.pl
+++ b/scripts/vyatta-interfaces.pl
@@ -260,10 +260,12 @@ sub update_eth_addrs {
}
if ($version == 4) {
- return system("ip addr add $addr broadcast + dev $intf");
+ exec (qw(ip addr add),$addr,qw(broadcast + dev), $intf)
+ or die "ip addr command failed: $!";
}
if ($version == 6) {
- return system("ip -6 addr add $addr dev $intf");
+ exec (qw(ip -6 addr add), $addr, 'dev', $intf)
+ or die "ip addr command failed: $!";
}
die "Error: Invalid address/prefix [$addr] for interface $intf\n";
}
@@ -316,7 +318,8 @@ sub update_mac {
system "sudo ip link set $intf up"
and die "Could not set $intf up ($!)\n";
} else {
- exec "sudo ip link set $intf address $mac";
+ system "sudo ip link set $intf address $mac"
+ and die "Could not set $intf address ($!)\n";
}
exit 0;
}