add glue detection
This commit is contained in:
parent
f111fe57a1
commit
e8ff9ea856
26
zone.go
26
zone.go
|
@ -18,8 +18,8 @@ type ZoneData struct {
|
||||||
RR map[uint16][]RR // Map of the RR type to the RR
|
RR map[uint16][]RR // Map of the RR type to the RR
|
||||||
// DNSSEC signatures for the RRsets
|
// DNSSEC signatures for the RRsets
|
||||||
Signatures []*RR_RRSIG
|
Signatures []*RR_RRSIG
|
||||||
// Almost always true, except for non-origin NS records (and accompanying glue)
|
// Always false, except for glue... TODO(mg)
|
||||||
Authoritatve bool
|
NonAuth bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewZone creates an initialized zone with Origin set origin.
|
// NewZone creates an initialized zone with Origin set origin.
|
||||||
|
@ -52,9 +52,14 @@ func (z *Zone) Insert(r RR) error {
|
||||||
switch t := r.Header().Rrtype; t {
|
switch t := r.Header().Rrtype; t {
|
||||||
case TypeRRSIG:
|
case TypeRRSIG:
|
||||||
zd.Signatures = append(zd.Signatures, r.(*RR_RRSIG))
|
zd.Signatures = append(zd.Signatures, r.(*RR_RRSIG))
|
||||||
|
case TypeNS:
|
||||||
|
// NS records with other names than z.Origin are non-auth
|
||||||
|
if z.Header().Name != z.Origin {
|
||||||
|
zd.NonAuth = true
|
||||||
|
}
|
||||||
|
fallthrough
|
||||||
default:
|
default:
|
||||||
zd.RR[t] = append(zd.RR[t], r)
|
zd.RR[t] = append(zd.RR[t], r)
|
||||||
glueCheck(r)
|
|
||||||
}
|
}
|
||||||
z.Radix.Insert(r.Header().Name, zd)
|
z.Radix.Insert(r.Header().Name, zd)
|
||||||
return
|
return
|
||||||
|
@ -63,21 +68,18 @@ func (z *Zone) Insert(r RR) error {
|
||||||
switch t := r.Header().Rrtype; t {
|
switch t := r.Header().Rrtype; t {
|
||||||
case TypeRRSIG:
|
case TypeRRSIG:
|
||||||
zd.Value.(*ZoneData).Signatures = append(zd.Value.(*ZoneData).Signatures, r.(*RR_RRSIG))
|
zd.Value.(*ZoneData).Signatures = append(zd.Value.(*ZoneData).Signatures, r.(*RR_RRSIG))
|
||||||
|
case TypeNS:
|
||||||
|
// NS records with other names than z.Origin are non-auth
|
||||||
|
if z.Header().Name != z.Origin {
|
||||||
|
zd.NonAuth = true
|
||||||
|
}
|
||||||
|
fallthrough
|
||||||
default:
|
default:
|
||||||
zd.Value.(*ZoneData).RR[t] = append(zd.Value.(*ZoneData).RR[t], r)
|
zd.Value.(*ZoneData).RR[t] = append(zd.Value.(*ZoneData).RR[t], r)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func glueCheck(r RR) {
|
|
||||||
if n, ok := r.(*RR_NS); ok {
|
|
||||||
// Check if glue would be needed
|
|
||||||
if CompareLabels(r.Header().Name, n.Ns) == LenLabels(r.Header().Name) {
|
|
||||||
println("glue needed?", r.Header().Name, n.Ns)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (z *Zone) Remove(r RR) {
|
func (z *Zone) Remove(r RR) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue