Browse Source

[pim] debug mroute

Everton Marques 9 years ago
parent
commit
67faabc180
5 changed files with 85 additions and 0 deletions
  1. 31 0
      pimd/pim_cmd.c
  2. 1 0
      pimd/pim_cmd.h
  3. 5 0
      pimd/pim_vty.c
  4. 44 0
      pimd/pim_zebra.c
  5. 4 0
      pimd/pimd.h

+ 31 - 0
pimd/pim_cmd.c

@@ -3131,6 +3131,33 @@ ALIAS (no_debug_igmp_trace,
        DEBUG_IGMP_STR
        DEBUG_IGMP_TRACE_STR)
 
+DEFUN (debug_mroute,
+       debug_mroute_cmd,
+       "debug mroute",
+       DEBUG_STR
+       DEBUG_MROUTE_STR)
+{
+  PIM_DO_DEBUG_MROUTE;
+  return CMD_SUCCESS;
+}
+
+DEFUN (no_debug_mroute,
+       no_debug_mroute_cmd,
+       "no debug mroute",
+       NO_STR
+       DEBUG_STR
+       DEBUG_MROUTE_STR)
+{
+  PIM_DONT_DEBUG_MROUTE;
+  return CMD_SUCCESS;
+}
+
+ALIAS (no_debug_mroute,
+       undebug_mroute_cmd,
+       "undebug mroute",
+       UNDEBUG_STR
+       DEBUG_MROUTE_STR)
+
 DEFUN (debug_pim,
        debug_pim_cmd,
        "debug pim",
@@ -4295,6 +4322,8 @@ void pim_cmd_init()
   install_element (ENABLE_NODE, &debug_igmp_trace_cmd);
   install_element (ENABLE_NODE, &no_debug_igmp_trace_cmd);
   install_element (ENABLE_NODE, &undebug_igmp_trace_cmd);
+  install_element (ENABLE_NODE, &debug_mroute_cmd);
+  install_element (ENABLE_NODE, &no_debug_mroute_cmd);
   install_element (ENABLE_NODE, &debug_pim_cmd);
   install_element (ENABLE_NODE, &no_debug_pim_cmd);
   install_element (ENABLE_NODE, &undebug_pim_cmd);
@@ -4332,6 +4361,8 @@ void pim_cmd_init()
   install_element (CONFIG_NODE, &debug_igmp_trace_cmd);
   install_element (CONFIG_NODE, &no_debug_igmp_trace_cmd);
   install_element (CONFIG_NODE, &undebug_igmp_trace_cmd);
+  install_element (CONFIG_NODE, &debug_mroute_cmd);
+  install_element (CONFIG_NODE, &no_debug_mroute_cmd);
   install_element (CONFIG_NODE, &debug_pim_cmd);
   install_element (CONFIG_NODE, &no_debug_pim_cmd);
   install_element (CONFIG_NODE, &undebug_pim_cmd);

+ 1 - 0
pimd/pim_cmd.h

@@ -38,6 +38,7 @@
 #define DEBUG_IGMP_EVENTS_STR                       "IGMP protocol events\n"
 #define DEBUG_IGMP_PACKETS_STR                      "IGMP protocol packets\n"
 #define DEBUG_IGMP_TRACE_STR                        "IGMP internal daemon activity\n"
+#define DEBUG_MROUTE_STR                            "PIM interaction with kernel MFC cache\n"
 #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"

+ 5 - 0
pimd/pim_vty.c

@@ -49,6 +49,11 @@ int pim_debug_config_write(struct vty *vty)
     ++writes;
   }
 
