summaryrefslogtreecommitdiffstats
path: root/pimd/pim_cmd.c
diff options
context:
space:
mode:
authorSarita Patra <saritap@vmware.com>2022-07-12 15:00:57 +0200
committerSarita Patra <saritap@vmware.com>2022-07-12 15:09:04 +0200
commitaf9c8e7666f91b8837c027ac733b512fe6f3a37e (patch)
tree3f33399d8eb945b605836170c8d959e60141456f /pimd/pim_cmd.c
parentMerge pull request #11580 from patrasar/remove_pim_addr.h (diff)
downloadfrr-af9c8e7666f91b8837c027ac733b512fe6f3a37e.tar.xz
frr-af9c8e7666f91b8837c027ac733b512fe6f3a37e.zip
pimd: Avoid unnecessary vrf lookup
In several places, we are getting the vrf structure using vrf_lookup_by_name(). Again we are passing vrf->vrf_id to pim_get_pim_instance() to get the pim_instance. The API pim_get_pim_instance() again get the VRF structure using vrf_lookup_by_id(). This is avoided in this PR. Signed-off-by: Sarita Patra <saritap@vmware.com>
Diffstat (limited to 'pimd/pim_cmd.c')
-rw-r--r--pimd/pim_cmd.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c
index 813ef4ca3..806b6d185 100644
--- a/pimd/pim_cmd.c
+++ b/pimd/pim_cmd.c
@@ -4158,26 +4158,21 @@ DEFPY_HIDDEN (pim_test_sg_keepalive,
"The Group we are resetting\n")
{
struct pim_upstream *up;
+ struct vrf *vrf;
struct pim_instance *pim;
pim_sgaddr sg;
sg.src = source;
sg.grp = group;
- if (!name)
- pim = pim_get_pim_instance(VRF_DEFAULT);
- else {
- struct vrf *vrf = vrf_lookup_by_name(name);
-
- if (!vrf) {
- vty_out(vty, "%% Vrf specified: %s does not exist\n",
- name);
- return CMD_WARNING;
- }
-
- pim = pim_get_pim_instance(vrf->vrf_id);
+ vrf = vrf_lookup_by_name(name ? name : VRF_DEFAULT_NAME);
+ if (!vrf) {
+ vty_out(vty, "%% Vrf specified: %s does not exist\n", name);
+ return CMD_WARNING;
}
+ pim = vrf->info;
+
if (!pim) {
vty_out(vty, "%% Unable to find pim instance\n");
return CMD_WARNING;