summaryrefslogtreecommitdiff
path: root/lib/vty.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/vty.h')
-rw-r--r--lib/vty.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/vty.h b/lib/vty.h
index e42a3b210f..430579c5a8 100644
--- a/lib/vty.h
+++ b/lib/vty.h
@@ -266,6 +266,15 @@ static inline void vty_push_context(struct vty *vty, int node, uint64_t id)
struct structname *ptr = VTY_GET_CONTEXT(structname); \
VTY_CHECK_CONTEXT(ptr);
+#define VTY_DECLVAR_CONTEXT_VRF(vrfptr) \
+ struct vrf *vrfptr; \
+ if (vty->node == CONFIG_NODE) \
+ vrfptr = vrf_lookup_by_id(VRF_DEFAULT); \
+ else \
+ vrfptr = VTY_GET_CONTEXT(vrf); \
+ VTY_CHECK_CONTEXT(vrfptr); \
+ MACRO_REQUIRE_SEMICOLON() /* end */
+
/* XPath macros. */
#define VTY_PUSH_XPATH(nodeval, value) \
do { \