]> git.puffer.fish Git - mirror/frr.git/commitdiff
pimd: Add debugs for channel_oil creation and deletion 4530/head
authorDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 14 Jun 2019 23:18:51 +0000 (19:18 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 14 Jun 2019 23:22:43 +0000 (19:22 -0400)
Add some debugs so we can see channel oil creation and deletion
events.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
pimd/pim_igmpv3.c
pimd/pim_mroute.c
pimd/pim_oil.c
pimd/pim_oil.h
pimd/pim_upstream.c
pimd/pim_zebra.c

index bc0460fa0397072ae44198afc94dfbf3774b797b..d9b940bba7203a10107c5455bb2f15591bdaa358 100644 (file)
@@ -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;
        }
 }
index ca0582434768dfba7da251fac285be22ba26c896..2bdec12cd1a8f26e84efe823a0ba065e512d2ba7 100644 (file)
@@ -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)) {
index 033148ea9cf0888a81d1d63b4ef528e59a876a3d..307a1760d9e7dedee43c53378607dcd16c7884f0 100644 (file)
@@ -148,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;
@@ -157,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;
        }
 
@@ -177,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);
                }
        }
 
@@ -197,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) {
index d097da6b3eb761959bf521f000533b288c6eacd8..485299196db48e66a28c75f2c313a03e211c78c0 100644 (file)
@@ -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);
index 50c68c66bdc2cfdaa85b2727bed30d269e0633a9..2e6c5c7803501e333b7b6ab34bbf63eb8df53733 100644 (file)
@@ -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)
index 25ac307ac43defc1b51e27ba89d169df7da729db..e09163a52719a24688bda9c54db5095550065318 100644 (file)
@@ -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(