summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-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;
}