]> git.proxmox.com Git - mirror_frr.git/commitdiff
ospfd: cli: add client api debug option
authorChristian Hopps <chopps@labn.net>
Mon, 17 Jan 2022 12:54:12 +0000 (07:54 -0500)
committerChristian Hopps <chopps@labn.net>
Wed, 1 Jun 2022 22:11:31 +0000 (18:11 -0400)
Signed-off-by: Christian Hopps <chopps@labn.net>
doc/user/ospfd.rst
ospfd/ospf_dump.c
ospfd/ospf_dump.h

index d1a0bb6f7bffcb9acfa2b7c8d1658b55b7d2ac02..5db4d63eed2e7dc6bdf6b553cef69f76e11b321e 100644 (file)
@@ -1064,6 +1064,10 @@ Debugging OSPF
    library messages and OSPF BFD integration messages that are mostly state
    transitions and validation problems.
 
+.. clicmd:: debug ospf client-api
+
+   Show debug information for the OSPF opaque data client API.
+
 .. clicmd:: debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv) [detail]
 
 
index f40d056742283578269794c0cc7f4f87fe7e2e60..4d76181c6af3f1ce2acf3d857fc5672919af9b12 100644 (file)
@@ -62,6 +62,7 @@ unsigned long conf_debug_ospf_defaultinfo = 0;
 unsigned long conf_debug_ospf_ldp_sync = 0;
 unsigned long conf_debug_ospf_gr = 0;
 unsigned long conf_debug_ospf_bfd;
+unsigned long conf_debug_ospf_client_api;
 
 /* Enable debug option variables -- valid only session. */
 unsigned long term_debug_ospf_packet[5] = {0, 0, 0, 0, 0};
@@ -79,6 +80,7 @@ unsigned long term_debug_ospf_defaultinfo;
 unsigned long term_debug_ospf_ldp_sync;
 unsigned long term_debug_ospf_gr = 0;
 unsigned long term_debug_ospf_bfd;
