diff options
author | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-11-29 14:53:33 +0100 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-11-29 19:01:00 +0100 |
commit | 4a83e7a04a6eef80452633a517a2e9ce7839391b (patch) | |
tree | 9ed0c8f7fd512958fc69f47459de1b4723acc635 /zebra/zebra_mpls_netlink.c | |
parent | zebra: Implement call back for route install/delete success/fail (diff) | |
download | frr-4a83e7a04a6eef80452633a517a2e9ce7839391b.tar.xz frr-4a83e7a04a6eef80452633a517a2e9ce7839391b.zip |
zebra: Fix lsp add/del from kernel using SETFLAG
Setup a interface such that the add/del of lsp's from
the kernel can have a callback for success/failure.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'zebra/zebra_mpls_netlink.c')
-rw-r--r-- | zebra/zebra_mpls_netlink.c | 47 |
1 files changed, 33 insertions, 14 deletions
diff --git a/zebra/zebra_mpls_netlink.c b/zebra/zebra_mpls_netlink.c index 0abc4959f..64b1a7c0a 100644 --- a/zebra/zebra_mpls_netlink.c +++ b/zebra/zebra_mpls_netlink.c @@ -29,16 +29,21 @@ /* * Install Label Forwarding entry into the kernel. */ -int kernel_add_lsp(zebra_lsp_t *lsp) +void kernel_add_lsp(zebra_lsp_t *lsp) { int ret; - if (!lsp || !lsp->best_nhlfe) // unexpected - return -1; + if (!lsp || !lsp->best_nhlfe) { // unexpected + kernel_lsp_pass_fail(lsp, SOUTHBOUND_INSTALL_FAILURE); + return; + } ret = netlink_mpls_multipath(RTM_NEWROUTE, lsp); - return ret; + kernel_lsp_pass_fail(lsp, + (!ret) ? + SOUTHBOUND_INSTALL_SUCCESS : + SOUTHBOUND_INSTALL_FAILURE); } /* @@ -52,14 +57,16 @@ int kernel_add_lsp(zebra_lsp_t *lsp) * through the metric field (before kernel-MPLS). This shouldn't be an issue * any longer, so REPLACE can be reintroduced. */ -int kernel_upd_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 - return -1; + 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. @@ -78,25 +85,37 @@ int kernel_upd_lsp(zebra_lsp_t *lsp) ret = netlink_mpls_multipath(RTM_NEWROUTE, lsp); - return ret; + kernel_lsp_pass_fail(lsp, + (!ret) ? + SOUTHBOUND_INSTALL_SUCCESS : + SOUTHBOUND_INSTALL_FAILURE); } /* * Delete Label Forwarding entry from the kernel. */ -int kernel_del_lsp(zebra_lsp_t *lsp) +void kernel_del_lsp(zebra_lsp_t *lsp) { int ret; - if (!lsp) // unexpected - return -1; + if (!lsp) { // unexpected + kernel_lsp_pass_fail(lsp, + SOUTHBOUND_DELETE_FAILURE); + return; + } - if (!CHECK_FLAG(lsp->flags, LSP_FLAG_INSTALLED)) - return -1; + if (!CHECK_FLAG(lsp->flags, LSP_FLAG_INSTALLED)) { + kernel_lsp_pass_fail(lsp, + SOUTHBOUND_DELETE_FAILURE); + return; + } ret = netlink_mpls_multipath(RTM_DELROUTE, lsp); - return ret; + kernel_lsp_pass_fail(lsp, + (!ret) ? + SOUTHBOUND_DELETE_SUCCESS : + SOUTHBOUND_DELETE_FAILURE); } int mpls_kernel_init(void) |