Restore dns on unclean shutdown (#1494)

This commit is contained in:
Viktor Liu
2024-01-30 09:58:56 +01:00
committed by GitHub
parent 9c56f74235
commit 846d486366
29 changed files with 660 additions and 143 deletions

View File

@@ -1080,6 +1080,11 @@ func (e *Engine) close() {
log.Errorf("failed closing ebpf proxy: %s", err)
}
// stop/restore DNS first so dbus and friends don't complain because of a missing interface
if e.dnsServer != nil {
e.dnsServer.Stop()
}
log.Debugf("removing Netbird interface %s", e.config.WgIfaceName)
if e.wgInterface != nil {
if err := e.wgInterface.Close(); err != nil {
@@ -1098,10 +1103,6 @@ func (e *Engine) close() {
e.routeManager.Stop()
}
if e.dnsServer != nil {
e.dnsServer.Stop()
}
if e.firewall != nil {
err := e.firewall.Reset()
if err != nil {