Browse Source

pimd: Cleanup zebra debugs to be protected by debug commands

pimd is very chatty without any pim debugs turned on.
This commit fixes a bunch of the debugs to be protected
by appropriate pim debug statement.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Donald Sharp 4 years ago
parent
commit
f3734dd5fc
7 changed files with 48 additions and 44 deletions
  1. 11 11
      pimd/pim_iface.c
  2. 6 4
      pimd/pim_ifchannel.c
  3. 1 1
      pimd/pim_neighbor.c
  4. 7 7
      pimd/pim_rpf.c
  5. 2 2
      pimd/pim_signals.c
  6. 1 1
      pimd/pim_zebra.c
  7. 20 18
      pimd/pim_zlookup.c

+ 11 - 11
pimd/pim_iface.c

@@ -256,14 +256,14 @@ static void on_primary_address_change(struct interface *ifp,
 {
   struct pim_interface *pim_ifp;
 
-  {
+  if (PIM_DEBUG_ZEBRA) {
     char old_str[100];
     char new_str[100];
     pim_inet4_dump("<old?>", old_addr, old_str, sizeof(old_str));
     pim_inet4_dump("<new?>", new_addr, new_str, sizeof(new_str));
-    zlog_info("%s: %s: primary address changed from %s to %s on interface %s",
-	      __PRETTY_FUNCTION__, caller,
-	      old_str, new_str, ifp->name);
+    zlog_debug("%s: %s: primary address changed from %s to %s on interface %s",
+	       __PRETTY_FUNCTION__, caller,
+	       old_str, new_str, ifp->name);
   }
 
   pim_ifp = ifp->info;
@@ -329,8 +329,8 @@ static void detect_secondary_address_change(struct interface *ifp,
     return;
 
   changed = 1; /* true */
-  zlog_debug("FIXME T31 C15 %s: on interface %s: acting on any addr change",
-	     __PRETTY_FUNCTION__, ifp->name);
+  zlog_info("FIXME T31 C15 %s: on interface %s: acting on any addr change",
+	    __PRETTY_FUNCTION__, ifp->name);
 
   if (PIM_DEBUG_ZEBRA) {
     zlog_debug("%s: on interface %s: %s",
@@ -382,7 +382,7 @@ void pim_if_addr_add(struct connected *ifc)
   if (!if_is_operative(ifp))
     return;
 
-  /* if (PIM_DEBUG_ZEBRA) */ {
+  if (PIM_DEBUG_ZEBRA) {
     char buf[BUFSIZ];
     prefix2str(ifc->address, buf, BUFSIZ);
     zlog_debug("%s: %s ifindex=%d connected IP address %s %s",
@@ -501,7 +501,7 @@ void pim_if_addr_del(struct connected *ifc, int force_prim_as_any)
   ifp = ifc->ifp;
   zassert(ifp);
 
-  /* if (PIM_DEBUG_ZEBRA) */ {
+  if (PIM_DEBUG_ZEBRA) {
     char buf[BUFSIZ];
     prefix2str(ifc->address, buf, BUFSIZ);
     zlog_debug("%s: %s ifindex=%d disconnected IP address %s %s",
@@ -1055,14 +1055,14 @@ int pim_if_igmp_join_add(struct interface *ifp,
     return -4;
   }
 
-  {
+  if (PIM_DEBUG_IGMP_EVENTS) {
     char group_str[100];
     char source_str[100];
     pim_inet4_dump("<grp?>", group_addr, group_str, sizeof(group_str));
     pim_inet4_dump("<src?>", source_addr, source_str, sizeof(source_str));
     zlog_debug("%s: issued static igmp join for channel (S,G)=(%s,%s) on interface %s",
-	       __PRETTY_FUNCTION__,
-	       source_str, group_str, ifp->name);
+	      __PRETTY_FUNCTION__,
+	      source_str, group_str, ifp->name);
   }
 
   return 0;

+ 6 - 4
pimd/pim_ifchannel.c

@@ -103,9 +103,11 @@ void pim_ifchannel_ifjoin_switch(const char *caller,
   enum pim_ifjoin_state old_state = ch->ifjoin_state;
 
   if (old_state == new_state) {
-    zlog_debug("%s calledby %s: non-transition on state %d (%s)",
-	       __PRETTY_FUNCTION__, caller, new_state,
-	       pim_ifchannel_ifjoin_name(new_state));
+    if (PIM_DEBUG_PIM_EVENTS) {
+      zlog_debug("%s calledby %s: non-transition on state %d (%s)",
+		 __PRETTY_FUNCTION__, caller, new_state,
+		 pim_ifchannel_ifjoin_name(new_state));
+    }
     return;
   }
 
@@ -286,7 +288,7 @@ static void ifmembership_set(struct pim_ifchannel *ch,
   if (ch->local_ifmembership == membership)
     return;
 
-  /* if (PIM_DEBUG_PIM_EVENTS) */ {
+  if (PIM_DEBUG_PIM_EVENTS) {
     char src_str[100];
     char grp_str[100];
     pim_inet4_dump("<src?>", ch->source_addr, src_str, sizeof(src_str));

+ 1 - 1
pimd/pim_neighbor.c

@@ -125,7 +125,7 @@ int pim_if_dr_election(struct interface *ifp)
   /* DR changed ? */
   if (old_dr_addr.s_addr != pim_ifp->pim_dr_addr.s_addr) {
 
-    /* if (PIM_DEBUG_PIM_EVENTS) */ {
+    if (PIM_DEBUG_PIM_EVENTS) {
       char dr_old_str[100];
       char dr_new_str[100];
       pim_inet4_dump("<old_dr?>", old_dr_addr, dr_old_str, sizeof(dr_old_str));

+ 7 - 7
pimd/pim_rpf.c

@@ -61,7 +61,7 @@ int pim_nexthop_lookup(struct pim_nexthop *nexthop,
   if (num_ifindex > 1) {
     char addr_str[100];
     pim_inet4_dump("<addr?>", addr, addr_str, sizeof(addr_str));
-    zlog_debug("%s %s: FIXME ignoring multiple nexthop ifindex'es num_ifindex=%d for address %s (using only ifindex=%d)",
+    zlog_info("%s %s: FIXME ignoring multiple nexthop ifindex'es num_ifindex=%d for address %s (using only ifindex=%d)",
 	      __FILE__, __PRETTY_FUNCTION__,
 	      num_ifindex, addr_str, first_ifindex);
     /* debug warning only, do not return */
@@ -136,22 +136,22 @@ enum pim_rpf_result pim_rpf_update(struct pim_upstream *up,
   }
 
   rpf->rpf_addr = pim_rpf_find_rpf_addr(up);
-  if (PIM_INADDR_IS_ANY(rpf->rpf_addr)) {
+  if (PIM_INADDR_IS_ANY(rpf->rpf_addr) && PIM_DEBUG_PIM_EVENTS) {
     /* RPF'(S,G) not found */
     char src_str[100];
     char grp_str[100];
     pim_inet4_dump("<src?>", up->source_addr, src_str, sizeof(src_str));
     pim_inet4_dump("<grp?>", up->group_addr, grp_str, sizeof(grp_str));
-    zlog_warn("%s %s: RPF'(%s,%s) not found: won't send join upstream",
-              __FILE__, __PRETTY_FUNCTION__,
-              src_str, grp_str);
+    zlog_debug("%s %s: RPF'(%s,%s) not found: won't send join upstream",
+	       __FILE__, __PRETTY_FUNCTION__,
+	       src_str, grp_str);
     /* warning only */
   }
 
   /* detect change in pim_nexthop */
   if (nexthop_mismatch(&rpf->source_nexthop, &save_nexthop)) {
 
-    /* if (PIM_DEBUG_PIM_EVENTS) */ {
+    if (PIM_DEBUG_PIM_EVENTS) {
       char src_str[100];
       char grp_str[100];
       char nhaddr_str[100];
@@ -176,7 +176,7 @@ enum pim_rpf_result pim_rpf_update(struct pim_upstream *up,
   /* detect change in RPF_interface(S) */
   if (save_nexthop.interface != rpf->source_nexthop.interface) {
 
-    /* if (PIM_DEBUG_PIM_EVENTS) */ {
+    if (PIM_DEBUG_PIM_EVENTS) {
       char src_str[100];
       char grp_str[100];
       pim_inet4_dump("<src?>", up->source_addr, src_str, sizeof(src_str));

+ 2 - 2
pimd/pim_signals.c

@@ -36,7 +36,7 @@
 
 static void pim_sighup()
 {
-  zlog_debug ("SIGHUP received, ignoring");
+  zlog_info ("SIGHUP received, ignoring");
 }
 
 static void pim_sigint()
@@ -55,7 +55,7 @@ static void pim_sigterm()
 
 static void pim_sigusr1()
 {
-  zlog_debug ("SIGUSR1 received");
+  zlog_info ("SIGUSR1 received");
   zlog_rotate (NULL);
 }
 

+ 1 - 1
pimd/pim_zebra.c

@@ -762,7 +762,7 @@ static int fib_lookup_if_vif_index(struct in_addr addr)
   if (num_ifindex > 1) {
     char addr_str[100];
     pim_inet4_dump("<addr?>", addr, addr_str, sizeof(addr_str));
-    zlog_debug("%s %s: FIXME ignoring multiple nexthop ifindex'es num_ifindex=%d for address %s (using only ifindex=%d)",
+    zlog_info("%s %s: FIXME ignoring multiple nexthop ifindex'es num_ifindex=%d for address %s (using only ifindex=%d)",
 	       __FILE__, __PRETTY_FUNCTION__,
 	       num_ifindex, addr_str, first_ifindex);
     /* debug warning only, do not return */

+ 20 - 18
pimd/pim_zlookup.c

@@ -283,14 +283,14 @@ static int zclient_read_nexthop(struct zclient *zlookup,
       nexthop_tab[num_ifindex].ifindex             = 0;
       nexthop_tab[num_ifindex].protocol_distance   = distance;
       nexthop_tab[num_ifindex].route_metric        = metric;
-      {
+      if (PIM_DEBUG_ZEBRA) {
 	char addr_str[100];
 	char nexthop_str[100];
 	pim_inet4_dump("<addr?>", addr, addr_str, sizeof(addr_str));
 	pim_inet4_dump("<nexthop?>", nexthop_tab[num_ifindex].nexthop_addr, nexthop_str, sizeof(nexthop_str));
-	zlog_warn("%s %s: zebra returned recursive nexthop %s for address %s",
-		  __FILE__, __PRETTY_FUNCTION__,
-		  nexthop_str, addr_str);
+	zlog_debug("%s %s: zebra returned recursive nexthop %s for address %s",
+		   __FILE__, __PRETTY_FUNCTION__,
+		   nexthop_str, addr_str);
       }
       ++num_ifindex;
       break;
@@ -375,7 +375,7 @@ int zclient_lookup_nexthop(struct zclient *zlookup,
 
     num_ifindex = zclient_lookup_nexthop_once(qpim_zclient_lookup, nexthop_tab,
 					      PIM_NEXTHOP_IFINDEX_TAB_SIZE, addr);
-    if (num_ifindex < 1) {
+    if ((num_ifindex < 1) && PIM_DEBUG_ZEBRA) {
       char addr_str[100];
       pim_inet4_dump("<addr?>", addr, addr_str, sizeof(addr_str));
       zlog_warn("%s %s: lookup=%d/%d: could not find nexthop ifindex for address %s",
@@ -400,15 +400,15 @@ int zclient_lookup_nexthop(struct zclient *zlookup,
     if (first_ifindex > 0) {
       /* found: first ifindex is non-recursive nexthop */
 
-      if (lookup > 0) {
+      if ((lookup > 0) && PIM_DEBUG_ZEBRA) {
 	/* Report non-recursive success after first lookup */
 	char addr_str[100];
 	pim_inet4_dump("<addr?>", addr, addr_str, sizeof(addr_str));
-	zlog_info("%s %s: lookup=%d/%d: found non-recursive ifindex=%d for address %s dist=%d met=%d",
-		  __FILE__, __PRETTY_FUNCTION__,
-		  lookup, max_lookup, first_ifindex, addr_str,
-		  nexthop_tab[0].protocol_distance,
-		  nexthop_tab[0].route_metric);
+	zlog_debug("%s %s: lookup=%d/%d: found non-recursive ifindex=%d for address %s dist=%d met=%d",
+		   __FILE__, __PRETTY_FUNCTION__,
+		   lookup, max_lookup, first_ifindex, addr_str,
+		   nexthop_tab[0].protocol_distance,
+		   nexthop_tab[0].route_metric);
 
 	/* use last address as nexthop address */
 	nexthop_tab[0].nexthop_addr = addr;
@@ -421,12 +421,12 @@ int zclient_lookup_nexthop(struct zclient *zlookup,
       return num_ifindex;
     }
 
-    {
+    if (PIM_DEBUG_ZEBRA) {
       char addr_str[100];
       char nexthop_str[100];
       pim_inet4_dump("<addr?>", addr, addr_str, sizeof(addr_str));
       pim_inet4_dump("<nexthop?>", nexthop_addr, nexthop_str, sizeof(nexthop_str));
-      zlog_warn("%s %s: lookup=%d/%d: zebra returned recursive nexthop %s for address %s dist=%d met=%d",
+      zlog_debug("%s %s: lookup=%d/%d: zebra returned recursive nexthop %s for address %s dist=%d met=%d",
 		__FILE__, __PRETTY_FUNCTION__,
 		lookup, max_lookup, nexthop_str, addr_str,
 		nexthop_tab[0].protocol_distance,
@@ -437,11 +437,13 @@ int zclient_lookup_nexthop(struct zclient *zlookup,
 
   } /* for (max_lookup) */
 
-  char addr_str[100];
-  pim_inet4_dump("<addr?>", addr, addr_str, sizeof(addr_str));
-  zlog_warn("%s %s: lookup=%d/%d: failure searching recursive nexthop ifindex for address %s",
-	    __FILE__, __PRETTY_FUNCTION__,
-	    lookup, max_lookup, addr_str);
+  if (PIM_DEBUG_ZEBRA) {
+    char addr_str[100];
+    pim_inet4_dump("<addr?>", addr, addr_str, sizeof(addr_str));
+    zlog_warn("%s %s: lookup=%d/%d: failure searching recursive nexthop ifindex for address %s",
+	      __FILE__, __PRETTY_FUNCTION__,
+	      lookup, max_lookup, addr_str);
+  }
 
   return -2;
 }