From ee1a477a046442f251e18d16fcfc8039b94a09bf Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Fri, 22 Jul 2016 23:28:13 -0400 Subject: [PATCH] pimd: Convert pim_ifchannel_join_add to struct prefix *sg Convert the pim_ifchannel_join_add to use a struct prefix *sg instead of struct in_addr's. Signed-off-by: Donald Sharp --- pimd/pim_ifchannel.c | 29 ++++++++--------------------- pimd/pim_ifchannel.h | 3 +-- pimd/pim_join.c | 16 +++++++++------- 3 files changed, 18 insertions(+), 30 deletions(-) diff --git a/pimd/pim_ifchannel.c b/pimd/pim_ifchannel.c index 27d51ea731..17e3de5710 100644 --- a/pimd/pim_ifchannel.c +++ b/pimd/pim_ifchannel.c @@ -124,13 +124,9 @@ void pim_ifchannel_ifjoin_switch(const char *caller, ) { if (PIM_DEBUG_PIM_EVENTS) { - char src_str[100]; - char grp_str[100]; - pim_inet4_dump("", ch->sg.u.sg.src, src_str, sizeof(src_str)); - pim_inet4_dump("", ch->sg.u.sg.grp, grp_str, sizeof(grp_str)); - zlog_debug("PIM_IFCHANNEL_%s: (S,G)=(%s,%s) on interface %s", + zlog_debug("PIM_IFCHANNEL_%s: (S,G)=%s on interface %s", ((new_state == PIM_IFJOIN_NOINFO) ? "DOWN" : "UP"), - src_str, grp_str, ch->interface->name); + pim_str_sg_dump (&ch->sg), ch->interface->name); } /* @@ -221,13 +217,9 @@ static void ifmembership_set(struct pim_ifchannel *ch, return; if (PIM_DEBUG_PIM_EVENTS) { - char src_str[100]; - char grp_str[100]; - pim_inet4_dump("", ch->sg.u.sg.src, src_str, sizeof(src_str)); - pim_inet4_dump("", ch->sg.u.sg.grp, grp_str, sizeof(grp_str)); - zlog_debug("%s: (S,G)=(%s,%s) membership now is %s on interface %s", + zlog_debug("%s: (S,G)=%s membership now is %s on interface %s", __PRETTY_FUNCTION__, - src_str, grp_str, + pim_str_sg_dump (&ch->sg), membership == PIM_IFMEMBERSHIP_INCLUDE ? "INCLUDE" : "NOINFO", ch->interface->name); } @@ -523,24 +515,19 @@ static int nonlocal_upstream(int is_join, void pim_ifchannel_join_add(struct interface *ifp, struct in_addr neigh_addr, struct in_addr upstream, - struct in_addr source_addr, - struct in_addr group_addr, + struct prefix *sg, uint8_t source_flags, uint16_t holdtime) { struct pim_interface *pim_ifp; struct pim_ifchannel *ch; - struct prefix sg; - memset (&sg, 0, sizeof (struct prefix)); - sg.u.sg.src = source_addr; - sg.u.sg.grp = group_addr; if (nonlocal_upstream(1 /* join */, ifp, upstream, - source_addr, group_addr, source_flags, holdtime)) { + sg->u.sg.src, sg->u.sg.grp, source_flags, holdtime)) { return; } - ch = pim_ifchannel_add(ifp, &sg); + ch = pim_ifchannel_add(ifp, sg); if (!ch) return; @@ -565,7 +552,7 @@ void pim_ifchannel_join_add(struct interface *ifp, pim_inet4_dump("", 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); + pim_str_sg_dump (sg), neigh_str, ifp->name); assert_action_a5(ch); } diff --git a/pimd/pim_ifchannel.h b/pimd/pim_ifchannel.h index aa8585a2b7..17678f7425 100644 --- a/pimd/pim_ifchannel.h +++ b/pimd/pim_ifchannel.h @@ -110,8 +110,7 @@ struct pim_ifchannel *pim_ifchannel_add(struct interface *ifp, void pim_ifchannel_join_add(struct interface *ifp, struct in_addr neigh_addr, struct in_addr upstream, - struct in_addr source_addr, - struct in_addr group_addr, + struct prefix *sg, uint8_t source_flags, uint16_t holdtime); void pim_ifchannel_prune(struct interface *ifp, diff --git a/pimd/pim_join.c b/pimd/pim_join.c index 75f484e577..afebc03109 100644 --- a/pimd/pim_join.c +++ b/pimd/pim_join.c @@ -55,18 +55,20 @@ static void recv_join(struct interface *ifp, struct in_addr source, uint8_t source_flags) { + struct prefix sg; + + memset (&sg, 0, sizeof (struct prefix)); + sg.u.sg.src = source; + sg.u.sg.grp = group; + if (PIM_DEBUG_PIM_TRACE) { char up_str[100]; - char src_str[100]; - char grp_str[100]; char neigh_str[100]; pim_inet4_dump("", upstream, up_str, sizeof(up_str)); - pim_inet4_dump("", source, src_str, sizeof(src_str)); - pim_inet4_dump("", group, grp_str, sizeof(grp_str)); pim_inet4_dump("", neigh->source_addr, neigh_str, sizeof(neigh_str)); - zlog_warn("%s: join (S,G)=(%s,%s) rpt=%d wc=%d upstream=%s holdtime=%d from %s on %s", + zlog_warn("%s: join (S,G)=%s rpt=%d wc=%d upstream=%s holdtime=%d from %s on %s", __PRETTY_FUNCTION__, - src_str, grp_str, + pim_str_sg_dump (&sg), source_flags & PIM_RPT_BIT_MASK, source_flags & PIM_WILDCARD_BIT_MASK, up_str, holdtime, neigh_str, ifp->name); @@ -74,7 +76,7 @@ static void recv_join(struct interface *ifp, /* Restart join expiry timer */ pim_ifchannel_join_add(ifp, neigh->source_addr, upstream, - source, group, source_flags, holdtime); + &sg, source_flags, holdtime); } static void recv_prune(struct interface *ifp, -- 2.39.5