summaryrefslogtreecommitdiff
path: root/zebra/zebra_mpls.c
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2016-09-21 23:59:57 -0300
committerDonald Sharp <sharpd@cumulusnetworks.com>2016-09-23 09:31:25 -0400
commitfe6c7157bf2babbc552dc45115da586bde1b92e7 (patch)
tree3d9792b6a1de0e8c621a4ea7aba1da8b367cf2a7 /zebra/zebra_mpls.c
parenta4b46f4c16bd4cb1f2c890c08ff541468d59d9b3 (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.c')
-rw-r--r--zebra/zebra_mpls.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/zebra/zebra_mpls.c b/zebra/zebra_mpls.c
index ccb81dcff5..185cddea64 100644
--- a/zebra/zebra_mpls.c
+++ b/zebra/zebra_mpls.c
@@ -53,6 +53,8 @@ DEFINE_MTYPE_STATIC(ZEBRA, NHLFE, "MPLS nexthop object")
DEFINE_MTYPE_STATIC(ZEBRA, SNHLFE, "MPLS static nexthop object")
DEFINE_MTYPE_STATIC(ZEBRA, SNHLFE_IFNAME, "MPLS static nexthop ifname")
+int mpls_enabled;
+
/* Default rtm_table for all clients */
extern struct zebra_t zebrad;
@@ -1902,6 +1904,12 @@ zebra_mpls_init_tables (struct zebra_vrf *zvrf)
void
zebra_mpls_init (void)
{
- mpls_kernel_init ();
+ if (mpls_kernel_init () < 0)
+ {
+ zlog_warn ("Disabling MPLS support (no kernel support)");
+ return;
+ }
+
+ mpls_enabled = 1;
mpls_processq_init (&zebrad);
}