summaryrefslogtreecommitdiff
path: root/scripts/vyatta-interfaces.pl
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2010-02-16 08:53:23 -0800
committerStephen Hemminger <stephen.hemminger@vyatta.com>2010-02-16 10:24:37 -0800
commit464c848d9a821de9f98495d5d8802ac0eb00314a (patch)
treee50ecf31a00a3f9d3ebf9ed6ad6144ae3dfb87d6 /scripts/vyatta-interfaces.pl
parentdef0f16b44e005d743a90318a8e425d7bc0f2db0 (diff)
downloadvyatta-cfg-system-464c848d9a821de9f98495d5d8802ac0eb00314a.tar.gz
vyatta-cfg-system-464c848d9a821de9f98495d5d8802ac0eb00314a.zip
Use die function for failures
die prints to standard error, so any interface failures show up in error file during boot, rather than being lost in trace messages.
Diffstat (limited to 'scripts/vyatta-interfaces.pl')
-rwxr-xr-xscripts/vyatta-interfaces.pl35
1 files changed, 14 insertions, 21 deletions
diff --git a/scripts/vyatta-interfaces.pl b/scripts/vyatta-interfaces.pl
index 7494d12a..30ba30fa 100755
--- a/scripts/vyatta-interfaces.pl
+++ b/scripts/vyatta-interfaces.pl
@@ -350,10 +350,9 @@ sub is_valid_addr_set {
my ($addr_net, $intf) = @_;
if ($addr_net eq "dhcp") {
- if ($intf eq "lo") {
- print "Error: can't use dhcp client on loopback interface\n";
- exit 1;
- }
+ die "Error: can't use dhcp client on loopback interface\n"
+ if ($intf eq "lo");
+
exit 0;
}
@@ -382,21 +381,16 @@ sub is_valid_addr_set {
#
# allow /32 for ivp4 and /128 for ipv6
#
- if ($ip->addr() eq $network->addr()) {
- print "Can not assign network address as the IP address\n";
- exit 1;
- }
- if ($ip->addr() eq $bcast->addr()) {
- print "Can not assign broadcast address as the IP address\n";
- exit 1;
- }
- }
+ die "Can not assign network address as the IP address\n"
+ if ($ip->addr() eq $network->addr());
- if (is_ip_duplicate($intf, $addr_net)) {
- print "Error: duplicate address/prefix [$addr_net]\n";
- exit 1;
+ die "Can not assign broadcast address as the IP address\n"
+ if ($ip->addr() eq $bcast->addr());
}
+ die "Error: duplicate address/prefix [$addr_net]\n"
+ if (is_ip_duplicate($intf, $addr_net));
+
if ($version == 4) {
if ($net > 0 && $net <= 32) {
exit 0;
@@ -435,11 +429,10 @@ sub is_valid_addr_commit {
}
}
- if ($static_v4 == 1 && $dhcp == 1) {
- printf("Error configuring interface $intf: Can't configure static\n");
- printf("IPv4 address and DHCP on the same interface.\n");
- exit 1;
- }
+
+ die "Error configuring interface $intf: Can't configure static\n",
+ "IPv4 address and DHCP on the same interface.\n"
+ if ($static_v4 == 1 && $dhcp == 1);
exit 0;
}