diff --git a/generate.py b/generate.py index 653403b..eb9a4dd 100755 --- a/generate.py +++ b/generate.py @@ -125,6 +125,10 @@ def create_roa_entries(route_objects, filter_rules, mode, f): allowed_max_len = min(int(matching_filter_rule['max_length']), int(route_object['max-length'])) else: allowed_max_len = int(matching_filter_rule['max_length']) + if allowed_max_len < route_network.prefixlen: + # Drop route objects which do not satisfy max_length requirement of matching filter rule + f.write('# FAILED maximum prefix length exceeded: ' + str(route_object) + ' against filter rule: ' + str(matching_filter_rule) + '\n') + continue # Create roa for every origin of this route for origin in route_object['origin']: # Make sure to strip "AS" prefix from AS value