diff options
author | Abhishek N R <abnr@vmware.com> | 2022-06-09 12:10:21 +0200 |
---|---|---|
committer | Abhishek N R <abnr@vmware.com> | 2022-06-09 12:10:21 +0200 |
commit | c630970866da41b90e3276ed5e8eeb52ccdda0ab (patch) | |
tree | 9dc1cbae5a9fb33f17199524ec540e8d36d91032 /pimd | |
parent | pim6d: Moving reusable code to common api for "show pim upstream join desired... (diff) | |
download | frr-c630970866da41b90e3276ed5e8eeb52ccdda0ab.tar.xz frr-c630970866da41b90e3276ed5e8eeb52ccdda0ab.zip |
pim6d: Moving reusable code to common api for "show pim upstream rpf" command
Signed-off-by: Abhishek N R <abnr@vmware.com>
Diffstat (limited to 'pimd')
-rw-r--r-- | pimd/pim6_cmd.c | 20 | ||||
-rw-r--r-- | pimd/pim_cmd.c | 20 | ||||
-rw-r--r-- | pimd/pim_cmd_common.c | 22 | ||||
-rw-r--r-- | pimd/pim_cmd_common.h | 1 |
4 files changed, 25 insertions, 38 deletions
diff --git a/pimd/pim6_cmd.c b/pimd/pim6_cmd.c index 998e0d1d7..7f057dd50 100644 --- a/pimd/pim6_cmd.c +++ b/pimd/pim6_cmd.c @@ -913,25 +913,7 @@ DEFPY (show_ipv6_pim_upstream_rpf, "PIM upstream source rpf\n" JSON_STR) { - struct pim_instance *pim; - struct vrf *v; - bool uj = !!json; - - 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; - } - - pim_show_upstream_rpf(pim, vty, uj); - - return CMD_SUCCESS; + return pim_show_upstream_rpf_helper(vrf, vty, !!json); } DEFPY (show_ipv6_pim_state, diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c index 54e1aae4d..225d79c2e 100644 --- a/pimd/pim_cmd.c +++ b/pimd/pim_cmd.c @@ -3131,25 +3131,7 @@ DEFPY (show_ip_pim_upstream_rpf, "PIM upstream source rpf\n" JSON_STR) { - struct pim_instance *pim; - struct vrf *v; - bool uj = !!json; - - 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; - } - - pim_show_upstream_rpf(pim, vty, uj); - - return CMD_SUCCESS; + return pim_show_upstream_rpf_helper(vrf, vty, !!json); } DEFPY (show_ip_pim_rp, diff --git a/pimd/pim_cmd_common.c b/pimd/pim_cmd_common.c index 26a6e8a1c..4c0a12622 100644 --- a/pimd/pim_cmd_common.c +++ b/pimd/pim_cmd_common.c @@ -4003,3 +4003,25 @@ int pim_show_upstream_join_desired_helper(const char *vrf, struct vty *vty, return CMD_SUCCESS; } + +int pim_show_upstream_rpf_helper(const char *vrf, struct vty *vty, bool uj) +{ + struct pim_instance *pim; + struct vrf *v; + + 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; + } + + pim_show_upstream_rpf(pim, vty, uj); + + return CMD_SUCCESS; +} diff --git a/pimd/pim_cmd_common.h b/pimd/pim_cmd_common.h index 038f7f4d7..0ce62d82d 100644 --- a/pimd/pim_cmd_common.h +++ b/pimd/pim_cmd_common.h @@ -145,6 +145,7 @@ int pim_show_upstream_helper(const char *vrf, struct vty *vty, pim_addr s_or_g, int pim_show_upstream_vrf_all_helper(struct vty *vty, bool json); int pim_show_upstream_join_desired_helper(const char *vrf, struct vty *vty, bool uj); +int pim_show_upstream_rpf_helper(const char *vrf, struct vty *vty, bool uj); /* * Special Macro to allow us to get the correct pim_instance; |