Skip to content
New issue

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

Over scribing ASN to same net but distinct mask #16

Open
LMBertholdo opened this issue Sep 8, 2019 · 1 comment
Open

Over scribing ASN to same net but distinct mask #16

LMBertholdo opened this issue Sep 8, 2019 · 1 comment

Comments

@LMBertholdo
Copy link

Apparently, when you put the longest prefix it over scribe all less specific.

t["10.1.0.0/22"] = "as10"
t["10.1.0.0/24"] = "as20"
print(t["10.1.0.0/22"], t["10.1.0.0/24"])
as20 as20

@jsiwek
Copy link
Contributor

jsiwek commented Sep 9, 2019

From the README, "Lookups are performed by longest-prefix matching." And maybe the confusing part is also that I don't think this is doing a lookup of the networks/keys:

print(t["10.1.0.0/22"], t["10.1.0.0/24"])

I think it's silently dropping the prefix length and essentially just doing:

print(t["10.1.0.0"], t["10.1.0.0"])

And the longest prefix match for that was "as20".

To get the list of prefixes that were originally inserted in the SubnetTree, might be able to use the prefixes() method:

>>> t.prefixes(ipv4_native=True)
{'10.1.0.0/22', '10.1.0.0/24'}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants