From a7e4ef2bf145ad96e284576d798f668ff0b1fdd1 Mon Sep 17 00:00:00 2001 From: yinle Date: Thu, 3 May 2012 06:49:07 +0000 Subject: [PATCH] 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 --- perl-xCAT/xCAT/SLP.pm | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/perl-xCAT/xCAT/SLP.pm b/perl-xCAT/xCAT/SLP.pm index d4f02068a..3f17c5230 100644 --- a/perl-xCAT/xCAT/SLP.pm +++ b/perl-xCAT/xCAT/SLP.pm @@ -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)/ 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