From 1b249e70979b5cd625dc221a77c82f8b10236066 Mon Sep 17 00:00:00 2001 From: Anuradha Karuppiah Date: Fri, 15 Nov 2019 08:47:33 -0800 Subject: [PATCH] pimd: update add_oif and del_oif debugs to print caller These logs were printing file name which has little value (is always pim_oil.c). Instead print the caller. add_oif/del_oif are being called directly from one too many. Instead OIF setup needs to be consolidated via the PIM state machine. These debugs are expected to help in understanding what needs to be cleaned up. Signed-off-by: Anuradha Karuppiah --- pimd/pim_ifchannel.c | 38 +++++++++++++++++++++++++------------- pimd/pim_join.c | 3 ++- pimd/pim_oil.c | 12 ++++++------ pimd/pim_oil.h | 4 ++-- pimd/pim_register.c | 4 ++-- pimd/pim_upstream.c | 23 ++++++++++++++--------- pimd/pim_vxlan.c | 5 +++-- pimd/pim_zebra.c | 14 ++++++++------ 8 files changed, 62 insertions(+), 41 deletions(-) diff --git a/pimd/pim_ifchannel.c b/pimd/pim_ifchannel.c index 48bd031f1e..77104dc81f 100644 --- a/pimd/pim_ifchannel.c +++ b/pimd/pim_ifchannel.c @@ -147,10 +147,11 @@ void pim_ifchannel_delete(struct pim_ifchannel *ch) ch->upstream, ch, ch->parent)) pim_channel_add_oif(ch->upstream->channel_oil, ch->interface, - PIM_OIF_FLAG_PROTO_STAR); + PIM_OIF_FLAG_PROTO_STAR, + __func__); pim_channel_del_oif(ch->upstream->channel_oil, - ch->interface, mask); + ch->interface, mask, __func__); /* * Do we have any S,G's that are inheriting? * Nuke from on high too. @@ -163,7 +164,8 @@ void pim_ifchannel_delete(struct pim_ifchannel *ch) up_node, child)) pim_channel_del_oif(child->channel_oil, ch->interface, - PIM_OIF_FLAG_PROTO_STAR); + PIM_OIF_FLAG_PROTO_STAR, + __func__); } } @@ -297,7 +299,8 @@ void pim_ifchannel_ifjoin_switch(const char *caller, struct pim_ifchannel *ch, pim_ifp->pim, child)) { pim_channel_del_oif( c_oil, ch->interface, - PIM_OIF_FLAG_PROTO_STAR); + PIM_OIF_FLAG_PROTO_STAR, + __func__); pim_upstream_update_join_desired( pim_ifp->pim, child); } @@ -314,7 +317,8 @@ void pim_ifchannel_ifjoin_switch(const char *caller, struct pim_ifchannel *ch, [pim_ifp->mroute_vif_index]) pim_channel_del_oif( c_oil, ch->interface, - PIM_OIF_FLAG_PROTO_STAR); + PIM_OIF_FLAG_PROTO_STAR, + __func__); } } if (ch->ifjoin_state == PIM_IFJOIN_JOIN) { @@ -333,7 +337,8 @@ void pim_ifchannel_ifjoin_switch(const char *caller, struct pim_ifchannel *ch, pim_channel_add_oif( child->channel_oil, ch->interface, - PIM_OIF_FLAG_PROTO_STAR); + PIM_OIF_FLAG_PROTO_STAR, + __func__); pim_upstream_update_join_desired( pim_ifp->pim, child); } @@ -904,7 +909,8 @@ void pim_ifchannel_join_add(struct interface *ifp, struct in_addr neigh_addr, ch->upstream)) { pim_channel_add_oif(ch->upstream->channel_oil, ch->interface, - PIM_OIF_FLAG_PROTO_PIM); + PIM_OIF_FLAG_PROTO_PIM, + __func__); pim_upstream_update_join_desired(pim_ifp->pim, ch->upstream); } @@ -1105,7 +1111,8 @@ int pim_ifchannel_local_membership_add(struct interface *ifp, if (pim_upstream_evaluate_join_desired_interface( child, ch, starch)) { pim_channel_add_oif(child->channel_oil, ifp, - PIM_OIF_FLAG_PROTO_STAR); + PIM_OIF_FLAG_PROTO_STAR, + __func__); pim_upstream_switch(pim, child, PIM_UPSTREAM_JOINED); } @@ -1124,12 +1131,14 @@ int pim_ifchannel_local_membership_add(struct interface *ifp, == PREFIX_DENY) { pim_channel_add_oif( up->channel_oil, pim->regiface, - PIM_OIF_FLAG_PROTO_IGMP); + PIM_OIF_FLAG_PROTO_IGMP, + __func__); } } } else pim_channel_add_oif(up->channel_oil, pim->regiface, - PIM_OIF_FLAG_PROTO_IGMP); + PIM_OIF_FLAG_PROTO_IGMP, + __func__); } return 1; @@ -1178,7 +1187,8 @@ void pim_ifchannel_local_membership_del(struct interface *ifp, && !pim_upstream_evaluate_join_desired_interface( child, ch, starch)) pim_channel_del_oif(c_oil, ifp, - PIM_OIF_FLAG_PROTO_STAR); + PIM_OIF_FLAG_PROTO_STAR, + __func__); /* * If the S,G has no if channel and the c_oil still @@ -1189,7 +1199,8 @@ void pim_ifchannel_local_membership_del(struct interface *ifp, if (!chchannel && c_oil && c_oil->oil.mfcc_ttls[pim_ifp->mroute_vif_index]) pim_channel_del_oif(c_oil, ifp, - PIM_OIF_FLAG_PROTO_STAR); + PIM_OIF_FLAG_PROTO_STAR, + __func__); /* Child node removal/ref count-- will happen as part of * parent' delete_no_info */ @@ -1408,7 +1419,8 @@ void pim_ifchannel_set_star_g_join_state(struct pim_ifchannel *ch, int eom, child->upstream))) { pim_channel_add_oif( child->upstream->channel_oil, - ch->interface, PIM_OIF_FLAG_PROTO_STAR); + ch->interface, PIM_OIF_FLAG_PROTO_STAR, + __func__); pim_upstream_switch(pim, child->upstream, PIM_UPSTREAM_JOINED); pim_jp_agg_single_upstream_send( diff --git a/pimd/pim_join.c b/pimd/pim_join.c index 842d6684b5..fcd93bcf24 100644 --- a/pimd/pim_join.c +++ b/pimd/pim_join.c @@ -340,7 +340,8 @@ int pim_joinprune_recv(struct interface *ifp, struct pim_neighbor *neigh, pim_channel_del_oif( up->channel_oil, starg_ch->interface, - PIM_OIF_FLAG_PROTO_STAR); + PIM_OIF_FLAG_PROTO_STAR, + __func__); } } } diff --git a/pimd/pim_oil.c b/pimd/pim_oil.c index d142934916..7e88ea4fb6 100644 --- a/pimd/pim_oil.c +++ b/pimd/pim_oil.c @@ -273,7 +273,7 @@ void pim_channel_oil_del(struct channel_oil *c_oil, const char *name) } int pim_channel_del_oif(struct channel_oil *channel_oil, struct interface *oif, - uint32_t proto_mask) + uint32_t proto_mask, const char *caller) { struct pim_interface *pim_ifp; @@ -363,8 +363,8 @@ int pim_channel_del_oif(struct channel_oil *channel_oil, struct interface *oif, pim_inet4_dump("", channel_oil->oil.mfcc_origin, source_str, sizeof(source_str)); zlog_debug( - "%s %s: (S,G)=(%s,%s): proto_mask=%u IIF:%d OIF=%s vif_index=%d", - __FILE__, __PRETTY_FUNCTION__, source_str, group_str, + "%s(%s): (S,G)=(%s,%s): proto_mask=%u IIF:%d OIF=%s vif_index=%d", + __PRETTY_FUNCTION__, caller, source_str, group_str, proto_mask, channel_oil->oil.mfcc_parent, oif->name, pim_ifp->mroute_vif_index); } @@ -374,7 +374,7 @@ int pim_channel_del_oif(struct channel_oil *channel_oil, struct interface *oif, int pim_channel_add_oif(struct channel_oil *channel_oil, struct interface *oif, - uint32_t proto_mask) + uint32_t proto_mask, const char *caller) { struct pim_interface *pim_ifp; int old_ttl; @@ -557,8 +557,8 @@ int pim_channel_add_oif(struct channel_oil *channel_oil, struct interface *oif, pim_inet4_dump("", channel_oil->oil.mfcc_origin, source_str, sizeof(source_str)); zlog_debug( - "%s %s: (S,G)=(%s,%s): proto_mask=%u OIF=%s vif_index=%d: DONE", - __FILE__, __PRETTY_FUNCTION__, source_str, group_str, + "%s(%s): (S,G)=(%s,%s): proto_mask=%u OIF=%s vif_index=%d: DONE", + __PRETTY_FUNCTION__, caller, source_str, group_str, proto_mask, oif->name, pim_ifp->mroute_vif_index); } diff --git a/pimd/pim_oil.h b/pimd/pim_oil.h index 319a1c91a3..3d4488a422 100644 --- a/pimd/pim_oil.h +++ b/pimd/pim_oil.h @@ -120,9 +120,9 @@ void pim_channel_oil_change_iif(struct pim_instance *pim, void pim_channel_oil_del(struct channel_oil *c_oil, const char *name); int pim_channel_add_oif(struct channel_oil *c_oil, struct interface *oif, - uint32_t proto_mask); + uint32_t proto_mask, const char *caller); int pim_channel_del_oif(struct channel_oil *c_oil, struct interface *oif, - uint32_t proto_mask); + uint32_t proto_mask, const char *caller); int pim_channel_oil_empty(struct channel_oil *c_oil); diff --git a/pimd/pim_register.c b/pimd/pim_register.c index aff3fbed6c..ce23de314a 100644 --- a/pimd/pim_register.c +++ b/pimd/pim_register.c @@ -59,7 +59,7 @@ void pim_register_join(struct pim_upstream *up) } pim_channel_add_oif(up->channel_oil, pim->regiface, - PIM_OIF_FLAG_PROTO_PIM); + PIM_OIF_FLAG_PROTO_PIM, __func__); up->reg_state = PIM_REG_JOIN; pim_vxlan_update_sg_reg_state(pim, up, true /*reg_join*/); } @@ -145,7 +145,7 @@ int pim_register_stop_recv(struct interface *ifp, uint8_t *buf, int buf_size) case PIM_REG_JOIN: upstream->reg_state = PIM_REG_PRUNE; pim_channel_del_oif(upstream->channel_oil, pim->regiface, - PIM_OIF_FLAG_PROTO_PIM); + PIM_OIF_FLAG_PROTO_PIM, __func__); pim_upstream_start_register_stop_timer(upstream, 0); pim_vxlan_update_sg_reg_state(pim, upstream, false/*reg_join*/); diff --git a/pimd/pim_upstream.c b/pimd/pim_upstream.c index 40b7e3d236..02dfb136c5 100644 --- a/pimd/pim_upstream.c +++ b/pimd/pim_upstream.c @@ -532,7 +532,8 @@ void pim_upstream_register_reevaluate(struct pim_instance *pim) /* remove regiface from the OIL if it is there*/ pim_channel_del_oif(up->channel_oil, pim->regiface, - PIM_OIF_FLAG_PROTO_PIM); + PIM_OIF_FLAG_PROTO_PIM, + __func__); up->reg_state = PIM_REG_NOINFO; } } else { @@ -544,7 +545,8 @@ void pim_upstream_register_reevaluate(struct pim_instance *pim) up->sg_str); pim_channel_add_oif(up->channel_oil, pim->regiface, - PIM_OIF_FLAG_PROTO_PIM); + PIM_OIF_FLAG_PROTO_PIM, + __func__); up->reg_state = PIM_REG_JOIN; } } @@ -1116,7 +1118,7 @@ static void pim_upstream_fhr_kat_expiry(struct pim_instance *pim, THREAD_OFF(up->t_rs_timer); /* remove regiface from the OIL if it is there*/ pim_channel_del_oif(up->channel_oil, pim->regiface, - PIM_OIF_FLAG_PROTO_PIM); + PIM_OIF_FLAG_PROTO_PIM, __func__); /* clear the register state */ up->reg_state = PIM_REG_NOINFO; PIM_UPSTREAM_FLAG_UNSET_FHR(up->flags); @@ -1445,7 +1447,8 @@ static int pim_upstream_register_stop_timer(struct thread *t) case PIM_REG_JOIN_PENDING: up->reg_state = PIM_REG_JOIN; pim_channel_add_oif(up->channel_oil, pim->regiface, - PIM_OIF_FLAG_PROTO_PIM); + PIM_OIF_FLAG_PROTO_PIM, + __func__); pim_vxlan_update_sg_reg_state(pim, up, true /*reg_join*/); break; case PIM_REG_JOIN: @@ -1546,7 +1549,8 @@ int pim_upstream_inherited_olist_decide(struct pim_instance *pim, if (!ch) flag = PIM_OIF_FLAG_PROTO_STAR; - pim_channel_add_oif(up->channel_oil, ifp, flag); + pim_channel_add_oif(up->channel_oil, ifp, flag, + __func__); output_intf++; } } @@ -1803,7 +1807,7 @@ void pim_upstream_add_lhr_star_pimreg(struct pim_instance *pim) continue; pim_channel_add_oif(up->channel_oil, pim->regiface, - PIM_OIF_FLAG_PROTO_IGMP); + PIM_OIF_FLAG_PROTO_IGMP, __func__); } } @@ -1852,17 +1856,18 @@ void pim_upstream_remove_lhr_star_pimreg(struct pim_instance *pim, if (!nlist) { pim_channel_del_oif(up->channel_oil, pim->regiface, - PIM_OIF_FLAG_PROTO_IGMP); + PIM_OIF_FLAG_PROTO_IGMP, __func__); continue; } g.u.prefix4 = up->sg.grp; apply_new = prefix_list_apply(np, &g); if (apply_new == PREFIX_DENY) pim_channel_add_oif(up->channel_oil, pim->regiface, - PIM_OIF_FLAG_PROTO_IGMP); + PIM_OIF_FLAG_PROTO_IGMP, + __func__); else pim_channel_del_oif(up->channel_oil, pim->regiface, - PIM_OIF_FLAG_PROTO_IGMP); + PIM_OIF_FLAG_PROTO_IGMP, __func__); } } diff --git a/pimd/pim_vxlan.c b/pimd/pim_vxlan.c index 33e3b2340c..7e0958700b 100644 --- a/pimd/pim_vxlan.c +++ b/pimd/pim_vxlan.c @@ -386,7 +386,8 @@ static void pim_vxlan_orig_mr_oif_add(struct pim_vxlan_sg *vxlan_sg) vxlan_sg->flags |= PIM_VXLAN_SGF_OIF_INSTALLED; pim_channel_add_oif(vxlan_sg->up->channel_oil, - vxlan_sg->orig_oif, PIM_OIF_FLAG_PROTO_VXLAN); + vxlan_sg->orig_oif, PIM_OIF_FLAG_PROTO_VXLAN, + __func__); } static void pim_vxlan_orig_mr_oif_del(struct pim_vxlan_sg *vxlan_sg) @@ -405,7 +406,7 @@ static void pim_vxlan_orig_mr_oif_del(struct pim_vxlan_sg *vxlan_sg) vxlan_sg->flags &= ~PIM_VXLAN_SGF_OIF_INSTALLED; pim_channel_del_oif(vxlan_sg->up->channel_oil, - orig_oif, PIM_OIF_FLAG_PROTO_VXLAN); + orig_oif, PIM_OIF_FLAG_PROTO_VXLAN, __func__); } static inline struct interface *pim_vxlan_orig_mr_oif_get( diff --git a/pimd/pim_zebra.c b/pimd/pim_zebra.c index b297615435..a0ca618b73 100644 --- a/pimd/pim_zebra.c +++ b/pimd/pim_zebra.c @@ -858,7 +858,7 @@ void igmp_source_forward_start(struct pim_instance *pim, if (PIM_I_am_DR(pim_oif)) { result = pim_channel_add_oif(source->source_channel_oil, group->group_igmp_sock->interface, - PIM_OIF_FLAG_PROTO_IGMP); + PIM_OIF_FLAG_PROTO_IGMP, __func__); if (result) { if (PIM_DEBUG_MROUTE) { zlog_warn("%s: add_oif() failed with return=%d", @@ -887,7 +887,7 @@ void igmp_source_forward_start(struct pim_instance *pim, pim_channel_del_oif(source->source_channel_oil, group->group_igmp_sock->interface, - PIM_OIF_FLAG_PROTO_IGMP); + PIM_OIF_FLAG_PROTO_IGMP, __func__); return; } @@ -938,7 +938,8 @@ void igmp_source_forward_stop(struct igmp_source *source) */ result = pim_channel_del_oif(source->source_channel_oil, group->group_igmp_sock->interface, - PIM_OIF_FLAG_PROTO_IGMP); + PIM_OIF_FLAG_PROTO_IGMP, + __func__); if (result) { if (PIM_DEBUG_IGMP_TRACE) zlog_debug( @@ -981,7 +982,8 @@ void pim_forward_start(struct pim_ifchannel *ch) if (up->flags & PIM_UPSTREAM_FLAG_MASK_SRC_IGMP) mask = PIM_OIF_FLAG_PROTO_IGMP; - pim_channel_add_oif(up->channel_oil, ch->interface, mask); + pim_channel_add_oif(up->channel_oil, ch->interface, + mask, __func__); } void pim_forward_stop(struct pim_ifchannel *ch, bool install_it) @@ -1000,10 +1002,10 @@ void pim_forward_stop(struct pim_ifchannel *ch, bool install_it) */ if (pim_upstream_evaluate_join_desired_interface(up, ch, ch->parent)) pim_channel_add_oif(up->channel_oil, ch->interface, - PIM_OIF_FLAG_PROTO_PIM); + PIM_OIF_FLAG_PROTO_PIM, __func__); else pim_channel_del_oif(up->channel_oil, ch->interface, - PIM_OIF_FLAG_PROTO_PIM); + PIM_OIF_FLAG_PROTO_PIM, __func__); if (install_it && !up->channel_oil->installed) pim_mroute_add(up->channel_oil, __PRETTY_FUNCTION__);