From e4e05713a76c31ba4edbb252e6f5fa0f59b13837 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Tue, 28 Apr 2009 22:50:27 -0700 Subject: Catch incorrect address format Don't just silently exit on incorrect address format. At least print an error --- scripts/vyatta-interfaces.pl | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'scripts') diff --git a/scripts/vyatta-interfaces.pl b/scripts/vyatta-interfaces.pl index c4e5c4e..5574462 100755 --- a/scripts/vyatta-interfaces.pl +++ b/scripts/vyatta-interfaces.pl @@ -233,9 +233,8 @@ sub update_eth_addrs { return; } my $version = is_ip_v4_or_v6($addr); - if (!defined $version) { - exit 1; - } + die "Unknown address not IPV4 or IPV6" unless $version; + if (is_ip_configured($intf, $addr)) { # # treat this as informational, don't fail @@ -250,8 +249,7 @@ sub update_eth_addrs { if ($version == 6) { return system("ip -6 addr add $addr dev $intf"); } - print "Error: Invalid address/prefix [$addr] for interface $intf\n"; - exit 1; + die "Error: Invalid address/prefix [$addr] for interface $intf\n"; } sub delete_eth_addrs { -- cgit v1.2.3