-
Notifications
You must be signed in to change notification settings - Fork 48
Expand file tree
/
Copy pathirrdb.j2
More file actions
66 lines (61 loc) · 2.45 KB
/
irrdb.j2
File metadata and controls
66 lines (61 loc) · 2.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
{% from 'macros.j2' import write_prefix_list %}
# ---------------------------------------------------------
# IRRDB
{% if irrdb_info %}
{% for as_set_bundle_id in irrdb_info|sort %}
{% set as_set_bundle = irrdb_info[as_set_bundle_id] %}
# {{ as_set_bundle.descr }}, used_by {{ as_set_bundle.used_by|sort|join(", ") }}
{% if as_set_bundle.asns|length == 0 %}
# no origin ASNs found for {{ as_set_bundle.name }}
{% else %}
define AS_SET_{{ as_set_bundle.name }}_asns = [
{{ "\t" -}}
{% for asn in as_set_bundle.asns|sort %}
{{- asn -}}
{% if not loop.last %}, {% endif %}
{% if loop.index % 5 == 0 %}{{ "\n\t" }}{% endif %}
{% endfor %}
];
{% endif %}
{% for this_ip_ver in list_ip_vers %}
{% set this_ip_ver_prefixes = as_set_bundle.prefixes|selectattr("prefix", "is_ipver", this_ip_ver)|list %}
{% if this_ip_ver_prefixes|length == 0 %}
# no IPv{{ this_ip_ver }} prefixes found for {{ as_set_bundle.name }}
{% else %}
define AS_SET_{{ as_set_bundle.name }}_prefixes_{{ this_ip_ver }} = [
{{ write_prefix_list(this_ip_ver_prefixes, True) }}
];
{% endif %}
{% endfor %}
{% endfor %}
{% endif %}
{% if cfg.filtering.irrdb.use_arin_bulk_whois_data.enabled and arin_whois_records %}
# ARIN Whois database records
{% for origin_asn in arin_whois_records|sort %}
{% for this_ip_ver in list_ip_vers %}
{% set this_ip_ver_prefixes = arin_whois_records[origin_asn].prefixes|selectattr("prefix", "is_ipver", this_ip_ver)|list %}
{% if this_ip_ver_prefixes|length == 0 %}
# no IPv{{ this_ip_ver }} prefixes found in the ARIN Whois database for AS{{ origin_asn }}
{% else %}
define ARIN_Whois_db_{{ origin_asn }}_{{ this_ip_ver }} = [
{{ write_prefix_list(this_ip_ver_prefixes, True) }}
];
{% endif %}
{% endfor %}
{% endfor %}
{% endif %}
{% if cfg.filtering.irrdb.use_registrobr_bulk_whois_data.enabled and registrobr_whois_records %}
# Registro.br Whois database records
{% for origin_asn in registrobr_whois_records|sort %}
{% for this_ip_ver in list_ip_vers %}
{% set this_ip_ver_prefixes = registrobr_whois_records[origin_asn].prefixes|selectattr("prefix", "is_ipver", this_ip_ver)|list %}
{% if this_ip_ver_prefixes|length == 0 %}
# no IPv{{ this_ip_ver }} prefixes found in the Registro.br Whois database for AS{{ origin_asn }}
{% else %}
define RegistroBR_Whois_db_{{ origin_asn }}_{{ this_ip_ver }} = [
{{ write_prefix_list(this_ip_ver_prefixes, True) }}
];
{% endif %}
{% endfor %}
{% endfor %}
{% endif %}