IPv6 support for SSL and install monitor

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@36 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
jbjohnso 2007-11-04 16:06:16 +00:00
parent 25a694f0cc
commit fafeee0905
2 changed files with 23 additions and 12 deletions

View File

@ -2,7 +2,9 @@
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
package xCAT::Client;
use xCAT::NodeRange;
use IO::Socket::SSL;
use IO::Socket::INET6;
use Socket6;
use IO::Socket::SSL qw(inet6);
use XML::Simple;
use Data::Dumper;
use Storable qw(dclone);

View File

@ -2,11 +2,12 @@
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
use Socket;
use Socket6;
use IO::Socket;
use IO::Handle;
use IO::Select;
use IO::Socket::SSL;
use IO::Socket::INET;
use IO::Socket::INET6;
use IO::Socket::SSL qw(inet6);
use XML::Simple;
use xCAT::Table;
use Data::Dumper;
@ -74,7 +75,7 @@ sub daemonize {
my %cmd_handlers;
sub do_installm_service {
#This function servers as a handler for messages from installing nodes
my $socket = IO::Socket::INET->new(LocalPort=>$sport,
my $socket = IO::Socket::INET6->new(LocalPort=>$sport,
Proto => 'tcp',
ReuseAddr => 1,
Listen => 64);
@ -86,13 +87,20 @@ sub do_installm_service {
$SIG{ALRM} = sub { die "XCATTIMEOUT"; };
my $conn;
next unless $conn = $socket->accept;
my $client = gethostbyaddr(inet_aton($conn->peerhost),AF_INET);
$client =~ s/\..*//;
my @clients = gethostbyaddr($conn->peeraddr,AF_INET6);
my $validclient=0;
my $node;
($node) = noderange($client); #ensure this is coming from a node IP at least
unless ($node) { #Means the source isn't a valid deal...
close($conn);
next;
foreach my $client (@clients) {
$client =~ s/\..*//;
($node) = noderange($client); #ensure this is coming from a node IP at least
if ($node) { #Means the source isn't a valid deal...
$validclient=1;
last;
}
}
unless ($validclient) {
close($conn);
next;
}
eval {
alarm(2);
@ -137,8 +145,9 @@ sub do_udp_service { #This function opens up a UDP port
#Also, this throttles to handle one message at a time, so no forking either
#Explicitly, to handle whatever operations nodes periodically send during discover state
#Could be used for heartbeating and such as desired
my $socket = IO::Socket::INET->new(LocalPort => $port,
Proto => 'udp');
my $socket = IO::Socket::INET6->new(LocalPort => $port,
Proto => 'udp',
Domain => AF_INET);
openlog("xCAT UDP",'','local1');
unless ($socket) {
syslog("err","xCAT UDP service unable to open port $port: $!");