+  if (PIM_DEBUG_MROUTE) {
+    vty_out(vty, "debug mroute%s", VTY_NEWLINE);
+    ++writes;
+  }
+
   if (PIM_DEBUG_PIM_EVENTS) {
     vty_out(vty, "debug pim events%s", VTY_NEWLINE);
     ++writes;

+ 44 - 0
pimd/pim_zebra.c

@@ -754,6 +754,17 @@ static int add_oif(struct channel_oil *channel_oil,
 
   pim_ifp = oif->info;
 
+  if (PIM_DEBUG_MROUTE) {
+    char group_str[100]; 
+    char source_str[100];
+    pim_inet4_dump("<group?>", channel_oil->oil.mfcc_mcastgrp, group_str, sizeof(group_str));
+    pim_inet4_dump("<source?>", channel_oil->oil.mfcc_origin, source_str, sizeof(source_str));
+    zlog_debug("%s %s: (S,G)=(%s,%s): proto_mask=%u OIF=%s vif_index=%d",
+	       __FILE__, __PRETTY_FUNCTION__,
+	       source_str, group_str,
+	       proto_mask, oif->name, pim_ifp->mroute_vif_index);
+  }
+
   if (pim_ifp->mroute_vif_index < 1) {
     zlog_warn("%s %s: interface %s vif_index=%d < 1",
 	      __FILE__, __PRETTY_FUNCTION__,
@@ -860,6 +871,17 @@ static int add_oif(struct channel_oil *channel_oil,
   ++channel_oil->oil_size;
   channel_oil->oif_flags[pim_ifp->mroute_vif_index] |= proto_mask;
 
+  if (PIM_DEBUG_MROUTE) {
+    char group_str[100]; 
+    char source_str[100];
+    pim_inet4_dump("<group?>", channel_oil->oil.mfcc_mcastgrp, group_str, sizeof(group_str));
+    pim_inet4_dump("<source?>", channel_oil->oil.mfcc_origin, source_str, sizeof(source_str));
+    zlog_debug("%s %s: (S,G)=(%s,%s): proto_mask=%u OIF=%s vif_index=%d: DONE",
+	       __FILE__, __PRETTY_FUNCTION__,
+	       source_str, group_str,
+	       proto_mask, oif->name, pim_ifp->mroute_vif_index);
+  }
+
   return 0;
 }
 
@@ -878,6 +900,17 @@ static int del_oif(struct channel_oil *channel_oil,
   zassert(qpim_mroute_oif_highest_vif_index < MAXVIFS);
   zassert(pim_ifp->mroute_vif_index <= qpim_mroute_oif_highest_vif_index);
 
+  if (PIM_DEBUG_MROUTE) {
+    char group_str[100]; 
+    char source_str[100];
+    pim_inet4_dump("<group?>", channel_oil->oil.mfcc_mcastgrp, group_str, sizeof(group_str));
+    pim_inet4_dump("<source?>", channel_oil->oil.mfcc_origin, source_str, sizeof(source_str));
+    zlog_debug("%s %s: (S,G)=(%s,%s): proto_mask=%u OIF=%s vif_index=%d",
+	       __FILE__, __PRETTY_FUNCTION__,
+	       source_str, group_str,
+	       proto_mask, oif->name, pim_ifp->mroute_vif_index);
+  }
+
   /* Prevent single protocol from unsubscribing same interface from
      channel (S,G) multiple times */
   if (!(channel_oil->oif_flags[pim_ifp->mroute_vif_index] & proto_mask)) {
@@ -963,6 +996,17 @@ static int del_oif(struct channel_oil *channel_oil,
     }
   }
 
+  if (PIM_DEBUG_MROUTE) {
+    char group_str[100]; 
+    char source_str[100];
+    pim_inet4_dump("<group?>", channel_oil->oil.mfcc_mcastgrp, group_str, sizeof(group_str));
+    pim_inet4_dump("<source?>", channel_oil->oil.mfcc_origin, source_str, sizeof(source_str));
+    zlog_debug("%s %s: (S,G)=(%s,%s): proto_mask=%u OIF=%s vif_index=%d: DONE",
+	       __FILE__, __PRETTY_FUNCTION__,
+	       source_str, group_str,
+	       proto_mask, oif->name, pim_ifp->mroute_vif_index);
+  }
+
   return 0;
 }
 

+ 4 - 0
pimd/pimd.h

@@ -63,6 +63,7 @@
 #define PIM_MASK_IGMP_TRACE          (1 << 7)
 #define PIM_MASK_ZEBRA               (1 << 8)
 #define PIM_MASK_SSMPINGD            (1 << 9)
+#define PIM_MASK_MROUTE              (1 << 10)
 
 const char *const PIM_ALL_SYSTEMS;
 const char *const PIM_ALL_ROUTERS;
@@ -105,6 +106,7 @@ struct in_addr            qpim_ssmpingd_group_addr;
 #define PIM_DEBUG_IGMP_TRACE          (qpim_debugs & PIM_MASK_IGMP_TRACE)
 #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_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))
@@ -120,6 +122,7 @@ struct in_addr            qpim_ssmpingd_group_addr;
 #define PIM_DO_DEBUG_IGMP_TRACE          (qpim_debugs |= PIM_MASK_IGMP_TRACE)
 #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_DONT_DEBUG_PIM_EVENTS          (qpim_debugs &= ~PIM_MASK_PIM_EVENTS)
 #define PIM_DONT_DEBUG_PIM_PACKETS         (qpim_debugs &= ~PIM_MASK_PIM_PACKETS)
@@ -131,6 +134,7 @@ struct in_addr            qpim_ssmpingd_group_addr;
 #define PIM_DONT_DEBUG_IGMP_TRACE          (qpim_debugs &= ~PIM_MASK_IGMP_TRACE)
 #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)
 
 void pim_init(void);
 void pim_terminate(void);