diff options
author | Donald Sharp <sharpd@cumulusnetworks.com> | 2018-05-25 17:07:34 +0200 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2018-05-30 14:05:29 +0200 |
commit | 7c5d0e1853597d398dda77494217f58a425e57df (patch) | |
tree | 8b1c971d20b359cfc5a5f5c7793217bfe2551b4d | |
parent | zebra: Add knowledge of request success/failure for pbr rules (diff) | |
download | frr-7c5d0e1853597d398dda77494217f58a425e57df.tar.xz frr-7c5d0e1853597d398dda77494217f58a425e57df.zip |
zebra: Add `enum dp_req_result` to lsp install/deletes
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
-rw-r--r-- | zebra/rt.h | 6 | ||||
-rw-r--r-- | zebra/zebra_mpls.c | 41 | ||||
-rw-r--r-- | zebra/zebra_mpls_netlink.c | 20 | ||||
-rw-r--r-- | zebra/zebra_mpls_null.c | 15 | ||||
-rw-r--r-- | zebra/zebra_mpls_openbsd.c | 20 |
5 files changed, 68 insertions, 34 deletions
diff --git a/zebra/rt.h b/zebra/rt.h index e1345c8e9..ad1fe9a1f 100644 --- a/zebra/rt.h +++ b/zebra/rt.h @@ -90,9 +90,9 @@ extern int kernel_neigh_update(int cmd, int ifindex, uint32_t addr, char *lla, extern int kernel_interface_set_master(struct interface *master, struct interface *slave); -extern void kernel_add_lsp(zebra_lsp_t *lsp); -extern void kernel_upd_lsp(zebra_lsp_t *lsp); -extern void kernel_del_lsp(zebra_lsp_t *lsp); +extern enum dp_req_result kernel_add_lsp(zebra_lsp_t *lsp); +extern enum dp_req_result kernel_upd_lsp(zebra_lsp_t *lsp); +extern enum dp_req_result kernel_del_lsp(zebra_lsp_t *lsp); /* * Add the ability to pass back up the lsp install/delete diff --git a/zebra/zebra_mpls.c b/zebra/zebra_mpls.c index 69d09a08c..47fcf84aa 100644 --- a/zebra/zebra_mpls.c +++ b/zebra/zebra_mpls.c @@ -860,7 +860,7 @@ static void lsp_uninstall_from_kernel(struct hash_backet *backet, void *ctxt) lsp = (zebra_lsp_t *)backet->data; if (CHECK_FLAG(lsp->flags, LSP_FLAG_INSTALLED)) - kernel_del_lsp(lsp); + (void)kernel_del_lsp(lsp); } /* @@ -914,17 +914,31 @@ static wq_item_status lsp_process(struct work_queue *wq, void *data) if (newbest) { UNSET_FLAG(lsp->flags, LSP_FLAG_CHANGED); - kernel_add_lsp(lsp); - - zvrf->lsp_installs++; + switch (kernel_add_lsp(lsp)) { + case DP_REQUEST_QUEUED: + zlog_err("No current DataPlane interfaces can return this, please fix"); + break; + case DP_REQUEST_FAILURE: + break; + case DP_REQUEST_SUCCESS: + zvrf->lsp_installs++; + break; + } } } else { /* Installed, may need an update and/or delete. */ if (!newbest) { - kernel_del_lsp(lsp); - - zvrf->lsp_removals++; + switch (kernel_del_lsp(lsp)) { + case DP_REQUEST_QUEUED: + zlog_err("No current DataPlane interfaces can return this, please fix"); + break; + case DP_REQUEST_FAILURE: + break; + case DP_REQUEST_SUCCESS: + zvrf->lsp_removals++; + break; + } } else if (CHECK_FLAG(lsp->flags, LSP_FLAG_CHANGED)) { zebra_nhlfe_t *nhlfe; struct nexthop *nexthop; @@ -953,9 +967,16 @@ static wq_item_status lsp_process(struct work_queue *wq, void *data) } } - kernel_upd_lsp(lsp); - - zvrf->lsp_installs++; + switch (kernel_upd_lsp(lsp)) { + case DP_REQUEST_QUEUED: + zlog_err("No current DataPlane interfaces can return this, please fix"); + break; + case DP_REQUEST_FAILURE: + break; + case DP_REQUEST_SUCCESS: + zvrf->lsp_installs++; + break; + } } } diff --git a/zebra/zebra_mpls_netlink.c b/zebra/zebra_mpls_netlink.c index 15aba89a2..245a77178 100644 --- a/zebra/zebra_mpls_netlink.c +++ b/zebra/zebra_mpls_netlink.c @@ -29,13 +29,13 @@ /* * Install Label Forwarding entry into the kernel. */ -void kernel_add_lsp(zebra_lsp_t *lsp) +enum dp_req_result kernel_add_lsp(zebra_lsp_t *lsp) { int ret; if (!lsp || !lsp->best_nhlfe) { // unexpected kernel_lsp_pass_fail(lsp, DP_INSTALL_FAILURE); - return; + return DP_REQUEST_FAILURE; } ret = netlink_mpls_multipath(RTM_NEWROUTE, lsp); @@ -43,6 +43,8 @@ void kernel_add_lsp(zebra_lsp_t *lsp) kernel_lsp_pass_fail(lsp, (!ret) ? DP_INSTALL_SUCCESS : DP_INSTALL_FAILURE); + + return DP_REQUEST_SUCCESS; } /* @@ -56,13 +58,13 @@ void 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. */ -void kernel_upd_lsp(zebra_lsp_t *lsp) +enum dp_req_result kernel_upd_lsp(zebra_lsp_t *lsp) { int ret; if (!lsp || !lsp->best_nhlfe) { // unexpected kernel_lsp_pass_fail(lsp, DP_INSTALL_FAILURE); - return; + return DP_REQUEST_FAILURE; } ret = netlink_mpls_multipath(RTM_NEWROUTE, lsp); @@ -70,23 +72,25 @@ void kernel_upd_lsp(zebra_lsp_t *lsp) kernel_lsp_pass_fail(lsp, (!ret) ? DP_INSTALL_SUCCESS : DP_INSTALL_FAILURE); + + return DP_REQUEST_SUCCESS; } /* * Delete Label Forwarding entry from the kernel. */ -void kernel_del_lsp(zebra_lsp_t *lsp) +enum dp_req_result kernel_del_lsp(zebra_lsp_t *lsp) { int ret; if (!lsp) { // unexpected kernel_lsp_pass_fail(lsp, DP_DELETE_FAILURE); - return; + return DP_REQUEST_FAILURE; } if (!CHECK_FLAG(lsp->flags, LSP_FLAG_INSTALLED)) { kernel_lsp_pass_fail(lsp, DP_DELETE_FAILURE); - return; + return DP_REQUEST_FAILURE; } ret = netlink_mpls_multipath(RTM_DELROUTE, lsp); @@ -94,6 +98,8 @@ void kernel_del_lsp(zebra_lsp_t *lsp) kernel_lsp_pass_fail(lsp, (!ret) ? DP_DELETE_SUCCESS : DP_DELETE_FAILURE); + + return DP_REQUEST_SUCCESS; } int mpls_kernel_init(void) diff --git a/zebra/zebra_mpls_null.c b/zebra/zebra_mpls_null.c index 6b5318325..d1371d334 100644 --- a/zebra/zebra_mpls_null.c +++ b/zebra/zebra_mpls_null.c @@ -24,18 +24,21 @@ #if !defined(HAVE_NETLINK) && !defined(OPEN_BSD) -void kernel_add_lsp(zebra_lsp_t *lsp) +enum dp_req_result kernel_add_lsp(zebra_lsp_t *lsp) { - return; + return DP_REQUEST_SUCCESS; } -void kernel_upd_lsp(zebra_lsp_t *lsp) + +enum dp_req_result kernel_upd_lsp(zebra_lsp_t *lsp) { - return; + return DP_REQUEST_SUCCESS; } -void kernel_del_lsp(zebra_lsp_t *lsp) + +enum dp_req_result kernel_del_lsp(zebra_lsp_t *lsp) { - return; + return DP_REQUEST_SUCCESS; } + int mpls_kernel_init(void) { return -1; diff --git a/zebra/zebra_mpls_openbsd.c b/zebra/zebra_mpls_openbsd.c index 80595972b..412fe7d3d 100644 --- a/zebra/zebra_mpls_openbsd.c +++ b/zebra/zebra_mpls_openbsd.c @@ -285,13 +285,13 @@ static int kernel_lsp_cmd(int action, zebra_lsp_t *lsp) return (0); } -void kernel_add_lsp(zebra_lsp_t *lsp) +enum dp_req_result kernel_add_lsp(zebra_lsp_t *lsp) { int ret; if (!lsp || !lsp->best_nhlfe) { // unexpected kernel_lsp_pass_fail(lsp, DP_INSTALL_FAILURE); - return; + return DP_REQUEST_FAILURE; } ret = kernel_lsp_cmd(RTM_ADD, lsp); @@ -299,15 +299,17 @@ void kernel_add_lsp(zebra_lsp_t *lsp) kernel_lsp_pass_fail(lsp, (!ret) ? DP_INSTALL_SUCCESS : DP_INSTALL_FAILURE); + + return DP_REQUEST_SUCCESS; } -void kernel_upd_lsp(zebra_lsp_t *lsp) +enum dp_req_result kernel_upd_lsp(zebra_lsp_t *lsp) { int ret; if (!lsp || !lsp->best_nhlfe) { // unexpected kernel_lsp_pass_fail(lsp, DP_INSTALL_FAILURE); - return; + return DP_REQUEST_FAILURE; } ret = kernel_lsp_cmd(RTM_CHANGE, lsp); @@ -315,21 +317,21 @@ void kernel_upd_lsp(zebra_lsp_t *lsp) kernel_lsp_pass_fail(lsp, (!ret) ? DP_INSTALL_SUCCESS : DP_INSTALL_FAILURE); - return; + return DP_REQUEST_SUCCESS; } -void kernel_del_lsp(zebra_lsp_t *lsp) +enum dp_req_result kernel_del_lsp(zebra_lsp_t *lsp) { int ret; if (!lsp) { // unexpected kernel_lsp_pass_fail(lsp, DP_DELETE_FAILURE); - return; + return DP_REQUEST_FAILURE; } if (!CHECK_FLAG(lsp->flags, LSP_FLAG_INSTALLED)) { kernel_lsp_pass_fail(lsp, DP_DELETE_FAILURE); - return; + return DP_REQUEST_FAILURE; } ret = kernel_lsp_cmd(RTM_DELETE, lsp); @@ -337,6 +339,8 @@ void kernel_del_lsp(zebra_lsp_t *lsp) kernel_lsp_pass_fail(lsp, (!ret) ? DP_DELETE_SUCCESS : DP_DELETE_FAILURE); + + return DP_REQUEST_SUCCESS; } static int kmpw_install(struct zebra_pw *pw) |