bugfix: actually *use* the CH class

This commit is contained in:
Miek Gieben
2016-03-25 20:30:38 +00:00
parent d9b7c94724
commit a832ab696a
2 changed files with 2 additions and 1 deletions

View File

@@ -17,7 +17,7 @@ type Chaos struct {
func (c Chaos) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) { func (c Chaos) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) {
state := middleware.State{W: w, Req: r} state := middleware.State{W: w, Req: r}
if state.QClass() != dns.ClassINET || state.QType() != dns.TypeTXT { if state.QClass() != dns.ClassCHAOS || state.QType() != dns.TypeTXT {
return c.Next.ServeDNS(ctx, w, r) return c.Next.ServeDNS(ctx, w, r)
} }
m := new(dns.Msg) m := new(dns.Msg)

View File

@@ -54,6 +54,7 @@ func TestChaos(t *testing.T) {
test.qtype = dns.TypeTXT test.qtype = dns.TypeTXT
} }
req.SetQuestion(dns.Fqdn(test.qname), test.qtype) req.SetQuestion(dns.Fqdn(test.qname), test.qtype)
req.Question[0].Qclass = dns.ClassCHAOS
em.Next = test.next em.Next = test.next
rec := middleware.NewResponseRecorder(&middleware.TestResponseWriter{}) rec := middleware.NewResponseRecorder(&middleware.TestResponseWriter{})