]> git.proxmox.com Git - mirror_frr.git/blobdiff - zebra/debug.c
Merge pull request #5706 from mjstapp/fix_nh_debug_show
[mirror_frr.git] / zebra / debug.c
index 85be620bff0992c38bccbdd918b283fc8ce19485..16b1d0057b9eebf4ef0b6663e60a009b4974634d 100644 (file)
 #include "command.h"
 #include "debug.h"
 
+#ifndef VTYSH_EXTRACT_PL
+#include "zebra/debug_clippy.c"
+#endif
+
 /* For debug statement. */
 unsigned long zebra_debug_event;
 unsigned long zebra_debug_packet;
@@ -33,6 +37,9 @@ unsigned long zebra_debug_nht;
 unsigned long zebra_debug_mpls;
 unsigned long zebra_debug_vxlan;
 unsigned long zebra_debug_pw;
+unsigned long zebra_debug_dplane;
+unsigned long zebra_debug_mlag;
+unsigned long zebra_debug_nexthop;
 
 DEFINE_HOOK(zebra_debug_show_debugging, (struct vty *vty), (vty));
 
@@ -81,7 +88,9 @@ DEFUN_NOSH (show_debugging_zebra,
 
        if (IS_ZEBRA_DEBUG_FPM)
                vty_out(vty, "  Zebra FPM debugging is on\n");
-       if (IS_ZEBRA_DEBUG_NHT)
+       if (IS_ZEBRA_DEBUG_NHT_DETAILED)
+               vty_out(vty, "  Zebra detailed next-hop tracking debugging is on\n");
+       else if (IS_ZEBRA_DEBUG_NHT)
                vty_out(vty, "  Zebra next-hop tracking debugging is on\n");
        if (IS_ZEBRA_DEBUG_MPLS)
                vty_out(vty, "  Zebra MPLS debugging is on\n");
@@ -89,6 +98,16 @@ DEFUN_NOSH (show_debugging_zebra,
                vty_out(vty, "  Zebra VXLAN debugging is on\n");
        if (IS_ZEBRA_DEBUG_PW)
                vty_out(vty, "  Zebra pseudowire debugging is on\n");
+       if (IS_ZEBRA_DEBUG_DPLANE_DETAIL)
+               vty_out(vty, "  Zebra detailed dataplane debugging is on\n");
+       else if (IS_ZEBRA_DEBUG_DPLANE)
+               vty_out(vty, "  Zebra dataplane debugging is on\n");
+       if (IS_ZEBRA_DEBUG_MLAG)
+               vty_out(vty, "  Zebra mlag debugging is on\n");
+       if (IS_ZEBRA_DEBUG_NHG_DETAIL)
+               vty_out(vty, "  Zebra detailed nexthop debugging is on\n");
+       else if (IS_ZEBRA_DEBUG_NHG)
+               vty_out(vty, "  Zebra nexthop debugging is on\n");
 
        hook_call(zebra_debug_show_debugging, vty);
        return CMD_SUCCESS;
@@ -107,12 +126,19 @@ DEFUN (debug_zebra_events,
 
 DEFUN (debug_zebra_nht,
        debug_zebra_nht_cmd,
-       "debug zebra nht",
+       "debug zebra nht [detailed]",
        DEBUG_STR
        "Zebra configuration\n"
-       "Debug option set for zebra next hop tracking\n")
+       "Debug option set for zebra next hop tracking\n"
+       "Debug option set for detailed info\n")
 {
+       int idx = 0;
+
        zebra_debug_nht = ZEBRA_DEBUG_NHT;
+
+       if (argv_find(argv, argc, "detailed", &idx))
+               zebra_debug_nht |= ZEBRA_DEBUG_NHT_DETAILED;
+
        return CMD_SUCCESS;
 }
 
@@ -261,6 +287,39 @@ DEFUN (debug_zebra_fpm,
        return CMD_SUCCESS;
 }
 
+DEFUN (debug_zebra_dplane,
+       debug_zebra_dplane_cmd,
+       "debug zebra dplane [detailed]",
+       DEBUG_STR
+       "Zebra configuration\n"
+       "Debug zebra dataplane events\n"
+       "Detailed debug information\n")
+{
+       int idx = 0;
+
+       SET_FLAG(zebra_debug_dplane, ZEBRA_DEBUG_DPLANE);
+
+       if (argv_find(argv, argc, "detailed", &idx))
+               SET_FLAG(zebra_debug_dplane, ZEBRA_DEBUG_DPLANE_DETAILED);
+
+       return CMD_SUCCESS;
+}
+
+DEFPY (debug_zebra_mlag,
+       debug_zebra_mlag_cmd,
+       "[no$no] debug zebra mlag",
+       NO_STR
+       DEBUG_STR
+       "Zebra configuration\n"
+       "Debug option set for mlag events\n")
+{
+       if (no)
+               UNSET_FLAG(zebra_debug_mlag, ZEBRA_DEBUG_MLAG);
+       else
+               SET_FLAG(zebra_debug_mlag, ZEBRA_DEBUG_MLAG);
+       return CMD_SUCCESS;
+}
+
 DEFUN (no_debug_zebra_events,
        no_debug_zebra_events_cmd,
        "no debug zebra events",
@@ -275,11 +334,12 @@ DEFUN (no_debug_zebra_events,
 
 DEFUN (no_debug_zebra_nht,
        no_debug_zebra_nht_cmd,
-       "no debug zebra nht",
+       "no debug zebra nht [detailed]",
        NO_STR
        DEBUG_STR
        "Zebra configuration\n"
-       "Debug option set for zebra next hop tracking\n")
+       "Debug option set for zebra next hop tracking\n"
+       "Debug option set for detailed info\n")
 {
        zebra_debug_nht = 0;
        return CMD_SUCCESS;
@@ -376,6 +436,40 @@ DEFUN (no_debug_zebra_fpm,
        return CMD_SUCCESS;
 }
 
+DEFUN (no_debug_zebra_dplane,
+       no_debug_zebra_dplane_cmd,
+       "no debug zebra dplane",
+       NO_STR
+       DEBUG_STR
+       "Zebra configuration\n"
+       "Debug zebra dataplane events\n")
+{
+       zebra_debug_dplane = 0;
+       return CMD_SUCCESS;
+}
+
+DEFPY (debug_zebra_nexthop,
+       debug_zebra_nexthop_cmd,
+       "[no$no] debug zebra nexthop [detail$detail]",
+       NO_STR
+       DEBUG_STR
+       "Zebra configuration\n"
+       "Debug zebra nexthop events\n"
+       "Detailed information\n")
+{
+       if (no)
+               zebra_debug_nexthop = 0;
+       else {
+               SET_FLAG(zebra_debug_nexthop, ZEBRA_DEBUG_NHG);
+
+               if (detail)
+                       SET_FLAG(zebra_debug_nexthop,
+                                ZEBRA_DEBUG_NHG_DETAILED);
+       }
+
+       return CMD_SUCCESS;
+}
+
 /* Debug node. */
 struct cmd_node debug_node = {DEBUG_NODE, "", /* Debug node has no interface. */
                              1};
@@ -433,10 +527,15 @@ static int config_write_debug(struct vty *vty)
                vty_out(vty, "debug zebra fpm\n");
                write++;
        }
-       if (IS_ZEBRA_DEBUG_NHT) {
+
+       if (IS_ZEBRA_DEBUG_NHT_DETAILED) {
+               vty_out(vty, "debug zebra nht detailed\n");
+               write++;
+       } else if (IS_ZEBRA_DEBUG_NHT) {
                vty_out(vty, "debug zebra nht\n");
                write++;
        }
+
        if (IS_ZEBRA_DEBUG_MPLS) {
                vty_out(vty, "debug zebra mpls\n");
                write++;
@@ -449,6 +548,23 @@ static int config_write_debug(struct vty *vty)
                vty_out(vty, "debug zebra pseudowires\n");
                write++;
        }
+
+       if (CHECK_FLAG(zebra_debug_dplane, ZEBRA_DEBUG_DPLANE_DETAILED)) {
+               vty_out(vty, "debug zebra dplane detailed\n");
+               write++;
+       } else if (CHECK_FLAG(zebra_debug_dplane, ZEBRA_DEBUG_DPLANE)) {
+               vty_out(vty, "debug zebra dplane\n");
+               write++;
+       }
+
+       if (CHECK_FLAG(zebra_debug_nexthop, ZEBRA_DEBUG_NHG_DETAILED)) {
+               vty_out(vty, "debug zebra nexthop detail\n");
+               write++;
+       } else if (CHECK_FLAG(zebra_debug_nexthop, ZEBRA_DEBUG_NHG)) {
+               vty_out(vty, "debug zebra nexthop\n");
+               write++;
+       }
+
        return write;
 }
 
@@ -462,6 +578,10 @@ void zebra_debug_init(void)
        zebra_debug_mpls = 0;
        zebra_debug_vxlan = 0;
        zebra_debug_pw = 0;
+       zebra_debug_dplane = 0;
+       zebra_debug_mlag = 0;
+       zebra_debug_nht = 0;
+       zebra_debug_nexthop = 0;
 
        install_node(&debug_node, config_write_debug);
 
@@ -477,6 +597,9 @@ void zebra_debug_init(void)
        install_element(ENABLE_NODE, &debug_zebra_kernel_msgdump_cmd);
        install_element(ENABLE_NODE, &debug_zebra_rib_cmd);
        install_element(ENABLE_NODE, &debug_zebra_fpm_cmd);
+       install_element(ENABLE_NODE, &debug_zebra_dplane_cmd);
+       install_element(ENABLE_NODE, &debug_zebra_mlag_cmd);
+       install_element(ENABLE_NODE, &debug_zebra_nexthop_cmd);
        install_element(ENABLE_NODE, &no_debug_zebra_events_cmd);
        install_element(ENABLE_NODE, &no_debug_zebra_nht_cmd);
        install_element(ENABLE_NODE, &no_debug_zebra_mpls_cmd);
@@ -486,6 +609,7 @@ void zebra_debug_init(void)
        install_element(ENABLE_NODE, &no_debug_zebra_kernel_msgdump_cmd);
        install_element(ENABLE_NODE, &no_debug_zebra_rib_cmd);
        install_element(ENABLE_NODE, &no_debug_zebra_fpm_cmd);
+       install_element(ENABLE_NODE, &no_debug_zebra_dplane_cmd);
 
        install_element(CONFIG_NODE, &debug_zebra_events_cmd);
        install_element(CONFIG_NODE, &debug_zebra_nht_cmd);
@@ -497,6 +621,8 @@ void zebra_debug_init(void)
        install_element(CONFIG_NODE, &debug_zebra_kernel_msgdump_cmd);
        install_element(CONFIG_NODE, &debug_zebra_rib_cmd);
        install_element(CONFIG_NODE, &debug_zebra_fpm_cmd);
+       install_element(CONFIG_NODE, &debug_zebra_dplane_cmd);
+       install_element(CONFIG_NODE, &debug_zebra_nexthop_cmd);
        install_element(CONFIG_NODE, &no_debug_zebra_events_cmd);
        install_element(CONFIG_NODE, &no_debug_zebra_nht_cmd);
        install_element(CONFIG_NODE, &no_debug_zebra_mpls_cmd);
@@ -506,4 +632,5 @@ void zebra_debug_init(void)
        install_element(CONFIG_NODE, &no_debug_zebra_kernel_msgdump_cmd);
        install_element(CONFIG_NODE, &no_debug_zebra_rib_cmd);
        install_element(CONFIG_NODE, &no_debug_zebra_fpm_cmd);
+       install_element(CONFIG_NODE, &no_debug_zebra_dplane_cmd);
 }