]>
git.proxmox.com Git - mirror_frr.git/blob - zebra/zebra_mpls_netlink.c
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /* MPLS forwarding table updates using netlink over GNU/Linux system.
3 * Copyright (C) 2016 Cumulus Networks, Inc.
10 #include "zebra/debug.h"
12 #include "zebra/rt_netlink.h"
13 #include "zebra/zebra_mpls.h"
14 #include "zebra/kernel_netlink.h"
16 ssize_t
netlink_lsp_msg_encoder(struct zebra_dplane_ctx
*ctx
, void *buf
,
21 /* Call to netlink layer based on type of update */
22 if (dplane_ctx_get_op(ctx
) == DPLANE_OP_LSP_DELETE
) {
24 } else if (dplane_ctx_get_op(ctx
) == DPLANE_OP_LSP_INSTALL
||
25 dplane_ctx_get_op(ctx
) == DPLANE_OP_LSP_UPDATE
) {
28 if (dplane_ctx_get_best_nhlfe(ctx
) == NULL
) {
29 if (IS_ZEBRA_DEBUG_KERNEL
|| IS_ZEBRA_DEBUG_MPLS
)
30 zlog_debug("LSP in-label %u: update fails, no best NHLFE",
31 dplane_ctx_get_in_label(ctx
));
40 return netlink_mpls_multipath_msg_encode(cmd
, ctx
, buf
, buflen
);
43 enum netlink_msg_status
netlink_put_lsp_update_msg(struct nl_batch
*bth
,
44 struct zebra_dplane_ctx
*ctx
)
46 return netlink_batch_add_msg(bth
, ctx
, netlink_lsp_msg_encoder
, false);
50 * Pseudowire update api - not supported by netlink as of 12/18,
51 * but note that the default has been to report 'success' for pw updates
52 * on unsupported platforms.
54 enum netlink_msg_status
netlink_put_pw_update_msg(struct nl_batch
*bth
,
55 struct zebra_dplane_ctx
*ctx
)
57 return FRR_NETLINK_SUCCESS
;
60 int mpls_kernel_init(void)
65 * Check if the MPLS module is loaded in the kernel.
67 if (stat("/proc/sys/net/mpls", &st
) != 0)
73 #endif /* HAVE_NETLINK */