35 lines
		
	
	
		
			980 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
		
			980 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
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;
 | 
						|
    if is_rpki_invalid() && source = RTS_BGP then return false;
 | 
						|
    if net = ::/0 then return false;
 | 
						|
    return true;
 | 
						|
}
 |