diff options
| author | David Lamparter <equinox@opensourcerouting.org> | 2017-06-13 17:37:58 +0200 |
|---|---|---|
| committer | David Lamparter <equinox@opensourcerouting.org> | 2017-06-13 17:37:58 +0200 |
| commit | 645bb0b10e8144a2b40201e4da6e200d5663b886 (patch) | |
| tree | c527bd7bcc578e2835b1e6e156118c76ff1cb660 /zebra/zebra_mpls_openbsd.c | |
| parent | fb82c3dbb2d889135d3e48180ee0764c3ce96dd4 (diff) | |
| parent | 98f65fda88e54c0c1ae3060124c5bcf62bb01796 (diff) | |
Merge branch 'stable/3.0'
Dropped:
redhat/README.rpm_build.md
redhat/daemons
redhat/frr.init
redhat/frr.logrotate
redhat/frr.spec.in
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'zebra/zebra_mpls_openbsd.c')
| -rw-r--r-- | zebra/zebra_mpls_openbsd.c | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/zebra/zebra_mpls_openbsd.c b/zebra/zebra_mpls_openbsd.c index bca73898c5..45e4435ee5 100644 --- a/zebra/zebra_mpls_openbsd.c +++ b/zebra/zebra_mpls_openbsd.c @@ -238,7 +238,7 @@ kernel_lsp_cmd (int action, zebra_lsp_t *lsp) { zebra_nhlfe_t *nhlfe; struct nexthop *nexthop = NULL; - int nexthop_num = 0; + unsigned int nexthop_num = 0; for (nhlfe = lsp->nhlfe_list; nhlfe; nhlfe = nhlfe->next) { @@ -288,28 +288,52 @@ kernel_lsp_cmd (int action, zebra_lsp_t *lsp) int kernel_add_lsp (zebra_lsp_t *lsp) { + int ret; + if (!lsp || !lsp->best_nhlfe) // unexpected return -1; - return kernel_lsp_cmd (RTM_ADD, lsp); + UNSET_FLAG (lsp->flags, LSP_FLAG_CHANGED); + ret = kernel_lsp_cmd (RTM_ADD, lsp); + if (!ret) + SET_FLAG (lsp->flags, LSP_FLAG_INSTALLED); + + return ret; } int kernel_upd_lsp (zebra_lsp_t *lsp) { + int ret; + if (!lsp || !lsp->best_nhlfe) // unexpected return -1; - return kernel_lsp_cmd (RTM_CHANGE, lsp); + UNSET_FLAG (lsp->flags, LSP_FLAG_CHANGED); + UNSET_FLAG (lsp->flags, LSP_FLAG_INSTALLED); + ret = kernel_lsp_cmd (RTM_CHANGE, lsp); + if (!ret) + SET_FLAG (lsp->flags, LSP_FLAG_INSTALLED); + + return ret; } int kernel_del_lsp (zebra_lsp_t *lsp) { + int ret; + if (!lsp) // unexpected return -1; - return kernel_lsp_cmd (RTM_DELETE, lsp); + if (! CHECK_FLAG (lsp->flags, LSP_FLAG_INSTALLED)) + return -1; + + ret = kernel_lsp_cmd (RTM_DELETE, lsp); + if (!ret) + UNSET_FLAG (lsp->flags, LSP_FLAG_INSTALLED); + + return ret; } #define MAX_RTSOCK_BUF 128 * 1024 |
