We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
It seems like on some sets of prefixes (128.0.0.0/1 and 0.0.0.0/1 in my case), it causes infinity loop:
128.0.0.0/1
0.0.0.0/1
func branchingFactorIPv4(ps []Prefix) (int, bool) { var lastBF, lastN int base := ipToIPv4Int(ps[0].IP.Mask(ps[0].Mask)) mask := ipMaskToIPv4Int(ps[0].Mask) l := ps[0].Len() for bf := 1; bf < IPv4PrefixLen; bf++ { n, nfull := 0, 1<<uint(bf) max := ipv4Int(1 << uint(bf)) aggrMask := mask << uint(bf) for pat := ipv4Int(0); pat < max; pat++ { aggr := base&aggrMask | pat<<uint(IPv4PrefixLen-l) for _, p := range ps { i := ipToIPv4Int(p.IP) if aggr == i&mask { n++ } } } if n < nfull { break } lastBF = bf lastN = n } n := 1 << uint(lastBF) return n, lastN >= n }
After some calculation it causes panic:
runtime error: slice bounds out of range [:2147483648] with capacity 24
The text was updated successfully, but these errors were encountered:
No branches or pull requests
It seems like on some sets of prefixes (
128.0.0.0/1
and0.0.0.0/1
in my case), it causes infinity loop:After some calculation it causes panic:
The text was updated successfully, but these errors were encountered: