diff --git a/perl-xCAT/xCAT/PPCmac.pm b/perl-xCAT/xCAT/PPCmac.pm index a9b4944c0..dc7794d70 100644 --- a/perl-xCAT/xCAT/PPCmac.pm +++ b/perl-xCAT/xCAT/PPCmac.pm @@ -82,29 +82,6 @@ sub parse_args { my $server_ip; my %server_nethash; - my %client_nethash = xCAT::DBobjUtils->getNetwkInfo( $node ); - ##################################### - # Network attributes undefined - ##################################### - if ( !%client_nethash ) { - return( [RC_ERROR,"Cannot get network information for node"] ); - } - - if ( exists($opt{C}) ) { - if ( scalar(@$node) > 1 ) { - return( [RC_ERROR,"Option '-C' doesn't work with noderange\n"] ); - } - push @network, $_; - } else { - # get, check the node IP - $client_ip = xCAT::NetworkUtils->getipaddr(@$node[0]); - chomp $client_ip; - if ( $client_ip ) { - $opt{C} = $client_ip; - push @network, $client_ip; - } - } - #################################### # Set server IP #################################### @@ -148,6 +125,39 @@ sub parse_args { } } + my %client_nethash = xCAT::DBobjUtils->getNetwkInfo( $node ); + ##################################### + # Network attributes undefined + ##################################### + if ( !%client_nethash ) { + # IPv6, the client ip address may not be available, + # if the link local address is being used, + # the link local address is calculated from mac address + if ($opt{S} =~ /:/) { + #get the network "fe80::" + my $tmpll = "fe80::1"; + %client_nethash = xCAT::DBobjUtils->getNetwkInfo( [$tmpll] ); + } else { + return( [RC_ERROR,"Cannot get network information for node"] ); + } + } + + if ( exists($opt{C}) ) { + if ( scalar(@$node) > 1 ) { + return( [RC_ERROR,"Option '-C' doesn't work with noderange\n"] ); + } + push @network, $_; + } else { + # get, check the node IP + $client_ip = xCAT::NetworkUtils->getipaddr(@$node[0]); + chomp $client_ip; + if ( $client_ip ) { + $opt{C} = $client_ip; + push @network, $client_ip; + } + } + + if ( exists($opt{G}) ) { push @network, $_; } elsif ( $client_nethash{@$node[0]}{net} eq $server_nethash{$server}{net} ) { diff --git a/perl-xCAT/xCAT/Utils.pm b/perl-xCAT/xCAT/Utils.pm index 049a461ea..0fc07a59d 100644 --- a/perl-xCAT/xCAT/Utils.pm +++ b/perl-xCAT/xCAT/Utils.pm @@ -3910,6 +3910,11 @@ sub validate_ip my ($class, @IPs) = @_; foreach (@IPs) { my $ip = $_; + #TODO need more check for IPv6 address + if ($ip =~ /:/) + { + return([0]); + } ################################### # Length is 4 for IPv4 addresses ###################################