Skip to content

Commit

Permalink
Fix handling of intervals with same start & end
Browse files Browse the repository at this point in the history
nftables disallows intervals (ranges) that begin and end with the
same IP address (ie. a range of 1 element). Add a check for this
case and add the single IP.

Increment version to 2.3.4.
  • Loading branch information
Julian Phillips committed May 3, 2022
1 parent 73f4d0c commit f176904
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion python/geoipsets/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.3.3
2.3.4
5 changes: 4 additions & 1 deletion python/geoipsets/dbip.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ def generate(self):
else: # create
country_subnets[filename_key] = subnets
else: # conversion not required for nftables
ip_range = r['ip_start'] + '-' + r['ip_end']
if ip_start == ip_end: # nftables disallows intervals with the same start & end
ip_range = r['ip_start']
else:
ip_range = r['ip_start'] + '-' + r['ip_end']
if filename_key in country_subnets: # append
country_subnets[filename_key].append(ip_range)
else: # create
Expand Down

0 comments on commit f176904

Please sign in to comment.