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() {
|
|
|
|
if pub_is_invalid_net_length() then return false;
|
|
|
|
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;
|
|
|
|
}
|