[zebra] Add 'debug zebra rib' commands

2006-07-27 Paul Jakma <paul.jakma@sun.com>

	* debug.{c,h}: Add 'debug zebra rib' and 'debug zebra rib queue'.
diff --git a/zebra/debug.c b/zebra/debug.c
index 8575a66..23c4de3 100644
--- a/zebra/debug.c
+++ b/zebra/debug.c
@@ -28,6 +28,7 @@
 unsigned long zebra_debug_event;
 unsigned long zebra_debug_packet;
 unsigned long zebra_debug_kernel;
+unsigned long zebra_debug_rib;
 
 DEFUN (show_debugging_zebra,
        show_debugging_zebra_cmd,
@@ -65,6 +66,11 @@
   if (IS_ZEBRA_DEBUG_KERNEL)
     vty_out (vty, "  Zebra kernel debugging is on%s", VTY_NEWLINE);
 
+  if (IS_ZEBRA_DEBUG_RIB)
+    vty_out (vty, "  Zebra RIB debugging is on%s", VTY_NEWLINE);
+  if (IS_ZEBRA_DEBUG_RIB_Q)
+    vty_out (vty, "  Zebra RIB queue debugging is on%s", VTY_NEWLINE);
+
   return CMD_SUCCESS;
 }
 
@@ -140,6 +146,29 @@
   return CMD_SUCCESS;
 }
 
+DEFUN (debug_zebra_rib,
+       debug_zebra_rib_cmd,
+       "debug zebra rib",
+       DEBUG_STR
+       "Zebra configuration\n"
+       "Debug RIB events\n")
+{
+  SET_FLAG (zebra_debug_rib, ZEBRA_DEBUG_RIB);
+  return CMD_SUCCESS;
+}
+
+DEFUN (debug_zebra_rib_q,
+       debug_zebra_rib_q_cmd,
+       "debug zebra rib queue",
+       DEBUG_STR
+       "Zebra configuration\n"
+       "Debug RIB events\n"
+       "Debug RIB queueing\n")
+{
+  SET_FLAG (zebra_debug_rib, ZEBRA_DEBUG_RIB_Q);
+  return CMD_SUCCESS;
+}
+
 DEFUN (no_debug_zebra_events,
        no_debug_zebra_events_cmd,
        "no debug zebra events",
@@ -193,6 +222,31 @@
   return CMD_SUCCESS;
 }
 
+DEFUN (no_debug_zebra_rib,
+       no_debug_zebra_rib_cmd,
+       "no debug zebra rib",
+       NO_STR
+       DEBUG_STR
+       "Zebra configuration\n"
+       "Debug zebra RIB\n")
+{
+  zebra_debug_rib = 0;
+  return CMD_SUCCESS;
+}
+
+DEFUN (no_debug_zebra_rib_q,
+       no_debug_zebra_rib_q_cmd,
+       "no debug zebra rib queueu",
+       NO_STR
+       DEBUG_STR
+       "Zebra configuration\n"
+       "Debug zebra RIB\n"
+       "Debug RIB queueing\n")
+{
+  UNSET_FLAG (zebra_debug_rib, ZEBRA_DEBUG_RIB_Q);
+  return CMD_SUCCESS;
+}
+
 /* Debug node. */
 struct cmd_node debug_node =
 {
@@ -238,6 +292,16 @@
       vty_out (vty, "debug zebra kernel%s", VTY_NEWLINE);
       write++;
     }
+  if (IS_ZEBRA_DEBUG_RIB)
+    {
+      vty_out (vty, "debug zebra rib%s", VTY_NEWLINE);
+      write++;
+    }
+  if (IS_ZEBRA_DEBUG_RIB_Q)
+    {
+      vty_out (vty, "debug zebra rib queue%s", VTY_NEWLINE);
+      write++;
+    }
   return write;
 }
 
@@ -246,6 +310,8 @@
 {
   zebra_debug_event = 0;
   zebra_debug_packet = 0;
+  zebra_debug_kernel = 0;
+  zebra_debug_rib = 0;
 
   install_node (&debug_node, config_write_debug);
 
@@ -257,16 +323,24 @@
   install_element (ENABLE_NODE, &debug_zebra_packet_direct_cmd);
   install_element (ENABLE_NODE, &debug_zebra_packet_detail_cmd);
   install_element (ENABLE_NODE, &debug_zebra_kernel_cmd);
+  install_element (ENABLE_NODE, &debug_zebra_rib_cmd);
+  install_element (ENABLE_NODE, &debug_zebra_rib_q_cmd);
   install_element (ENABLE_NODE, &no_debug_zebra_events_cmd);
   install_element (ENABLE_NODE, &no_debug_zebra_packet_cmd);
   install_element (ENABLE_NODE, &no_debug_zebra_kernel_cmd);
+  install_element (ENABLE_NODE, &no_debug_zebra_rib_cmd);
+  install_element (ENABLE_NODE, &no_debug_zebra_rib_q_cmd);
 
   install_element (CONFIG_NODE, &debug_zebra_events_cmd);
   install_element (CONFIG_NODE, &debug_zebra_packet_cmd);
   install_element (CONFIG_NODE, &debug_zebra_packet_direct_cmd);
   install_element (CONFIG_NODE, &debug_zebra_packet_detail_cmd);
   install_element (CONFIG_NODE, &debug_zebra_kernel_cmd);
+  install_element (CONFIG_NODE, &debug_zebra_rib_cmd);
+  install_element (CONFIG_NODE, &debug_zebra_rib_q_cmd);
   install_element (CONFIG_NODE, &no_debug_zebra_events_cmd);
   install_element (CONFIG_NODE, &no_debug_zebra_packet_cmd);
   install_element (CONFIG_NODE, &no_debug_zebra_kernel_cmd);
+  install_element (CONFIG_NODE, &no_debug_zebra_rib_cmd);
+  install_element (CONFIG_NODE, &no_debug_zebra_rib_q_cmd);
 }