]> git.ipfire.org Git - location/libloc.git/commit
location-importer.in: process unaligned IP ranges in RIR data files correctly
authorPeter Müller <peter.mueller@ipfire.org>
Mon, 29 Mar 2021 20:24:36 +0000 (22:24 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 29 Mar 2021 20:26:09 +0000 (20:26 +0000)
commit1814283b82e479f60c0871f0518593f1c6fd4b87
tree6d94a75085eb2715ff099a6d7e93839b676949c5
parent55664c7ef66aafced62f3427391fd5c7bc377255
location-importer.in: process unaligned IP ranges in RIR data files correctly

The IP range given in an inetnum object apparently not necessarily
matches distinct subnet boundaries. As a result, the current attempt to
calculate its CIDR mask resulted in faulty subnets not covering the
entire IP range.

This patch leaves the task of enumerating subnets to the ipaddress
module itself, which handles things much more robust. Since the output
may contain of several subnets, a list for the inetnum key is necessary
as well as a loop over them when conducting the SQL statements.

Fixes: #12595
Cc: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/python/location-importer.in