From a84810d27eb4bbc721c0ee326fe64589ffcf2f3c Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Thu, 27 Aug 2009 09:54:36 -0700 Subject: 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. --- scripts/vyatta-interfaces.pl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'scripts') 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; } -- cgit v1.2.3