Added "ifconfig -a" for AIX inplace of "ip addr" for Linux. "ip" command is not available on AIX

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@1387 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
sakolish 2008-05-14 14:57:37 +00:00
parent 46e8cf6c85
commit 4e85065eb5

View File

@ -891,21 +891,27 @@ sub dispatch_request {
sub thishostisnot {
my $comparison = shift;
my @ips = split /\n/,`/sbin/ip addr`;
# use "ip addr" for linux, since ifconfig
# doesn't list "ip addr add" aliases for linux
#
my $cmd = ($^O !~ /^aix/i) ? "/sbin/ip addr" : "ifconfig -a";
my @ips = split /\n/,`$cmd`;
my $comp=inet_aton($comparison);
foreach (@ips) {
foreach (@ips) {
if (/^\s*inet/) {
my @ents = split(/\s+/);
my $ip=$ents[2];
$ip =~ s/\/.*//;
if (inet_aton($ip) eq $comp) {
return 0;
}
#print Dumper(inet_aton($ip));
my @ents = split(/\s+/);
my $ip=$ents[2];
$ip =~ s/\/.*//;
if (inet_aton($ip) eq $comp) {
return 0;
}
#print Dumper(inet_aton($ip));
}
}
return 1;
}
sub do_request {
my $req = shift;
my $second = shift;