]> git.ipfire.org Git - location/libloc.git/commitdiff
location-importer: Improve regex for catching historic/orphaned data
authorPeter Müller <peter.mueller@ipfire.org>
Sun, 12 Dec 2021 09:05:15 +0000 (10:05 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 13 Dec 2021 17:46:29 +0000 (17:46 +0000)
This silences a bunch of warnings due to allocations at APNIC having
country code set to "ZZ", which are completely irrelevant to us.

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

index eff925326469891b244e72b6dd339355defdcfb3..4373e41517caeb3b885471f199e9555ae406dbef 100644 (file)
@@ -671,7 +671,7 @@ class CLI(object):
                        # Filter any inetnum records which are only referring to IP space
                        # not managed by that specific RIR...
                        if key == "netname":
-                               if re.match(r"(ERX-NETBLOCK|(AFRINIC|ARIN|LACNIC|RIPE)-CIDR-BLOCK|IANA-NETBLOCK-\d{1,3}|NON-RIPE-NCC-MANAGED-ADDRESS-BLOCK)", val.strip()):
+                               if re.match(r"^(ERX-NETBLOCK|(AFRINIC|ARIN|LACNIC|RIPE)-CIDR-BLOCK|IANA-NETBLOCK-\d{1,3}|NON-RIPE-NCC-MANAGED-ADDRESS-BLOCK|STUB-[\d-]{3,}SLASH\d{1,2})", val.strip()):
                                        log.debug("Skipping record indicating historic/orphaned data: %s" % val.strip())
                                        return