Commit 38d91ef2 authored by Julien Muchembled's avatar Julien Muchembled

Do not advertise any IPv6 when UPnP is used

parent 2cf88eef
...@@ -29,13 +29,16 @@ class Forwarder(object): ...@@ -29,13 +29,16 @@ class Forwarder(object):
return wraps(wrapped)(wrapper) return wraps(wrapped)(wrapper)
def checkExternalIp(self, ip=None): def checkExternalIp(self, ip=None):
if not ip: if ip:
try:
socket.inet_aton(ip)
except socket.error:
ip = None
else:
ip = self.refresh() ip = self.refresh()
if not ip:
return socket.AF_INET, ()
# If port is None, we assume we're not NATed. # If port is None, we assume we're not NATed.
return socket.AF_INET, [(ip, str(port or local), proto) return socket.AF_INET, [(ip, str(port or local), proto)
for local, proto, port in self._rules] 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