]> git.puffer.fish Git - mirror/frr.git/commitdiff
pimd: Create macro to get appropriate pim instance
authorDonald Sharp <sharpd@cumulusnetworks.com>
Mon, 22 May 2017 20:12:41 +0000 (16:12 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Mon, 24 Jul 2017 17:51:37 +0000 (13:51 -0400)
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
pimd/pim_cmd.c
pimd/pim_cmd.h

index 059bd4e6f4af3e752b83db57fbef672c480d6ba9..5a0737fcfea7caf9df89db14bc7de602f00133a0 100644 (file)
@@ -4524,8 +4524,7 @@ DEFUN (ip_pim_rp,
        "ip address of RP\n"
        "Group Address range to cover\n")
 {
-       VTY_DECLVAR_CONTEXT(vrf, vrf);
-       struct pim_instance *pim = vrf->info;
+       PIM_DECLVAR_CONTEXT(vrf, pim);
        int idx_ipv4 = 3;
 
        if (argc == (idx_ipv4 + 1))
index 64751d8682b12fc6da3752dcad735645acaab43e..8867514876a8283a6d3622a8a40192d473e7a563 100644 (file)
 
 void pim_cmd_init(void);
 
+/*
+ * Special Macro to allow us to get the correct pim_instance;
+ */
+#define PIM_DECLVAR_CONTEXT(A, B)                                              \
+       struct vrf *A = VTY_GET_CONTEXT(vrf);                                  \
+       struct pim_instance *B =                                               \
+               (vrf) ? vrf->info : pim_get_pim_instance(VRF_DEFAULT);         \
+       vrf = (vrf) ? vrf : pim->vrf;
+
 #endif /* PIM_CMD_H */