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/", line 271, in main
   remote_gateway, config.disable_proto, config.neighbour)
 File "re6st/", line 663, in __init__
   cache, cert, address)
 File "re6st/", line 236, in __init__
 File "re6st/", line 643, in _updateCountry
   family, ip = resolve(*address)
 File "re6st/", 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:
except socket.error:
ip = None
ip = self.refresh() ip = self.refresh()
# If port is None, we assume we're not NATed. try:
return socket.AF_INET, [(ip, str(port or local), proto) socket.inet_aton(ip)
for local, proto, port in self._rules] if ip else () except socket.error:
ip = ()
return socket.AF_INET, ip and [(ip, str(port or local), proto)
for local, proto, port in self._rules]
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