Skip to content

Commit

Permalink
- Fix BBB resolve DNS after stop VPN service
Browse files Browse the repository at this point in the history
  • Loading branch information
zero88 committed Jun 15, 2021
1 parent 24cc83f commit fe06d1e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
18 changes: 7 additions & 11 deletions cli/python/src/client/cmd_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,12 +361,10 @@ def do_force_start(self, log_lvl=logger.INFO):
self.lease_vpn_ip(vpn_acc, log_lvl=log_lvl)

def do_force_stop(self, log_lvl=logger.INFO):
self.storage.set_current('')
if self.is_installed(silent=True):
self.storage.set_current('')
self.post_exec(log_lvl=log_lvl, _force_stop=True)
if self.device.dns_resolver.is_connman():
self.device.ip_resolver.renew_all_ip(silent=True)
else:
self.device.dns_resolver.restart()
self.device.dns_resolver.restart()

def lease_vpn_service(self, is_enable: bool = True, is_restart: bool = True, is_lease_ip: bool = False,
account: Optional[str] = None):
Expand Down Expand Up @@ -395,12 +393,10 @@ def shutdown_vpn_service(self, is_stop=True, is_disable=False, vpn_service: str
if is_disable:
self.device.unix_service.disable(vpn_service)
if is_stop:
self.device.unix_service.stop(vpn_service)
if self.is_installed(silent=True):
self.storage.set_current('')
self._cleanup_zombie_vpn(log_lvl=log_lvl)
if self.device.dns_resolver.is_connman():
self.device.ip_resolver.renew_all_ip(silent=True)
if self.device.unix_service.status(vpn_service).is_running():
self.device.unix_service.stop(vpn_service)
else:
self.do_force_stop(log_lvl)

def backup_config(self):
backup_dir = self.opts.backup_dir()
Expand Down
5 changes: 2 additions & 3 deletions cli/python/src/client/device_resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,9 +596,8 @@ def resolve(self, vpn_service: str, reason: DHCPReason, priv_root_dns: str, new_
return
resolver.update_hook(reason, priv_root_dns, nss, self.vpn_hook_cfg)

def restart(self, keep_dnsmasq=True):
if not self.is_connman():
self._resolver().restart(_all=not keep_dnsmasq, keep_dnsmasq=keep_dnsmasq)
def restart(self):
self._resolver().restart(_all=self.is_connman(), keep_dnsmasq=True)

def _resolver(self) -> DNSFlavour:
if self.kind.is_dnsmasq():
Expand Down

0 comments on commit fe06d1e

Please sign in to comment.