mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-12-15 11:22:49 +03:00
Merge: * dns: fail on starting DNS server if upstream servers configuration is incorrect
* commit 'e2675e9a3bb54263d991ed4e9260d5acfedd63da': - client: fix link to dhcp settings page * dns: fail on starting DNS server if upstream servers configuration is incorrect
This commit is contained in:
commit
b419a1e3d8
@ -80,7 +80,7 @@ let Form = (props) => {
|
||||
<div className="form__desc">
|
||||
<Trans
|
||||
components={[
|
||||
<a href="#settings_dhcp" key="0">
|
||||
<a href="#dhcp" key="0">
|
||||
link
|
||||
</a>,
|
||||
]}
|
||||
|
20
home/dns.go
20
home/dns.go
@ -171,7 +171,7 @@ func onDNSRequest(d *proxy.DNSContext) {
|
||||
}
|
||||
}
|
||||
|
||||
func generateServerConfig() dnsforward.ServerConfig {
|
||||
func generateServerConfig() (dnsforward.ServerConfig, error) {
|
||||
filters := []dnsfilter.Filter{}
|
||||
userFilter := userFilter()
|
||||
filters = append(filters, dnsfilter.Filter{
|
||||
@ -206,14 +206,14 @@ func generateServerConfig() dnsforward.ServerConfig {
|
||||
|
||||
upstreamConfig, err := proxy.ParseUpstreamsConfig(config.DNS.UpstreamDNS, config.DNS.BootstrapDNS, dnsforward.DefaultTimeout)
|
||||
if err != nil {
|
||||
log.Error("Couldn't get upstreams configuration cause: %s", err)
|
||||
return newconfig, fmt.Errorf("Couldn't get upstreams configuration cause: %s", err)
|
||||
}
|
||||
newconfig.Upstreams = upstreamConfig.Upstreams
|
||||
newconfig.DomainsReservedUpstreams = upstreamConfig.DomainReservedUpstreams
|
||||
newconfig.AllServers = config.DNS.AllServers
|
||||
newconfig.FilterHandler = applyClientSettings
|
||||
newconfig.OnDNSRequest = onDNSRequest
|
||||
return newconfig
|
||||
return newconfig, nil
|
||||
}
|
||||
|
||||
// If a client has his own settings, apply them
|
||||
@ -235,8 +235,11 @@ func startDNSServer() error {
|
||||
return fmt.Errorf("unable to start forwarding DNS server: Already running")
|
||||
}
|
||||
|
||||
newconfig := generateServerConfig()
|
||||
err := dnsServer.Start(&newconfig)
|
||||
newconfig, err := generateServerConfig()
|
||||
if err != nil {
|
||||
return errorx.Decorate(err, "Couldn't start forwarding DNS server")
|
||||
}
|
||||
err = dnsServer.Start(&newconfig)
|
||||
if err != nil {
|
||||
return errorx.Decorate(err, "Couldn't start forwarding DNS server")
|
||||
}
|
||||
@ -254,8 +257,11 @@ func reconfigureDNSServer() error {
|
||||
return fmt.Errorf("Refusing to reconfigure forwarding DNS server: not running")
|
||||
}
|
||||
|
||||
config := generateServerConfig()
|
||||
err := dnsServer.Reconfigure(&config)
|
||||
config, err := generateServerConfig()
|
||||
if err != nil {
|
||||
return errorx.Decorate(err, "Couldn't start forwarding DNS server")
|
||||
}
|
||||
err = dnsServer.Reconfigure(&config)
|
||||
if err != nil {
|
||||
return errorx.Decorate(err, "Couldn't start forwarding DNS server")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user