Skip Menu |

This queue is for tickets about the IO-Socket-INET6 CPAN distribution.

Report information
The Basics
Id: 39550
Status: resolved
Priority: 0/
Queue: IO-Socket-INET6

People
Owner: SHLOMIF [...] cpan.org
Requestors: Steffen_Ullrich [...] genua.de
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in:
  • 2.52
  • 2.53
  • 2.54
Fixed in: (no value)



Subject: Problem with connect to IPv4 w/o given domain on FreeBSD6.1 (patch included)
If I just give IO::Socket::INET6->new( PeerAddr => '127.0.0.1', PeerPort => 10 ) e.g not specifying Domain (leaving it AF_UNSPEC) and not specifying a local address then it will fail to connect on FreeBSD6.1. Reason: the code in configure uses getaddrinfo to find out the addrinfo for the peer (127.0.0.1, gives only family AF_INET) and the local addr ('', gives AF_INET6 and AF_INET). Then it builds the socket with the family it got from the peer (AF_INET) and binds the listenaddr on this socket. If this fails the whole configure fails. What happens on FreeBSD6.1 in this scenario (only schematic, of course we don't give the address as a string to bind) socket(my $sock, AF_INET..) bind( $sock,'::' ) -> fails because AF_INET6 but socket is AF_INET -> configure fails When using linux this seems to be no problem, because the bind succeeds (maybe it doesn't distinguish between unspecified AF_INET6 and AF_INET) Fix: make sure, that the socket uses the same family as the peer (patch against 2.54) @@ -178,7 +178,8 @@ $family = (exists $arg->{PeerAddr})? ($rres[0]):($lres[0]) ; # One concrete family. #printf "DEBUG $family \n"; - (undef,undef,undef,$lres,undef,@lres) = @lres; + (my $fam_listen,undef,undef,$lres,undef,@lres) = @lres; + next if $fam_listen != $family; if ($lres && $family == AF_INET6) { if ($arg->{LocalFlow} || $arg->{LocalScope}) {
Subject: Re: [rt.cpan.org #39550] AutoReply: Problem with connect to IPv4 w/o given domain on FreeBSD6.1 (patch included)
Date: Wed, 24 Sep 2008 10:03:20 +0200
To: Bugs in IO-Socket-INET6 via RT <bug-IO-Socket-INET6 [...] rt.cpan.org>
From: Steffen Ullrich <Steffen_Ullrich [...] genua.de>
Same problem on OpenBSD (tested with 4.3 and 4.1). Steffen Show quoted text
> > ------------------------------------------------------------------------- > If I just give > IO::Socket::INET6->new( PeerAddr => '127.0.0.1', PeerPort => 10 ) > e.g not specifying Domain (leaving it AF_UNSPEC) and not specifying > a local address then it will fail to connect on FreeBSD6.1. > ...
Hi! Thanks for the report and the patch. I applied a modified version of the patch to IO-Socket-INET6-2.55, which I just uploaded to the CPAN. Closing as resolved. Regards, -- Shlomi Fish