summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2017-11-29 11:54:27 -0500
committerDonald Sharp <sharpd@cumulusnetworks.com>2017-11-29 13:01:01 -0500
commit9fa38ec6bbd6d0755c4b0e5ca718ded97d8e2f79 (patch)
tree33f04169fcc86bdda71ccc21f9d28cc456206615
parent4a83e7a04a6eef80452633a517a2e9ce7839391b (diff)
zebra: Fix route replace flags
When doing a route replace, on openbsd we were not marking the old lsp as no longer installed, while on linux we were. Move the abstraction up a layer. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
-rw-r--r--zebra/zebra_mpls.c23
-rw-r--r--zebra/zebra_mpls_netlink.c17
2 files changed, 23 insertions, 17 deletions
diff --git a/zebra/zebra_mpls.c b/zebra/zebra_mpls.c
index 57d29050c9..4c6fb002dc 100644
--- a/zebra/zebra_mpls.c
+++ b/zebra/zebra_mpls.c
@@ -909,10 +909,33 @@ static wq_item_status lsp_process(struct work_queue *wq, void *data)
zvrf->lsp_removals++;
} else if (CHECK_FLAG(lsp->flags, LSP_FLAG_CHANGED)) {
+ zebra_nhlfe_t *nhlfe;
+ struct nexthop *nexthop;
UNSET_FLAG(lsp->flags, LSP_FLAG_CHANGED);
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);
+ }
+ }
+
kernel_upd_lsp(lsp);
zvrf->lsp_installs++;
diff --git a/zebra/zebra_mpls_netlink.c b/zebra/zebra_mpls_netlink.c
index 64b1a7c0ac..3c8d25189e 100644
--- a/zebra/zebra_mpls_netlink.c
+++ b/zebra/zebra_mpls_netlink.c
@@ -60,29 +60,12 @@ void kernel_add_lsp(zebra_lsp_t *lsp)
void kernel_upd_lsp(zebra_lsp_t *lsp)
{
int ret;
- zebra_nhlfe_t *nhlfe;
- struct nexthop *nexthop;
if (!lsp || !lsp->best_nhlfe) { // unexpected
kernel_lsp_pass_fail(lsp, SOUTHBOUND_INSTALL_FAILURE);
return;
}
- /* 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);
- }
- }
-
ret = netlink_mpls_multipath(RTM_NEWROUTE, lsp);
kernel_lsp_pass_fail(lsp,