]> git.puffer.fish Git - matthieu/frr.git/commitdiff
pimd: Allow storing of sg in string format
authorDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 17 Nov 2016 13:17:25 +0000 (08:17 -0500)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 22 Dec 2016 01:26:16 +0000 (20:26 -0500)
Debugs are extremely expensive currently.  Let's
store 'struct prefix_sg sg' string format in
the ifchannel, upstream and msdp_sa structures.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
19 files changed:
pimd/pim_assert.c
pimd/pim_cmd.c
pimd/pim_ifchannel.c
pimd/pim_ifchannel.h
pimd/pim_join.c
pimd/pim_macro.c
pimd/pim_mroute.c
pimd/pim_msdp.c
pimd/pim_msdp.h
pimd/pim_msg.c
pimd/pim_register.c
pimd/pim_rpf.c
pimd/pim_ssmpingd.c
pimd/pim_str.c
pimd/pim_str.h
pimd/pim_upstream.c
pimd/pim_upstream.h
pimd/pim_zebra.c
pimd/pimd.h

index 505d1f1ec1959ed16126c2d2700600bbf0bcfb9d..3e8f1b7d3d007a1711da859b6b350e1ec4120f53 100644 (file)
@@ -57,7 +57,7 @@ void pim_ifassert_winner_set(struct pim_ifchannel     *ch,
     if (ch->ifassert_state != new_state) {
       zlog_debug("%s: (S,G)=%s assert state changed from %s to %s on interface %s",
                 __PRETTY_FUNCTION__,
-                pim_str_sg_dump (&ch->sg),
+                ch->sg_str,
                 pim_ifchannel_ifassert_name(ch->ifassert_state),
                 pim_ifchannel_ifassert_name(new_state),
                 ch->interface->name);
@@ -70,7 +70,7 @@ void pim_ifassert_winner_set(struct pim_ifchannel     *ch,
       pim_inet4_dump("<winner?>", winner, winner_str, sizeof(winner_str));
       zlog_debug("%s: (S,G)=%s assert winner changed from %s to %s on interface %s",
                 __PRETTY_FUNCTION__,
-                pim_str_sg_dump (&ch->sg),
+                ch->sg_str,
                 was_str, winner_str, ch->interface->name);
     }
   } /* PIM_DEBUG_PIM_EVENTS */
@@ -133,7 +133,7 @@ static void if_could_assert_do_a1(const char *caller,
     if (assert_action_a1(ch)) {
       zlog_warn("%s: %s: (S,G)=%s assert_action_a1 failure on interface %s",
                __PRETTY_FUNCTION__, caller,
-               pim_str_sg_dump (&ch->sg), ch->interface->name);
+               ch->sg_str, ch->interface->name);
       /* log warning only */
     }
   }
@@ -213,7 +213,7 @@ static int dispatch_assert(struct interface *ifp,
     {
       zlog_warn("%s: (S,G)=%s invalid assert state %d on interface %s",
                __PRETTY_FUNCTION__,
-               pim_str_sg_dump (&sg), ch->ifassert_state, ifp->name);
+               ch->sg_str, ch->ifassert_state, ifp->name);
     }
     return -2;
   }
@@ -468,7 +468,7 @@ static int pim_assert_do(struct pim_ifchannel *ch,
   if (PIM_DEBUG_PIM_TRACE) {
     zlog_debug("%s: to %s: (S,G)=%s pref=%u metric=%u rpt_bit=%u",
               __PRETTY_FUNCTION__, 
-              ifp->name, pim_str_sg_dump (&ch->sg),
+              ifp->name, ch->sg_str,
               metric.metric_preference,
               metric.route_metric,
               PIM_FORCE_BOOLEAN(metric.rpt_bit_flag));
@@ -523,7 +523,7 @@ static int on_assert_timer(struct thread *t)
   if (PIM_DEBUG_PIM_TRACE) {
     zlog_debug("%s: (S,G)=%s timer expired on interface %s",
               __PRETTY_FUNCTION__,
-              pim_str_sg_dump (&ch->sg), ifp->name);
+              ch->sg_str, ifp->name);
   }
 
   ch->t_ifassert_timer = NULL;
@@ -540,7 +540,7 @@ static int on_assert_timer(struct thread *t)
     {
       zlog_warn("%s: (S,G)=%s invalid assert state %d on interface %s",
                __PRETTY_FUNCTION__,
-               pim_str_sg_dump (&ch->sg), ch->ifassert_state, ifp->name);
+               ch->sg_str, ch->ifassert_state, ifp->name);
     }
   }
 
@@ -559,7 +559,7 @@ static void assert_timer_off(struct pim_ifchannel *ch)
     if (ch->t_ifassert_timer) {
       zlog_debug("%s: (S,G)=%s cancelling timer on interface %s",
                 __PRETTY_FUNCTION__,
-                pim_str_sg_dump (&ch->sg), ifp->name);
+                ch->sg_str, ifp->name);
     }
   }
   THREAD_OFF(ch->t_ifassert_timer);
@@ -580,7 +580,7 @@ static void pim_assert_timer_set(struct pim_ifchannel *ch,
   if (PIM_DEBUG_PIM_TRACE) {
     zlog_debug("%s: (S,G)=%s starting %u sec timer on interface %s",
               __PRETTY_FUNCTION__,
-              pim_str_sg_dump(&ch->sg), interval, ifp->name);
+              ch->sg_str, interval, ifp->name);
   }
 
   THREAD_TIMER_ON(master, ch->t_ifassert_timer,
@@ -614,7 +614,7 @@ int assert_action_a1(struct pim_ifchannel *ch)
   if (!pim_ifp) {
     zlog_warn("%s: (S,G)=%s multicast not enabled on interface %s",
              __PRETTY_FUNCTION__,
-             pim_str_sg_dump (&ch->sg), ifp->name);
+             ch->sg_str, ifp->name);
     return -1; /* must return since pim_ifp is used below */
   }
 
@@ -628,7 +628,7 @@ int assert_action_a1(struct pim_ifchannel *ch)
   if (assert_action_a3(ch)) {
     zlog_warn("%s: (S,G)=%s assert_action_a3 failure on interface %s",
              __PRETTY_FUNCTION__,
-             pim_str_sg_dump (&ch->sg), ifp->name);
+             ch->sg_str, ifp->name);
     /* warning only */
   }
 
@@ -675,7 +675,7 @@ static int assert_action_a3(struct pim_ifchannel *ch)
   if (pim_assert_send(ch)) {
     zlog_warn("%s: (S,G)=%s failure sending assert on interface %s",
              __PRETTY_FUNCTION__,
-             pim_str_sg_dump (&ch->sg), ch->interface->name);
+             ch->sg_str, ch->interface->name);
     return -1;
   }
 
