diff options
author | David Lamparter <equinox@opensourcerouting.org> | 2022-04-28 11:06:20 +0200 |
---|---|---|
committer | David Lamparter <equinox@opensourcerouting.org> | 2022-04-28 11:09:26 +0200 |
commit | 0cbed9511acbf4adbf9209a022b48e1fc0d0e2a3 (patch) | |
tree | aaf3ad8885757cc3cb234333d89093bf40bd4144 /pimd/pim_cmd_common.h | |
parent | Merge pull request #11031 from AbhishekNR/v6_multicast (diff) | |
download | frr-0cbed9511acbf4adbf9209a022b48e1fc0d0e2a3.tar.xz frr-0cbed9511acbf4adbf9209a022b48e1fc0d0e2a3.zip |
lib, zebra, pimd: clean up/fix VRF DECLVAR macros
There's a common pattern of "get VRF context for CLI node" here, which
first got a helper macro in zebra that then permeated into pimd.
Unfortunately the pimd copy wasn't quite adjusted correctly and thus
caused two coverity warnings (CID 1517453, CID 1517454).
Fix the PIM one, and clean up by providing a common base macro in
`lib/vty.h`.
Also rename the macros (add `_VRF`) to make more clear what they do.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'pimd/pim_cmd_common.h')
-rw-r--r-- | pimd/pim_cmd_common.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/pimd/pim_cmd_common.h b/pimd/pim_cmd_common.h index 9fac2c111..74477fd19 100644 --- a/pimd/pim_cmd_common.h +++ b/pimd/pim_cmd_common.h @@ -112,9 +112,9 @@ void show_multicast_interfaces(struct pim_instance *pim, struct vty *vty, /* * 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 +#define PIM_DECLVAR_CONTEXT_VRF(vrfptr, pimptr) \ + VTY_DECLVAR_CONTEXT_VRF(vrfptr); \ + struct pim_instance *pimptr = vrfptr->info; \ + MACRO_REQUIRE_SEMICOLON() /* end */ + #endif /* PIM_CMD_COMMON_H */ |