From c7b1183fc7aaef258c40074826de5325fca3c1f4 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Mon, 26 Sep 2016 23:13:42 -0400 Subject: [PATCH] pimd: Don't ask for information when you are notgoing to get an answer When we have intentionally not installed a mroute( for whatever reason ), do not ask for information about that mroute from the kernel when it happens. Ticket: CM-12986 Signed-off-by: Donald Sharp --- pimd/pim_mroute.c | 49 +++++++++++++++++++++++++++++++--------------- pimd/pim_zlookup.c | 8 +++++++- 2 files changed, 40 insertions(+), 17 deletions(-) diff --git a/pimd/pim_mroute.c b/pimd/pim_mroute.c index c53a0393c0..9ef29b6e42 100644 --- a/pimd/pim_mroute.c +++ b/pimd/pim_mroute.c @@ -737,29 +737,46 @@ pim_mroute_update_counters (struct channel_oil *c_oil) { struct sioc_sg_req sgreq; - memset (&sgreq, 0, sizeof(sgreq)); - sgreq.src = c_oil->oil.mfcc_origin; - sgreq.grp = c_oil->oil.mfcc_mcastgrp; - c_oil->cc.oldpktcnt = c_oil->cc.pktcnt; c_oil->cc.oldbytecnt = c_oil->cc.bytecnt; c_oil->cc.oldwrong_if = c_oil->cc.wrong_if; + if (!c_oil->installed) + { + c_oil->cc.lastused = 100 * qpim_keep_alive_time; + if (PIM_DEBUG_MROUTE) + { + struct prefix_sg sg; + + sg.src = c_oil->oil.mfcc_origin; + sg.grp = c_oil->oil.mfcc_mcastgrp; + if (PIM_DEBUG_MROUTE) + zlog_debug("Channel(%s) is not installed no need to collect data from kernel", + pim_str_sg_dump (&sg)); + } + return; + } + + memset (&sgreq, 0, sizeof(sgreq)); + sgreq.src = c_oil->oil.mfcc_origin; + sgreq.grp = c_oil->oil.mfcc_mcastgrp; + pim_zlookup_sg_statistics (c_oil); if (ioctl (qpim_mroute_socket_fd, SIOCGETSGCNT, &sgreq)) { - char group_str[100]; - char source_str[100]; - - pim_inet4_dump("", c_oil->oil.mfcc_mcastgrp, group_str, sizeof(group_str)); - pim_inet4_dump("", c_oil->oil.mfcc_origin, source_str, sizeof(source_str)); - - zlog_warn ("ioctl(SIOCGETSGCNT=%lu) failure for (S,G)=(%s,%s): errno=%d: %s", - (unsigned long)SIOCGETSGCNT, - source_str, - group_str, - errno, - safe_strerror(errno)); + if (PIM_DEBUG_MROUTE) + { + struct prefix_sg sg; + + sg.src = c_oil->oil.mfcc_origin; + sg.grp = c_oil->oil.mfcc_mcastgrp; + + zlog_warn ("ioctl(SIOCGETSGCNT=%lu) failure for (S,G)=(%s): errno=%d: %s", + (unsigned long)SIOCGETSGCNT, + pim_str_sg_dump (&sg), + errno, + safe_strerror(errno)); + } return; } diff --git a/pimd/pim_zlookup.c b/pimd/pim_zlookup.c index 8c8fb55ce2..4e6c76f0b0 100644 --- a/pimd/pim_zlookup.c +++ b/pimd/pim_zlookup.c @@ -448,7 +448,13 @@ pim_zlookup_sg_statistics (struct channel_oil *c_oil) struct interface *ifp = pim_if_find_by_vif_index (c_oil->oil.mfcc_parent); if (PIM_DEBUG_ZEBRA) - zlog_debug ("Sending Request for New Channel Oil Information"); + { + struct prefix_sg more; + + more.src = c_oil->oil.mfcc_origin; + more.grp = c_oil->oil.mfcc_mcastgrp; + zlog_debug ("Sending Request for New Channel Oil Information(%s)", pim_str_sg_dump (&more)); + } stream_reset (s); zclient_create_header (s, ZEBRA_IPMR_ROUTE_STATS, VRF_DEFAULT); -- 2.39.5