summaryrefslogtreecommitdiff
path: root/pimd/pim_cmd_common.c
diff options
context:
space:
mode:
authorSarita Patra <saritap@vmware.com>2023-06-07 04:10:52 -0700
committerSarita Patra <saritap@vmware.com>2023-07-10 05:03:04 -0700
commit752c56822624ad7fbb630caa55a05cf093a7a287 (patch)
tree7c906251c525b86f5ed2c1eb01a6ca8286df2abb /pimd/pim_cmd_common.c
parentf5b8a4e188966b1fc89b3eec45be88ac576fb579 (diff)
pimd, pim6d: Added pimEnabled field in "show ip pim nexthop json" cli
The cli "show ip pim nexthop json" gives the RPF information. However it doesn't give PIM enable status on the nexthop interface. Added pimEnabled field in this clis, this will tell if PIM is enabled or not on the nexthop interface. Example: frr# show ip pim nexthop Number of registered addresses: 1 Address Interface Nexthop 108.0.0.2 ens224 108.0.0.2 frr# show ip pim nexthop json { "108.0.0.2":{ "address":"108.0.0.2", "nexthops":[ { "interface":"ens224", "pimEnabled":true, "nexthop":"108.0.0.2" } ] } } frr# configure terminal frr(config)# int ens224 frr(config-if)# no ip pim frr(config-if)# end frr# show ip pim nexthop json { "108.0.0.2":{ "address":"108.0.0.2", "nexthops":[ { "interface":"ens224", "pimEnabled":false, "nexthop":"108.0.0.2" } ] } } Signed-off-by: Sarita Patra <saritap@vmware.com>
Diffstat (limited to 'pimd/pim_cmd_common.c')
-rw-r--r--pimd/pim_cmd_common.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/pimd/pim_cmd_common.c b/pimd/pim_cmd_common.c
index 6af19cadd7..716cb8db5b 100644
--- a/pimd/pim_cmd_common.c
+++ b/pimd/pim_cmd_common.c
@@ -2844,6 +2844,8 @@ static int pim_print_json_pnc_cache_walkcb(struct hash_bucket *backet,
json_object *json_row = NULL;
json_object *json_ifp = NULL;
json_object *json_arr = NULL;
+ struct pim_interface *pim_ifp = NULL;
+ bool pim_enable = false;
for (nh_node = pnc->nexthop; nh_node; nh_node = nh_node->next) {
first_ifindex = nh_node->ifindex;
@@ -2863,6 +2865,14 @@ static int pim_print_json_pnc_cache_walkcb(struct hash_bucket *backet,
json_ifp = json_object_new_object();
json_object_string_add(json_ifp, "interface",
ifp ? ifp->name : "NULL");
+
+ if (ifp)
+ pim_ifp = ifp->info;
+
+ if (pim_ifp && pim_ifp->pim_enable)
+ pim_enable = true;
+
+ json_object_boolean_add(json_ifp, "pimEnabled", pim_enable);
#if PIM_IPV == 4
json_object_string_addf(json_ifp, "nexthop", "%pI4",
&nh_node->gate.ipv4);