Fix bug 3522940: FB->lsslp no response on aix71D

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.7@12501 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
yinle 2012-05-03 06:49:07 +00:00
parent deb0391464
commit a7e4ef2bf1

View File

@ -2,6 +2,7 @@ package xCAT::SLP;
use Carp;
use IO::Select;
use strict;
use xCAT::Utils;
my $ip6support = eval {
require IO::Socket::INET6;
require Socket6;
@ -307,11 +308,36 @@ sub send_service_request_single {
sub get_interfaces {
#TODO: AIX tolerance, no subprocess, include/exclude interface(s)
my @ipoutput = `ip addr`;
my %ifacemap;
my $payingattention=0;
my $interface;
my $keepcurrentiface;
# AIX part
if (xCAT::Utils->isAIX()) {
$ip6support = 0;
my $result = `ifconfig -a`;
my @nics = $result =~ /(\w+\d+)\: flags=/g;
my @adapter = split /\w+\d+:\s+flags=/, $result;
for (my $i=0; $i<scalar(@adapter); $i++) {
$_ = $adapter[$i+1];
if ( !($_ =~ /LOOPBACK/ ) and
$_ =~ /UP(,|>)/ and
$_ =~ /BROADCAST/ ) {
my @ip = split /\n/;
foreach ( @ip ) {
if ( $_ =~ /^\s*inet\s+/ and
$_ =~ /broadcast\s+(\d+\.\d+\.\d+\.\d+)/ ) {
push @{$ifacemap{$nics[$i]}->{ipv4addrs}},$1;
if( $nics[$i]=~ /\w+(\d+)/){
$ifacemap{$nics[$i]}->{scopeidx} = $1+2;
}
}
}
}
}
} else {
my @ipoutput = `ip addr`;
foreach my $line (@ipoutput) {
if ($line =~ /^\d/) { # new interface, new context..
if ($interface and not $keepcurrentiface) {
@ -336,6 +362,7 @@ sub get_interfaces {
push @{$ifacemap{$interface}->{ipv4addrs}},$1;
}
}
}
return \%ifacemap;
}
# discovery is "service request", rfc 2608