The attached patch adds a patch to debian/patches for this issue.
=== modified file 'debian/changelog'
--- debian/changelog	2010-07-17 04:20:47 +0000
+++ debian/changelog	2010-11-07 00:17:34 +0000
@@ -1,3 +1,10 @@
+paramiko (1.7.6-5ubuntu1) UNRELEASED; urgency=low
+
+  * Try all available address families when connecting. Closes: #602251,
+    LP: #638675
+
+ -- Jelmer Vernooij <jel...@debian.org>  Sun, 07 Nov 2010 01:14:54 +0100
+
 paramiko (1.7.6-5) unstable; urgency=low
 
   * debian/control: Fix python-crypto version dependency

=== added directory 'debian/patches'
=== added file 'debian/patches/address-families.patch'
--- debian/patches/address-families.patch	1970-01-01 00:00:00 +0000
+++ debian/patches/address-families.patch	2010-11-05 11:21:53 +0000
@@ -0,0 +1,36 @@
+Patch from Andrew Bennetts:
+
+Try connecting to each available address family until one succeeds.
+
+See also https://bugs.launchpad.net/paramiko/+bug/579530
+
+=== modified file 'a/paramiko/transport.py'
+--- a/paramiko/transport.py	2010-04-25 23:42:45 +0000
++++ b/paramiko/transport.py	2010-05-13 10:56:39 +0000
+@@ -285,15 +285,21 @@
+         if type(sock) is tuple:
+             # connect to the given (host, port)
+             hostname, port = sock
++            reason = 'No suitable address family'
+             for (family, socktype, proto, canonname, sockaddr) in socket.getaddrinfo(hostname, port, socket.AF_UNSPEC, socket.SOCK_STREAM):
+                 if socktype == socket.SOCK_STREAM:
+                     af = family
+                     addr = sockaddr
+-                    break
++                    sock = socket.socket(af, socket.SOCK_STREAM)
++                    try:
++                        sock.connect((hostname, port))
++                    except socket.error, e:
++                        reason = str(e)
++                    else:
++                        break
+             else:
+-                raise SSHException('No suitable address family for %s' % hostname)
+-            sock = socket.socket(af, socket.SOCK_STREAM)
+-            sock.connect((hostname, port))
++                raise SSHException(
++                    'Unable to connect to %s: %s' % (hostname, reason))
+         # okay, normal socket-ish flow here...
+         threading.Thread.__init__(self)
+         self.setDaemon(True)
+

=== added file 'debian/patches/series'
--- debian/patches/series	1970-01-01 00:00:00 +0000
+++ debian/patches/series	2010-11-05 11:13:08 +0000
@@ -0,0 +1,1 @@
+address-families.patch

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to