Implement min_length filter requirements, improve error reporting
This commit is contained in:
parent
725874d163
commit
3b64d0d363
|
@ -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']))
|
||||
|
|
Loading…
Reference in New Issue