nradix icon indicating copy to clipboard operation
nradix copied to clipboard

IPv4 and IPv6 collision

Open fishnux opened this issue 5 years ago • 3 comments

There seems to be a collision with the following specific CIDRs:

  • 42.0.0.0/22
  • 2a00::/22
package main

import (
	"fmt"
	"github.com/asergeyev/nradix"
)

func main() {
	tr := nradix.NewTree(0)
	
	err := tr.AddCIDR("42.0.0.0/22", "Got 42.0.0.0/22")
	if err != nil {
		fmt.Print(err)
	}

	inf, err := tr.FindCIDR("2a00::/22")
	if err != nil {
		fmt.Print(err)
	}
	
	fmt.Print(inf)
}

https://play.golang.org/p/xQiaBZQZkWi

fishnux avatar Mar 22 '20 20:03 fishnux

yes, I'm encountering the same issue. I'm feeding the tree IPV4 CIDRs only and when I ask on an IPv6 - it finds it in the tree. Can we please have a fix for it?

lior-k avatar Apr 26 '20 15:04 lior-k