diff --git a/Makefile b/Makefile index 9a1786ff..4f21bbf7 100644 --- a/Makefile +++ b/Makefile @@ -22,6 +22,7 @@ GOFILES=\ rawmsg.go \ tsig.go\ types.go\ + update.go\ xfr.go\ zone.go\ zparse.go\ diff --git a/README.markdown b/README.markdown index 1563106e..4a3f1209 100644 --- a/README.markdown +++ b/README.markdown @@ -29,6 +29,7 @@ Miek Gieben - 2010, 2011 - miek@miek.nl * 1876 - LOC record (incomplete) * 1995 - IXFR * 1996 - DNS notify +* 2136 - DNS Update * 2181 - RRset definition * 2537 - RSAMD5 DNS keys * 2065 - DNSSEC (updated in later RFCs) diff --git a/defaults.go b/defaults.go index 7aa1b0ca..52303a2e 100644 --- a/defaults.go +++ b/defaults.go @@ -60,6 +60,15 @@ func (dns *Msg) SetRcodeFormatError(request *Msg) { dns.MsgHdr.Id = request.MsgHdr.Id } +// IsQuestion returns true if the the packet is a question +func (dns *Msg) IsQuestion() (ok bool) { + if len(dns.Question) == 0 { + return false + } + ok = dns.MsgHdr.Response == false + return +} + // Is the message a packet with the FormErr set? func (dns *Msg) IsRcodeFormatError() (ok bool) { if len(dns.Question) == 0 { @@ -82,6 +91,7 @@ func (dns *Msg) IsUpdate() (ok bool) { // SetUpdate makes the message a dynamic update packet. It // sets the ZONE section to: z, TypeSOA, classINET. func (dns *Msg) SetUpdate(z string) { + dns.MsgHdr.Id = Id() dns.MsgHdr.Opcode = OpcodeUpdate dns.Question = make([]Question, 1) dns.Question[0] = Question{z, TypeSOA, ClassINET}