2018-09-22 10:51:14 +00:00
|
|
|
function is_self_net() {
|
|
|
|
return net ~ [172.20.170.192/27+];
|
|
|
|
}
|
|
|
|
|
|
|
|
function is_valid_network() {
|
|
|
|
return net ~ [
|
|
|
|
172.20.0.0/14{21,29}, # dn42
|
|
|
|
172.20.0.0/24{28,32}, # dn42 Anycast
|
|
|
|
172.21.0.0/24{28,32}, # dn42 Anycast
|
|
|
|
172.22.0.0/24{28,32}, # dn42 Anycast
|
|
|
|
172.23.0.0/24{28,32}, # dn42 Anycast
|
|
|
|
172.31.0.0/16+, # ChaosVPN
|
|
|
|
10.100.0.0/14+, # ChaosVPN
|
|
|
|
10.0.0.0/8{15,24} # Freifunk.net
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
2018-10-13 18:28:29 +00:00
|
|
|
roa table dn42_roa {
|
|
|
|
include "/var/lib/bird/bird_roa_dn42.conf";
|
|
|
|
};
|
|
|
|
|
|
|
|
function check_roa() {
|
2018-10-13 18:49:35 +00:00
|
|
|
if (roa_check(dn42_roa, net, bgp_path.last) = ROA_INVALID) then {
|
2018-10-13 18:28:29 +00:00
|
|
|
print "[dn42] ROA check failed for ", net, " ASN ", bgp_path.last;
|
|
|
|
return false;
|
|
|
|
}
|
2018-10-13 18:49:35 +00:00
|
|
|
return true;
|
2018-10-13 18:28:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function import_filter_networks() {
|
|
|
|
if is_valid_network() && !is_self_net() then {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
function dnpeers_import_policy() {
|
2018-10-13 18:49:35 +00:00
|
|
|
if(!check_roa()) then return false;
|
|
|
|
if(!import_filter_networks()) then return false:
|
2018-10-13 18:28:29 +00:00
|
|
|
}
|