Browse Source

pimd: Reduce informative mandatory logging.

Everton Marques 5 years ago
parent
commit
c1b228c5cf
5 changed files with 110 additions and 93 deletions
  1. 29 27
      pimd/pim_assert.c
  2. 28 28
      pimd/pim_ifchannel.c
  3. 10 7
      pimd/pim_neighbor.c
  4. 30 24
      pimd/pim_rpf.c
  5. 13 7
      pimd/pim_zebra.c

+ 29 - 27
pimd/pim_assert.c

@@ -53,33 +53,35 @@ void pim_ifassert_winner_set(struct pim_ifchannel     *ch,
   int metric_changed = !pim_assert_metric_match(&ch->ifassert_winner_metric,
 						&winner_metric);
 
-  if (ch->ifassert_state != new_state) {
-    char src_str[100];
-    char grp_str[100];
-    pim_inet4_dump("<src?>", ch->source_addr, src_str, sizeof(src_str));
-    pim_inet4_dump("<grp?>", ch->group_addr, grp_str, sizeof(grp_str));
-    zlog_info("%s: (S,G)=(%s,%s) assert state changed from %s to %s on interface %s",
-	      __PRETTY_FUNCTION__,
-	      src_str, grp_str,
-	      pim_ifchannel_ifassert_name(ch->ifassert_state),
-	      pim_ifchannel_ifassert_name(new_state),
-	      ch->interface->name);
-  }
+  if (PIM_DEBUG_PIM_EVENTS) {
+    if (ch->ifassert_state != new_state) {
+      char src_str[100];
+      char grp_str[100];
+      pim_inet4_dump("<src?>", ch->source_addr, src_str, sizeof(src_str));
+      pim_inet4_dump("<grp?>", ch->group_addr, grp_str, sizeof(grp_str));
+      zlog_debug("%s: (S,G)=(%s,%s) assert state changed from %s to %s on interface %s",
+		__PRETTY_FUNCTION__,
+		src_str, grp_str,
+		pim_ifchannel_ifassert_name(ch->ifassert_state),
+		pim_ifchannel_ifassert_name(new_state),
+		ch->interface->name);
+    }
 
-  if (winner_changed) {
-    char src_str[100];
-    char grp_str[100];
-    char was_str[100];
-    char winner_str[100];
-    pim_inet4_dump("<src?>", ch->source_addr, src_str, sizeof(src_str));
-    pim_inet4_dump("<grp?>", ch->group_addr, grp_str, sizeof(grp_str));
-    pim_inet4_dump("<was?>", ch->ifassert_winner, was_str, sizeof(was_str));
-    pim_inet4_dump("<winner?>", winner, winner_str, sizeof(winner_str));
-    zlog_info("%s: (S,G)=(%s,%s) assert winner changed from %s to %s on interface %s",
-	      __PRETTY_FUNCTION__,
-	      src_str, grp_str,
-	      was_str, winner_str, ch->interface->name);
-  }
+    if (winner_changed) {
+      char src_str[100];
+      char grp_str[100];
+      char was_str[100];
+      char winner_str[100];
+      pim_inet4_dump("<src?>", ch->source_addr, src_str, sizeof(src_str));
+      pim_inet4_dump("<grp?>", ch->group_addr, grp_str, sizeof(grp_str));
+      pim_inet4_dump("<was?>", ch->ifassert_winner, was_str, sizeof(was_str));
+      pim_inet4_dump("<winner?>", winner, winner_str, sizeof(winner_str));
+      zlog_debug("%s: (S,G)=(%s,%s) assert winner changed from %s to %s on interface %s",
+		__PRETTY_FUNCTION__,
+		src_str, grp_str,
+		was_str, winner_str, ch->interface->name);
+    }
+  } /* PIM_DEBUG_PIM_EVENTS */
 
   ch->ifassert_state         = new_state;
   ch->ifassert_winner        = winner;
@@ -655,7 +657,7 @@ int assert_action_a1(struct pim_ifchannel *ch)
     char grp_str[100];
     pim_inet4_dump("<src?>", ch->source_addr, src_str, sizeof(src_str));
     pim_inet4_dump("<grp?>", ch->group_addr, grp_str, sizeof(grp_str));
-    zlog_warn("%s: (S,G)=(%s,%s) multicast no enabled on interface %s",
+    zlog_warn("%s: (S,G)=(%s,%s) multicast not enabled on interface %s",
 	      __PRETTY_FUNCTION__,
 	      src_str, grp_str, ifp->name);
     return -1; /* must return since pim_ifp is used below */

+ 28 - 28
pimd/pim_ifchannel.c

@@ -286,16 +286,16 @@ static void ifmembership_set(struct pim_ifchannel *ch,
   if (ch->local_ifmembership == membership)
     return;
 
-  {
+  /* 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));
     pim_inet4_dump("<grp?>", ch->group_addr, grp_str, sizeof(grp_str));
-    zlog_info("%s: (S,G)=(%s,%s) membership now is %s on interface %s",
-	      __PRETTY_FUNCTION__,
-	      src_str, grp_str,
-	      membership == PIM_IFMEMBERSHIP_INCLUDE ? "INCLUDE" : "NOINFO",
-	      ch->interface->name);
+    zlog_debug("%s: (S,G)=(%s,%s) membership now is %s on interface %s",
+	       __PRETTY_FUNCTION__,
+	       src_str, grp_str,
+	       membership == PIM_IFMEMBERSHIP_INCLUDE ? "INCLUDE" : "NOINFO",
+	       ch->interface->name);
   }
   
   ch->local_ifmembership = membership;
@@ -787,15 +787,15 @@ void pim_ifchannel_update_could_assert(struct pim_ifchannel *ch)
   if (new_couldassert == old_couldassert)
     return;
 
-  {
+  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));
     pim_inet4_dump("<grp?>", ch->group_addr, grp_str, sizeof(grp_str));
-    zlog_info("%s: CouldAssert(%s,%s,%s) changed from %d to %d",
-	      __PRETTY_FUNCTION__,
-	      src_str, grp_str, ch->interface->name,
-	      old_couldassert, new_couldassert);
+    zlog_debug("%s: CouldAssert(%s,%s,%s) changed from %d to %d",
+	       __PRETTY_FUNCTION__,
+	       src_str, grp_str, ch->interface->name,
+	       old_couldassert, new_couldassert);
   }
 
   if (new_couldassert) {
@@ -829,7 +829,7 @@ void pim_ifchannel_update_my_assert_metric(struct pim_ifchannel *ch)
   if (pim_assert_metric_match(&my_metric_new, &ch->ifassert_my_metric))
       return;
 
-  {
+  if (PIM_DEBUG_PIM_EVENTS) {
     char src_str[100];
     char grp_str[100];
     char old_addr_str[100];
@@ -838,17 +838,17 @@ void pim_ifchannel_update_my_assert_metric(struct pim_ifchannel *ch)
     pim_inet4_dump("<grp?>", ch->group_addr, grp_str, sizeof(grp_str));
     pim_inet4_dump("<old_addr?>", ch->ifassert_my_metric.ip_address, old_addr_str, sizeof(old_addr_str));
     pim_inet4_dump("<new_addr?>", my_metric_new.ip_address, new_addr_str, sizeof(new_addr_str));
-    zlog_info("%s: my_assert_metric(%s,%s,%s) changed from %u,%u,%u,%s to %u,%u,%u,%s",
-	      __PRETTY_FUNCTION__,
-	      src_str, grp_str, ch->interface->name,
-	      ch->ifassert_my_metric.rpt_bit_flag,
-	      ch->ifassert_my_metric.metric_preference,
-	      ch->ifassert_my_metric.route_metric,
-	      old_addr_str,
-	      my_metric_new.rpt_bit_flag,
-	      my_metric_new.metric_preference,
-	      my_metric_new.route_metric,
-	      new_addr_str);
+    zlog_debug("%s: my_assert_metric(%s,%s,%s) changed from %u,%u,%u,%s to %u,%u,%u,%s",
+	       __PRETTY_FUNCTION__,
+	       src_str, grp_str, ch->interface->name,
+	       ch->ifassert_my_metric.rpt_bit_flag,
+	       ch->ifassert_my_metric.metric_preference,
+	       ch->ifassert_my_metric.route_metric,
+	       old_addr_str,
+	       my_metric_new.rpt_bit_flag,
+	       my_metric_new.metric_preference,
+	       my_metric_new.route_metric,
+	       new_addr_str);
   }
 
   ch->ifassert_my_metric = my_metric_new;
@@ -867,15 +867,15 @@ void pim_ifchannel_update_assert_tracking_desired(struct pim_ifchannel *ch)
   if (new_atd == old_atd)
     return;
 
-  {
+  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));
     pim_inet4_dump("<grp?>", ch->group_addr, grp_str, sizeof(grp_str));
-    zlog_info("%s: AssertTrackingDesired(%s,%s,%s) changed from %d to %d",
-	      __PRETTY_FUNCTION__,
-	      src_str, grp_str, ch->interface->name,
-	      old_atd, new_atd);
+    zlog_debug("%s: AssertTrackingDesired(%s,%s,%s) changed from %d to %d",
+	       __PRETTY_FUNCTION__,
+	       src_str, grp_str, ch->interface->name,
+	       old_atd, new_atd);
   }
 
   if (new_atd) {

+ 10 - 7
pimd/pim_neighbor.c

@@ -124,13 +124,16 @@ void pim_if_dr_election(struct interface *ifp)
 
   /* DR changed ? */
   if (old_dr_addr.s_addr != pim_ifp->pim_dr_addr.s_addr) {
-    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));
-    pim_inet4_dump("<new_dr?>", pim_ifp->pim_dr_addr, dr_new_str, sizeof(dr_new_str));
-    zlog_info("%s: DR was %s now is %s on interface %s",
-	      __PRETTY_FUNCTION__,
-	      dr_old_str, dr_new_str, ifp->name);
+
+    /* 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));
+      pim_inet4_dump("<new_dr?>", pim_ifp->pim_dr_addr, dr_new_str, sizeof(dr_new_str));
+      zlog_debug("%s: DR was %s now is %s on interface %s",
+		 __PRETTY_FUNCTION__,
+		 dr_old_str, dr_new_str, ifp->name);
+    }
 
     pim_ifp->pim_dr_election_last = pim_time_monotonic_sec(); /* timestamp */
     ++pim_ifp->pim_dr_election_changes; 

+ 30 - 24
pimd/pim_rpf.c

@@ -150,20 +150,23 @@ enum pim_rpf_result pim_rpf_update(struct pim_upstream *up,
 
   /* detect change in pim_nexthop */
   if (nexthop_mismatch(&rpf->source_nexthop, &save_nexthop)) {
-    char src_str[100];
-    char grp_str[100];
-    char nhaddr_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));
-    pim_inet4_dump("<addr?>", rpf->source_nexthop.mrib_nexthop_addr, nhaddr_str, sizeof(nhaddr_str));
-    zlog_warn("%s %s: (S,G)=(%s,%s) source nexthop now is: interface=%s address=%s pref=%d metric=%d",
-              __FILE__, __PRETTY_FUNCTION__,
-              src_str, grp_str,
-	      rpf->source_nexthop.interface ? rpf->source_nexthop.interface->name : "<ifname?>",
-	      nhaddr_str,
-	      rpf->source_nexthop.mrib_metric_preference,
-	      rpf->source_nexthop.mrib_route_metric);
-    /* warning only */
+
+    /* if (PIM_DEBUG_PIM_EVENTS) */ {
+      char src_str[100];
+      char grp_str[100];
+      char nhaddr_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));
+      pim_inet4_dump("<addr?>", rpf->source_nexthop.mrib_nexthop_addr, nhaddr_str, sizeof(nhaddr_str));
+      zlog_debug("%s %s: (S,G)=(%s,%s) source nexthop now is: interface=%s address=%s pref=%d metric=%d",
+		 __FILE__, __PRETTY_FUNCTION__,
+		 src_str, grp_str,
+		 rpf->source_nexthop.interface ? rpf->source_nexthop.interface->name : "<ifname?>",
+		 nhaddr_str,
+		 rpf->source_nexthop.mrib_metric_preference,
+		 rpf->source_nexthop.mrib_route_metric);
+      /* warning only */
+    }
 
     pim_upstream_update_join_desired(up);
     pim_upstream_update_could_assert(up);
@@ -172,16 +175,19 @@ 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) {
-    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: (S,G)=(%s,%s) RPF_interface(S) changed from %s to %s",
-              __FILE__, __PRETTY_FUNCTION__,
-              src_str, grp_str,
-	      save_nexthop.interface ? save_nexthop.interface->name : "<oldif?>",
-	      rpf->source_nexthop.interface ? rpf->source_nexthop.interface->name : "<newif?>");
-    /* warning only */
+
+    /* 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));
+      pim_inet4_dump("<grp?>", up->group_addr, grp_str, sizeof(grp_str));
+      zlog_debug("%s %s: (S,G)=(%s,%s) RPF_interface(S) changed from %s to %s",
+		 __FILE__, __PRETTY_FUNCTION__,
+		 src_str, grp_str,
+		 save_nexthop.interface ? save_nexthop.interface->name : "<oldif?>",
+		 rpf->source_nexthop.interface ? rpf->source_nexthop.interface->name : "<newif?>");
+      /* warning only */
+    }
 
     pim_upstream_rpf_interface_changed(up, save_nexthop.interface);
   }

