From 3b64d0d363648c8b447ff39fa2ed52797a58e7ea Mon Sep 17 00:00:00 2001 From: Jan Philipp Timme Date: Sun, 2 Jun 2019 19:59:48 +0200 Subject: [PATCH] Implement min_length filter requirements, improve error reporting --- generate.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/generate.py b/generate.py index 20eac54..653403b 100755 --- a/generate.py +++ b/generate.py @@ -113,12 +113,13 @@ def create_roa_entries(route_objects, filter_rules, mode, f): # Now check if it permits or denies if matching_filter_rule['route_allowed'] == False: # Skip non-permitted routes - f.write('# route object not permitted: ' + str(route_network) + "\n") - f.write('# route object was denied by filter rule: ' + str(matching_filter_rule) + "\n") + f.write('# DENIED' + str(route_object) + ' by filter rule: ' + str(matching_filter_rule) + '\n') continue # Check if min-length fits filter requirements - - + if matching_filter_rule['min_length'] > route_network.prefixlen: + # Drop route objects which do not satisfy min_length requirement of matching filter rule + f.write('# FAILED minimum prefix length requirement exceeded: ' + str(route_object) + ' against filter rule: ' + str(matching_filter_rule) + '\n') + continue # Figure out max-length (filter rule wins over route object) if 'max-length' in route_object.keys(): allowed_max_len = min(int(matching_filter_rule['max_length']), int(route_object['max-length']))