From 58302dc7247b014fa7bae96380cc3c9b0e6c7815 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Tue, 12 Jul 2016 15:22:10 -0400 Subject: [PATCH] pimd: Track if the mroute is installed or not Track whether or not if a mroute has been installed or not. If not don't display information about it. Signed-off-by: Donald Sharp --- pimd/pim_cmd.c | 12 ++++++++++++ pimd/pim_mroute.c | 3 +++ pimd/pim_oil.c | 1 + pimd/pim_oil.h | 1 + 4 files changed, 17 insertions(+) diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c index 4e168bda0..f27e3ff76 100644 --- a/pimd/pim_cmd.c +++ b/pimd/pim_cmd.c @@ -2190,6 +2190,9 @@ static void show_mroute(struct vty *vty) char source_str[100]; int oif_vif_index; + if (!c_oil->installed) + continue; + 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)); @@ -2240,6 +2243,9 @@ static void show_mroute(struct vty *vty) char source_str[100]; int oif_vif_index; + if (!s_route->c_oil.installed) + continue; + pim_inet4_dump("", s_route->group, group_str, sizeof(group_str)); pim_inet4_dump("", s_route->source, source_str, sizeof(source_str)); @@ -2305,6 +2311,9 @@ static void show_mroute_count(struct vty *vty) char source_str[100]; struct sioc_sg_req sgreq; + if (!c_oil->installed) + continue; + memset(&sgreq, 0, sizeof(sgreq)); sgreq.src = c_oil->oil.mfcc_origin; sgreq.grp = c_oil->oil.mfcc_mcastgrp; @@ -2340,6 +2349,9 @@ static void show_mroute_count(struct vty *vty) char source_str[100]; struct sioc_sg_req sgreq; + if (!s_route->c_oil.installed) + continue; + memset(&sgreq, 0, sizeof(sgreq)); sgreq.src = s_route->c_oil.oil.mfcc_origin; sgreq.grp = s_route->c_oil.oil.mfcc_mcastgrp; diff --git a/pimd/pim_mroute.c b/pimd/pim_mroute.c index 1b13d9086..4d9a9d0b7 100644 --- a/pimd/pim_mroute.c +++ b/pimd/pim_mroute.c @@ -597,6 +597,7 @@ int pim_mroute_add(struct channel_oil *c_oil) return -2; } + c_oil->installed = 1; return 0; } @@ -624,5 +625,7 @@ int pim_mroute_del (struct channel_oil *c_oil) return -2; } + c_oil->installed = 0; + return 0; } diff --git a/pimd/pim_oil.c b/pimd/pim_oil.c index 3d9b7d11f..96f9ef2b6 100644 --- a/pimd/pim_oil.c +++ b/pimd/pim_oil.c @@ -79,6 +79,7 @@ static struct channel_oil *channel_oil_new(struct in_addr group_addr, c_oil->oil.mfcc_origin = source_addr; c_oil->oil.mfcc_parent = input_vif_index; c_oil->oil_ref_count = 1; + c_oil->installed = 0; zassert(c_oil->oil_size == 0); diff --git a/pimd/pim_oil.h b/pimd/pim_oil.h index f0a14a9ba..143f2345f 100644 --- a/pimd/pim_oil.h +++ b/pimd/pim_oil.h @@ -59,6 +59,7 @@ struct channel_oil { struct mfcctl oil; + int installed; int oil_size; int oil_ref_count; time_t oif_creation[MAXVIFS]; -- 2.39.5