diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-08-27 09:54:36 -0700 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-08-27 09:54:36 -0700 |
commit | a84810d27eb4bbc721c0ee326fe64589ffcf2f3c (patch) | |
tree | fd50c96a8949da8ffd8edaaf0884705f58b11708 /scripts | |
parent | 694826938f19a97640a7b87a73e5e06eb572e63c (diff) | |
download | vyatta-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.
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/vyatta-interfaces.pl | 9 |
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; } |