From 654b2a0fc92293b91d374ab1c3312b3f026f05ba Mon Sep 17 00:00:00 2001 From: ligc Date: Mon, 21 Feb 2011 07:20:14 +0000 Subject: [PATCH] isInSameSubnet: error condition check git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8897 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/Utils.pm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/perl-xCAT/xCAT/Utils.pm b/perl-xCAT/xCAT/Utils.pm index 5f381be75..a6d95ff95 100644 --- a/perl-xCAT/xCAT/Utils.pm +++ b/perl-xCAT/xCAT/Utils.pm @@ -2607,6 +2607,11 @@ sub isInSameSubnet $ip1 = xCAT::NetworkUtils->getipaddr($ip1); $ip2 = xCAT::NetworkUtils->getipaddr($ip2); + if (!defined($ip1) || !defined($ip2)) + { + return undef; + } + if ((($ip1 =~ /\d+\.\d+\.\d+\.\d+/) && ($ip2 !~ /\d+\.\d+\.\d+\.\d+/)) ||(($ip1 !~ /\d+\.\d+\.\d+\.\d+/) && ($ip2 =~ /\d+\.\d+\.\d+\.\d+/))) {