summaryrefslogtreecommitdiff
path: root/bgpd/bgp_ecommunity.c
diff options
context:
space:
mode:
authorTrey Aspelund <taspelund@nvidia.com>2023-05-08 02:51:28 +0000
committerTrey Aspelund <taspelund@nvidia.com>2023-05-30 15:20:35 +0000
commit65cdb9ce9ba7141b47796692ff870eddc531656b (patch)
tree577d311b3bf3758a9847acc726a907f57e86f093 /bgpd/bgp_ecommunity.c
parent5d5d12677711374e0a2e644fd7971a85d44fdb04 (diff)
bgpd: Add MAC-VRF Site-of-Origin support
Initial support for configuring an SoO for all MAC-VRFs (EVIs/L2VNIs). This provides a topology-independent method of preventing EVPN routes from one MAC-VRF "site" (an L2 domain) from being imported by other PEs in the same MAC-VRF "site", similar to how SoO is traditionally used in L3VPN to identify and break loops for an L3/IP-VRF "site". One example of where a MAC-VRF SoO can be used to avoid an L2 control plane loop is with Active/Active MLAG VTEPs. For a given L2 site only one control plane should be active. SoO can be used to ID/ignore entries originated from the local MAC-VRF site so that EVPN will not attempt to manage entries that are already handled by MLAG. Signed-off-by: Trey Aspelund <taspelund@nvidia.com>
Diffstat (limited to 'bgpd/bgp_ecommunity.c')
-rw-r--r--bgpd/bgp_ecommunity.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/bgpd/bgp_ecommunity.c b/bgpd/bgp_ecommunity.c
index a555930137..29b2250747 100644
--- a/bgpd/bgp_ecommunity.c
+++ b/bgpd/bgp_ecommunity.c
@@ -1765,3 +1765,18 @@ struct ecommunity *ecommunity_replace_linkbw(as_t as, struct ecommunity *ecom,
return new;
}
+
+bool soo_in_ecom(struct ecommunity *ecom, struct ecommunity *soo)
+{
+ if (ecom && soo) {
+ if ((ecommunity_lookup(ecom, ECOMMUNITY_ENCODE_AS,
+ ECOMMUNITY_SITE_ORIGIN) ||
+ ecommunity_lookup(ecom, ECOMMUNITY_ENCODE_AS4,
+ ECOMMUNITY_SITE_ORIGIN) ||
+ ecommunity_lookup(ecom, ECOMMUNITY_ENCODE_IP,
+ ECOMMUNITY_SITE_ORIGIN)) &&
+ ecommunity_include(ecom, soo))
+ return true;
+ }
+ return false;
+}