From eedc80c1f59c060d0f313dee9910f32f99c606c3 Mon Sep 17 00:00:00 2001 From: Renato Westphal Date: Sat, 9 Oct 2021 20:02:16 -0300 Subject: [PATCH] ospfd: introduce additional opaque capability check in the GR code Before starting the graceful restart procedures, ospf_gr_prepare() verifies for each configured OSPF instance whether it has the opaque capability enabled (a pre-requisite for GR). If not, a warning is emitted and GR isn't performed on that instance. This PR introduces an additional opaque capability check that will return a CLI error when the opaque capability isn't enabled. The idea is to make it easier for the user to identify when the GR activation has failed, instead of requiring him or her to check the logs for errors. The original opaque capability check from ospf_gr_prepare() was retaining as it's possible that that function might be called from other contexts in the future. Signed-off-by: Renato Westphal --- ospfd/ospf_gr.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ospfd/ospf_gr.c b/ospfd/ospf_gr.c index fed8bddb5f..aae7e33867 100644 --- a/ospfd/ospf_gr.c +++ b/ospfd/ospf_gr.c @@ -734,6 +734,18 @@ DEFPY(graceful_restart_prepare, graceful_restart_prepare_cmd, IP_STR "Prepare to restart the OSPF process") { + struct ospf *ospf; + struct listnode *node; + + for (ALL_LIST_ELEMENTS_RO(om->ospf, node, ospf)) { + if (!CHECK_FLAG(ospf->config, OSPF_OPAQUE_CAPABLE)) { + vty_out(vty, + "%% Can't start graceful restart: opaque capability not enabled (VRF %s)\n\n", + ospf_get_name(ospf)); + return CMD_WARNING; + } + } + ospf_gr_prepare(); return CMD_SUCCESS;