+unsigned long term_debug_ospf_client_api;
 
 const char *ospf_redist_string(unsigned int route_type)
 {
@@ -1620,6 +1622,33 @@ DEFPY(debug_ospf_bfd, debug_ospf_bfd_cmd,
        return CMD_SUCCESS;
 }
 
+DEFUN(debug_ospf_client_api,
+      debug_ospf_client_api_cmd,
+      "debug ospf client-api",
+      DEBUG_STR OSPF_STR
+      "OSPF client API information\n")
+{
+       if (vty->node == CONFIG_NODE)
+               CONF_DEBUG_ON(client_api, CLIENT_API);
+       TERM_DEBUG_ON(client_api, CLIENT_API);
+       return CMD_SUCCESS;
+}
+
+DEFUN(no_debug_ospf_client_api,
+      no_debug_ospf_client_api_cmd,
+      "no debug ospf client-api",
+      NO_STR
+      DEBUG_STR
+      OSPF_STR
+      "OSPF client API information\n")
+{
+       if (vty->node == CONFIG_NODE)
+               CONF_DEBUG_OFF(client_api, CLIENT_API);
+       TERM_DEBUG_OFF(client_api, CLIENT_API);
+
+       return CMD_SUCCESS;
+}
+
 DEFUN (no_debug_ospf,
        no_debug_ospf_cmd,
        "no debug ospf",
@@ -1654,6 +1683,7 @@ DEFUN (no_debug_ospf,
                DEBUG_OFF(te, TE);
                DEBUG_OFF(sr, SR);
                DEBUG_OFF(ti_lfa, TI_LFA);
+               DEBUG_OFF(client_api, CLIENT_API);
 
                /* BFD debugging is two parts: OSPF and library. */
                DEBUG_OFF(bfd, BFD_LIB);
@@ -1690,6 +1720,7 @@ DEFUN (no_debug_ospf,
        TERM_DEBUG_OFF(sr, SR);
        TERM_DEBUG_OFF(ti_lfa, TI_LFA);
        TERM_DEBUG_OFF(bfd, BFD_LIB);
+       TERM_DEBUG_OFF(client_api, CLIENT_API);
 
        return CMD_SUCCESS;
 }
@@ -1815,6 +1846,10 @@ static int show_debugging_ospf_common(struct vty *vty)
                vty_out(vty,
                        "  OSPF BFD integration library debugging is on\n");
 
+       /* Show debug status for LDP-SYNC. */
+       if (IS_DEBUG_OSPF(client_api, CLIENT_API) == OSPF_DEBUG_CLIENT_API)
+               vty_out(vty, "  OSPF client-api debugging is on\n");
+
        vty_out(vty, "\n");
 
        return CMD_SUCCESS;
@@ -2007,6 +2042,13 @@ static int config_write_debug(struct vty *vty)
                write = 1;
        }
 
+       /* debug ospf client-api */
+       if (IS_CONF_DEBUG_OSPF(client_api, CLIENT_API) ==
+           OSPF_DEBUG_CLIENT_API) {
+               vty_out(vty, "debug ospf%s client-api\n", str);
+               write = 1;
+       }
+
        return write;
 }
 
@@ -2027,6 +2069,7 @@ void ospf_debug_init(void)
        install_element(ENABLE_NODE, &debug_ospf_ti_lfa_cmd);
        install_element(ENABLE_NODE, &debug_ospf_default_info_cmd);
        install_element(ENABLE_NODE, &debug_ospf_ldp_sync_cmd);
+       install_element(ENABLE_NODE, &debug_ospf_client_api_cmd);
        install_element(ENABLE_NODE, &no_debug_ospf_ism_cmd);
        install_element(ENABLE_NODE, &no_debug_ospf_nsm_cmd);
        install_element(ENABLE_NODE, &no_debug_ospf_lsa_cmd);
@@ -2038,6 +2081,7 @@ void ospf_debug_init(void)
        install_element(ENABLE_NODE, &no_debug_ospf_ti_lfa_cmd);
        install_element(ENABLE_NODE, &no_debug_ospf_default_info_cmd);
        install_element(ENABLE_NODE, &no_debug_ospf_ldp_sync_cmd);
+       install_element(ENABLE_NODE, &no_debug_ospf_client_api_cmd);
        install_element(ENABLE_NODE, &debug_ospf_gr_cmd);
        install_element(ENABLE_NODE, &debug_ospf_bfd_cmd);
 
@@ -2072,6 +2116,7 @@ void ospf_debug_init(void)
        install_element(CONFIG_NODE, &debug_ospf_ti_lfa_cmd);
        install_element(CONFIG_NODE, &debug_ospf_default_info_cmd);
        install_element(CONFIG_NODE, &debug_ospf_ldp_sync_cmd);
+       install_element(CONFIG_NODE, &debug_ospf_client_api_cmd);
        install_element(CONFIG_NODE, &no_debug_ospf_nsm_cmd);
        install_element(CONFIG_NODE, &no_debug_ospf_lsa_cmd);
        install_element(CONFIG_NODE, &no_debug_ospf_zebra_cmd);
@@ -2082,6 +2127,7 @@ void ospf_debug_init(void)
        install_element(CONFIG_NODE, &no_debug_ospf_ti_lfa_cmd);
        install_element(CONFIG_NODE, &no_debug_ospf_default_info_cmd);
        install_element(CONFIG_NODE, &no_debug_ospf_ldp_sync_cmd);
+       install_element(CONFIG_NODE, &no_debug_ospf_client_api_cmd);
        install_element(CONFIG_NODE, &debug_ospf_gr_cmd);
        install_element(CONFIG_NODE, &debug_ospf_bfd_cmd);
 
index 58227d038e16e1b06253a5adde918f88b8d45f11..251be7c8d177f65f0ae83735f3a4995b01772371 100644 (file)
@@ -68,6 +68,8 @@
 
 #define OSPF_DEBUG_BFD_LIB 0x01
 
+#define OSPF_DEBUG_CLIENT_API 0x01
+
 /* Macro for setting debug option. */
 #define CONF_DEBUG_PACKET_ON(a, b)         conf_debug_ospf_packet[a] |= (b)
 #define CONF_DEBUG_PACKET_OFF(a, b)        conf_debug_ospf_packet[a] &= ~(b)
 
 #define IS_DEBUG_OSPF_LDP_SYNC IS_DEBUG_OSPF(ldp_sync, LDP_SYNC)
 #define IS_DEBUG_OSPF_GR IS_DEBUG_OSPF(gr, GR)
+#define IS_DEBUG_OSPF_CLIENT_API IS_DEBUG_OSPF(client_api, CLIENT_API)
 
 #define IS_CONF_DEBUG_OSPF_PACKET(a, b)                                        \
        (conf_debug_ospf_packet[a] & OSPF_DEBUG_##b)
@@ -142,6 +145,7 @@ extern unsigned long term_debug_ospf_defaultinfo;
 extern unsigned long term_debug_ospf_ldp_sync;
 extern unsigned long term_debug_ospf_gr;
 extern unsigned long term_debug_ospf_bfd;
+extern unsigned long term_debug_ospf_client_api;
 
 /* Message Strings. */
 extern char *ospf_lsa_type_str[];