summaryrefslogtreecommitdiffstats
path: root/zebra/zebra_mpls_vty.c
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2016-09-22 04:59:57 +0200
committerDonald Sharp <sharpd@cumulusnetworks.com>2016-09-23 15:31:25 +0200
commitfe6c7157bf2babbc552dc45115da586bde1b92e7 (patch)
tree3d9792b6a1de0e8c621a4ea7aba1da8b367cf2a7 /zebra/zebra_mpls_vty.c
parent*: remove dead code (diff)
downloadfrr-fe6c7157bf2babbc552dc45115da586bde1b92e7.tar.xz
frr-fe6c7157bf2babbc552dc45115da586bde1b92e7.zip
zebra: check at startup if the kernel supports MPLS
Replace all HAVE_MPLS #ifdef's by a run-time check if MPLS is supported by the kernel or not. This way we don't need to create multiple packages for each OS distribution. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'zebra/zebra_mpls_vty.c')
-rw-r--r--zebra/zebra_mpls_vty.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/zebra/zebra_mpls_vty.c b/zebra/zebra_mpls_vty.c
index e5f6932e8..e7338a10c 100644
--- a/zebra/zebra_mpls_vty.c
+++ b/zebra/zebra_mpls_vty.c
@@ -21,8 +21,6 @@
#include <zebra.h>
-#if defined(HAVE_MPLS)
-
#include "memory.h"
#include "if.h"
#include "prefix.h"
@@ -810,6 +808,18 @@ DEFUN (show_mpls_table_lsp,
return CMD_SUCCESS;
}
+DEFUN (show_mpls_status,
+ show_mpls_status_cmd,
+ "show mpls status",
+ SHOW_STR
+ "MPLS information\n"
+ "MPLS status\n")
+{
+ vty_out (vty, "MPLS support enabled: %s%s", (mpls_enabled) ? "yes" :
+ "no (mpls kernel extensions not detected)", VTY_NEWLINE);
+ return CMD_SUCCESS;
+}
+
/* MPLS node for MPLS LSP. */
static struct cmd_node mpls_node = { MPLS_NODE, "", 1 };
@@ -817,6 +827,12 @@ static struct cmd_node mpls_node = { MPLS_NODE, "", 1 };
void
zebra_mpls_vty_init (void)
{
+ install_element (VIEW_NODE, &show_mpls_status_cmd);
+ install_element (ENABLE_NODE, &show_mpls_status_cmd);
+
+ if (! mpls_enabled)
+ return;
+
install_node (&mpls_node, zebra_mpls_config);
install_element (CONFIG_NODE, &ip_route_label_cmd);
@@ -863,5 +879,3 @@ zebra_mpls_vty_init (void)
install_element (VIEW_NODE, &show_mpls_table_lsp_cmd);
install_element (ENABLE_NODE, &show_mpls_table_lsp_cmd);
}
-
-#endif /* HAVE_MPLS */