mirror of
https://github.com/safing/portmaster
synced 2025-09-01 18:19:12 +00:00
Improve missing dns servers module error
This commit is contained in:
parent
a0268ee91d
commit
30f84e8009
1 changed files with 8 additions and 4 deletions
|
@ -204,28 +204,32 @@ func getSystemResolvers() (resolvers []*Resolver) {
|
|||
return resolvers
|
||||
}
|
||||
|
||||
const missingResolversErrorID = "missing-resolvers"
|
||||
|
||||
func loadResolvers() {
|
||||
// TODO: what happens when a lot of processes want to reload at once? we do not need to run this multiple times in a short time frame.
|
||||
resolversLock.Lock()
|
||||
defer resolversLock.Unlock()
|
||||
|
||||
// Resolve module error about missing resolvers.
|
||||
module.Resolve(missingResolversErrorID)
|
||||
|
||||
newResolvers := append(
|
||||
getConfiguredResolvers(configuredNameServers()),
|
||||
getSystemResolvers()...,
|
||||
)
|
||||
|
||||
if len(newResolvers) == 0 {
|
||||
msg := "no (valid) dns servers found in (user) configuration or system, falling back to defaults"
|
||||
msg := "no (valid) dns servers found in configuration or system, falling back to defaults"
|
||||
log.Warningf("resolver: %s", msg)
|
||||
module.Warning("no-valid-user-resolvers", msg)
|
||||
module.Warning(missingResolversErrorID, msg)
|
||||
|
||||
// load defaults directly, overriding config system
|
||||
newResolvers = getConfiguredResolvers(defaultNameServers)
|
||||
if len(newResolvers) == 0 {
|
||||
msg = "no (valid) dns servers found in configuration or system"
|
||||
log.Criticalf("resolver: %s", msg)
|
||||
module.Error("no-valid-default-resolvers", msg)
|
||||
return
|
||||
module.Error(missingResolversErrorID, msg)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue