From f65080fb4b8f2d79624f80ccc13209bce25f018d Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Thu, 16 May 2013 13:35:10 +0000 Subject: [PATCH] Support LLA with scope index XCATHOST git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.8@16319 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/Client.pm | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/perl-xCAT/xCAT/Client.pm b/perl-xCAT/xCAT/Client.pm index 85d091fee..970166bab 100644 --- a/perl-xCAT/xCAT/Client.pm +++ b/perl-xCAT/xCAT/Client.pm @@ -179,11 +179,31 @@ if (ref($request) eq 'HASH') { # the request is an array, not pure XML if ($ENV{XCATHOST}) { $xcathost=$ENV{XCATHOST}; } + my %connargs=(); + if ($xcathost =~ s/%([^\]]*)//) { + $connargs{PeerScope} = $1; + } + $connargs{PeerAddr} = $xcathost; + $connargs{Timeout} = 15; + if ($connargs{PeerScope} and $connargs{PeerScope} =~ /[a-zA-Z]/) { #non-numeric, need to translate... + my @ipdata = `ip link`; + use Data::Dumper; + print Dumper(\@ipdata); + @ipdata = grep(/[^@]$connargs{PeerScope}(:|@)/,@ipdata); + print Dumper(\@ipdata); + if (scalar(@ipdata) != 1) { + print STDERR "Unable to identify scope ".$connargs{PeerScope}."\n"; + exit(1); + } + $connargs{PeerScope} = $ipdata[0]; + $connargs{PeerScope} =~ s/:.*//; + } + + my $pclient; if ($inet6support) { $pclient = IO::Socket::INET6->new( - PeerAddr => $xcathost, - Timeout => 15, + %connargs, ); } else { $pclient = IO::Socket::INET->new(