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

Prefix lookups possible? #21

Closed
eliaswendt opened this issue Jun 23, 2020 · 1 comment
Closed

Prefix lookups possible? #21

eliaswendt opened this issue Jun 23, 2020 · 1 comment

Comments

@eliaswendt
Copy link

eliaswendt commented Jun 23, 2020

Hi there,

I was just wondering, whether it's also possible to directly lookup prefixes (instead of IPs) in the SubnetTree.
I tried the following:

from SubnetTree import SubnetTree

subnet_tree = SubnetTree()

subnet_tree['10.0.0.0/24'] = "/24"
subnet_tree['10.0.0.0/25'] = "/25"

print(subnet_tree['10.0.0.0/24'])

As output I received: "/25"

I am wondering what happens here, as I expected "/24" as result.
First idea that came to my mind, was, that the lookup (last line) just cuts-off the trailing "/24" and uses the prefix as IP, which would match the /25 (longest prefix). Otherwise, may this be a bug?

EDIT: I am using version 0.33 with Python 3.8.1 on macOS

@0xxon
Copy link
Member

0xxon commented Jun 23, 2020

I think this is a duplicate of #16

In that @jsiwek indicated that no, it currently is not possible to do a direct prefix lookup. Though you can get a list of the prefixes.

Closing this as a duplicate.

@0xxon 0xxon closed this as completed Jun 23, 2020
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