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

[dbip] Performance improvement #25

Closed
chr0mag opened this issue Jan 9, 2022 · 0 comments · Fixed by #27
Closed

[dbip] Performance improvement #25

chr0mag opened this issue Jan 9, 2022 · 0 comments · Fixed by #27
Labels
enhancement New feature or request

Comments

@chr0mag
Copy link
Owner

chr0mag commented Jan 9, 2022

The dbip data is provided as ranges of IP addresses -- not CIDR subnets. While nftables does support this format (known as intervals) the hash:net set type from ipset does not so the ranges must be converted to CIDR notation first. It is possible to store IP ranges in the ipset bitmap:ip set type but this has a fixed size entry of 65536 which is smaller than some of the country sets.

Since nftables supports CIDR notation as well, for simplicity conversion is currently done regardless of which firewall type is provided - but the conversion is expensive.

maxmind provides data in CIDR notation so no conversion is needed. This is the source the better performance for maxmind (~3s) vs. dbip (~11s)

  1. Update the dbip logic to avoid conversion if only the nftables firewall type is requested.
  2. For the iptables firewall type, investigate whether dbip ranges can be provided as is to the ipset bitmap:ip set type. If so, update the dbip logic to use this set type for any sets with fewer than 65536 entries and only use the hash:net set type (which requires conversion) for larger sets.
@chr0mag chr0mag added the enhancement New feature or request label Jan 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant