summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormitesh <mitesh@cumulusnetworks.com>2018-02-09 21:54:00 -0800
committermitesh <mitesh@cumulusnetworks.com>2018-02-09 21:54:00 -0800
commit7fdaec88941d66d831363d32084cc88c5b98ac6c (patch)
tree12f9bdbbbcab2b107786501063451fd40eff163a
parent12eeac84ff34bd153f6d75f80aac1fa42c3f7db3 (diff)
bgpd: update the VNI labels in type-2 routes when l3vni gets deleted
When an l3-vni is enabled, type-2 routes are sent with 2 labels (l2vni and l3vni). When it gets deleted, we need to update type-2 routes and send them with only one label (l2vni). Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
-rw-r--r--bgpd/bgp_evpn.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c
index a50e3707ad..9b1ff8f6a9 100644
--- a/bgpd/bgp_evpn.c
+++ b/bgpd/bgp_evpn.c
@@ -1209,6 +1209,23 @@ static int update_evpn_route_entry(struct bgp *bgp, struct bgpevpn *vpn,
&& !CHECK_FLAG(tmp_ri->flags, BGP_INFO_REMOVED))
route_change = 0;
else {
+ /*
+ * The attributes have changed, type-2 routes needs to
+ * be advertised with right labels.
+ */
+ vni2label(vpn->vni, &label[0]);
+ if (evp->prefix.route_type == BGP_EVPN_MAC_IP_ROUTE) {
+ vni_t l3vni;
+
+ l3vni = bgpevpn_get_l3vni(vpn);
+ if (l3vni) {
+ vni2label(l3vni, &label[1]);
+ num_labels++;
+ }
+ }
+ memcpy(&tmp_ri->extra->label, label, sizeof(label));
+ tmp_ri->extra->num_labels = num_labels;
+
/* The attribute has changed. */
/* Add (or update) attribute to hash. */
attr_new = bgp_attr_intern(attr);