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

IPv6 support #7

Open
brandond opened this issue Aug 18, 2017 · 4 comments
Open

IPv6 support #7

brandond opened this issue Aug 18, 2017 · 4 comments

Comments

@brandond
Copy link

brandond commented Aug 18, 2017

Hey, I saw that IPv6 support was on your roadmap. I'm attempting to use your library to increase the speed of logstash-filter-cidr, which is currently VERY slow, but does support IPv6. What would it take to add support not just for IPv6, but also generic v4/v6 ip type and trie?

The use case is that the user may provide a list containing both IPv4 and v6 CIDRs to match, and events to be matched may contain addresses of either type as well. We would need to be able to build a trie containing both types, and make queries using address of either type.

Support for IPv4-mapped IPv6 addresses would also be nice (::ffff:192.168.0.0/120 matches 192.168.0.1)

@veqryn
Copy link
Owner

veqryn commented Aug 18, 2017

Hi, and thanks for looking at my library.
I would love to get IPv6 support in.
From a technical perspective, we'd want to:

  • Make a common interface for IPv4 + IPv6, which might require normalizing everything into an IPv6 format, since they are normally incompatible with each other. This would probably need to be done with methods, since we wouldn't want to increase the memory footprint of IPv4.
  • After we have a common interface, modifying the cidr type shouldn't be that hard by itself, but it would have a side effect: because of how we store the cidrs, the memory requirement for storing IPv6 (or a IPv4 through a common interface that normalizes to IPv6) would quadruple. So, we'd probably want to switch to a compressed trie, rather than the current uncompressed one.

I'll be honest, I probably don't have the time to do that myself in short order.
I'd be happy though to work with you or some other interested parties to do it.

@brandond
Copy link
Author

I'm passable with Java, although certainly not as handy with it as other languages... but I'd be glad to take a whack at it if you're willing to help with the code review.

I think I can muddle my way through the first item. For the second, I'm at a bit of a loss, having no experience implementing tries, compressed or otherwise. You have any pointers to share that might get me started in the right direction?

@veqryn
Copy link
Owner

veqryn commented Aug 19, 2017

Lets take it in smaller steps and get a compatible IPv6 type out first, with a shared interface.
For the trie, the compression I am referring to would be not expanding nodes unnecessarily. So for example, if you put a /32 ipv4 cidr into the trie currently, you will end up with 32 nodes in your trie regardless of whether you have other cidrs in the trie or not. If if you only have 1 cidr in the trie, you only need one or a few nodes.

@robeden
Copy link

robeden commented May 25, 2018

(First, thanks for the library.)

I'm not to the point where I need this yet, but needing it is on our roadmap. So, add me to the list of people who might get to this first.

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

3 participants