mirror of
				https://github.com/xcat2/xcat-core.git
				synced 2025-10-31 19:32:31 +00:00 
			
		
		
		
	Make the INET6 support check more direct and to the point
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@744 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
		| @@ -10,15 +10,18 @@ use xCAT::NodeRange; | ||||
| use xCAT::Utils; | ||||
| use xCAT::Table; | ||||
|  | ||||
| my $inet6support; | ||||
| use IO::Socket::SSL; | ||||
| if (xCAT::Utils->isLinux()) { | ||||
|         eval { require Socket6 }; | ||||
|         eval { require IO::Socket::INET6 }; | ||||
|         eval { require IO::Socket::SSL::inet6 }; | ||||
| } else { | ||||
|  | ||||
|         eval { require Socket }; | ||||
|         eval { require IO::Socket::INET }; | ||||
| $inet6support=eval { require Socket6 }; | ||||
| if ($inet6support) { | ||||
|    $inet6support = eval { require IO::Socket::INET6 }; | ||||
| } | ||||
| if ($inet6support) { | ||||
|    $inet6support = eval { require IO::Socket::SSL::inet6 }; | ||||
| } | ||||
| unless ($inet6support) { | ||||
|   eval { require Socket }; | ||||
|   eval { require IO::Socket::INET }; | ||||
| } | ||||
|  | ||||
| use XML::Simple; | ||||
|   | ||||
| @@ -13,13 +13,17 @@ use Thread qw(yield); | ||||
| use xCAT::Client submit_request; | ||||
|  | ||||
| use IO::Socket::SSL; | ||||
| if (xCAT::Utils->isLinux()) { | ||||
|         eval { require Socket6 }; | ||||
|         eval { require IO::Socket::INET6 }; | ||||
|         eval { require IO::Socket::SSL::inet6 }; | ||||
| } else { | ||||
| 		eval { require Socket }; | ||||
|         eval { require IO::Socket::INET }; | ||||
| my $inet6support; | ||||
| $inet6support=eval { require Socket6 }; | ||||
| if ($inet6support) { | ||||
|     $inet6support = eval { require IO::Socket::INET6 }; | ||||
| } | ||||
| if ($inet6support) { | ||||
|    $inet6support = eval { require IO::Socket::SSL::inet6 }; | ||||
| } | ||||
| unless ($inet6support) { | ||||
|   eval { require Socket }; | ||||
|   eval { require IO::Socket::INET }; | ||||
| } | ||||
|  | ||||
| my $dispatch_requests = 1; # govern whether commands are dispatchable | ||||
| @@ -103,7 +107,7 @@ sub do_installm_service { | ||||
|   #This function servers as a handler for messages from installing nodes | ||||
|  | ||||
| my $socket; | ||||
| if (xCAT::Utils->isLinux()) { | ||||
| if ($inet6support) { | ||||
|   $socket = IO::Socket::INET6->new(LocalPort=>$sport, | ||||
|                                      Proto    => 'tcp', | ||||
|                                      ReuseAddr => 1, | ||||
| @@ -125,7 +129,7 @@ if (xCAT::Utils->isLinux()) { | ||||
|     next unless $conn = $socket->accept; | ||||
|  | ||||
| my @clients; | ||||
| if (xCAT::Utils->isLinux()) { | ||||
| if ($inet6support) { | ||||
|     @clients = gethostbyaddr($conn->peeraddr,AF_INET6); | ||||
| } else { | ||||
|     @clients = gethostbyaddr($conn->peeraddr,AF_INET); | ||||
| @@ -228,7 +232,7 @@ sub do_udp_service { #This function opens up a UDP port | ||||
|    $dispatch_requests=0; | ||||
| my $socket; | ||||
|    my $select = new IO::Select; | ||||
| if (xCAT::Utils->isLinux()) { | ||||
| if ($inet6support) { | ||||
|   $socket = IO::Socket::INET6->new(LocalPort => $port, | ||||
|                                      Proto     => 'udp', | ||||
|                                      Domain => AF_INET); | ||||
| @@ -401,7 +405,7 @@ until ($quit) { | ||||
|     } | ||||
|     $sitetab->close; | ||||
|  | ||||
| if (xCAT::Utils->isLinux()) { | ||||
| if ($inet6support) { | ||||
|     $peerhost = gethostbyaddr($connection->peeraddr,AF_INET6); | ||||
| } else { | ||||
|     $peerhost = gethostbyaddr($connection->peeraddr,AF_INET); | ||||
|   | ||||
| @@ -15,7 +15,7 @@ BuildRoot: /var/tmp/%{name}-%{version}-%{release}-root | ||||
| # also need to fix Requires for AIX | ||||
| %ifos linux | ||||
| BuildArch: noarch | ||||
| Requires: perl-IO-Socket-SSL perl-XML-Simple perl-IO-Socket-INET6 | ||||
| Requires: perl-IO-Socket-SSL perl-XML-Simple | ||||
| %endif | ||||
|  | ||||
| Requires: perl-xCAT = %{version} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user