summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorStig Thormodsrud <stig@vyatta.com>2008-06-03 12:34:08 -0700
committerStig Thormodsrud <stig@vyatta.com>2008-06-03 12:34:08 -0700
commitaca9f66546b7018beb53a6357a4f2e381e2590a5 (patch)
treecd6aaa41fc75368d0b6378f03d1a39582e7294cb /scripts
parentf09b0212d821a7d411db221460b1bedd0ef46274 (diff)
downloadvyatta-cfg-aca9f66546b7018beb53a6357a4f2e381e2590a5.tar.gz
vyatta-cfg-aca9f66546b7018beb53a6357a4f2e381e2590a5.zip
Fix 920: System allows configuration of invalid IP Address for subnet
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/vyatta-interfaces.pl12
1 files changed, 12 insertions, 0 deletions
diff --git a/scripts/vyatta-interfaces.pl b/scripts/vyatta-interfaces.pl
index dd71d7a..ad059c5 100755
--- a/scripts/vyatta-interfaces.pl
+++ b/scripts/vyatta-interfaces.pl
@@ -471,6 +471,18 @@ sub is_valid_addr {
exit 1;
}
+ my $ip = NetAddr::IP->new($addr_net);
+ my $network = $ip->network();
+ my $bcast = $ip->broadcast();
+ 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;
+ }
+
if (is_dhcp_enabled($intf)) {
print "Error: remove dhcp before adding static addresses for $intf\n";
exit 1;