Skip to content

Commit

Permalink
Pull request: 2674 fix upstreams validation
Browse files Browse the repository at this point in the history
Merge in DNS/adguard-home from 2674-quic-upstream to master

Updates AdguardTeam#2674.

Squashed commit of the following:

commit ce76435
Author: Eugene Burkov <[email protected]>
Date:   Tue Feb 16 18:23:39 2021 +0300

    all: fix log

commit b53e436
Author: Eugene Burkov <[email protected]>
Date:   Tue Feb 16 18:21:59 2021 +0300

    all: log changes

commit 1cdca48
Merge: bc441da e32c18f
Author: Eugene Burkov <[email protected]>
Date:   Tue Feb 16 18:15:47 2021 +0300

    Merge branch 'master' into 2674-quic-upstream

commit bc441da
Author: Eugene Burkov <[email protected]>
Date:   Tue Feb 16 17:06:47 2021 +0300

    dnsforward: fix error wrapping

commit 281c1b4
Author: Eugene Burkov <[email protected]>
Date:   Tue Feb 16 17:00:35 2021 +0300

    all: fix validation, imp shutdown

commit 31a5ea7
Author: Eugene Burkov <[email protected]>
Date:   Tue Feb 16 14:53:10 2021 +0300

    dnsforward: fix upstreams validation
  • Loading branch information
EugeneOne1 committed Feb 16, 2021
1 parent e32c18f commit 1122e71
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ and this project adheres to

### Fixed

- Incomplete DNS upstreams validation ([#2674]).
- Wrong parsing of DHCP options of the `ip` type ([#2688]).

[#2674]: https://github.com/AdguardTeam/AdGuardHome/issues/2674
[#2688]: https://github.com/AdguardTeam/AdGuardHome/issues/2688


Expand Down
2 changes: 1 addition & 1 deletion internal/dnsforward/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ func (s *Server) prepareUpstreamSettings() error {
}

if len(upstreamConfig.Upstreams) == 0 {
log.Info("Warning: no default upstream servers specified, using %v", defaultDNS)
log.Info("warning: no default upstream servers specified, using %v", defaultDNS)
uc, err := proxy.ParseUpstreamsConfig(defaultDNS, s.conf.BootstrapDNS, DefaultTimeout)
if err != nil {
return fmt.Errorf("dns: failed to parse default upstreams: %v", err)
Expand Down
6 changes: 6 additions & 0 deletions internal/dnsforward/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"strconv"
"strings"

"github.com/AdguardTeam/dnsproxy/proxy"
"github.com/AdguardTeam/dnsproxy/upstream"
"github.com/AdguardTeam/golibs/log"
"github.com/AdguardTeam/golibs/utils"
Expand Down Expand Up @@ -314,6 +315,11 @@ func ValidateUpstreams(upstreams []string) error {
return nil
}

_, err := proxy.ParseUpstreamsConfig(upstreams, []string{}, DefaultTimeout)
if err != nil {
return err
}

var defaultUpstreamFound bool
for _, u := range upstreams {
d, err := validateUpstream(u)
Expand Down
1 change: 1 addition & 0 deletions internal/home/home.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ func run(args options) {
go func() {
err := startDNSServer()
if err != nil {
closeDNSServer()
log.Fatal(err)
}
}()
Expand Down

0 comments on commit 1122e71

Please sign in to comment.