From da053bc212dc7d6356bff09a955dbf71c62e3689 Mon Sep 17 00:00:00 2001 From: 186526 Date: Tue, 27 Dec 2022 01:01:37 +0800 Subject: [PATCH] Fix: error in 10-community-transit.conf --- lib/10-community-transit.conf | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/lib/10-community-transit.conf b/lib/10-community-transit.conf index 577f150..0e9d611 100644 --- a/lib/10-community-transit.conf +++ b/lib/10-community-transit.conf @@ -1,21 +1,20 @@ -function pub_add_communities(int ASN, int type) { - +function pub_add_communities(int ASN; int PeerType) { # DIRECT PEER - if (type=0) then { + if (PeerType=0) then { bgp_large_community.add((LOCAL_ASN, 110, 0)); bgp_large_community.add((LOCAL_ASN, 110, 2)); # PEER via IX - } else if (type=1) then { + } else if (PeerType=1) then { bgp_large_community.add((LOCAL_ASN, 110, 0)); bgp_large_community.add((LOCAL_ASN, 110, 1)); -j + # UPSTREAM - }else if (type=10) then { + }else if (PeerType=10) then { bgp_large_community.add((LOCAL_ASN, 110, 10)); # DOWNSTREAM - } else if (type=20) then { + } else if (PeerType=20) then { bgp_large_community.add((LOCAL_ASN, 110, 20)); } @@ -44,7 +43,7 @@ function pub_preprocess_communities() { # Finished (LOCAL_ASN, 115, *); } -function pub_process_communities(int ASN, int type) { +function pub_process_communities(int ASN; int PeerType) { if (LOCAL_ASN, 125, POP) ~ bgp_large_community then { bgp_community.add((65535, 65282)); @@ -58,18 +57,18 @@ function pub_process_communities(int ASN, int type) { if (65535, 65282) ~ bgp_community then return false; if (65535, 65283) ~ bgp_community then return false; - if (LOCAL_ASN, 2, ASN) ~ bgp_large_community then reject + if (LOCAL_ASN, 2, ASN) ~ bgp_large_community then return false; # PEER - if (type<10) then { + if (PeerType<10) then { if (LOCAL_ASN, 1, 1) ~ bgp_large_community then return false; # UPSTREAM - } else if (type=10) then { + } else if (PeerType=10) then { if (LOCAL_ASN, 1, 0) ~ bgp_large_community then return false; # DOWNSTREAM - } else if (type=20) then { + } else if (PeerType=20) then { if (LOCAL_ASN, 1, 2) ~ bgp_large_community then return false; }