summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/vrf.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/vrf.c b/lib/vrf.c
index 1ed96cd0a4..8593cf289f 100644
--- a/lib/vrf.c
+++ b/lib/vrf.c
@@ -159,11 +159,13 @@ struct vrf *vrf_get(vrf_id_t vrf_id, const char *name)
if (!name && vrf_id == VRF_UNKNOWN)
return NULL;
+ /* attempt to find already available VRF
+ */
+ if (name)
+ vrf = vrf_lookup_by_name(name);
/* Try to find VRF both by ID and name */
- if (vrf_id != VRF_UNKNOWN)
+ if (!vrf && vrf_id != VRF_UNKNOWN)
vrf = vrf_lookup_by_id(vrf_id);
- if (!vrf && name)
- vrf = vrf_lookup_by_name(name);
if (vrf == NULL) {
vrf = XCALLOC(MTYPE_VRF, sizeof(struct vrf));