From 8291e3a3138163b169441dbb321b863cb7b6a345 Mon Sep 17 00:00:00 2001 From: Philippe Guibert Date: Thu, 13 Jul 2023 09:42:55 +0200 Subject: [PATCH] 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 --- zebra/interface.c | 17 ++++++++++++----- 1 file 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 ", 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);