summaryrefslogtreecommitdiff
path: root/bgpd/bgp_attr_evpn.c
diff options
context:
space:
mode:
authorMitesh Kanjariya <mitesh@marvel-07.cumulusnetworks.com>2017-11-13 03:19:52 -0800
committermitesh <mitesh@cumulusnetworks.com>2018-01-23 15:58:53 -0800
commitead40654de7260c0b66061a41da1aac0c4febef7 (patch)
treebc3b3dc51547fbd8b9081def24a85b8b87e517d0 /bgpd/bgp_attr_evpn.c
parentd6fed381094ba34c04166b08cd16af01f6c263ea (diff)
bgpd/zebra/lib: Add Default Gateway extended community
1. Added default gw extended community 2. code modification to handle sticky-mac/default-gw-mac as they go together 3. show command support for newly added extended community 4. State in zebra to reflect if a mac/neigh is default gateway 5. show command enhancement to refelect the same in zebra commands Ticket: CM-17428 Review: CCR-6580 Testing: Manual Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
Diffstat (limited to 'bgpd/bgp_attr_evpn.c')
-rw-r--r--bgpd/bgp_attr_evpn.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/bgpd/bgp_attr_evpn.c b/bgpd/bgp_attr_evpn.c
index eaa4e329d4..e74fa5a2be 100644
--- a/bgpd/bgp_attr_evpn.c
+++ b/bgpd/bgp_attr_evpn.c
@@ -135,6 +135,36 @@ void bgp_attr_rmac(struct attr *attr,
}
/*
+ * return true if attr contains default gw extended community
+ */
+uint8_t bgp_attr_default_gw(struct attr *attr)
+{
+ struct ecommunity *ecom;
+ int i;
+
+ ecom = attr->ecommunity;
+ if (!ecom || !ecom->size)
+ return 0;
+
+ /* If there is a default gw extendd community return true otherwise
+ * return 0 */
+ for (i = 0; i < ecom->size; i++) {
+ u_char *pnt;
+ u_char type, sub_type;
+
+ pnt = (ecom->val + (i * ECOMMUNITY_SIZE));
+ type = *pnt++;
+ sub_type = *pnt++;
+
+ if ((type == ECOMMUNITY_ENCODE_OPAQUE
+ && sub_type == ECOMMUNITY_EVPN_SUBTYPE_DEF_GW))
+ return 1;
+ }
+
+ return 0;
+}
+
+/*
* Fetch and return the sequence number from MAC Mobility extended
* community, if present, else 0.
*/