summaryrefslogtreecommitdiffstats
path: root/zebra/zebra_mpls_netlink.c
diff options
context:
space:
mode:
authorMark Stapp <mjs@voltanet.io>2018-11-15 15:11:01 +0100
committerMark Stapp <mjs@voltanet.io>2019-01-22 19:56:48 +0100
commitd37f4d6c61c21eb2973b7865d7ed5a6f74d92449 (patch)
treee9fd58a0ef39cf06e7e31139fdbbcd1901ef3f46 /zebra/zebra_mpls_netlink.c
parentzebra: infra for LSP updates using dplane (diff)
downloadfrr-d37f4d6c61c21eb2973b7865d7ed5a6f74d92449.tar.xz
frr-d37f4d6c61c21eb2973b7865d7ed5a6f74d92449.zip
zebra: move LSP updates into dataplane subsystem
Start performing LSP updates through the async dataplane subsystem. This is plumbed through for linux/netlink. Signed-off-by: Mark Stapp <mjs@voltanet.io>
Diffstat (limited to 'zebra/zebra_mpls_netlink.c')
-rw-r--r--zebra/zebra_mpls_netlink.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/zebra/zebra_mpls_netlink.c b/zebra/zebra_mpls_netlink.c
index 2a21f8686..63f518ffc 100644
--- a/zebra/zebra_mpls_netlink.c
+++ b/zebra/zebra_mpls_netlink.c
@@ -22,6 +22,7 @@
#ifdef HAVE_NETLINK
+#include "zebra/debug.h"
#include "zebra/rt.h"
#include "zebra/rt_netlink.h"
#include "zebra/zebra_mpls.h"
@@ -98,9 +99,38 @@ enum zebra_dplane_result kernel_del_lsp(zebra_lsp_t *lsp)
return ZEBRA_DPLANE_REQUEST_SUCCESS;
}
+/*
+ * LSP forwarding update using dataplane context information.
+ */
enum zebra_dplane_result kernel_lsp_update(struct zebra_dplane_ctx *ctx)
{
- return ZEBRA_DPLANE_REQUEST_FAILURE;
+ int cmd, ret = -1;
+
+ /* Call to netlink layer based on type of update */
+ if (dplane_ctx_get_op(ctx) == DPLANE_OP_LSP_DELETE) {
+ cmd = RTM_DELROUTE;
+ } else if (dplane_ctx_get_op(ctx) == DPLANE_OP_LSP_INSTALL ||
+ dplane_ctx_get_op(ctx) == DPLANE_OP_LSP_UPDATE) {
+
+ /* Validate */
+ if (dplane_ctx_get_best_nhlfe(ctx) == NULL) {
+ if (IS_ZEBRA_DEBUG_KERNEL || IS_ZEBRA_DEBUG_MPLS)
+ zlog_debug("LSP in-label %u: update fails, no best NHLFE",
+ dplane_ctx_get_in_label(ctx));
+ goto done;
+ }
+
+ cmd = RTM_NEWROUTE;
+ } else
+ /* Invalid op? */
+ goto done;
+
+ ret = netlink_mpls_multipath_ctx(cmd, ctx);
+
+done:
+
+ return (ret == 0 ?
+ ZEBRA_DPLANE_REQUEST_SUCCESS : ZEBRA_DPLANE_REQUEST_FAILURE);
}
int mpls_kernel_init(void)