Browse Source

pimd: Addition of Hello & Join-Prune message debug commands

Separate "debug pim packets hello and Join-Prune" added to enable hello
and Join-Prune debugs specifically
Balaji.G 5 years ago
parent
commit
ed14fa0075
5 changed files with 68 additions and 5 deletions
  1. 55 2
      pimd/pim_cmd.c
  2. 2 0
      pimd/pim_cmd.h
  3. 2 2
      pimd/pim_hello.c
  4. 1 1
      pimd/pim_pim.c
  5. 8 0
      pimd/pimd.h

+ 55 - 2
pimd/pim_cmd.c

@@ -3302,7 +3302,30 @@ DEFUN (debug_pim_packets,
        DEBUG_PIM_STR
        DEBUG_PIM_PACKETS_STR)
 {
-  PIM_DO_DEBUG_PIM_PACKETS;
+    PIM_DO_DEBUG_PIM_PACKETS;
+    vty_out (vty, "PIM Packet debugging is on %s", VTY_NEWLINE);
+    return CMD_SUCCESS;
+}
+
+DEFUN (debug_pim_packets_filter,
+       debug_pim_packets_filter_cmd,
+       "debug pim packets (hello|joins)",
+       DEBUG_STR
+       DEBUG_PIM_STR
+       DEBUG_PIM_PACKETS_STR
+       DEBUG_PIM_HELLO_PACKETS_STR
+       DEBUG_PIM_J_P_PACKETS_STR)
+{
+    if (strncmp(argv[0],"h",1) == 0) 
+    {
+      PIM_DO_DEBUG_PIM_HELLO;
+      vty_out (vty, "PIM Hello debugging is on %s", VTY_NEWLINE);
+    }
+    else if (strncmp(argv[0],"j",1) == 0)
+    {
+      PIM_DO_DEBUG_PIM_J_P;
+      vty_out (vty, "PIM Join/Prune debugging is on %s", VTY_NEWLINE);
+    }
   return CMD_SUCCESS;
 }
 
@@ -3312,12 +3335,38 @@ DEFUN (no_debug_pim_packets,
        NO_STR
        DEBUG_STR
        DEBUG_PIM_STR
-       DEBUG_PIM_PACKETS_STR)
+       DEBUG_PIM_PACKETS_STR
+       DEBUG_PIM_HELLO_PACKETS_STR
+       DEBUG_PIM_J_P_PACKETS_STR)
 {
   PIM_DONT_DEBUG_PIM_PACKETS;
+  vty_out (vty, "PIM Packet debugging is off %s", VTY_NEWLINE);
   return CMD_SUCCESS;
 }
 
