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>
This commit is contained in:
Donald Sharp 2016-10-25 14:25:29 -04:00
parent 5697001a7b
commit c58418c110
2 changed files with 13 additions and 3 deletions

View 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);

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