From b6f60ce633aa8585dca0ee2f78f9aae44365602e Mon Sep 17 00:00:00 2001 From: uvok cheetah Date: Sun, 21 Apr 2024 17:16:11 +0200 Subject: bgp: Add cleanet functions file --- roles/uvok_bird/files/clear_functions.conf | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 roles/uvok_bird/files/clear_functions.conf diff --git a/roles/uvok_bird/files/clear_functions.conf b/roles/uvok_bird/files/clear_functions.conf new file mode 100644 index 0000000..f9e3c10 --- /dev/null +++ b/roles/uvok_bird/files/clear_functions.conf @@ -0,0 +1,26 @@ +# managed by Ansible + +function clean_own_communities() { + bgp_large_community.delete([(CLEARNET_ASN, *, *)]); +} + +function clearnet_import_ixp() { + clean_own_communities(); + bgp_large_community.add((CLEARNET_ASN, LC_INFO, INFO_IXP_RS)); +} + +function clearnet_import_transit() { + clean_own_communities(); + bgp_large_community.add((CLEARNET_ASN, LC_INFO, INFO_TRANSIT)); +} + +function clearnet_is_ixp() { + if (CLEARNET_ASN, LC_INFO, INFO_IXP_RS) ~ bgp_large_community then { + return true; + } + return false; +} + +function clearnet_add_filter(int filter_reason) { + bgp_large_community.add((CLEARNET_ASN, LC_FILTERED, filter_reason)); +} -- cgit v1.2.3