From cb36bc7abeaa48019f01b611de4d3d11ee40462d Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Tue, 15 Dec 2015 22:25:39 +0100 Subject: [PATCH] don't try to use GUPnP-IGD when we use an IPv6 address --- src/common/protocol/bytestream.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/common/protocol/bytestream.py b/src/common/protocol/bytestream.py index a032e561d..64bc5aecf 100644 --- a/src/common/protocol/bytestream.py +++ b/src/common/protocol/bytestream.py @@ -421,6 +421,15 @@ class ConnectionSocks5Bytestream(ConnectionBytestream): self.connection.send(iq) return + my_ip = self.peerhost[0] + + # check if we are connected with an IPv4 address + try: + socket.inet_aton(my_ip) + except socket.error as e: + self.connection.send(iq) + return + def ip_is_local(ip): if '.' not in ip: # it's an IPv6 @@ -439,9 +448,6 @@ class ConnectionSocks5Bytestream(ConnectionBytestream): return True return False - - my_ip = self.peerhost[0] - if not ip_is_local(my_ip): self.connection.send(iq) return @@ -475,7 +481,7 @@ class ConnectionSocks5Bytestream(ConnectionBytestream): cleanup_gupnp() def fail(s, error, proto, ext_ip, local_ip, local_port, desc): - log.debug('Got GUPnP-IGD error : %s', str(error)) + log.debug('Got GUPnP-IGD error') self.connection.send(iq) cleanup_gupnp()