fix prepend

production
186526 2023-02-26 15:58:52 +08:00
parent 43e705ec07
commit afebf9110b
2 changed files with 11 additions and 8 deletions

View File

@ -78,17 +78,19 @@ function pub_process_communities(int ASN; int PeerType) {
function pub_process_path() { function pub_process_path() {
# Delete Self eBGP Confed Path. # Delete Self eBGP Confed Path.
bgp_path.delete([4200000000..4225479999]); bgp_path.delete([4200000000..4225479999]);
# Route is via or locate Europe & Africa & Middle East
if bgp_large_community ~ [(LOCAL_ASN, 122, 100), (LOCAL_ASN, 122, 300..310), (LOCAL_ASN, 122, 600), (LOCAL_ASN, 121, 100), (LOCAL_ASN, 121, 300..310), (LOCAL_ASN, 121, 600)] then bgp_path.prepend(LOCAL_ASN);
# Route is via or locate America
if bgp_large_community ~ [(LOCAL_ASN, 122, 200..299), (LOCAL_ASN, 121, 200..299)] then bgp_path.prepend(LOCAL_ASN);
# Route is via or locate East Asia & Oceania
if bgp_large_community ~ [(LOCAL_ASN, 122, 400..500), (LOCAL_ASN, 121, 200..299)] then bgp_path.prepend(LOCAL_ASN);
# Self PoP # Self PoP
if (LOCAL_ASN, 120, POP) ~ bgp_large_community then { if (LOCAL_ASN, 120, POP) ~ bgp_large_community then {
bgp_path.delete(LOCAL_ASN); # Nothing here.
bgp_path.prepend(LOCAL_ASN); } else {
# Route is via or locate Europe & Africa & Middle East
if bgp_large_community ~ [(LOCAL_ASN, 122, 100), (LOCAL_ASN, 122, 300..310), (LOCAL_ASN, 122, 600), (LOCAL_ASN, 121, 100), (LOCAL_ASN, 121, 300..310), (LOCAL_ASN, 121, 600)] then bgp_path.prepend(LOCAL_ASN);
# Route is via or locate America
if bgp_large_community ~ [(LOCAL_ASN, 122, 200..299), (LOCAL_ASN, 121, 200..299)] then bgp_path.prepend(LOCAL_ASN);
# Route is via or locate East Asia & Oceania
if bgp_large_community ~ [(LOCAL_ASN, 122, 400..500), (LOCAL_ASN, 121, 400..500)] then bgp_path.prepend(LOCAL_ASN);
} }
pub_preprocess_communities(); pub_preprocess_communities();
} }

View File

@ -25,6 +25,7 @@ function is_downstream_asn() {
} }
function is_valid() { function is_valid() {
if (LOCAL_ASN, 0, 665) ~ bgp_large_community then return true;
if pub_is_invalid_net_length() then return false; if pub_is_invalid_net_length() then return false;
if is_bogon_prefix() then return false; if is_bogon_prefix() then return false;
if is_bogon_asn() then return false; if is_bogon_asn() then return false;