summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2016-10-25 14:25:29 -0400
committerDonald Sharp <sharpd@cumulusnetworks.com>2016-10-25 14:30:25 -0400
commitc58418c1107928a851aee28b98acae306b79c6e3 (patch)
treea9240706dc26a352833bb0b461925b1f95d99c97
parent5697001a7b6860418ae2641a276238ba1dd76af6 (diff)
zebra: Disable mpls slightly different
When mpls is not turned on in the kernel, we are not installing the mpls commands into the cli. This results in vtysh attempting to run the command and receiving a 'WTF is this command' back from zebra. Modify the mpls code to install commands and to check to see if the command should be accepted based upon mpls working or not. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
-rw-r--r--zebra/zebra_mpls_vty.c10
-rw-r--r--zebra/zebra_vty.c6
2 files changed, 13 insertions, 3 deletions
diff --git a/zebra/zebra_mpls_vty.c b/zebra/zebra_mpls_vty.c
index 6e95236c20..8b967c3af8 100644
--- a/zebra/zebra_mpls_vty.c
+++ b/zebra/zebra_mpls_vty.c
@@ -52,6 +52,13 @@ zebra_mpls_transit_lsp (struct vty *vty, int add_cmd, const char *inlabel_str,
mpls_label_t label;
mpls_label_t in_label, out_label;
+ if (!mpls_enabled)
+ {
+ vty_out (vty, "%% MPLS not turned on in kernel, ignoring command%s",
+ VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
zvrf = vrf_info_lookup(VRF_DEFAULT);
if (!zvrf)
{
@@ -829,9 +836,6 @@ zebra_mpls_vty_init (void)
{
install_element (VIEW_NODE, &show_mpls_status_cmd);
- if (! mpls_enabled)
- return;
-
install_node (&mpls_node, zebra_mpls_config);
install_element (CONFIG_NODE, &ip_route_label_cmd);
diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c
index 6002b0d6fa..6a43da39b3 100644
--- a/zebra/zebra_vty.c
+++ b/zebra/zebra_vty.c
@@ -118,6 +118,12 @@ zebra_static_ipv4 (struct vty *vty, safi_t safi, int add_cmd,
/* Labels */
if (label_str)
{
+ if (!mpls_enabled)
+ {
+ vty_out (vty, "%% MPLS not turned on in kernel, ignoring command%s",
+ VTY_NEWLINE);
+ return CMD_WARNING;
+ }
if (mpls_str2label (label_str, &snh_label.num_labels,
snh_label.label))
{