summaryrefslogtreecommitdiff
path: root/zebra/zebra_mpls_netlink.c
diff options
context:
space:
mode:
Diffstat (limited to 'zebra/zebra_mpls_netlink.c')
-rw-r--r--zebra/zebra_mpls_netlink.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/zebra/zebra_mpls_netlink.c b/zebra/zebra_mpls_netlink.c
index 8b8d018d03..887c685498 100644
--- a/zebra/zebra_mpls_netlink.c
+++ b/zebra/zebra_mpls_netlink.c
@@ -58,17 +58,29 @@ int kernel_add_lsp(zebra_lsp_t *lsp)
int kernel_upd_lsp(zebra_lsp_t *lsp)
{
int ret;
+ zebra_nhlfe_t *nhlfe;
+ struct nexthop *nexthop;
if (!lsp || !lsp->best_nhlfe) // unexpected
return -1;
UNSET_FLAG(lsp->flags, LSP_FLAG_CHANGED);
- /* First issue a DEL and clear the installed flag. */
- netlink_mpls_multipath(RTM_DELROUTE, lsp);
- UNSET_FLAG(lsp->flags, LSP_FLAG_INSTALLED);
+ /* Any NHLFE that was installed but is not selected now needs to
+ * have its flags updated.
+ */
+ for (nhlfe = lsp->nhlfe_list; nhlfe; nhlfe = nhlfe->next) {
+ nexthop = nhlfe->nexthop;
+ if (!nexthop)
+ continue;
+
+ if (CHECK_FLAG(nhlfe->flags, NHLFE_FLAG_INSTALLED) &&
+ !CHECK_FLAG(nhlfe->flags, NHLFE_FLAG_SELECTED)) {
+ UNSET_FLAG(nhlfe->flags, NHLFE_FLAG_INSTALLED);
+ UNSET_FLAG(nexthop->flags, NEXTHOP_FLAG_FIB);
+ }
+ }
- /* Then issue an ADD. */
ret = netlink_mpls_multipath(RTM_NEWROUTE, lsp);
if (!ret)
SET_FLAG(lsp->flags, LSP_FLAG_INSTALLED);