diff --git a/internal/dnsproxy/proxy.go b/internal/dnsproxy/proxy.go index b29c18f..d6cc527 100644 --- a/internal/dnsproxy/proxy.go +++ b/internal/dnsproxy/proxy.go @@ -93,6 +93,19 @@ func (p *Proxy) handleRequest(w dns.ResponseWriter, r *dns.Msg) { "ttl": ttl, }).Debug("DNS-Proxy received CNAME in reply") p.watches.AddTemp(rr.Target, ttl) + + case dns.TypeDNAME: + // DNAME record, store temporary watch + rr, ok := a.(*dns.DNAME) + if !ok { + log.Error("DNS-Proxy received invalid DNAME record in reply") + continue + } + log.WithFields(log.Fields{ + "target": rr.Target, + "ttl": ttl, + }).Debug("DNS-Proxy received DNAME in reply") + p.watches.AddTemp(rr.Target, ttl) } } diff --git a/internal/dnsproxy/proxy_test.go b/internal/dnsproxy/proxy_test.go index 3aee688..7249522 100644 --- a/internal/dnsproxy/proxy_test.go +++ b/internal/dnsproxy/proxy_test.go @@ -69,11 +69,12 @@ func TestProxyHandleRequest(t *testing.T) { reply := &dns.Msg{} reply.SetReply(r) + dname, _ := dns.NewRR("test.example.com 3600 IN DNAME example.com.") cname, _ := dns.NewRR("test.example.com 3600 IN CNAME example.com.") a, _ := dns.NewRR("example.com. 3600 IN A 127.0.0.1") aaaa, _ := dns.NewRR("example.com. 3600 IN AAAA ::1") - reply.Answer = []dns.RR{cname, aaaa, a} + reply.Answer = []dns.RR{dname, cname, aaaa, a} if err := w.WriteMsg(reply); err != nil { log.WithError(err).Error("error sending reply") }