diff options
| author | Christian Hopps <chopps@labn.net> | 2022-01-17 07:54:12 -0500 |
|---|---|---|
| committer | Christian Hopps <chopps@labn.net> | 2022-06-01 18:11:31 -0400 |
| commit | a6c39c3d1a2b1edf74c84c0a1b7b5a590f528626 (patch) | |
| tree | 98e6604855ddb2e1033aa0ca1cd7d536865deb71 | |
| parent | 97385dddf1e955a428dc3396fb535c592b1f8c79 (diff) | |
ospfd: cli: add client api debug option
Signed-off-by: Christian Hopps <chopps@labn.net>
| -rw-r--r-- | doc/user/ospfd.rst | 4 | ||||
| -rw-r--r-- | ospfd/ospf_dump.c | 46 | ||||
| -rw-r--r-- | ospfd/ospf_dump.h | 4 |
3 files changed, 54 insertions, 0 deletions
diff --git a/doc/user/ospfd.rst b/doc/user/ospfd.rst index d1a0bb6f7b..5db4d63eed 100644 --- a/doc/user/ospfd.rst +++ b/doc/user/ospfd.rst @@ -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] diff --git a/ospfd/ospf_dump.c b/ospfd/ospf_dump.c index f40d056742..4d76181c6a 100644 --- a/ospfd/ospf_dump.c +++ b/ospfd/ospf_dump.c @@ -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); diff --git a/ospfd/ospf_dump.h b/ospfd/ospf_dump.h index 58227d038e..251be7c8d1 100644 --- a/ospfd/ospf_dump.h +++ b/ospfd/ospf_dump.h @@ -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) @@ -118,6 +120,7 @@ #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[]; |