@@ -699,7 +699,7 @@ void assert_action_a4(struct pim_ifchannel *ch)
   if (pim_assert_cancel(ch)) {
     zlog_warn("%s: failure sending AssertCancel%s on interface %s",
              __PRETTY_FUNCTION__,
-             pim_str_sg_dump (&ch->sg), ch->interface->name);
+             ch->sg_str, ch->interface->name);
     /* log warning only */
   }
 
index 0690130edfdb839108cc0c8667a95ece0e6a3e3f..ecfa94cba94578badec597a550a46ad212ea99d3 100644 (file)
@@ -5800,7 +5800,7 @@ ip_msdp_show_sa_entry_detail(struct pim_msdp_sa *sa, const char *src_str,
     json_object_string_add(json_row, "stateTime", statetimer);
     json_object_object_add(json_group, src_str, json_row);
   } else {
-    vty_out(vty, "SA : %s%s", pim_str_sg_dump(&sa->sg), VTY_NEWLINE);
+    vty_out(vty, "SA : %s%s", sa->sg_str, VTY_NEWLINE);
     vty_out(vty, "  RP         : %s%s", rp_str, VTY_NEWLINE);
     vty_out(vty, "  Peer       : %s%s", peer_str, VTY_NEWLINE);
     vty_out(vty, "  Local      : %s%s", local_str, VTY_NEWLINE);
index 0da3abe99e3840592722d356d09766ee8468424e..ef4c23e95f6b1a0f0641c1775c68888386da251d 100644 (file)
@@ -213,7 +213,7 @@ void pim_ifchannel_ifjoin_switch(const char *caller,
   if (PIM_DEBUG_PIM_EVENTS)
     zlog_debug ("PIM_IFCHANNEL(%s): %s is switching from %s to %s",
                ch->interface->name,
-               pim_str_sg_dump (&ch->sg),
+               ch->sg_str,
                pim_ifchannel_ifjoin_name (ch->ifjoin_state),
                pim_ifchannel_ifjoin_name (new_state));
 
@@ -236,7 +236,7 @@ void pim_ifchannel_ifjoin_switch(const char *caller,
     if (PIM_DEBUG_PIM_EVENTS) {
       zlog_debug("PIM_IFCHANNEL_%s: (S,G)=%s on interface %s",
                 ((new_state == PIM_IFJOIN_NOINFO) ? "DOWN" : "UP"),
-                pim_str_sg_dump (&ch->sg), ch->interface->name);
+                ch->sg_str, ch->interface->name);
     }
 
     /*
@@ -331,7 +331,7 @@ static void ifmembership_set(struct pim_ifchannel *ch,
   if (PIM_DEBUG_PIM_EVENTS) {
     zlog_debug("%s: (S,G)=%s membership now is %s on interface %s",
               __PRETTY_FUNCTION__,
-              pim_str_sg_dump (&ch->sg),
+              ch->sg_str,
               membership == PIM_IFMEMBERSHIP_INCLUDE ? "INCLUDE" : "NOINFO",
               ch->interface->name);
   }
@@ -426,7 +426,7 @@ pim_ifchannel_add(struct interface *ifp,
   if (!ch) {
     zlog_warn("%s: pim_ifchannel_new() failure for (S,G)=%s on interface %s",
              __PRETTY_FUNCTION__,
-             pim_str_sg_dump (sg), ifp->name);
+             up->sg_str, ifp->name);
 
     pim_upstream_del (up, __PRETTY_FUNCTION__);
     return NULL;
@@ -436,6 +436,7 @@ pim_ifchannel_add(struct interface *ifp,
   ch->upstream                     = up;
   ch->interface                    = ifp;
   ch->sg                           = *sg;
+  pim_str_sg_set (sg, ch->sg_str);
   ch->parent                       = pim_ifchannel_find_parent (ch);
   if (ch->sg.src.s_addr == INADDR_ANY)
     {
@@ -549,7 +550,7 @@ static void check_recv_upstream(int is_join,
     /* RPF'(S,G) not found */
     zlog_warn("%s %s: RPF'%s not found",
              __FILE__, __PRETTY_FUNCTION__, 
-             pim_str_sg_dump (sg));
+             up->sg_str);
     return;
   }
 
@@ -561,7 +562,7 @@ static void check_recv_upstream(int is_join,
     pim_addr_dump("<rpf?>", &up->rpf.rpf_addr, rpf_str, sizeof(rpf_str));
     zlog_warn("%s %s: (S,G)=%s upstream=%s not directed to RPF'(S,G)=%s on interface %s",
              __FILE__, __PRETTY_FUNCTION__, 
-             pim_str_sg_dump (sg),
+             up->sg_str,
              up_str, rpf_str, recv_ifp->name);
     return;
   }
@@ -673,7 +674,7 @@ void pim_ifchannel_join_add(struct interface *ifp,
     pim_inet4_dump("<neigh?>", neigh_addr, neigh_str, sizeof(neigh_str));
     zlog_warn("%s: Assert Loser recv Join%s from %s on %s",
              __PRETTY_FUNCTION__,
-             pim_str_sg_dump (sg), neigh_str, ifp->name);
+             ch->sg_str, neigh_str, ifp->name);
 
     assert_action_a5(ch);
   }
