From 14406e8eec3d8d528727a45836ca5fd1865c9e26 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Mon, 25 Feb 2019 14:10:10 -0500 Subject: [PATCH] ospfd: Allow pre-existing vrf's to work When creating a ospf vrf based instance allow it to work if the vrf has been created *before* we create the ospf instance. Signed-off-by: Donald Sharp --- ospfd/ospfd.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c index a18e2de725..073a51561b 100644 --- a/ospfd/ospfd.c +++ b/ospfd/ospfd.c @@ -234,8 +234,12 @@ static struct ospf *ospf_new(unsigned short instance, const char *name) new->instance = instance; new->router_id.s_addr = htonl(0); new->router_id_static.s_addr = htonl(0); - if (name && !strmatch(name, VRF_DEFAULT_NAME)) { - new->vrf_id = VRF_UNKNOWN; + if (name) { + vrf = vrf_lookup_by_name(name); + if (vrf) + new->vrf_id = vrf->vrf_id; + else + new->vrf_id = VRF_UNKNOWN; /* Freed in ospf_finish_final */ new->name = XSTRDUP(MTYPE_OSPF_TOP, name); if (IS_DEBUG_OSPF_EVENT) -- 2.39.5