diff options
author | Rafael Zalamena <rzalamena@users.noreply.github.com> | 2019-06-18 13:44:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-18 13:44:33 +0200 |
commit | cd4ee3395cc0877539e0f0ce4c98125bc4761d4c (patch) | |
tree | c4dab9e7e962edf2eaf78c725be0527e70d71d7a /pimd | |
parent | Merge pull request #4514 from opensourcerouting/warnings-20190612 (diff) | |
parent | pimd: Add debugs for channel_oil creation and deletion (diff) | |
download | frr-cd4ee3395cc0877539e0f0ce4c98125bc4761d4c.tar.xz frr-cd4ee3395cc0877539e0f0ce4c98125bc4761d4c.zip |
Merge pull request #4530 from donaldsharp/pim_debugs
Pim debugs
Diffstat (limited to 'pimd')
-rw-r--r-- | pimd/pim_igmpv3.c | 3 | ||||
-rw-r--r-- | pimd/pim_mroute.c | 9 | ||||
-rw-r--r-- | pimd/pim_oil.c | 48 | ||||
-rw-r--r-- | pimd/pim_oil.h | 4 | ||||
-rw-r--r-- | pimd/pim_upstream.c | 22 | ||||
-rw-r--r-- | pimd/pim_zebra.c | 27 |
6 files changed, 73 insertions, 40 deletions
diff --git a/pimd/pim_igmpv3.c b/pimd/pim_igmpv3.c index bc0460fa0..d9b940bba 100644 --- a/pimd/pim_igmpv3.c +++ b/pimd/pim_igmpv3.c @@ -332,7 +332,8 @@ void igmp_source_free(struct igmp_source *source) static void source_channel_oil_detach(struct igmp_source *source) { if (source->source_channel_oil) { - pim_channel_oil_del(source->source_channel_oil); + pim_channel_oil_del(source->source_channel_oil, + __PRETTY_FUNCTION__); source->source_channel_oil = NULL; } } diff --git a/pimd/pim_mroute.c b/pimd/pim_mroute.c index ca0582434..2bdec12cd 100644 --- a/pimd/pim_mroute.c +++ b/pimd/pim_mroute.c @@ -203,7 +203,8 @@ static int pim_mroute_msg_nocache(int fd, struct interface *ifp, * and causing us to consider them. */ c_oil = pim_channel_oil_add(pim_ifp->pim, &sg, - pim_ifp->mroute_vif_index); + pim_ifp->mroute_vif_index, + __PRETTY_FUNCTION__); pim_mroute_add(c_oil, __PRETTY_FUNCTION__); return 0; @@ -523,7 +524,8 @@ static int pim_mroute_msg_wrvifwhole(int fd, struct interface *ifp, if (!up->channel_oil) up->channel_oil = pim_channel_oil_add( pim_ifp->pim, &sg, - pim_ifp->mroute_vif_index); + pim_ifp->mroute_vif_index, + __PRETTY_FUNCTION__); pim_upstream_inherited_olist(pim_ifp->pim, up); if (!up->channel_oil->installed) pim_mroute_add(up->channel_oil, @@ -548,7 +550,8 @@ static int pim_mroute_msg_wrvifwhole(int fd, struct interface *ifp, } pim_ifp = ifp->info; - oil = pim_channel_oil_add(pim_ifp->pim, &sg, pim_ifp->mroute_vif_index); + oil = pim_channel_oil_add(pim_ifp->pim, &sg, pim_ifp->mroute_vif_index, + __PRETTY_FUNCTION__); if (!oil->installed) pim_mroute_add(oil, __PRETTY_FUNCTION__); if (pim_if_connected_to_source(ifp, sg.src)) { diff --git a/pimd/pim_oil.c b/pimd/pim_oil.c index 22045c2d3..307a1760d 100644 --- a/pimd/pim_oil.c +++ b/pimd/pim_oil.c @@ -38,18 +38,22 @@ char *pim_channel_oil_dump(struct channel_oil *c_oil, char *buf, size_t size) { char *out; + struct interface *ifp; struct prefix_sg sg; int i; sg.src = c_oil->oil.mfcc_origin; sg.grp = c_oil->oil.mfcc_mcastgrp; - snprintf(buf, size, "%s IIF: %d, OIFS: ", pim_str_sg_dump(&sg), - c_oil->oil.mfcc_parent); + ifp = pim_if_find_by_vif_index(c_oil->pim, c_oil->oil.mfcc_parent); + snprintf(buf, size, "%s IIF: %s, OIFS: ", pim_str_sg_dump(&sg), + ifp ? ifp->name : "(?)"); out = buf + strlen(buf); for (i = 0; i < MAXVIFS; i++) { if (c_oil->oil.mfcc_ttls[i] != 0) { - snprintf(out, buf + size - out, "%d ", i); + ifp = pim_if_find_by_vif_index(c_oil->pim, i); + snprintf(out, buf + size - out, "%s ", + ifp ? ifp->name : "(?)"); out += strlen(out); } } @@ -144,7 +148,7 @@ struct channel_oil *pim_find_channel_oil(struct pim_instance *pim, struct channel_oil *pim_channel_oil_add(struct pim_instance *pim, struct prefix_sg *sg, - int input_vif_index) + int input_vif_index, const char *name) { struct channel_oil *c_oil; struct interface *ifp; @@ -153,18 +157,23 @@ struct channel_oil *pim_channel_oil_add(struct pim_instance *pim, if (c_oil) { if (c_oil->oil.mfcc_parent != input_vif_index) { c_oil->oil_inherited_rescan = 1; - if (PIM_DEBUG_MROUTE) + if (PIM_DEBUG_MROUTE_DETAIL) zlog_debug( - "%s: Existing channel oil %s points to %d, modifying to point at %d", - __PRETTY_FUNCTION__, - pim_str_sg_dump(sg), + "%s: Existing channel oil %pSG4 points to %d, modifying to point at %d", + __PRETTY_FUNCTION__, sg, c_oil->oil.mfcc_parent, input_vif_index); } c_oil->oil.mfcc_parent = input_vif_index; ++c_oil->oil_ref_count; - c_oil->up = pim_upstream_find( - pim, sg); // channel might be present prior to upstream + /* channel might be present prior to upstream */ + c_oil->up = pim_upstream_find(pim, sg); + + if (PIM_DEBUG_MROUTE) + zlog_debug( + "%s(%s): Existing oil for %pSG4 Ref Count: %d (Post Increment)", + __PRETTY_FUNCTION__, name, sg, + c_oil->oil_ref_count); return c_oil; } @@ -173,9 +182,8 @@ struct channel_oil *pim_channel_oil_add(struct pim_instance *pim, if (!ifp) { /* warning only */ zlog_warn( - "%s: (S,G)=%s could not find input interface for input_vif_index=%d", - __PRETTY_FUNCTION__, pim_str_sg_dump(sg), - input_vif_index); + "%s:%s (S,G)=%pSG4 could not find input interface for input_vif_index=%d", + __PRETTY_FUNCTION__, name, sg, input_vif_index); } } @@ -193,11 +201,23 @@ struct channel_oil *pim_channel_oil_add(struct pim_instance *pim, listnode_add_sort(pim->channel_oil_list, c_oil); + if (PIM_DEBUG_MROUTE) + zlog_debug( + "%s(%s): New oil for %pSG4 vif_index: %d Ref Count: 1 (Post Increment)", + __PRETTY_FUNCTION__, name, sg, input_vif_index); return c_oil; } -void pim_channel_oil_del(struct channel_oil *c_oil) +void pim_channel_oil_del(struct channel_oil *c_oil, const char *name) { + if (PIM_DEBUG_MROUTE) { + struct prefix_sg sg = {.src = c_oil->oil.mfcc_mcastgrp, + .grp = c_oil->oil.mfcc_origin}; + + zlog_debug( + "%s(%s): Del oil for %pSG4, Ref Count: %d (Predecrement)", + __PRETTY_FUNCTION__, name, &sg, c_oil->oil_ref_count); + } --c_oil->oil_ref_count; if (c_oil->oil_ref_count < 1) { diff --git a/pimd/pim_oil.h b/pimd/pim_oil.h index d097da6b3..485299196 100644 --- a/pimd/pim_oil.h +++ b/pimd/pim_oil.h @@ -113,8 +113,8 @@ struct channel_oil *pim_find_channel_oil(struct pim_instance *pim, struct prefix_sg *sg); struct channel_oil *pim_channel_oil_add(struct pim_instance *pim, struct prefix_sg *sg, - int input_vif_index); -void pim_channel_oil_del(struct channel_oil *c_oil); + int input_vif_index, const char *name); +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); diff --git a/pimd/pim_upstream.c b/pimd/pim_upstream.c index 50c68c66b..2e6c5c780 100644 --- a/pimd/pim_upstream.c +++ b/pimd/pim_upstream.c @@ -146,7 +146,7 @@ static void upstream_channel_oil_detach(struct pim_upstream *up) but upstream would not keep reference of it */ up->channel_oil->up = NULL; - pim_channel_oil_del(up->channel_oil); + pim_channel_oil_del(up->channel_oil, __PRETTY_FUNCTION__); up->channel_oil = NULL; } } @@ -740,13 +740,15 @@ static struct pim_upstream *pim_upstream_new(struct pim_instance *pim, pim_upstream_fill_static_iif(up, incoming); pim_ifp = up->rpf.source_nexthop.interface->info; assert(pim_ifp); - up->channel_oil = pim_channel_oil_add(pim, - &up->sg, pim_ifp->mroute_vif_index); + up->channel_oil = pim_channel_oil_add(pim, &up->sg, + pim_ifp->mroute_vif_index, + __PRETTY_FUNCTION__); } else if (up->upstream_addr.s_addr == INADDR_ANY) { /* Create a dummmy channel oil with incoming ineterface MAXVIFS, * since RP is not configured */ - up->channel_oil = pim_channel_oil_add(pim, &up->sg, MAXVIFS); + up->channel_oil = pim_channel_oil_add(pim, &up->sg, MAXVIFS, + __PRETTY_FUNCTION__); } else { rpf_result = pim_rpf_update(pim, up, NULL); @@ -759,14 +761,15 @@ static struct pim_upstream *pim_upstream_new(struct pim_instance *pim, * MAXVIFS, since RP is not reachable */ up->channel_oil = pim_channel_oil_add( - pim, &up->sg, MAXVIFS); + pim, &up->sg, MAXVIFS, __PRETTY_FUNCTION__); } if (up->rpf.source_nexthop.interface) { pim_ifp = up->rpf.source_nexthop.interface->info; if (pim_ifp) - up->channel_oil = pim_channel_oil_add(pim, - &up->sg, pim_ifp->mroute_vif_index); + up->channel_oil = pim_channel_oil_add( + pim, &up->sg, pim_ifp->mroute_vif_index, + __PRETTY_FUNCTION__); } } @@ -1524,8 +1527,9 @@ int pim_upstream_inherited_olist_decide(struct pim_instance *pim, __PRETTY_FUNCTION__, up->sg_str); } if (pim_ifp && !up->channel_oil) - up->channel_oil = pim_channel_oil_add( - pim, &up->sg, pim_ifp->mroute_vif_index); + up->channel_oil = pim_channel_oil_add(pim, &up->sg, + pim_ifp->mroute_vif_index, + __PRETTY_FUNCTION__); FOR_ALL_INTERFACES (pim->vrf, ifp) { if (!ifp->info) diff --git a/pimd/pim_zebra.c b/pimd/pim_zebra.c index 25ac307ac..e09163a52 100644 --- a/pimd/pim_zebra.c +++ b/pimd/pim_zebra.c @@ -974,8 +974,8 @@ void igmp_source_forward_start(struct pim_instance *pim, if (!pim_rp_set_upstream_addr(pim, &vif_source, source->source_addr, sg.grp)) { /*Create a dummy channel oil */ - source->source_channel_oil = - pim_channel_oil_add(pim, &sg, MAXVIFS); + source->source_channel_oil = pim_channel_oil_add( + pim, &sg, MAXVIFS, __PRETTY_FUNCTION__); if (!source->source_channel_oil) { if (PIM_DEBUG_IGMP_TRACE) { @@ -1035,7 +1035,9 @@ void igmp_source_forward_start(struct pim_instance *pim, source_str); } source->source_channel_oil = - pim_channel_oil_add(pim, &sg, MAXVIFS); + pim_channel_oil_add( + pim, &sg, MAXVIFS, + __PRETTY_FUNCTION__); } else { @@ -1065,8 +1067,9 @@ void igmp_source_forward_start(struct pim_instance *pim, } source->source_channel_oil = - pim_channel_oil_add(pim, &sg, - input_iface_vif_index); + pim_channel_oil_add( + pim, &sg, input_iface_vif_index, + __PRETTY_FUNCTION__); if (!source->source_channel_oil) { if (PIM_DEBUG_IGMP_TRACE) { zlog_debug( @@ -1241,13 +1244,14 @@ void pim_forward_start(struct pim_ifchannel *ch) __FILE__, __PRETTY_FUNCTION__, source_str); } - up->channel_oil = pim_channel_oil_add(pim, &up->sg, - MAXVIFS); + up->channel_oil = pim_channel_oil_add( + pim, &up->sg, MAXVIFS, __PRETTY_FUNCTION__); } else { - up->channel_oil = pim_channel_oil_add(pim, &up->sg, - input_iface_vif_index); + up->channel_oil = pim_channel_oil_add( + pim, &up->sg, input_iface_vif_index, + __PRETTY_FUNCTION__); if (!up->channel_oil) { if (PIM_DEBUG_PIM_TRACE) zlog_debug( @@ -1268,8 +1272,9 @@ void pim_forward_start(struct pim_ifchannel *ch) input_iface_vif_index, up->sg_str); } - up->channel_oil = pim_channel_oil_add(pim, &up->sg, - input_iface_vif_index); + up->channel_oil = + pim_channel_oil_add(pim, &up->sg, input_iface_vif_index, + __PRETTY_FUNCTION__); if (!up->channel_oil) { if (PIM_DEBUG_PIM_TRACE) zlog_debug( |