From c3156184f95fc4db5ba6ca58294262cb384dec5d Mon Sep 17 00:00:00 2001 From: Sarita Patra Date: Fri, 22 Feb 2019 03:31:56 -0800 Subject: [PATCH] pimd: Don't install dummy channel oil entry into Kernel If the channel oil is dummy(channel_oil->is_valid != True), then don't install entry into the kernel. Signed-off-by: Sarita Patra --- pimd/pim_oil.c | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/pimd/pim_oil.c b/pimd/pim_oil.c index 5042db8e57..35801aa49e 100644 --- a/pimd/pim_oil.c +++ b/pimd/pim_oil.c @@ -453,25 +453,31 @@ int pim_channel_add_oif(struct channel_oil *channel_oil, struct interface *oif, channel_oil->oil.mfcc_ttls[pim_ifp->mroute_vif_index] = PIM_MROUTE_MIN_TTL; - if (pim_mroute_add(channel_oil, __PRETTY_FUNCTION__)) { - if (PIM_DEBUG_MROUTE) { - char group_str[INET_ADDRSTRLEN]; - char source_str[INET_ADDRSTRLEN]; - pim_inet4_dump("", - channel_oil->oil.mfcc_mcastgrp, - group_str, sizeof(group_str)); - pim_inet4_dump("", - channel_oil->oil.mfcc_origin, source_str, - sizeof(source_str)); - zlog_debug( - "%s %s: could not add output interface %s (vif_index=%d) for channel (S,G)=(%s,%s)", - __FILE__, __PRETTY_FUNCTION__, oif->name, - pim_ifp->mroute_vif_index, source_str, - group_str); - } + /* channel_oil->is_valid indicate if this entry is valid to get + * installed in kernel. + */ + if (channel_oil->is_valid) { + if (pim_mroute_add(channel_oil, __PRETTY_FUNCTION__)) { + if (PIM_DEBUG_MROUTE) { + char group_str[INET_ADDRSTRLEN]; + char source_str[INET_ADDRSTRLEN]; + pim_inet4_dump("", + channel_oil->oil.mfcc_mcastgrp, + group_str, sizeof(group_str)); + pim_inet4_dump("", + channel_oil->oil.mfcc_origin, source_str, + sizeof(source_str)); + zlog_debug( + "%s %s: could not add output interface %s (vif_index=%d) for channel (S,G)=(%s,%s)", + __FILE__, __PRETTY_FUNCTION__, oif->name, + pim_ifp->mroute_vif_index, source_str, + group_str); + } - channel_oil->oil.mfcc_ttls[pim_ifp->mroute_vif_index] = old_ttl; - return -5; + channel_oil->oil.mfcc_ttls[pim_ifp->mroute_vif_index] + = old_ttl; + return -5; + } } channel_oil->oif_creation[pim_ifp->mroute_vif_index] = -- 2.39.5