summaryrefslogtreecommitdiff
path: root/zebra/interface.c
diff options
context:
space:
mode:
authorPhilippe Guibert <philippe.guibert@6wind.com>2023-07-13 09:42:55 +0200
committerPhilippe Guibert <philippe.guibert@6wind.com>2023-08-10 18:13:21 +0200
commit8291e3a3138163b169441dbb321b863cb7b6a345 (patch)
treed638c717e9e03d38595fb6ef291ac66bebdc2636 /zebra/interface.c
parent8ceb26240126dca3be65162b0c8aa9bad28a65f6 (diff)
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: 39ffa8e8e856 ("zebra: Add a `mpls enable` interface node command") Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to 'zebra/interface.c')
-rw-r--r--zebra/interface.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/zebra/interface.c b/zebra/interface.c
index 4006f9c574..c92f149e23 100644
--- a/zebra/interface.c
+++ b/zebra/interface.c
@@ -3777,20 +3777,24 @@ DEFUN (multicast,
DEFPY (mpls,
mpls_cmd,
- "[no] mpls enable",
+ "[no] mpls <enable$on|disable$off>",
NO_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);
struct zebra_if *if_data = ifp->info;
if (no) {
- dplane_intf_mpls_modify_state(ifp, false);
+ /* keep the state as it is */
if_data->mpls_config = IF_ZEBRA_DATA_UNSPEC;
} else {
- dplane_intf_mpls_modify_state(ifp, true);
- if_data->mpls_config = IF_ZEBRA_DATA_ON;
+ dplane_intf_mpls_modify_state(ifp, !!on);
+ if (on)
+ if_data->mpls_config = IF_ZEBRA_DATA_ON;
+ else
+ if_data->mpls_config = IF_ZEBRA_DATA_OFF;
}
return CMD_SUCCESS;
@@ -5633,6 +5637,9 @@ static int if_config_write(struct vty *vty)
if (if_data->mpls_config == IF_ZEBRA_DATA_ON)
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);