mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-05 10:08:41 +00:00
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>
This commit is contained in:
parent
eeedae06ee
commit
6a78764e46
@ -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];
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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];
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
|
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user