]> git.proxmox.com Git - mirror_frr.git/commitdiff
lib: Add a macro to allow for quick/easy display of vrf name
authorDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 14 Feb 2020 13:09:25 +0000 (08:09 -0500)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 14 Feb 2020 13:15:40 +0000 (08:15 -0500)
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>
lib/vrf.h

index 1d87576f78818c2f10c8ebdda48c3189ff4ac123..f231d2433fbc9b769eb75382a0750eb9605820c0 100644 (file)
--- 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;                                              \