summaryrefslogtreecommitdiffstats
path: root/lib/vrf.h
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2020-02-14 14:09:25 +0100
committerDonald Sharp <sharpd@cumulusnetworks.com>2020-02-14 14:15:40 +0100
commitb7e48f2147051be7f1e67f7cecba866f7bde620d (patch)
treefd28e391041acc5a3776ccceb9d8e6111fea310b /lib/vrf.h
parentlib: Format according to our standard (diff)
downloadfrr-b7e48f2147051be7f1e67f7cecba866f7bde620d.tar.xz
frr-b7e48f2147051be7f1e67f7cecba866f7bde620d.zip
lib: Add a macro to allow for quick/easy display of vrf name
Add a quick macro to allow for safe dereference of the vrf since it may or may not exist in all cases. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to '')
-rw-r--r--lib/vrf.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/vrf.h b/lib/vrf.h
index 1d87576f7..f231d2433 100644
--- a/lib/vrf.h
+++ b/lib/vrf.h
@@ -114,6 +114,8 @@ extern struct vrf *vrf_get(vrf_id_t, const char *);
extern const char *vrf_id_to_name(vrf_id_t vrf_id);
extern vrf_id_t vrf_name_to_id(const char *);
+#define VRF_LOGNAME(V) V ? V->name : "Unknown"
+
#define VRF_GET_ID(V, NAME, USE_JSON) \
do { \
struct vrf *_vrf; \