2018-10-10 12:23:21 +02:00
|
|
|
|
# pylint: disable=too-many-statements,too-many-branches,protected-access,no-self-use
|
|
|
|
|
"""
|
|
|
|
|
src/upnp.py
|
|
|
|
|
===========
|
|
|
|
|
|
|
|
|
|
A simple upnp module to forward port for BitMessage
|
|
|
|
|
Reference: http://mattscodecave.com/posts/using-python-and-upnp-to-forward-a-port
|
|
|
|
|
"""
|
|
|
|
|
|
2016-05-02 17:33:18 +02:00
|
|
|
|
import httplib
|
2015-08-22 10:48:49 +02:00
|
|
|
|
import socket
|
2015-11-21 11:59:44 +01:00
|
|
|
|
import threading
|
|
|
|
|
import time
|
2018-10-10 12:23:21 +02:00
|
|
|
|
import urllib2
|
|
|
|
|
from random import randint
|
|
|
|
|
from urlparse import urlparse
|
|
|
|
|
from xml.dom.minidom import Document, parseString
|
|
|
|
|
|
2019-08-01 12:19:56 +02:00
|
|
|
|
import knownnodes
|
2017-02-08 13:41:56 +01:00
|
|
|
|
import queues
|
2017-01-14 23:20:15 +01:00
|
|
|
|
import state
|
2015-11-22 23:41:03 +01:00
|
|
|
|
import tr
|
2018-10-10 12:23:21 +02:00
|
|
|
|
from bmconfigparser import BMConfigParser
|
|
|
|
|
from debug import logger
|
|
|
|
|
from helper_threading import StoppableThread
|
|
|
|
|
from network.connectionpool import BMConnectionPool
|
|
|
|
|
|
2015-08-22 10:48:49 +02:00
|
|
|
|
|
2017-01-11 18:13:00 +01:00
|
|
|
|
def createRequestXML(service, action, arguments=None):
|
2018-10-10 12:23:21 +02:00
|
|
|
|
"""Router UPnP requests are XML formatted"""
|
2015-08-22 10:48:49 +02:00
|
|
|
|
|
|
|
|
|
doc = Document()
|
|
|
|
|
|
|
|
|
|
# create the envelope element and set its attributes
|
|
|
|
|
envelope = doc.createElementNS('', 's:Envelope')
|
|
|
|
|
envelope.setAttribute('xmlns:s', 'http://schemas.xmlsoap.org/soap/envelope/')
|
|
|
|
|
envelope.setAttribute('s:encodingStyle', 'http://schemas.xmlsoap.org/soap/encoding/')
|
|
|
|
|
|
|
|
|
|
# create the body element
|
|
|
|
|
body = doc.createElementNS('', 's:Body')
|
|
|
|
|
|
|
|
|
|
# create the function element and set its attribute
|
|
|
|
|
fn = doc.createElementNS('', 'u:%s' % action)
|
|
|
|
|
fn.setAttribute('xmlns:u', 'urn:schemas-upnp-org:service:%s' % service)
|
|
|
|
|
|
|
|
|
|
# setup the argument element names and values
|
|
|
|
|
# using a list of tuples to preserve order
|
|
|
|
|
|
|
|
|
|
# container for created nodes
|
|
|
|
|
argument_list = []
|
|
|
|
|
|
|
|
|
|
# iterate over arguments, create nodes, create text nodes,
|
|
|
|
|
# append text nodes to nodes, and finally add the ready product
|
|
|
|
|
# to argument_list
|
2017-01-11 18:13:00 +01:00
|
|
|
|
if arguments is not None:
|
|
|
|
|
for k, v in arguments:
|
|
|
|
|
tmp_node = doc.createElement(k)
|
|
|
|
|
tmp_text_node = doc.createTextNode(v)
|
|
|
|
|
tmp_node.appendChild(tmp_text_node)
|
|
|
|
|
argument_list.append(tmp_node)
|
2015-08-22 10:48:49 +02:00
|
|
|
|
|
|
|
|
|
# append the prepared argument nodes to the function element
|
|
|
|
|
for arg in argument_list:
|
|
|
|
|
fn.appendChild(arg)
|
|
|
|
|
|
|
|
|
|
# append function element to the body element
|
|
|
|
|
body.appendChild(fn)
|
|
|
|
|
|
|
|
|
|
# append body element to envelope element
|
|
|
|
|
envelope.appendChild(body)
|
|
|
|
|
|
|
|
|
|
# append envelope element to document, making it the root element
|
|
|
|
|
doc.appendChild(envelope)
|
|
|
|
|
|
|
|
|
|
# our tree is ready, conver it to a string
|
|
|
|
|
return doc.toxml()
|
|
|
|
|
|
2018-10-10 12:23:21 +02:00
|
|
|
|
|
2015-08-22 10:48:49 +02:00
|
|
|
|
class UPnPError(Exception):
|
2018-10-10 12:23:21 +02:00
|
|
|
|
"""Handle a UPnP error"""
|
|
|
|
|
|
2015-08-22 10:48:49 +02:00
|
|
|
|
def __init__(self, message):
|
2018-10-10 12:23:21 +02:00
|
|
|
|
super(UPnPError, self).__init__()
|
|
|
|
|
logger.error(message)
|
|
|
|
|
|
2015-08-22 10:48:49 +02:00
|
|
|
|
|
2018-10-10 12:23:21 +02:00
|
|
|
|
class Router: # pylint: disable=old-style-class
|
|
|
|
|
"""Encapulate routing"""
|
2015-08-22 10:48:49 +02:00
|
|
|
|
name = ""
|
|
|
|
|
path = ""
|
|
|
|
|
address = None
|
|
|
|
|
routerPath = None
|
2015-11-21 11:59:44 +01:00
|
|
|
|
extPort = None
|
2018-10-10 12:23:21 +02:00
|
|
|
|
|
2015-08-22 10:48:49 +02:00
|
|
|
|
def __init__(self, ssdpResponse, address):
|
|
|
|
|
|
|
|
|
|
self.address = address
|
|
|
|
|
|
|
|
|
|
row = ssdpResponse.split('\r\n')
|
|
|
|
|
header = {}
|
|
|
|
|
for i in range(1, len(row)):
|
|
|
|
|
part = row[i].split(': ')
|
|
|
|
|
if len(part) == 2:
|
|
|
|
|
header[part[0].lower()] = part[1]
|
|
|
|
|
|
2016-05-02 17:10:45 +02:00
|
|
|
|
try:
|
|
|
|
|
self.routerPath = urlparse(header['location'])
|
|
|
|
|
if not self.routerPath or not hasattr(self.routerPath, "hostname"):
|
2018-10-10 12:23:21 +02:00
|
|
|
|
logger.error("UPnP: no hostname: %s", header['location'])
|
2016-05-02 17:10:45 +02:00
|
|
|
|
except KeyError:
|
2018-10-10 12:23:21 +02:00
|
|
|
|
logger.error("UPnP: missing location header")
|
2015-08-22 10:48:49 +02:00
|
|
|
|
|
|
|
|
|
# get the profile xml file and read it into a variable
|
|
|
|
|
directory = urllib2.urlopen(header['location']).read()
|
|
|
|
|
|
|
|
|
|
# create a DOM object that represents the `directory` document
|
|
|
|
|
dom = parseString(directory)
|
|
|
|
|
|
|
|
|
|
self.name = dom.getElementsByTagName('friendlyName')[0].childNodes[0].data
|
|
|
|
|
# find all 'serviceType' elements
|
|
|
|
|
service_types = dom.getElementsByTagName('serviceType')
|
|
|
|
|
|
|
|
|
|
for service in service_types:
|
2016-03-21 21:52:10 +01:00
|
|
|
|
if service.childNodes[0].data.find('WANIPConnection') > 0 or \
|
2018-10-10 12:23:21 +02:00
|
|
|
|
service.childNodes[0].data.find('WANPPPConnection') > 0:
|
2015-08-22 10:48:49 +02:00
|
|
|
|
self.path = service.parentNode.getElementsByTagName('controlURL')[0].childNodes[0].data
|
2016-06-21 10:11:15 +02:00
|
|
|
|
self.upnp_schema = service.childNodes[0].data.split(':')[-2]
|
2015-08-22 10:48:49 +02:00
|
|
|
|
|
2018-10-10 12:23:21 +02:00
|
|
|
|
def AddPortMapping(
|
|
|
|
|
self,
|
|
|
|
|
externalPort,
|
|
|
|
|
internalPort,
|
|
|
|
|
internalClient,
|
|
|
|
|
protocol,
|
|
|
|
|
description,
|
|
|
|
|
leaseDuration=0,
|
|
|
|
|
enabled=1,
|
|
|
|
|
): # pylint: disable=too-many-arguments
|
|
|
|
|
"""Add UPnP port mapping"""
|
|
|
|
|
|
2016-06-21 10:11:15 +02:00
|
|
|
|
resp = self.soapRequest(self.upnp_schema + ':1', 'AddPortMapping', [
|
2018-10-10 12:23:21 +02:00
|
|
|
|
('NewRemoteHost', ''),
|
|
|
|
|
('NewExternalPort', str(externalPort)),
|
|
|
|
|
('NewProtocol', protocol),
|
|
|
|
|
('NewInternalPort', str(internalPort)),
|
|
|
|
|
('NewInternalClient', internalClient),
|
|
|
|
|
('NewEnabled', str(enabled)),
|
|
|
|
|
('NewPortMappingDescription', str(description)),
|
|
|
|
|
('NewLeaseDuration', str(leaseDuration))
|
|
|
|
|
])
|
2015-11-21 00:39:23 +01:00
|
|
|
|
self.extPort = externalPort
|
2018-10-10 12:23:21 +02:00
|
|
|
|
logger.info("Successfully established UPnP mapping for %s:%i on external port %i",
|
|
|
|
|
internalClient, internalPort, externalPort)
|
2015-08-22 10:48:49 +02:00
|
|
|
|
return resp
|
|
|
|
|
|
|
|
|
|
def DeletePortMapping(self, externalPort, protocol):
|
2018-10-10 12:23:21 +02:00
|
|
|
|
"""Delete UPnP port mapping"""
|
|
|
|
|
|
2016-06-21 10:11:15 +02:00
|
|
|
|
resp = self.soapRequest(self.upnp_schema + ':1', 'DeletePortMapping', [
|
2018-10-10 12:23:21 +02:00
|
|
|
|
('NewRemoteHost', ''),
|
|
|
|
|
('NewExternalPort', str(externalPort)),
|
|
|
|
|
('NewProtocol', protocol),
|
|
|
|
|
])
|
2015-11-21 10:17:27 +01:00
|
|
|
|
logger.info("Removed UPnP mapping on external port %i", externalPort)
|
2015-08-22 10:48:49 +02:00
|
|
|
|
return resp
|
|
|
|
|
|
|
|
|
|
def GetExternalIPAddress(self):
|
2018-10-10 12:23:21 +02:00
|
|
|
|
"""Get the external address"""
|
|
|
|
|
|
2019-08-01 12:19:56 +02:00
|
|
|
|
resp = self.soapRequest(
|
|
|
|
|
self.upnp_schema + ':1', 'GetExternalIPAddress')
|
|
|
|
|
dom = parseString(resp.read())
|
|
|
|
|
return dom.getElementsByTagName(
|
|
|
|
|
'NewExternalIPAddress')[0].childNodes[0].data
|
2018-10-10 12:23:21 +02:00
|
|
|
|
|
2017-01-11 18:13:00 +01:00
|
|
|
|
def soapRequest(self, service, action, arguments=None):
|
2018-10-10 12:23:21 +02:00
|
|
|
|
"""Make a request to a router"""
|
|
|
|
|
|
2015-08-22 10:48:49 +02:00
|
|
|
|
conn = httplib.HTTPConnection(self.routerPath.hostname, self.routerPath.port)
|
|
|
|
|
conn.request(
|
|
|
|
|
'POST',
|
|
|
|
|
self.path,
|
|
|
|
|
createRequestXML(service, action, arguments),
|
|
|
|
|
{
|
|
|
|
|
'SOAPAction': '"urn:schemas-upnp-org:service:%s#%s"' % (service, action),
|
|
|
|
|
'Content-Type': 'text/xml'
|
2018-10-10 12:23:21 +02:00
|
|
|
|
}
|
|
|
|
|
)
|
2016-03-21 21:52:10 +01:00
|
|
|
|
resp = conn.getresponse()
|
|
|
|
|
conn.close()
|
|
|
|
|
if resp.status == 500:
|
|
|
|
|
respData = resp.read()
|
|
|
|
|
try:
|
|
|
|
|
dom = parseString(respData)
|
|
|
|
|
errinfo = dom.getElementsByTagName('errorDescription')
|
2018-10-10 12:23:21 +02:00
|
|
|
|
if errinfo:
|
2016-03-21 21:52:10 +01:00
|
|
|
|
logger.error("UPnP error: %s", respData)
|
|
|
|
|
raise UPnPError(errinfo[0].childNodes[0].data)
|
|
|
|
|
except:
|
2018-10-10 12:23:21 +02:00
|
|
|
|
raise UPnPError("Unable to parse SOAP error: %s" % (respData))
|
2015-08-22 10:48:49 +02:00
|
|
|
|
return resp
|
|
|
|
|
|
2018-10-10 12:23:21 +02:00
|
|
|
|
|
2015-11-22 16:18:59 +01:00
|
|
|
|
class uPnPThread(threading.Thread, StoppableThread):
|
2018-10-10 12:23:21 +02:00
|
|
|
|
"""Start a thread to handle UPnP activity"""
|
|
|
|
|
|
2016-03-21 21:52:10 +01:00
|
|
|
|
SSDP_ADDR = "239.255.255.250"
|
|
|
|
|
GOOGLE_DNS = "8.8.8.8"
|
|
|
|
|
SSDP_PORT = 1900
|
|
|
|
|
SSDP_MX = 2
|
|
|
|
|
SSDP_ST = "urn:schemas-upnp-org:device:InternetGatewayDevice:1"
|
|
|
|
|
|
2018-10-10 12:23:21 +02:00
|
|
|
|
def __init__(self):
|
2015-11-21 11:59:44 +01:00
|
|
|
|
threading.Thread.__init__(self, name="uPnPThread")
|
2015-12-23 13:42:48 +01:00
|
|
|
|
try:
|
2017-01-11 14:27:19 +01:00
|
|
|
|
self.extPort = BMConfigParser().getint('bitmessagesettings', 'extport')
|
2015-12-23 13:42:48 +01:00
|
|
|
|
except:
|
|
|
|
|
self.extPort = None
|
2016-03-21 21:52:10 +01:00
|
|
|
|
self.localIP = self.getLocalIP()
|
2015-11-21 11:59:44 +01:00
|
|
|
|
self.routers = []
|
|
|
|
|
self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
2018-02-13 16:11:53 +01:00
|
|
|
|
self.sock.bind((self.localIP, 0))
|
2015-11-21 11:59:44 +01:00
|
|
|
|
self.sock.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_TTL, 2)
|
2016-03-21 21:52:10 +01:00
|
|
|
|
self.sock.settimeout(5)
|
2015-11-21 11:59:44 +01:00
|
|
|
|
self.sendSleep = 60
|
2015-11-22 16:18:59 +01:00
|
|
|
|
self.initStop()
|
2015-11-21 11:59:44 +01:00
|
|
|
|
|
|
|
|
|
def run(self):
|
2018-10-10 12:23:21 +02:00
|
|
|
|
"""Start the thread to manage UPnP activity"""
|
|
|
|
|
|
2015-11-21 11:59:44 +01:00
|
|
|
|
logger.debug("Starting UPnP thread")
|
2016-03-21 21:52:10 +01:00
|
|
|
|
logger.debug("Local IP: %s", self.localIP)
|
2015-11-21 11:59:44 +01:00
|
|
|
|
lastSent = 0
|
2017-08-09 17:29:23 +02:00
|
|
|
|
|
|
|
|
|
# wait until asyncore binds so that we know the listening port
|
|
|
|
|
bound = False
|
|
|
|
|
while state.shutdown == 0 and not self._stopped and not bound:
|
|
|
|
|
for s in BMConnectionPool().listeningSockets.values():
|
|
|
|
|
if s.is_bound():
|
|
|
|
|
bound = True
|
|
|
|
|
if not bound:
|
|
|
|
|
time.sleep(1)
|
|
|
|
|
|
2018-10-10 12:23:21 +02:00
|
|
|
|
# pylint: disable=attribute-defined-outside-init
|
2017-08-09 17:29:23 +02:00
|
|
|
|
self.localPort = BMConfigParser().getint('bitmessagesettings', 'port')
|
2018-10-10 12:23:21 +02:00
|
|
|
|
|
2017-01-14 23:20:15 +01:00
|
|
|
|
while state.shutdown == 0 and BMConfigParser().safeGetBoolean('bitmessagesettings', 'upnp'):
|
2018-10-10 12:23:21 +02:00
|
|
|
|
if time.time() - lastSent > self.sendSleep and not self.routers:
|
2016-03-21 22:22:36 +01:00
|
|
|
|
try:
|
|
|
|
|
self.sendSearchRouter()
|
|
|
|
|
except:
|
|
|
|
|
pass
|
2015-11-21 11:59:44 +01:00
|
|
|
|
lastSent = time.time()
|
|
|
|
|
try:
|
2017-01-14 23:20:15 +01:00
|
|
|
|
while state.shutdown == 0 and BMConfigParser().safeGetBoolean('bitmessagesettings', 'upnp'):
|
2018-10-10 12:23:21 +02:00
|
|
|
|
resp, (ip, _) = self.sock.recvfrom(1000)
|
2015-11-21 11:59:44 +01:00
|
|
|
|
if resp is None:
|
|
|
|
|
continue
|
|
|
|
|
newRouter = Router(resp, ip)
|
|
|
|
|
for router in self.routers:
|
2018-02-26 20:03:35 +01:00
|
|
|
|
if router.routerPath == newRouter.routerPath:
|
2015-11-21 11:59:44 +01:00
|
|
|
|
break
|
|
|
|
|
else:
|
|
|
|
|
logger.debug("Found UPnP router at %s", ip)
|
|
|
|
|
self.routers.append(newRouter)
|
|
|
|
|
self.createPortMapping(newRouter)
|
2019-08-01 12:19:56 +02:00
|
|
|
|
try:
|
|
|
|
|
self_peer = state.Peer(
|
|
|
|
|
newRouter.GetExternalIPAddress(),
|
|
|
|
|
self.extPort
|
|
|
|
|
)
|
|
|
|
|
except:
|
|
|
|
|
logger.debug('Failed to get external IP')
|
|
|
|
|
else:
|
|
|
|
|
with knownnodes.knownNodesLock:
|
|
|
|
|
knownnodes.addKnownNode(
|
|
|
|
|
1, self_peer, is_self=True)
|
2018-10-10 12:23:21 +02:00
|
|
|
|
queues.UISignalQueue.put(('updateStatusBar', tr._translate(
|
|
|
|
|
"MainWindow", 'UPnP port mapping established on port %1'
|
|
|
|
|
).arg(str(self.extPort))))
|
2015-11-21 11:59:44 +01:00
|
|
|
|
break
|
2018-10-10 12:23:21 +02:00
|
|
|
|
except socket.timeout:
|
2015-11-21 11:59:44 +01:00
|
|
|
|
pass
|
|
|
|
|
except:
|
|
|
|
|
logger.error("Failure running UPnP router search.", exc_info=True)
|
|
|
|
|
for router in self.routers:
|
|
|
|
|
if router.extPort is None:
|
|
|
|
|
self.createPortMapping(router)
|
2015-11-23 01:35:11 +01:00
|
|
|
|
try:
|
|
|
|
|
self.sock.shutdown(socket.SHUT_RDWR)
|
|
|
|
|
except:
|
|
|
|
|
pass
|
|
|
|
|
try:
|
|
|
|
|
self.sock.close()
|
|
|
|
|
except:
|
|
|
|
|
pass
|
2015-11-22 23:41:03 +01:00
|
|
|
|
deleted = False
|
2015-11-21 11:59:44 +01:00
|
|
|
|
for router in self.routers:
|
|
|
|
|
if router.extPort is not None:
|
2015-11-22 23:41:03 +01:00
|
|
|
|
deleted = True
|
2015-11-21 11:59:44 +01:00
|
|
|
|
self.deletePortMapping(router)
|
2015-11-22 23:41:03 +01:00
|
|
|
|
if deleted:
|
2018-10-10 12:23:21 +02:00
|
|
|
|
queues.UISignalQueue.put(('updateStatusBar', tr._translate("MainWindow", 'UPnP port mapping removed')))
|
2015-11-21 11:59:44 +01:00
|
|
|
|
logger.debug("UPnP thread done")
|
|
|
|
|
|
2016-03-21 21:52:10 +01:00
|
|
|
|
def getLocalIP(self):
|
2018-10-10 12:23:21 +02:00
|
|
|
|
"""Get the local IP of the node"""
|
|
|
|
|
|
2016-03-21 21:52:10 +01:00
|
|
|
|
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
|
|
|
|
s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
|
|
|
|
|
s.connect((uPnPThread.GOOGLE_DNS, 1))
|
|
|
|
|
return s.getsockname()[0]
|
|
|
|
|
|
2015-11-21 11:59:44 +01:00
|
|
|
|
def sendSearchRouter(self):
|
2018-10-10 12:23:21 +02:00
|
|
|
|
"""Querying for UPnP services"""
|
|
|
|
|
|
2015-11-21 11:59:44 +01:00
|
|
|
|
ssdpRequest = "M-SEARCH * HTTP/1.1\r\n" + \
|
2018-10-10 12:23:21 +02:00
|
|
|
|
"HOST: %s:%d\r\n" % (uPnPThread.SSDP_ADDR, uPnPThread.SSDP_PORT) + \
|
|
|
|
|
"MAN: \"ssdp:discover\"\r\n" + \
|
|
|
|
|
"MX: %d\r\n" % (uPnPThread.SSDP_MX, ) + \
|
|
|
|
|
"ST: %s\r\n" % (uPnPThread.SSDP_ST, ) + "\r\n"
|
2015-11-21 00:39:23 +01:00
|
|
|
|
|
|
|
|
|
try:
|
2015-11-21 11:59:44 +01:00
|
|
|
|
logger.debug("Sending UPnP query")
|
2016-03-21 21:52:10 +01:00
|
|
|
|
self.sock.sendto(ssdpRequest, (uPnPThread.SSDP_ADDR, uPnPThread.SSDP_PORT))
|
2015-11-21 11:59:44 +01:00
|
|
|
|
except:
|
|
|
|
|
logger.exception("UPnP send query failed")
|
|
|
|
|
|
|
|
|
|
def createPortMapping(self, router):
|
2018-10-10 12:23:21 +02:00
|
|
|
|
"""Add a port mapping"""
|
2015-11-21 11:59:44 +01:00
|
|
|
|
|
|
|
|
|
for i in range(50):
|
|
|
|
|
try:
|
2016-03-21 21:52:10 +01:00
|
|
|
|
localIP = self.localIP
|
2015-11-21 11:59:44 +01:00
|
|
|
|
if i == 0:
|
2018-10-10 12:23:21 +02:00
|
|
|
|
extPort = self.localPort # try same port first
|
2015-12-23 13:42:48 +01:00
|
|
|
|
elif i == 1 and self.extPort:
|
2018-10-10 12:23:21 +02:00
|
|
|
|
extPort = self.extPort # try external port from last time next
|
2015-11-21 11:59:44 +01:00
|
|
|
|
else:
|
|
|
|
|
extPort = randint(32767, 65535)
|
2018-10-10 12:23:21 +02:00
|
|
|
|
logger.debug(
|
|
|
|
|
"Attempt %i, requesting UPnP mapping for %s:%i on external port %i",
|
|
|
|
|
i,
|
|
|
|
|
localIP,
|
|
|
|
|
self.localPort,
|
|
|
|
|
extPort)
|
2015-11-21 11:59:44 +01:00
|
|
|
|
router.AddPortMapping(extPort, self.localPort, localIP, 'TCP', 'BitMessage')
|
2015-12-23 13:42:48 +01:00
|
|
|
|
self.extPort = extPort
|
2017-01-11 14:27:19 +01:00
|
|
|
|
BMConfigParser().set('bitmessagesettings', 'extport', str(extPort))
|
2017-02-27 15:55:59 +01:00
|
|
|
|
BMConfigParser().save()
|
2015-11-21 11:59:44 +01:00
|
|
|
|
break
|
|
|
|
|
except UPnPError:
|
|
|
|
|
logger.debug("UPnP error: ", exc_info=True)
|
|
|
|
|
|
|
|
|
|
def deletePortMapping(self, router):
|
2018-10-10 12:23:21 +02:00
|
|
|
|
"""Delete a port mapping"""
|
2015-11-21 11:59:44 +01:00
|
|
|
|
router.DeletePortMapping(router.extPort, 'TCP')
|