Package: libx11-protocol-perl
Version: 0.56-4
Tags: ipv6, patch

        The INETSocket.pm module, as used by X11::Protocol, does
        currently rely on IO::Socket::INET, thus supporting connections
        over IPv4 only.

        The fix is rather straightforward: the IO::Socket::INET6 class
        (which supports /both/ IPv6 /and/ IPv4) is to be checked at
        run-time, and, if available, used instead of IO::Socket::INET.
        (Much like the fix I’ve suggested [1] for Bug#306914.)

        An (untested) change is MIMEd.

        As a work-around, the software using X11::Protocol may simply
        “redirect” the IO::Socket::INET->new () class constructor to
        IO::Socket::INET6->new (), like:

require IO::Socket::INET;
require IO::Socket::INET6;

*IO::Socket::INET::new = sub {
    my ($class, @args) = @_;
    ## .
    IO::Socket::INET6->new (@args);
};

        As a side effect, this may actually enable IPv6 support in all
        the other Perl code that uses IO::Socket::INET.  (Potentially
        breaking it with unexpected values of ->peerhost (), etc.)

[1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=306914#68

-- 
FSF associate member #7257
## to the top of X11/Protocol/Connection/INETSocket.pm

our $SOCKET_CLASS;

$SOCKET_CLASS
    = ((eval { require IO::Socket::INET6 })
       ? "IO::Socket::INET6"
       : do { require IO::Socket::INET; "IO::Socket::INET"; })
    unless (defined ($SOCKET_CLASS));

## the ‘open’ function is then to be changed as follows:

#      my($host, $dispnum) = @_;
# -    my($sock) = IO::Socket::INET->new('PeerAddr' => $host,
# +    my($sock) = $SOCKET_CLASS->new   ('PeerAddr' => $host,
#  				      'PeerPort' => 6000 + $dispnum,
#  				      'Type' => SOCK_STREAM(),
#  				      'Proto' => "tcp");
#      croak "Can't connect to display `$host:$dispnum': $!" unless $sock;

Reply via email to