+ 13 - 7
pimd/pim_zebra.c

@@ -670,7 +670,9 @@ void pim_zebra_init(char *zebra_sock_path)
   qpim_zclient_update->ipv4_route_delete        = redist_read_ipv4_route;
 
   zclient_init(qpim_zclient_update, ZEBRA_ROUTE_PIM);
-  zlog_info("zclient_init cleared redistribution request");
+  if (PIM_DEBUG_PIM_TRACE) {
+    zlog_info("zclient_init cleared redistribution request");
+  }
 
   zassert(qpim_zclient_update->redist_default == ZEBRA_ROUTE_PIM);
 
@@ -679,18 +681,22 @@ void pim_zebra_init(char *zebra_sock_path)
     if (i == qpim_zclient_update->redist_default)
       continue;
     qpim_zclient_update->redist[i] = 1;
-    zlog_info("%s: requesting redistribution for %s (%i)", 
-	      __PRETTY_FUNCTION__, zebra_route_string(i), i);
+    if (PIM_DEBUG_PIM_TRACE) {
+      zlog_debug("%s: requesting redistribution for %s (%i)", 
+		 __PRETTY_FUNCTION__, zebra_route_string(i), i);
+    }
   }
 
   /* Request default information */
   qpim_zclient_update->default_information = 1;
-  zlog_info("%s: requesting default information redistribution",
-	    __PRETTY_FUNCTION__);
-
-  zlog_notice("%s: zclient update socket initialized",
+  if (PIM_DEBUG_PIM_TRACE) {
+    zlog_info("%s: requesting default information redistribution",
 	      __PRETTY_FUNCTION__);
 
+    zlog_notice("%s: zclient update socket initialized",
+		__PRETTY_FUNCTION__);
+  }
+
   zassert(!qpim_zclient_lookup);
   qpim_zclient_lookup = zclient_lookup_new();
   zassert(qpim_zclient_lookup);