@@ -879,14 +880,9 @@ void pim_ifchannel_local_membership_add(struct interface *ifp,
       for (ALL_LIST_ELEMENTS_RO (up->sources, up_node, child))
         {
          if (PIM_DEBUG_EVENTS)
-           {
-             char buff[100];
-
-             strcpy (buff, pim_str_sg_dump (&child->sg));
-             zlog_debug("%s %s: IGMP (S,G)=%s(%s) from %s",
-                        __FILE__, __PRETTY_FUNCTION__,
-                        buff, ifp->name, pim_str_sg_dump (sg));
-           }
+           zlog_debug("%s %s: IGMP (S,G)=%s(%s) from %s",
+                      __FILE__, __PRETTY_FUNCTION__,
+                      child->sg_str, ifp->name, up->sg_str);
 
          if (pim_upstream_evaluate_join_desired (child))
            {
@@ -929,13 +925,9 @@ void pim_ifchannel_local_membership_del(struct interface *ifp,
          struct pim_interface *pim_ifp = ifp->info;
 
          if (PIM_DEBUG_EVENTS)
-           {
-             char buff[100];
-             strcpy (buff, pim_str_sg_dump (&child->sg));
-             zlog_debug("%s %s: Prune(S,G)=%s(%s) from %s",
-                        __FILE__, __PRETTY_FUNCTION__,
-                        buff, ifp->name, pim_str_sg_dump (&child->sg));
-           }
+           zlog_debug("%s %s: Prune(S,G)=%s(%s) from %s",
+                      __FILE__, __PRETTY_FUNCTION__,
+                      up->sg_str, ifp->name, child->sg_str);
 
          if (c_oil && !pim_upstream_evaluate_join_desired (child))
            pim_channel_del_oif (c_oil, ifp, PIM_OIF_FLAG_PROTO_PIM);
@@ -1119,7 +1111,7 @@ pim_ifchannel_set_star_g_join_state (struct pim_ifchannel *ch, int eom)
   if (PIM_DEBUG_PIM_TRACE)
     zlog_debug ("%s: %s %s eom: %d", __PRETTY_FUNCTION__,
                 pim_ifchannel_ifjoin_name(ch->ifjoin_state),
-                pim_str_sg_dump(&ch->sg), eom);
+                ch->sg_str, eom);
   if (!ch->sources)
     return;
 
index b640cfd4df41b3809a562144f9fb6d08823c00da..a95f66551bacd4e5f4e655b5683049edbad8aed4 100644 (file)
@@ -86,6 +86,7 @@ struct pim_ifchannel {
   struct pim_ifchannel     *parent;
   struct list              *sources;
   struct prefix_sg          sg;
+  char                      sg_str[PIM_SG_LEN];
   struct interface         *interface;   /* backpointer to interface */
   uint32_t                  flags;
 
index 42d4a518744a26cfb57f0ad8ad0a85dab94bbeaa..ff41b28ba4f350a49b2c84f2d72f4a566b6ddb45 100644 (file)
@@ -112,13 +112,10 @@ static void recv_join(struct interface *ifp,
 
       for (ALL_LIST_ELEMENTS_RO (up->sources, up_node, child))
         {
-         char buff[100];
-
-         strcpy (buff, pim_str_sg_dump (&child->sg));
          if (PIM_DEBUG_PIM_TRACE)
            zlog_debug("%s %s: Join(S,G)=%s from %s",
                       __FILE__, __PRETTY_FUNCTION__,
-                      buff, pim_str_sg_dump (sg));
+                      child->sg_str, up->sg_str);
 
          if (pim_upstream_evaluate_join_desired (child))
            {
@@ -183,13 +180,9 @@ static void recv_prune(struct interface *ifp,
          struct pim_interface *pim_ifp = ifp->info;
 
          if (PIM_DEBUG_PIM_TRACE)
-           {
-             char buff[100];
-             strcpy (buff, pim_str_sg_dump (&child->sg));
-             zlog_debug("%s %s: Prune(S,G)=%s from %s",
-                        __FILE__, __PRETTY_FUNCTION__,
-                        buff, pim_str_sg_dump (sg));
-           }
+           zlog_debug("%s %s: Prune(S,G)=%s from %s",
+                      __FILE__, __PRETTY_FUNCTION__,
+                      child->sg_str, up->sg_str);
          if (!c_oil)
            continue;
 
@@ -408,7 +401,7 @@ int pim_joinprune_send(struct interface *ifp,
     zlog_debug("%s: sending %s(S,G)=%s to upstream=%s on interface %s",
               __PRETTY_FUNCTION__,
               send_join ? "Join" : "Prune",
-              pim_str_sg_dump (&up->sg), dst_str, ifp->name);
+              up->sg_str, dst_str, ifp->name);
   }
 
   if (PIM_INADDR_IS_ANY(upstream_addr)) {
@@ -418,7 +411,7 @@ int pim_joinprune_send(struct interface *ifp,
       zlog_debug("%s: %s(S,G)=%s: upstream=%s is myself on interface %s",
                 __PRETTY_FUNCTION__,
                 send_join ? "Join" : "Prune",
-                pim_str_sg_dump (&up->sg), dst_str, ifp->name);
+                up->sg_str, dst_str, ifp->name);
     }
     return 0;
   }
index da12146be157421e3fdd88d2739c3c0b251029a3..c339fce49d51baba84c94b1c51598b248253e534 100644 (file)
@@ -26,9 +26,8 @@
 #include "vty.h"
 #include "plist.h"
 
-#include "pim_macro.h"
 #include "pimd.h"
-#include "pim_str.h"
+#include "pim_macro.h"
 #include "pim_iface.h"
 #include "pim_ifchannel.h"
 #include "pim_rp.h"
@@ -121,7 +120,7 @@ int pim_macro_ch_lost_assert(const struct pim_ifchannel *ch)
   if (!ifp) {
     zlog_warn("%s: (S,G)=%s: null interface",
              __PRETTY_FUNCTION__,
-             pim_str_sg_dump (&ch->sg));
+             ch->sg_str);
     return 0; /* false */
   }
 
@@ -133,7 +132,7 @@ int pim_macro_ch_lost_assert(const struct pim_ifchannel *ch)
   if (!pim_ifp) {
     zlog_warn("%s: (S,G)=%s: multicast not enabled on interface %s",
              __PRETTY_FUNCTION__,
-             pim_str_sg_dump (&ch->sg), ifp->name);
+             ch->sg_str, ifp->name);
     return 0; /* false */
   }
 
@@ -170,7 +169,7 @@ int pim_macro_chisin_pim_include(const struct pim_ifchannel *ch)
   if (!pim_ifp) {
     zlog_warn("%s: (S,G)=%s: multicast not enabled on interface %s",
              __PRETTY_FUNCTION__,
-             pim_str_sg_dump (&ch->sg), ch->interface->name);
+             ch->sg_str, ch->interface->name);
     return 0; /* false */
   }
 
@@ -233,8 +232,7 @@ int pim_macro_ch_could_assert_eval(const struct pim_ifchannel *ch)
   ifp = ch->interface;
   if (!ifp) {
     zlog_warn("%s: (S,G)=%s: null interface",
-             __PRETTY_FUNCTION__,
-             pim_str_sg_dump (&ch->sg));
+             __PRETTY_FUNCTION__, ch->sg_str);
     return 0; /* false */
   }
 
@@ -390,16 +388,14 @@ int pim_macro_assert_tracking_desired_eval(const struct pim_ifchannel *ch)
   ifp = ch->interface;
   if (!ifp) {
     zlog_warn("%s: (S,G)=%s: null interface",
-             __PRETTY_FUNCTION__,
-             pim_str_sg_dump (&ch->sg));
+             __PRETTY_FUNCTION__, ch->sg_str);
     return 0; /* false */
   }
 
   pim_ifp = ifp->info;
   if (!pim_ifp) {
     zlog_warn("%s: (S,G)=%s: multicast not enabled on interface %s",
-             __PRETTY_FUNCTION__,
-             pim_str_sg_dump (&ch->sg), ch->interface->name);
+             __PRETTY_FUNCTION__, ch->sg_str, ch->interface->name);
     return 0; /* false */
   }
 
