diff --git a/netsplit/funcs.go b/netsplit/funcs.go index 10613be..e1b9707 100644 --- a/netsplit/funcs.go +++ b/netsplit/funcs.go @@ -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++ } } } diff --git a/netsplit/funcs_cache.go b/netsplit/funcs_cache.go index 896b21c..e75d912 100644 --- a/netsplit/funcs_cache.go +++ b/netsplit/funcs_cache.go @@ -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 }