diff --git a/internal/dnsforward/dns.go b/internal/dnsforward/dns.go index e049bef0..2865bc84 100644 --- a/internal/dnsforward/dns.go +++ b/internal/dnsforward/dns.go @@ -278,7 +278,9 @@ func (s *Server) processDDRQuery(ctx *dnsContext) (rc resultCode) { // makeDDRResponse creates DDR answer according to server configuration. func (s *Server) makeDDRResponse(req *dns.Msg) (resp *dns.Msg) { resp = s.makeResponse(req) - domainName := s.conf.ServerName + // TODO(e.burkov): Think about stroing the FQDN version of the server's + // name somewhere. + domainName := dns.Fqdn(s.conf.ServerName) for _, addr := range s.dnsProxy.HTTPSListenAddr { values := []dns.SVCBKeyValue{ diff --git a/internal/dnsforward/dns_test.go b/internal/dnsforward/dns_test.go index b40b7bc2..129e3c2f 100644 --- a/internal/dnsforward/dns_test.go +++ b/internal/dnsforward/dns_test.go @@ -14,12 +14,15 @@ import ( "github.com/stretchr/testify/require" ) -const ddrTestDomainName = "dns.example.net" +const ( + ddrTestDomainName = "dns.example.net" + ddrTestFQDN = ddrTestDomainName + "." +) func TestServer_ProcessDDRQuery(t *testing.T) { dohSVCB := &dns.SVCB{ Priority: 1, - Target: ddrTestDomainName, + Target: ddrTestFQDN, Value: []dns.SVCBKeyValue{ &dns.SVCBAlpn{Alpn: []string{"h2"}}, &dns.SVCBPort{Port: 8044}, @@ -29,7 +32,7 @@ func TestServer_ProcessDDRQuery(t *testing.T) { dotSVCB := &dns.SVCB{ Priority: 2, - Target: ddrTestDomainName, + Target: ddrTestFQDN, Value: []dns.SVCBKeyValue{ &dns.SVCBAlpn{Alpn: []string{"dot"}}, &dns.SVCBPort{Port: 8043}, @@ -38,7 +41,7 @@ func TestServer_ProcessDDRQuery(t *testing.T) { doqSVCB := &dns.SVCB{ Priority: 3, - Target: ddrTestDomainName, + Target: ddrTestFQDN, Value: []dns.SVCBKeyValue{ &dns.SVCBAlpn{Alpn: []string{"doq"}}, &dns.SVCBPort{Port: 8042},