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);
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 */
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 */
}
}
{
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;
}
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));
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;
{
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);
}
}
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);
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,
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 */
}
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 */
}
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;
}
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 */
}
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);
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));
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);
}
/*
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);
}
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;
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)
{
/* 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;
}
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;
}
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);
}
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))
{
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);
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;
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;
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))
{
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;
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)) {
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;
}
#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"
if (!ifp) {
zlog_warn("%s: (S,G)=%s: null interface",
__PRETTY_FUNCTION__,
- pim_str_sg_dump (&ch->sg));
+ ch->sg_str);
return 0; /* false */
}
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 */
}
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 */
}
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 */
}
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 */
}
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) {
}
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);
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;
}
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;
}
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;
}
{
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
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;
}
sa->sg = *sg;
+ pim_str_sg_set (sg, sa->sg_str);
sa->rp = rp;
sa->uptime = pim_time_monotonic_sec();
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 */
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;
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)
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))
{
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,
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:
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;
{
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__);
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))) {
/* 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 */
}
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,
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 */
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;
#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";
{
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;
}
#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
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;
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);
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 */
}
}
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);
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);
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);
}
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);
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);
}
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);
}
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));
}
}
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))
{
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)
{
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;
}
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",
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);
}
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*/
{
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);
{
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__);
}
{
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,
{
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;
}
{
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;
}
{
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;
}
{
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;
}
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));
}
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,
{
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);
}
}
{
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;
}
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;
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);
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;
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;
}
}
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;
}
#include <stdint.h>
+#include "pim_str.h"
#include "pim_memory.h"
#include "pim_assert.h"