+DEFUN (no_debug_pim_packets_filter,
+       no_debug_pim_packets_filter_cmd,
+       "no debug pim packets (hello|joins)",
+       NO_STR
+       DEBUG_STR
+       DEBUG_PIM_STR
+       DEBUG_PIM_PACKETS_STR
+       DEBUG_PIM_HELLO_PACKETS_STR
+       DEBUG_PIM_J_P_PACKETS_STR)
+{
+    if (strncmp(argv[0],"h",1) == 0) 
+    {
+      PIM_DONT_DEBUG_PIM_HELLO;
+      vty_out (vty, "PIM Hello debugging is off %s", VTY_NEWLINE);
+    }
+    else if (strncmp(argv[0],"j",1) == 0)
+    {
+      PIM_DONT_DEBUG_PIM_J_P;
+      vty_out (vty, "PIM Join/Prune debugging is off %s", VTY_NEWLINE);
+    }
+    return CMD_SUCCESS;
+}
+
 ALIAS (no_debug_pim_packets,
        undebug_pim_packets_cmd,
        "undebug pim packets",
@@ -4406,7 +4455,9 @@ void pim_cmd_init()
   install_element (ENABLE_NODE, &no_debug_pim_events_cmd);
   install_element (ENABLE_NODE, &undebug_pim_events_cmd);
   install_element (ENABLE_NODE, &debug_pim_packets_cmd);
+  install_element (ENABLE_NODE, &debug_pim_packets_filter_cmd);
   install_element (ENABLE_NODE, &no_debug_pim_packets_cmd);
+  install_element (ENABLE_NODE, &no_debug_pim_packets_filter_cmd);
   install_element (ENABLE_NODE, &undebug_pim_packets_cmd);
   install_element (ENABLE_NODE, &debug_pim_packetdump_send_cmd);
   install_element (ENABLE_NODE, &no_debug_pim_packetdump_send_cmd);
@@ -4445,7 +4496,9 @@ void pim_cmd_init()
   install_element (CONFIG_NODE, &no_debug_pim_events_cmd);
   install_element (CONFIG_NODE, &undebug_pim_events_cmd);
   install_element (CONFIG_NODE, &debug_pim_packets_cmd);
+  install_element (CONFIG_NODE, &debug_pim_packets_filter_cmd);
   install_element (CONFIG_NODE, &no_debug_pim_packets_cmd);
+  install_element (CONFIG_NODE, &no_debug_pim_packets_filter_cmd);
   install_element (CONFIG_NODE, &undebug_pim_packets_cmd);
   install_element (CONFIG_NODE, &debug_pim_trace_cmd);
   install_element (CONFIG_NODE, &no_debug_pim_trace_cmd);

+ 2 - 0
pimd/pim_cmd.h

@@ -42,6 +42,8 @@
 #define DEBUG_PIM_STR                               "PIM protocol activity\n"
 #define DEBUG_PIM_EVENTS_STR                        "PIM protocol events\n"
 #define DEBUG_PIM_PACKETS_STR                       "PIM protocol packets\n"
+#define DEBUG_PIM_HELLO_PACKETS_STR                 "PIM Hello protocol packets\n"
+#define DEBUG_PIM_J_P_PACKETS_STR                   "PIM Join/Prune protocol packets\n"
 #define DEBUG_PIM_PACKETDUMP_STR                    "PIM packet dump\n"
 #define DEBUG_PIM_PACKETDUMP_SEND_STR               "Dump sent packets\n"
 #define DEBUG_PIM_PACKETDUMP_RECV_STR               "Dump received packets\n"

+ 2 - 2
pimd/pim_hello.c

@@ -204,7 +204,7 @@ int pim_hello_recv(struct interface *ifp,
       FREE_ADDR_LIST_THEN_RETURN(-2);
     }
 
-    if (PIM_DEBUG_PIM_TRACE) {
+    if (PIM_DEBUG_PIM_TRACE || PIM_DEBUG_PIM_HELLO) {
       char src_str[100];
       pim_inet4_dump("<src?>", src_addr, src_str, sizeof(src_str));
       zlog_debug("%s: parse left_size=%d: PIM hello TLV type=%d length=%d from %s on %s",
@@ -262,7 +262,7 @@ int pim_hello_recv(struct interface *ifp,
       }
       break;
     case PIM_MSG_OPTION_TYPE_DM_STATE_REFRESH:
-      if (PIM_DEBUG_PIM_TRACE) {
+      if (PIM_DEBUG_PIM_TRACE || PIM_DEBUG_PIM_HELLO) {
 	char src_str[100];
 	pim_inet4_dump("<src?>", src_addr, src_str, sizeof(src_str));
 	zlog_debug("%s: ignoring PIM hello dense-mode state refresh TLV option type=%d length=%d from %s on interface %s",

+ 1 - 1
pimd/pim_pim.c

@@ -509,7 +509,7 @@ static int hello_send(struct interface *ifp,
 
   pim_ifp = ifp->info;
 
-  if (PIM_DEBUG_PIM_PACKETS) {
+  if (PIM_DEBUG_PIM_PACKETS || PIM_DEBUG_PIM_HELLO) {
     char dst_str[100];
     pim_inet4_dump("<dst?>", qpim_all_pim_routers_addr, dst_str, sizeof(dst_str));
     zlog_debug("%s: to %s on %s: holdt=%u prop_d=%u overr_i=%u dis_join_supp=%d dr_prio=%u gen_id=%08x addrs=%d",

+ 8 - 0
pimd/pimd.h

@@ -64,6 +64,8 @@
 #define PIM_MASK_ZEBRA               (1 << 8)
 #define PIM_MASK_SSMPINGD            (1 << 9)
 #define PIM_MASK_MROUTE              (1 << 10)
+#define PIM_MASK_PIM_HELLO	     (1 << 11)
+#define PIM_MASK_PIM_J_P	     (1 << 12)
 
 const char *const PIM_ALL_SYSTEMS;
 const char *const PIM_ALL_ROUTERS;
@@ -114,6 +116,8 @@ int64_t                   qpim_mroute_del_last;
 #define PIM_DEBUG_ZEBRA               (qpim_debugs & PIM_MASK_ZEBRA)
 #define PIM_DEBUG_SSMPINGD            (qpim_debugs & PIM_MASK_SSMPINGD)
 #define PIM_DEBUG_MROUTE              (qpim_debugs & PIM_MASK_MROUTE)
+#define PIM_DEBUG_PIM_HELLO	      (qpim_debugs & PIM_MASK_PIM_HELLO)
+#define PIM_DEBUG_PIM_J_P	      (qpim_debugs & PIM_MASK_PIM_J_P)
 
 #define PIM_DEBUG_EVENTS       (qpim_debugs & (PIM_MASK_PIM_EVENTS | PIM_MASK_IGMP_EVENTS))
 #define PIM_DEBUG_PACKETS      (qpim_debugs & (PIM_MASK_PIM_PACKETS | PIM_MASK_IGMP_PACKETS))
@@ -130,6 +134,8 @@ int64_t                   qpim_mroute_del_last;
 #define PIM_DO_DEBUG_ZEBRA               (qpim_debugs |= PIM_MASK_ZEBRA)
 #define PIM_DO_DEBUG_SSMPINGD            (qpim_debugs |= PIM_MASK_SSMPINGD)
 #define PIM_DO_DEBUG_MROUTE              (qpim_debugs |= PIM_MASK_MROUTE)
+#define PIM_DO_DEBUG_PIM_HELLO           (qpim_debugs |= PIM_MASK_PIM_HELLO)
+#define PIM_DO_DEBUG_PIM_J_P             (qpim_debugs |= PIM_MASK_PIM_J_P)
 
 #define PIM_DONT_DEBUG_PIM_EVENTS          (qpim_debugs &= ~PIM_MASK_PIM_EVENTS)
 #define PIM_DONT_DEBUG_PIM_PACKETS         (qpim_debugs &= ~PIM_MASK_PIM_PACKETS)
@@ -142,6 +148,8 @@ int64_t                   qpim_mroute_del_last;
 #define PIM_DONT_DEBUG_ZEBRA               (qpim_debugs &= ~PIM_MASK_ZEBRA)
 #define PIM_DONT_DEBUG_SSMPINGD            (qpim_debugs &= ~PIM_MASK_SSMPINGD)
 #define PIM_DONT_DEBUG_MROUTE              (qpim_debugs &= ~PIM_MASK_MROUTE)
+#define PIM_DONT_DEBUG_PIM_HELLO           (qpim_debugs &= ~PIM_MASK_PIM_HELLO)
+#define PIM_DONT_DEBUG_PIM_J_P             (qpim_debugs &= ~PIM_MASK_PIM_J_P)
 
 void pim_init(void);
 void pim_terminate(void);