summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRenato Westphal <renatowestphal@gmail.com>2016-09-28 12:25:18 -0300
committerDonald Sharp <sharpd@cumulusnetworks.com>2016-09-28 16:05:42 -0400
commitdaca38aecede78f3d4b1cc93ccd0623c250c4778 (patch)
treed67d3bc6f4d5f2b5e0db058553e0e0fcb23b5772
parent134970a2a183d5021a1de42e8eede2fc3aa32e56 (diff)
ldpd: always advertise labels upon receiving a redistributed route
Whenever a routing daemon advertises a new version of a route to zebra, zebra removes the old version of this route (implicit withdraw) and then create a new 'rib' structure for the new version of the route. In this process, the previously received label(s) from ldpd are lost. This is because upon receiving a ZEBRA_MPLS_LABELS_ADD message, zebra only adds a label to a nexthop of an existing route. And routes are volatile, they can be removed while being updated. To workaround this issue, this patch makes ldpd always advertise the appropriate labels whenever it receives a redistributed route, even if it was already received before (an older version). This way, when ldpd receives the updated version of a route, it will readvertise the appropriate label(s) and zebra will reinstall them. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
-rw-r--r--ldpd/lde_lib.c1
-rw-r--r--zebra/zebra_mpls.c6
2 files changed, 5 insertions, 2 deletions
diff --git a/ldpd/lde_lib.c b/ldpd/lde_lib.c
index c72a25985d..43e5f92f2f 100644
--- a/ldpd/lde_lib.c
+++ b/ldpd/lde_lib.c
@@ -336,6 +336,7 @@ lde_kernel_insert(struct fec *fec, int af, union ldpd_addr *nexthop,
fn = fec_add(fec);
fnh = fec_nh_find(fn, af, nexthop, priority);
if (fnh != NULL) {
+ lde_send_change_klabel(fn, fnh);
fnh->flags |= F_FEC_NH_NEW;
return;
}
diff --git a/zebra/zebra_mpls.c b/zebra/zebra_mpls.c
index 977c84d4dd..15e5c330e4 100644
--- a/zebra/zebra_mpls.c
+++ b/zebra/zebra_mpls.c
@@ -1311,10 +1311,12 @@ mpls_ftn_update (int add, struct zebra_vrf *zvrf, enum lsp_types_t type,
return -1;
found:
- if (add)
+ if (add && nexthop->nh_label_type == ZEBRA_LSP_NONE)
nexthop_add_labels (nexthop, type, 1, &out_label);
- else
+ else if (!add && nexthop->nh_label_type == type)
nexthop_del_labels (nexthop);
+ else
+ return 0;
SET_FLAG (rib->status, RIB_ENTRY_CHANGED);
SET_FLAG (rib->status, RIB_ENTRY_NEXTHOPS_CHANGED);