Blame SOURCES/0008-ospf-multi-instance.patch

caebb1
diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c
caebb1
index d8be19db9..6fe94f3a4 100644
caebb1
--- a/ospfd/ospfd.c
caebb1
+++ b/ospfd/ospfd.c
caebb1
@@ -384,12 +384,50 @@ struct ospf *ospf_lookup_by_inst_name(unsigned short instance, const char *name)
caebb1
 	return NULL;
caebb1
 }
caebb1
 
caebb1
-struct ospf *ospf_get(unsigned short instance, const char *name, bool *created)
caebb1
+static void ospf_init(struct ospf *ospf)
caebb1
 {
caebb1
-	struct ospf *ospf;
caebb1
 	struct vrf *vrf;
caebb1
 	struct interface *ifp;
caebb1
 
caebb1
+	ospf_opaque_type11_lsa_init(ospf);
caebb1
+
caebb1
+	if (ospf->vrf_id != VRF_UNKNOWN)
caebb1
+		ospf->oi_running = 1;
caebb1
+
caebb1
+	/* Activate 'ip ospf area x' configured interfaces for given
caebb1
+	 * vrf. Activate area on vrf x aware interfaces.
caebb1
+	 * vrf_enable callback calls router_id_update which
caebb1
+	 * internally will call ospf_if_update to trigger
caebb1
+	 * network_run_state
caebb1
+	 */
caebb1
+	vrf = vrf_lookup_by_id(ospf->vrf_id);
caebb1
+
caebb1
+	FOR_ALL_INTERFACES (vrf, ifp) {
caebb1
+		struct ospf_if_params *params;
caebb1
+		struct route_node *rn;
caebb1
+		uint32_t count = 0;
caebb1
+
caebb1
+		params = IF_DEF_PARAMS(ifp);
caebb1
+		if (OSPF_IF_PARAM_CONFIGURED(params, if_area))
caebb1
+			count++;
caebb1
+
caebb1
+		for (rn = route_top(IF_OIFS_PARAMS(ifp)); rn; rn = route_next(rn))
caebb1
+			if ((params = rn->info) && OSPF_IF_PARAM_CONFIGURED(params, if_area))
caebb1
+				count++;
caebb1
+
caebb1
+		if (count > 0) {
caebb1
+			ospf_interface_area_set(ospf, ifp);
caebb1
+			ospf->if_ospf_cli_count += count;
caebb1
+		}
caebb1
+	}
caebb1
+
caebb1
+	ospf_router_id_update(ospf);
caebb1
+}
caebb1
+
caebb1
+struct ospf *ospf_get(unsigned short instance, const char *name, bool *created)
caebb1
+{
caebb1
+	struct ospf *ospf;
caebb1
+
caebb1
 	/* vrf name provided call inst and name based api
caebb1
 	 * in case of no name pass default ospf instance */
caebb1
 	if (name)
caebb1
@@ -402,39 +440,7 @@ struct ospf *ospf_get(unsigned short instance, const char *name, bool *created)
caebb1
 		ospf = ospf_new(instance, name);
caebb1
 		ospf_add(ospf);
caebb1
 
caebb1
-		ospf_opaque_type11_lsa_init(ospf);
caebb1
-
caebb1
-		if (ospf->vrf_id != VRF_UNKNOWN)
caebb1
-			ospf->oi_running = 1;
caebb1
-
caebb1
-		/* Activate 'ip ospf area x' configured interfaces for given
caebb1
-		 * vrf. Activate area on vrf x aware interfaces.
caebb1
-		 * vrf_enable callback calls router_id_update which
caebb1
-		 * internally will call ospf_if_update to trigger
caebb1
-		 * network_run_state
caebb1
-		 */
caebb1
-		vrf = vrf_lookup_by_id(ospf->vrf_id);
caebb1
-
caebb1
-		FOR_ALL_INTERFACES (vrf, ifp) {
caebb1
-			struct ospf_if_params *params;
caebb1
-			struct route_node *rn;
caebb1
-			uint32_t count = 0;
caebb1
-
caebb1
-			params = IF_DEF_PARAMS(ifp);
caebb1
-			if (OSPF_IF_PARAM_CONFIGURED(params, if_area))
caebb1
-				count++;
caebb1
-
caebb1
-			for (rn = route_top(IF_OIFS_PARAMS(ifp)); rn; rn = route_next(rn))
caebb1
-				if ((params = rn->info) && OSPF_IF_PARAM_CONFIGURED(params, if_area))
caebb1
-					count++;
caebb1
-
caebb1
-			if (count > 0) {
caebb1
-				ospf_interface_area_set(ospf, ifp);
caebb1
-				ospf->if_ospf_cli_count += count;
caebb1
-			}
caebb1
-		}
caebb1
-
caebb1
-		ospf_router_id_update(ospf);
caebb1
+		ospf_init(ospf);
caebb1
 	}
caebb1
 
caebb1
 	return ospf;
caebb1
@@ -450,7 +456,7 @@ struct ospf *ospf_get_instance(unsigned short instance, bool *created)
caebb1
 		ospf = ospf_new(instance, NULL /* VRF_DEFAULT*/);
caebb1
 		ospf_add(ospf);
caebb1
 
caebb1
-		ospf_opaque_type11_lsa_init(ospf);
caebb1
+		ospf_init(ospf);
caebb1
 	}
caebb1
 
caebb1
 	return ospf;
caebb1
diff --git a/ospfd/ospfd.h b/ospfd/ospfd.h
caebb1
index 192e54281..3087b735a 100644
caebb1
--- a/ospfd/ospfd.h
caebb1
+++ b/ospfd/ospfd.h
caebb1
@@ -604,7 +604,6 @@ extern int ospf_nbr_nbma_poll_interval_set(struct ospf *, struct in_addr,
caebb1
 					   unsigned int);
caebb1
 extern int ospf_nbr_nbma_poll_interval_unset(struct ospf *, struct in_addr);
caebb1
 extern void ospf_prefix_list_update(struct prefix_list *);
caebb1
-extern void ospf_init(void);
caebb1
 extern void ospf_if_update(struct ospf *, struct interface *);
caebb1
 extern void ospf_ls_upd_queue_empty(struct ospf_interface *);
caebb1
 extern void ospf_terminate(void);