diff options
author | Stig Thormodsrud <stig@vyatta.com> | 2008-06-03 12:34:08 -0700 |
---|---|---|
committer | Stig Thormodsrud <stig@vyatta.com> | 2008-06-03 12:34:08 -0700 |
commit | aca9f66546b7018beb53a6357a4f2e381e2590a5 (patch) | |
tree | cd6aaa41fc75368d0b6378f03d1a39582e7294cb /scripts | |
parent | f09b0212d821a7d411db221460b1bedd0ef46274 (diff) | |
download | vyatta-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-x | scripts/vyatta-interfaces.pl | 12 |
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; |