From aca9f66546b7018beb53a6357a4f2e381e2590a5 Mon Sep 17 00:00:00 2001 From: Stig Thormodsrud Date: Tue, 3 Jun 2008 12:34:08 -0700 Subject: Fix 920: System allows configuration of invalid IP Address for subnet --- scripts/vyatta-interfaces.pl | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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; -- cgit v1.2.3