From a8cf5442a1a63464ca965b158f184dcd352a932f Mon Sep 17 00:00:00 2001 From: Dirk Koopman Date: Mon, 4 Apr 2011 21:54:43 +0100 Subject: [PATCH] itry to fix outgoing IPV6 connects --- Changes | 2 ++ perl/Msg.pm | 35 ++++++++++++++++++++--------------- perl/Version.pm | 4 ++-- 3 files changed, 24 insertions(+), 17 deletions(-) diff --git a/Changes b/Changes index 0622f4ac..12af104e 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,5 @@ +04Apr11======================================================================= +1. After being poked by Brendan EI6IZ, add outgoing IPV6 connect() handling 29Mar11======================================================================= 1. Add CTY-2106 prefixes 16Mar11======================================================================= diff --git a/perl/Msg.pm b/perl/Msg.pm index f2bb2976..6805e008 100644 --- a/perl/Msg.pm +++ b/perl/Msg.pm @@ -222,22 +222,27 @@ sub connect { $conn->{peerport} = $to_port; $conn->{sort} = 'Outgoing'; - # Create a new internet socket - my $sock = $io_socket->new(); - return undef unless $sock; - - my $proto = getprotobyname('tcp'); - $sock->socket(AF_INET, SOCK_STREAM, $proto) or return undef; - - blocking($sock, 0); - $conn->{blocking} = 0; + my $sock; + if ($blocking_supported) { + $sock = $io_socket->new(PeerAddr => $to_host, PeerPort => $to_port, Proto => 'tcp', Blocking =>0); + } else { + # Create a new internet socket + my $sock = $io_socket->new(); + return undef unless $sock; - # does the host resolve? - my $ip = gethostbyname($to_host); - return undef unless $ip; - - my $r = connect($sock, pack_sockaddr_in($to_port, $ip)); - return undef unless $r || _err_will_block($!); + my $proto = getprotobyname('tcp'); + $sock->socket(AF_INET, SOCK_STREAM, $proto) or return undef; + + blocking($sock, 0); + $conn->{blocking} = 0; + + # does the host resolve? + my $ip = gethostbyname($to_host); + return undef unless $ip; + + my $r = connect($sock, pack_sockaddr_in($to_port, $ip)); + return undef unless $r || _err_will_block($!); + } $conn->{sock} = $sock; $conn->{peerhost} = $sock->peerhost; # for consistency diff --git a/perl/Version.pm b/perl/Version.pm index e534b014..fa1654f2 100644 --- a/perl/Version.pm +++ b/perl/Version.pm @@ -11,7 +11,7 @@ use vars qw($version $subversion $build $gitversion); $version = '1.55'; $subversion = '0'; -$build = '87'; -$gitversion = '8f65275'; +$build = '88'; +$gitversion = 'dd4a4bf'; 1; -- 2.43.0