summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStig Thormodsrud <stig@vyatta.com>2008-01-10 11:21:19 -0800
committerStig Thormodsrud <stig@vyatta.com>2008-01-10 11:21:19 -0800
commit9d4884d13ca6b6391f9aab6023d64fa2c95af9e0 (patch)
treea6269a19eb91df30e5d543300536f47415f50848
parent2cd4094b05230530e414362553c7699516a63b9b (diff)
downloadvyatta-cfg-9d4884d13ca6b6391f9aab6023d64fa2c95af9e0.tar.gz
vyatta-cfg-9d4884d13ca6b6391f9aab6023d64fa2c95af9e0.zip
Fix 2617 "Invalid interface address accepted".
-rw-r--r--scripts/vyatta-interfaces.pl8
1 files changed, 8 insertions, 0 deletions
diff --git a/scripts/vyatta-interfaces.pl b/scripts/vyatta-interfaces.pl
index 36d811f..dde54c7 100644
--- a/scripts/vyatta-interfaces.pl
+++ b/scripts/vyatta-interfaces.pl
@@ -231,6 +231,14 @@ sub is_ip_v4_or_v6 {
my $ip = NetAddr::IP->new($addr);
if (defined $ip && $ip->version() == 4) {
+ #
+ # the call to IP->new() will accept 1.1 and consider
+ # it to be 1.1.0.0, so add a check to force all
+ # 4 octets to be defined
+ #
+ if ($addr !~ /\d+\.\d+\.\d+\.\d+/) {
+ return undef;
+ }
return 4;
}
$ip = NetAddr::IP->new6($addr);