]> git.proxmox.com Git - mirror_frr.git/commitdiff
zebra: Disable mpls slightly different
authorDonald Sharp <sharpd@cumulusnetworks.com>
Tue, 25 Oct 2016 18:25:29 +0000 (14:25 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Tue, 25 Oct 2016 18:30:25 +0000 (14:30 -0400)
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>
zebra/zebra_mpls_vty.c
zebra/zebra_vty.c

index 6e95236c20cd57ca326f7d064b8a43ddf8013ab6..8b967c3af83f4a28e517ba032406536796f746fa 100644 (file)
@@ -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);
index 6002b0d6fa5460dffad5d18ae0bfe103f1ed2aca..6a43da39b349fb400e854ae5978caadfd88e0adf 100644 (file)
@@ -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))
         {