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>
This commit is contained in:
Renato Westphal 2016-09-28 12:25:18 -03:00 committed by Donald Sharp
parent 134970a2a1
commit daca38aece
2 changed files with 5 additions and 2 deletions

View File

@ -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;
}

View File

@ -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);