]> git.proxmox.com Git - mirror_frr.git/blobdiff - ripngd/ripng_debug.c
zebra: Allow ns delete to happen after under/over flow checks
[mirror_frr.git] / ripngd / ripng_debug.c
index 9ba0e10e46183c180fc6f356dbadc1f8cb9edba1..c56ff126271bcbb0d06a0d9ac0c094e7e3ca837c 100644 (file)
@@ -28,37 +28,35 @@ unsigned long ripng_debug_event = 0;
 unsigned long ripng_debug_packet = 0;
 unsigned long ripng_debug_zebra = 0;
 
-DEFUN (show_debugging_ripng,
-       show_debugging_ripng_cmd,
-       "show debugging ripng",
-       SHOW_STR
-       DEBUG_STR
-       "RIPng configuration\n")
+DEFUN_NOSH (show_debugging_ripng,
+           show_debugging_ripng_cmd,
+           "show debugging [ripng]",
+           SHOW_STR
+           DEBUG_STR
+           "RIPng configuration\n")
 {
-  vty_outln (vty, "RIPng debugging status:");
-
-  if (IS_RIPNG_DEBUG_EVENT)
-    vty_outln (vty, "  RIPng event debugging is on");
-
-  if (IS_RIPNG_DEBUG_PACKET)
-    {
-      if (IS_RIPNG_DEBUG_SEND && IS_RIPNG_DEBUG_RECV)
-       {
-         vty_outln (vty,"  RIPng packet debugging is on");
-       }
-      else
-       {
-         if (IS_RIPNG_DEBUG_SEND)
-           vty_outln (vty,"  RIPng packet send debugging is on");
-         else
-           vty_outln (vty,"  RIPng packet receive debugging is on");
+       vty_out(vty, "RIPng debugging status:\n");
+
+       if (IS_RIPNG_DEBUG_EVENT)
+               vty_out(vty, "  RIPng event debugging is on\n");
+
+       if (IS_RIPNG_DEBUG_PACKET) {
+               if (IS_RIPNG_DEBUG_SEND && IS_RIPNG_DEBUG_RECV) {
+                       vty_out(vty, "  RIPng packet debugging is on\n");
+               } else {
+                       if (IS_RIPNG_DEBUG_SEND)
+                               vty_out(vty,
+                                       "  RIPng packet send debugging is on\n");
+                       else
+                               vty_out(vty,
+                                       "  RIPng packet receive debugging is on\n");
+               }
        }
-    }
 
-  if (IS_RIPNG_DEBUG_ZEBRA)
-    vty_outln (vty, "  RIPng zebra debugging is on");
+       if (IS_RIPNG_DEBUG_ZEBRA)
+               vty_out(vty, "  RIPng zebra debugging is on\n");
 
-  return CMD_SUCCESS;
+       return CMD_SUCCESS;
 }
 
 DEFUN (debug_ripng_events,
@@ -68,8 +66,8 @@ DEFUN (debug_ripng_events,
        "RIPng configuration\n"
        "Debug option set for ripng events\n")
 {
-  ripng_debug_event = RIPNG_DEBUG_EVENT;
-  return CMD_WARNING;
+       ripng_debug_event = RIPNG_DEBUG_EVENT;
+       return CMD_SUCCESS;
 }
 
 DEFUN (debug_ripng_packet,
@@ -79,10 +77,10 @@ DEFUN (debug_ripng_packet,
        "RIPng configuration\n"
        "Debug option set for ripng packet\n")
 {
-  ripng_debug_packet = RIPNG_DEBUG_PACKET;
-  ripng_debug_packet |= RIPNG_DEBUG_SEND;
-  ripng_debug_packet |= RIPNG_DEBUG_RECV;
-  return CMD_SUCCESS;
+       ripng_debug_packet = RIPNG_DEBUG_PACKET;
+       ripng_debug_packet |= RIPNG_DEBUG_SEND;
+       ripng_debug_packet |= RIPNG_DEBUG_RECV;
+       return CMD_SUCCESS;
 }
 
 DEFUN (debug_ripng_packet_direct,
@@ -94,14 +92,14 @@ DEFUN (debug_ripng_packet_direct,
        "Debug option set for receive packet\n"
        "Debug option set for send packet\n")
 {
-  int idx_recv_send = 3;
-  ripng_debug_packet |= RIPNG_DEBUG_PACKET;
-  if (strncmp ("send", argv[idx_recv_send]->arg, strlen (argv[idx_recv_send]->arg)) == 0)
-    ripng_debug_packet |= RIPNG_DEBUG_SEND;
-  if (strncmp ("recv", argv[idx_recv_send]->arg, strlen (argv[idx_recv_send]->arg)) == 0)
-    ripng_debug_packet |= RIPNG_DEBUG_RECV;
-
-  return CMD_SUCCESS;
+       int idx_recv_send = 3;
+       ripng_debug_packet |= RIPNG_DEBUG_PACKET;
+       if (strcmp("send", argv[idx_recv_send]->text) == 0)
+               ripng_debug_packet |= RIPNG_DEBUG_SEND;
+       if (strcmp("recv", argv[idx_recv_send]->text) == 0)
+               ripng_debug_packet |= RIPNG_DEBUG_RECV;
+
+       return CMD_SUCCESS;
 }
 
 DEFUN (debug_ripng_zebra,
@@ -111,8 +109,8 @@ DEFUN (debug_ripng_zebra,
        "RIPng configuration\n"
        "Debug option set for ripng and zebra communication\n")
 {
-  ripng_debug_zebra = RIPNG_DEBUG_ZEBRA;
-  return CMD_WARNING;
+       ripng_debug_zebra = RIPNG_DEBUG_ZEBRA;
+       return CMD_SUCCESS;
 }
 
 DEFUN (no_debug_ripng_events,
@@ -123,8 +121,8 @@ DEFUN (no_debug_ripng_events,
        "RIPng configuration\n"
        "Debug option set for ripng events\n")
 {
-  ripng_debug_event = 0;
-  return CMD_SUCCESS;
+       ripng_debug_event = 0;
+       return CMD_SUCCESS;
 }
 
 DEFUN (no_debug_ripng_packet,
@@ -135,8 +133,8 @@ DEFUN (no_debug_ripng_packet,
        "RIPng configuration\n"
        "Debug option set for ripng packet\n")
 {
-  ripng_debug_packet = 0;
-  return CMD_SUCCESS;
+       ripng_debug_packet = 0;
+       return CMD_SUCCESS;
 }
 
 DEFUN (no_debug_ripng_packet_direct,
@@ -149,22 +147,19 @@ DEFUN (no_debug_ripng_packet_direct,
        "Debug option set for receive packet\n"
        "Debug option set for send packet\n")
 {
-  int idx_recv_send = 4;
-  if (strncmp ("send", argv[idx_recv_send]->arg, strlen (argv[idx_recv_send]->arg)) == 0)
-    {
-      if (IS_RIPNG_DEBUG_RECV)
-       ripng_debug_packet &= ~RIPNG_DEBUG_SEND;
-      else
-       ripng_debug_packet = 0;
-    }
-  else if (strncmp ("recv", argv[idx_recv_send]->arg, strlen (argv[idx_recv_send]->arg)) == 0)
-    {
-      if (IS_RIPNG_DEBUG_SEND)
-       ripng_debug_packet &= ~RIPNG_DEBUG_RECV;
-      else
-       ripng_debug_packet = 0;
-    }
-  return CMD_SUCCESS;
+       int idx_recv_send = 4;
+       if (strcmp("send", argv[idx_recv_send]->text) == 0) {
+               if (IS_RIPNG_DEBUG_RECV)
+                       ripng_debug_packet &= ~RIPNG_DEBUG_SEND;
+               else
+                       ripng_debug_packet = 0;
+       } else if (strcmp("recv", argv[idx_recv_send]->text) == 0) {
+               if (IS_RIPNG_DEBUG_SEND)
+                       ripng_debug_packet &= ~RIPNG_DEBUG_RECV;
+               else
+                       ripng_debug_packet = 0;
+       }
+       return CMD_SUCCESS;
 }
 
 DEFUN (no_debug_ripng_zebra,
@@ -175,86 +170,68 @@ DEFUN (no_debug_ripng_zebra,
        "RIPng configuration\n"
        "Debug option set for ripng and zebra communication\n")
 {
-  ripng_debug_zebra = 0;
-  return CMD_WARNING;
+       ripng_debug_zebra = 0;
+       return CMD_SUCCESS;
 }
 
 /* Debug node. */
-static struct cmd_node debug_node =
-{
-  DEBUG_NODE,
-  "",                          /* Debug node has no interface. */
-  1 /* VTYSH */
+static struct cmd_node debug_node = {
+       DEBUG_NODE, "", /* Debug node has no interface. */
+       1               /* VTYSH */
 };
 
-static int
-config_write_debug (struct vty *vty)
+static int config_write_debug(struct vty *vty)
 {
-  int write = 0;
+       int write = 0;
 
-  if (IS_RIPNG_DEBUG_EVENT)
-    {
-      vty_outln (vty, "debug ripng events");
-      write++;
-    }
-  if (IS_RIPNG_DEBUG_PACKET)
-    {
-      if (IS_RIPNG_DEBUG_SEND && IS_RIPNG_DEBUG_RECV)
-       {
-         vty_outln (vty,"debug ripng packet");
-         write++;
+       if (IS_RIPNG_DEBUG_EVENT) {
+               vty_out(vty, "debug ripng events\n");
+               write++;
        }
-      else
-       {
-         if (IS_RIPNG_DEBUG_SEND)
-           vty_outln (vty,"debug ripng packet send");
-         else
-           vty_outln (vty,"debug ripng packet recv");
-         write++;
+       if (IS_RIPNG_DEBUG_PACKET) {
+               if (IS_RIPNG_DEBUG_SEND && IS_RIPNG_DEBUG_RECV) {
+                       vty_out(vty, "debug ripng packet\n");
+                       write++;
+               } else {
+                       if (IS_RIPNG_DEBUG_SEND)
+                               vty_out(vty, "debug ripng packet send\n");
+                       else
+                               vty_out(vty, "debug ripng packet recv\n");
+                       write++;
+               }
        }
-    }
-  if (IS_RIPNG_DEBUG_ZEBRA)
-    {
-      vty_outln (vty, "debug ripng zebra");
-      write++;
-    }
-  return write;
-}
-
-void
-ripng_debug_reset ()
-{
-  ripng_debug_event = 0;
-  ripng_debug_packet = 0;
-  ripng_debug_zebra = 0;
+       if (IS_RIPNG_DEBUG_ZEBRA) {
+               vty_out(vty, "debug ripng zebra\n");
+               write++;
+       }
+       return write;
 }
 
-void
-ripng_debug_init ()
+void ripng_debug_init()
 {
-  ripng_debug_event = 0;
-  ripng_debug_packet = 0;
-  ripng_debug_zebra = 0;
-
-  install_node (&debug_node, config_write_debug);
-
-  install_element (VIEW_NODE, &show_debugging_ripng_cmd);
-
-  install_element (ENABLE_NODE, &debug_ripng_events_cmd);
-  install_element (ENABLE_NODE, &debug_ripng_packet_cmd);
-  install_element (ENABLE_NODE, &debug_ripng_packet_direct_cmd);
-  install_element (ENABLE_NODE, &debug_ripng_zebra_cmd);
-  install_element (ENABLE_NODE, &no_debug_ripng_events_cmd);
-  install_element (ENABLE_NODE, &no_debug_ripng_packet_cmd);
-  install_element (ENABLE_NODE, &no_debug_ripng_packet_direct_cmd);
-  install_element (ENABLE_NODE, &no_debug_ripng_zebra_cmd);
-
-  install_element (CONFIG_NODE, &debug_ripng_events_cmd);
-  install_element (CONFIG_NODE, &debug_ripng_packet_cmd);
-  install_element (CONFIG_NODE, &debug_ripng_packet_direct_cmd);
-  install_element (CONFIG_NODE, &debug_ripng_zebra_cmd);
-  install_element (CONFIG_NODE, &no_debug_ripng_events_cmd);
-  install_element (CONFIG_NODE, &no_debug_ripng_packet_cmd);
-  install_element (CONFIG_NODE, &no_debug_ripng_packet_direct_cmd);
-  install_element (CONFIG_NODE, &no_debug_ripng_zebra_cmd);
+       ripng_debug_event = 0;
+       ripng_debug_packet = 0;
+       ripng_debug_zebra = 0;
+
+       install_node(&debug_node, config_write_debug);
+
+       install_element(VIEW_NODE, &show_debugging_ripng_cmd);
+
+       install_element(ENABLE_NODE, &debug_ripng_events_cmd);
+       install_element(ENABLE_NODE, &debug_ripng_packet_cmd);
+       install_element(ENABLE_NODE, &debug_ripng_packet_direct_cmd);
+       install_element(ENABLE_NODE, &debug_ripng_zebra_cmd);
+       install_element(ENABLE_NODE, &no_debug_ripng_events_cmd);
+       install_element(ENABLE_NODE, &no_debug_ripng_packet_cmd);
+       install_element(ENABLE_NODE, &no_debug_ripng_packet_direct_cmd);
+       install_element(ENABLE_NODE, &no_debug_ripng_zebra_cmd);
+
+       install_element(CONFIG_NODE, &debug_ripng_events_cmd);
+       install_element(CONFIG_NODE, &debug_ripng_packet_cmd);
+       install_element(CONFIG_NODE, &debug_ripng_packet_direct_cmd);
+       install_element(CONFIG_NODE, &debug_ripng_zebra_cmd);
+       install_element(CONFIG_NODE, &no_debug_ripng_events_cmd);
+       install_element(CONFIG_NODE, &no_debug_ripng_packet_cmd);
+       install_element(CONFIG_NODE, &no_debug_ripng_packet_direct_cmd);
+       install_element(CONFIG_NODE, &no_debug_ripng_zebra_cmd);
 }