Skip to content

Commit

Permalink
dnsforward: imp ddr priority
Browse files Browse the repository at this point in the history
  • Loading branch information
EugeneOne1 committed Jun 20, 2022
1 parent 8f4acce commit 1ba099c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
10 changes: 7 additions & 3 deletions internal/dnsforward/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -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): Define the correct priority policy.
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
Expand Down Expand Up @@ -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,
}
Expand All @@ -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,
}
Expand Down
4 changes: 2 additions & 2 deletions internal/dnsforward/dns_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"}},
Expand All @@ -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"}},
Expand Down

0 comments on commit 1ba099c

Please sign in to comment.