Pull request: 4463 Improve DDR priority

Merge in DNS/adguard-home from 4463-ddr-prior to master

Updates #4463.

Squashed commit of the following:

commit 30b470abe6ea6a58b50a49715c77342018be9491
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date:   Mon Jun 20 17:33:56 2022 +0300

    dnsforward: imp docs

commit 1ba099c2cc318e00b390c4e1b8770aee970d5c20
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date:   Mon Jun 20 17:12:46 2022 +0300

    dnsforward: imp ddr priority
This commit is contained in:
Eugene Burkov 2022-06-20 17:48:56 +03:00
parent 8f4acce44a
commit ce1b2bc4f1
2 changed files with 9 additions and 5 deletions

View File

@ -275,7 +275,11 @@ func (s *Server) processDDRQuery(ctx *dnsContext) (rc resultCode) {
return resultCodeSuccess
}
// makeDDRResponse creates DDR answer according to server configuration.
// makeDDRResponse creates DDR answer according to server configuration. The
// contructed SVCB resource records have the priority of 1 for each entry,
// similar to examples provided by https://www.ietf.org/archive/id/draft-ietf-add-ddr-06.html.
//
// TODO(a.meshkov): Consider setting the priority values based on the protocol.
func (s *Server) makeDDRResponse(req *dns.Msg) (resp *dns.Msg) {
resp = s.makeResponse(req)
// TODO(e.burkov): Think about storing the FQDN version of the server's
@ -307,7 +311,7 @@ func (s *Server) makeDDRResponse(req *dns.Msg) (resp *dns.Msg) {
ans := &dns.SVCB{
Hdr: s.hdr(req, dns.TypeSVCB),
Priority: 2,
Priority: 1,
Target: domainName,
Value: values,
}
@ -323,7 +327,7 @@ func (s *Server) makeDDRResponse(req *dns.Msg) (resp *dns.Msg) {
ans := &dns.SVCB{
Hdr: s.hdr(req, dns.TypeSVCB),
Priority: 3,
Priority: 1,
Target: domainName,
Value: values,
}

View File

@ -31,7 +31,7 @@ func TestServer_ProcessDDRQuery(t *testing.T) {
}
dotSVCB := &dns.SVCB{
Priority: 2,
Priority: 1,
Target: ddrTestFQDN,
Value: []dns.SVCBKeyValue{
&dns.SVCBAlpn{Alpn: []string{"dot"}},
@ -40,7 +40,7 @@ func TestServer_ProcessDDRQuery(t *testing.T) {
}
doqSVCB := &dns.SVCB{
Priority: 3,
Priority: 1,
Target: ddrTestFQDN,
Value: []dns.SVCBKeyValue{
&dns.SVCBAlpn{Alpn: []string{"doq"}},