location-import.in: optimise regular expression for filtering ASN allocations to other RIRs when parsing ARIN AS names file

Message ID 234e5464-f24f-9725-2cdc-0b0f4173e7c1@ipfire.org
State Accepted
Headers
Series location-import.in: optimise regular expression for filtering ASN allocations to other RIRs when parsing ARIN AS names file |

Commit Message

Peter Müller June 20, 2021, 10:43 a.m. UTC
  https://lists.ipfire.org/pipermail/location/2021-June/000394.html

Reported-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
---
 src/python/location-importer.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Patch

diff --git a/src/python/location-importer.in b/src/python/location-importer.in
index b235db7..ff90d91 100644
--- a/src/python/location-importer.in
+++ b/src/python/location-importer.in
@@ -811,7 +811,7 @@  class CLI(object):
 					continue
 
 				# Skip any AS name that appears to be a placeholder for a different RIR or entity...
-				if re.match(r"^(ASN-BLK|)(AFCONC|AFRINIC|APNIC|ASNBLK|DNIC|LACNIC|RIPE|IANA)(\d?$|\-.*)", name):
+				if re.match(r"^(ASN-BLK|)(AFCONC|AFRINIC|APNIC|ASNBLK|DNIC|LACNIC|RIPE|IANA)(?:\d?$|\-)", name):
 					continue
 
 				# Bail out in case the AS name contains anything we do not expect here...