index 3f8ec3558765e3230457561d542218fb7512c24c..c7730acc04969e713d3ecce777ab48cd55717a13 100644 (file)
@@ -135,11 +135,6 @@ pim_mroute_msg_nocache (int fd, struct interface *ifp, const struct igmpmsg *msg
   sg.src = msg->im_src;
   sg.grp = msg->im_dst;
 
-  if (PIM_DEBUG_MROUTE) {
-    zlog_debug("%s: Adding a Route %s for WHOLEPKT consumption",
-              __PRETTY_FUNCTION__, pim_str_sg_dump (&sg));
-  }
-
   oil = pim_channel_oil_add (&sg, pim_ifp->mroute_vif_index);
   if (!oil) {
     if (PIM_DEBUG_MROUTE) {
@@ -159,6 +154,16 @@ pim_mroute_msg_nocache (int fd, struct interface *ifp, const struct igmpmsg *msg
     }
     return 0;
   }
+
+  /*
+   * I moved this debug till after the actual add because
+   * I want to take advantage of the up->sg_str being filled in.
+   */
+  if (PIM_DEBUG_MROUTE) {
+    zlog_debug("%s: Adding a Route %s for WHOLEPKT consumption",
+              __PRETTY_FUNCTION__, up->sg_str);
+  }
+
   PIM_UPSTREAM_FLAG_SET_SRC_STREAM(up->flags);
   pim_upstream_keep_alive_timer_start (up, qpim_keep_alive_time);
 
@@ -294,7 +299,7 @@ pim_mroute_msg_wrongvif (int fd, struct interface *ifp, const struct igmpmsg *ms
     if (PIM_DEBUG_MROUTE) {
       zlog_debug("%s: WRONGVIF (S,G)=%s channel is not on Assert NoInfo state for interface %s",
                 __PRETTY_FUNCTION__,
-                pim_str_sg_dump (&ch->sg), ifp->name);
+                ch->sg_str, ifp->name);
     }
     return -4;
   }
@@ -303,7 +308,7 @@ pim_mroute_msg_wrongvif (int fd, struct interface *ifp, const struct igmpmsg *ms
     if (PIM_DEBUG_MROUTE) {
       zlog_debug("%s: WRONGVIF (S,G)=%s interface %s is not downstream for channel",
                 __PRETTY_FUNCTION__,
-                pim_str_sg_dump (&ch->sg), ifp->name);
+                ch->sg_str, ifp->name);
     }
     return -5;
   }
@@ -312,7 +317,7 @@ pim_mroute_msg_wrongvif (int fd, struct interface *ifp, const struct igmpmsg *ms
     if (PIM_DEBUG_MROUTE) {
       zlog_debug("%s: WRONGVIF (S,G)=%s assert_action_a1 failure on interface %s",
                 __PRETTY_FUNCTION__,
-                pim_str_sg_dump (&ch->sg), ifp->name);
+                ch->sg_str, ifp->name);
     }
     return -6;
   }
@@ -344,7 +349,7 @@ pim_mroute_msg_wrvifwhole (int fd, struct interface *ifp, const char *buf)
     {
       if (PIM_DEBUG_MROUTE)
        zlog_debug ("WRVIFWHOLE (S,G)=%s found ifchannel on interface %s",
-                   pim_str_sg_dump (&sg), ifp->name);
+                   ch->sg_str, ifp->name);
       return -1;
     }
 #if 0
index 12f363e6fe4d5ed31ae3b6dcbab0627513f48154..bee5e734db734cadd445da59c9cdd46767e0d0c3 100644 (file)
@@ -65,9 +65,9 @@ pim_msdp_sa_key_dump(struct pim_msdp_sa *sa, char *buf, int buf_size, bool long_
   if (long_format && (sa->flags & PIM_MSDP_SAF_PEER)) {
     pim_inet4_dump("<rp?>", sa->rp, rp_str, sizeof(rp_str));
     snprintf(buf, buf_size, "MSDP SA %s rp %s",
-        pim_str_sg_dump(&sa->sg), rp_str);
+            sa->sg_str, rp_str);
   } else {
-    snprintf(buf, buf_size, "MSDP SA %s", pim_str_sg_dump(&sa->sg));
+    snprintf(buf, buf_size, "MSDP SA %s", sa->sg_str);
   }
 
   return buf;
@@ -268,6 +268,7 @@ pim_msdp_sa_new(struct prefix_sg *sg, struct in_addr rp)
   }
 
   sa->sg = *sg;
+  pim_str_sg_set (sg, sa->sg_str);
   sa->rp = rp;
   sa->uptime = pim_time_monotonic_sec();
 
@@ -569,7 +570,7 @@ pim_msdp_up_join_state_changed(struct pim_upstream *xg_up)
   struct pim_msdp_sa *sa;
 
   if (PIM_DEBUG_MSDP_INTERNAL) {
-      zlog_debug("MSDP join state changed for %s", pim_str_sg_dump(&xg_up->sg)); 
+    zlog_debug("MSDP join state changed for %s", xg_up->sg_str);
   }
 
   /* If this is not really an XG entry just move on */
