summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2016-12-06 10:08:09 -0500
committerDonald Sharp <sharpd@cumulusnetworks.com>2016-12-21 20:26:18 -0500
commit6a78764e468bd002d795309e17b3fd01a40ea707 (patch)
tree5de58c7d401e0fae88fb78b859aa2b212ae3e422
parenteeedae06ee5c13d225b3fbf2f01bf410846ead2f (diff)
pimd: Clarify pim_mroute_[add|del] function debugging
When debugging is turned on for 'debug mroute' we are unable to tell when a mroute has been added or deleted from the mrib. Notice when we do it and who called it. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
-rw-r--r--pimd/pim_cmd.c8
-rw-r--r--pimd/pim_mroute.c29
-rw-r--r--pimd/pim_mroute.h4
-rw-r--r--pimd/pim_oil.c4
-rw-r--r--pimd/pim_static.c22
-rw-r--r--pimd/pim_upstream.c2
-rw-r--r--pimd/pim_zebra.c12
7 files changed, 51 insertions, 30 deletions
diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c
index 6ab6af7ba8..093497d44e 100644
--- a/pimd/pim_cmd.c
+++ b/pimd/pim_cmd.c
@@ -2303,7 +2303,7 @@ static void mroute_add_all()
struct channel_oil *c_oil;
for (ALL_LIST_ELEMENTS_RO(pim_channel_oil_list, node, c_oil)) {
- if (pim_mroute_add(c_oil)) {
+ if (pim_mroute_add(c_oil, __PRETTY_FUNCTION__)) {
/* just log warning */
char source_str[INET_ADDRSTRLEN];
char group_str[INET_ADDRSTRLEN];
@@ -2322,7 +2322,7 @@ static void mroute_del_all()
struct channel_oil *c_oil;
for (ALL_LIST_ELEMENTS_RO(pim_channel_oil_list, node, c_oil)) {
- if (pim_mroute_del(c_oil)) {
+ if (pim_mroute_del(c_oil, __PRETTY_FUNCTION__)) {
/* just log warning */
char source_str[INET_ADDRSTRLEN];
char group_str[INET_ADDRSTRLEN];
@@ -2341,7 +2341,7 @@ static void static_mroute_add_all()
struct static_route *s_route;
for (ALL_LIST_ELEMENTS_RO(qpim_static_route_list, node, s_route)) {
- if (pim_mroute_add(&s_route->c_oil)) {
+ if (pim_mroute_add(&s_route->c_oil, __PRETTY_FUNCTION__)) {
/* just log warning */
char source_str[INET_ADDRSTRLEN];
char group_str[INET_ADDRSTRLEN];
@@ -2360,7 +2360,7 @@ static void static_mroute_del_all()
struct static_route *s_route;
for (ALL_LIST_ELEMENTS_RO(qpim_static_route_list, node, s_route)) {
- if (pim_mroute_del(&s_route->c_oil)) {
+ if (pim_mroute_del(&s_route->c_oil, __PRETTY_FUNCTION__)) {
/* just log warning */
char source_str[INET_ADDRSTRLEN];
char group_str[INET_ADDRSTRLEN];
diff --git a/pimd/pim_mroute.c b/pimd/pim_mroute.c
index 01fa529525..fdae0b9a22 100644
--- a/pimd/pim_mroute.c
+++ b/pimd/pim_mroute.c
@@ -402,7 +402,7 @@ pim_mroute_msg_wrvifwhole (int fd, struct interface *ifp, const char *buf)
up->channel_oil = pim_channel_oil_add (&sg, pim_ifp->mroute_vif_index);
pim_upstream_inherited_olist (up);
if (!up->channel_oil->installed)
- pim_mroute_add (up->channel_oil);
+ pim_mroute_add (up->channel_oil, __PRETTY_FUNCTION__);
pim_upstream_set_sptbit (up, ifp);
}
else
@@ -423,7 +423,7 @@ pim_mroute_msg_wrvifwhole (int fd, struct interface *ifp, const char *buf)
pim_ifp = ifp->info;
oil = pim_channel_oil_add (&sg, pim_ifp->mroute_vif_index);
if (!oil->installed)
- pim_mroute_add (oil);
+ pim_mroute_add (oil, __PRETTY_FUNCTION__);
if (pim_if_connected_to_source (ifp, sg.src))
{
up = pim_upstream_add (&sg, ifp, PIM_UPSTREAM_FLAG_MASK_FHR, __PRETTY_FUNCTION__);
@@ -745,7 +745,7 @@ int pim_mroute_del_vif(int vif_index)
return 0;
}
-int pim_mroute_add(struct channel_oil *c_oil)
+int pim_mroute_add(struct channel_oil *c_oil, const char *name)
{
int err;
int orig = 0;
@@ -805,11 +805,22 @@ int pim_mroute_add(struct channel_oil *c_oil)
return -2;
}
+ if (PIM_DEBUG_MROUTE)
+ {
+ struct prefix_sg sg;
+
+ sg.src = c_oil->oil.mfcc_origin;
+ sg.grp = c_oil->oil.mfcc_mcastgrp;
+
+ zlog_debug("%s(%s), Added Route: %s to mroute table",
+ __PRETTY_FUNCTION__, name, pim_str_sg_dump(&sg));
+ }
+
c_oil->installed = 1;
return 0;
}
-int pim_mroute_del (struct channel_oil *c_oil)
+int pim_mroute_del (struct channel_oil *c_oil, const char *name)
{
int err;
@@ -832,6 +843,16 @@ int pim_mroute_del (struct channel_oil *c_oil)
return -2;
}
+ if (PIM_DEBUG_MROUTE)
+ {
+ struct prefix_sg sg;
+
+ sg.src = c_oil->oil.mfcc_origin;
+ sg.grp = c_oil->oil.mfcc_mcastgrp;
+
+ zlog_debug("%s(%s), Deleted Route: %s from mroute table",
+ __PRETTY_FUNCTION__, name, pim_str_sg_dump(&sg));
+ }
c_oil->installed = 0;
return 0;
diff --git a/pimd/pim_mroute.h b/pimd/pim_mroute.h
index ce300f0ab0..b3f56aa724 100644
--- a/pimd/pim_mroute.h
+++ b/pimd/pim_mroute.h
@@ -172,8 +172,8 @@ int pim_mroute_socket_disable(void);
int pim_mroute_add_vif(struct interface *ifp, struct in_addr ifaddr, unsigned char flags);
int pim_mroute_del_vif(int vif_index);
-int pim_mroute_add(struct channel_oil *c_oil);
-int pim_mroute_del(struct channel_oil *c_oil);
+int pim_mroute_add(struct channel_oil *c_oil, const char *name);
+int pim_mroute_del(struct channel_oil *c_oil, const char *name);
int pim_mroute_msg(int fd, const char *buf, int buf_size);
diff --git a/pimd/pim_oil.c b/pimd/pim_oil.c
index 6e77afd40a..e002de0300 100644
--- a/pimd/pim_oil.c
+++ b/pimd/pim_oil.c
@@ -247,7 +247,7 @@ pim_channel_del_oif (struct channel_oil *channel_oil,
channel_oil->oil.mfcc_ttls[pim_ifp->mroute_vif_index] = 0;
- if (pim_mroute_add (channel_oil)) {
+ if (pim_mroute_add (channel_oil, __PRETTY_FUNCTION__)) {
if (PIM_DEBUG_MROUTE)
{
char group_str[INET_ADDRSTRLEN];
@@ -387,7 +387,7 @@ int pim_channel_add_oif(struct channel_oil *channel_oil,
channel_oil->oil.mfcc_ttls[pim_ifp->mroute_vif_index] = PIM_MROUTE_MIN_TTL;
- if (pim_mroute_add(channel_oil)) {
+ if (pim_mroute_add(channel_oil, __PRETTY_FUNCTION__)) {
if (PIM_DEBUG_MROUTE)
{
char group_str[INET_ADDRSTRLEN];
diff --git a/pimd/pim_static.c b/pimd/pim_static.c
index 443e7cacaa..c3c40ff210 100644
--- a/pimd/pim_static.c
+++ b/pimd/pim_static.c
@@ -175,7 +175,7 @@ int pim_static_add(struct interface *iif, struct interface *oif, struct in_addr
listnode_add(qpim_static_route_list, s_route);
}
- if (pim_mroute_add(&s_route->c_oil))
+ if (pim_mroute_add(&s_route->c_oil, __PRETTY_FUNCTION__))
{
char gifaddr_str[INET_ADDRSTRLEN];
char sifaddr_str[INET_ADDRSTRLEN];
@@ -254,23 +254,23 @@ int pim_static_del(struct interface *iif, struct interface *oif, struct in_addr
/* If there are no more outputs then delete the whole route, otherwise set the route with the new outputs */
if (s_route->c_oil.oil_ref_count <= 0 ?
- pim_mroute_del(&s_route->c_oil) : pim_mroute_add(&s_route->c_oil)) {
- char gifaddr_str[INET_ADDRSTRLEN];
- char sifaddr_str[INET_ADDRSTRLEN];
- pim_inet4_dump("<ifaddr?>", group, gifaddr_str, sizeof(gifaddr_str));
- pim_inet4_dump("<ifaddr?>", source, sifaddr_str, sizeof(sifaddr_str));
- zlog_warn("%s %s: Unable to remove static route(iif=%d,oif=%d,group=%s,source=%s)",
+ pim_mroute_del(&s_route->c_oil, __PRETTY_FUNCTION__) : pim_mroute_add(&s_route->c_oil, __PRETTY_FUNCTION__)) {
+ char gifaddr_str[INET_ADDRSTRLEN];
+ char sifaddr_str[INET_ADDRSTRLEN];
+ pim_inet4_dump("<ifaddr?>", group, gifaddr_str, sizeof(gifaddr_str));
+ pim_inet4_dump("<ifaddr?>", source, sifaddr_str, sizeof(sifaddr_str));
+ zlog_warn("%s %s: Unable to remove static route(iif=%d,oif=%d,group=%s,source=%s)",
__FILE__, __PRETTY_FUNCTION__,
iif_index,
oif_index,
gifaddr_str,
sifaddr_str);
- s_route->oif_ttls[oif_index] = 1;
- s_route->c_oil.oil.mfcc_ttls[oif_index] = 1;
- ++s_route->c_oil.oil_ref_count;
+ s_route->oif_ttls[oif_index] = 1;
+ s_route->c_oil.oil.mfcc_ttls[oif_index] = 1;
+ ++s_route->c_oil.oil_ref_count;
- return -1;
+ return -1;
}
s_route->c_oil.oif_creation[oif_index] = 0;
diff --git a/pimd/pim_upstream.c b/pimd/pim_upstream.c
index 90adf60615..2b76cb9172 100644
--- a/pimd/pim_upstream.c
+++ b/pimd/pim_upstream.c
@@ -188,7 +188,7 @@ pim_upstream_del(struct pim_upstream *up, const char *name)
}
pim_upstream_remove_children (up);
- pim_mroute_del (up->channel_oil);
+ pim_mroute_del (up->channel_oil, __PRETTY_FUNCTION__);
upstream_channel_oil_detach(up);
if (up->sources)
diff --git a/pimd/pim_zebra.c b/pimd/pim_zebra.c
index 4b8c36fbe1..cfce8909d6 100644
--- a/pimd/pim_zebra.c
+++ b/pimd/pim_zebra.c
@@ -379,7 +379,7 @@ static void scan_upstream_rpf_cache()
* so install it.
*/
if (up->channel_oil && !up->channel_oil->installed)
- pim_mroute_add (up->channel_oil);
+ pim_mroute_add (up->channel_oil, __PRETTY_FUNCTION__);
/*
RFC 4601: 4.5.7. Sending (S,G) Join/Prune Messages
@@ -442,14 +442,14 @@ pim_scan_individual_oil (struct channel_oil *c_oil)
__FILE__, __PRETTY_FUNCTION__, c_oil->oil.mfcc_parent,
source_str, group_str);
}
- pim_mroute_del (c_oil);
+ pim_mroute_del (c_oil, __PRETTY_FUNCTION__);
return;
}
if (input_iface_vif_index == c_oil->oil.mfcc_parent)
{
if (!c_oil->installed)
- pim_mroute_add (c_oil);
+ pim_mroute_add (c_oil, __PRETTY_FUNCTION__);
/* RPF unchanged */
return;
@@ -494,7 +494,7 @@ pim_scan_individual_oil (struct channel_oil *c_oil)
c_oil->oil.mfcc_parent = input_iface_vif_index;
/* update kernel multicast forwarding cache (MFC) */
- if (pim_mroute_add(c_oil))
+ if (pim_mroute_add(c_oil, __PRETTY_FUNCTION__))
{
if (PIM_DEBUG_MROUTE)
{
@@ -931,7 +931,7 @@ static int del_oif(struct channel_oil *channel_oil,
channel_oil->oil.mfcc_ttls[pim_ifp->mroute_vif_index] = 0;
- if (pim_mroute_add(channel_oil)) {
+ if (pim_mroute_add(channel_oil, __PRETTY_FUNCTION__)) {
char group_str[INET_ADDRSTRLEN];
char source_str[INET_ADDRSTRLEN];
pim_inet4_dump("<group?>", channel_oil->oil.mfcc_mcastgrp, group_str, sizeof(group_str));
@@ -948,7 +948,7 @@ static int del_oif(struct channel_oil *channel_oil,
--channel_oil->oil_size;
if (channel_oil->oil_size < 1) {
- if (pim_mroute_del(channel_oil)) {
+ if (pim_mroute_del(channel_oil, __PRETTY_FUNCTION__)) {
if (PIM_DEBUG_MROUTE)
{
/* just log a warning in case of failure */