diff options
author | Abhishek N R <abnr@vmware.com> | 2022-06-09 09:49:38 +0200 |
---|---|---|
committer | Abhishek N R <abnr@vmware.com> | 2022-06-09 09:49:38 +0200 |
commit | e21c4e907540714cba39d5421699e5726911bec4 (patch) | |
tree | 9954107354f8f51af435535d882c7b7442f9157d /pimd/pim6_cmd.c | |
parent | pim6d: Moving resuable code to common api for "show pim rpf" command (diff) | |
download | frr-e21c4e907540714cba39d5421699e5726911bec4.tar.xz frr-e21c4e907540714cba39d5421699e5726911bec4.zip |
pim6d: Moving resuable code to common api for "show pim rp-info" command
Signed-off-by: Abhishek N R <abnr@vmware.com>
Diffstat (limited to 'pimd/pim6_cmd.c')
-rw-r--r-- | pimd/pim6_cmd.c | 68 |
1 files changed, 4 insertions, 64 deletions
diff --git a/pimd/pim6_cmd.c b/pimd/pim6_cmd.c index f86f3375d..1b83d38b9 100644 --- a/pimd/pim6_cmd.c +++ b/pimd/pim6_cmd.c @@ -790,40 +790,8 @@ DEFPY (show_ipv6_pim_rp, "Multicast Group range\n" JSON_STR) { - struct pim_instance *pim; - struct vrf *v; - json_object *json_parent = NULL; - struct prefix *range = 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 (group_str) { - range = prefix_new(); - prefix_copy(range, group); - apply_mask(range); - } - - if (json) - json_parent = json_object_new_object(); - - pim_rp_show_information(pim, range, vty, json_parent); - - if (json) - vty_json(vty, json_parent); - - prefix_free(&range); - - return CMD_SUCCESS; + return pim_show_rp_helper(vrf, vty, group_str, (struct prefix *)group, + !!json); } DEFPY (show_ipv6_pim_rp_vrf_all, @@ -837,36 +805,8 @@ DEFPY (show_ipv6_pim_rp_vrf_all, "Multicast Group range\n" JSON_STR) { - struct vrf *vrf; - json_object *json_parent = NULL; - json_object *json_vrf = NULL; - struct prefix *range = NULL; - - if (group_str) { - range = prefix_new(); - prefix_copy(range, group); - apply_mask(range); - } - - 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(); - pim_rp_show_information(vrf->info, range, vty, json_vrf); - if (json) - json_object_object_add(json_parent, vrf->name, - json_vrf); - } - if (json) - vty_json(vty, json_parent); - - prefix_free(&range); - - return CMD_SUCCESS; + return pim_show_rp_vrf_all_helper(vty, group_str, + (struct prefix *)group, !!json); } DEFPY (show_ipv6_pim_rpf, |