misakanet-config/util/util.conf

37 lines
1.1 KiB
Plaintext
Raw Normal View History

2022-12-26 15:41:18 +00:00
function pub_is_invalid_net_length(){
case net.type {
NET_IP4: return net.len > 24;
NET_IP6: return net.len > 48;
else: print "pub_is_valid_net_length: unexpected net.type ", net.type, " ", net; return false;
}
}
function is_bogon_prefix() {
case net.type {
NET_IP4: return net ~ BOGON_PREFIXES_V4;
NET_IP6: return net ~ BOGON_PREFIXES_V6;
else: print "is_bogon_prefix: unexpected net.type ", net.type, " ", net; return false;
}
}
function is_bogon_asn() {
if bgp_path ~ BOGON_ASNS then return true;
return false;
}
function is_downstream_asn() {
if bgp_path.last ~ DOWNSTREAM_ASN then return true;
return false;
}
function is_valid() {
2023-03-01 18:05:31 +00:00
if pub_is_invalid_net_length() then return false;
2023-02-26 10:07:04 +00:00
if (LOCAL_ASN, 110, 30) ~ bgp_large_community then return true;
if bgp_path.len = 0 then return true;
2022-12-26 15:41:18 +00:00
if is_bogon_prefix() then return false;
if is_bogon_asn() then return false;
2022-12-26 17:17:37 +00:00
if is_rpki_invalid() && source = RTS_BGP then return false;
2022-12-28 03:31:37 +00:00
if net = ::/0 then return false;
2022-12-26 15:41:18 +00:00
return true;
}