summaryrefslogtreecommitdiffstats
path: root/zebra/zebra_mpls_netlink.c
diff options
context:
space:
mode:
authorwhitespace / reindent <invalid@invalid.invalid>2017-07-17 14:03:14 +0200
committerwhitespace / reindent <invalid@invalid.invalid>2017-07-17 14:04:07 +0200
commitd62a17aedeb0eebdba98238874bb13d62c48dbf9 (patch)
tree3b319b1d61c8b85b4d1f06adf8b844bb8a9b5107 /zebra/zebra_mpls_netlink.c
parent*: add indent control files (diff)
downloadfrr-d62a17aedeb0eebdba98238874bb13d62c48dbf9.tar.xz
frr-d62a17aedeb0eebdba98238874bb13d62c48dbf9.zip
indent.py `git ls-files | pcregrep '\.[ch]$' | pcregrep -v '^(ldpd|babeld|nhrpd)/'` Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'zebra/zebra_mpls_netlink.c')
-rw-r--r--zebra/zebra_mpls_netlink.c89
1 files changed, 42 insertions, 47 deletions
diff --git a/zebra/zebra_mpls_netlink.c b/zebra/zebra_mpls_netlink.c
index d0c4acb37..c5053563b 100644
--- a/zebra/zebra_mpls_netlink.c
+++ b/zebra/zebra_mpls_netlink.c
@@ -26,22 +26,21 @@
/*
* Install Label Forwarding entry into the kernel.
*/
-int
-kernel_add_lsp (zebra_lsp_t *lsp)
+int kernel_add_lsp(zebra_lsp_t *lsp)
{
- int ret;
+ int ret;
- if (!lsp || !lsp->best_nhlfe) // unexpected
- return -1;
+ 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);
- else
- clear_nhlfe_installed (lsp);
+ UNSET_FLAG(lsp->flags, LSP_FLAG_CHANGED);
+ ret = netlink_mpls_multipath(RTM_NEWROUTE, lsp);
+ if (!ret)
+ SET_FLAG(lsp->flags, LSP_FLAG_INSTALLED);
+ else
+ clear_nhlfe_installed(lsp);
- return ret;
+ return ret;
}
/*
@@ -55,58 +54,54 @@ 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)
+int kernel_upd_lsp(zebra_lsp_t *lsp)
{
- int ret;
+ int ret;
- if (!lsp || !lsp->best_nhlfe) // unexpected
- return -1;
+ if (!lsp || !lsp->best_nhlfe) // unexpected
+ return -1;
- UNSET_FLAG (lsp->flags, LSP_FLAG_CHANGED);
+ UNSET_FLAG(lsp->flags, LSP_FLAG_CHANGED);
- /* First issue a DEL and clear the installed flag. */
- netlink_mpls_multipath (RTM_DELROUTE, lsp);
- UNSET_FLAG (lsp->flags, LSP_FLAG_INSTALLED);
+ /* First issue a DEL and clear the installed flag. */
+ netlink_mpls_multipath(RTM_DELROUTE, lsp);
+ UNSET_FLAG(lsp->flags, LSP_FLAG_INSTALLED);
- /* Then issue an ADD. */
- ret = netlink_mpls_multipath (RTM_NEWROUTE, lsp);
- if (!ret)
- SET_FLAG (lsp->flags, LSP_FLAG_INSTALLED);
- else
- clear_nhlfe_installed (lsp);
+ /* Then issue an ADD. */
+ ret = netlink_mpls_multipath(RTM_NEWROUTE, lsp);
+ if (!ret)
+ SET_FLAG(lsp->flags, LSP_FLAG_INSTALLED);
+ else
+ clear_nhlfe_installed(lsp);
- return ret;
+ return ret;
}
/*
* Delete Label Forwarding entry from the kernel.
*/
-int
-kernel_del_lsp (zebra_lsp_t *lsp)
+int kernel_del_lsp(zebra_lsp_t *lsp)
{
- if (!lsp) // unexpected
- return -1;
+ 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)) {
+ netlink_mpls_multipath(RTM_DELROUTE, lsp);
+ UNSET_FLAG(lsp->flags, LSP_FLAG_INSTALLED);
+ }
- return 0;
+ return 0;
}
-int
-mpls_kernel_init (void)
+int mpls_kernel_init(void)
{
- struct stat st;
+ struct stat st;
- /*
- * Check if the MPLS module is loaded in the kernel.
- */
- if (stat ("/proc/sys/net/mpls", &st) != 0)
- return -1;
+ /*
+ * Check if the MPLS module is loaded in the kernel.
+ */
+ if (stat("/proc/sys/net/mpls", &st) != 0)
+ return -1;
- return 0;
+ return 0;
};