summaryrefslogtreecommitdiffstats
path: root/zebra/zebra_mpls_netlink.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2017-11-16 18:46:10 +0100
committerDonald Sharp <sharpd@cumulusnetworks.com>2017-11-16 19:13:13 +0100
commit2b63430caa350b603a5173cea54e18719202f189 (patch)
tree8440bee771cd46c63376fde63cf9cca18f713f40 /zebra/zebra_mpls_netlink.c
parentzebra: rt_socket.c should not use SET_FLAG (diff)
downloadfrr-2b63430caa350b603a5173cea54e18719202f189.tar.xz
frr-2b63430caa350b603a5173cea54e18719202f189.zip
zebra: Move some LSP flag handling to common code
The LSP_FLAG_CHANGED and LSP_FLAG_INSTALLED flags should be handled in the common call function for adding/updating/removing a lsp to/from the kernel. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'zebra/zebra_mpls_netlink.c')
-rw-r--r--zebra/zebra_mpls_netlink.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/zebra/zebra_mpls_netlink.c b/zebra/zebra_mpls_netlink.c
index 887c68549..0abc4959f 100644
--- a/zebra/zebra_mpls_netlink.c
+++ b/zebra/zebra_mpls_netlink.c
@@ -36,10 +36,7 @@ int kernel_add_lsp(zebra_lsp_t *lsp)
if (!lsp || !lsp->best_nhlfe) // unexpected
return -1;
- UNSET_FLAG(lsp->flags, LSP_FLAG_CHANGED);
ret = netlink_mpls_multipath(RTM_NEWROUTE, lsp);
- if (!ret)
- SET_FLAG(lsp->flags, LSP_FLAG_INSTALLED);
return ret;
}
@@ -64,8 +61,6 @@ int kernel_upd_lsp(zebra_lsp_t *lsp)
if (!lsp || !lsp->best_nhlfe) // unexpected
return -1;
- UNSET_FLAG(lsp->flags, LSP_FLAG_CHANGED);
-
/* Any NHLFE that was installed but is not selected now needs to
* have its flags updated.
*/
@@ -82,8 +77,6 @@ int kernel_upd_lsp(zebra_lsp_t *lsp)
}
ret = netlink_mpls_multipath(RTM_NEWROUTE, lsp);
- if (!ret)
- SET_FLAG(lsp->flags, LSP_FLAG_INSTALLED);
return ret;
}
@@ -93,15 +86,17 @@ int kernel_upd_lsp(zebra_lsp_t *lsp)
*/
int kernel_del_lsp(zebra_lsp_t *lsp)
{
+ int ret;
+
if (!lsp) // unexpected
return -1;
- if (CHECK_FLAG(lsp->flags, LSP_FLAG_INSTALLED)) {
- netlink_mpls_multipath(RTM_DELROUTE, lsp);
- UNSET_FLAG(lsp->flags, LSP_FLAG_INSTALLED);
- }
+ if (!CHECK_FLAG(lsp->flags, LSP_FLAG_INSTALLED))
+ return -1;
- return 0;
+ ret = netlink_mpls_multipath(RTM_DELROUTE, lsp);
+
+ return ret;
}
int mpls_kernel_init(void)