From 9d4884d13ca6b6391f9aab6023d64fa2c95af9e0 Mon Sep 17 00:00:00 2001 From: Stig Thormodsrud Date: Thu, 10 Jan 2008 11:21:19 -0800 Subject: Fix 2617 "Invalid interface address accepted". --- scripts/vyatta-interfaces.pl | 8 ++++++++ 1 file changed, 8 insertions(+) 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); -- cgit v1.2.3