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)) {