index 38ac4aa337386c2e60f5b182cc353663081c2d3b..0f6402180503bc2b41150c25a12ff29fc93c0be1 100644 (file)
@@ -77,6 +77,7 @@ enum pim_msdp_sa_flags {
 
 struct pim_msdp_sa {
   struct prefix_sg sg;
+  char sg_str[PIM_SG_LEN];
   struct in_addr rp; /* Last RP address associated with this SA */
   struct in_addr peer; /* last peer from who we heard this SA */
   enum pim_msdp_sa_flags flags;
index c22011b576f4845023f94869754386159dd01b79..bb73e34062ff87f92950df906c739b364cd3a4c2 100644 (file)
@@ -211,11 +211,9 @@ pim_msg_join_prune_encode (uint8_t *buf, int buf_size, int is_join,
       struct pim_upstream *child;
       struct listnode *up_node;
       int send_prune = 0;
-      char star_g[100];
 
-      strcpy (star_g, pim_str_sg_dump (&up->sg));
       zlog_debug ("%s: Considering (%s) children for (S,G,rpt) prune",
-                 __PRETTY_FUNCTION__, star_g);
+                 __PRETTY_FUNCTION__, up->sg_str);
       for (ALL_LIST_ELEMENTS_RO (up->sources, up_node, child))
        {
          if (child->sptbit == PIM_UPSTREAM_SPTBIT_TRUE)
@@ -225,12 +223,12 @@ pim_msg_join_prune_encode (uint8_t *buf, int buf_size, int is_join,
                  send_prune = 1;
                  if (PIM_DEBUG_PIM_PACKETS)
                    zlog_debug ("%s: SPT Bit and RPF'(%s) != RPF'(S,G): Add Prune (%s,rpt) to compound message",
-                               __PRETTY_FUNCTION__, star_g, pim_str_sg_dump (&child->sg));
+                               __PRETTY_FUNCTION__, up->sg_str, child->sg_str);
                }
              else
                if (PIM_DEBUG_PIM_PACKETS)
                  zlog_debug ("%s: SPT Bit and RPF'(%s) == RPF'(S,G): Not adding Prune for (%s,rpt)",
-                             __PRETTY_FUNCTION__, star_g, pim_str_sg_dump (&child->sg));
+                             __PRETTY_FUNCTION__, up->sg_str, child->sg_str);
            }
          else if (pim_upstream_is_sg_rpt (child))
            {
@@ -239,24 +237,24 @@ pim_msg_join_prune_encode (uint8_t *buf, int buf_size, int is_join,
                  send_prune = 1;
                  if (PIM_DEBUG_PIM_PACKETS)
                    zlog_debug ("%s: inherited_olist(%s,rpt) is NULL, Add Prune to compound message",
-                               __PRETTY_FUNCTION__, pim_str_sg_dump (&child->sg));
+                               __PRETTY_FUNCTION__, child->sg_str);
                }
              else if (!pim_rpf_is_same (&up->rpf, &child->rpf))
                {
                  send_prune = 1;
                  if (PIM_DEBUG_PIM_PACKETS)
                    zlog_debug ("%s: RPF'(%s) != RPF'(%s,rpt), Add Prune to compound message",
-                               __PRETTY_FUNCTION__, star_g, pim_str_sg_dump (&child->sg));
+                               __PRETTY_FUNCTION__, up->sg_str, child->sg_str);
                }
              else
                if (PIM_DEBUG_PIM_PACKETS)
                  zlog_debug ("%s: RPF'(%s) == RPF'(%s,rpt), Do not add Prune to compound message",
-                             __PRETTY_FUNCTION__, star_g, pim_str_sg_dump (&child->sg));
+                             __PRETTY_FUNCTION__, up->sg_str, child->sg_str);
            }
          else
            if (PIM_DEBUG_PIM_PACKETS)
              zlog_debug ("%s: SPT bit is not set for (%s)",
-                         __PRETTY_FUNCTION__, pim_str_sg_dump (&child->sg));
+                         __PRETTY_FUNCTION__, child->sg_str);
          if (send_prune)
            {
              pim_msg_curr = pim_msg_addr_encode_ipv4_source (pim_msg_curr, remain,
index 8f3edc75801ebe06bb23b81a35a0bfc4ec3d8e28..490a05be37644441a0a2d114167ced99d13d0197 100644 (file)
@@ -112,18 +112,16 @@ pim_register_stop_recv (uint8_t *buf, int buf_size)
   pim_parse_addr_ucast (&source, buf, buf_size);
   sg.src = source.u.prefix4;
 
-  if (PIM_DEBUG_PIM_REG)
-    {
-      zlog_debug ("Received Register stop for %s",
-                 pim_str_sg_dump (&sg));
-    }
-
   upstream = pim_upstream_find (&sg);
   if (!upstream)
     {
       return 0;
     }
 
+  if (PIM_DEBUG_PIM_REG)
+    zlog_debug ("Received Register stop for %s",
+               upstream->sg_str);
+
   switch (upstream->join_state)
     {
     case PIM_UPSTREAM_NOTJOINED:
@@ -157,7 +155,7 @@ pim_register_send (const uint8_t *buf, int buf_size, struct in_addr src, struct
        char rp_str[INET_ADDRSTRLEN];
        strcpy (rp_str, inet_ntoa (rpg->rpf_addr.u.prefix4));
        zlog_debug ("Sending %s %sRegister Packet to %s",
-                  pim_str_sg_dump (&up->sg), null_register ? "NULL " : "", rp_str);
+                  up->sg_str, null_register ? "NULL " : "", rp_str);
     }
 
   ifp = rpg->source_nexthop.interface;
@@ -351,7 +349,7 @@ pim_register_recv (struct interface *ifp,
           {
             if (PIM_DEBUG_PIM_REG)
               {
-                zlog_debug ("Received Register(%s), for which I have no path back", pim_str_sg_dump (&upstream->sg));
+                zlog_debug ("Received Register(%s), for which I have no path back", upstream->sg_str);
               }
             PIM_UPSTREAM_FLAG_UNSET_SRC_STREAM(upstream->flags);
             pim_upstream_del (upstream, __PRETTY_FUNCTION__);
@@ -372,7 +370,7 @@ pim_register_recv (struct interface *ifp,
       sentRegisterStop = 1;
     } else {
       if (PIM_DEBUG_PIM_REG)
-         zlog_debug ("(%s) sptbit: %d", pim_str_sg_dump (&upstream->sg), upstream->sptbit);
+         zlog_debug ("(%s) sptbit: %d", upstream->sg_str, upstream->sptbit);
     }
     if ((upstream->sptbit == PIM_UPSTREAM_SPTBIT_TRUE) ||
        (SwitchToSptDesired(&sg))) {
index b71024711a614c22b15a813e9f00a40a430dc6b9..48cb2e40178b6ab9f64a7b3b4b8898757b5d44c1 100644 (file)
@@ -206,7 +206,7 @@ enum pim_rpf_result pim_rpf_update(struct pim_upstream *up, struct in_addr *old_
     /* RPF'(S,G) not found */
     zlog_debug("%s %s: RPF'%s not found: won't send join upstream",
               __FILE__, __PRETTY_FUNCTION__,
-              pim_str_sg_dump (&up->sg));
+              up->sg_str);
     /* warning only */
   }
 
@@ -218,7 +218,7 @@ enum pim_rpf_result pim_rpf_update(struct pim_upstream *up, struct in_addr *old_
       pim_addr_dump("<addr?>", &rpf->source_nexthop.mrib_nexthop_addr, nhaddr_str, sizeof(nhaddr_str));
       zlog_debug("%s %s: (S,G)=%s source nexthop now is: interface=%s address=%s pref=%d metric=%d",
                 __FILE__, __PRETTY_FUNCTION__,
-                pim_str_sg_dump (&up->sg),
+                up->sg_str,
                 rpf->source_nexthop.interface ? rpf->source_nexthop.interface->name : "<ifname?>",
                 nhaddr_str,
                 rpf->source_nexthop.mrib_metric_preference,
@@ -236,7 +236,7 @@ enum pim_rpf_result pim_rpf_update(struct pim_upstream *up, struct in_addr *old_
     if (PIM_DEBUG_ZEBRA) {
       zlog_debug("%s %s: (S,G)=%s RPF_interface(S) changed from %s to %s",
                 __FILE__, __PRETTY_FUNCTION__,
-                pim_str_sg_dump (&up->sg),
+                up->sg_str,
                 save_nexthop.interface ? save_nexthop.interface->name : "<oldif?>",
                 rpf->source_nexthop.interface ? rpf->source_nexthop.interface->name : "<newif?>");
       /* warning only */
@@ -282,7 +282,7 @@ static struct in_addr pim_rpf_find_rpf_addr(struct pim_upstream *up)
   if (!up->rpf.source_nexthop.interface) {
     zlog_warn("%s: missing RPF interface for upstream (S,G)=%s",
              __PRETTY_FUNCTION__,
-             pim_str_sg_dump (&up->sg));
+             up->sg_str);
 
     rpf_addr.s_addr = PIM_NET_INADDR_ANY;
     return rpf_addr;
index d308d80e3a64a060914b7edeb6bba07456da807d..00abc5f60af8e00549811263a07ccaf50db4c93e 100644 (file)
 #include "memory.h"
 #include "sockopt.h"
 
+#include "pimd.h"
 #include "pim_ssmpingd.h"
 #include "pim_time.h"
 #include "pim_sock.h"
-#include "pim_str.h"
-#include "pimd.h"
 
 static const char * const PIM_SSMPINGD_REPLY_GROUP = "232.43.211.234";
 
index 4c25c00294d54b4846f064de0241e1ed8230fae0..51440317940b7383965d96d8000d2bf4a016de91 100644 (file)
@@ -67,10 +67,24 @@ pim_str_sg_dump (const struct prefix_sg *sg)
 {
   char src_str[INET_ADDRSTRLEN];
   char grp_str[INET_ADDRSTRLEN];
-  static char sg_str[200];
+  static char sg_str[PIM_SG_LEN];
 
   pim_inet4_dump ("<src?>", sg->src, src_str, sizeof(src_str));
   pim_inet4_dump ("<grp?>", sg->grp, grp_str, sizeof(grp_str));
-  snprintf (sg_str, 200, "(%s,%s)", src_str, grp_str);
+  snprintf (sg_str, PIM_SG_LEN, "(%s,%s)", src_str, grp_str);
+
+  return sg_str;
+}
+
+char *
+pim_str_sg_set (const struct prefix_sg *sg, char *sg_str)
+{
+  char src_str[INET_ADDRSTRLEN];
+  char grp_str[INET_ADDRSTRLEN];
+
+  pim_inet4_dump ("<src?>", sg->src, src_str, sizeof(src_str));
+  pim_inet4_dump ("<grp?>", sg->grp, grp_str, sizeof(grp_str));
+  snprintf (sg_str, PIM_SG_LEN, "(%s,%s)", src_str, grp_str);
+
   return sg_str;
 }
index 15f5227de8ab7f8811778f74c93131a2fbb68b36..da7257357085c0ae16c5b4aaefc047e06f0bd730 100644 (file)
 
 #include <prefix.h>
 
+/*
+ * Longest possible length of a (S,G) string is 36 bytes
+ * 123.123.123.123 = 16 * 2
+ * (,) = 3
+ * NULL Character at end = 1
+ * (123.123.123.123,123,123,123,123)
+ */
+#define PIM_SG_LEN 36
+
 void pim_addr_dump (const char *onfail, struct prefix *p, char *buf, int buf_size);
 void pim_inet4_dump(const char *onfail, struct in_addr addr, char *buf, int buf_size);
 char *pim_str_sg_dump (const struct prefix_sg *sg);
+char *pim_str_sg_set (const struct prefix_sg *sg, char *sg_str);
 
 #endif
index 01b0b3ac69e1891e2fe3c27bab845307961c3fad..ec985076df48528283c450d644b5c581190fcdbc 100644 (file)
@@ -160,7 +160,7 @@ pim_upstream_del(struct pim_upstream *up, const char *name)
   if (PIM_DEBUG_PIM_TRACE)
     {
       zlog_debug ("%s: Delete (%s) ref count: %d",
-                 name, pim_str_sg_dump (&up->sg), up->ref_count);
+                 name, up->sg_str, up->ref_count);
     }
   --up->ref_count;
 
@@ -169,8 +169,8 @@ pim_upstream_del(struct pim_upstream *up, const char *name)
 
   if (PIM_DEBUG_PIM_TRACE)
     zlog_debug ("%s: %s is being deleted",
-               __PRETTY_FUNCTION__,
-               pim_str_sg_dump (&up->sg));
+               __PRETTY_FUNCTION__, up->sg_str);
+
   THREAD_OFF(up->t_join_timer);
   THREAD_OFF(up->t_ka_timer);
   THREAD_OFF(up->t_rs_timer);
@@ -224,12 +224,12 @@ pim_upstream_send_join (struct pim_upstream *up)
     char rpf_str[PREFIX_STRLEN];
     pim_addr_dump("<rpf?>", &up->rpf.rpf_addr, rpf_str, sizeof(rpf_str));
     zlog_debug ("%s: RPF'%s=%s(%s) for Interface %s", __PRETTY_FUNCTION__,
-               pim_str_sg_dump (&up->sg), rpf_str, pim_upstream_state2str (up->join_state),
+               up->sg_str, rpf_str, pim_upstream_state2str (up->join_state),
                up->rpf.source_nexthop.interface->name);
     if (pim_rpf_addr_is_inaddr_any(&up->rpf)) {
       zlog_debug("%s: can't send join upstream: RPF'%s=%s",
                 __PRETTY_FUNCTION__,
-                pim_str_sg_dump (&up->sg), rpf_str);
+                up->sg_str, rpf_str);
       /* warning only */
     }
   }
@@ -273,7 +273,7 @@ static void join_timer_start(struct pim_upstream *up)
     zlog_debug("%s: starting %d sec timer for upstream (S,G)=%s",
               __PRETTY_FUNCTION__,
               qpim_t_periodic,
-              pim_str_sg_dump (&up->sg));
+              up->sg_str);
   }
 
   THREAD_OFF (up->t_join_timer);
@@ -295,7 +295,7 @@ static void pim_upstream_join_timer_restart_msec(struct pim_upstream *up,
     zlog_debug("%s: restarting %d msec timer for upstream (S,G)=%s",
               __PRETTY_FUNCTION__,
               interval_msec,
-              pim_str_sg_dump (&up->sg));
+              up->sg_str);
   }
 
   THREAD_OFF(up->t_join_timer);
@@ -321,7 +321,7 @@ void pim_upstream_join_suppress(struct pim_upstream *up,
     pim_inet4_dump("<rpf?>", rpf_addr, rpf_str, sizeof(rpf_str));
     zlog_debug("%s %s: detected Join%s to RPF'(S,G)=%s: join_timer=%ld msec t_joinsuppress=%ld msec",
               __FILE__, __PRETTY_FUNCTION__, 
-              pim_str_sg_dump (&up->sg),
+              up->sg_str,
               rpf_str,
               join_timer_remain_msec, t_joinsuppress_msec);
   }
@@ -330,7 +330,7 @@ void pim_upstream_join_suppress(struct pim_upstream *up,
     if (PIM_DEBUG_PIM_TRACE) {
       zlog_debug("%s %s: suppressing Join(S,G)=%s for %ld msec",
                 __FILE__, __PRETTY_FUNCTION__, 
-                pim_str_sg_dump (&up->sg), t_joinsuppress_msec);
+                up->sg_str, t_joinsuppress_msec);
     }
 
     pim_upstream_join_timer_restart_msec(up, t_joinsuppress_msec);
@@ -352,7 +352,7 @@ void pim_upstream_join_timer_decrease_to_t_override(const char *debug_label,
     pim_inet4_dump("<rpf?>", rpf_addr, rpf_str, sizeof(rpf_str));
     zlog_debug("%s: to RPF'%s=%s: join_timer=%ld msec t_override=%d msec",
               debug_label,
-              pim_str_sg_dump (&up->sg), rpf_str,
+              up->sg_str, rpf_str,
               join_timer_remain_msec, t_override_msec);
   }
     
@@ -360,7 +360,7 @@ void pim_upstream_join_timer_decrease_to_t_override(const char *debug_label,
     if (PIM_DEBUG_PIM_TRACE) {
       zlog_debug("%s: decreasing (S,G)=%s join timer to t_override=%d msec",
                 debug_label,
-                pim_str_sg_dump (&up->sg),
+                up->sg_str,
                 t_override_msec);
     }
 
@@ -432,7 +432,7 @@ pim_upstream_switch(struct pim_upstream *up,
   if (PIM_DEBUG_PIM_EVENTS) {
     zlog_debug("%s: PIM_UPSTREAM_%s: (S,G) old: %s new: %s",
               __PRETTY_FUNCTION__,
-              pim_str_sg_dump (&up->sg),
+              up->sg_str,
               pim_upstream_state2str (up->join_state),
               pim_upstream_state2str (new_state));
   }
@@ -537,6 +537,7 @@ static struct pim_upstream *pim_upstream_new(struct prefix_sg *sg,
   }
   
   up->sg                          = *sg;
+  pim_str_sg_set (sg, up->sg_str);
   up = hash_get (pim_upstream_hash, up, hash_alloc_intern);
   if (!pim_rp_set_upstream_addr (&up->upstream_addr, sg->src, sg->grp))
     {
@@ -584,7 +585,7 @@ static struct pim_upstream *pim_upstream_new(struct prefix_sg *sg,
   if (rpf_result == PIM_RPF_FAILURE) {
     if (PIM_DEBUG_PIM_TRACE)
       zlog_debug ("%s: Attempting to create upstream(%s), Unable to RPF for source", __PRETTY_FUNCTION__,
-                  pim_str_sg_dump (&up->sg));
+                  up->sg_str);
 
     if (up->parent)
       {
@@ -607,7 +608,7 @@ static struct pim_upstream *pim_upstream_new(struct prefix_sg *sg,
   listnode_add_sort(pim_upstream_list, up);
 
   if (PIM_DEBUG_PIM_TRACE)
-    zlog_debug ("%s: Created Upstream %s", __PRETTY_FUNCTION__, pim_str_sg_dump (&up->sg));
+    zlog_debug ("%s: Created Upstream %s", __PRETTY_FUNCTION__, up->sg_str);
 
   return up;
 }
@@ -648,7 +649,7 @@ struct pim_upstream *pim_upstream_add(struct prefix_sg *sg,
       if (up)
        zlog_debug("%s(%s): (%s), found: %d: ref_count: %d",
                   __PRETTY_FUNCTION__, name,
-                  pim_str_sg_dump (&up->sg), found,
+                  up->sg_str, found,
                   up->ref_count);
       else
        zlog_debug("%s(%s): (%s) failure to create",
@@ -786,7 +787,7 @@ void pim_upstream_rpf_genid_changed(struct in_addr neigh_addr)
       pim_addr_dump("<rpf?>", &up->rpf.rpf_addr, rpf_addr_str, sizeof(rpf_addr_str));
       zlog_debug("%s: matching neigh=%s against upstream (S,G)=%s joined=%d rpf_addr=%s",
                 __PRETTY_FUNCTION__,
-                neigh_str, pim_str_sg_dump (&up->sg),
+                neigh_str, up->sg_str,
                 up->join_state == PIM_UPSTREAM_JOINED,
                 rpf_addr_str);
     }
@@ -910,8 +911,8 @@ static void pim_upstream_fhr_kat_expiry(struct pim_upstream *up)
     return;
 
   if (PIM_DEBUG_TRACE)
-    zlog_debug ("kat expired on %s; clear fhr reg state",
-        pim_str_sg_dump (&up->sg));
+    zlog_debug ("kat expired on %s; clear fhr reg state", up->sg_str);
+
   /* stop reg-stop timer */
   THREAD_OFF(up->t_rs_timer);
   /* remove regiface from the OIL if it is there*/
@@ -928,8 +929,8 @@ static void pim_upstream_fhr_kat_start(struct pim_upstream *up)
 {
   if (pim_upstream_could_register(up)) {
     if (PIM_DEBUG_TRACE)
-      zlog_debug ("kat started on %s; set fhr reg state to joined",
-        pim_str_sg_dump (&up->sg));
+      zlog_debug ("kat started on %s; set fhr reg state to joined", up->sg_str);
+
     PIM_UPSTREAM_FLAG_SET_FHR(up->flags);
     if (up->join_state == PIM_UPSTREAM_NOTJOINED) {
       pim_channel_add_oif (up->channel_oil, pim_regiface, PIM_OIF_FLAG_PROTO_PIM);
@@ -969,8 +970,7 @@ pim_upstream_keep_alive_timer (struct thread *t)
   {
     pim_upstream_fhr_kat_expiry(up);
     if (PIM_DEBUG_TRACE)
-      zlog_debug ("kat expired on %s; remove stream reference",
-          pim_str_sg_dump (&up->sg));
+      zlog_debug ("kat expired on %s; remove stream reference", up->sg_str);
     PIM_UPSTREAM_FLAG_UNSET_SRC_STREAM(up->flags);
     pim_upstream_del(up, __PRETTY_FUNCTION__);
   }
@@ -984,8 +984,7 @@ pim_upstream_keep_alive_timer_start (struct pim_upstream *up,
 {
   if (!PIM_UPSTREAM_FLAG_TEST_SRC_STREAM(up->flags)) {
     if (PIM_DEBUG_TRACE)
-      zlog_debug ("kat start on %s with no stream reference",
-          pim_str_sg_dump (&up->sg));
+      zlog_debug ("kat start on %s with no stream reference", up->sg_str);
   }
   THREAD_OFF (up->t_ka_timer);
   THREAD_TIMER_ON (master,
@@ -1111,7 +1110,7 @@ pim_upstream_set_sptbit (struct pim_upstream *up, struct interface *incoming)
     {
       if (PIM_DEBUG_TRACE)
        zlog_debug ("%s: %s is directly connected to the source", __PRETTY_FUNCTION__,
-                   pim_str_sg_dump (&up->sg));
+                   up->sg_str);
       up->sptbit = PIM_UPSTREAM_SPTBIT_TRUE;
       return;
      }
@@ -1122,7 +1121,7 @@ pim_upstream_set_sptbit (struct pim_upstream *up, struct interface *incoming)
     {
       if (PIM_DEBUG_TRACE)
        zlog_debug ("%s: %s RPF_interface(S) != RPF_interface(RP(G))",
-                   __PRETTY_FUNCTION__, pim_str_sg_dump(&up->sg));
+                   __PRETTY_FUNCTION__, up->sg_str);
       up->sptbit = PIM_UPSTREAM_SPTBIT_TRUE;
       return;
     }
@@ -1132,7 +1131,7 @@ pim_upstream_set_sptbit (struct pim_upstream *up, struct interface *incoming)
     {
       if (PIM_DEBUG_TRACE)
        zlog_debug ("%s: %s OR inherited_olist(S,G,rpt) == NULL", __PRETTY_FUNCTION__,
-                   pim_str_sg_dump (&up->sg));
+                   up->sg_str);
       up->sptbit = PIM_UPSTREAM_SPTBIT_TRUE;
       return;
     }
@@ -1143,7 +1142,7 @@ pim_upstream_set_sptbit (struct pim_upstream *up, struct interface *incoming)
     {
       if (PIM_DEBUG_TRACE)
        zlog_debug ("%s: %s RPF'(S,G) is the same as RPF'(*,G)", __PRETTY_FUNCTION__,
-                   pim_str_sg_dump (&up->sg));
+                   up->sg_str);
       up->sptbit = PIM_UPSTREAM_SPTBIT_TRUE;
       return;
     }
@@ -1186,7 +1185,7 @@ pim_upstream_register_stop_timer (struct thread *t)
   if (PIM_DEBUG_TRACE)
     {
       zlog_debug ("%s: (S,G)=%s upstream register stop timer %s",
-                 __PRETTY_FUNCTION__, pim_str_sg_dump (&up->sg),
+                 __PRETTY_FUNCTION__, up->sg_str,
                   pim_upstream_state2str(up->join_state));
     }
 
@@ -1252,7 +1251,7 @@ pim_upstream_start_register_stop_timer (struct pim_upstream *up, int null_regist
   if (PIM_DEBUG_TRACE)
     {
       zlog_debug ("%s: (S,G)=%s Starting upstream register stop timer %d",
-                 __PRETTY_FUNCTION__, pim_str_sg_dump (&up->sg), time);
+                 __PRETTY_FUNCTION__, up->sg_str, time);
     }
   THREAD_TIMER_ON (master, up->t_rs_timer,
                   pim_upstream_register_stop_timer,
@@ -1343,7 +1342,7 @@ pim_upstream_find_new_rpf (void)
        {
          if (PIM_DEBUG_PIM_TRACE)
            zlog_debug ("Upstream %s without a path to send join, checking",
-                       pim_str_sg_dump (&up->sg));
+                       up->sg_str);
          pim_rpf_update (up, NULL);
        }
     }
@@ -1431,7 +1430,7 @@ pim_upstream_sg_running (void *arg)
     {
       if (PIM_DEBUG_TRACE)
        zlog_debug ("%s: %s is not installed in mroute",
-                   __PRETTY_FUNCTION__, pim_str_sg_dump (&up->sg));
+                   __PRETTY_FUNCTION__, up->sg_str);
       return;
     }
 
@@ -1445,7 +1444,7 @@ pim_upstream_sg_running (void *arg)
       if (PIM_DEBUG_TRACE)
        {
          zlog_debug ("%s: %s old packet count is equal or lastused is greater than 30",
-                     __PRETTY_FUNCTION__, pim_str_sg_dump (&up->sg));
+                     __PRETTY_FUNCTION__, up->sg_str);
          zlog_debug ("%s: %ld %ld %lld", __PRETTY_FUNCTION__, up->channel_oil->cc.oldpktcnt, up->channel_oil->cc.pktcnt, up->channel_oil->cc.lastused/100);
        }
       return;
@@ -1457,8 +1456,8 @@ pim_upstream_sg_running (void *arg)
     if (!PIM_UPSTREAM_FLAG_TEST_SRC_STREAM(up->flags))
     {
       if (PIM_DEBUG_TRACE)
-        zlog_debug ("source reference created on kat restart %s",
-            pim_str_sg_dump (&up->sg));
+        zlog_debug ("source reference created on kat restart %s", up->sg_str);
+
       pim_upstream_ref(up, PIM_UPSTREAM_FLAG_MASK_SRC_STREAM);
       PIM_UPSTREAM_FLAG_SET_SRC_STREAM(up->flags);
       pim_upstream_fhr_kat_start(up);
index a40265a906d42e197373e6acda5e78525af8e5b6..cc4860a215648df9f541b101b5f46ede90373467 100644 (file)
@@ -83,6 +83,7 @@ struct pim_upstream {
   struct in_addr           upstream_addr;/* Who we are talking to */
   struct in_addr           upstream_register; /*Who we received a register from*/
   struct prefix_sg         sg;           /* (S,G) group key */
+  char                     sg_str[PIM_SG_LEN];
   uint32_t                 flags;
   struct channel_oil      *channel_oil;
   struct list             *sources;
index 815fbbd2d3f779a026b10fd37ed20554bfe13ac7..f5c73efe2dfbda74eab06d91339551d351cbb4ac 100644 (file)
@@ -1188,7 +1188,7 @@ void pim_forward_start(struct pim_ifchannel *ch)
       if (PIM_DEBUG_PIM_TRACE)
        zlog_debug("%s %s: could not create OIL for channel (S,G)=%s",
                   __FILE__, __PRETTY_FUNCTION__,
-                  pim_str_sg_dump (&up->sg));
+                  up->sg_str);
       return;
     }
   }
@@ -1205,14 +1205,14 @@ void pim_forward_stop(struct pim_ifchannel *ch)
   if (PIM_DEBUG_PIM_TRACE) {
     zlog_debug("%s: (S,G)=%s oif=%s",
               __PRETTY_FUNCTION__,
-              pim_str_sg_dump (&ch->sg), ch->interface->name);
+              ch->sg_str, ch->interface->name);
   }
 
   if (!up->channel_oil) {
     if (PIM_DEBUG_PIM_TRACE)
       zlog_debug("%s: (S,G)=%s oif=%s missing channel OIL",
                 __PRETTY_FUNCTION__,
-                pim_str_sg_dump(&ch->sg), ch->interface->name);
+                ch->sg_str, ch->interface->name);
 
     return;
   }
index 75a13a1e6b1ea03afa081b6c8982bb68acc701ee..0899d831e6547306f5c0e02b87d95913496ddd78 100644 (file)
@@ -24,6 +24,7 @@
 
 #include <stdint.h>
 
+#include "pim_str.h"
 #include "pim_memory.h"
 #include "pim_assert.h"