From: Peter Müller Date: Sun, 12 Dec 2021 09:05:15 +0000 (+0100) Subject: location-importer: Improve regex for catching historic/orphaned data X-Git-Tag: 0.9.10~9 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5254e5fce603a924a94aee4db39306d9ff10d471;p=people%2Fms%2Flibloc.git location-importer: Improve regex for catching historic/orphaned data 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 Signed-off-by: Michael Tremer --- diff --git a/src/python/location-importer.in b/src/python/location-importer.in index eff9253..4373e41 100644 --- a/src/python/location-importer.in +++ b/src/python/location-importer.in @@ -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