]> git.puffer.fish Git - mirror/frr.git/commitdiff
ospfd: introduce additional opaque capability check in the GR code
authorRenato Westphal <renato@opensourcerouting.org>
Sat, 9 Oct 2021 23:02:16 +0000 (20:02 -0300)
committerRenato Westphal <renato@opensourcerouting.org>
Tue, 12 Oct 2021 20:33:32 +0000 (17:33 -0300)
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 <renato@opensourcerouting.org>
ospfd/ospf_gr.c

index fed8bddb5f9e3646072d126b6a05f6509b3c8878..aae7e33867d9cf780cd88d90c2efef3b158c74f7 100644 (file)
@@ -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;