diff options
| author | Renato Westphal <renato@opensourcerouting.org> | 2016-09-21 23:59:57 -0300 | 
|---|---|---|
| committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2016-09-23 09:31:25 -0400 | 
| commit | fe6c7157bf2babbc552dc45115da586bde1b92e7 (patch) | |
| tree | 3d9792b6a1de0e8c621a4ea7aba1da8b367cf2a7 /zebra/zebra_mpls_vty.c | |
| parent | a4b46f4c16bd4cb1f2c890c08ff541468d59d9b3 (diff) | |
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.c | 22 | 
1 files changed, 18 insertions, 4 deletions
diff --git a/zebra/zebra_mpls_vty.c b/zebra/zebra_mpls_vty.c index e5f6932e87..e7338a10c2 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 */  | 
