summaryrefslogtreecommitdiffstats
path: root/pimd/pim_cmd.c
diff options
context:
space:
mode:
authorAbhishek N R <abnr@vmware.com>2022-06-09 13:27:20 +0200
committerAbhishek N R <abnr@vmware.com>2022-06-09 13:27:20 +0200
commit4f1f8ff9aa2ee0b944f43453879e93e70e44d598 (patch)
tree4da0c3b36baaecbe44659d8facddd1baaaf8607a /pimd/pim_cmd.c
parentpim6d: Moving reusable code to common api for "show ip/ipv6 multicast count" ... (diff)
downloadfrr-4f1f8ff9aa2ee0b944f43453879e93e70e44d598.tar.xz
frr-4f1f8ff9aa2ee0b944f43453879e93e70e44d598.zip
pim6d: Moving reusable code to common api for "show ip/ipv6 mroute" command
Signed-off-by: Abhishek N R <abnr@vmware.com>
Diffstat (limited to 'pimd/pim_cmd.c')
-rw-r--r--pimd/pim_cmd.c58
1 files changed, 2 insertions, 56 deletions
diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c
index dc36471f6..411963b03 100644
--- a/pimd/pim_cmd.c
+++ b/pimd/pim_cmd.c
@@ -3369,40 +3369,7 @@ DEFPY (show_ip_mroute,
"Fill in Assumed data\n"
JSON_STR)
{
- pim_sgaddr sg = {0};
- struct pim_instance *pim;
- struct vrf *v;
- json_object *json_parent = NULL;
-
- v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME);
-
- if (!v)
- return CMD_WARNING;
-
- pim = pim_get_pim_instance(v->vrf_id);
-
- if (!pim) {
- vty_out(vty, "%% Unable to find pim instance\n");
- return CMD_WARNING;
- }
-
- if (json)
- json_parent = json_object_new_object();
-
- if (s_or_g.s_addr != INADDR_ANY) {
- if (g.s_addr != INADDR_ANY) {
- sg.src = s_or_g;
- sg.grp = g;
- } else
- sg.grp = s_or_g;
- }
-
- show_mroute(pim, vty, &sg, !!fill, json_parent);
-
- if (json)
- vty_json(vty, json_parent);
-
- return CMD_SUCCESS;
+ return pim_show_mroute_helper(vrf, vty, s_or_g, g, !!fill, !!json);
}
DEFPY (show_ip_mroute_vrf_all,
@@ -3415,28 +3382,7 @@ DEFPY (show_ip_mroute_vrf_all,
"Fill in Assumed data\n"
JSON_STR)
{
- pim_sgaddr sg = {0};
- struct vrf *vrf;
- json_object *json_parent = NULL;
- json_object *json_vrf = NULL;
-
- if (json)
- json_parent = json_object_new_object();
-
- RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
- if (!json)
- vty_out(vty, "VRF: %s\n", vrf->name);
- else
- json_vrf = json_object_new_object();
- show_mroute(vrf->info, vty, &sg, !!fill, json_vrf);
- if (json)
- json_object_object_add(json_parent, vrf->name,
- json_vrf);
- }
- if (json)
- vty_json(vty, json_parent);
-
- return CMD_SUCCESS;
+ return pim_show_mroute_vrf_all_helper(vty, !!fill, !!json);
}
DEFPY (clear_ip_mroute_count,