From dc43ad99101e6fc295687f906fe4e7ea4f1bd0f8 Mon Sep 17 00:00:00 2001 From: Simon Zolin Date: Tue, 25 Jun 2019 15:24:37 +0300 Subject: [PATCH 1/2] * dns: fail on starting DNS server if upstream servers configuration is incorrect --- home/dns.go | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/home/dns.go b/home/dns.go index def74ecc..76e99e8e 100644 --- a/home/dns.go +++ b/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") } From e2675e9a3bb54263d991ed4e9260d5acfedd63da Mon Sep 17 00:00:00 2001 From: Ildar Kamalov Date: Tue, 2 Jul 2019 11:52:57 +0300 Subject: [PATCH 2/2] - client: fix link to dhcp settings page --- client/src/components/Settings/Clients/Form.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/components/Settings/Clients/Form.js b/client/src/components/Settings/Clients/Form.js index 4a32f9f8..b10487c4 100644 --- a/client/src/components/Settings/Clients/Form.js +++ b/client/src/components/Settings/Clients/Form.js @@ -80,7 +80,7 @@ let Form = (props) => {
+ link , ]}