NSEC3 working for types < 256

This commit is contained in:
Miek Gieben 2012-01-15 13:20:53 +01:00
parent dc6c6d7c9e
commit e76189c8f7
3 changed files with 7 additions and 12 deletions

View File

@ -6,17 +6,11 @@ things that need to be fixed.
* Parsing
* $INCLUDE
* Add handy zone data structure (r/b tree)?
* Use the Exchange structure to deal with errors when resolving, esp. Timeout
* encoding NSEC3/NSEC bitmaps, DEcoding works;
* IsSubdomain, IsGlue helper functions;
* Speed
## Issues
* Check the network order, it works now, but this is on Intel?
## Examples to create
## Examples to add
* Nameserver, with a small zone, 1 KSK and online signing;
* Recursor - ala FunkenSturm?

View File

@ -84,7 +84,6 @@ func handleReflect(w dns.ResponseWriter, r *dns.Msg) {
nsec3.SaltLength = uint8(len(nsec3.Salt)/2)
nsec3.NextDomain = "miek.nl."
// nsec3.TypeBitMap = []uint16{dns.TypeA, dns.TypeNS, dns.TypeMX, dns.TypeTXT, 4000, 4001}
// nsec3.TypeBitMap = []uint16{dns.TypeA, dns.TypeNS, dns.TypeMX, dns.TypeTXT}
nsec3.TypeBitMap = []uint16{dns.TypeA, dns.TypeNS, dns.TypeSOA, dns.TypeTXT}
nsec3.HashNames("miek.nl.")

10
msg.go
View File

@ -422,9 +422,10 @@ func packStructValue(val reflect.Value, msg []byte, off int, compression map[str
window := uint16(t / 256)
if lastwindow != window {
// New window
off += 2 + int(length)
println("New window, adding", 2+length)
off += int(length)+2
}
length := (t - window*256) / 8
length = (t - window*256) / 8
bit := t - (window * 256) - (length * 8)
println("Setting window", off, "to", byte(window))
@ -432,14 +433,15 @@ func packStructValue(val reflect.Value, msg []byte, off int, compression map[str
println("Setting length", off+1, "to", byte(length+1))
msg[off+1] = byte(length+1)
println("Setting value", off+1+1+int(length), "to", byte(1<<bit))
msg[off+1+1+int(length)] |= byte(1 << bit)
msg[off+1+1+int(length)] |= byte(1 << (7-bit))
println(t, window, length, bit, 1<<bit)
fmt.Printf("%b\n", msg[off+2+int(length)])
lastwindow = window
}
off += 3
off+=2+int(length)
off++
println("off", off)
}
case reflect.Struct: