ipv6 fix, replace the Socket library calls with NetworkUtils subroutines
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@6047 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
b8eeb7bbdf
commit
447880fff7
@ -2073,6 +2073,8 @@ sub my_nets
|
||||
{
|
||||
my $rethash;
|
||||
my @nets;
|
||||
my $v6net;
|
||||
my $v6ip;
|
||||
if ( $^O eq 'aix')
|
||||
{
|
||||
@nets = split /\n/, `/usr/sbin/ifconfig -a`;
|
||||
@ -2083,29 +2085,48 @@ sub my_nets
|
||||
}
|
||||
foreach (@nets)
|
||||
{
|
||||
$v6net = '';
|
||||
my @elems = split /\s+/;
|
||||
unless (/^\s*inet\s/)
|
||||
unless (/^\s*inet/)
|
||||
{
|
||||
next;
|
||||
}
|
||||
my $curnet; my $maskbits;
|
||||
if ( $^O eq 'aix')
|
||||
{
|
||||
$curnet = $elems[2];
|
||||
$maskbits = formatNetmask( $elems[4], 2, 1);
|
||||
if ($elems[1] eq 'inet6')
|
||||
{
|
||||
$v6net=$elems[2];
|
||||
$v6ip=$elems[2];
|
||||
$v6ip =~ s/\/.*//; # ipv6 address 4000::99/64
|
||||
$v6ip =~ s/\%.*//; # ipv6 address ::1%1/128
|
||||
}
|
||||
else
|
||||
{
|
||||
$curnet = $elems[2];
|
||||
$maskbits = formatNetmask( $elems[4], 2, 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
($curnet, $maskbits) = split /\//, $elems[2];
|
||||
}
|
||||
my $curmask = 2**$maskbits - 1 << (32 - $maskbits);
|
||||
my $nown = unpack("N", inet_aton($curnet));
|
||||
$nown = $nown & $curmask;
|
||||
my $textnet=inet_ntoa(pack("N",$nown));
|
||||
$textnet.="/$maskbits";
|
||||
$rethash->{$textnet} = $curnet;
|
||||
if (!$v6net)
|
||||
{
|
||||
my $curmask = 2**$maskbits - 1 << (32 - $maskbits);
|
||||
my $nown = unpack("N", inet_aton($curnet));
|
||||
$nown = $nown & $curmask;
|
||||
my $textnet=inet_ntoa(pack("N",$nown));
|
||||
$textnet.="/$maskbits";
|
||||
$rethash->{$textnet} = $curnet;
|
||||
}
|
||||
else
|
||||
{
|
||||
$rethash->{$v6net} = $v6ip;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# now get remote nets
|
||||
my $nettab = xCAT::Table->new("networks");
|
||||
my $sitetab = xCAT::Table->new("site");
|
||||
|
Loading…
Reference in New Issue
Block a user