HIP unpack support -- not tested
This commit is contained in:
parent
f45d4d933d
commit
c82a1af1e3
20
msg.go
20
msg.go
|
@ -642,18 +642,30 @@ func unpackStructValue(val reflect.Value, msg []byte, off int) (off1 int, ok boo
|
||||||
default:
|
default:
|
||||||
println("dns: unknown tag unpacking slice", val.Type().Field(i).Tag)
|
println("dns: unknown tag unpacking slice", val.Type().Field(i).Tag)
|
||||||
return lenmsg, false
|
return lenmsg, false
|
||||||
// Need to add domain-name for HIP
|
case "domain-name":
|
||||||
|
// HIP record slice of name (or none)
|
||||||
|
servers := make([]string, 0)
|
||||||
|
var s string
|
||||||
|
for off < lenmsg {
|
||||||
|
s, off, ok = UnpackDomainName(msg, off)
|
||||||
|
if !ok {
|
||||||
|
println("dns: failure unpacking domain-name")
|
||||||
|
return lenmsg, false
|
||||||
|
}
|
||||||
|
servers = append(servers, s)
|
||||||
|
}
|
||||||
|
fv.Set(reflect.ValueOf(servers))
|
||||||
case "txt":
|
case "txt":
|
||||||
txt := make([]string,0)
|
txt := make([]string, 0)
|
||||||
rdlength := int(val.FieldByName("Hdr").FieldByName("Rdlength").Uint())
|
rdlength := int(val.FieldByName("Hdr").FieldByName("Rdlength").Uint())
|
||||||
Txts:
|
Txts:
|
||||||
l := int(msg[off])
|
l := int(msg[off])
|
||||||
if off + l + 1 > lenmsg {
|
if off+l+1 > lenmsg {
|
||||||
println("dns: failure unpacking txt strings")
|
println("dns: failure unpacking txt strings")
|
||||||
return lenmsg, false
|
return lenmsg, false
|
||||||
}
|
}
|
||||||
txt = append(txt, string(msg[off+1:off+l+1]))
|
txt = append(txt, string(msg[off+1:off+l+1]))
|
||||||
off += l+1
|
off += l + 1
|
||||||
if off < rdlength {
|
if off < rdlength {
|
||||||
// More
|
// More
|
||||||
goto Txts
|
goto Txts
|
||||||
|
|
2
types.go
2
types.go
|
@ -859,7 +859,7 @@ func (rr *RR_NSEC3) String() string {
|
||||||
|
|
||||||
func (rr *RR_NSEC3) Len() int {
|
func (rr *RR_NSEC3) Len() int {
|
||||||
return rr.Hdr.Len() + 6 + len(rr.Salt)/2 + 1 + len(rr.NextDomain) + 1 + len(rr.TypeBitMap)
|
return rr.Hdr.Len() + 6 + len(rr.Salt)/2 + 1 + len(rr.NextDomain) + 1 + len(rr.TypeBitMap)
|
||||||
// TODO: typebitmap
|
// TODO: typebitmap length
|
||||||
}
|
}
|
||||||
|
|
||||||
type RR_NSEC3PARAM struct {
|
type RR_NSEC3PARAM struct {
|
||||||
|
|
Loading…
Reference in New Issue