]> git.ipfire.org Git - location/libloc.git/commit
export: Flatten the tree before exporting it
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 27 Oct 2020 17:14:30 +0000 (17:14 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 27 Oct 2020 17:32:56 +0000 (17:32 +0000)
commitbbed1fd2330e8efa6b413dc152a1a6ef2d771aac
treed0fc35c0d253d96ee9d37e38f3b8462229bd1f98
parentebb087cfa30ec5ca0c96dcce66a91245c1ffc271
export: Flatten the tree before exporting it

This patch removes the possibility that any IP address ranges
might show up in multiple exported files.

If this was content from the database:

  * 10.0.0.0/16 - DE
  * 10.0.1.0/24 - FR

Then the IP address 10.0.1.1 would match for both countries.

The algorithm will now break the larger /16 subnet apart into
smaller subnets so that 10.0.1.0/24 is no longer overlapped.

There was some time spent on this to make this as efficient
as possible.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/python/export.py