Add: complete the filter of internal network and downstream
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2022-12-27 15:31:54 +08:00
parent fdc14ca1cc
commit db8827f83e
7 changed files with 54 additions and 48 deletions

View File

@ -22,8 +22,9 @@ function pub_add_communities(int ASN; int PeerType) {
if (LOCAL_ASN, 120, POP) ~ bgp_large_community then bgp_large_community.add((LOCAL_ASN, 120, POP));
if (LOCAL_ASN, 121, REGION) ~ bgp_large_community then bgp_large_community.add((LOCAL_ASN, 121, REGION));
# Finished (LOCAL_ASN, 120~130, *);
return true;
}
function pub_preprocess_communities() {
@ -41,18 +42,10 @@ function pub_preprocess_communities() {
bgp_path.prepend(bgp_path.last);
}
# Finished (LOCAL_ASN, 115, *);
return true;
}
function pub_process_communities(int ASN; int PeerType) {
if (LOCAL_ASN, 125, POP) ~ bgp_large_community then {
bgp_community.add((65535, 65282));
}
if (LOCAL_ASN, 126, REGION) ~ bgp_large_community then {
bgp_community.add((65535, 65283));
}
if (65535, 65281) ~ bgp_community then return false;
if (65535, 65282) ~ bgp_community then return false;
if (65535, 65283) ~ bgp_community then return false;
@ -71,7 +64,7 @@ function pub_process_communities(int ASN; int PeerType) {
} else if (PeerType=20) then {
if (LOCAL_ASN, 1, 2) ~ bgp_large_community then return false;
}
return true;
}
function transit_import_filter(int ASN) {
@ -85,7 +78,7 @@ function transit_export_filter(int ASN) {
# Delete Self eBGP Confed Path.
bgp_path.delete([4200000000..4225479999]);
if !is_valid() then return false;
pub_process_communities(ASN, 10);
if bgp_path.last !~ DOWNSTREAM_ASN && source = RTS_BGP then return false;
return true;
if pub_process_communities(ASN, 10) then return true;
else return false;
}