summaryrefslogtreecommitdiffstats
path: root/zebra/zebra_mpls_netlink.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_netlink.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_netlink.c')
-rw-r--r--zebra/zebra_mpls_netlink.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/zebra/zebra_mpls_netlink.c b/zebra/zebra_mpls_netlink.c
index 4011b90ee..1f894b33c 100644
--- a/zebra/zebra_mpls_netlink.c
+++ b/zebra/zebra_mpls_netlink.c
@@ -77,4 +77,16 @@ kernel_del_lsp (zebra_lsp_t *lsp)
return 0;
}
-void mpls_kernel_init (void) {};
+int
+mpls_kernel_init (void)
+{
+ struct stat st;
+
+ /*
+ * Check if the MPLS module is loaded in the kernel.
+ */
+ if (stat ("/proc/sys/net/mpls", &st) != 0)
+ return -1;
+
+ return 0;
+};