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:
|
||||
println("dns: unknown tag unpacking slice", val.Type().Field(i).Tag)
|
||||
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":
|
||||
txt := make([]string,0)
|
||||
txt := make([]string, 0)
|
||||
rdlength := int(val.FieldByName("Hdr").FieldByName("Rdlength").Uint())
|
||||
Txts:
|
||||
l := int(msg[off])
|
||||
if off + l + 1 > lenmsg {
|
||||
if off+l+1 > lenmsg {
|
||||
println("dns: failure unpacking txt strings")
|
||||
return lenmsg, false
|
||||
}
|
||||
txt = append(txt, string(msg[off+1:off+l+1]))
|
||||
off += l+1
|
||||
off += l + 1
|
||||
if off < rdlength {
|
||||
// More
|
||||
goto Txts
|
||||
|
|
Loading…
Reference in New Issue