Merge pull request #4530 from donaldsharp/pim_debugs

Pim debugs
This commit is contained in:
Rafael Zalamena 2019-06-18 08:44:33 -03:00 committed by GitHub
commit cd4ee3395c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 73 additions and 40 deletions

View File

@ -332,7 +332,8 @@ void igmp_source_free(struct igmp_source *source)
static void source_channel_oil_detach(struct igmp_source *source) static void source_channel_oil_detach(struct igmp_source *source)
{ {
if (source->source_channel_oil) { 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; source->source_channel_oil = NULL;
} }
} }

View File

@ -203,7 +203,8 @@ static int pim_mroute_msg_nocache(int fd, struct interface *ifp,
* and causing us to consider them. * and causing us to consider them.
*/ */
c_oil = pim_channel_oil_add(pim_ifp->pim, &sg, 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__); pim_mroute_add(c_oil, __PRETTY_FUNCTION__);
return 0; return 0;
@ -523,7 +524,8 @@ static int pim_mroute_msg_wrvifwhole(int fd, struct interface *ifp,
if (!up->channel_oil) if (!up->channel_oil)
up->channel_oil = pim_channel_oil_add( up->channel_oil = pim_channel_oil_add(
pim_ifp->pim, &sg, pim_ifp->pim, &sg,
pim_ifp->mroute_vif_index); pim_ifp->mroute_vif_index,
__PRETTY_FUNCTION__);
pim_upstream_inherited_olist(pim_ifp->pim, up); pim_upstream_inherited_olist(pim_ifp->pim, up);
if (!up->channel_oil->installed) if (!up->channel_oil->installed)
pim_mroute_add(up->channel_oil, 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; 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) if (!oil->installed)
pim_mroute_add(oil, __PRETTY_FUNCTION__); pim_mroute_add(oil, __PRETTY_FUNCTION__);
if (pim_if_connected_to_source(ifp, sg.src)) { if (pim_if_connected_to_source(ifp, sg.src)) {

View File

@ -38,18 +38,22 @@
char *pim_channel_oil_dump(struct channel_oil *c_oil, char *buf, size_t size) char *pim_channel_oil_dump(struct channel_oil *c_oil, char *buf, size_t size)
{ {
char *out; char *out;
struct interface *ifp;
struct prefix_sg sg; struct prefix_sg sg;
int i; int i;
sg.src = c_oil->oil.mfcc_origin; sg.src = c_oil->oil.mfcc_origin;
sg.grp = c_oil->oil.mfcc_mcastgrp; sg.grp = c_oil->oil.mfcc_mcastgrp;
snprintf(buf, size, "%s IIF: %d, OIFS: ", pim_str_sg_dump(&sg), ifp = pim_if_find_by_vif_index(c_oil->pim, c_oil->oil.mfcc_parent);
c_oil->oil.mfcc_parent); snprintf(buf, size, "%s IIF: %s, OIFS: ", pim_str_sg_dump(&sg),
ifp ? ifp->name : "(?)");
out = buf + strlen(buf); out = buf + strlen(buf);
for (i = 0; i < MAXVIFS; i++) { for (i = 0; i < MAXVIFS; i++) {
if (c_oil->oil.mfcc_ttls[i] != 0) { 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); 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 channel_oil *pim_channel_oil_add(struct pim_instance *pim,
struct prefix_sg *sg, struct prefix_sg *sg,
int input_vif_index) int input_vif_index, const char *name)
{ {
struct channel_oil *c_oil; struct channel_oil *c_oil;
struct interface *ifp; struct interface *ifp;
@ -153,18 +157,23 @@ struct channel_oil *pim_channel_oil_add(struct pim_instance *pim,
if (c_oil) { if (c_oil) {
if (c_oil->oil.mfcc_parent != input_vif_index) { if (c_oil->oil.mfcc_parent != input_vif_index) {
c_oil->oil_inherited_rescan = 1; c_oil->oil_inherited_rescan = 1;
if (PIM_DEBUG_MROUTE) if (PIM_DEBUG_MROUTE_DETAIL)
zlog_debug( zlog_debug(
"%s: Existing channel oil %s points to %d, modifying to point at %d", "%s: Existing channel oil %pSG4 points to %d, modifying to point at %d",
__PRETTY_FUNCTION__, __PRETTY_FUNCTION__, sg,
pim_str_sg_dump(sg),
c_oil->oil.mfcc_parent, c_oil->oil.mfcc_parent,
input_vif_index); input_vif_index);
} }
c_oil->oil.mfcc_parent = input_vif_index; c_oil->oil.mfcc_parent = input_vif_index;
++c_oil->oil_ref_count; ++c_oil->oil_ref_count;
c_oil->up = pim_upstream_find( /* channel might be present prior to upstream */
pim, sg); // 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; return c_oil;
} }
@ -173,9 +182,8 @@ struct channel_oil *pim_channel_oil_add(struct pim_instance *pim,
if (!ifp) { if (!ifp) {
/* warning only */ /* warning only */
zlog_warn( zlog_warn(
"%s: (S,G)=%s could not find input interface for input_vif_index=%d", "%s:%s (S,G)=%pSG4 could not find input interface for input_vif_index=%d",
__PRETTY_FUNCTION__, pim_str_sg_dump(sg), __PRETTY_FUNCTION__, name, sg, input_vif_index);
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); 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; 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; --c_oil->oil_ref_count;
if (c_oil->oil_ref_count < 1) { if (c_oil->oil_ref_count < 1) {

View File

@ -113,8 +113,8 @@ struct channel_oil *pim_find_channel_oil(struct pim_instance *pim,
struct prefix_sg *sg); struct prefix_sg *sg);
struct channel_oil *pim_channel_oil_add(struct pim_instance *pim, struct channel_oil *pim_channel_oil_add(struct pim_instance *pim,
struct prefix_sg *sg, struct prefix_sg *sg,
int input_vif_index); int input_vif_index, const char *name);
void pim_channel_oil_del(struct channel_oil *c_oil); 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, int pim_channel_add_oif(struct channel_oil *c_oil, struct interface *oif,
uint32_t proto_mask); uint32_t proto_mask);

View File

@ -146,7 +146,7 @@ static void upstream_channel_oil_detach(struct pim_upstream *up)
but upstream would not keep reference of it but upstream would not keep reference of it
*/ */
up->channel_oil->up = NULL; 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; 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_upstream_fill_static_iif(up, incoming);
pim_ifp = up->rpf.source_nexthop.interface->info; pim_ifp = up->rpf.source_nexthop.interface->info;
assert(pim_ifp); assert(pim_ifp);
up->channel_oil = pim_channel_oil_add(pim, up->channel_oil = pim_channel_oil_add(pim, &up->sg,
&up->sg, pim_ifp->mroute_vif_index); pim_ifp->mroute_vif_index,
__PRETTY_FUNCTION__);
} else if (up->upstream_addr.s_addr == INADDR_ANY) { } else if (up->upstream_addr.s_addr == INADDR_ANY) {
/* Create a dummmy channel oil with incoming ineterface MAXVIFS, /* Create a dummmy channel oil with incoming ineterface MAXVIFS,
* since RP is not configured * 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 { } else {
rpf_result = pim_rpf_update(pim, up, NULL); 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 * MAXVIFS, since RP is not reachable
*/ */
up->channel_oil = pim_channel_oil_add( up->channel_oil = pim_channel_oil_add(
pim, &up->sg, MAXVIFS); pim, &up->sg, MAXVIFS, __PRETTY_FUNCTION__);
} }
if (up->rpf.source_nexthop.interface) { if (up->rpf.source_nexthop.interface) {
pim_ifp = up->rpf.source_nexthop.interface->info; pim_ifp = up->rpf.source_nexthop.interface->info;
if (pim_ifp) if (pim_ifp)
up->channel_oil = pim_channel_oil_add(pim, up->channel_oil = pim_channel_oil_add(
&up->sg, pim_ifp->mroute_vif_index); 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); __PRETTY_FUNCTION__, up->sg_str);
} }
if (pim_ifp && !up->channel_oil) if (pim_ifp && !up->channel_oil)
up->channel_oil = pim_channel_oil_add( up->channel_oil = pim_channel_oil_add(pim, &up->sg,
pim, &up->sg, pim_ifp->mroute_vif_index); pim_ifp->mroute_vif_index,
__PRETTY_FUNCTION__);
FOR_ALL_INTERFACES (pim->vrf, ifp) { FOR_ALL_INTERFACES (pim->vrf, ifp) {
if (!ifp->info) if (!ifp->info)

View File

@ -974,8 +974,8 @@ void igmp_source_forward_start(struct pim_instance *pim,
if (!pim_rp_set_upstream_addr(pim, &vif_source, if (!pim_rp_set_upstream_addr(pim, &vif_source,
source->source_addr, sg.grp)) { source->source_addr, sg.grp)) {
/*Create a dummy channel oil */ /*Create a dummy channel oil */
source->source_channel_oil = source->source_channel_oil = pim_channel_oil_add(
pim_channel_oil_add(pim, &sg, MAXVIFS); pim, &sg, MAXVIFS, __PRETTY_FUNCTION__);
if (!source->source_channel_oil) { if (!source->source_channel_oil) {
if (PIM_DEBUG_IGMP_TRACE) { if (PIM_DEBUG_IGMP_TRACE) {
@ -1035,7 +1035,9 @@ void igmp_source_forward_start(struct pim_instance *pim,
source_str); source_str);
} }
source->source_channel_oil = source->source_channel_oil =
pim_channel_oil_add(pim, &sg, MAXVIFS); pim_channel_oil_add(
pim, &sg, MAXVIFS,
__PRETTY_FUNCTION__);
} }
else { else {
@ -1065,8 +1067,9 @@ void igmp_source_forward_start(struct pim_instance *pim,
} }
source->source_channel_oil = source->source_channel_oil =
pim_channel_oil_add(pim, &sg, pim_channel_oil_add(
input_iface_vif_index); pim, &sg, input_iface_vif_index,
__PRETTY_FUNCTION__);
if (!source->source_channel_oil) { if (!source->source_channel_oil) {
if (PIM_DEBUG_IGMP_TRACE) { if (PIM_DEBUG_IGMP_TRACE) {
zlog_debug( zlog_debug(
@ -1241,13 +1244,14 @@ void pim_forward_start(struct pim_ifchannel *ch)
__FILE__, __PRETTY_FUNCTION__, __FILE__, __PRETTY_FUNCTION__,
source_str); source_str);
} }
up->channel_oil = pim_channel_oil_add(pim, &up->sg, up->channel_oil = pim_channel_oil_add(
MAXVIFS); pim, &up->sg, MAXVIFS, __PRETTY_FUNCTION__);
} }
else { else {
up->channel_oil = pim_channel_oil_add(pim, &up->sg, up->channel_oil = pim_channel_oil_add(
input_iface_vif_index); pim, &up->sg, input_iface_vif_index,
__PRETTY_FUNCTION__);
if (!up->channel_oil) { if (!up->channel_oil) {
if (PIM_DEBUG_PIM_TRACE) if (PIM_DEBUG_PIM_TRACE)
zlog_debug( zlog_debug(
@ -1268,8 +1272,9 @@ void pim_forward_start(struct pim_ifchannel *ch)
input_iface_vif_index, up->sg_str); input_iface_vif_index, up->sg_str);
} }
up->channel_oil = pim_channel_oil_add(pim, &up->sg, up->channel_oil =
input_iface_vif_index); pim_channel_oil_add(pim, &up->sg, input_iface_vif_index,
__PRETTY_FUNCTION__);
if (!up->channel_oil) { if (!up->channel_oil) {
if (PIM_DEBUG_PIM_TRACE) if (PIM_DEBUG_PIM_TRACE)
zlog_debug( zlog_debug(