From 0e27d30c5fd7797c3ad2d27d99d8e3aa0676db2d Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Tue, 26 Feb 2008 18:44:34 +0000 Subject: [PATCH] -Simplify plain text IP determination, hopefuly v6 agnostic -Log condition where networks table lacks requisite data git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@584 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server-2.0/lib/xcat/plugins/bmcconfig.pm | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/xCAT-server-2.0/lib/xcat/plugins/bmcconfig.pm b/xCAT-server-2.0/lib/xcat/plugins/bmcconfig.pm index 7eea99f83..ba64be681 100644 --- a/xCAT-server-2.0/lib/xcat/plugins/bmcconfig.pm +++ b/xCAT-server-2.0/lib/xcat/plugins/bmcconfig.pm @@ -2,6 +2,7 @@ package xCAT_plugin::bmcconfig; use Data::Dumper; use xCAT::Table; +use Socket; sub handled_commands { return { @@ -22,11 +23,7 @@ sub genpassword { sub net_parms { my $ip = shift; - if ($ip =~ /[A-Za-z]/) { - my $addr = (gethostbyname($ip))[4]; - my @bytes = unpack("C4",$addr); - $ip = join(".",@bytes); - } + $ip = inet_ntoa(inet_aton($ip)); my $nettab = xCAT::Table->new('networks'); unless ($nettab) { return undef }; my @nets = $nettab->getAllAttribs('net','mask','gateway'); @@ -44,6 +41,7 @@ sub net_parms { return ($ip,$mask,$gw); } } + syslog("local1|err","xCAT BMC configuration error, no appropriate network for $ip found in networks, unable to determine netmask"); }