From 7adf026098fe6ae1f7b7e1805ec00930f7eac892 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Wed, 30 Sep 2015 10:22:46 -0400 Subject: [PATCH] pimd: Cleanup zebra debugs to be protected by debug commands pimd is very chatty without any pim debugs turned on. This commit fixes a bunch of the debugs to be protected by appropriate pim debug statement. Signed-off-by: Donald Sharp --- pimd/pim_iface.c | 22 +++++++++++----------- pimd/pim_ifchannel.c | 10 ++++++---- pimd/pim_neighbor.c | 2 +- pimd/pim_rpf.c | 14 +++++++------- pimd/pim_signals.c | 4 ++-- pimd/pim_zebra.c | 2 +- pimd/pim_zlookup.c | 38 ++++++++++++++++++++------------------ 7 files changed, 48 insertions(+), 44 deletions(-) diff --git a/pimd/pim_iface.c b/pimd/pim_iface.c index 54fb09daa3..32d10f1c15 100644 --- a/pimd/pim_iface.c +++ b/pimd/pim_iface.c @@ -262,14 +262,14 @@ static void on_primary_address_change(struct interface *ifp, { struct pim_interface *pim_ifp; - { + if (PIM_DEBUG_ZEBRA) { char old_str[100]; char new_str[100]; pim_inet4_dump("", old_addr, old_str, sizeof(old_str)); pim_inet4_dump("", new_addr, new_str, sizeof(new_str)); - zlog_info("%s: %s: primary address changed from %s to %s on interface %s", - __PRETTY_FUNCTION__, caller, - old_str, new_str, ifp->name); + zlog_debug("%s: %s: primary address changed from %s to %s on interface %s", + __PRETTY_FUNCTION__, caller, + old_str, new_str, ifp->name); } pim_ifp = ifp->info; @@ -335,8 +335,8 @@ static void detect_secondary_address_change(struct interface *ifp, return; changed = 1; /* true */ - zlog_debug("FIXME T31 C15 %s: on interface %s: acting on any addr change", - __PRETTY_FUNCTION__, ifp->name); + zlog_info("FIXME T31 C15 %s: on interface %s: acting on any addr change", + __PRETTY_FUNCTION__, ifp->name); if (PIM_DEBUG_ZEBRA) { zlog_debug("%s: on interface %s: %s", @@ -388,7 +388,7 @@ void pim_if_addr_add(struct connected *ifc) if (!if_is_operative(ifp)) return; - /* if (PIM_DEBUG_ZEBRA) */ { + if (PIM_DEBUG_ZEBRA) { char buf[BUFSIZ]; prefix2str(ifc->address, buf, BUFSIZ); zlog_debug("%s: %s ifindex=%d connected IP address %s %s", @@ -507,7 +507,7 @@ void pim_if_addr_del(struct connected *ifc, int force_prim_as_any) ifp = ifc->ifp; zassert(ifp); - /* if (PIM_DEBUG_ZEBRA) */ { + if (PIM_DEBUG_ZEBRA) { char buf[BUFSIZ]; prefix2str(ifc->address, buf, BUFSIZ); zlog_debug("%s: %s ifindex=%d disconnected IP address %s %s", @@ -1061,14 +1061,14 @@ int pim_if_igmp_join_add(struct interface *ifp, return -4; } - { + if (PIM_DEBUG_IGMP_EVENTS) { char group_str[100]; char source_str[100]; pim_inet4_dump("", group_addr, group_str, sizeof(group_str)); pim_inet4_dump("", source_addr, source_str, sizeof(source_str)); zlog_debug("%s: issued static igmp join for channel (S,G)=(%s,%s) on interface %s", - __PRETTY_FUNCTION__, - source_str, group_str, ifp->name); + __PRETTY_FUNCTION__, + source_str, group_str, ifp->name); } return 0; diff --git a/pimd/pim_ifchannel.c b/pimd/pim_ifchannel.c index e253a0ea9c..e801f4eeb5 100644 --- a/pimd/pim_ifchannel.c +++ b/pimd/pim_ifchannel.c @@ -103,9 +103,11 @@ void pim_ifchannel_ifjoin_switch(const char *caller, enum pim_ifjoin_state old_state = ch->ifjoin_state; if (old_state == new_state) { - zlog_debug("%s calledby %s: non-transition on state %d (%s)", - __PRETTY_FUNCTION__, caller, new_state, - pim_ifchannel_ifjoin_name(new_state)); + if (PIM_DEBUG_PIM_EVENTS) { + zlog_debug("%s calledby %s: non-transition on state %d (%s)", + __PRETTY_FUNCTION__, caller, new_state, + pim_ifchannel_ifjoin_name(new_state)); + } return; } @@ -286,7 +288,7 @@ static void ifmembership_set(struct pim_ifchannel *ch, if (ch->local_ifmembership == membership) return; - /* if (PIM_DEBUG_PIM_EVENTS) */ { + if (PIM_DEBUG_PIM_EVENTS) { char src_str[100]; char grp_str[100]; pim_inet4_dump("", ch->source_addr, src_str, sizeof(src_str)); diff --git a/pimd/pim_neighbor.c b/pimd/pim_neighbor.c index 72a35382fd..8932dc324c 100644 --- a/pimd/pim_neighbor.c +++ b/pimd/pim_neighbor.c @@ -125,7 +125,7 @@ int pim_if_dr_election(struct interface *ifp) /* DR changed ? */ if (old_dr_addr.s_addr != pim_ifp->pim_dr_addr.s_addr) { - /* if (PIM_DEBUG_PIM_EVENTS) */ { + if (PIM_DEBUG_PIM_EVENTS) { char dr_old_str[100]; char dr_new_str[100]; pim_inet4_dump("", old_dr_addr, dr_old_str, sizeof(dr_old_str)); diff --git a/pimd/pim_rpf.c b/pimd/pim_rpf.c index dedc60a551..38339da1bd 100644 --- a/pimd/pim_rpf.c +++ b/pimd/pim_rpf.c @@ -61,7 +61,7 @@ int pim_nexthop_lookup(struct pim_nexthop *nexthop, if (num_ifindex > 1) { char addr_str[100]; pim_inet4_dump("", addr, addr_str, sizeof(addr_str)); - zlog_debug("%s %s: FIXME ignoring multiple nexthop ifindex'es num_ifindex=%d for address %s (using only ifindex=%d)", + zlog_info("%s %s: FIXME ignoring multiple nexthop ifindex'es num_ifindex=%d for address %s (using only ifindex=%d)", __FILE__, __PRETTY_FUNCTION__, num_ifindex, addr_str, first_ifindex); /* debug warning only, do not return */ @@ -136,22 +136,22 @@ enum pim_rpf_result pim_rpf_update(struct pim_upstream *up, } rpf->rpf_addr = pim_rpf_find_rpf_addr(up); - if (PIM_INADDR_IS_ANY(rpf->rpf_addr)) { + if (PIM_INADDR_IS_ANY(rpf->rpf_addr) && PIM_DEBUG_PIM_EVENTS) { /* RPF'(S,G) not found */ char src_str[100]; char grp_str[100]; pim_inet4_dump("", up->source_addr, src_str, sizeof(src_str)); pim_inet4_dump("", up->group_addr, grp_str, sizeof(grp_str)); - zlog_warn("%s %s: RPF'(%s,%s) not found: won't send join upstream", - __FILE__, __PRETTY_FUNCTION__, - src_str, grp_str); + zlog_debug("%s %s: RPF'(%s,%s) not found: won't send join upstream", + __FILE__, __PRETTY_FUNCTION__, + src_str, grp_str); /* warning only */ } /* detect change in pim_nexthop */ if (nexthop_mismatch(&rpf->source_nexthop, &save_nexthop)) { - /* if (PIM_DEBUG_PIM_EVENTS) */ { + if (PIM_DEBUG_PIM_EVENTS) { char src_str[100]; char grp_str[100]; char nhaddr_str[100]; @@ -176,7 +176,7 @@ enum pim_rpf_result pim_rpf_update(struct pim_upstream *up, /* detect change in RPF_interface(S) */ if (save_nexthop.interface != rpf->source_nexthop.interface) { - /* if (PIM_DEBUG_PIM_EVENTS) */ { + if (PIM_DEBUG_PIM_EVENTS) { char src_str[100]; char grp_str[100]; pim_inet4_dump("", up->source_addr, src_str, sizeof(src_str)); diff --git a/pimd/pim_signals.c b/pimd/pim_signals.c index d1350b08b3..afd0259658 100644 --- a/pimd/pim_signals.c +++ b/pimd/pim_signals.c @@ -36,7 +36,7 @@ static void pim_sighup() { - zlog_debug ("SIGHUP received, ignoring"); + zlog_info ("SIGHUP received, ignoring"); } static void pim_sigint() @@ -55,7 +55,7 @@ static void pim_sigterm() static void pim_sigusr1() { - zlog_debug ("SIGUSR1 received"); + zlog_info ("SIGUSR1 received"); zlog_rotate (NULL); } diff --git a/pimd/pim_zebra.c b/pimd/pim_zebra.c index 4cfb359a5a..5510ceae1b 100644 --- a/pimd/pim_zebra.c +++ b/pimd/pim_zebra.c @@ -758,7 +758,7 @@ static int fib_lookup_if_vif_index(struct in_addr addr) if (num_ifindex > 1) { char addr_str[100]; pim_inet4_dump("", addr, addr_str, sizeof(addr_str)); - zlog_debug("%s %s: FIXME ignoring multiple nexthop ifindex'es num_ifindex=%d for address %s (using only ifindex=%d)", + zlog_info("%s %s: FIXME ignoring multiple nexthop ifindex'es num_ifindex=%d for address %s (using only ifindex=%d)", __FILE__, __PRETTY_FUNCTION__, num_ifindex, addr_str, first_ifindex); /* debug warning only, do not return */ diff --git a/pimd/pim_zlookup.c b/pimd/pim_zlookup.c index 6e3845c549..6f9e2fb35b 100644 --- a/pimd/pim_zlookup.c +++ b/pimd/pim_zlookup.c @@ -289,14 +289,14 @@ static int zclient_read_nexthop(struct zclient *zlookup, nexthop_tab[num_ifindex].ifindex = 0; nexthop_tab[num_ifindex].protocol_distance = distance; nexthop_tab[num_ifindex].route_metric = metric; - { + if (PIM_DEBUG_ZEBRA) { char addr_str[100]; char nexthop_str[100]; pim_inet4_dump("", addr, addr_str, sizeof(addr_str)); pim_inet4_dump("", nexthop_tab[num_ifindex].nexthop_addr, nexthop_str, sizeof(nexthop_str)); - zlog_warn("%s %s: zebra returned recursive nexthop %s for address %s", - __FILE__, __PRETTY_FUNCTION__, - nexthop_str, addr_str); + zlog_debug("%s %s: zebra returned recursive nexthop %s for address %s", + __FILE__, __PRETTY_FUNCTION__, + nexthop_str, addr_str); } ++num_ifindex; break; @@ -381,7 +381,7 @@ int zclient_lookup_nexthop(struct zclient *zlookup, num_ifindex = zclient_lookup_nexthop_once(qpim_zclient_lookup, nexthop_tab, PIM_NEXTHOP_IFINDEX_TAB_SIZE, addr); - if (num_ifindex < 1) { + if ((num_ifindex < 1) && PIM_DEBUG_ZEBRA) { char addr_str[100]; pim_inet4_dump("", addr, addr_str, sizeof(addr_str)); zlog_warn("%s %s: lookup=%d/%d: could not find nexthop ifindex for address %s", @@ -406,15 +406,15 @@ int zclient_lookup_nexthop(struct zclient *zlookup, if (first_ifindex > 0) { /* found: first ifindex is non-recursive nexthop */ - if (lookup > 0) { + if ((lookup > 0) && PIM_DEBUG_ZEBRA) { /* Report non-recursive success after first lookup */ char addr_str[100]; pim_inet4_dump("", addr, addr_str, sizeof(addr_str)); - zlog_info("%s %s: lookup=%d/%d: found non-recursive ifindex=%d for address %s dist=%d met=%d", - __FILE__, __PRETTY_FUNCTION__, - lookup, max_lookup, first_ifindex, addr_str, - nexthop_tab[0].protocol_distance, - nexthop_tab[0].route_metric); + zlog_debug("%s %s: lookup=%d/%d: found non-recursive ifindex=%d for address %s dist=%d met=%d", + __FILE__, __PRETTY_FUNCTION__, + lookup, max_lookup, first_ifindex, addr_str, + nexthop_tab[0].protocol_distance, + nexthop_tab[0].route_metric); /* use last address as nexthop address */ nexthop_tab[0].nexthop_addr = addr; @@ -427,12 +427,12 @@ int zclient_lookup_nexthop(struct zclient *zlookup, return num_ifindex; } - { + if (PIM_DEBUG_ZEBRA) { char addr_str[100]; char nexthop_str[100]; pim_inet4_dump("", addr, addr_str, sizeof(addr_str)); pim_inet4_dump("", nexthop_addr, nexthop_str, sizeof(nexthop_str)); - zlog_warn("%s %s: lookup=%d/%d: zebra returned recursive nexthop %s for address %s dist=%d met=%d", + zlog_debug("%s %s: lookup=%d/%d: zebra returned recursive nexthop %s for address %s dist=%d met=%d", __FILE__, __PRETTY_FUNCTION__, lookup, max_lookup, nexthop_str, addr_str, nexthop_tab[0].protocol_distance, @@ -443,11 +443,13 @@ int zclient_lookup_nexthop(struct zclient *zlookup, } /* for (max_lookup) */ - char addr_str[100]; - pim_inet4_dump("", addr, addr_str, sizeof(addr_str)); - zlog_warn("%s %s: lookup=%d/%d: failure searching recursive nexthop ifindex for address %s", - __FILE__, __PRETTY_FUNCTION__, - lookup, max_lookup, addr_str); + if (PIM_DEBUG_ZEBRA) { + char addr_str[100]; + pim_inet4_dump("", addr, addr_str, sizeof(addr_str)); + zlog_warn("%s %s: lookup=%d/%d: failure searching recursive nexthop ifindex for address %s", + __FILE__, __PRETTY_FUNCTION__, + lookup, max_lookup, addr_str); + } return -2; } -- 2.39.5