Commit 2938a7c6 authored by Julien Muchembled's avatar Julien Muchembled

Fix crash caused by buggy UPnP

gaierror: [Errno -2] Name or service not known
Traceback (most recent call last):
 File "re6st/cli/node.py", line 271, in main
   remote_gateway, config.disable_proto, config.neighbour)
 File "re6st/tunnel.py", line 663, in __init__
   cache, cert, address)
 File "re6st/tunnel.py", line 236, in __init__
   self._updateCountry(address)
 File "re6st/tunnel.py", line 643, in _updateCountry
   family, ip = resolve(*address)
 File "re6st/tunnel.py", line 30, in resolve
   for x in socket.getaddrinfo(ip, port, family, 0, proto))

where ip is '-a'
parent 4fda2dc7
...@@ -48,16 +48,14 @@ class Forwarder(object): ...@@ -48,16 +48,14 @@ class Forwarder(object):
t.append((self.next_refresh, self.refresh)) t.append((self.next_refresh, self.refresh))
def checkExternalIp(self, ip=None): def checkExternalIp(self, ip=None):
if ip: if not ip:
ip = self.refresh()
try: try:
socket.inet_aton(ip) socket.inet_aton(ip)
except socket.error: except socket.error:
ip = None ip = ()
else: return socket.AF_INET, ip and [(ip, str(port or local), proto)
ip = self.refresh() for local, proto, port in self._rules]
# If port is None, we assume we're not NATed.
return socket.AF_INET, [(ip, str(port or local), proto)
for local, proto, port in self._rules] if ip else ()
def addRule(self, local_port, proto): def addRule(self, local_port, proto):
self._rules.append([local_port, proto, None]) self._rules.append([local_port, proto, None])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment