blade-router: tweak export filter to drop local communities

This commit is contained in:
Luke Granger-Brown 2022-08-17 02:30:09 +01:00
parent a8bb05ba1e
commit 27eb5b251e
2 changed files with 18 additions and 6 deletions

View file

@ -30,6 +30,18 @@ let
bgp_local_pref = ${toString ix.remote.bgp_local_pref}; bgp_local_pref = ${toString ix.remote.bgp_local_pref};
accept; accept;
} }
filter bgp_export_${ixName}4
{
if ! ((ro, ${toString ix.local.asn}, 1000) ~ bgp_ext_community) then reject;
bgp_ext_community.delete([(ro, ${toString ix.local.asn}, *)]);
accept;
}
filter bgp_export_${ixName}6
{
if ! ((ro, ${toString ix.local.asn}, 1000) ~ bgp_ext_community) then reject;
bgp_ext_community.delete([(ro, ${toString ix.local.asn}, *)]);
accept;
}
protocol pipe ${ixName}pipe_4 { protocol pipe ${ixName}pipe_4 {
table ${ixName}4; table ${ixName}4;
peer table master4; peer table master4;
@ -61,7 +73,7 @@ let
ipv4 { ipv4 {
table ${ixName}4; table ${ixName}4;
import all; import all;
export ${if ix.remote.is_route_collector then "all" else "where ((ro, ${toString ix.local.asn}, 1000) ~ bgp_ext_community)"}; export ${if ix.remote.is_route_collector then "all" else "filter bgp_export_${ixName}4"};
${prefixLimitSnippet ix.remote.prefix_limit.v4} ${prefixLimitSnippet ix.remote.prefix_limit.v4}
}; };
}; };
@ -77,7 +89,7 @@ let
ipv6 { ipv6 {
table ${ixName}6; table ${ixName}6;
import all; import all;
export ${if ix.remote.is_route_collector then "all" else "where ((ro, ${toString ix.local.asn}, 1000) ~ bgp_ext_community)"}; export ${if ix.remote.is_route_collector then "all" else "filter bgp_export_${ixName}6"};
${prefixLimitSnippet ix.remote.prefix_limit.v6} ${prefixLimitSnippet ix.remote.prefix_limit.v6}
}; };
}; };

View file

@ -349,10 +349,10 @@ in
v4 = "195.66.225.6"; v4 = "195.66.225.6";
v6 = "2001:7f8:4::3f94:2"; v6 = "2001:7f8:4::3f94:2";
}]; }];
}]; bgp_local_pref = 120;
bgp_local_pref = 120; prefix_limit.v4 = 1000;
prefix_limit.v4 = 1000; prefix_limit.v6 = 200;
prefix_limit.v6 = 200; };
}; };
export.v4 = [ "92.118.28.0/24" ]; export.v4 = [ "92.118.28.0/24" ];
export.v6 = [ "2a09:a441::/32" ]; export.v6 = [ "2a09:a441::/32" ];