summaryrefslogtreecommitdiff
path: root/src/leap
diff options
context:
space:
mode:
Diffstat (limited to 'src/leap')
-rw-r--r--src/leap/bitmask/core/dispatcher.py4
-rw-r--r--src/leap/bitmask/vpn/service.py3
2 files changed, 5 insertions, 2 deletions
diff --git a/src/leap/bitmask/core/dispatcher.py b/src/leap/bitmask/core/dispatcher.py
index 52de62b..fc17b76 100644
--- a/src/leap/bitmask/core/dispatcher.py
+++ b/src/leap/bitmask/core/dispatcher.py
@@ -436,9 +436,9 @@ class CommandDispatcher(object):
def do_VPN(self, *parts):
vpn = self._get_service(self.subcommand_vpn.label)
- if not vpn:
- return _format_result({'vpn': 'disabled'})
subcmd = parts[1]
+ if subcmd != 'enable' and not vpn:
+ return _format_result({'vpn': 'disabled'})
dispatch = self.subcommand_vpn.dispatch
if subcmd in ('enable', 'disable'):
diff --git a/src/leap/bitmask/vpn/service.py b/src/leap/bitmask/vpn/service.py
index ec9e065..b04ea9f 100644
--- a/src/leap/bitmask/vpn/service.py
+++ b/src/leap/bitmask/vpn/service.py
@@ -90,6 +90,9 @@ class VPNService(HookableService):
# TODO -----------------------------
# when shutting down the main bitmaskd daemon, this should be called.
+ if not self._vpn:
+ raise Exception('VPN was not running')
+
if self._started:
self._vpn.stop()
self._started = False