From 052a0cd0257f751cc1fec4d3972b179916ae9c63 Mon Sep 17 00:00:00 2001 From: Philippe Guibert Date: Tue, 15 Feb 2022 17:18:30 +0100 Subject: [PATCH] ospfd: silently remove prefix sid already stored in config There is no need to have an interface available to configure SRGB. Conversely, it should be possible to remove the SRGB when no interfaces are available. Signed-off-by: Philippe Guibert --- ospfd/ospf_sr.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/ospfd/ospf_sr.c b/ospfd/ospf_sr.c index e4059d05c2..21978d35ce 100644 --- a/ospfd/ospf_sr.c +++ b/ospfd/ospf_sr.c @@ -2663,12 +2663,18 @@ DEFUN (no_sr_prefix_sid, return CMD_WARNING_CONFIG_FAILED; } + osr_debug("SR (%s): Remove Prefix %pFX with index %u", __func__, + (struct prefix *)&srp->prefv4, srp->sid); + /* Get Interface */ ifp = if_lookup_by_index(srp->nhlfe.ifindex, VRF_DEFAULT); if (ifp == NULL) { vty_out(vty, "interface for prefix %s not found.\n", argv[idx]->arg); - return CMD_WARNING_CONFIG_FAILED; + /* silently remove from list */ + listnode_delete(OspfSR.self->ext_prefix, srp); + XFREE(MTYPE_OSPF_SR_PARAMS, srp); + return CMD_SUCCESS; } /* Update Extended Prefix LSA */ @@ -2677,9 +2683,6 @@ DEFUN (no_sr_prefix_sid, return CMD_WARNING; } - osr_debug("SR (%s): Remove Prefix %pFX with index %u", __func__, - (struct prefix *)&srp->prefv4, srp->sid); - /* Delete NHLFE if NO-PHP is set and EXPLICIT NULL not set */ if (CHECK_FLAG(srp->flags, EXT_SUBTLV_PREFIX_SID_NPFLG) && !CHECK_FLAG(srp->flags, EXT_SUBTLV_PREFIX_SID_EFLG)) -- 2.39.5