fix reservation checking
This commit is contained in:
parent
d8469533a7
commit
2a780ae88a
@ -177,6 +177,7 @@ func CheckReserved(nets []*netip.Prefix, revRecursive, recursive, excludePrivate
|
||||
if _, _, reserved, err = RetrieveReserved(); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
for _, n := range nets {
|
||||
if n == nil {
|
||||
continue
|
||||
@ -219,8 +220,6 @@ func CheckReserved(nets []*netip.Prefix, revRecursive, recursive, excludePrivate
|
||||
// Contain takes the results of a NetSplitter and returns a StructuredResults. The reservations are only checked against nets.
|
||||
func Contain(origPfx *netip.Prefix, nets []*netip.Prefix, remaining *netipx.IPSet, splitter NetSplitter) (s *StructuredResults, err error) {
|
||||
|
||||
var idx int
|
||||
var r *IANAAddrNetResRecord
|
||||
var rem []netip.Prefix
|
||||
var reserved map[netip.Prefix]*IANAAddrNetResRecord
|
||||
var sr = StructuredResults{
|
||||
@ -281,8 +280,10 @@ func Contain(origPfx *netip.Prefix, nets []*netip.Prefix, remaining *netipx.IPSe
|
||||
}
|
||||
if reserved != nil && len(reserved) > 0 {
|
||||
s.Reservations = make([]*IANAAddrNetResRecord, len(reserved))
|
||||
for idx, r = range reserved {
|
||||
idx := 0
|
||||
for _, r := range reserved {
|
||||
s.Reservations[idx] = r
|
||||
idx++
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ func RetrieveReserved() (ipv4, ipv6 IANARegistry, reserved map[netip.Prefix]*IAN
|
||||
return
|
||||
}
|
||||
ianaReserved4 = new(IANARegistry)
|
||||
ianaReserved4 = new(IANARegistry)
|
||||
ianaReserved6 = new(IANARegistry)
|
||||
if err = json.Unmarshal(dat4, ianaReserved4); err != nil {
|
||||
return
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user