0
0
Fork 0

Implement min_length filter requirements, improve error reporting

This commit is contained in:
Jan Philipp Timme 2019-06-02 19:59:48 +02:00
parent 725874d163
commit 3b64d0d363
1 changed files with 5 additions and 4 deletions

View File

@ -113,12 +113,13 @@ def create_roa_entries(route_objects, filter_rules, mode, f):
# Now check if it permits or denies # Now check if it permits or denies
if matching_filter_rule['route_allowed'] == False: if matching_filter_rule['route_allowed'] == False:
# Skip non-permitted routes # Skip non-permitted routes
f.write('# route object not permitted: ' + str(route_network) + "\n") f.write('# DENIED' + str(route_object) + ' by filter rule: ' + str(matching_filter_rule) + '\n')
f.write('# route object was denied by filter rule: ' + str(matching_filter_rule) + "\n")
continue continue
# Check if min-length fits filter requirements # 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) # Figure out max-length (filter rule wins over route object)
if 'max-length' in route_object.keys(): if 'max-length' in route_object.keys():
allowed_max_len = min(int(matching_filter_rule['max_length']), int(route_object['max-length'])) allowed_max_len = min(int(matching_filter_rule['max_length']), int(route_object['max-length']))