summaryrefslogtreecommitdiff
path: root/ospfd/ospfd.c
diff options
context:
space:
mode:
Diffstat (limited to 'ospfd/ospfd.c')
-rw-r--r--ospfd/ospfd.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c
index bfaedf2fe7..d311b4da6b 100644
--- a/ospfd/ospfd.c
+++ b/ospfd/ospfd.c
@@ -234,12 +234,10 @@ 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) {
+ if (name && !strmatch(name, VRF_DEFAULT_NAME)) {
new->vrf_id = VRF_UNKNOWN;
/* Freed in ospf_finish_final */
new->name = XSTRDUP(MTYPE_OSPF_TOP, name);
- vrf = vrf_lookup_by_name(new->name);
if (IS_DEBUG_OSPF_EVENT)
zlog_debug(
"%s: Create new ospf instance with vrf_name %s vrf_id %u",
@@ -381,6 +379,9 @@ struct ospf *ospf_lookup_by_inst_name(unsigned short instance, const char *name)
struct ospf *ospf = NULL;
struct listnode *node, *nnode;
+ if (name == NULL || strmatch(name, VRF_DEFAULT_NAME))
+ return ospf_lookup_by_vrf_id(VRF_DEFAULT);
+
for (ALL_LIST_ELEMENTS(om->ospf, node, nnode, ospf)) {
if ((ospf->instance == instance)
&& ((ospf->name == NULL && name == NULL)
@@ -2078,6 +2079,10 @@ static int ospf_vrf_enable(struct vrf *vrf)
ospf = ospf_lookup_by_name(vrf->name);
if (ospf) {
+ if (ospf->name && strmatch(vrf->name, VRF_DEFAULT_NAME)) {
+ XFREE(MTYPE_OSPF_TOP, ospf->name);
+ ospf->name = NULL;
+ }
old_vrf_id = ospf->vrf_id;
/* We have instance configured, link to VRF and make it "up". */
ospf_vrf_link(ospf, vrf);
@@ -2149,7 +2154,7 @@ static int ospf_vrf_disable(struct vrf *vrf)
void ospf_vrf_init(void)
{
vrf_init(ospf_vrf_new, ospf_vrf_enable, ospf_vrf_disable,
- ospf_vrf_delete);
+ ospf_vrf_delete, NULL);
}
void ospf_vrf_terminate(void)