summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoruvok cheetah2024-04-21 17:16:11 +0200
committeruvok cheetah2024-04-21 17:16:11 +0200
commitb6f60ce633aa8585dca0ee2f78f9aae44365602e (patch)
treeccc6ea3d7555959d6b08ebfb3a42b4bdd49bb53c
parentc02e624bfee6279241317da3dd863815d49a5506 (diff)
bgp: Add cleanet functions file
-rw-r--r--roles/uvok_bird/files/clear_functions.conf26
1 files changed, 26 insertions, 0 deletions
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));
+}