new->oi_write_q = list_new();
new->write_oi_count = OSPF_WRITE_INTERFACE_COUNT_DEFAULT;
-/* Enable "log-adjacency-changes" */
-#if DFLT_OSPF_LOG_ADJACENCY_CHANGES
- SET_FLAG(new->config, OSPF_LOG_ADJACENCY_CHANGES);
-#endif
-
QOBJ_REG(new, ospf);
new->fd = -1;
return NULL;
}
-struct ospf *ospf_get(unsigned short instance, const char *name)
+struct ospf *ospf_get(unsigned short instance, const char *name, bool *created)
{
struct ospf *ospf;
else
ospf = ospf_lookup_by_vrf_id(VRF_DEFAULT);
+ *created = (ospf == NULL);
if (ospf == NULL) {
ospf = ospf_new(instance, name);
ospf_add(ospf);
return ospf;
}
-struct ospf *ospf_get_instance(unsigned short instance)
+struct ospf *ospf_get_instance(unsigned short instance, bool *created)
{
struct ospf *ospf;
ospf = ospf_lookup_instance(instance);
+ *created = (ospf == NULL);
if (ospf == NULL) {
ospf = ospf_new(instance, NULL /* VRF_DEFAULT*/);
ospf_add(ospf);
- if (ospf->router_id_static.s_addr == 0) {
- if (vrf_lookup_by_id(ospf->vrf_id))
- ospf_router_id_update(ospf);
- else {
- if (IS_DEBUG_OSPF_EVENT)
- zlog_debug(
- "%s: ospf VRF (id %d) is not active yet, skip router id update",
- __PRETTY_FUNCTION__,
- ospf->vrf_id);
- }
+ if (ospf->router_id_static.s_addr == 0)
ospf_router_id_update(ospf);
- }
ospf_opaque_type11_lsa_init(ospf);
}
struct ospf_vl_data *vl_data;
struct listnode *node, *nnode;
int i;
- unsigned short instance = 0;
QOBJ_UNREG(ospf);
ospf_distance_reset(ospf);
route_table_finish(ospf->distance_table);
- if (!CHECK_FLAG(om->options, OSPF_MASTER_SHUTDOWN))
- instance = ospf->instance;
-
list_delete(&ospf->areas);
list_delete(&ospf->oi_write_q);
}
XFREE(MTYPE_OSPF_TOP, ospf);
-
- if (!CHECK_FLAG(om->options, OSPF_MASTER_SHUTDOWN))
- ospf_get_instance(instance);
}
return vrf ? vrf->name : "NIL";
}
+
+const char *ospf_get_name(const struct ospf *ospf)
+{
+ if (ospf->name)
+ return ospf->name;
+ else
+ return VRF_DEFAULT_NAME;
+}