diff --git a/lib/10-community-controller.conf b/lib/09-community-controller.conf similarity index 87% rename from lib/10-community-controller.conf rename to lib/09-community-controller.conf index 776eb35..286ef5e 100644 --- a/lib/10-community-controller.conf +++ b/lib/09-community-controller.conf @@ -4,4 +4,9 @@ function pub_route_controller_specific() { if REGION = 400 && (200536, 121, 500) ~ bgp_large_community && (200536, 122, 410) ~ bgp_large_community then bgp_local_pref = bgp_local_pref + 6; if REGION = 430 && (200536, 110, 10) ~ bgp_large_community && (200536, 121, 430) !~ bgp_large_community && ((200536, 121, 400) ~ bgp_large_community || (200536, 122, 400) ~ bgp_large_community) then bgp_local_pref = bgp_local_pref + 30; if REGION != 430 && (200536, 121, 430) ~ bgp_large_community then bgp_local_pref = bgp_local_pref + filter(bgp_large_community, [(LOCAL_ASN, 122, 430)]).len * 3; +} + +function pub_is_downstream_route() { + if delete(bgp_path, DOWNSTREAM_ASN).len != 0 then return false; + return true; } \ No newline at end of file diff --git a/lib/10-community-transit.conf b/lib/10-community-transit.conf index 76ff380..43d20ce 100644 --- a/lib/10-community-transit.conf +++ b/lib/10-community-transit.conf @@ -106,7 +106,7 @@ function transit_export_filter(int ASN) { pub_process_path(); if !is_valid() then return false; if bgp_large_community ~ [(LOCAL_ASN, 110, 0), (LOCAL_ASN, 110, 10)] then return false; - if bgp_path.last !~ DOWNSTREAM_ASN && source = RTS_BGP then { + if !pub_is_downstream_route() && source = RTS_BGP then { print "transit exporter: for ", net, " ASN ", bgp_path.last; return false; } diff --git a/lib/20-community-peer.conf b/lib/20-community-peer.conf index 51d91a5..30f2d2a 100644 --- a/lib/20-community-peer.conf +++ b/lib/20-community-peer.conf @@ -1,9 +1,7 @@ function is_peer_route() { if (LOCAL_ASN, 110, 0) ~ bgp_large_community then return false; if (LOCAL_ASN, 110, 10) ~ bgp_large_community then return false; - if bgp_path ~ [ 7018, 3320, 3257, 6830, 3356, 2914, 5511, 3491, 1239, 6453, 6762, 1299, 12956, 701, 6461, 174, 6939] then { - return false; - } + if !pub_is_downstream_route() then return false; return true; } diff --git a/protocol/external_network.conf b/protocol/external_network.conf index e1d1d5e..bf084fb 100644 --- a/protocol/external_network.conf +++ b/protocol/external_network.conf @@ -1,8 +1,6 @@ template bgp pub_transit { local as LOCAL_ASN; - allow local as 1; - ipv6 { import where transit_import_filter(6939); export where transit_export_filter(6939);