From ce1b2bc4f17b2123e9a16ad0665061505c437376 Mon Sep 17 00:00:00 2001 From: Eugene Burkov Date: Mon, 20 Jun 2022 17:48:56 +0300 Subject: [PATCH] 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 Date: Mon Jun 20 17:33:56 2022 +0300 dnsforward: imp docs commit 1ba099c2cc318e00b390c4e1b8770aee970d5c20 Author: Eugene Burkov Date: Mon Jun 20 17:12:46 2022 +0300 dnsforward: imp ddr priority --- internal/dnsforward/dns.go | 10 +++++++--- internal/dnsforward/dns_test.go | 4 ++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/internal/dnsforward/dns.go b/internal/dnsforward/dns.go index 55a38a2f..3c444e2c 100644 --- a/internal/dnsforward/dns.go +++ b/internal/dnsforward/dns.go @@ -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, } diff --git a/internal/dnsforward/dns_test.go b/internal/dnsforward/dns_test.go index b9c7e47b..1e0537dc 100644 --- a/internal/dnsforward/dns_test.go +++ b/internal/dnsforward/dns_test.go @@ -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"}},