diff options
Diffstat (limited to 'ospfd/ospf_dump.c')
| -rw-r--r-- | ospfd/ospf_dump.c | 114 |
1 files changed, 73 insertions, 41 deletions
diff --git a/ospfd/ospf_dump.c b/ospfd/ospf_dump.c index b98852eeee..2442f2e781 100644 --- a/ospfd/ospf_dump.c +++ b/ospfd/ospf_dump.c @@ -21,6 +21,7 @@ #include <zebra.h> +#include "lib/bfd.h" #include "monotime.h" #include "linklist.h" #include "thread.h" @@ -60,6 +61,7 @@ unsigned long conf_debug_ospf_ti_lfa = 0; 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; /* Enable debug option variables -- valid only session. */ unsigned long term_debug_ospf_packet[5] = {0, 0, 0, 0, 0}; @@ -76,6 +78,7 @@ unsigned long term_debug_ospf_ti_lfa = 0; 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; const char *ospf_redist_string(unsigned int route_type) { @@ -616,7 +619,7 @@ DEFUN (debug_ospf_packet, if (inst) // user passed instance ID { - if (!ospf_lookup_instance(strtoul(argv[2]->arg, NULL, 10))) + if (inst != ospf_instance) return CMD_NOT_MY_INSTANCE; } @@ -692,7 +695,7 @@ DEFUN (no_debug_ospf_packet, if (inst) // user passed instance ID { - if (!ospf_lookup_instance(strtoul(argv[3]->arg, NULL, 10))) + if (inst != ospf_instance) return CMD_NOT_MY_INSTANCE; } @@ -763,7 +766,7 @@ DEFUN (debug_ospf_ism, if (inst) // user passed instance ID { - if (!ospf_lookup_instance(strtoul(argv[2]->arg, NULL, 10))) + if (inst != ospf_instance) return CMD_NOT_MY_INSTANCE; } @@ -814,7 +817,7 @@ DEFUN (no_debug_ospf_ism, if (inst) // user passed instance ID { - if (!ospf_lookup_instance(strtoul(argv[3]->arg, NULL, 10))) + if (inst != ospf_instance) return CMD_NOT_MY_INSTANCE; } @@ -909,8 +912,8 @@ DEFUN (debug_ospf_instance_nsm, unsigned short instance = 0; instance = strtoul(argv[idx_number]->arg, NULL, 10); - if (!ospf_lookup_instance(instance)) - return CMD_SUCCESS; + if (instance != ospf_instance) + return CMD_NOT_MY_INSTANCE; return debug_ospf_nsm_common(vty, 4, argc, argv); } @@ -981,7 +984,7 @@ DEFUN (no_debug_ospf_instance_nsm, unsigned short instance = 0; instance = strtoul(argv[idx_number]->arg, NULL, 10); - if (!ospf_lookup_instance(instance)) + if (instance != ospf_instance) return CMD_NOT_MY_INSTANCE; return no_debug_ospf_nsm_common(vty, 5, argc, argv); @@ -1062,7 +1065,7 @@ DEFUN (debug_ospf_instance_lsa, unsigned short instance = 0; instance = strtoul(argv[idx_number]->arg, NULL, 10); - if (!ospf_lookup_instance(instance)) + if (instance != ospf_instance) return CMD_NOT_MY_INSTANCE; return debug_ospf_lsa_common(vty, 4, argc, argv); @@ -1145,7 +1148,7 @@ DEFUN (no_debug_ospf_instance_lsa, unsigned short instance = 0; instance = strtoul(argv[idx_number]->arg, NULL, 10); - if (!ospf_lookup_instance(instance)) + if (instance != ospf_instance) return CMD_NOT_MY_INSTANCE; return no_debug_ospf_lsa_common(vty, 5, argc, argv); @@ -1207,7 +1210,7 @@ DEFUN (debug_ospf_instance_zebra, unsigned short instance = 0; instance = strtoul(argv[idx_number]->arg, NULL, 10); - if (!ospf_lookup_instance(instance)) + if (instance != ospf_instance) return CMD_NOT_MY_INSTANCE; return debug_ospf_zebra_common(vty, 4, argc, argv); @@ -1271,8 +1274,8 @@ DEFUN (no_debug_ospf_instance_zebra, unsigned short instance = 0; instance = strtoul(argv[idx_number]->arg, NULL, 10); - if (!ospf_lookup_instance(instance)) - return CMD_SUCCESS; + if (instance != ospf_instance) + return CMD_NOT_MY_INSTANCE; return no_debug_ospf_zebra_common(vty, 5, argc, argv); } @@ -1317,8 +1320,8 @@ DEFUN (debug_ospf_instance_event, unsigned short instance = 0; instance = strtoul(argv[idx_number]->arg, NULL, 10); - if (!ospf_lookup_instance(instance)) - return CMD_SUCCESS; + if (instance != ospf_instance) + return CMD_NOT_MY_INSTANCE; if (vty->node == CONFIG_NODE) CONF_DEBUG_ON(event, EVENT); @@ -1339,8 +1342,8 @@ DEFUN (no_debug_ospf_instance_event, unsigned short instance = 0; instance = strtoul(argv[idx_number]->arg, NULL, 10); - if (!ospf_lookup_instance(instance)) - return CMD_SUCCESS; + if (instance != ospf_instance) + return CMD_NOT_MY_INSTANCE; if (vty->node == CONFIG_NODE) CONF_DEBUG_OFF(event, EVENT); @@ -1387,8 +1390,8 @@ DEFUN (debug_ospf_instance_nssa, unsigned short instance = 0; instance = strtoul(argv[idx_number]->arg, NULL, 10); - if (!ospf_lookup_instance(instance)) - return CMD_SUCCESS; + if (instance != ospf_instance) + return CMD_NOT_MY_INSTANCE; if (vty->node == CONFIG_NODE) CONF_DEBUG_ON(nssa, NSSA); @@ -1409,8 +1412,8 @@ DEFUN (no_debug_ospf_instance_nssa, unsigned short instance = 0; instance = strtoul(argv[idx_number]->arg, NULL, 10); - if (!ospf_lookup_instance(instance)) - return CMD_SUCCESS; + if (instance != ospf_instance) + return CMD_NOT_MY_INSTANCE; if (vty->node == CONFIG_NODE) CONF_DEBUG_OFF(nssa, NSSA); @@ -1563,6 +1566,31 @@ DEFPY (debug_ospf_gr, return CMD_SUCCESS; } +DEFPY(debug_ospf_bfd, debug_ospf_bfd_cmd, + "[no] debug ospf bfd", + NO_STR + DEBUG_STR + OSPF_STR + "Bidirection Forwarding Detection\n") +{ + if (vty->node == CONFIG_NODE) { + if (no) { + bfd_protocol_integration_set_debug(false); + CONF_DEBUG_OFF(bfd, BFD_LIB); + } else { + bfd_protocol_integration_set_debug(true); + CONF_DEBUG_ON(bfd, BFD_LIB); + } + } + + if (no) + TERM_DEBUG_OFF(bfd, BFD_LIB); + else + TERM_DEBUG_ON(bfd, BFD_LIB); + + return CMD_SUCCESS; +} + DEFUN (no_debug_ospf, no_debug_ospf_cmd, "no debug ospf", @@ -1594,6 +1622,10 @@ DEFUN (no_debug_ospf, DEBUG_OFF(defaultinfo, DEFAULTINFO); DEBUG_OFF(ldp_sync, LDP_SYNC); + /* BFD debugging is two parts: OSPF and library. */ + DEBUG_OFF(bfd, BFD_LIB); + bfd_protocol_integration_set_debug(false); + for (i = 0; i < 5; i++) DEBUG_PACKET_OFF(i, flag); } @@ -1621,16 +1653,17 @@ DEFUN (no_debug_ospf, TERM_DEBUG_OFF(zebra, ZEBRA_REDISTRIBUTE); TERM_DEBUG_OFF(defaultinfo, DEFAULTINFO); TERM_DEBUG_OFF(ldp_sync, LDP_SYNC); + TERM_DEBUG_OFF(bfd, BFD_LIB); return CMD_SUCCESS; } -static int show_debugging_ospf_common(struct vty *vty, struct ospf *ospf) +static int show_debugging_ospf_common(struct vty *vty) { int i; - if (ospf->instance) - vty_out(vty, "\nOSPF Instance: %d\n\n", ospf->instance); + if (ospf_instance) + vty_out(vty, "\nOSPF Instance: %d\n\n", ospf_instance); vty_out(vty, "OSPF debugging status:\n"); @@ -1730,6 +1763,10 @@ static int show_debugging_ospf_common(struct vty *vty, struct ospf *ospf) if (IS_DEBUG_OSPF(gr, GR_HELPER) == OSPF_DEBUG_GR_HELPER) vty_out(vty, " OSPF Graceful Restart Helper debugging is on\n"); + if (IS_DEBUG_OSPF(bfd, BFD_LIB) == OSPF_DEBUG_BFD_LIB) + vty_out(vty, + " OSPF BFD integration library debugging is on\n"); + vty_out(vty, "\n"); return CMD_SUCCESS; @@ -1742,13 +1779,7 @@ DEFUN_NOSH (show_debugging_ospf, DEBUG_STR OSPF_STR) { - struct ospf *ospf = NULL; - - ospf = ospf_lookup_by_vrf_id(VRF_DEFAULT); - if (ospf == NULL) - return CMD_SUCCESS; - - return show_debugging_ospf_common(vty, ospf); + return show_debugging_ospf_common(vty); } DEFUN_NOSH (show_debugging_ospf_instance, @@ -1760,14 +1791,13 @@ DEFUN_NOSH (show_debugging_ospf_instance, "Instance ID\n") { int idx_number = 3; - struct ospf *ospf; unsigned short instance = 0; instance = strtoul(argv[idx_number]->arg, NULL, 10); - if ((ospf = ospf_lookup_instance(instance)) == NULL) - return CMD_SUCCESS; + if (instance != ospf_instance) + return CMD_NOT_MY_INSTANCE; - return show_debugging_ospf_common(vty, ospf); + return show_debugging_ospf_common(vty); } static int config_write_debug(struct vty *vty); @@ -1790,16 +1820,11 @@ static int config_write_debug(struct vty *vty) "", " send", " recv", "", " detail", " send detail", " recv detail", " detail"}; - struct ospf *ospf; char str[16]; memset(str, 0, 16); - ospf = ospf_lookup_by_vrf_id(VRF_DEFAULT); - if (ospf == NULL) - return CMD_SUCCESS; - - if (ospf->instance) - snprintf(str, sizeof(str), " %u", ospf->instance); + if (ospf_instance) + snprintf(str, sizeof(str), " %u", ospf_instance); /* debug ospf ism (status|events|timers). */ if (IS_CONF_DEBUG_OSPF(ism, ISM) == OSPF_DEBUG_ISM) @@ -1929,6 +1954,11 @@ static int config_write_debug(struct vty *vty) write = 1; } + if (IS_CONF_DEBUG_OSPF(bfd, BFD_LIB) == OSPF_DEBUG_BFD_LIB) { + vty_out(vty, "debug ospf%s bfd\n", str); + write = 1; + } + return write; } @@ -1961,6 +1991,7 @@ void ospf_debug_init(void) install_element(ENABLE_NODE, &no_debug_ospf_default_info_cmd); install_element(ENABLE_NODE, &no_debug_ospf_ldp_sync_cmd); install_element(ENABLE_NODE, &debug_ospf_gr_cmd); + install_element(ENABLE_NODE, &debug_ospf_bfd_cmd); install_element(ENABLE_NODE, &show_debugging_ospf_instance_cmd); install_element(ENABLE_NODE, &debug_ospf_packet_cmd); @@ -2004,6 +2035,7 @@ void ospf_debug_init(void) install_element(CONFIG_NODE, &no_debug_ospf_default_info_cmd); install_element(CONFIG_NODE, &no_debug_ospf_ldp_sync_cmd); install_element(CONFIG_NODE, &debug_ospf_gr_cmd); + install_element(CONFIG_NODE, &debug_ospf_bfd_cmd); install_element(CONFIG_NODE, &debug_ospf_instance_nsm_cmd); install_element(CONFIG_NODE, &debug_ospf_instance_lsa_cmd); |
