summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/vpn
diff options
context:
space:
mode:
authorRuben Pollan <meskio@sindominio.net>2017-07-18 22:37:02 +0200
committerRuben Pollan <meskio@sindominio.net>2017-07-20 21:37:04 +0200
commite5e1b7a5309169ae88d32d67f3fb949c1462b4da (patch)
treeaf7bd95e77d21583cf79f73cc15cb9be7e3a386f /src/leap/bitmask/vpn
parent157ddb7459e585cb4893dd1533e788c8489ee2eb (diff)
[feat] clean up the firewall on bitmask start
Just in chance the firewall was not properly cleaned up in a previeous run (bitmask crashed, some bugs in the code, ...). Let's clean up the firewall when it starts. - Resolves: #8979
Diffstat (limited to 'src/leap/bitmask/vpn')
-rw-r--r--src/leap/bitmask/vpn/service.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/leap/bitmask/vpn/service.py b/src/leap/bitmask/vpn/service.py
index 054845f7..e9b5add8 100644
--- a/src/leap/bitmask/vpn/service.py
+++ b/src/leap/bitmask/vpn/service.py
@@ -57,7 +57,7 @@ class VPNService(HookableService):
super(VPNService, self).__init__()
self._tunnel = None
- self._firewall = None
+ self._firewall = FirewallManager([])
self._domain = ''
if basepath is None:
@@ -65,6 +65,9 @@ class VPNService(HookableService):
else:
self._basepath = basepath
+ if self._firewall.is_up():
+ self._firewall.stop()
+
def startService(self):
# TODO this could trigger a check for validity of the certificates,
# etc.
@@ -114,7 +117,7 @@ class VPNService(HookableService):
defer.returnValue({'result': 'started'})
def stop_vpn(self):
- if self._firewall and self._firewall.is_up():
+ if self._firewall.is_up():
fw_ok = self._firewall.stop()
if not fw_ok:
self.log.error("Firewall: error stopping")
@@ -136,8 +139,7 @@ class VPNService(HookableService):
if self._tunnel:
childrenStatus['vpn'] = self._tunnel.status
- if self._firewall:
- childrenStatus['firewall'] = self._firewall.status
+ childrenStatus['firewall'] = self._firewall.status
status = merge_status(childrenStatus)
if self._domain: