From: Donald Sharp Date: Fri, 19 Aug 2016 11:56:59 +0000 (-0400) Subject: pimd: Modify pim_upstream_state2str for more usage X-Git-Tag: frr-3.0-branchpoint~64^2~10^2~279 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=c98029541203906cfec89974658301367d55fe79;p=mirror%2Ffrr.git pimd: Modify pim_upstream_state2str for more usage Just pass in the actual state to allow us to translate the state to a string even if we don't have a upstream. Signed-off-by: Donald Sharp --- diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c index 8067219e45..ba2d4a063b 100644 --- a/pimd/pim_cmd.c +++ b/pimd/pim_cmd.c @@ -1004,7 +1004,7 @@ static void pim_show_upstream(struct vty *vty) up->rpf.source_nexthop.interface->name, src_str, grp_str, - pim_upstream_state2str (up), + pim_upstream_state2str (up->join_state), uptime, join_timer, rs_timer, diff --git a/pimd/pim_upstream.c b/pimd/pim_upstream.c index 957cf456c1..abc3f53c56 100644 --- a/pimd/pim_upstream.c +++ b/pimd/pim_upstream.c @@ -175,7 +175,7 @@ pim_upstream_send_join (struct pim_upstream *up) char rpf_str[100]; pim_inet4_dump("", 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), + pim_str_sg_dump (&up->sg), rpf_str, pim_upstream_state2str (up->join_state), up->rpf.source_nexthop.interface->name); if (PIM_INADDR_IS_ANY(up->rpf.rpf_addr)) { zlog_debug("%s: can't send join upstream: RPF'%s=%s", @@ -379,10 +379,11 @@ pim_upstream_switch(struct pim_upstream *up, enum pim_upstream_state old_state = up->join_state; if (PIM_DEBUG_PIM_EVENTS) { - zlog_debug("%s: PIM_UPSTREAM_%s: (S,G)=%s", + zlog_debug("%s: PIM_UPSTREAM_%s: (S,G) old: %s new: %s", __PRETTY_FUNCTION__, - ((new_state == PIM_UPSTREAM_JOINED) ? "JOINED" : "NOTJOINED"), - pim_str_sg_dump (&up->sg)); + pim_str_sg_dump (&up->sg), + pim_upstream_state2str (up->join_state), + pim_upstream_state2str (new_state)); } /* @@ -901,9 +902,9 @@ pim_upstream_switch_to_spt_desired (struct prefix_sg *sg) } const char * -pim_upstream_state2str (struct pim_upstream *up) +pim_upstream_state2str (enum pim_upstream_state join_state) { - switch (up->join_state) + switch (join_state) { case PIM_UPSTREAM_NOTJOINED: return "NtJnd"; @@ -936,7 +937,7 @@ pim_upstream_register_stop_timer (struct thread *t) { zlog_debug ("%s: (S,G)=%s upstream register stop timer %s", __PRETTY_FUNCTION__, pim_str_sg_dump (&up->sg), - pim_upstream_state2str(up)); + pim_upstream_state2str(up->join_state)); } switch (up->join_state) diff --git a/pimd/pim_upstream.h b/pimd/pim_upstream.h index fccb1c4186..03dcd6bfd2 100644 --- a/pimd/pim_upstream.h +++ b/pimd/pim_upstream.h @@ -157,7 +157,7 @@ void pim_upstream_send_join (struct pim_upstream *up); void pim_upstream_switch (struct pim_upstream *up, enum pim_upstream_state new_state); -const char *pim_upstream_state2str (struct pim_upstream *up); +const char *pim_upstream_state2str (enum pim_upstream_state join_state); int pim_upstream_inherited_olist (struct pim_upstream *up); #endif /* PIM_UPSTREAM_H */