From 0d1a650fa5a71f9f6582d9e1480fbcbd1a42382d Mon Sep 17 00:00:00 2001 From: daxi20 Date: Fri, 12 Jun 2026 18:11:53 +0800 Subject: [PATCH] 0. --- bird/function/inet_community.conf | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/bird/function/inet_community.conf b/bird/function/inet_community.conf index 0579e68..0df3b07 100644 --- a/bird/function/inet_community.conf +++ b/bird/function/inet_community.conf @@ -1,4 +1,4 @@ -# 社区属性转换与本地优先级修正函数(Local Pref 200封顶版) +# 社区属性转换与本地优先级修正函数(BIRD 2.18 纯净稳定版) function function_inet_community_make(){ # 1. 从上游收到的路由 => 赋予兜底优先级 (Local Pref = 100) if bgp_large_community ~ [(LOCAL_ASN, 10100, 0)] then { @@ -26,9 +26,11 @@ function function_inet_community_make(){ # 4. 下游客户发来的路由 => 赋予高优先级 (Local Pref = 180) if bgp_large_community ~ [(LOCAL_ASN, 10100, 4)] then { bgp_local_pref = 180; - bgp_large_community.add([ - (LOCAL_ASN, 2, 1), (LOCAL_ASN, 2, 2), (LOCAL_ASN, 2, 3), (LOCAL_ASN, 2, 4) - ]); + # 修复:BIRD 的 add 不支持中括号批量加,必须拆开单次调用 + bgp_large_community.add((LOCAL_ASN, 2, 1)); + bgp_large_community.add((LOCAL_ASN, 2, 2)); + bgp_large_community.add((LOCAL_ASN, 2, 3)); + bgp_large_community.add((LOCAL_ASN, 2, 4)); bgp_large_community.delete((LOCAL_ASN, 10100, 4)); return true; } @@ -36,7 +38,12 @@ function function_inet_community_make(){ # 5. 自身宣告的前缀 => 赋予最高级封顶 (Local Pref = 200) if bgp_large_community ~ [(LOCAL_ASN, 200, 0)] then { bgp_local_pref = 200; - bgp_large_community.add([(LOCAL_ASN, 2, 0..4)]); + # 修复:拆开单独 add + bgp_large_community.add((LOCAL_ASN, 2, 0)); + bgp_large_community.add((LOCAL_ASN, 2, 1)); + bgp_large_community.add((LOCAL_ASN, 2, 2)); + bgp_large_community.add((LOCAL_ASN, 2, 3)); + bgp_large_community.add((LOCAL_ASN, 2, 4)); bgp_large_community.delete((LOCAL_ASN, 200, 0)); return true; } @@ -44,7 +51,6 @@ function function_inet_community_make(){ return false; } - # 社区安全检查/清理(全量通配版) function function_inet_bgp_community_clear(){ # 使用 [ (ASN, Data1, *) ] 语法,直接清空该分类下的所有子标记