zebra: fix 'no mpls' command by using 'mpls disable' instead

The 'no mpls' command wrongly assumes the user wants to disable
the mpls handling on the interface whereas this is just a config
knob that should mean 'I don't care with mpls'.

Fix this by adding a 'disable' option to the mpls command.

Fixes: 39ffa8e8e8 ("zebra: Add a `mpls enable` interface node command")

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
This commit is contained in:
Philippe Guibert 2023-07-13 09:42:55 +02:00
parent 8ceb262401
commit 8291e3a313

View File

@ -3777,20 +3777,24 @@ DEFUN (multicast,
DEFPY (mpls, DEFPY (mpls,
mpls_cmd, mpls_cmd,
"[no] mpls enable", "[no] mpls <enable$on|disable$off>",
NO_STR NO_STR
MPLS_STR MPLS_STR
"Set mpls to be on for the interface\n") "Set mpls to be on for the interface\n"
"Set mpls to be off for the interface\n")
{ {
VTY_DECLVAR_CONTEXT(interface, ifp); VTY_DECLVAR_CONTEXT(interface, ifp);
struct zebra_if *if_data = ifp->info; struct zebra_if *if_data = ifp->info;
if (no) { if (no) {
dplane_intf_mpls_modify_state(ifp, false); /* keep the state as it is */
if_data->mpls_config = IF_ZEBRA_DATA_UNSPEC; if_data->mpls_config = IF_ZEBRA_DATA_UNSPEC;
} else { } else {
dplane_intf_mpls_modify_state(ifp, true); dplane_intf_mpls_modify_state(ifp, !!on);
if_data->mpls_config = IF_ZEBRA_DATA_ON; if (on)
if_data->mpls_config = IF_ZEBRA_DATA_ON;
else
if_data->mpls_config = IF_ZEBRA_DATA_OFF;
} }
return CMD_SUCCESS; return CMD_SUCCESS;
@ -5633,6 +5637,9 @@ static int if_config_write(struct vty *vty)
if (if_data->mpls_config == IF_ZEBRA_DATA_ON) if (if_data->mpls_config == IF_ZEBRA_DATA_ON)
vty_out(vty, " mpls enable\n"); vty_out(vty, " mpls enable\n");
else if (if_data->mpls_config ==
IF_ZEBRA_DATA_OFF)
vty_out(vty, " mpls disable\n");
} }
hook_call(zebra_if_config_wr, vty, ifp); hook_call(zebra_if_config_wr, vty, ifp);