]> git.puffer.fish Git - mirror/frr.git/commitdiff
pim6d: Moving the common lines of pim_show_nexthop cli
authorSai Gomathi N <nsaigomathi@vmware.com>
Thu, 9 Jun 2022 10:23:28 +0000 (03:23 -0700)
committerSai Gomathi N <nsaigomathi@vmware.com>
Thu, 9 Jun 2022 10:23:28 +0000 (03:23 -0700)
Moving the common lines of pim_show_nexthop cli
in pim_cmd.c and pim6_cmd.c to pim_cmd_common.c file

Signed-off-by: Sai Gomathi N <nsaigomathi@vmware.com>
pimd/pim6_cmd.c
pimd/pim_cmd.c
pimd/pim_cmd_common.c
pimd/pim_cmd_common.h

index a46e7fa178d94481afdc0e0eabd920320661b36b..55d77f6e963ad92c05384cf3abf6a0d10f95a985 100644 (file)
@@ -1418,16 +1418,7 @@ DEFPY (show_ipv6_pim_nexthop,
        VRF_CMD_HELP_STR
        "PIM cached nexthop rpf information\n")
 {
-       struct vrf *v;
-
-       v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME);
-
-       if (!v)
-               return CMD_WARNING;
-
-       pim_show_nexthop(v->info, vty);
-
-       return CMD_SUCCESS;
+       return pim_show_nexthop_cmd_helper(vrf, vty);
 }
 
 DEFPY (show_ipv6_pim_nexthop_lookup,
index 4e573d23721fa53e17a679194e9fd70b8dd5307d..ec1a2f4c579d5123cbbf2f41265a141f40b813c6 100644 (file)
@@ -3284,16 +3284,7 @@ DEFPY (show_ip_pim_nexthop,
        VRF_CMD_HELP_STR
        "PIM cached nexthop rpf information\n")
 {
-       struct vrf *v;
-
-       v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME);
-
-       if (!v)
-               return CMD_WARNING;
-
-       pim_show_nexthop(v->info, vty);
-
-       return CMD_SUCCESS;
+       return pim_show_nexthop_cmd_helper(vrf, vty);
 }
 
 DEFPY (show_ip_pim_nexthop_lookup,
index e7299f221411508ac7756d954e3585ed911f090e..666d7672eb1dd1d302f05cf14a2c22bbb16b8bfa 100644 (file)
@@ -2597,6 +2597,20 @@ static int pim_print_pnc_cache_walkcb(struct hash_bucket *bucket, void *arg)
        return CMD_SUCCESS;
 }
 
+int pim_show_nexthop_cmd_helper(const char *vrf, struct vty *vty)
+{
+       struct vrf *v;
+
+       v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME);
+
+       if (!v)
+               return CMD_WARNING;
+
+       pim_show_nexthop(v->info, vty);
+
+       return CMD_SUCCESS;
+}
+
 void pim_show_nexthop(struct pim_instance *pim, struct vty *vty)
 {
        struct pnc_cache_walk_data cwd;
index d6fd360ac8c7a52a60316dbacbf4bab8f611ce32..2ff738997d2ed9e98ccdf581bc9336bc252a6ff8 100644 (file)
@@ -102,6 +102,7 @@ void pim_show_interfaces_single(struct pim_instance *pim, struct vty *vty,
                                json_object *json);
 void ip_pim_ssm_show_group_range(struct pim_instance *pim, struct vty *vty,
                                 bool uj);
+int pim_show_nexthop_cmd_helper(const char *vrf, struct vty *vty);
 void pim_show_nexthop(struct pim_instance *pim, struct vty *vty);
 int pim_show_neighbors_cmd_helper(const char *vrf, struct vty *vty,
                                  const char *json, const char *interface);